/* Ucharbek CRM — design tokens + components (CONTRACT §7.1). Read docs/UI-KIT.md for class names.
   Visual world: Ucharbek's own brand (logo and Instagram @ucharbek.tours, 16.11.2026) on a calm work tool —
   royal blue #0055E0 for actions and selection, the logo's yellow #FDCD01 as the single accent (counters, the «+» on
   phones, stale marks), deep navy #002D4E for the chrome (sidebar, phone top bar), cool blue-tinted neutrals.
   Excel's slot colours stay: answered green, no answer red, empty grey ring.
   Never hard-code colours in views: every token below is redefined for dark mode. */

:root {
  --bg: #ffffff;
  --panel: #f3f6fb;
  --panel-2: #e8eef6;
  --line: #dee5ee;
  --line-2: #c7d1df;
  --ink: #0a1f3a;
  --text: #24344d;
  --muted: #55647b;
  --placeholder: #627086;
  --faint: #8b97a9;

  --brand: #0055e0;
  --brand-d: #0043b4;
  --brand-soft: #e6eeff;
  --brand-ring: rgba(0, 85, 224, .24);
  --on-brand: #ffffff;

  /* the logo's yellow: the one accent. --warm-d is its readable text colour on light surfaces */
  --warm: #fdcd01;
  --warm-d: #7a5600;
  --warm-soft: #fff6cc;
  --accent: #fdcd01;
  --on-accent: #002d4e;

  /* chrome: sidebar and the phone top bar */
  --chrome: #002d4e;
  --chrome-2: #0a3c63;
  --chrome-line: rgba(255, 255, 255, .1);
  --on-chrome: #ffffff;
  --on-chrome-muted: #a9bed4;

  --ok: #15803d;
  --ok-soft: #e3f5e9;
  --warn: #b45309;
  --warn-soft: #fdf0de;
  --err: #b91c1c;
  --err-soft: #fbe9e8;
  --info: #0b7285;
  --info-soft: #e0f3f6;
  --violet: #6d4fd8;
  --violet-soft: #efebfc;

  --slot-ok: #16a34a;
  --slot-no: #ef4444;
  --slot-empty: #c2ccd9;
  --q-good: var(--ok);
  --q-bad: var(--faint);

  --r-s: 8px;
  --r: 12px;
  --r-l: 16px;
  --shadow-1: 0 1px 2px rgba(6, 26, 51, .06), 0 2px 8px rgba(6, 26, 51, .06);
  --shadow-2: 0 8px 28px rgba(6, 26, 51, .14);
  --shadow-3: 0 16px 48px rgba(6, 26, 51, .2);
  --scrim: rgba(6, 26, 51, .34);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-18: 18px; --fs-22: 22px; --fs-28: 28px;

  --ease: cubic-bezier(.23, 1, .32, 1);
  --t-fast: 150ms;
  --t: 200ms;

  --top-h: 56px;
  --side-w: 232px;
  --rail-w: 68px;
  --tab-h: 60px;
  --gutter: 28px;
  --table-h: 70dvh;

  --z-side: 20; --z-top: 30; --z-tab: 30; --z-drawer: 60; --z-menu: 70; --z-dialog: 80; --z-toast: 90;

  color-scheme: light;
}

/* dark theme: the system's choice unless the user forced light; or forced dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1420; --panel: #121d2c; --panel-2: #1a2738; --line: #233246; --line-2: #32445c;
    --ink: #eef3fa; --text: #cdd7e4; --muted: #97a6ba; --placeholder: #8494aa; --faint: #6b7b91;
    --brand: #5b9dff; --brand-d: #8cbbff; --brand-soft: #12294d; --brand-ring: rgba(91, 157, 255, .35); --on-brand: #04142e;
    --warm: #fdcd01; --warm-d: #ffdf5c; --warm-soft: #3a3108; --accent: #fdcd01; --on-accent: #002d4e;
    --chrome: #0e1826; --chrome-2: #18263a; --chrome-line: rgba(255, 255, 255, .08); --on-chrome: #eef3fa; --on-chrome-muted: #97a6ba;
    --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf6b; --warn-soft: #3b2b10; --err: #f87171; --err-soft: #3d1818;
    --info: #5cc8d8; --info-soft: #0f2f36; --violet: #a78bfa; --violet-soft: #251e3f;
    --slot-ok: #22c55e; --slot-no: #f05252; --slot-empty: #44546a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, .5);
    --shadow-3: 0 16px 48px rgba(0, 0, 0, .6);
    --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1420; --panel: #121d2c; --panel-2: #1a2738; --line: #233246; --line-2: #32445c;
  --ink: #eef3fa; --text: #cdd7e4; --muted: #97a6ba; --placeholder: #8494aa; --faint: #6b7b91;
  --brand: #5b9dff; --brand-d: #8cbbff; --brand-soft: #12294d; --brand-ring: rgba(91, 157, 255, .35); --on-brand: #04142e;
  --warm: #fdcd01; --warm-d: #ffdf5c; --warm-soft: #3a3108; --accent: #fdcd01; --on-accent: #002d4e;
  --chrome: #0e1826; --chrome-2: #18263a; --chrome-line: rgba(255, 255, 255, .08); --on-chrome: #eef3fa; --on-chrome-muted: #97a6ba;
  --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf6b; --warn-soft: #3b2b10; --err: #f87171; --err-soft: #3d1818;
  --info: #5cc8d8; --info-soft: #0f2f36; --violet: #a78bfa; --violet-soft: #251e3f;
  --slot-ok: #22c55e; --slot-no: #f05252; --slot-empty: #44546a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .5);
  --shadow-3: 0 16px 48px rgba(0, 0, 0, .6);
  --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ───────────── base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-14)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--brand);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 650; text-wrap: balance; }
h1 { font-size: var(--fs-22); line-height: 1.25; letter-spacing: -.015em; font-weight: 700; }
h2 { font-size: var(--fs-16); line-height: 1.3; }
h3 { font-size: var(--fs-14); line-height: 1.35; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.ic { flex: none; }
::selection { background: var(--brand-soft); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }
.num, .tnum, time { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ink { color: var(--ink); }
.warm-text { color: var(--warm-d); }
.ok-text { color: var(--ok); }
.err-text { color: var(--err); }
.small { font-size: var(--fs-13); }
.xs { font-size: var(--fs-12); }
.strong { font-weight: 600; color: var(--ink); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hidden, [hidden] { display: none !important; }
.row-flex { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.spacer { flex: 1; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ───────────── app shell ───────────── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "side top" "side main";
  height: 100dvh;
  overflow: hidden;
}
.top {
  grid-area: top;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: var(--z-top);
  min-width: 0;
}
/* the brand block: the Ucharbek monogram + the name set like their wordmark (heavy, oblique, caps) */
.brandmark { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--on-chrome); text-decoration: none; flex: none; }
.brandmark:hover { text-decoration: none; }
.brandmark img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brandmark .bm-text { min-width: 0; }
.brandmark b { display: block; font-weight: 800; font-style: italic; font-size: 16px; letter-spacing: .03em; line-height: 1.1; text-transform: uppercase; }
.brandmark span { display: block; margin-top: 1px; font-size: 11.5px; color: var(--on-chrome-muted); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side > .brandmark { height: var(--top-h); margin: 0 0 10px; padding: 0 6px; }
.top > .brandmark { display: none; }
.top-search { position: relative; flex: 1 1 auto; max-width: 460px; min-width: 0; }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.demo-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--warm-soft); color: var(--warm-d); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.usermenu-btn { position: relative; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 4px; border: 1px solid transparent; border-radius: 999px; background: none; cursor: pointer; color: var(--ink); }
.usermenu-btn:hover { background: var(--panel); }
.usermenu-btn .who { text-align: left; line-height: 1.15; }
.usermenu-btn .who b { display: block; font-weight: 500; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu-btn .who span { font-size: 11.5px; color: var(--muted); }
.usermenu-btn .nav-dot { position: absolute; top: 4px; left: 28px; }

.side {
  grid-area: side;
  display: flex; flex-direction: column; gap: 2px;
  padding: 0 10px 12px;
  background: var(--chrome);
  color: var(--on-chrome);
  overflow-y: auto;
  z-index: var(--z-side);
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 10px;
  border-radius: var(--r-s);
  color: color-mix(in srgb, var(--on-chrome) 86%, var(--chrome)); font-weight: 500;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent; background: none; width: 100%; text-align: left;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item:hover { background: var(--chrome-2); text-decoration: none; color: var(--on-chrome); }
.nav-item .ic { color: var(--on-chrome-muted); transition: color var(--t-fast) var(--ease); }
.nav-item:hover .ic { color: var(--on-chrome); }
.nav-item[aria-current="page"] { background: color-mix(in srgb, var(--on-chrome) 13%, transparent); color: var(--on-chrome); font-weight: 600; }
.nav-item[aria-current="page"] .ic { color: var(--accent); }
.nav-item:focus-visible { outline-color: var(--accent); }
.side .count { background: color-mix(in srgb, var(--on-chrome) 16%, transparent); color: var(--on-chrome); }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sep { height: 1px; background: var(--chrome-line); margin: 8px 6px; }
.side-foot { margin-top: auto; padding-top: 8px; }
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--panel-2); color: var(--text);
}
.count.hot, .side .count.hot { background: var(--accent); color: var(--on-accent); }
.count.alert { background: var(--err); color: #fff; }
.count:empty { display: none; }
.nav-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--err); box-shadow: 0 0 0 2px var(--bg); flex: none; }
.side .nav-dot { background: #ff6b6b; box-shadow: 0 0 0 2px var(--chrome); }
.nav-dot[hidden] { display: none !important; }

.main { grid-area: main; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.banners { flex: none; }
.view-host { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; }
.view.view-fill { overflow: hidden; display: flex; flex-direction: column; }
.view-enter { animation: view-in var(--t) var(--ease); }
@keyframes view-in { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* strips under the top bar: demo, offline */
.banner { display: flex; align-items: center; gap: 10px; padding: 8px var(--gutter); font-size: var(--fs-13); border-bottom: 1px solid var(--line); flex: none; }
.banner .ic { flex: none; }
.banner .b-text { flex: 1; min-width: 0; }
.banner.is-demo { background: var(--warm-soft); color: var(--text); }
.banner.is-demo .ic { color: var(--warm-d); }
.banner.is-offline { background: var(--err-soft); color: var(--text); }
.banner.is-offline .ic { color: var(--err); }

.tabbar { display: none; }
.phone-only { display: none !important; }

/* bare layout (login) */
.bare { min-height: 100dvh; background: var(--chrome); }
.bare > .view { overflow: visible; min-height: 100dvh; }

/* ───────────── page primitives ───────────── */
.page { padding: 24px var(--gutter) 40px; max-width: 1360px; }
.page.narrow { max-width: 920px; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .titles { min-width: 0; }
.page-head .sub { margin-top: 4px; color: var(--muted); font-size: var(--fs-13); }
.page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-13); margin-bottom: 6px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.toolbar .grow { flex: 1; min-width: 160px; }
.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.section-head .aside { color: var(--muted); font-size: var(--fs-13); }
.panel { background: var(--panel); border-radius: var(--r-l); padding: 16px; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* hairline lists */
.list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.list.no-top { border-top: 0; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none; background: none;
  border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left;
}
a.list-row:hover, button.list-row:hover, .list-row.is-link:hover { background: var(--panel); text-decoration: none; cursor: pointer; }
.list-row.is-active { background: var(--brand-soft); }
.list-row.is-urgent { background: var(--err-soft); }
.list-row.is-urgent:hover { background: color-mix(in srgb, var(--err) 14%, var(--bg)); }
.list-row.is-warm { background: var(--warm-soft); }
.list-row .main-col { flex: 1; min-width: 0; }
.list-row .title { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { color: var(--muted); font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .end { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-13); font-variant-numeric: tabular-nums; }
.list-group-title { display: flex; align-items: center; gap: 8px; padding: 14px 8px 6px; font-size: var(--fs-12); font-weight: 600; color: var(--muted); }

/* tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; font-size: var(--fs-12); color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
.table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; background: var(--bg); }
.table tr.group td { background: var(--panel); font-weight: 600; color: var(--ink); font-size: var(--fs-13); padding: 8px 10px; }
.table td.num, .table th.num { text-align: right; }
.table td.center, .table th.center { text-align: center; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--panel) 70%, var(--bg)); }
.table tbody tr.group:hover td { background: var(--panel); }
.table tr.is-link { cursor: pointer; }
.table tfoot td { font-weight: 600; color: var(--ink); background: var(--panel); border-bottom: 0; }
.table-scroll { position: relative; overflow: auto; max-height: var(--table-h); border: 1px solid var(--line); border-radius: var(--r); -webkit-overflow-scrolling: touch; }
.table-scroll > .table th:first-child, .table-scroll > .table td:first-child { padding-left: 12px; }
/* wide tables say «there is more»: a visible scrollbar thumb, a fade on the right edge while columns are hidden there and
   a shadow under the sticky first column (or a fade on the left edge) once the table is scrolled (ui.scrollShadows) */
.table-scroll { scrollbar-color: var(--faint) transparent; }
.table-scroll::-webkit-scrollbar-thumb { background-color: var(--faint); }
.scroll-shadow { position: relative; min-width: 0; }
.scroll-shadow::before, .scroll-shadow::after { content: ""; position: absolute; top: 1px; bottom: calc(1px + var(--sb-h, 0px)); width: 32px; pointer-events: none; opacity: 0; z-index: 4; transition: opacity var(--t-fast) var(--ease); }
.scroll-shadow::before { left: 1px; border-radius: var(--r) 0 0 var(--r); background: linear-gradient(to right, var(--bg) 15%, transparent); }
.scroll-shadow::after { right: calc(1px + var(--sb-w, 0px)); border-radius: 0 var(--r) var(--r) 0; background: linear-gradient(to left, var(--bg) 15%, transparent); }
.scroll-shadow.more-right::after { opacity: 1; }
.scroll-shadow.more-left:not(:has(.sticky-col))::before { opacity: 1; }
.scroll-shadow.more-left .table .sticky-col { box-shadow: inset -1px 0 0 var(--line), 8px 0 10px -8px rgba(0, 0, 0, .28); }
.table.sticky thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); border-bottom: 0; }
.table .sticky-col { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--line); }
.table.sticky thead th.sticky-col { z-index: 3; }

/* ───────────── controls ───────────── */
.btn {
  --h: 36px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); min-width: var(--h); padding: 0 14px;
  border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: var(--bg); color: var(--ink);
  font-weight: 500; font-size: var(--fs-14); line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none; text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--panel); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .ic { color: currentColor; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, var(--bg)); color: var(--ok); }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 18%, var(--bg)); }
.btn-warm { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-warm:hover { background: color-mix(in srgb, var(--warm) 85%, #000); border-color: color-mix(in srgb, var(--warm) 85%, #000); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--panel); color: var(--ink); }
.btn-danger { background: var(--bg); border-color: color-mix(in srgb, var(--err) 35%, var(--bg)); color: var(--err); }
.btn-danger:hover { background: var(--err-soft); }
.btn-danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger.solid:hover { background: color-mix(in srgb, var(--err) 82%, #000); }
.btn-sm { --h: 30px; padding: 0 10px; font-size: var(--fs-13); gap: 6px; border-radius: 7px; }
.btn-lg { --h: 44px; padding: 0 18px; font-size: var(--fs-16); }
.btn-xl { --h: 56px; padding: 0 22px; font-size: 17px; font-weight: 600; border-radius: var(--r); gap: 10px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: var(--h); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading .spinner { position: absolute; inset: 0; margin: auto; color: var(--ink); }
.btn-primary.is-loading .spinner, .btn-danger.solid.is-loading .spinner { color: var(--on-brand); }
.btn .badge-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); border: 2px solid var(--bg); }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 500; }
.linklike:hover { text-decoration: underline; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--bg); color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  font-variant-numeric: tabular-nums;
}
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); outline: none; }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--panel); color: var(--muted); cursor: not-allowed; }
.input.is-error, .select.is-error, .textarea.is-error { border-color: var(--err); }
.input.is-error:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 22%, transparent); }
.input-sm, .select.input-sm { height: 30px; padding: 0 10px; font-size: var(--fs-13); }
.input.quiet { border-color: transparent; background: transparent; padding: 0 8px; }
.input.quiet:hover { border-color: var(--line-2); background: var(--bg); }
.input.quiet:focus { border-color: var(--brand); background: var(--bg); }
.textarea { height: auto; min-height: 88px; padding: 9px 12px; line-height: 1.5; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b97a9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="time"].input { padding-right: 6px; min-width: 96px; }
input[type="date"].input { padding-right: 6px; min-width: 132px; }
input[type="number"].input { -moz-appearance: textfield; }
input[type="number"].input::-webkit-inner-spin-button { opacity: .4; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.input-wrap > .input { padding-left: 36px; }
.input-wrap > .kbd { position: absolute; right: 8px; }
.input-wrap > .input:focus ~ .kbd { display: none; }
.input-suffix { position: absolute; right: 12px; color: var(--muted); font-size: var(--fs-13); pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field .label { font-size: var(--fs-13); font-weight: 500; color: var(--text); }
.field .hint { font-size: var(--fs-12); color: var(--muted); }
.field .error { font-size: var(--fs-12); color: var(--err); display: flex; gap: 6px; align-items: flex-start; }
.field .error:empty, .field .hint:empty { display: none; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-weight: 500; font-size: var(--fs-13);
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(6, 26, 51, .08), 0 0 0 1px var(--line); }
.seg.seg-sm button { height: 26px; padding: 0 10px; font-size: var(--fs-12); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 28px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 36px; height: 22px; border-radius: 999px; background: var(--line-2); transition: background var(--t) var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform var(--t) var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.switch .switch-label { color: var(--ink); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 12px; border: 0; background: none;
  color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); }
.tabs .count { height: 18px; min-width: 18px; font-size: 11px; }

/* chips: single filter chips and chipSelect groups (multi / single) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  font-size: var(--fs-13); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.chip:hover { background: var(--panel); }
.chip[aria-pressed="true"] { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, var(--bg)); color: var(--brand-d); }
.chip[aria-pressed="true"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-left: -2px; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip .count { height: 18px; min-width: 18px; font-size: 11px; }
.chips-lg { gap: 8px; }
.chips-lg .chip { height: 44px; padding: 0 16px; font-size: var(--fs-14); }

/* ───────────── data display ───────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: var(--fs-12); font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--panel-2); color: var(--text);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.tone-brand { background: var(--brand-soft); color: var(--brand-d); }
.pill.tone-ok { background: var(--ok-soft); color: var(--ok); }
.pill.tone-warn { background: var(--warn-soft); color: var(--warn); }
.pill.tone-err { background: var(--err-soft); color: var(--err); }
.pill.tone-info { background: var(--info-soft); color: var(--info); }
.pill.tone-violet { background: var(--violet-soft); color: var(--violet); }
.pill.tone-warm { background: var(--warm-soft); color: var(--warm-d); }
.pill.tone-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); }
.pill.tone-dashed { background: var(--bg); color: var(--brand-d); outline: 1.5px dashed var(--brand); outline-offset: -1.5px; }
.pill.tone-strike { background: var(--panel); color: var(--muted); text-decoration: line-through; }
.pill.q-bad { color: var(--muted); }
.pill-lg { height: 26px; padding: 0 10px; font-size: var(--fs-13); }

/* stage colour from the server on any element: style="--sc: #8b5cf6" */
.sc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sc, var(--faint)); flex: none; display: inline-block; }
.sc-fill { background: color-mix(in srgb, var(--sc, var(--faint)) 14%, var(--bg)); color: color-mix(in srgb, var(--sc, var(--faint)) 70%, var(--ink)); }
.sc-line { box-shadow: inset 0 3px 0 var(--sc, var(--faint)); }
.stage-pill { background: color-mix(in srgb, var(--sc, var(--faint)) 13%, var(--bg)); color: color-mix(in srgb, var(--sc, var(--faint)) 62%, var(--ink)); }

/* Excel slot grid (G–P): answered green, no answer red, empty grey ring */
.slots { display: inline-flex; align-items: center; }
.slots .slot.s-ok { --sl: var(--slot-ok); }
.slots .slot.s-no { --sl: var(--slot-no); }
.slots.mini { gap: 4px; }
.slots.mini .sd { display: inline-flex; gap: 2px; }
.slots.mini .slot { display: block; width: 9px; height: 9px; border-radius: 3px; background: var(--sl, transparent); box-shadow: inset 0 0 0 1.5px var(--sl, var(--slot-empty)); }
.slots.mini .slot.is-current { box-shadow: inset 0 0 0 1.5px var(--sl, var(--slot-empty)), 0 0 0 1.5px var(--bg), 0 0 0 3px var(--brand); }
.slots.full { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; width: 100%; }
.slots.full .sd { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slots.full .sd-head { font-size: var(--fs-12); color: var(--muted); font-weight: 500; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slots.full .slot {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; border-radius: var(--r-s); font-size: var(--fs-12); font-weight: 500;
  background: color-mix(in srgb, var(--sl, transparent) 14%, var(--bg));
  color: var(--sl, var(--muted));
  box-shadow: inset 0 0 0 1.5px var(--sl, var(--slot-empty));
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.slots.full .slot.s-empty { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--slot-empty); }
.slots.full .slot.is-current { box-shadow: inset 0 0 0 1.5px var(--sl, var(--slot-empty)), 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }

/* call result badge, staff tag, source tag */
.callb { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-13); font-weight: 500; white-space: nowrap; }
.callb.tone-ok { color: var(--ok); }
.callb.tone-err { color: var(--err); }
.callb.tone-warn { color: var(--warn); }
.callb.tone-neutral { color: var(--muted); }
.staff-tag { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; color: var(--ink); }
.src-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; }

.avatar {
  --av: 32px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--av); height: var(--av); border-radius: 50%;
  background: color-mix(in srgb, var(--av-c, var(--brand)) 16%, var(--bg));
  color: color-mix(in srgb, var(--av-c, var(--brand)) 70%, var(--ink));
  font-size: calc(var(--av) * .38); font-weight: 600; letter-spacing: .01em;
  overflow: hidden; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.urgent-mark { display: inline-flex; align-items: center; gap: 4px; color: var(--err); font-weight: 600; font-size: var(--fs-12); }
.wait { font-variant-numeric: tabular-nums; color: var(--muted); }
.wait.is-late { color: var(--warn); font-weight: 600; }
.wait.is-critical { color: var(--err); font-weight: 600; }
.delta-up { color: var(--ok); font-weight: 600; }
.delta-down { color: var(--err); font-weight: 600; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(156px, 1fr)); gap: 10px; }
.kpi {
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; row-gap: 4px; min-width: 0;
  padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid transparent;
  color: inherit; text-decoration: none; text-align: left; font: inherit;
}
.kpi.is-link { cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.kpi.is-link:hover { border-color: var(--line-2); background: var(--panel-2); text-decoration: none; }
/* a label wraps to two lines instead of losing its end («Переданы менеджерам»); tiles of one grid row share their
   label / value / sub rows (subgrid), so the numbers line up whether a label or a sub took one line or two */
@supports (grid-template-rows: subgrid) {
  .kpis > .kpi { grid-row: span 3; grid-template-rows: subgrid; }
}
.kpi .kpi-label { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: var(--fs-13); font-weight: 500; line-height: 1.3; min-width: 0; }
.kpi .kpi-label .ic { flex: none; margin-top: 1px; }
.kpi .kpi-label span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: break-word; min-width: 0; }
.kpi .kpi-value { color: var(--ink); font-size: 26px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi .kpi-sub { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--muted); font-size: var(--fs-12); }
.kpi.tone-brand .kpi-label .ic { color: var(--brand); }
.kpi.tone-ok .kpi-value { color: var(--ok); }
.kpi.tone-warn .kpi-value { color: var(--warn); }
.kpi.tone-err .kpi-value { color: var(--err); }
.kpi.tone-warm { background: var(--warm-soft); }

/* period picker */
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.period-custom { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-custom .input { width: auto; }

/* kanban */
.board { display: flex; gap: 12px; align-items: stretch; overflow-x: auto; overflow-y: hidden; padding: 0 var(--gutter) 16px; min-height: 0; flex: 1; scroll-snap-type: x proximity; }
.board-col { flex: 0 0 280px; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: var(--r-l); box-shadow: inset 0 3px 0 var(--sc, var(--line-2)); scroll-snap-align: start; transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.board-col.is-over { background: color-mix(in srgb, var(--sc, var(--brand)) 10%, var(--panel)); box-shadow: inset 0 3px 0 var(--sc, var(--brand)), inset 0 0 0 2px color-mix(in srgb, var(--sc, var(--brand)) 45%, transparent); }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 8px; flex: none; }
.board-col-head h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-col-head .sum { width: 100%; order: 3; color: var(--muted); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.board-col-head { flex-wrap: wrap; }
.board-col-body { flex: 1; min-height: 60px; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.board-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line);
  color: inherit; text-decoration: none; cursor: pointer; box-shadow: 0 1px 2px rgba(6, 26, 51, .04);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.board-card:hover { border-color: var(--line-2); text-decoration: none; box-shadow: var(--shadow-1); }
.board-card[draggable="true"] { cursor: grab; }
.board-card.is-dragging { opacity: .45; cursor: grabbing; }
.board-card.is-stale { border-color: color-mix(in srgb, var(--warm) 70%, var(--line)); }
.board-card.is-closed { opacity: .78; }
.board-card .bc-title { display: flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; min-width: 0; }
.board-card .bc-title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.board-card .bc-meta { color: var(--muted); font-size: var(--fs-12); display: flex; flex-wrap: wrap; gap: 2px 8px; font-variant-numeric: tabular-nums; }
.board-card .bc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-12); color: var(--muted); }
.board-card .bc-amount { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.board-card .bc-stale { color: var(--warm-d); font-weight: 600; }
.board-empty { padding: 16px 8px; color: var(--faint); font-size: var(--fs-13); text-align: center; }

/* charts (core/charts.js) */
.chart { position: relative; width: 100%; min-width: 0; }
.chart .ch-svg { display: block; width: 100%; overflow: visible; font-family: var(--font); }
.chart .ch-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .ch-base { stroke: var(--line-2); stroke-width: 1; }
.chart .ch-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ch-val { fill: var(--ink); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .ch-flabel { fill: var(--text); font-size: 13px; }
.chart .ch-fval { fill: var(--ink); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart .ch-cval { fill: var(--ink); font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart .ch-empty { fill: var(--faint); font-size: 13px; }
.chart .ch-bar { fill: var(--brand); transition: opacity var(--t-fast) var(--ease); }
.chart .ch-fbar { fill: var(--brand); }
.chart .ch-track { fill: var(--panel-2); stroke: var(--panel-2); }
.chart .ch-hit { fill: transparent; }
.chart .ch-cell { fill: var(--brand); }
.chart .ch-cell.is-empty { fill: var(--panel); }
.chart .ch-cellv { fill: var(--ink); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; pointer-events: none; }
.chart .ch-cellv.is-dark { fill: var(--on-brand); }
.chart .ch-line { fill: none; stroke: var(--brand); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-area { fill: var(--brand); opacity: .12; }
.chart .ch-dot { fill: var(--brand); }
.chart .ch-mark.is-click { cursor: pointer; }
.chart .ch-mark.is-click:hover .ch-bar, .chart .ch-mark.is-click:hover .ch-cell { opacity: .78; }
.chart .ch-mark.is-click:focus-visible { outline: none; }
.chart .ch-mark.is-click:focus-visible .ch-hit { fill: var(--brand-soft); }
.chart .ch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: var(--fs-12); }
.chart .ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart .ch-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); flex: none; }
.chart .ch-donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.chart .ch-donut .ch-svg { width: auto; flex: none; }
.chart .ch-donut .ch-legend { flex-direction: column; margin: 0; }

/* QR codes are always black on white (scanners) */
.qr { display: inline-grid; place-items: center; padding: 10px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); }
.qr svg { width: min(220px, 100%); height: auto; }

/* ───────────── feedback ───────────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--muted); }
.empty .empty-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--panel); color: var(--brand); margin-bottom: 4px; }
.empty .empty-title { color: var(--ink); font-weight: 600; font-size: var(--fs-16); }
.empty .empty-text { max-width: 46ch; font-size: var(--fs-14); }
.empty .empty-action { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.empty.compact { padding: 20px 12px; }
.empty.compact .empty-ic { width: 40px; height: 40px; }
.empty.compact .empty-title { font-size: var(--fs-14); }
.empty.is-error .empty-ic { background: var(--err-soft); color: var(--err); }
.empty.is-soon .empty-ic { background: var(--brand-soft); }

.skel-group { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.skel-row { display: flex; align-items: center; gap: 12px; }
.skel {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 40%, var(--panel) 80%);
  background-size: 300% 100%;
  animation: skel 1.4s ease-in-out infinite;
}
.skel.circle { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.skel.block { height: 64px; border-radius: var(--r); }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; flex: none; opacity: .9; }
@keyframes spin { to { transform: rotate(360deg); } }

.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--muted); min-height: 28px; transition: opacity var(--t) var(--ease); }
.save-state[data-state="idle"] { opacity: 0; }
.save-state[data-state="saved"] .ic { color: var(--ok); }
.save-state[data-state="error"] { color: var(--err); }
.save-state .spinner { width: 13px; height: 13px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--panel); color: var(--text); font-size: var(--fs-13); }
.notice .ic { color: var(--brand); margin-top: 1px; }
.notice.tone-warn { background: var(--warn-soft); }
.notice.tone-warn .ic { color: var(--warn); }
.notice.tone-err { background: var(--err-soft); }
.notice.tone-err .ic { color: var(--err); }
.notice.tone-ok { background: var(--ok-soft); }
.notice.tone-ok .ic { color: var(--ok); }

/* toasts: bottom-left on desktop (over the sidebar's empty end), top on phones; at most 3 (core/toast-queue.js) */
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 10px 10px 12px; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  color: var(--ink); font-size: var(--fs-13);
  animation: toast-in var(--t) var(--ease);
}
.toast.is-leaving { animation: toast-out 160ms ease-in forwards; }
.toast .t-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--panel); color: var(--brand); flex: none; }
.toast.k-ok .t-ic { background: var(--ok-soft); color: var(--ok); }
.toast.k-warn .t-ic, .toast.k-stale .t-ic { background: var(--warn-soft); color: var(--warn); }
.toast.k-err .t-ic, .toast.k-urgent .t-ic, .toast.k-missed .t-ic { background: var(--err-soft); color: var(--err); }
.toast.k-lead .t-ic, .toast.k-callback .t-ic { background: var(--brand-soft); color: var(--brand); }
.toast.k-urgent, .toast.k-missed { background: color-mix(in srgb, var(--err) 5%, var(--bg)); border-color: color-mix(in srgb, var(--err) 25%, var(--bg)); }
.toast .t-body { flex: 1; min-width: 0; padding-top: 4px; }
.toast .t-text { overflow-wrap: anywhere; }
.toast .t-actions { display: flex; gap: 8px; margin-top: 8px; }
.toast .t-close { margin: -2px -2px 0 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ───────────── overlays ───────────── */
.drawer-layer { position: fixed; inset: 0; z-index: var(--z-drawer); pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t) var(--ease); pointer-events: auto; }
.drawer-layer.no-scrim .drawer-scrim { display: none; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(var(--dw, 440px), 100vw);
  display: flex; flex-direction: column;
  background: var(--bg); box-shadow: var(--shadow-3); border-left: 1px solid var(--line);
  transform: translateX(104%); transition: transform 240ms var(--ease);
  pointer-events: auto;
}
.drawer-layer.is-open .drawer { transform: none; }
.drawer-layer.is-open .drawer-scrim { opacity: 1; }
.drawer-head { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-head .d-title { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: var(--fs-18); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head .d-sub { color: var(--muted); font-size: var(--fs-13); margin-top: 2px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }
.drawer-body.flush { padding: 0; }
.drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--bg); flex: none; }
.drawer-foot:empty { display: none; }
/* bottom sheet (sheet() / drawer({placement:'bottom'})) on every width */
.drawer-layer.is-sheet .drawer {
  top: auto; left: 0; right: 0; bottom: 0; margin: 0 auto;
  width: min(var(--dw, 560px), 100vw); max-height: min(88dvh, 760px);
  border-left: 0; border-radius: 20px 20px 0 0; transform: translateY(104%);
}
.drawer-layer.is-sheet.is-open .drawer { transform: none; }
.drawer-layer.is-sheet .drawer-head { border-bottom: 0; padding-top: 4px; min-height: 52px; }
.drawer-layer.is-sheet .drawer-body { padding-top: 4px; }
.drawer-layer.is-sheet .drawer-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 10px auto 2px; flex: none; }

dialog.dlg {
  border: 0; padding: 0; border-radius: var(--r-l); box-shadow: var(--shadow-3);
  width: min(440px, calc(100vw - 32px)); color: var(--text); background: var(--bg);
}
dialog.dlg::backdrop { background: var(--scrim); }
dialog.dlg[open] { animation: dlg-in var(--t) var(--ease); }
.dlg-body { padding: 22px 22px 8px; }
.dlg-body h2 { font-size: var(--fs-18); margin-bottom: 8px; }
.dlg-body .dlg-text { color: var(--text); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; flex-wrap: wrap; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

.pop {
  position: fixed; z-index: var(--z-menu);
  min-width: 200px; max-width: min(380px, calc(100vw - 16px));
  max-height: min(460px, calc(100dvh - 16px)); overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2);
  padding: 6px;
  animation: pop-in 140ms var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 38px; padding: 6px 10px; border: 0; border-radius: 7px; background: none;
  color: var(--ink); text-align: left; cursor: pointer; font-size: var(--fs-14);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel); outline: none; }
.menu-item .ic { color: var(--muted); }
.menu-item.is-danger { color: var(--err); }
.menu-item.is-danger .ic { color: var(--err); }
.menu-item[disabled] { opacity: .45; cursor: not-allowed; }
.menu-item .mi-label { flex: 1; min-width: 0; }
.menu-item .mi-hint { color: var(--muted); font-size: var(--fs-12); }
.menu-item .mi-check { color: var(--brand); }
.menu-item .mi-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-head { padding: 8px 10px 6px; font-size: var(--fs-12); color: var(--muted); }
.menu-head b { display: block; color: var(--ink); font-size: var(--fs-14); font-weight: 600; }

/* global search results / picker results */
.results { padding: 4px; }
.result {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 6px 10px; border: 0; border-radius: 8px; background: none;
  text-align: left; cursor: pointer; color: var(--ink);
}
.result:hover, .result.is-active { background: var(--panel); }
.result .r-main { flex: 1; min-width: 0; }
.result .r-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .r-meta { color: var(--muted); font-size: var(--fs-12); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result mark { background: var(--brand-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.result .r-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); color: var(--muted); flex: none; }
.results-empty { padding: 14px 12px; color: var(--muted); font-size: var(--fs-13); }

/* lead picker */
.picker { position: relative; }
.picker-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); max-height: 340px; overflow-y: auto; }
.picker-selected { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--bg); }
.picker-selected .ps-main { flex: 1; min-width: 0; }

/* ───────────── login & PIN pad ───────────── */
.login { min-height: 100dvh; display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px 40px; background: var(--chrome); }
.login-sheet { width: min(720px, 100%); background: var(--bg); border-radius: 20px; box-shadow: var(--shadow-3); overflow: hidden; }
.login-head { display: flex; align-items: center; gap: 16px; padding: 28px 32px 20px; }
.login-head img { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.login-head h1 { font-size: var(--fs-22); font-weight: 800; font-style: italic; letter-spacing: .02em; text-transform: uppercase; }
.login-head p { color: var(--muted); margin-top: 4px; max-width: 54ch; }
.login-banner { display: flex; align-items: center; gap: 8px; margin: 0 32px 16px; padding: 10px 12px; border-radius: var(--r); background: var(--warm-soft); color: var(--text); font-size: var(--fs-13); font-weight: 500; }
.login-banner .ic { color: var(--warm-d); }
.roles { border-top: 1px solid var(--line); }
.role-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.role-row:last-child { border-bottom: 0; }
.role-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.role-row h2 { font-size: var(--fs-16); }
.role-row .role-desc { color: var(--muted); font-size: var(--fs-13); margin-top: 2px; max-width: 60ch; }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.person {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 16px 6px 6px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; text-align: left; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.person:hover { border-color: var(--brand); background: var(--brand-soft); }
.person:active { transform: translateY(1px); }
.person .p-name { font-weight: 500; line-height: 1.15; }
.person .p-sub { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.person.is-loading { opacity: .6; pointer-events: none; }
.login-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 32px 22px; background: var(--panel); border-top: 1px solid var(--line); }
.login-foot .lf-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-13); }
.login-foot .lf-brand img { width: 18px; height: 18px; border-radius: 5px; }
.login-err { color: var(--err); min-height: 20px; font-size: var(--fs-13); padding: 0 32px 12px; }
.login-err:empty { display: none; }

.pin { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pin-who { display: flex; align-items: center; gap: 12px; padding: 8px 32px 4px; justify-content: center; }
.pin-dots { display: flex; gap: 12px; height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.pin-pad > button { height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg); font-size: 22px; font-weight: 500; color: var(--ink); cursor: pointer; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.pin-pad > button:hover { background: var(--panel); }
.pin-pad > button:active { background: var(--panel-2); }
.pin-err { color: var(--err); min-height: 20px; font-size: var(--fs-13); text-align: center; }
.pin-submit { width: 240px; max-width: 100%; }
.pin-wrap { padding: 4px 24px 32px; }

/* ───────────── settings-style blocks (shared by owner views) ───────────── */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.set-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.set-nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: var(--r-s); color: var(--text); font-weight: 500; text-decoration: none; }
.set-nav a:hover { background: var(--panel); }
.set-nav a .ic { color: var(--muted); }
.set-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-d); }
.set-nav a[aria-current="page"] .ic { color: var(--brand); }
.set-body { min-width: 0; max-width: 920px; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.set-head h2 { font-size: var(--fs-18); }
.set-intro { color: var(--muted); margin-bottom: 20px; max-width: 70ch; }
.set-group { padding: 20px 0; border-top: 1px solid var(--line); }
.set-group:first-of-type { border-top: 0; padding-top: 4px; }
.set-group > h3 { margin-bottom: 4px; font-size: var(--fs-16); }
.set-group > .g-intro { color: var(--muted); font-size: var(--fs-13); margin-bottom: 14px; max-width: 70ch; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .sr-text { min-width: 0; }
.set-row .sr-title { color: var(--ink); font-weight: 500; }
.set-row .sr-desc { color: var(--muted); font-size: var(--fs-13); margin-top: 2px; max-width: 62ch; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; background: var(--sc, var(--faint)); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.codeblock { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: var(--ink); overflow-x: auto; white-space: pre; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-d); font-weight: 600; font-size: var(--fs-13); }
.steps li b { color: var(--ink); font-weight: 600; }
.range { width: 100%; accent-color: var(--brand); }

/* ───────────── responsive ───────────── */
@media (max-width: 1199px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .side { padding: 0 8px 12px; align-items: stretch; }
  .side > .brandmark { justify-content: center; padding: 0; }
  .side > .brandmark .bm-text { display: none; }
  .nav-item { justify-content: center; padding: 0; min-height: 44px; }
  .nav-item .label { display: none; }
  .nav-item .count { position: absolute; top: 2px; right: 4px; height: 17px; min-width: 17px; padding: 0 4px; font-size: 10.5px; box-shadow: 0 0 0 2px var(--chrome); }
  .nav-item .nav-dot { position: absolute; top: 6px; right: 10px; }
  .nav-sep { margin: 8px 4px; }
  .usermenu-btn .who { display: none; }
  .settings { grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 899px) {
  :root { --gutter: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top-h) minmax(0, 1fr) calc(var(--tab-h) + env(safe-area-inset-bottom)); grid-template-areas: "top" "main" "tab"; }
  .side { display: none; }
  .top { gap: 6px; padding: 0 8px 0 12px; background: var(--chrome); border-bottom-color: transparent; color: var(--on-chrome); }
  .top-search, .top-lang { display: none; }
  .top > .brandmark { display: flex; }
  .brandmark .bm-text span { display: none; }
  .top .btn-ghost { color: var(--on-chrome); }
  .top .btn-ghost:hover { background: var(--chrome-2); color: var(--on-chrome); }
  .top .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .top .btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); border-color: transparent; }
  .top .usermenu-btn { color: var(--on-chrome); }
  .top .usermenu-btn:hover { background: var(--chrome-2); }
  .top :focus-visible { outline-color: var(--accent); }
  .phone-only { display: inline-flex !important; }
  .desk-only { display: none !important; }
  .tabbar {
    grid-area: tab; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
    z-index: var(--z-tab);
  }
  .tab-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tab-h); min-width: 44px; padding: 0 2px; border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 500; text-decoration: none; cursor: pointer; }
  .tab-item > span:not(.count):not(.nav-dot) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-item:hover { text-decoration: none; }
  .tab-item[aria-current="page"] { color: var(--brand); }
  .tab-item .count { position: absolute; top: 6px; left: calc(50% + 6px); height: 17px; min-width: 17px; padding: 0 4px; font-size: 10.5px; }
  .tab-item .nav-dot { position: absolute; top: 8px; left: calc(50% + 8px); box-shadow: 0 0 0 2px var(--bg); }
  .toasts { left: 12px; right: 12px; width: auto; bottom: auto; top: calc(var(--top-h) + 8px); }
  .bare .toasts, body.no-tabbar .toasts { top: 12px; }
  .page { padding: 16px var(--gutter) 32px; }
  .page-head { margin-bottom: 14px; }
  h1 { font-size: 20px; }
  .banner { padding: 8px var(--gutter); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .drawer { width: 100vw; border-left: 0; top: auto; max-height: 94dvh; border-radius: 20px 20px 0 0; transform: translateY(104%); }
  .drawer-layer.is-open .drawer { transform: none; }
  .drawer-head { padding: 8px 8px 8px 16px; }
  .drawer-body { padding: 16px; }
  .drawer-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .kpi-value { font-size: 22px; }
  .board { padding: 0 var(--gutter) 12px; scroll-snap-type: x mandatory; }
  .board-col { flex-basis: min(86vw, 320px); }
  .login { padding: 16px 12px 32px; }
  .login-head { padding: 22px 18px 16px; }
  .login-banner { margin: 0 18px 14px; }
  .login-err { padding: 0 18px 12px; }
  .role-row { padding: 16px 18px; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .role-ic { width: 40px; height: 40px; }
  .login-foot { padding: 14px 18px 18px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .set-row { flex-wrap: wrap; }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav a { flex: none; min-height: 40px; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; }
  .slots.full { gap: 4px; }
  .slots.full .slot span { font-size: 11px; }
}
@media (max-width: 380px) {
  .pin-pad { grid-template-columns: repeat(3, 64px); gap: 10px; }
  .slots.full .slot { gap: 2px; }
  .slots.full .slot .ic { display: none; }
}
@media (max-width: 339px) {
  .slots.full .slot span { display: none; }
}
@media (pointer: coarse) {
  .btn { --h: 44px; }
  .btn-sm { --h: 38px; }
  .btn-xl { --h: 56px; }
  .input, .select { height: 44px; font-size: 16px; }
  .input-sm, .select.input-sm { height: 38px; }
  .seg button { height: 38px; }
  .chip { height: 40px; }
  .chips-lg .chip { height: 48px; }
  .nav-item, .menu-item { min-height: 44px; }
  .list-row { min-height: 56px; }
  .tabs button { height: 44px; }
  .result { min-height: 52px; }
  .usermenu-btn { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* boot splash in index.html (no inline styles: CSP) */
.boot-splash { display: grid; place-items: center; min-height: 100dvh; }
.boot-splash .boot-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--accent); }
.boot-splash img { width: 56px; height: 56px; border-radius: 15px; }
.noscript { padding: 24px; font-family: system-ui, sans-serif; }

/* ───────────── OWNER (dashboard, team, import, settings — js/views/{dashboard,team,import,settings}.js) ───────────── */
.own-toolbar { margin-bottom: 4px; }
.own-foot { margin-top: 8px; max-width: 90ch; }
.own-gap { margin-top: 10px; }
.own-bullets { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.row-flex.wrap { flex-wrap: wrap; }
.center { text-align: center; }
.input-narrow { width: 110px; }

/* dashboard */
/* dashboard KPI rows: column counts that divide the tile count (6 main, 8 «Требует внимания»), so no tile is left
   alone on a second row; phones keep two columns */
.dash-kpis-main { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-kpis-attn { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1366px) { .dash-kpis-main { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 899px) { .dash-kpis-main, .dash-kpis-attn { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* the numbers of the period as one strip (kpiTile children): hairlines between cells, no separate tiles.
   Column counts divide six, so no cell is left alone on a row */
.statbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; margin-top: 14px; }
.statbar > .kpi { background: var(--bg); border: 0; border-radius: 0; padding: 14px 18px 16px; }
.statbar > .kpi.is-link:hover { background: var(--panel); border: 0; }
.statbar > .kpi.is-link:focus-visible { outline-offset: -2px; }
.statbar .kpi-label { font-size: var(--fs-12); }
.statbar .kpi-value { font-size: 24px; font-weight: 700; }
@media (max-width: 1199px) { .statbar { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 599px) { .statbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } .statbar > .kpi { padding: 12px 14px; } .statbar .kpi-value { font-size: 21px; } }

/* «Требует внимания»: links to the lists that need an action, nothing else */
.attn { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin: 16px 0 6px; }
.attn-title { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); font-weight: 600; color: var(--muted); }
.attn-row { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.attn-item {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg); color: var(--ink); font-weight: 500; text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.attn-item:hover { background: var(--panel); border-color: var(--faint); text-decoration: none; }
.attn-item b { font-weight: 700; }
.attn-item > .ic:last-child { color: var(--faint); }
.attn-item.tone-brand > .ic:first-child, .attn-item.tone-brand b { color: var(--brand); }
.attn-item.tone-warn > .ic:first-child, .attn-item.tone-warn b { color: var(--warn); }
.attn-item.tone-err > .ic:first-child, .attn-item.tone-err b { color: var(--err); }
.attn-none { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-13); }
.attn-none .ic { color: var(--ok); }
.dash > .tabs { margin: 14px 0 16px; }
.dash-total { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r); background: var(--panel); color: var(--ink); text-decoration: none; }
.dash-total:hover { background: var(--panel-2); text-decoration: none; }
.dash-total > .ic:first-child { color: var(--brand); }
.dash-total > .ic:last-child { color: var(--faint); margin-left: auto; }
.dash-total b { font-size: var(--fs-18); font-weight: 700; }
.dash-links { display: flex; flex-wrap: wrap; gap: 6px 24px; padding-top: 10px; border-top: 1px solid var(--line); font-size: var(--fs-13); }
.dash-links a { display: inline-flex; align-items: baseline; gap: 8px; color: var(--muted); }
.dash-links a b { color: var(--ink); font-weight: 650; }
.dash-links a:hover { color: var(--brand-d); }
.dash-aside { color: var(--muted); font-size: var(--fs-13); font-weight: 500; }
.dash-aside:hover { color: var(--brand-d); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dash-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dash-card.is-wide { grid-column: 1 / -1; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dash-card-head h2 { font-size: var(--fs-16); }
.dash-card-sub { color: var(--muted); font-size: var(--fs-13); max-width: 70ch; }
.dash-chart { width: 100%; min-width: 0; }
.dash-heat { margin-top: 2px; }
.dash-heat-head { margin-top: 10px; }
.speed-big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 6px 0 4px; }
.speed-big .speed-val { font-size: 34px; font-weight: 650; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.speed-big .speed-cap { color: var(--muted); font-size: var(--fs-13); }
.speed-big.is-ok .speed-val { color: var(--ok); }
.speed-big.is-warn .speed-val { color: var(--warn); }
.speed-big.is-err .speed-val { color: var(--err); }

/* team tables (Excel «Статистика» / «Зоир и Бахора») */
.team-table { --table-h: 72dvh; }
.team-table .table th { white-space: normal; min-width: 76px; max-width: 120px; line-height: 1.25; vertical-align: bottom; }
.team-table .table th.sticky-col, .team-table .table td.sticky-col { min-width: 150px; max-width: 220px; }
.team-table .table td { white-space: nowrap; }
.team-table .col-sep { box-shadow: inset 1px 0 0 var(--line-2); }
.team-person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; color: var(--ink); font-weight: 500; }
.cell-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border-radius: 4px; }
.cell-link:hover { color: var(--brand-d); text-decoration: underline; }
td.num .cell-link { justify-content: flex-end; }
td.is-zero, td.is-zero .cell-link { color: var(--faint); }

/* import */
.imp-flow { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.imp-steps { display: flex; gap: 6px 18px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: var(--fs-13); font-weight: 500; }
.imp-steps li { display: inline-flex; align-items: center; gap: 8px; }
.imp-steps .n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: var(--fs-12); font-weight: 600; }
.imp-steps li.is-current { color: var(--ink); }
.imp-steps li.is-current .n { background: var(--brand); color: var(--on-brand); }
.imp-steps li.is-done .n { background: var(--brand-soft); color: var(--brand-d); }
.imp-busy { display: flex; align-items: center; gap: 10px; padding: 28px 4px; color: var(--muted); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 20px; border: 2px dashed var(--line-2); border-radius: var(--r-l); background: var(--panel);
  cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); outline: none; }
.dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--bg); color: var(--brand); }
.dropzone .dz-title { color: var(--ink); font-weight: 600; font-size: var(--fs-16); }
.dropzone .dz-text { color: var(--muted); font-size: var(--fs-13); }
.dropzone .dz-hint { color: var(--muted); font-size: var(--fs-12); max-width: 52ch; margin-top: 4px; }
.imp-facts { margin: 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-13); display: flex; flex-direction: column; gap: 4px; max-width: 90ch; }
.imp-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--panel); }
.imp-file > .ic { color: var(--brand); }
.imp-file .main-col { flex: 1; min-width: 0; }
.imp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.imp-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.imp-kpis .kpi .kpi-value { font-size: 22px; }
.imp-kpis .kpi .kpi-label span { white-space: normal; }
.imp-block { border-top: 1px solid var(--line); padding-top: 16px; }
.imp-block > h3 { font-size: var(--fs-16); margin-bottom: 4px; }
.imp-block .g-intro { color: var(--muted); font-size: var(--fs-13); margin-bottom: 12px; max-width: 80ch; }
details.imp-block > summary { cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; list-style: none; }
details.imp-block > summary::-webkit-details-marker { display: none; }
details.imp-block > summary::before { content: "›"; display: inline-block; width: 12px; color: var(--muted); transition: transform var(--t-fast) var(--ease); }
details.imp-block[open] > summary::before { transform: rotate(90deg); }
details.imp-block > :not(summary) { margin-top: 10px; }
.imp-errors ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13); }
.map-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(200px, 320px); align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.map-assume { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 320px); align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border-radius: var(--r); background: var(--panel); }
.map-arrow { color: var(--faint); display: grid; place-items: center; }
.map-name { min-width: 0; }
.imp-comment { min-width: 180px; max-width: 320px; white-space: normal; }
.imp-fname { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-refreshing { opacity: .6; transition: opacity var(--t) var(--ease); }

/* settings */
.rule-summary { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding: 10px 12px; border-radius: var(--r); background: var(--brand-soft); color: var(--text); font-size: var(--fs-13); }
.rule-summary .ic { color: var(--brand); margin-top: 1px; }
.stale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; width: 100%; }
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 20px 0 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); box-shadow: var(--shadow-2);
}
.savebar-text { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; font-size: var(--fs-13); }
.savebar-text .ic { color: var(--warm-d); }
.savebar-actions { display: flex; gap: 8px; margin-left: auto; }
.edit-list { display: flex; flex-direction: column; }
.edit-list + .edit-list, .edit-add + .edit-list { border-top: 1px solid var(--line); }
.edit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.edit-list .edit-row:last-child { border-bottom: 0; }
.edit-row > .edit-main:first-child { grid-column: 1 / 3; }
.edit-row.is-off .edit-main .input { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.edit-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.edit-main .input { flex: 1; min-width: 0; max-width: 420px; }
.edit-key { flex: none; font-size: var(--fs-12); }
.edit-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.edit-add { padding: 10px 0; }
.edit-add .input { max-width: 360px; }
.swatch.stage-swatch { flex: none; }
.colour-pop { padding: 6px; }
.colour-pop .swatches { gap: 8px; }
.code-wrap { position: relative; min-width: 0; }
.code-wrap .codeblock { margin: 0; padding-right: 120px; max-height: 420px; overflow: auto; }
.code-wrap .code-copy { position: absolute; top: 8px; right: 8px; }
.connect { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.connect-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.connect-qr .qr svg { width: 180px; }
.key-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pin-row { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.pin-row .field { flex: 1; min-width: 160px; }
.pin-row > .btn { margin-top: 26px; }
.drawer-group { padding: 14px 0 0; }
.list-intro { margin: 12px 0; }
.table tr.is-revoked td { color: var(--muted); }

@media (max-width: 1099px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .map-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .map-row .map-arrow { display: none; }
  .map-assume { grid-template-columns: minmax(0, 1fr); }
  .connect { grid-template-columns: minmax(0, 1fr); }
  .connect-qr { align-items: flex-start; }
  .edit-row { grid-template-columns: auto minmax(0, 1fr); }
  .edit-row > .edit-ctl { grid-column: 1 / -1; justify-content: flex-start; }
  .edit-row > .edit-main:first-child { grid-column: 1 / -1; }
  .edit-main { flex-wrap: wrap; }
  .edit-main .input { max-width: none; flex-basis: 100%; }
  .code-wrap .codeblock { padding-right: 14px; padding-top: 46px; }
  .savebar { margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); border-radius: 0; border-left: 0; border-right: 0; }
  .savebar-actions { width: 100%; }
  .savebar-actions .btn { flex: 1; }
  .imp-flow { padding: 14px; }
  .speed-big .speed-val { font-size: 28px; }
}
