:root {
  --bg: #f4f5f7; --card: #fff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --accent: #d97706; --accent-ink: #fff; --ok: #047857; --ok-bg: #ecfdf5; --err: #b91c1c; --err-bg: #fef2f2;
  --warn-bg: #fffbeb; --radius: 10px;
  --link: #1d4ed8; --nav-bg: #1f2937; --nav-ink: #e5e7eb; --nav-hover: #374151; --brand: #fbbf24;
  --input-bg: #fff; --input-line: #d1d5db; --light-bg: #fff; --chip-bg: #fff; --sunken: #eceff3; --bar-bg: #fff;
  --accent-soft: #fff7ed; --btn-radius: 8px; --input-radius: 8px; --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif); background: var(--bg); color: var(--text); }
a { color: var(--link); }
h1 { font-size: 1.45rem; margin: .2em 0 .6em; }
h2 { font-size: 1.15rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1rem; margin: 1em 0 .4em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 460px; margin: 6vh auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* навигация */
.nav { background: var(--nav-bg); color: var(--nav-ink); position: sticky; top: 0; z-index: 10; }
.nav .wrap { display: flex; gap: 4px; align-items: center; padding: 8px 16px; overflow-x: auto; }
.nav a, .nav button { color: var(--nav-ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: .92rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .nav a.on { background: var(--nav-hover); }
.nav .brand { font-weight: 700; color: var(--brand); margin-right: 8px; }
.nav .sp { flex: 1; }

/* карточки, сетки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.stat b { display: block; font-size: 1.4rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }

/* формы */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--input-line); border-radius: var(--input-radius); background: var(--input-bg); color: var(--text); margin-top: 3px; }
textarea { min-height: 72px; resize: vertical; }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; }
.check { display: flex; align-items: center; color: var(--text); font-size: .95rem; }
button, .btn { display: inline-block; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: var(--btn-radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; text-align: center; }
button:disabled { opacity: .6; cursor: default; }
.btn-light, button.light { background: var(--light-bg); color: var(--text); border-color: var(--input-line); }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-danger, button.danger { background: var(--light-bg); color: var(--err); border-color: #fca5a5; }
.btn-big { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn-sm, button.sm { padding: 4px 10px; font-size: .85rem; font-weight: 500; }
form.inline { display: inline; }

/* сообщения */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err, .error { background: var(--err-bg); color: var(--err); padding: 10px 14px; border-radius: 8px; }
.warn { background: var(--warn-bg); }

/* таблицы */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr.low td { background: var(--warn-bg); }

/* статусы */
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.s-pending { background: #fef3c7; color: #92400e; }
.s-confirmed, .s-in_progress { background: #dbeafe; color: #1e40af; }
.s-done, .s-issued { background: #d1fae5; color: #065f46; }
.s-rejected, .s-cancelled, .s-no_show { background: #fee2e2; color: #991b1b; }
.s-income { background: #d1fae5; color: #065f46; }
.s-expense { background: #fee2e2; color: #991b1b; }

/* онлайн-запись */
.choice { display: block; width: 100%; text-align: left; background: var(--input-bg); color: var(--text); border: 1px solid var(--line); margin-bottom: 8px; font-weight: 400; }
.choice b { display: block; }
.choice.on, .chip.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px #fed7aa inset; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--chip-bg); color: var(--text); border: 1px solid var(--input-line); font-weight: 500; padding: 8px 14px; }

/* история авто, фото */
.timeline { border-left: 3px solid var(--line); padding-left: 16px; margin-left: 6px; }
.timeline .card { position: relative; }
.timeline .card::before { content: ""; position: absolute; left: -25px; top: 20px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos a, .photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.photos figure { margin: 0; font-size: .75rem; color: var(--muted); }
.preview { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.preview img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; }
.comment { border-bottom: 1px dashed var(--line); padding: 6px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* печатные формы */
.printable { background: #fff; text-align: center; padding: 24px; border: 1px dashed #9ca3af; border-radius: 12px; margin: 0 auto 16px; }
.printable img { width: 100%; max-width: 320px; image-rendering: pixelated; }
.sticker { max-width: 300px; }
.poster { max-width: 620px; }
.poster h1 { font-size: 2rem; }
.qr-big img { max-width: 480px; }
@media print {
  .nav, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .printable { border: 0; }
}
@media (max-width: 600px) {
  .wrap { padding: 12px; }
  th, td { padding: 6px; }
  .hide-sm { display: none; }
}

/* ===== клиентское приложение ===== */
body.my { background: var(--bg); }
body.has-tabs { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.my-wrap { max-width: 560px; }
.my-top { display: flex; justify-content: space-between; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bar-bg); border-bottom: 1px solid var(--line); font-weight: 700; position: sticky; top: 0; z-index: 5; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bar-bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs a { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); text-decoration: none; padding: 8px 0 6px; }
.tabs a span { display: block; font-size: 1.3rem; line-height: 1.2; }
.tabs a.tab-main span { color: #fff; background: var(--accent); width: 40px; height: 40px; line-height: 40px; border-radius: 50%; margin: -14px auto 2px; box-shadow: 0 4px 10px rgba(217,119,6,.35); }
.bonus-card { display: block; text-decoration: none; color: #fff; border-radius: 16px; padding: 18px; margin: 12px 0 16px;
  background: linear-gradient(135deg, #d97706, #b45309); box-shadow: 0 6px 18px rgba(180,83,9,.25); }
.bonus-card span { display: block; opacity: .9; }
.bonus-card b { display: block; font-size: 2rem; margin: 2px 0; }
.my-item { display: block; text-decoration: none; color: var(--text); }
.rec { border-left: 4px solid #d1d5db; padding: 6px 0 8px 10px; margin: 8px 0; }
.rec .btn { margin-top: 6px; }
.rec-now { border-color: #dc2626; } .rec-soon { border-color: #f59e0b; } .rec-later { border-color: #9ca3af; }
.u-now { background: #fee2e2; color: #991b1b; } .u-soon { background: #fef3c7; color: #92400e; } .u-later { background: #e5e7eb; color: #374151; }
.features { list-style: none; padding: 0; margin: 0; }
.features li { padding: 6px 0; }
b.plus { color: var(--ok); } b.minus { color: var(--err); }

/* ===== склад ===== */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.subnav a.on { border-color: var(--accent); color: var(--accent); }
.subnav a { padding: 5px 12px; border-radius: 99px; background: var(--chip-bg); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.subnav a:hover { border-color: var(--accent); }
.ps-results { max-height: 320px; overflow: auto; }
.so-draft { background: #fef3c7; color: #92400e; } .so-sent { background: #dbeafe; color: #1e40af; }
.so-received { background: #d1fae5; color: #065f46; } .so-cancelled { background: #fee2e2; color: #991b1b; }
.scanner { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; }
.scanner button { margin: 12px; }
table.bordered { border: 1px solid #000; }
table.bordered th, table.bordered td { border: 1px solid #000; padding: 4px 6px; font-size: .9rem; }
.doc-print .signs { display: flex; justify-content: space-between; margin-top: 40px; }
.doc-print { background: #fff; padding: 20px; }

/* ===== роли ===== */
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2px 16px; margin: 8px 0 12px; }
.perms .check { margin: 0; padding: 4px 0; }

/* ===== отзывы ===== */
.stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: 6px; margin: 10px 0 16px; }
.stars input { display: none; }
.stars label { font-size: 2.6rem; color: #d1d5db; cursor: pointer; margin: 0; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f59e0b; }

/* ===== таймлайн постов ===== */
.tl { display: flex; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tl-hours { position: relative; width: 52px; flex: 0 0 52px; margin-top: 46px; border-right: 1px solid var(--line); }
.tl-hour { position: absolute; left: 4px; font-size: .75rem; color: var(--muted); transform: translateY(-50%); }
.tl-col { flex: 1 0 160px; border-right: 1px solid var(--line); }
.tl-head { height: 46px; padding: 4px 8px; font-weight: 600; font-size: .9rem; border-bottom: 1px solid var(--line); }
.tl-body { position: relative; cursor: copy; }
.tl-body.drop { background: var(--accent-soft); }
.tl-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.tl-now { position: absolute; left: 0; right: 0; border-top: 2px solid #dc2626; z-index: 2; }
.tl-block { position: absolute; left: 4px; right: 4px; padding: 3px 6px; border-radius: 6px; font-size: .75rem; line-height: 1.25;
  overflow: hidden; text-decoration: none; color: inherit; cursor: grab; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  border-bottom: var(--busy) solid rgba(0,0,0,.05); box-sizing: content-box; }
/* ===== живая очередь ===== */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.kan-col { background: var(--sunken); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.kan-col h2 { margin: 4px 4px 8px; font-size: 1rem; }
.kan-card { padding: 10px; margin-bottom: 8px; }
.plate { font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: .04em; }
.svc-chips .chip { display: inline-flex; align-items: center; gap: 4px; }
.svc-chips input { width: auto; margin: 0; }
/* ===== ТВ-экран ===== */
.tv { position: fixed; inset: 0; background: #0f172a; color: #fff; padding: 2vw; overflow: hidden; }
.tv-head { display: flex; justify-content: space-between; font-size: 2.2vw; margin-bottom: 1.5vw; }
.tv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2vw; height: 85vh; }
.tv-col { background: #1e293b; border-radius: 1vw; padding: 1vw; overflow: hidden; }
.tv-col h2 { font-size: 2vw; margin: 0 0 1vw; }
.tv-ready { background: #065f46; }
.tv-card { background: rgba(255,255,255,.08); border-radius: .6vw; padding: .8vw 1vw; margin-bottom: .8vw; display: flex; flex-direction: column; }
.tv-card b { font-size: 2.4vw; font-family: ui-monospace, monospace; }
.tv-card span { font-size: 1.2vw; opacity: .8; }
.tv-empty { opacity: .4; font-size: 1.6vw; }
/* ===== чек-листы и согласование ===== */
.checklist td { vertical-align: middle; }
.cl { display: inline-flex; align-items: center; gap: 3px; margin: 0 6px 0 0; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--text); font-size: .8rem; cursor: pointer; }
.cl input { width: auto; margin: 0; }
.cl-ok:has(input:checked), .badge.cl-ok { background: #d1fae5; } .cl-warn:has(input:checked), .badge.cl-warn { background: #fef3c7; } .cl-bad:has(input:checked), .badge.cl-bad { background: #fee2e2; }
tr.ap-pending td { background: #fffbeb; } tr.ap-declined td { opacity: .5; text-decoration: line-through; }
.photos video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; }
.matrix td, .matrix th { padding: 4px 6px; } .matrix input { padding: 6px 8px; min-width: 72px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.inline-select { width: auto; display: inline-block; padding: 2px 6px; }
.ok-text { color: var(--ok); } .err-text { color: var(--err); }
.act table td, .act table th { border: 1px solid #999; padding: 4px 6px; }
.act table { border-collapse: collapse; width: 100%; }
.num-pos { color: var(--ok); } .num-neg { color: var(--err); }
.nav .wrap { flex-wrap: wrap; row-gap: 4px; }
.bar { display: inline-block; width: calc(100% - 44px); height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar span { display: block; height: 100%; background: var(--accent, #d97706); max-width: 100%; }
.heat td, .heat th { text-align: center; padding: 4px 2px; font-size: .8rem; min-width: 28px; }
.heat td { border: 1px solid var(--card); }


/* ===================== Удобство: мобильное меню, первые шаги, переключатели ===================== */
.nav-toggle { display: none; }
.tabbar { display: none; }
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.hello h1 { margin: 0; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.quick a { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: var(--text); font-weight: 600; box-shadow: var(--shadow); transition: transform .15s; }
.quick a:active { transform: scale(.97); }
.quick a span { font-size: 1.6rem; line-height: 1; }
.quick a small { font-weight: 400; color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border: 0; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 26px; background: var(--sunken); font-size: .85rem; }
.steps li.done .dot { background: var(--ok); color: #fff; }
.steps li.done a { color: var(--muted); text-decoration: line-through; }
.progress { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.settings-nav { position: sticky; top: 64px; z-index: 5; }
/* iOS-переключатель */
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; margin: 0; color: var(--text); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .txt { flex: 1; }
.switch-row .txt b { display: block; font-size: .98rem; }
.switch-row .txt span { font-size: .85rem; color: var(--muted); }
input.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; flex: 0 0 51px; border-radius: 99px; background: var(--sunken);
  position: relative; cursor: pointer; transition: background .2s; border: 0; margin: 2px 0 0; padding: 0; box-shadow: inset 0 0 0 1px var(--line); }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s; }
input.switch:checked { background: #34c759; box-shadow: none; }
input.switch:checked::after { transform: translateX(20px); }
.modgroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 28px; }
.modgroups h3 { margin-top: 14px; }
/* выбор темы */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.theme-card { display: block; margin: 0; cursor: pointer; border-radius: 18px; border: 2px solid var(--line); overflow: hidden; background: var(--card); color: var(--text); }
.theme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-prev { height: 90px; position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 10px; }
.theme-prev i { display: block; border-radius: 10px; height: 46px; flex: 1; border: 1px solid rgba(255,255,255,.5); backdrop-filter: blur(6px); }
.theme-prev i + i { flex: 0 0 34px; height: 22px; border-radius: 99px; border: 0; }
.theme-card .txt { padding: 10px 12px; font-size: .85rem; }
.theme-card .txt b { display: block; font-size: .95rem; }
.theme-card .txt span { color: var(--muted); }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.empty span { display: block; font-size: 2.2rem; margin-bottom: 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
button, .btn, .chip, .subnav a, .nav a { transition: background .15s, transform .12s, box-shadow .15s, border-color .15s; }
button:active, .btn:active { transform: scale(.97); }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; margin-left: auto; }
  .nav .wrap { flex-wrap: wrap; }
  .nav .wrap > a:not(.brand), .nav .wrap > .sp, .nav .wrap > form { display: none; }
  body.nav-open .nav .wrap > a, body.nav-open .nav .wrap > form { display: block; flex: 1 1 45%; }
  body.staff { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20;
    background: var(--bar-bg); border: 1px solid var(--line); border-radius: 28px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
  .tabbar a, .tabbar button { flex: 1; text-align: center; font-size: .68rem; color: var(--muted); text-decoration: none; padding: 6px 0 4px; border-radius: 22px;
    background: none; border: 0; font-weight: 500; }
  .tabbar a span, .tabbar button span { display: block; font-size: 1.25rem; line-height: 1.2; }
  .tabbar a.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .settings-nav { top: 56px; }
}

/* ===================== ТЕМЫ ===================== */
/* Жидкое стекло (iOS 26): полупрозрачные панели с размытием, мягкие блики, «капсулы» */
html[data-theme^="glass"] {
  --radius: 22px; --btn-radius: 999px; --input-radius: 14px;
  --accent: #0a84ff; --accent-ink: #fff; --link: #0a6cdf; --brand: #0a84ff;
  --font: -apple-system, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
}
html[data-theme="glass"], html[data-theme="glass"] body {
  --bg: #eef2f8; --text: #111827; --muted: #5b6473; --line: rgba(15,23,42,.08);
  --card: rgba(255,255,255,.56); --glass-edge: rgba(255,255,255,.75); --sunken: rgba(120,130,150,.14);
  --input-bg: rgba(255,255,255,.62); --input-line: rgba(15,23,42,.10); --light-bg: rgba(255,255,255,.6); --chip-bg: rgba(255,255,255,.55);
  --bar-bg: rgba(255,255,255,.6); --nav-bg: rgba(255,255,255,.55); --nav-ink: #111827; --nav-hover: rgba(255,255,255,.75);
  --ok: #15803d; --ok-bg: rgba(52,199,89,.16); --err: #d70015; --err-bg: rgba(255,59,48,.12); --warn-bg: rgba(255,204,0,.16);
  --accent-soft: rgba(10,132,255,.12);
  --shadow: 0 10px 30px rgba(31,41,80,.08), inset 0 1px 0 rgba(255,255,255,.85);
  --mesh: radial-gradient(1100px 620px at 8% -12%, #c7d7fe 0%, transparent 60%), radial-gradient(900px 620px at 108% 6%, #fbd0e8 0%, transparent 55%),
          radial-gradient(1000px 760px at 50% 118%, #bfe6fd 0%, transparent 60%), radial-gradient(700px 500px at 85% 70%, #fde7c3 0%, transparent 55%), #eef2f8;
}
html[data-theme="glass-dark"], html[data-theme="glass-dark"] body {
  color-scheme: dark;
  --bg: #0b0d14; --text: #f5f5f7; --muted: #a1a1b3; --line: rgba(255,255,255,.10);
  --card: rgba(36,38,52,.52); --glass-edge: rgba(255,255,255,.14); --sunken: rgba(255,255,255,.08);
  --input-bg: rgba(255,255,255,.07); --input-line: rgba(255,255,255,.14); --light-bg: rgba(255,255,255,.08); --chip-bg: rgba(255,255,255,.07);
  --bar-bg: rgba(30,32,44,.6); --nav-bg: rgba(30,32,44,.55); --nav-ink: #f5f5f7; --nav-hover: rgba(255,255,255,.12);
  --link: #64b5ff; --ok: #32d74b; --ok-bg: rgba(50,215,75,.14); --err: #ff6961; --err-bg: rgba(255,69,58,.16); --warn-bg: rgba(255,214,10,.10);
  --accent-soft: rgba(10,132,255,.2);
  --shadow: 0 10px 34px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.10);
  --mesh: radial-gradient(1100px 620px at 8% -12%, #2f2a7a 0%, transparent 60%), radial-gradient(900px 620px at 108% 6%, #5b1d6e 0%, transparent 55%),
          radial-gradient(1000px 760px at 50% 118%, #0c4a6e 0%, transparent 60%), #0b0d14;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="glass"], html[data-theme="glass"] body {
    color-scheme: dark;
    --bg: #0b0d14; --text: #f5f5f7; --muted: #a1a1b3; --line: rgba(255,255,255,.10);
    --card: rgba(36,38,52,.52); --glass-edge: rgba(255,255,255,.14); --sunken: rgba(255,255,255,.08);
    --input-bg: rgba(255,255,255,.07); --input-line: rgba(255,255,255,.14); --light-bg: rgba(255,255,255,.08); --chip-bg: rgba(255,255,255,.07);
    --bar-bg: rgba(30,32,44,.6); --nav-bg: rgba(30,32,44,.55); --nav-ink: #f5f5f7; --nav-hover: rgba(255,255,255,.12);
    --link: #64b5ff; --ok: #32d74b; --ok-bg: rgba(50,215,75,.14); --err: #ff6961; --err-bg: rgba(255,69,58,.16); --warn-bg: rgba(255,214,10,.10);
    --accent-soft: rgba(10,132,255,.2);
    --shadow: 0 10px 34px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.10);
    --mesh: radial-gradient(1100px 620px at 8% -12%, #2f2a7a 0%, transparent 60%), radial-gradient(900px 620px at 108% 6%, #5b1d6e 0%, transparent 55%),
            radial-gradient(1000px 760px at 50% 118%, #0c4a6e 0%, transparent 60%), #0b0d14;
  }
}
html[data-theme^="glass"] body { font-family: var(--font); background: var(--mesh); background-attachment: fixed; letter-spacing: -.005em; }
html[data-theme^="glass"] :is(.card, .stat, .quick a, .tl, .kan-col, .tabbar, .tabs, .my-top, .theme-card, .subnav a, .chip, .choice, .btn-light, button.light, .btn-danger, button.danger) {
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border-color: var(--glass-edge);
}
html[data-theme^="glass"] .card, html[data-theme^="glass"] .stat { position: relative; }
html[data-theme^="glass"] .kan-col { background: var(--sunken); }
html[data-theme^="glass"] .kan-card { background: var(--card); }
/* «плавающая» стеклянная панель навигации */
html[data-theme^="glass"] .nav { background: transparent; padding: 10px 12px 0; }
html[data-theme^="glass"] .nav .wrap { background: var(--nav-bg); -webkit-backdrop-filter: blur(28px) saturate(190%); backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-edge); border-radius: 26px; box-shadow: var(--shadow); padding: 6px 8px; }
html[data-theme^="glass"] .nav a { border-radius: 99px; font-weight: 500; }
html[data-theme^="glass"] .nav a.on { background: var(--accent-soft); color: var(--accent); }
html[data-theme^="glass"] .nav .brand { font-weight: 700; }
html[data-theme^="glass"] button:not(.light):not(.danger):not(.choice):not(.chip):not(.cl):not([data-nav-toggle]),
html[data-theme^="glass"] .btn:not(.btn-light):not(.btn-danger) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff) 0%, var(--accent) 60%);
  border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.45);
}
html[data-theme^="glass"] .btn-ok, html[data-theme^="glass"] button.btn-ok { --accent: #34c759; }
html[data-theme^="glass"] .btn-light, html[data-theme^="glass"] button.light { box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
html[data-theme^="glass"] .badge { border-radius: 99px; }
html[data-theme^="glass"] th { color: var(--muted); }
html[data-theme^="glass"] .flash { border-radius: 16px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
html[data-theme^="glass"] .tabbar, html[data-theme^="glass"] .tabs { border-radius: 30px; }
html[data-theme^="glass"] .tabs { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); border: 1px solid var(--glass-edge); padding-bottom: 0; box-shadow: var(--shadow); }
html[data-theme^="glass"] .my-top { background: var(--bar-bg); border-bottom: 0; }
html[data-theme^="glass"] .bonus-card { background: linear-gradient(135deg, #0a84ff, #5e5ce6); box-shadow: 0 12px 30px rgba(10,132,255,.35); }
html[data-theme^="glass"] .tabs a.tab-main span { box-shadow: 0 6px 16px rgba(10,132,255,.4); }
html[data-theme="glass-dark"] :is(.s-pending, .s-confirmed, .s-in_progress, .s-done, .s-issued, .s-rejected, .s-cancelled, .s-no_show, .s-income, .s-expense, .badge) { filter: saturate(1.1) brightness(.92); }

/* Графит: тёмная матовая, без прозрачности */
html[data-theme="graphite"], html[data-theme="graphite"] body {
  color-scheme: dark;
  --bg: #111418; --card: #1b1f24; --text: #e7e9ec; --muted: #9aa3ad; --line: #2a3038; --sunken: #15191e;
  --input-bg: #14181c; --input-line: #343b44; --light-bg: #232830; --chip-bg: #1f242b; --bar-bg: #171b20;
  --nav-bg: #0b0d10; --nav-ink: #d5d9de; --nav-hover: #232830; --brand: #f59e0b; --accent: #f59e0b; --accent-ink: #111;
  --link: #7cb7ff; --ok: #34d399; --ok-bg: rgba(52,211,153,.12); --err: #f87171; --err-bg: rgba(248,113,113,.12); --warn-bg: rgba(245,158,11,.10);
  --accent-soft: rgba(245,158,11,.14); --radius: 12px;
}
/* Крупная контрастная: для планшета в боксе и работы в перчатках */
html[data-theme="contrast"] body { font-size: 18px; }
html[data-theme="contrast"], html[data-theme="contrast"] body {
  --bg: #fff; --card: #fff; --text: #000; --muted: #374151; --line: #6b7280; --accent: #0047ab; --link: #0040a0; --nav-bg: #000; --nav-ink: #fff;
  --nav-hover: #1f2937; --brand: #ffd400; --input-line: #374151; --accent-soft: #e0ecff; --radius: 12px; --btn-radius: 12px;
}
html[data-theme="contrast"] :is(button, .btn) { padding: 13px 20px; font-size: 1.02rem; }
html[data-theme="contrast"] button.sm { padding: 8px 14px; }
html[data-theme="contrast"] :is(input, select, textarea) { padding: 12px; border-width: 2px; }
html[data-theme="contrast"] .card, html[data-theme="contrast"] .stat { border-width: 2px; }

@media print {
  html[data-theme] body { background: #fff !important; color: #000; }
  html[data-theme] .card { background: #fff; box-shadow: none; backdrop-filter: none; }
  .tabbar { display: none !important; }
}

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 200;
  padding: 10px 18px; border-radius: 99px; background: rgba(20,22,30,.85); color: #fff; font-size: .92rem; pointer-events: none;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: rgba(215,0,21,.9); }
@media (min-width: 761px) { .toast { bottom: 28px; } }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip input[type=radio], .chip input[type=checkbox] { width: auto; margin: 0 6px 0 0; accent-color: var(--accent); }
.chips label.chip { display: inline-flex; align-items: center; gap: 2px; margin: 0; border-radius: 99px; color: var(--text); font-size: .9rem; }

.daybars { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 6px; }
.daybars > div { flex: 1; display: flex; align-items: flex-end; gap: 1px; height: 100%; }
.daybars span { flex: 1; border-radius: 4px 4px 0 0; min-height: 2px; }
.b1 { background: var(--accent); } .b2 { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 8px; }
.add-bot > summary { list-style: none; cursor: pointer; display: inline-block; }
.add-bot > summary::-webkit-details-marker { display: none; }

/* ===== сайт сервиса ===== */
.site { max-width: 820px; margin: 0 auto; }
.site-hero { text-align: center; padding: 28px 18px; }
.site-hero h1 { font-size: 2rem; margin: 10px 0 6px; }
.site-rating { font-size: 1.1rem; margin: 0 0 8px; }
.site-about { font-size: 1.05rem; max-width: 600px; margin: 8px auto; }
.site-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.site-actions .btn-big { width: auto; min-width: 230px; }
.site-hero .chips { justify-content: center; }
.site-hero a.chip { text-decoration: none; border-radius: 99px; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.login-plain { margin-top: 14vh; max-width: 380px; }
.login-plain h1 { text-align: center; }
.policy { white-space: pre-line; max-height: 46vh; overflow: auto; padding: 12px 14px; border-radius: 14px; background: var(--sunken); font-size: .9rem; margin: 12px 0; }
.inline-quota { display: inline-flex; gap: 4px; align-items: center; margin-top: 4px; }
.inline-quota input { width: 70px; padding: 3px 6px; margin: 0; }

/* Окно «Сообщить об ошибке» */
.bug-dialog { border: none; border-radius: 20px; padding: 20px; max-width: 480px; width: calc(100% - 32px); background: var(--card, #fff); color: inherit; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.bug-dialog::backdrop { background: rgba(10,15,30,.45); backdrop-filter: blur(4px); }
.bug-dialog textarea { width: 100%; }

/* печатные документы: шапка с реквизитами, таблица «поле — значение» */
.doc-print { color: #000; }
.doc-print h1, .doc-print h2 { color: #000; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; white-space: pre-line; font-size: .85rem; }
table.kv-print th { width: 32%; text-align: left; font-weight: 600; }
.doc-print .signs > div { min-width: 40%; border-top: 1px solid #000; padding-top: 4px; font-size: .85rem; }
@media print { .doc-print { padding: 0; } body { background: #fff !important; } }

/* переписка с клиентом */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; margin-bottom: 10px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg .small { display: block; margin-top: 2px; }
.msg-in { align-self: flex-start; background: var(--card2, rgba(127,127,127,.12)); border-bottom-left-radius: 4px; }
.msg-out { align-self: flex-end; background: color-mix(in srgb, var(--accent, #0a84ff) 18%, transparent); border-bottom-right-radius: 4px; }
.unread { font-weight: 700; }
.sub-card { border-left: 4px solid var(--accent, #0a84ff); }
.flash.warn { background: rgba(255, 159, 10, .16); color: inherit; border: 1px solid rgba(255, 159, 10, .45); }
.catalog-card h2 { margin: 0 0 4px; }
.catalog-card .svc { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.catalog-card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cat-star { color: #ff9f0a; font-weight: 600; white-space: nowrap; }
/* конструктор отчётов */
.rb-chart { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.rb-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: .92rem; }
.rb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-bar { background: rgba(127,127,127,.12); border-radius: 6px; height: 14px; overflow: hidden; }
.rb-bar i { display: block; height: 100%; background: var(--accent, #0a84ff); border-radius: 6px; min-width: 2px; }
.rb-val { white-space: nowrap; }

/* ---------- аватарки */
.ava { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; background: var(--sunken); }
.ava-i { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; line-height: 1; vertical-align: middle; border-radius: 50%; flex: none; }
.nav a.me { display: inline-flex; align-items: center; gap: 6px; }
.sm-file { cursor: pointer; font-size: 1.1rem; padding: 2px 6px; border-radius: 8px; border: 1px solid var(--line); display: inline-block; }
.avatar-mini { display: inline-flex; gap: 4px; align-items: center; }
.masters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.master { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ---------- контроль заказов */
.progress i { display: block; height: 100%; background: var(--accent, #0a84ff); border-radius: 99px; }
.warn-text { color: #b45309; } .bad-text { color: #b91c1c; font-weight: 600; }
.card.control { border-left: 4px solid var(--accent, #0a84ff); }
.card.control.late { border-left-color: #dc2626; }
.ctl-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ctl-cell b { display: block; font-size: 1.05rem; }
.qc { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qc details { flex-basis: 100%; }
.badge.js-todo { background: #e5e7eb; } .badge.js-doing { background: #dbeafe; color: #1d4ed8; }
.badge.js-paused { background: #fef3c7; color: #92400e; } .badge.js-done { background: #d1fae5; color: #065f46; }
tr.js-doing td:first-child { box-shadow: inset 3px 0 0 #2563eb; }
.events { list-style: none; padding: 0; margin: 10px 0 0; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.events .ev-overdue, .events .ev-qc { background: rgba(220,38,38,.05); }
.board-sum .stat.bad b { color: #b91c1c; } .board-sum .stat.warn b { color: #b45309; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px; }
.board-col { background: var(--sunken); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.board-col h2 { font-size: 1rem; margin: 0 0 4px; display: flex; justify-content: space-between; }
.board-col .count { background: var(--card); border-radius: 99px; padding: 0 8px; font-size: .85rem; }
.bcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-top: 8px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.bcard.late { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626 inset; }
.bcard.soon { border-color: #f59e0b; }
.bcard.running { border-left: 4px solid #2563eb; }
.bc-top { display: flex; justify-content: space-between; align-items: baseline; }
.bc-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.bc-masters { display: flex; gap: 2px; margin-top: 6px; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; } .board-col { scroll-snap-align: start; } }

/* Меню разделов настроек: одна строка с прокруткой вбок и плотным фоном — не налезает на содержимое */
.settings-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 8px 6px; margin-left: -6px; margin-right: -6px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--bg); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
html[data-theme^="glass"] .settings-nav { background: color-mix(in srgb, var(--bar-bg) 70%, var(--bg)); backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6); }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav a { flex: none; white-space: nowrap; }
@media (max-width: 700px) { .settings-nav { position: static; } } /* на телефоне не прилипает: шапка там своя, а место на экране дороже */
/* Стекло плотнее: под шапкой, меню разделов и нижней панелью текст не читается насквозь */
html[data-theme^="glass"], html[data-theme^="glass"] body { --nav-bg: rgba(255,255,255,.86); --bar-bg: rgba(255,255,255,.88); }
html[data-theme="glass-dark"], html[data-theme="glass-dark"] body { --nav-bg: rgba(24,26,36,.88); --bar-bg: rgba(24,26,36,.9); }
@media (prefers-color-scheme: dark) { html[data-theme="glass"], html[data-theme="glass"] body { --nav-bg: rgba(24,26,36,.88); --bar-bg: rgba(24,26,36,.9); } }
html[data-theme^="glass"] .tabbar { background: var(--bar-bg); }
html[data-theme^="glass"] .nav, html[data-theme^="glass"] .tabbar { backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8); }
