/* Mobi Pro CRM — дизайн-токены и компоненты.
   Графит + один акцент (фиолетовые чернила). Красный — просрочка, янтарный — риск, зелёный — готово.
   Цвет всегда дублируется значком и текстом. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f9fafb; --sunken: #eceef1;
  --ink: #1d2025; --ink-2: #474d56; --muted: #6b727c; --line: #e2e5e9; --line-2: #d3d7dd;
  --accent: #5442d6; --accent-ink: #ffffff; --accent-soft: #ecebfc; --accent-line: #c9c3f5;
  --red: #c62f2f; --red-soft: #fdecec; --amber: #a86a00; --amber-soft: #fff4dc; --green: #18834a; --green-soft: #e5f5ec;
  --slate: #4a5260; --slate-soft: #e9ebef;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --r-s: 6px; --r-m: 10px; --r-l: 14px;
  --sh-pop: 0 12px 32px -8px rgb(20 24 32 / .22), 0 2px 6px rgb(20 24 32 / .08);
  --font: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 12px; --fs-s: 13px; --fs-m: 14px; --fs-l: 16px; --fs-xl: 20px; --fs-xxl: 28px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #131518; --surface: #1b1e22; --surface-2: #202328; --sunken: #26292f; --ink: #e9ebee; --ink-2: #c3c8cf; --muted: #9098a3; --line: #2c3036; --line-2: #3a3f46;
  --accent: #8f82ff; --accent-ink: #14121f; --accent-soft: #26233f; --accent-line: #4a4386; --red: #ff6b66; --red-soft: #3a1f20; --amber: #f2b33d; --amber-soft: #382c14; --green: #4cc982; --green-soft: #183224; --slate: #aab2bf; --slate-soft: #2a2e35; color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #131518; --surface: #1b1e22; --surface-2: #202328; --sunken: #26292f; --ink: #e9ebee; --ink-2: #c3c8cf; --muted: #9098a3; --line: #2c3036; --line-2: #3a3f46;
  --accent: #8f82ff; --accent-ink: #14121f; --accent-soft: #26233f; --accent-line: #4a4386; --red: #ff6b66; --red-soft: #3a1f20; --amber: #f2b33d; --amber-soft: #382c14; --green: #4cc982; --green-soft: #183224; --slate: #aab2bf; --slate-soft: #2a2e35; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: var(--fs-m)/1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-s); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-s); text-decoration: none; color: var(--ink-2); }
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .badge { margin-left: auto; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 10px; }
.side-foot { margin-top: auto; padding: 10px; font-size: var(--fs-s); color: var(--muted); }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding: 8px 12px 8px 34px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); }
.search .ico { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search kbd { position: absolute; right: 9px; top: 8px; }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--sh-pop); max-height: 60vh; overflow: auto; padding: 6px; }
.search-pop a { display: block; padding: 8px 10px; border-radius: var(--r-s); text-decoration: none; }
.search-pop a:hover, .search-pop a.active { background: var(--sunken); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { padding: 22px 24px 80px; max-width: 1480px; width: 100%; }
.banner { margin: 0 24px; margin-top: 12px; padding: 10px 14px; border-radius: var(--r-m); border: 1px solid; display: flex; gap: 10px; align-items: center; font-size: var(--fs-s); }
.banner.err { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--red); }
.banner.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 40%, transparent); color: var(--amber); }
.banner.test { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ---------- типографика ---------- */
h1 { font-size: var(--fs-xxl); line-height: 1.15; letter-spacing: -.02em; margin: 0; font-weight: 680; }
h2 { font-size: var(--fs-l); margin: 0; font-weight: 640; letter-spacing: -.005em; }
h3 { font-size: var(--fs-m); margin: 0; font-weight: 620; }
.muted { color: var(--muted); } .small { font-size: var(--fs-s); } .xs { font-size: var(--fs-xs); }
.num { font-variant-numeric: tabular-nums; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 520; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 28px; padding: 0 9px; font-size: var(--fs-s); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.busy { pointer-events: none; opacity: .7; }
.icon-btn { width: 34px; padding: 0; }
kbd { font: 11px var(--font); color: var(--muted); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
.field { display: grid; gap: 5px; }
.field > span { font-size: var(--fs-s); color: var(--ink-2); font-weight: 520; }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); }
textarea.input { min-height: 76px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.input[aria-invalid="true"] { border-color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-s); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: var(--fs-s); color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); font-weight: 600; }
.chip .n { margin-left: 4px; color: var(--muted); }

/* ---------- состояние сроков: цвет + значок + текст ---------- */
.lvl { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 620; white-space: nowrap; border: 1px solid transparent; }
.lvl svg { width: 13px; height: 13px; }
.lvl-overdue { color: var(--red); background: var(--red-soft); }
.lvl-high_risk { color: var(--amber); background: var(--amber-soft); }
.lvl-soon { color: var(--amber); background: transparent; border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.lvl-blocked { color: var(--slate); background: repeating-linear-gradient(135deg, var(--slate-soft) 0 6px, transparent 6px 10px); border-color: var(--line-2); }
.lvl-needs_promise { color: var(--accent); background: transparent; border: 1px dashed var(--accent-line); }
.lvl-on_time { color: var(--green); background: var(--green-soft); }
.lvl-ready { color: var(--green); background: var(--green-soft); }
.lvl-done { color: var(--muted); background: var(--sunken); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--line-2); }
.st-diagnostics::before, .st-repair::before, .st-quality_check::before { background: var(--accent); }
.st-awaiting_approval::before, .st-waiting_parts::before { background: transparent; border: 1.5px solid var(--slate); }
.st-ready::before { background: var(--green); } .st-refused::before, .st-cancelled::before { background: var(--red); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.tag { font-size: var(--fs-xs); padding: 1px 6px; border-radius: 4px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.tag.urgent { background: var(--red-soft); color: var(--red); font-weight: 650; }
.tag.test { background: var(--accent-soft); color: var(--accent); font-weight: 650; }

/* ---------- панели и списки ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel-head .count { font-weight: 650; }
.panel-head .more { margin-left: auto; font-size: var(--fs-s); color: var(--accent); text-decoration: none; }
.panel-body { padding: 14px 16px; }
.empty { padding: 22px 16px; color: var(--muted); font-size: var(--fs-s); }

/* строка заказа (главный экран, «Мой день») */
.orow { display: grid; grid-template-columns: 4px minmax(0, 1fr) minmax(0, 1.25fr) auto; gap: 12px; align-items: center; padding: 10px 16px 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.orow:first-child { border-top: 0; }
.orow:hover { background: var(--surface-2); }
.orow .rail { align-self: stretch; border-radius: 0 3px 3px 0; }
.rail-overdue { background: var(--red); } .rail-high_risk, .rail-soon { background: var(--amber); } .rail-blocked { background: repeating-linear-gradient(180deg, var(--slate) 0 4px, transparent 4px 7px); }
.rail-needs_promise { background: var(--accent-line); } .rail-on_time, .rail-ready { background: var(--green); } .rail-done { background: var(--line); }
.orow .who { min-width: 0; display: grid; gap: 2px; }
.orow .t1 { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.orow .t1 .tag { flex: none; }
.orow .t1 b { font-weight: 640; white-space: nowrap; }
.orow .t1 > span:last-child { min-width: 0; }
.orow .t1 > span:last-child, .orow .t2 { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow .t2 { color: var(--muted); font-size: var(--fs-s); }
.orow .why { min-width: 0; font-size: var(--fs-s); display: grid; gap: 3px; }
.orow .why .h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.orow .why .r { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow .why .n { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* таблица */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-s); }
.t th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 560; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover td { background: var(--surface-2); }
.t td.first { border-left: 3px solid transparent; }
.t .clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* канбан */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--sunken); border-radius: var(--r-l); padding: 8px; min-height: 120px; }
.col-head { display: flex; justify-content: space-between; padding: 4px 6px 8px; font-weight: 620; font-size: var(--fs-s); }
.col.drop-ok { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col.drop-no { opacity: .55; }
.kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 11px; margin-bottom: 8px; cursor: grab; text-decoration: none; border-left-width: 3px; }
.kcard:hover { border-color: var(--line-2); }
.kcard.dragging { opacity: .5; }
.kcard .k1 { display: flex; justify-content: space-between; gap: 6px; font-size: var(--fs-s); }
.kcard .k2 { font-weight: 600; margin: 4px 0 2px; }
.kcard .k3 { font-size: var(--fs-xs); color: var(--muted); }
.kcard .k4 { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* ---------- блок сроков в карточке: главный элемент интерфейса ---------- */
.clock { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.clock-main { padding: 18px 20px; border-right: 1px solid var(--line); }
.clock-state { display: flex; align-items: center; gap: 10px; }
.clock-big { font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; margin: 10px 0 2px; }
.clock-big.overdue { color: var(--red); } .clock-big.risk { color: var(--amber); } .clock-big.none { color: var(--accent); font-size: 26px; }
.clock-sub { color: var(--ink-2); }
.ruler { position: relative; margin: 18px 0 6px; height: 34px; }
.ruler .track { position: absolute; left: 0; right: 0; top: 13px; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.ruler .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink-2); border-radius: 4px; }
.ruler .fill.overdue { background: var(--red); } .ruler .fill.risk { background: var(--amber); } .ruler .fill.ok { background: var(--green); }
.ruler .closed { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(90deg, transparent 0 3px, color-mix(in srgb, var(--ink) 9%, transparent) 3px 4px); }
.ruler .mark { position: absolute; top: 4px; width: 2px; height: 26px; background: var(--ink); border-radius: 1px; }
.ruler .mark.proposed { background: var(--accent); height: 26px; }
.ruler .mark.original { background: var(--muted); }
.ruler .lbl { position: absolute; top: -2px; transform: translateX(-50%) translateY(-100%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.ruler-legend { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }
.clock-side { padding: 14px 18px; display: grid; gap: 2px; align-content: start; background: var(--surface-2); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-s); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 560; }
.reasons { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.reasons li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-s); }
.reasons li svg { margin-top: 2px; }
.gaps { margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); }

.next { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r-l); }
.next.late { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.next.none { border-style: dashed; }
.next .lbl { font-size: var(--fs-xs); color: var(--muted); }
.next .ttl { font-weight: 640; font-size: var(--fs-l); }

.order-head { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; }
.order-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: var(--fs-s); margin-top: 6px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.section { margin-top: 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: var(--fs-s); }
.timeline li:first-child { border-top: 0; }
.timeline .when { color: var(--muted); font-size: var(--fs-xs); }
.timeline .what b { font-weight: 600; }
.timeline .note { color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; }
.timeline li.test .what { color: var(--accent); }
.items { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
.items td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.items td:last-child { text-align: right; white-space: nowrap; }
.items tr.total td { font-weight: 700; border-bottom: 0; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); }

/* сводка и загрузка */
.summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; margin-bottom: 18px; }
.summary a { padding: 14px 16px; text-decoration: none; border-left: 1px solid var(--line); display: grid; gap: 2px; }
.summary a:first-child { border-left: 0; }
.summary a:hover { background: var(--surface-2); }
.summary .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.summary .k { font-size: var(--fs-s); color: var(--muted); }
.summary a.hot .v { color: var(--red); } .summary a.warm .v { color: var(--amber); }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash .wide { grid-column: 1 / -1; }
.load { display: grid; grid-template-columns: 120px 1fr 120px; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: var(--fs-s); }
.load:first-child { border-top: 0; }
.bar { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); border-radius: 4px; }
.bar i.over { background: var(--red); } .bar i.high { background: var(--amber); }
.bar .cap { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }

/* диалог */
dialog { border: 0; padding: 0; border-radius: var(--r-l); box-shadow: var(--sh-pop); background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgb(15 17 21 / .38); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-head { padding: 16px 18px 6px; } .dlg-head p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-s); }
.dlg-body { padding: 12px 18px; overflow: auto; display: grid; gap: 12px; }
.dlg-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.err-box { padding: 10px 12px; border-radius: var(--r-s); background: var(--red-soft); color: var(--red); font-size: var(--fs-s); }
.err-box ul { margin: 4px 0 0; padding-left: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }

/* уведомления, тосты */
.pop { position: absolute; right: 24px; top: 54px; width: min(420px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-pop); max-height: 70vh; overflow: auto; z-index: 40; }
.notif { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--line); font-size: var(--fs-s); }
.notif.unread { background: var(--surface-2); }
.notif .sev-critical { color: var(--red); font-weight: 620; } .notif .sev-warning { color: var(--amber); font-weight: 620; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(460px, calc(100vw - 24px)); }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: var(--r-m); box-shadow: var(--sh-pop); font-size: var(--fs-s); animation: up .18s ease-out; }
.toast.err { background: var(--red); color: #fff; }
@keyframes up { from { transform: translateY(6px); opacity: 0; } }
.save-state { font-size: var(--fs-xs); color: var(--muted); }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: sh 1.2s infinite linear; margin: 10px 0; }
@keyframes sh { to { background-position: -200% 0; } }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .panel { width: min(380px, 100%); padding: 26px; }
.login h1 { font-size: 22px; margin: 14px 0 4px; }

/* мобильная навигация */
.tabbar { display: none; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } .summary { grid-template-columns: repeat(3, 1fr); } .summary a:nth-child(4) { border-left: 0; } .summary a:nth-child(n+4) { border-top: 1px solid var(--line); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 8px 12px; }
  .content { padding: 14px 12px 96px; }
  .banner { margin: 10px 12px 0; }
  .dash, .grid2, .grid3 { grid-template-columns: 1fr; }
  .clock { grid-template-columns: 1fr; } .clock-main { border-right: 0; border-bottom: 1px solid var(--line); }
  .orow { grid-template-columns: 4px minmax(0, 1fr) auto; } .orow .why { grid-column: 2 / -1; }
  .next { grid-template-columns: 1fr; }
  .search kbd, .top-right .tag.test { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; min-height: 44px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .ico { width: 20px; height: 20px; }
  .btn { height: 40px; } .btn.sm { height: 34px; }
  .load { grid-template-columns: 90px 1fr; } .load .lr { grid-column: 1 / -1; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  h1 { font-size: 22px; }
  .clock-big { font-size: 28px; }
}
.kcard .k4 select { flex: 1 1 auto; min-width: 0; max-width: 58%; width: auto; }

/* =====================================================================
   Оформление в духе Битрикс24: тёмная боковая панель, голубой акцент,
   салатовая главная кнопка, белые карточки на светло-голубом фоне,
   цветные этапы-стрелки в канбане, кружки с инициалами.
   ===================================================================== */
:root {
  --bg: #eef2f4; --surface: #ffffff; --surface-2: #f5f7f8; --sunken: #e9eef1;
  --ink: #333a41; --ink-2: #525c69; --muted: #828b95; --line: #e3e8ec; --line-2: #d5dce1;
  --accent: #2067b0; --accent-ink: #ffffff; --accent-soft: #e5f4fb; --accent-line: #a9dff4;
  --brand: #2fc6f6; --brand-ink: #ffffff;
  --cta: #bbed21; --cta-hover: #d2f95f; --cta-ink: #535c69;
  --side-bg: #1f2b38; --side-ink: #c4ccd5; --side-ink-strong: #ffffff; --side-hover: rgba(255,255,255,.08); --side-active: rgba(47,198,246,.18);
  --wall: linear-gradient(180deg, #cfe7f3 0, #eef2f4 260px);
  --sh-card: 0 1px 2px rgba(83,92,105,.08), 0 2px 8px rgba(83,92,105,.06);
  --r-m: 10px; --r-l: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #161d24; --surface: #1f2730; --surface-2: #242d37; --sunken: #2a3440; --ink: #e6ebf0; --ink-2: #c0c9d2; --muted: #8e99a5; --line: #2f3a46; --line-2: #3b4855;
  --accent: #5fc4f3; --accent-ink: #0d1720; --accent-soft: #1d3442; --accent-line: #2d5a72; --brand: #2fc6f6; --brand-ink: #0d1720;
  --cta: #a8dd10; --cta-hover: #bdeb3a; --cta-ink: #1c2408;
  --side-bg: #10161d; --side-ink: #aab5c0; --side-ink-strong: #ffffff; --side-hover: rgba(255,255,255,.06); --side-active: rgba(47,198,246,.16);
  --wall: linear-gradient(180deg, #1b2a36 0, #161d24 260px); --sh-card: 0 1px 2px rgba(0,0,0,.3);
} }
:root[data-theme="dark"] {
  --bg: #161d24; --surface: #1f2730; --surface-2: #242d37; --sunken: #2a3440; --ink: #e6ebf0; --ink-2: #c0c9d2; --muted: #8e99a5; --line: #2f3a46; --line-2: #3b4855;
  --accent: #5fc4f3; --accent-ink: #0d1720; --accent-soft: #1d3442; --accent-line: #2d5a72; --brand: #2fc6f6; --brand-ink: #0d1720;
  --cta: #a8dd10; --cta-hover: #bdeb3a; --cta-ink: #1c2408;
  --side-bg: #10161d; --side-ink: #aab5c0; --side-ink-strong: #ffffff; --side-hover: rgba(255,255,255,.06); --side-active: rgba(47,198,246,.16);
  --wall: linear-gradient(180deg, #1b2a36 0, #161d24 260px); --sh-card: 0 1px 2px rgba(0,0,0,.3);
}
body { font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif; background: var(--bg) var(--wall) no-repeat; }
h1 { font-weight: 600; letter-spacing: -.01em; }
h2 { font-weight: 600; }

/* боковая панель */
.side { background: var(--side-bg); border-right: 0; color: var(--side-ink); }
.brand { color: var(--side-ink-strong); }
.brand-mark { background: var(--brand); color: #fff; border-radius: 50%; }
.nav a { color: var(--side-ink); border-radius: 8px; padding: 9px 12px; }
.nav a .ico { opacity: .85; }
.nav a:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.nav a[aria-current="page"] { background: var(--side-active); color: var(--side-ink-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav-sep { background: rgba(255,255,255,.1); }
.side-foot { color: var(--side-ink); }
.side-foot b { color: var(--side-ink-strong); }
.side-foot .btn.ghost { color: var(--side-ink); }
.side-foot .btn.ghost:hover { background: var(--side-hover); color: #fff; }

/* верхняя панель */
.top { background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--line); }
.search input { background: var(--surface-2); border-color: transparent; border-radius: 20px; }
.search input:focus { background: var(--surface); border-color: var(--brand); }

/* кнопки */
.btn { border-radius: 18px; padding: 0 16px; font-weight: 600; font-size: 13px; letter-spacing: .01em; border-color: var(--line-2); }
.btn.sm { border-radius: 14px; padding: 0 12px; font-size: 12px; }
.btn.primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.btn.primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn.ghost { color: var(--accent); }
.icon-btn { border-radius: 50%; }
.seg { border-radius: 18px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.chip { border-radius: 16px; background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.input, select.input, textarea.input { border-radius: 8px; }
.input:focus { border-color: var(--brand); }

/* карточки и панели — без рамок, с мягкой тенью */
.panel, .table-wrap, .summary, .clock { border: 0; box-shadow: var(--sh-card); border-radius: var(--r-l); }
.panel-head { border-bottom-color: var(--line); }
.panel-head h2 { font-size: 15px; }
.summary { gap: 10px; background: transparent; box-shadow: none; overflow: visible; }
.summary a { background: var(--surface); border: 0; border-radius: var(--r-l); box-shadow: var(--sh-card); border-top: 4px solid var(--brand); }
.summary a:first-child { border-top-color: #ff5752; }
.summary a:nth-child(2) { border-top-color: #ffa900; }
.summary a:nth-child(3) { border-top-color: #2fc6f6; }
.summary a:nth-child(4) { border-top-color: #9b8af5; }
.summary a:nth-child(5) { border-top-color: #3e9cf5; }
.summary a:nth-child(6) { border-top-color: #7bd500; }
.summary a:hover { background: var(--surface); transform: translateY(-1px); transition: transform .12s; }
@media (max-width: 1100px) { .summary a:nth-child(n+4) { border-top: 4px solid; } .summary a:nth-child(4) { border-top-color: #9b8af5; } .summary a:nth-child(5) { border-top-color: #3e9cf5; } .summary a:nth-child(6) { border-top-color: #7bd500; } }
.t th { background: var(--surface-2); text-transform: none; font-weight: 600; color: var(--muted); }
.t td.first { border-left-width: 4px; }

/* статусы — цветные плашки этапов */
.status { padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #fff; background: var(--c, #a8adb4); }
.status::before { display: none; }
.st-accepted { --c: #47c8f5; } .st-diagnostics { --c: #3e9cf5; } .st-awaiting_approval { --c: #ffa900; } .st-waiting_parts { --c: #9b8af5; }
.st-repair { --c: #00b4ac; } .st-quality_check { --c: #55b700; } .st-ready { --c: #7bd500; } .st-refused { --c: #ff5752; }
.st-issued { --c: #a8adb4; } .st-closed { --c: #a8adb4; } .st-cancelled { --c: #c3c7cc; }

/* канбан: заголовки этапов — цветные стрелки */
.board { gap: 10px; }
.col { background: transparent; padding: 0; }
.col-head { position: relative; margin-bottom: 10px; padding: 9px 22px 9px 14px; color: #fff; font-size: 13px; font-weight: 600; background: var(--c, #a8adb4);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.col-head .cnt { background: rgba(255,255,255,.3); border-radius: 10px; padding: 0 8px; }
.stage-accepted { --c: #47c8f5; } .stage-diagnostics { --c: #3e9cf5; } .stage-awaiting_approval { --c: #ffa900; } .stage-waiting_parts { --c: #9b8af5; }
.stage-repair { --c: #00b4ac; } .stage-quality_check { --c: #55b700; } .stage-refused { --c: #ff5752; } .stage-ready { --c: #7bd500; } .stage-issued { --c: #a8adb4; }
.col.drop-ok { outline: 2px dashed var(--brand); outline-offset: 2px; border-radius: 10px; }
.kcard { border: 0; border-left: 4px solid var(--line-2); border-radius: 10px; box-shadow: var(--sh-card); padding: 12px; }
.kcard:hover { box-shadow: 0 4px 14px rgba(83,92,105,.16); }
.kcard .k2 { color: var(--accent); }
.kcard .k4 { justify-content: flex-start; }
.kcard .k4 select { margin-left: auto; }

/* кружки с инициалами */
.ava { --s: 28px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: var(--c, #a8adb4); color: #fff;
  font-size: calc(var(--s) * .4); font-weight: 700; letter-spacing: .02em; line-height: 1; }
.ava-empty { background: transparent; color: var(--muted); border: 1.5px dashed var(--line-2); }

/* строки заказов и прочее */
.orow:hover { background: var(--accent-soft); }
.orow .t1 b { color: var(--accent); }
.next { border-radius: var(--r-l); border: 0; box-shadow: var(--sh-card); background: var(--surface); border-left: 4px solid var(--brand); }
.next.late { background: var(--surface); border-left-color: #ff5752; }
.next.none { border-left: 4px dashed var(--line-2); }
.clock-main { border-right-color: var(--line); }
.clock-side { background: var(--surface-2); }
.ruler .fill.ok { background: var(--brand); }
.banner { border-radius: var(--r-m); }
.demo-bar { background: var(--side-bg); }
a { color: inherit; }
.page-head p a, .panel-head .more, .small a, .meta a { color: var(--accent); }
.tabbar { background: var(--side-bg); border-top: 0; }
.tabbar a { color: var(--side-ink); }
.tabbar a[aria-current="page"] { color: var(--brand); }
.login { background: var(--wall), var(--bg); }
.login .panel { border-top: 4px solid var(--brand); }

/* =====================================================================
   Стекло: цветная подложка + полупрозрачные слои с размытием.
   --surface остаётся сплошным (на нём пишется текст в плашках),
   прозрачность задаётся отдельными токенами --glass*.
   ===================================================================== */
:root {
  --glass: rgba(255,255,255,.58); --glass-strong: rgba(255,255,255,.78); --glass-soft: rgba(255,255,255,.38);
  --glass-line: rgba(255,255,255,.65); --glass-shadow: 0 8px 32px -8px rgba(31,56,88,.18), 0 1px 0 rgba(255,255,255,.7) inset;
  --side-glass: rgba(16,28,44,.62); --blur: blur(22px) saturate(170%);
  --mesh-1: #9ad7f7; --mesh-2: #c3b5ff; --mesh-3: #b6efd3; --mesh-4: #ffe0b0; --mesh-base: #e6eef6;
  --r-l: 18px; --r-m: 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --glass: rgba(22,30,42,.58); --glass-strong: rgba(26,35,48,.82); --glass-soft: rgba(30,40,54,.4);
  --glass-line: rgba(255,255,255,.09); --glass-shadow: 0 10px 36px -10px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.05) inset;
  --side-glass: rgba(8,13,20,.6);
  --mesh-1: #12406a; --mesh-2: #3a2a7a; --mesh-3: #0c4a45; --mesh-4: #4a3313; --mesh-base: #0b1118;
} }
:root[data-theme="dark"] {
  --glass: rgba(22,30,42,.58); --glass-strong: rgba(26,35,48,.82); --glass-soft: rgba(30,40,54,.4);
  --glass-line: rgba(255,255,255,.09); --glass-shadow: 0 10px 36px -10px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.05) inset;
  --side-glass: rgba(8,13,20,.6);
  --mesh-1: #12406a; --mesh-2: #3a2a7a; --mesh-3: #0c4a45; --mesh-4: #4a3313; --mesh-base: #0b1118;
}

body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif; background: var(--mesh-base); }
/* подложка закреплена отдельным слоем — работает и на iPhone */
body::before { content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 42% at 12% 18%, var(--mesh-1) 0, transparent 70%),
    radial-gradient(34% 40% at 88% 12%, var(--mesh-2) 0, transparent 70%),
    radial-gradient(40% 44% at 78% 88%, var(--mesh-3) 0, transparent 72%),
    radial-gradient(30% 34% at 24% 92%, var(--mesh-4) 0, transparent 70%),
    var(--mesh-base);
  filter: saturate(115%); }
h1 { font-weight: 700; letter-spacing: -.025em; }

/* общий рецепт стекла */
.side, .top, .panel, .table-wrap, .clock, .summary a, .next, .kcard, dialog, .pop, .search-pop, .tabbar, .login .panel, .demo-bar {
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.panel, .table-wrap, .clock, .summary a, .next, .login .panel {
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); border-radius: var(--r-l);
}
.summary { background: transparent; border: 0; box-shadow: none; }
.summary a { border-top-width: 1px; border-top-color: var(--glass-line) !important; position: relative; overflow: hidden; }
.summary a::after { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.summary a:nth-child(1)::after { background: #ff5752; } .summary a:nth-child(2)::after { background: #ffa900; } .summary a:nth-child(3)::after { background: #2fc6f6; }
.summary a:nth-child(4)::after { background: #9b8af5; } .summary a:nth-child(5)::after { background: #3e9cf5; } .summary a:nth-child(6)::after { background: #7bd500; }
.summary a:hover { background: var(--glass-strong); }
.clock-side { background: var(--glass-soft); }
.clock-main { border-right-color: var(--glass-line); }
.panel-head { border-bottom-color: var(--glass-line); }
.orow { border-top-color: var(--glass-line); }
.orow:hover { background: var(--glass-soft); }
.t th { background: var(--glass-soft); border-bottom-color: var(--glass-line); }
.t td { border-bottom-color: var(--glass-line); }
.t tbody tr:hover td { background: var(--glass-soft); }

/* боковая панель и шапка */
.side { background: var(--side-glass); border-right: 1px solid rgba(255,255,255,.08); }
.top { background: var(--glass); border-bottom: 1px solid var(--glass-line); }
.search input { background: var(--glass-soft); border: 1px solid var(--glass-line); }
.search input:focus { background: var(--glass-strong); }
.tabbar { background: var(--side-glass); }

/* канбан — карточки полупрозрачные без лишнего размытия (быстрее на старых компьютерах) */
.kcard { background: var(--glass-strong); border: 1px solid var(--glass-line); border-left-width: 4px; -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 14px; }
.col-head { box-shadow: 0 6px 18px -8px var(--c); }

/* поля, кнопки, чипы */
.input, select.input, textarea.input { background: var(--glass-strong); border-color: var(--glass-line); }
.btn { background: var(--glass-strong); border-color: var(--glass-line); }
.btn:hover { background: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.primary { background: var(--cta); border-color: transparent; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--cta) 80%, #000); }
.chip { background: var(--glass); border-color: var(--glass-line); }
.seg { background: var(--glass); border-color: var(--glass-line); }
.next { border-left: 4px solid var(--brand); }
.next.late { border-left-color: #ff5752; background: var(--glass); }
.check { background: var(--glass-soft); border-color: var(--glass-line); }

/* диалоги и всплывающие окна */
dialog { background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: 0 30px 80px -20px rgba(15,25,40,.45); border-radius: 20px; }
dialog::backdrop { background: rgba(12,20,32,.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pop, .search-pop { background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 16px; }
.notif { border-top-color: var(--glass-line); }
.notif.unread { background: var(--glass-soft); }
.toast { border-radius: 14px; }

/* лёгкое появление экранов */
@media (prefers-reduced-motion: no-preference) {
  #view > * { animation: rise .28s ease-out both; }
  @keyframes rise { from { opacity: .001; transform: translateY(6px); } }
}

/* если браузер не умеет размытие или пользователь отключил прозрачность — плотные слои */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: var(--surface); --glass-strong: var(--surface); --glass-soft: var(--surface-2); --side-glass: var(--side-bg); }
}
@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-theme="dark"] { --glass: var(--surface); --glass-strong: var(--surface); --glass-soft: var(--surface-2); --side-glass: var(--side-bg); }
  body::before { display: none; }
}

/* ===== Финансы ===== */
.fin-summary a { cursor: default; }
.fin-summary a .v { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-summary a.hl { background: color-mix(in srgb, var(--cta, #bbed21) 22%, transparent); }
.fin-summary a.hl .v { color: var(--ink); }
.fin-top { margin-bottom: 14px; }
.fin-table .n, .fin-recips td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-table th.n { text-align: right; }
.fin-table tr.link { cursor: pointer; }
.fin-table tr.bad td { background: color-mix(in srgb, var(--red-soft) 70%, transparent); }
.fin-table tr.bad td:first-child { box-shadow: inset 3px 0 var(--red); }
.fin-table tr.warn td:first-child { box-shadow: inset 3px 0 var(--amber); }
.fin-table tfoot td { position: sticky; bottom: 0; background: var(--glass-strong, var(--surface)); backdrop-filter: var(--blur); font-weight: 600; padding: 10px 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-table .clip-2 { min-width: 200px; max-width: 300px; }
.fin-table td:nth-child(1), .fin-table td:nth-child(2) { white-space: nowrap; }
.warn-t { color: var(--amber); }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }
.tag.goods { background: var(--accent-soft); color: var(--accent); }
.warn-box { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.month-seg .m-cur { min-width: 136px; font-weight: 600; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; font-size: var(--fs-s); }
.bar-row b { font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand, #2fc6f6), var(--accent)); }
.o-fin { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.fin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.fin-set td { vertical-align: top; }
.fin-set details summary { cursor: pointer; }
@media (max-width: 900px) { .fin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .fin-recips td:nth-child(3) { display: none; } .fin-recips td { padding-left: 4px; padding-right: 4px; } .month-seg .m-cur { min-width: 110px; } }
