/* Панель оператора нейроофиса · ЕВИСК.
   Тёплый рабочий стиль: мягкий фон, бирюзовый акцент для действий, тёплый коралловый для выделений.
   Цвет несёт смысл: красный — срочно и деньги в минус, янтарный — внимание, зелёный — в порядке, серый — нет данных.
   Без внешних шрифтов и библиотек. Все цвета — переменные ниже; тёмная тема — отдельная палитра, а не инверсия. */

:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --bg-glow: #e6f3f0;
  --bg-glow-2: #fcebe1;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --surface-3: #f1ede6;
  --border: #e8e2d8;
  --border-strong: #d4ccbf;
  --zebra: #fbf9f6;
  --hover: #f1f8f6;
  --text: #1d2a2f;
  --text-2: #43535a;
  --muted: #5d6b71;

  --accent: #0e7470;
  --accent-hover: #0a5c59;
  --accent-soft: #e2f2ef;
  --accent-line: #a7d8d1;
  --on-accent: #ffffff;
  --warm: #e9875a;
  --warm-soft: #fdeee5;
  --warm-line: #f4c6ac;
  --warm-text: #9c4623;
  --info: #3b5ec2;
  --info-soft: #ebf0fc;
  --info-line: #c4d1f3;

  --red: #b42d26;
  --red-soft: #fdecea;
  --red-line: #f1c2bd;
  --red-mark: #d13c31;
  --on-red: #ffffff;
  --amber: #8a5200;
  --amber-soft: #fff4de;
  --amber-line: #efd39a;
  --amber-mark: #e5a019;
  --green: #18764a;
  --green-soft: #e5f5ec;
  --green-line: #b6dfc6;
  --green-mark: #2ea566;
  --gray-soft: #f0ece6;
  --gray-line: #ddd6cb;
  --gray-mark: #a19a8f;
  --violet: #6a4fc0;
  --violet-soft: #efebfb;

  --tip-bg: #1d2a2f;
  --tip-text: #ffffff;
  --shadow-sm: 0 1px 2px rgb(52 40 24 / 0.05);
  --shadow: 0 1px 2px rgb(52 40 24 / 0.04), 0 8px 24px -12px rgb(52 40 24 / 0.14);
  --shadow-lg: 0 24px 60px -16px rgb(30 36 38 / 0.32);
  --focus: #0e7470;
  --backdrop: rgb(24 30 32 / 0.42);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --topbar-h: 60px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1315;
    --bg-glow: #0f2624;
    --bg-glow-2: #2a1a12;
    --surface: #151d20;
    --surface-2: #1a2326;
    --surface-3: #212c30;
    --border: #253135;
    --border-strong: #344349;
    --zebra: #172024;
    --hover: #1a2b2b;
    --text: #e7eff0;
    --text-2: #bccacd;
    --muted: #94a5aa;

    --accent: #4fc4bd;
    --accent-hover: #76d6d0;
    --accent-soft: #123331;
    --accent-line: #22504c;
    --on-accent: #062321;
    --warm: #f19b70;
    --warm-soft: #33211a;
    --warm-line: #5e3726;
    --warm-text: #f6b493;
    --info: #93abf3;
    --info-soft: #1a2440;
    --info-line: #2f3f6e;

    --red: #ff9a91;
    --red-soft: #361b1a;
    --red-line: #6a2e29;
    --red-mark: #f0645a;
    --on-red: #2a0d0a;
    --amber: #f3c56e;
    --amber-soft: #30270f;
    --amber-line: #5f4d1f;
    --amber-mark: #e9b44a;
    --green: #84d8a7;
    --green-soft: #11301f;
    --green-line: #285a3c;
    --green-mark: #4cbc7d;
    --gray-soft: #20292c;
    --gray-line: #38464b;
    --gray-mark: #6f7f85;
    --violet: #b8a6f5;
    --violet-soft: #251f3d;

    --tip-bg: #e7eff0;
    --tip-text: #0d1315;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -14px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 28px 70px -16px rgb(0 0 0 / 0.75);
    --focus: #76d6d0;
    --backdrop: rgb(0 0 0 / 0.6);
  }
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.5 var(--font);
  background:
    radial-gradient(900px 420px at 100% -8%, var(--bg-glow-2), transparent 62%),
    radial-gradient(1100px 520px at 30% -14%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-family: var(--font-display); }
p { margin: 0 0 8px; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }
.ic { display: inline-block; flex: none; width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.neg { color: var(--red); }
.pos { color: var(--green); }
.na { color: var(--muted); font-size: 13px; white-space: nowrap; }
.num, .kpi-value, .t, time, .timer, .chart-y, .chart-x, .ch-old, .ch-new, .mc-hero-value {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.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;
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  padding: 8px 12px; background: var(--surface); color: var(--accent);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.skip-link:focus { top: 8px; }
.noscript { padding: 24px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 7px 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14.5px; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent-line); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red-mark); color: var(--red); }
.btn-quiet { border-color: transparent; background: transparent; box-shadow: none; }
.btn-quiet:hover { background: var(--surface-3); border-color: transparent; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); box-shadow: none; }
.btn-soft:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.btn-lg { min-height: 46px; padding: 10px 22px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-link {
  border: 0; background: none; padding: 0; margin: 0;
  color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  cursor: pointer; font-size: inherit;
}
.btn-link:hover { color: var(--accent-hover); }
.btn-price { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 13px; text-decoration: none; }
.btn-price .ic { width: 15px; height: 15px; }
.btn-price:hover { text-decoration: underline; }
.btn-refresh.is-busy .ic { animation: spin 0.9s linear infinite; }
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none;
  border: 2px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Аватары ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em; line-height: 1;
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.4);
}
.avatar-xs { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; margin: 0 auto 10px; }
.ava-teal { background: var(--accent-soft); color: var(--accent); }
.ava-blue { background: var(--info-soft); color: var(--info); }
.ava-coral { background: var(--warm-soft); color: var(--warm-text); }
.ava-violet { background: var(--violet-soft); color: var(--violet); }
.ava-amber { background: var(--amber-soft); color: var(--amber); }
.avatar.is-off { filter: grayscale(1); opacity: 0.7; }

/* ---------- Каркас ---------- */
.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) auto;
  min-height: 100vh;
}
.topbar {
  grid-column: 1 / -1;
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) { .topbar { background: var(--surface); } }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(140deg, var(--accent) 0%, #2f9c95 55%, var(--warm) 140%);
  color: #ffffff;
  box-shadow: 0 4px 12px -4px rgb(14 116 112 / 0.55);
}
.brand-mark-lg { width: 52px; height: 52px; border-radius: 16px; margin-bottom: 14px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-weight: 750; font-size: 17px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1 1 auto; }
.menu-btn { display: none; flex: none; }
.mock-tag {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-line);
  padding: 2px 7px; border-radius: 999px;
}
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--surface-3); font-size: 14px; font-weight: 600; }

.sidenav {
  position: sticky; top: var(--topbar-h); align-self: start;
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 12px;
  color: var(--text-2); text-decoration: none; font-weight: 600;
  transition: background-color 0.15s, color 0.15s;
}
.nav-link .ic { width: 20px; height: 20px; color: var(--muted); transition: color 0.15s; }
.nav-label { flex: 1 1 auto; min-width: 0; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link:hover .ic { color: var(--accent); }
.nav-link[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow), inset 3px 0 0 var(--accent); }
.nav-link[aria-current="page"] .ic { color: var(--accent); }
.nav-foot { margin-top: auto; padding: 14px 8px 4px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); }
.nav-foot:empty { display: none; }
.nav-foot > span:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.nav-user-name { font-weight: 650; font-size: 14px; }
.nav-user-sub { font-size: 12px; color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  font-size: 12px; font-weight: 750; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.badge-red { background: var(--red-mark); color: var(--on-red); box-shadow: 0 2px 8px -2px rgb(224 72 61 / 0.6); }
.badge-red-soft { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-line); }
.badge-accent { background: var(--accent); color: var(--on-accent); }

.main { padding: 26px 32px 64px; min-width: 0; width: 100%; max-width: 1280px; }
.main:focus { outline: none; }
.screen-enter { animation: enter 0.19s var(--ease) both; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 0 10px; gap: 6px; }
  .menu-btn { display: inline-flex; }
  .sidenav {
    display: none;
    position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 25;
    height: auto; max-height: calc(100vh - var(--topbar-h));
    padding: 10px 12px 14px;
    background: var(--surface); border-right: 0; border-bottom: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
  }
  .sidenav.open { display: flex; animation: drop 0.18s var(--ease); }
  .nav-foot { margin-top: 10px; }
  .main { padding: 18px 16px 48px; }
  .user-chip { display: none; }
}
@media (max-width: 560px) {
  .topbar .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar .btn-sm { width: 40px; padding: 0; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-name { font-size: 16px; }
}

/* ---------- Заголовок экрана ---------- */
.screen-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px; margin-bottom: 14px;
}
.sh-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sh-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
}
.sh-icon .ic { width: 24px; height: 24px; }
.sh-text { min-width: 0; }
.screen-head h1 { font-size: 27px; font-weight: 750; letter-spacing: -0.01em; }
.subtitle { margin: 3px 0 0; color: var(--text-2); }
.owner { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); color: var(--muted); font-size: 13.5px; }
.owner strong { color: var(--text); font-weight: 650; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--warm-text); letter-spacing: 0.01em; }
.eyebrow::first-letter { text-transform: uppercase; }

/* ---------- Источники ---------- */
.sources {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 0 0 22px; font-size: 12.5px; color: var(--muted);
}
.sources-title { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font); font-size: 12.5px; font-weight: 650; color: var(--muted); }
.sources-title .ic { width: 15px; height: 15px; }
.sources-none { gap: 6px; }
.src-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.src {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 75%, transparent); box-shadow: inset 0 0 0 1px var(--border);
}
.src-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-mark); flex: none; }
.src-name { color: var(--text-2); font-weight: 600; }
.src-time { white-space: nowrap; }
.src-note::before { content: "· "; }
.src.stale { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber-line); }
.src.stale .src-dot { background: var(--amber-mark); }
.src-stale { color: var(--amber); font-weight: 650; }
@media (max-width: 700px) { .src-note { display: none; } }

/* ---------- Блоки ---------- */
.block { margin: 0 0 30px; }
.block-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 16px; margin-bottom: 12px;
}
.block h2 { font-size: 18.5px; font-weight: 700; letter-spacing: -0.005em; }
.block > h2 { margin-bottom: 12px; }
.block-note { margin: 0; color: var(--muted); font-size: 13px; }
.tiles-title { margin: 4px 0 10px; font-family: var(--font); font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpis + .tiles-title { margin-top: 18px; }
.count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px;
  margin-left: 6px; padding: 0 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-family: var(--font); font-size: 12.5px; font-weight: 700; vertical-align: 2px; font-variant-numeric: tabular-nums;
}
.notice {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 0 0 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
}
.notice.tone-amber { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber-line); }
.notice.tone-red { background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-line); }
.notice.tone-green { background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green-line); }
[id^="a-"] { scroll-margin-top: calc(var(--topbar-h) + 14px); }
[id^="a-"]:focus { outline: none; }
.is-target { outline: 3px solid var(--accent-line) !important; outline-offset: 5px; border-radius: var(--radius); }
.error-box {
  padding: 22px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 4px 0 0 var(--red-mark);
}
.error-box h1 { font-size: 21px; margin-bottom: 8px; }

/* ---------- Пустые состояния: иллюстрация рисуется маской, цвет — градиент акцента ---------- */
.empty {
  padding: 26px 18px 22px; text-align: center;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-2);
}
.empty::before {
  content: ""; display: block; width: 96px; height: 70px; margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--accent) 10%, var(--warm) 95%);
  -webkit-mask: var(--illo) center / contain no-repeat;
  mask: var(--illo) center / contain no-repeat;
  opacity: 0.85;
}
.empty p { margin: 0; font-weight: 650; color: var(--text); }
.empty .empty-sub { margin-top: 4px; font-weight: 400; color: var(--muted); font-size: 14px; }
.empty-calm, .empty { --illo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M36 10 23 17l5 9 6-3.4V60h28V22.6l6 3.4 5-9-13-7c-2 5-7 7.6-12 7.6S38 15 36 10z'/%3E%3Cpath d='m40 39 6 6 11-12'/%3E%3Cpath d='m80 12 1.6 4.2 4.2 1.6-4.2 1.6L80 23.6l-1.6-4.2-4.2-1.6 4.2-1.6z'/%3E%3Cpath d='M14 46h.01M86 50h.01M12 20h.01'/%3E%3C/svg%3E"); }
.empty-box { --illo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='m20 30 28-12 28 12-28 12z'/%3E%3Cpath d='M20 30v20l28 12 28-12V30M48 42v20'/%3E%3Cpath d='M38 10c3 4 3 7 0 10M58 8c-3 4-3 7 0 10'/%3E%3Cpath d='m82 14 1.4 3.6 3.6 1.4-3.6 1.4L82 24l-1.4-3.6-3.6-1.4 3.6-1.4z'/%3E%3C/svg%3E"); }
.empty-chat { --illo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M16 10h38a7 7 0 0 1 7 7v16a7 7 0 0 1-7 7H32l-11 9v-9h-5a7 7 0 0 1-7-7V17a7 7 0 0 1 7-7z'/%3E%3Cpath d='M66 28h14a7 7 0 0 1 7 7v12a7 7 0 0 1-7 7h-2v8l-9-8h-9a7 7 0 0 1-7-7v-4'/%3E%3Cpath d='M24 25h.01M35 25h.01M46 25h.01'/%3E%3C/svg%3E"); }
.empty-search { --illo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Ccircle cx='42' cy='30' r='17'/%3E%3Cpath d='m55 43 15 15'/%3E%3Cpath d='M35 30h14'/%3E%3Cpath d='m80 12 1.4 3.6 3.6 1.4-3.6 1.4L80 22l-1.4-3.6-3.6-1.4 3.6-1.4z'/%3E%3C/svg%3E"); }
.empty-done { --illo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Ccircle cx='48' cy='35' r='24'/%3E%3Cpath d='m37 35 8 8 15-16'/%3E%3Cpath d='m82 10 1.4 3.6 3.6 1.4-3.6 1.4L82 20l-1.4-3.6-3.6-1.4 3.6-1.4zM14 52h.01M18 16h.01'/%3E%3C/svg%3E"); }

/* ---------- Скелетоны ---------- */
.skel {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 45%, var(--surface-3) 90%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skel-screen { display: grid; gap: 14px; padding-top: 4px; }
.skel-title { width: min(340px, 70%); height: 34px; }
.skel-line { width: min(520px, 90%); height: 14px; }
.skel-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 14px; margin-top: 6px; }
.skel-tile { height: 112px; border-radius: var(--radius); }
.skel-block { height: 150px; border-radius: var(--radius); }
.skel-short { height: 90px; width: 70%; }
.skel-chat { display: grid; gap: 14px; padding: 4px; }
.skel-bubble { width: 58%; height: 56px; border-radius: 16px; }
.skel-right { justify-self: end; width: 40%; height: 40px; }
.skel-wide { width: 72%; height: 92px; }

/* ---------- Сегодня: приветствие ---------- */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 14px; padding: 24px 28px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 220px at 92% 30%, var(--warm-soft), transparent 70%),
    linear-gradient(120deg, var(--surface) 30%, var(--accent-soft) 140%);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
}
.hero-text { min-width: 0; position: relative; z-index: 1; }
.hero h1 { font-size: 30px; font-weight: 750; letter-spacing: -0.015em; }
.hero-summary { margin: 6px 0 14px; font-size: 16.5px; color: var(--text-2); }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-art { flex: none; margin: -10px -6px -16px 0; }
.hero-art svg { display: block; width: 240px; height: auto; }
.ha-sun { fill: var(--warm-soft); }
.ha-dot { fill: var(--accent-line); }
.ha-dot2, .ha-star, .ha-snap { fill: var(--warm); }
.ha-line { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.ha-shirt { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.7; stroke-linejoin: round; }
.ha-body { fill: var(--warm-soft); stroke: var(--warm); stroke-width: 1.7; stroke-linejoin: round; }
.ha-peg { stroke: var(--text-2); stroke-width: 2.4; stroke-linecap: round; }
@media (max-width: 640px) {
  .hero { padding: 18px; }
  .hero h1 { font-size: 24px; }
  .hero-summary { font-size: 15px; }
  .hero-art { display: none; }
}
.pill {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
  transition: box-shadow 0.15s, transform 0.1s;
}
.pill:hover { color: var(--text); box-shadow: var(--shadow), inset 0 0 0 1px var(--accent-line); }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .ic { width: 17px; height: 17px; }
.pill-green .ic { color: var(--green-mark); }
.pill-red { background: var(--red-soft); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-line); }
.pill-amber { background: var(--amber-soft); color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber-line); }
.pill-accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px -6px var(--accent); }
.pill-accent:hover { color: var(--on-accent); background: var(--accent-hover); }
.pill-gray .ic { color: var(--muted); }

/* ---------- Плитки ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(156px, 100%), 1fr)); gap: 14px; }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); } }
.kpi {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: 14px 16px 12px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
}
.kpi-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi-ic {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent);
}
.kpi-ic .ic { width: 17px; height: 17px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.3; }
.kpi-value { margin-top: 10px; font-family: var(--font-display); font-size: 27px; font-weight: 750; line-height: 1.1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.kpi-unit { font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi-value .na { font-size: 15px; font-weight: 500; }
.kpi-sub { margin-top: 5px; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.trend { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12.5px; font-weight: 650; }
.trend .ic { width: 15px; height: 15px; padding: 2px; border-radius: 50%; }
.trend-up { color: var(--green); }
.trend-up .ic { background: var(--green-soft); }
.trend-down { color: var(--red); }
.trend-down .ic { background: var(--red-soft); }
.trend-flat { color: var(--muted); }
.trend-flat .ic { background: var(--surface-3); }
.trend-note { font-weight: 500; color: var(--muted); }
.spark { margin-top: auto; padding-top: 10px; }
.spark svg { display: block; width: 100%; height: 30px; }
.sp-on { fill: var(--accent); }
.sp-off { fill: var(--accent-line); }
.sp-on.sp-zero { fill: var(--accent-line); }
.sp-off.sp-zero { fill: var(--border); }
.kpi.tone-red { box-shadow: var(--shadow), inset 0 0 0 1px var(--red-line); }
.kpi.tone-red .kpi-value { color: var(--red); }
.kpi.tone-red .kpi-ic { background: var(--red-soft); color: var(--red); }
.kpi.tone-amber .kpi-value { color: var(--amber); }
.kpi.tone-amber .kpi-ic { background: var(--amber-soft); color: var(--amber); }
.kpi.tone-green .kpi-value { color: var(--green); }
.kpi.tone-green .kpi-ic { background: var(--green-soft); color: var(--green); }

.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--gray-mark); }
.dot-green { background: var(--green-mark); }
.dot-amber { background: var(--amber-mark); }
.dot-red { background: var(--red-mark); }
.dot-gray { background: var(--gray-mark); }
.dot-info { background: var(--accent); }

/* ---------- Подсказки ---------- */
.hints-all { font-size: 13.5px; }
.hint-none { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 9px 14px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 14px; font-weight: 600; }
.hint-none .ic { width: 17px; height: 17px; }
.hint-group + .hint-group { margin-top: 18px; }
.hint-group-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
  font-family: var(--font); font-size: 13px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.hg-ic { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 7px; }
.hg-ic .ic { width: 14px; height: 14px; }
.hint-group-red .hint-group-title { color: var(--red); }
.hint-group-red .hg-ic { background: var(--red-soft); }
.hint-group-amber .hint-group-title { color: var(--amber); }
.hint-group-amber .hg-ic { background: var(--amber-soft); }
.hint-group-info .hint-group-title { color: var(--info); }
.hint-group-info .hg-ic { background: var(--info-soft); }
.hints { display: grid; gap: 8px; }
.hint {
  min-width: 0; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
  transition: box-shadow 0.2s;
}
.hint:hover, .hint.is-open { box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.hint-red { box-shadow: var(--shadow), inset 0 0 0 1px var(--red-line); }
.hint-red.is-open, .hint-red:hover { box-shadow: var(--shadow), inset 0 0 0 1px var(--red-line); }
.hint-h { margin: 0; }
.hint-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
  border-radius: var(--radius);
}
.hint-toggle:focus-visible { outline-offset: -2px; }
.hint-ic {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; border-radius: 11px;
}
.hint-ic .ic { width: 19px; height: 19px; }
.hint-red .hint-ic { background: var(--red-soft); color: var(--red); }
.hint-amber .hint-ic { background: var(--amber-soft); color: var(--amber); }
.hint-info .hint-ic { background: var(--info-soft); color: var(--info); }
.hint-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.hint-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.hint-line {
  margin-top: 2px; font-size: 13.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.hint.is-open .hint-line { display: none; }
.hint-area { flex: none; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.hint-more { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--accent); font-size: 13px; font-weight: 650; }
.hint-more .ic { width: 18px; height: 18px; transition: transform 0.22s var(--ease); }
.hint.is-open .hint-more .ic { transform: rotate(180deg); }
.hint-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.24s var(--ease); }
.hint.is-open .hint-body { grid-template-rows: 1fr; }
.hint-inner { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility 0s linear 0.24s; }
.hint.is-open .hint-inner { visibility: visible; transition-delay: 0s; }
.hint-inner > * { margin-left: 60px; margin-right: 18px; }
.hint-inner::after { content: ""; display: block; height: 16px; }
.hint-detail { margin-top: 0; color: var(--text-2); }
.hint-dl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 10px 22px; margin-top: 10px; margin-bottom: 12px; padding: 12px 14px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.hint-dl dt, .ap-meta dt, .detail-dl dt, .calc-dl dt, .mc-stats dt, .run-stats dt {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 650; color: var(--muted);
}
.hint-dl dt .ic, .mc-stats dt .ic { width: 14px; height: 14px; }
.hint-dl dd, .detail-dl dd, .calc-dl dd, .mc-stats dd, .run-stats dd { margin: 2px 0 0; font-size: 14px; }
.hint-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) {
  .hint-toggle { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .hint-main { flex-basis: calc(100% - 50px); }
  .hint-area { margin-left: 46px; }
  .hint-more { margin-left: auto; }
  .hint-inner > * { margin-left: 14px; margin-right: 14px; }
}

/* ---------- Метки ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: var(--gray-soft); color: var(--text-2);
}
.tag .ic { width: 13px; height: 13px; }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-gray { background: var(--gray-soft); color: var(--text-2); }
.tag-info { background: var(--info-soft); color: var(--info); }
.tag-warm { background: var(--warm-soft); color: var(--warm-text); }

/* ---------- Таблицы ---------- */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
  container-type: inline-size;
}
.table-wrap:focus-visible { outline-offset: 2px; }
.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.t th, .t td {
  padding: 10px 10px; text-align: left; vertical-align: top; white-space: nowrap;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.t thead th {
  background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 700; line-height: 1.3; vertical-align: bottom;
  text-transform: uppercase; letter-spacing: 0.04em;
  white-space: normal; min-width: 64px;
}
.t thead th:first-child { border-top-left-radius: var(--radius); }
.t thead th:last-child { border-top-right-radius: var(--radius); }
.t tbody th { font-weight: 500; }
.t tbody tr:last-child > * { border-bottom: 0; }
.t tr.is-even > * { background: var(--zebra); }
.t tbody tr:not(.detail-row):not(.group-row):hover > * { background: var(--hover); }
.t .num { text-align: right; }
.t .wrap { white-space: normal; min-width: 180px; }
.t .wrap-sm { white-space: normal; min-width: 120px; }
.t .mono { white-space: nowrap !important; color: var(--text-2); }
.t .sticky-col { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
.t thead .sticky-col { z-index: 2; }
.t tr.row-red > * { background: var(--red-soft); }
.t tr.row-red:hover > * { background: color-mix(in srgb, var(--red-soft) 70%, var(--red-line)); }
.t tr.row-amber > * { background: var(--amber-soft); }
.t tr.group-row > * { background: var(--surface-3); font-size: 12.5px; font-weight: 700; color: var(--text-2); padding-top: 7px; padding-bottom: 7px; }
.t tfoot th, .t tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; font-weight: 750; background: var(--surface-2); }
.t .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.t .sticky-col .sub, .t .wrap .sub { white-space: normal; }
.t .sub.pos { color: var(--green); font-weight: 600; }
.t .sub.neg { color: var(--red); font-weight: 600; }
.t .sub .tag { margin-top: 3px; }
.t-compact th, .t-compact td { padding: 8px 12px; }
.t-foot { margin: 8px 4px 0; font-size: 12.5px; color: var(--muted); }
/* Подсортировка (экран «Остатки») */
.rs-sub { margin: 22px 0 6px; align-items: center; }
.rs-sub h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.rs-note { margin: 0 0 10px; }
.t-inner { min-width: 640px; font-size: 13.5px; }
.t-inner th[scope="row"] { font-weight: 400; }
#tbl-rs-own th.sticky-col, #tbl-rs-clusters th.sticky-col { max-width: 320px; white-space: normal; }
@media (max-width: 600px) { .t tbody th.sticky-col { max-width: 140px; white-space: normal; } }
@media (min-width: 701px) {
  .table-wrap.is-tall { max-height: min(74vh, 780px); overflow: auto; }
  .table-wrap.is-tall thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--border); }
  .table-wrap.is-tall thead th.sticky-col { z-index: 4; }
}
.th-sort {
  display: inline-flex; align-items: flex-end; gap: 4px;
  padding: 0; margin: 0; border: 0; background: none;
  color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: inherit; cursor: pointer;
}
.num .th-sort { flex-direction: row-reverse; text-align: right; }
.th-sort:hover { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sort-ind { display: inline-block; min-width: 9px; font-size: 12px; color: var(--muted); line-height: 1.3; opacity: 0; transition: opacity 0.15s; }
th:hover .sort-ind, th:focus-within .sort-ind { opacity: 1; }
.t td.wrap-sub .sub { white-space: normal; min-width: 96px; }
th.is-sorted { color: var(--accent); }
th.is-sorted .sort-ind { color: var(--accent); opacity: 1; }
.row-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0; margin: 0 0 0 -4px; border: 0; background: none; color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.row-toggle:hover { color: var(--accent); }
.row-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.chev { display: inline-flex; color: var(--muted); }
.chev .ic { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
[aria-expanded="true"] > .chev .ic { transform: rotate(90deg); }
.model-code { font-weight: 700; }
.cell-tags { display: block; margin-top: 4px; }
.detail-row > td { background: var(--surface-2); white-space: normal; }
.detail-inner { position: sticky; left: 12px; max-width: calc(100cqw - 24px); }
.detail-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 10px 22px; margin: 2px 0; }
/* Полоска в ячейке: доля от максимума колонки */
.cbar { display: block; height: 4px; margin: 5px 0 1px auto; width: 100%; max-width: 110px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.cbar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.cbar-green { background: var(--green-mark); }
.cbar-red { background: var(--red-mark); }
.cbar-amber { background: var(--amber-mark); }
.cbar-gray { background: var(--gray-mark); }
.t-accruals .cbar { max-width: 160px; }

/* Таблица ↔ карточки: на телефоне вместо широких таблиц — карточки */
.dt-mobile { display: none; }
.dt-sort { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dt-sort label { font-size: 13px; font-weight: 650; color: var(--muted); }
.dt-sort select { flex: 1 1 auto; }
.dt-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dt-card {
  min-width: 0; padding: 14px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
}
.dt-card.row-red { box-shadow: var(--shadow), inset 0 0 0 1px var(--red-line); background: linear-gradient(var(--red-soft), var(--red-soft)) top / 100% 4px no-repeat, var(--surface); }
.dt-card-detail { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.dt-card .sub { display: block; font-size: 12px; color: var(--muted); }
.dt-card .sub.pos { color: var(--green); }
.dt-card .sub.neg { color: var(--red); }
@media (max-width: 700px) {
  .dt .table-wrap.has-cards { display: none; }
  .dt-mobile { display: block; }
}
.mc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mc-title { min-width: 0; }
.mc-title .model-code { font-size: 16px; }
.mc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 12px 0; }
.mc-stats > div { min-width: 0; }
.mc-stats .mc-wide { grid-column: 1 / -1; }
.mc-stats dd .cbar { margin-left: 0; max-width: none; }
.mc-stats dd .sub.pos, .mc-stats dd .sub.neg { display: inline; font-weight: 650; }
.mc-note { margin: 0 0 10px; }
.mc-more { width: 100%; }
.mc-hero { margin: 12px 0 0; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.mc-hero-label { display: block; font-size: 12px; font-weight: 650; color: var(--muted); }
.mc-hero-value { display: inline-block; margin-top: 2px; font-family: var(--font-display); font-size: 22px; font-weight: 750; }
.mc-hero-sub { margin-left: 8px; font-size: 13px; color: var(--muted); }
.mc-hero .cbar { max-width: none; margin-top: 8px; }
.oc-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.oc-main { min-width: 0; }
.oc-offer { font-weight: 650; }
.oc-profit { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-family: var(--font-display); font-weight: 750; font-size: 17px; text-align: right; }
.oc-costs { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- Графики ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 14px; }
.chart {
  margin: 0; min-width: 0; padding: 16px 16px 12px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
}
.chart-title { font-family: var(--font); font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--text-2); }
.chart-body { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 156px; margin: -7px 0; font-size: 11.5px; color: var(--muted); text-align: right; }
.chart-plot { position: relative; height: 156px; border-radius: 6px; }
.chart-plot:focus-visible { outline-offset: 4px; }
.chart-grid { position: absolute; inset: 0; pointer-events: none; }
.chart-grid span { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--border); }
.chart-grid span:nth-child(1) { top: 0; }
.chart-grid span:nth-child(2) { top: 50%; }
.chart-grid span:nth-child(3) { bottom: 0; border-top: 1px solid var(--border-strong); }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bar-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  display: block; width: 100%; max-width: 22px; min-height: 0;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 72%, var(--surface)) 100%);
  transition: opacity 0.15s, filter 0.15s;
}
.chart-green .bar { background: linear-gradient(180deg, var(--green-mark) 0%, color-mix(in srgb, var(--green-mark) 70%, var(--surface)) 100%); }
.bar-col.is-zero .bar { height: 3px !important; background: var(--border); border-radius: 2px; }
.bar-col.is-na .bar { height: 3px !important; background: repeating-linear-gradient(90deg, var(--gray-line) 0 3px, transparent 3px 5px); }
.chart-plot:hover .bar-col:not(.is-active) .bar, .chart-plot:focus-visible .bar-col:not(.is-active) .bar { opacity: 0.45; }
.bar-col.is-active .bar { filter: saturate(1.2); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-line); }
.chart-tip {
  position: absolute; z-index: 5; max-width: 260px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--tip-bg); color: var(--tip-text);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.chart-x { position: relative; height: 18px; margin: 6px 0 0 60px; font-size: 11.5px; color: var(--muted); }
.chart-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.chart-x span.is-first { transform: none; }
.chart-x span.is-last { transform: translateX(-100%); }
.chart figcaption { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- К сборке ---------- */
.ships { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ship {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 14px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}
.ship-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.ship-red { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--red-line); }
.ship-red .ship-ic { background: var(--red-soft); color: var(--red); }
.ship-amber .ship-ic { background: var(--amber-soft); color: var(--amber); }
.ship-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.ship-items { font-weight: 650; }
.ship-meta { font-size: 12.5px; color: var(--muted); }
.ship-tariff { margin-top: 4px; }
.ship-tariff .tag { font-size: 12px; white-space: normal; }
.ship-when { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; text-align: right; }
.ship-deadline { font-size: 12.5px; color: var(--muted); }
@media (max-width: 520px) { .ship { flex-wrap: wrap; } .ship-when { flex-direction: row; align-items: center; margin-left: 50px; } }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.field-help { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input:not([type]), select, textarea {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--accent-line); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 4px var(--accent-line); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red-mark); }
.input-ic { position: relative; }
.input-ic .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-ic input { padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 12px; margin: 12px 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.form-error { margin: 8px 0 0; color: var(--red); font-size: 14px; font-weight: 600; }
.form-msg { margin: 0; font-size: 14px; }
.form-msg.form-error { margin: 0; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; cursor: pointer; }
.checkbox input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.warn-box { margin: 12px 0 0; padding: 12px 14px; background: var(--amber-soft); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--amber-line); }
.warn-box p { color: var(--text); }
.funnel { padding: 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 0 0 1px var(--border); }
.funnel h3 { font-family: var(--font); font-size: 15px; font-weight: 700; margin: 14px 0 8px; }
.funnel .table-wrap { margin: 8px 0; box-shadow: inset 0 0 0 1px var(--border); }
.funnel-form { margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.funnel-form h3 { margin-top: 0; }

/* ---------- Окна ---------- */
.dlg-box {
  width: min(580px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
  padding: 0; border: 0; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--border);
}
.dlg-box[open] { animation: pop-in 0.18s var(--ease); }
.dlg-box::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dlg { padding: 22px; }
.dlg-title { font-size: 20px; font-weight: 750; margin: 0 0 8px; }
.dlg-body { color: var(--text-2); }
.dlg-body strong { color: var(--text); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.pv-row { display: flex; gap: 8px; }
.pv-row input { flex: 1 1 auto; }
.pv-table { margin-top: 12px; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.pv-table thead th { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pv-table tbody th { white-space: normal; }
.pv-out { margin-top: 4px; }
.pv-out > p { margin-top: 10px; }
.pv-mode {
  display: block; margin: 12px 0 0; padding: 11px 14px 11px 40px; position: relative;
  background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
}
.pv-mode::before {
  content: ""; position: absolute; left: 14px; top: 13px; width: 16px; height: 16px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12V4.5A1.5 1.5 0 0 1 4.5 3H12l9 9-9 9z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12V4.5A1.5 1.5 0 0 1 4.5 3H12l9 9-9 9z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pv-mode strong { color: var(--accent); }

/* ---------- Согласования ---------- */
.ap-list { display: grid; gap: 14px; }
.ap {
  min-width: 0; padding: 18px 20px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
  transition: box-shadow 0.3s;
}
.ap.is-decided.ap-done { box-shadow: var(--shadow), inset 0 0 0 2px var(--green-line); }
.ap.is-decided.ap-declined, .ap.is-decided.ap-obsolete { box-shadow: var(--shadow), inset 0 0 0 1px var(--gray-line); }
.ap.is-decided.ap-failed { box-shadow: var(--shadow), inset 0 0 0 2px var(--red-line); }
.ap-head { display: flex; align-items: flex-start; gap: 14px; }
.ap-kind {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 13px; background: var(--gray-soft); color: var(--text-2);
}
.ap-kind .ic { width: 22px; height: 22px; }
.ap-kind-sm { width: 34px; height: 34px; border-radius: 10px; }
.ap-kind-sm .ic { width: 18px; height: 18px; }
.ap-kind-warm { background: var(--warm-soft); color: var(--warm-text); }
.ap-kind-accent { background: var(--accent-soft); color: var(--accent); }
.ap-head-main { flex: 1 1 auto; min-width: 0; }
.ap-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.ap-kind-label { font-weight: 700; color: var(--text-2); }
.ap-title { font-size: 19.5px; font-weight: 750; margin: 3px 0 0; letter-spacing: -0.005em; }
.ap-status { margin-left: auto; }
.ap-reason { margin: 12px 0 0; color: var(--text-2); }
.ap-why { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: 1px; }
.ap-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 12px 0 0; font-size: 14px; }
.ap-who, .ap-count { display: inline-flex; align-items: center; gap: 7px; }
.ap-count .ic { color: var(--muted); }
.ap-sub { margin: 0 0 8px; font-family: var(--font); font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ap-change, .ap-items-wrap { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.change-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.change-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.change-list li:last-child { border-bottom: 0; }
.ch-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-old { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.ch-arrow { display: inline-flex; color: var(--muted); }
.ch-arrow .ic { width: 15px; height: 15px; }
.ch-new { font-weight: 750; }
.ch-pct { font-size: 12.5px; font-weight: 650; min-width: 52px; text-align: right; }
.change-more { color: var(--muted); display: block !important; }
@media (max-width: 520px) { .change-list li { grid-template-columns: minmax(0, 1fr) auto auto auto; } .ch-pct { display: none; } }
.ap-items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ap-items li { padding: 3px 10px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); font-size: 13px; }
.ap-items .ap-items-more { background: transparent; box-shadow: none; color: var(--muted); }
.ap-preview { margin: 4px 0 0; padding-left: 18px; }
.calc { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.calc-title { margin: 0 0 8px; font-family: var(--font); font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.calc-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 8px 16px; margin: 0; font-variant-numeric: tabular-nums; }
.calc-strong dd { font-weight: 750; font-size: 15px; }
.ap-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 14px 0 0; }
.ap-shot { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13px; text-decoration: none; min-width: 0; }
.ap-shot img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.ap-shot:hover span { color: var(--accent); }
.ap-shot-wide { grid-column: 1 / -1; }
.photo-meta { margin: 6px 0 4px; color: var(--text-2); font-size: 14px; }
.photo-sub { margin: 22px 0 0; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.photo-sub .count { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.ap-shot-wide img { aspect-ratio: auto; max-height: 420px; object-fit: contain; }
.ap-text { margin: 14px 0 0; border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.ap-text summary { cursor: pointer; padding: 10px 14px; font-size: 14px; font-weight: 650; list-style-position: inside; }
.ap-text summary:hover { color: var(--accent); }
.ap-text[open] summary { border-bottom: 1px solid var(--border); }
.ap-text-old summary { color: var(--text-2); font-weight: 600; }
.ap-text-old + .ap-text { margin-top: 8px; }
.ap-text-body { padding: 12px 14px 14px; max-height: 360px; overflow: auto; white-space: pre-wrap; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; color: var(--text-2); }
.ap-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.ap-result {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.ap-result-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); }
.ap-result.tone-green { background: var(--green-soft); color: var(--green); }
.ap-result.tone-green .ap-result-ic { background: var(--green-mark); color: #ffffff; }
.ap-result.tone-red { background: var(--red-soft); color: var(--red); }
.ap-result.tone-red .ap-result-ic { background: var(--red-mark); color: var(--on-red); }
.ap-result.tone-gray { background: var(--gray-soft); color: var(--text-2); }
.ap-result.is-new { animation: rise 0.32s var(--ease); }
.ap-result.is-new .ap-result-ic { animation: pop 0.42s var(--ease); }
.ap-busy { color: var(--muted); }
.ap-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.aph {
  display: flex; align-items: flex-start; gap: 12px; min-width: 0;
  padding: 12px 14px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}
.aph-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.aph-title { font-weight: 650; }
.aph-sub { font-size: 12.5px; color: var(--muted); }
.aph-result { margin-top: 3px; font-size: 13.5px; color: var(--text-2); }
@media (max-width: 520px) { .aph { display: grid; grid-template-columns: 34px minmax(0, 1fr); } .aph > .tag { grid-column: 2; justify-self: start; } }
@media (max-width: 520px) { .ap { padding: 16px; } .ap-head { gap: 12px; } .ap-kind { width: 38px; height: 38px; border-radius: 11px; } .ap-status { margin-left: 0; } .ap-title { font-size: 17.5px; } .ap-actions .btn { flex: 1 1 140px; } }

/* ---------- Офис ---------- */
.health { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.hc {
  display: flex; gap: 12px; min-width: 0; padding: 12px 14px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}
.hc-ic, .run-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--gray-soft); color: var(--muted); }
.hc-ic .ic, .run-ic .ic { width: 18px; height: 18px; }
.hc-green .hc-ic, .run-green .run-ic { background: var(--green-soft); color: var(--green); }
.hc-amber { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--amber-line); background: var(--amber-soft); }
.hc-amber .hc-ic, .run-amber .run-ic { background: var(--surface); color: var(--amber); }
.hc-red { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--red-line); background: var(--red-soft); }
.hc-red .hc-ic, .run-red .run-ic { background: var(--surface); color: var(--red); }
.hc-main { min-width: 0; }
.hc-label { font-weight: 700; }
.hc-status { font-size: 13.5px; color: var(--text-2); }
.hc-state { font-weight: 650; }
.hc-time { font-size: 12px; color: var(--muted); }
.run-group + .run-group { margin-top: 18px; }
.run-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-family: var(--font); font-size: 13px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.run-group-title .ic { color: var(--accent); }
.runs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 10px; }
.run {
  min-width: 0; padding: 14px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}
.run-red { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--red-line); }
.run-head { display: flex; align-items: flex-start; gap: 10px; }
.run-name { flex: 1 1 auto; min-width: 0; }
.run-name .sub { display: block; font-size: 12.5px; color: var(--muted); }
.run-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(112px, 100%), 1fr)); gap: 8px 12px; margin: 12px 0 0; font-size: 13.5px; }
.run-stats dd { font-size: 13.5px; }
.run-stats .sub { display: block; font-size: 12px; color: var(--muted); }
.run-note { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }

.meter { height: 8px; margin-top: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green-mark), var(--accent)); }
.meter.tone-amber > span { background: var(--amber-mark); }
.meter.tone-red > span { background: var(--red-mark); }

/* ---------- Журнал ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 10px; padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.filters .field { flex: 1 1 200px; }
.filters .field-grow { flex: 3 1 260px; }
.j-day { position: sticky; top: var(--topbar-h); z-index: 2; margin: 20px 0 8px; padding: 6px 0; font-family: var(--font); font-size: 13px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg); }
.j-list { list-style: none; margin: 0; padding: 0; position: relative; }
.j-list::before { content: ""; position: absolute; left: 17px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--border); }
.j-item { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 6px 0; }
.j-ic { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); color: var(--muted); box-shadow: 0 0 0 4px var(--bg), inset 0 0 0 1px var(--border); }
.j-ic .ic { width: 17px; height: 17px; }
.j-green .j-ic { background: var(--green-soft); color: var(--green); }
.j-info .j-ic { background: var(--info-soft); color: var(--info); }
.j-red .j-ic { background: var(--red-soft); color: var(--red); }
.j-amber .j-ic { background: var(--amber-soft); color: var(--amber); }
.j-warm .j-ic { background: var(--warm-soft); color: var(--warm-text); }
.j-body { min-width: 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.j-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 12.5px; color: var(--muted); }
.j-time { font-weight: 700; color: var(--text-2); }
.j-kind { font-weight: 650; }
.j-text { margin: 3px 0 0; overflow-wrap: anywhere; }

/* ---------- Что считается ---------- */
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; margin-top: 40px; }
.about-col { display: flex; gap: 12px; min-width: 0; padding: 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); box-shadow: inset 0 0 0 1px var(--border); }
.about-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--green-soft); color: var(--green); }
.about-missing .about-ic { background: var(--gray-soft); color: var(--muted); }
.about-ic .ic { width: 16px; height: 16px; }
.about h2 { font-family: var(--font); font-size: 14px; font-weight: 750; margin: 4px 0 6px; }
.about ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); }
.about li + li { margin-top: 4px; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); padding: 30px 28px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--border);
  animation: pop-in 0.25s var(--ease);
}
.login-card h1 { font-size: 23px; margin-bottom: 4px; }
.login-card .field { margin: 18px 0 4px; }
.login-card .btn-block { margin-top: 18px; }

/* ---------- Сообщение внизу ---------- */
.toast {
  position: fixed; left: 50%; bottom: 18px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 14px;
  background: var(--tip-bg); color: var(--tip-text); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translate(-50%, 14px);
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}
.toast .ic { width: 18px; height: 18px; color: var(--accent-line); }
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast.toast-error { background: var(--red-soft); color: var(--red); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--red-line); }
.toast.toast-error .ic { color: var(--red); }

/* ---------- Чат ---------- */
.main:has(#chat-root) { padding-bottom: 16px; }
#chat-queue { padding: 5px 12px; }
.chat-note { margin-bottom: 12px; font-size: 13.5px; color: var(--text-2); }
.chat-note::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2.5'/%3E%3Cpath d='M9 4V3h6v1M9 13l2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2.5'/%3E%3Cpath d='M9 4V3h6v1M9 13l2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chat {
  display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  height: max(440px, calc(100vh - var(--topbar-h) - 200px));
  background: var(--surface); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
}
.chat-side { min-width: 0; overflow-y: auto; padding: 14px; background: var(--surface-2); border-right: 1px solid var(--border); }
.chat-side-title { font-family: var(--font); font-size: 12.5px; font-weight: 750; color: var(--muted); margin: 0 2px 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.chat-side-title:not(:first-child) { margin-top: 16px; }
.agents { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.agent { min-width: 0; padding: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.agent.is-paused { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.agent.is-paused .agent-name, .agent.is-paused .agent-role { color: var(--muted); }
.agent-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.agent-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.agent-name { font-weight: 750; }
.agent-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.agent-status .dot { width: 7px; height: 7px; }
.agent-role { margin: 8px 0 10px; font-size: 13px; color: var(--text-2); }
.agent-note { margin: 8px 0 4px; font-size: 13px; color: var(--muted); }
.agent-new { width: 100%; }
.agent-new[aria-current="page"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.threads { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.threads > li { min-width: 0; }
.thread-link { display: block; min-width: 0; padding: 7px 9px; border-radius: 10px; color: var(--text); text-decoration: none; }
.thread-link:hover { background: var(--hover); color: var(--text); }
.thread-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.thread-title { display: block; font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; color: var(--muted); }
.thread-last { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; color: var(--text-2); }
.thread-none { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-main-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-main-title { flex: 1 1 auto; min-width: 0; }
.chat-main-title h2 { font-size: 16.5px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main-title p { margin: 0; font-size: 13px; color: var(--muted); }
.chat-back { display: none; flex: none; }
.chat-msgs {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column;
  background: radial-gradient(600px 300px at 100% 0%, var(--bg-glow), transparent 70%), var(--surface);
}
.chat-msgs:focus-visible { outline-offset: -3px; }
.chat-empty { margin: auto; max-width: 480px; padding: 24px 8px; text-align: center; color: var(--text-2); }
.chat-hello { font-weight: 650; color: var(--text); }
.chat-empty-main { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.chat-empty-main::before {
  content: ""; display: block; width: 110px; height: 80px; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--accent), var(--warm));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M16 10h38a7 7 0 0 1 7 7v16a7 7 0 0 1-7 7H32l-11 9v-9h-5a7 7 0 0 1-7-7V17a7 7 0 0 1 7-7z'/%3E%3Cpath d='M66 28h14a7 7 0 0 1 7 7v12a7 7 0 0 1-7 7h-2v8l-9-8h-9a7 7 0 0 1-7-7v-4'/%3E%3Cpath d='M24 25h.01M35 25h.01M46 25h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 70' fill='none' stroke='black' stroke-width='2.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M16 10h38a7 7 0 0 1 7 7v16a7 7 0 0 1-7 7H32l-11 9v-9h-5a7 7 0 0 1-7-7V17a7 7 0 0 1 7-7z'/%3E%3Cpath d='M66 28h14a7 7 0 0 1 7 7v12a7 7 0 0 1-7 7h-2v8l-9-8h-9a7 7 0 0 1-7-7v-4'/%3E%3Cpath d='M24 25h.01M35 25h.01M46 25h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 0; border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--accent-line);
  transition: box-shadow 0.15s, transform 0.1s, background-color 0.15s;
}
.chip .ic { width: 16px; height: 16px; color: var(--warm); }
.chip:hover { background: var(--accent-soft); box-shadow: var(--shadow), inset 0 0 0 1px var(--accent); }
.chip:active { transform: translateY(1px); }
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; flex-direction: column; max-width: min(740px, 88%); }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-agent { align-self: flex-start; flex-direction: row; align-items: flex-start; gap: 10px; }
.msg-ava { margin-top: 18px; }
.msg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.bubble { min-width: 0; max-width: 100%; padding: 11px 15px; border-radius: 18px; overflow-wrap: anywhere; }
.msg-user .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; box-shadow: 0 6px 16px -10px var(--accent); }
.msg-agent .bubble { background: var(--surface); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.msg-agent.is-wait .bubble { color: var(--text-2); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.msg-agent.is-failed .bubble { background: var(--red-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--red-line); }
.wait-ic { margin-right: 6px; color: var(--muted); }
.is-failed .wait-ic { color: var(--red); }
.typing { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-2); }
.dots { display: inline-flex; gap: 4px; padding: 6px 8px; border-radius: 999px; background: var(--surface-3); }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
.timer { margin-left: 8px; font-size: 12px; color: var(--muted); }
.msg-hint { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.msg-author { margin: 0 4px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 5px 6px 0; font-size: 12px; color: var(--muted); }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li + li { margin-top: 3px; }
.md li::marker { color: var(--accent); }
.md strong { font-weight: 700; }
.md > :last-child { margin-bottom: 0; }
.msg-approvals { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.msg-ap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px;
  background: var(--warm-soft); border-radius: var(--radius-sm); font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--warm-line);
}
.msg-ap-ic { display: inline-flex; color: var(--warm-text); }
.msg-ap-title { flex: 1 1 160px; min-width: 0; font-weight: 650; }
.msg-ap a { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; }
.msg-ap a .ic { width: 16px; height: 16px; }
.composer { flex: none; margin: 0; padding: 12px 16px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.composer textarea { display: block; min-height: 72px; max-height: 40vh; resize: vertical; line-height: 1.45; border-radius: 14px; }
.composer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; }
.composer-help { flex: 1 1 auto; margin: 0; font-size: 12.5px; color: var(--muted); }
.composer.is-drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.composer-attach { cursor: pointer; }
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.composer-files:empty { display: none; }
.cfile { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2, var(--surface)); font-size: 13px; }
.cfile .ic { width: 16px; height: 16px; flex: none; color: var(--muted); }
.cfile-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.cfile-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.cfile.is-loading .cfile-meta { color: var(--info); }
.cfile.is-error { border-color: var(--red); }
.cfile.is-error .cfile-meta { color: var(--red); }
.cfile-x { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.cfile-x:hover, .cfile-x:focus-visible { background: var(--gray-soft); color: var(--text); }
.cfile-x .ic { width: 15px; height: 15px; }
.msg-files { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.msg-file { display: inline-flex; align-items: center; gap: 6px; max-width: 320px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 13px; text-decoration: none; }
.msg-file:hover, .msg-file:focus-visible { border-color: var(--accent); }
.msg-file .ic { width: 16px; height: 16px; flex: none; color: var(--accent); }
.msg-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file-size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.char-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--red); font-weight: 700; }
.composer-note { margin: 6px 0 0; font-size: 13px; color: var(--amber); }
.composer-note:empty { display: none; }
.composer-note.is-error { color: var(--red); }
.composer-off { color: var(--muted); font-size: 14px; }
@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); height: max(420px, calc(100vh - var(--topbar-h) - 180px)); }
  .chat[data-view="list"] .chat-main { display: none; }
  .chat[data-view="thread"] .chat-side { display: none; }
  .chat-side { border-right: 0; }
  .chat-back { display: inline-flex; }
  .chat-msgs { padding: 12px; }
  .msg { max-width: 94%; }
  .msg-agent .avatar { width: 28px; height: 28px; font-size: 11px; }
  .composer { padding: 10px 12px 12px; }
  .composer textarea { min-height: 58px; }
}

/* ---------- Движение ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
  .dots i { opacity: 0.8; }
}

@media print {
  body { background: #ffffff; }
  .topbar, .sidenav, .hint-actions, .ap-actions, .toast, .hints-all { display: none !important; }
  .app { display: block; }
  .hint-body { grid-template-rows: 1fr !important; }
  .hint-inner { visibility: visible !important; }
}

/* Чат на телефоне: в шапке переписки — только значки, чтобы заголовку хватило места */
@media (max-width: 860px) {
  #chat-root .subtitle { display: none; }
  .chat-main-head .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .chat-main-head .btn-sm { width: 38px; padding: 0; }
  .chat-main-head { padding: 8px 10px; }
}
