/* App Radar — «Тёплое бенто»: светлая тема, верхняя навигация-капсулы, графит + оранжевый акцент. */
:root {
  color-scheme: light;
  --bg: #f4f2ee; --surface: #ffffff; --surface-2: #faf9f6; --surface-3: #efece6; --overlay: rgba(28, 25, 20, .38);
  --border: rgba(28, 25, 20, .07); --border-strong: rgba(28, 25, 20, .13);
  --text: #171512; --text-2: #5a554d; --muted: #8f897f;
  --grid: #ece9e2; --axis: #cfcabf;
  --ink: #1b1a17; --ink-2: #2a2824; --on-ink: #f7f5f0; --on-ink-2: #b8b2a6;
  --accent: #ff6b35; --accent-2: #2a78d6; --accent-soft: #fff0e8; --accent-ink: #ffffff; --accent-text: #d9480f;
  --lime: #e4f7a8; --lime-ink: #3d5a00; --sky: #e3efff; --peach: #ffe9dc; --lilac: #eeeafe;
  --good: #0ca30c; --good-text: #157a15; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-soft: #e6f6e3; --bad-soft: #fde8e6; --warn-soft: #fff4d6;
  --shadow: 0 1px 2px rgba(28, 25, 20, .04);
  --shadow-lg: 0 18px 50px rgba(28, 25, 20, .14);
  --radius: 26px; --radius-sm: 16px; --radius-xs: 10px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #12110f; --surface: #1c1b18; --surface-2: #22201d; --surface-3: #2b2925; --overlay: rgba(0, 0, 0, .6);
    --border: rgba(255, 250, 240, .07); --border-strong: rgba(255, 250, 240, .13);
    --text: #f3f0ea; --text-2: #c2bcb1; --muted: #8e887d; --grid: #2a2825; --axis: #3d3a35;
    --ink: #f3f0ea; --ink-2: #e4e0d8; --on-ink: #171512; --on-ink-2: #5a554d;
    --accent: #ff7a47; --accent-soft: rgba(255, 122, 71, .14); --accent-text: #ff9466;
    --lime: rgba(198, 240, 90, .16); --lime-ink: #c8ee6b; --sky: rgba(57, 135, 229, .16); --peach: rgba(255, 122, 71, .14); --lilac: rgba(144, 133, 233, .16);
    --good-text: #3cc23c; --good-soft: rgba(12, 163, 12, .16); --bad-soft: rgba(230, 103, 103, .16); --warn-soft: rgba(250, 178, 25, .14);
    --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12110f; --surface: #1c1b18; --surface-2: #22201d; --surface-3: #2b2925; --overlay: rgba(0, 0, 0, .6);
  --border: rgba(255, 250, 240, .07); --border-strong: rgba(255, 250, 240, .13);
  --text: #f3f0ea; --text-2: #c2bcb1; --muted: #8e887d; --grid: #2a2825; --axis: #3d3a35;
  --ink: #f3f0ea; --ink-2: #e4e0d8; --on-ink: #171512; --on-ink-2: #5a554d;
  --accent: #ff7a47; --accent-soft: rgba(255, 122, 71, .14); --accent-text: #ff9466;
  --lime: rgba(198, 240, 90, .16); --lime-ink: #c8ee6b; --sky: rgba(57, 135, 229, .16); --peach: rgba(255, 122, 71, .14); --lilac: rgba(144, 133, 233, .16);
  --good-text: #3cc23c; --good-soft: rgba(12, 163, 12, .16); --bad-soft: rgba(230, 103, 103, .16); --warn-soft: rgba(250, 178, 25, .14);
  --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .t2 { color: var(--text-2); }
.nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .col { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .gap-4 { gap: 4px; } .gap-16 { gap: 16px; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Каркас: верхняя панель-капсула ---------- */
.shell { min-height: 100vh; }
.top { position: sticky; top: 0; z-index: 20; padding: 14px 24px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); }
.top-in { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; letter-spacing: -.02em; flex: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; background: var(--ink); display: grid; place-items: center; color: var(--on-ink); position: relative; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark::after { content: ""; position: absolute; right: -2px; top: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.nav { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); margin: 0 auto; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; color: var(--text-2); font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; position: relative; }
.nav a:hover { color: var(--text); background: var(--surface-3); }
.nav a.active { background: var(--ink); color: var(--on-ink); }
.nav a svg { width: 17px; height: 17px; }
.nav .badge { height: 18px; font-size: 10.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--peach); color: var(--accent-text); display: grid; place-items: center; font-weight: 750; border: 1px solid var(--border); cursor: pointer; }
.main { min-width: 0; padding: 10px 24px 70px; max-width: 1440px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: flex-end; gap: 12px; margin: 8px 0 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 34px; letter-spacing: -.035em; margin: 0; font-weight: 750; line-height: 1.1; }
.topbar .sub { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabbar { display: none; }
.statusline { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.statusline .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.statusline.warn .pulse { background: var(--serious); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---------- Карточки и сетка ---------- */
.grid { display: grid; gap: 16px; }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s-3 { grid-column: span 3; } .s-4 { grid-column: span 4; } .s-5 { grid-column: span 5; } .s-6 { grid-column: span 6; }
.s-7 { grid-column: span 7; } .s-8 { grid-column: span 8; } .s-12 { grid-column: span 12; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.ink { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.card.ink .muted, .card.ink .hint, .card.ink .t2 { color: var(--on-ink-2) !important; }
.card.tint-peach { background: var(--peach); border-color: transparent; } .card.tint-lime { background: var(--lime); border-color: transparent; }
.card.tint-sky { background: var(--sky); border-color: transparent; } .card.tint-lilac { background: var(--lilac); border-color: transparent; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.card-h .hint { color: var(--muted); font-size: 12.5px; }
.card-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.section-title { font-size: 13px; color: var(--muted); font-weight: 650; margin: 28px 0 10px; }
.help { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 700; cursor: help; flex: none; }
.card.ink .help { background: rgba(255, 255, 255, .12); color: var(--on-ink-2); }

/* Сводка простыми словами */
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 22px; }
.summary .pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; }
.summary .pill b { font-weight: 700; } .summary .pill.good { background: var(--good-soft); border-color: transparent; } .summary .pill.bad { background: var(--bad-soft); border-color: transparent; } .summary .pill.warn { background: var(--warn-soft); border-color: transparent; }

/* ---------- KPI ---------- */
.kpi .label { color: var(--text-2); font-size: 13.5px; display: flex; align-items: center; gap: 8px; font-weight: 550; }
.kpi .label .ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text); }
.kpi .label .ico svg { width: 17px; height: 17px; }
.kpi .value { font-size: 34px; font-weight: 750; letter-spacing: -.035em; margin-top: 14px; line-height: 1.05; }
.kpi .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.hero-value { font-size: 72px; font-weight: 800; letter-spacing: -.05em; line-height: .95; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 12.5px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good-text); background: var(--good-soft); }
.delta.down { color: var(--critical); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
:root:not([data-theme="dark"]) .card.ink .delta.up { background: rgba(60, 194, 60, .18); color: #7fe07f; }
:root:not([data-theme="dark"]) .card.ink .delta.down { background: rgba(230, 103, 103, .2); color: #ff9a9a; }
:root:not([data-theme="dark"]) .card.ink .delta.flat { background: rgba(255, 255, 255, .1); color: var(--on-ink-2); }
:root[data-theme="dark"] .card.ink .delta.up { background: #dcf3d8; color: #157a15; } :root[data-theme="dark"] .card.ink .delta.down { background: #fde3e0; color: #b42318; }
.delta svg { width: 12px; height: 12px; stroke-width: 2.6; }

/* ---------- Кнопки, поля ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; transition: transform .05s, background .15s, border-color .15s; }
.btn:hover { background: var(--surface-3); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: transparent; color: var(--on-ink); }
.btn.primary:hover { filter: brightness(1.15); }
.btn.accent { background: var(--accent); border-color: transparent; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; justify-content: center; } .btn.sm.icon { width: 32px; }
.btn.danger { color: var(--critical); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.input, .select, textarea.input { height: 42px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 11px 14px; resize: vertical; min-height: 88px; line-height: 1.45; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--ink); color: var(--on-ink); }
.seg button svg { width: 15px; height: 15px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + span { background: var(--accent); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }

/* ---------- Бейджи, чипы ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.high { background: var(--bad-soft); color: var(--critical); } .badge.medium { background: var(--warn-soft); color: #9a6700; } .badge.low { background: var(--surface-3); color: var(--text-2); }
.badge.good { background: var(--good-soft); color: var(--good-text); }
:root[data-theme="dark"] .badge.medium { color: #f5c451; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 13px; background: var(--surface); cursor: default; }
button.chip { cursor: pointer; } button.chip:hover { background: var(--surface-3); }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); display: flex; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.app-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); object-fit: cover; flex: none; border: 1px solid var(--border); }
.app-ico.sm { width: 28px; height: 28px; border-radius: 8px; } .app-ico.lg { width: 72px; height: 72px; border-radius: 20px; }
.own-tag { font-size: 10.5px; font-weight: 750; color: var(--on-ink); background: var(--ink); padding: 2px 7px; border-radius: 999px; letter-spacing: .02em; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; user-select: none; }
.t th.sortable { cursor: pointer; } .t th.sortable:hover { color: var(--text); }
.t th.num, .t td.num { text-align: right; font-variant-numeric: tabular-nums; }
.t td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr { transition: background .1s; } .t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.clickable { cursor: pointer; }
.t tr:last-child td { border-bottom: 0; }
.t .own-row { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.pos { display: inline-grid; place-items: center; min-width: 36px; height: 28px; padding: 0 8px; border-radius: 999px; font-weight: 750; font-variant-numeric: tabular-nums; background: var(--surface-3); }
.pos.p1 { background: var(--accent); color: #fff; } .pos.p3 { background: var(--ink); color: var(--on-ink); }
.pos.p10 { background: var(--lime); color: var(--lime-ink); } .pos.none { color: var(--muted); font-weight: 500; background: transparent; }

/* Метр (полоска 0..100) */
.meter { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.meter .track { flex: 1; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent-2) 14%, var(--surface-3)); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 999px; background: var(--accent-2); }
.meter.diff .track { background: color-mix(in srgb, var(--serious) 16%, var(--surface-3)); } .meter.diff .fill { background: var(--serious); }
.meter.opp .track { background: color-mix(in srgb, var(--good) 14%, var(--surface-3)); } .meter.opp .fill { background: var(--good); }
.meter b { font-size: 13px; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }

/* Тепловая карта позиций */
.heat { display: grid; gap: 4px; font-size: 12px; }
.heat .cell { height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.heat .hdr { font-size: 11.5px; color: var(--muted); padding: 4px; display: flex; align-items: flex-end; justify-content: center; text-align: center; line-height: 1.15; min-height: 46px; }
.heat .kw { display: flex; align-items: center; font-size: 13.5px; padding-right: 8px; min-width: 0; font-weight: 550; }

/* ---------- Списки ---------- */
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list .item:last-child { border-bottom: 0; }
.list .item .title { font-weight: 600; } .list .item .meta { font-size: 12.5px; color: var(--muted); }
.feed .item { align-items: flex-start; }
.sev { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.sev svg { width: 17px; height: 17px; }
.sev.high { background: var(--bad-soft); color: var(--critical); } .sev.medium { background: var(--warn-soft); color: #9a6700; } .sev.low { background: var(--surface-3); color: var(--text-2); }

/* Рекомендации */
.rec { display: flex; gap: 16px; padding: 18px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, transform .15s; text-align: left; }
.rec:hover { border-color: var(--border-strong); }
.rec .prio { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex: none; background: var(--surface-3); color: var(--text); }
.rec .prio.high { background: var(--accent); color: #fff; }
.rec h4 { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.rec p { margin: 0; color: var(--text-2); font-size: 14px; }
.rec .ev { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.rec .ev span { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.rec .ev span b { color: var(--text); font-weight: 700; }

/* Карточка своего приложения */
.app-card { display: flex; flex-direction: column; gap: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.app-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.app-card .stat { padding: 12px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.app-card .stat .v { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.app-card .stat .l { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 2px; }
.ring { position: relative; width: 56px; height: 56px; flex: none; }
.ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 800; }

/* Сегментированная полоса (доли) */
.segbar { display: flex; height: 34px; gap: 3px; }
.segbar > div { display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 12px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; border-radius: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; } .legend span.off { opacity: .4; }
.legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

/* Графики */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.card.ink .chart .grid-line { stroke: rgba(255, 255, 255, .08); } .card.ink .chart .axis-text { fill: var(--on-ink-2); }
.chart .xhair { stroke: var(--axis); stroke-width: 1; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 10px 12px; font-size: 12.5px; min-width: 150px; z-index: 5; opacity: 0; transition: opacity .1s; }
.tooltip .d { color: var(--muted); margin-bottom: 4px; font-weight: 650; }
.tooltip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; } .tooltip .r b { font-variant-numeric: tabular-nums; }
.spark { display: block; }

/* Панели и модальные окна */
.drawer-bg { position: fixed; inset: 0; background: var(--overlay); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(760px, calc(100vw - 20px)); background: var(--bg); z-index: 41; overflow-y: auto; box-shadow: var(--shadow-lg);
  border-radius: 28px; animation: slide .2s ease-out; padding: 24px 26px 40px; }
.modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-lg); padding: 26px; animation: pop .16s ease-out; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(40px); opacity: 0; } } @keyframes pop { from { transform: translate(-50%, -48%); opacity: 0; } }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: var(--on-ink); padding: 12px 16px; border-radius: 16px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 400px; animation: pop2 .2s; }
.toast.err { background: var(--critical); color: #fff; }
@keyframes pop2 { from { transform: translateY(8px); opacity: 0; } }
.menu { position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; z-index: 30; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; width: 100%; border: 0; background: none; cursor: pointer; font-weight: 550; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* Пустые состояния, скелетоны */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .ico { width: 60px; height: 60px; border-radius: 20px; background: var(--peach); color: var(--accent-text); display: grid; place-items: center; margin: 0 auto 16px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 18px; }
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: var(--radius); }
@keyframes sh { to { background-position: -200% 0; } }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--warn-soft); margin-bottom: 16px; font-size: 14px; }

/* Markdown (ИИ-разбор) */
.md h1, .md h2, .md h3 { font-size: 16.5px; margin: 20px 0 8px; letter-spacing: -.01em; } .md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }
.md p { margin: 0 0 10px; color: var(--text-2); } .md ul, .md ol { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); } .md li { margin: 5px 0; }
.md strong { color: var(--text); } .md code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* Вход */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .pane { display: grid; place-items: center; padding: 24px; }
.auth .art { background: var(--ink); color: var(--on-ink); border-radius: 32px; margin: 14px; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.auth .art h2 { font-size: 44px; letter-spacing: -.04em; line-height: 1.05; margin: 0; max-width: 520px; }
.auth .art .blob { position: absolute; width: 360px; height: 360px; border-radius: 50%; background: var(--accent); right: -90px; bottom: -90px; filter: blur(2px); opacity: .95; }
.auth .art .blob2 { position: absolute; width: 160px; height: 160px; border-radius: 50%; background: #e4f7a8; right: 200px; bottom: 140px; }
.auth form { width: min(400px, 100%); }
.auth h1 { margin: 20px 0 6px; font-size: 30px; letter-spacing: -.035em; }

/* Тайм-лайн */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); border-radius: 2px; }
.timeline .ev { position: relative; padding: 0 0 18px; }
.timeline .ev::before { content: ""; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); }
.timeline .ev.release::before { border-color: var(--accent); }

/* ---------- Адаптив ---------- */
@media (max-width: 1240px) {
  .nav a span { display: none; } .nav a { padding: 9px 12px; } .nav a.active span { display: inline; }
}
@media (max-width: 1180px) {
  .s-3 { grid-column: span 6; } .s-4 { grid-column: span 6; } .s-5, .s-7, .s-8 { grid-column: span 12; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; } .auth .art { display: none; }
}
@media (max-width: 720px) {
  .top { padding: 10px 16px; } .nav, .top-actions .hide-m { display: none; } .top-actions { margin-left: auto; }
  .main { padding: 4px 16px 100px; }
  .topbar h1 { font-size: 27px; } .topbar .actions { margin-left: 0; width: 100%; } .topbar .actions .btn.hide-m { display: none; }
  .s-3, .s-4, .s-6 { grid-column: span 12; }
  .grid { gap: 12px; } .card { padding: 18px; border-radius: 22px; }
  .hero-value { font-size: 56px; } .kpi .value { font-size: 28px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } .kpis > * { grid-column: auto !important; }
  .tabbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30; padding: 6px;
    background: var(--ink); border-radius: 999px; box-shadow: var(--shadow-lg); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--on-ink-2); padding: 7px 0; border: 0; background: none; font-weight: 600; position: relative; border-radius: 999px; }
  .tabbar a.active { color: var(--on-ink); background: rgba(255, 255, 255, .1); } :root[data-theme="dark"] .tabbar a.active { background: rgba(0, 0, 0, .08); }
  .tabbar svg { width: 21px; height: 21px; }
  .tabbar .badge { position: absolute; top: 0; left: 55%; height: 16px; font-size: 10px; padding: 0 5px; }
  /* Таблицы → карточки */
  table.t.stack thead { display: none; }
  table.t.stack, table.t.stack tbody, table.t.stack tr, table.t.stack td { display: block; width: 100%; }
  table.t.stack tr { padding: 14px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  table.t.stack td { border: 0; padding: 0; text-align: left !important; display: flex; flex-direction: column; gap: 3px; }
  table.t.stack td::before { content: attr(data-l); font-size: 11.5px; color: var(--muted); font-weight: 600; }
  table.t.stack td.lead { grid-column: 1 / -1; } table.t.stack td.lead::before { display: none; }
  table.t.stack td[data-l=""]::before { display: none; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; padding: 18px 16px 40px; }
  .rec { padding: 14px; gap: 12px; } .rec .prio { width: 40px; height: 40px; font-size: 14px; border-radius: 13px; }
  .sheet { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 41; background: var(--surface); border-radius: 26px; padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); animation: up .2s; box-shadow: var(--shadow-lg); }
  .sheet a { display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 16px; font-weight: 600; } .sheet a:active { background: var(--surface-3); }
  .summary { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; } .summary .pill { flex: none; }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .top, .tabbar, .topbar .actions { display: none !important; } body { background: #fff; } }
