/* Пульт Sito. Цвета, шрифт и «стекло» — из CRM Sito (styles.css), знак #1F44FF.
   Один язык цвета на весь пульт: синий — работает, янтарный — с перебоями или внимание, красный — беда,
   пустая клетка — нет данных (сборщик не смотрел), а не «лежало». */

@font-face { font-family: Onest; font-weight: 400 700; font-display: swap; src: url('/fonts/onest-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212; }
@font-face { font-family: Onest; font-weight: 400 700; font-display: swap; src: url('/fonts/onest-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 400 700; font-display: swap; src: url('/fonts/onest-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-048F, U+0492-04AF, U+04B2-052F; }

:root {
  color-scheme: light;
  --bg: #e3e6eb;
  --surface: #fbfbfc;
  --surface-2: #f1f3f5;
  --surface-3: #e8ebef;
  --line: #dfe2e7;
  --line-strong: #cbd0d7;
  --line-dark: #a3a9b3;
  --text: #0e1013;
  --text-2: #2d3238;
  --muted: #4d535c;
  --faint: #5b616b;
  --accent: #121417;
  --accent-hover: #000;
  --on-accent: #fff;
  --tile: #1f44ff;
  --blue: #1f57c4;
  --blue-soft: #e9effb;
  --warn: #7d5710;
  --warn-soft: #fdf4e3;
  --warn-line: #ecd9ae;
  --danger: #a8281c;
  --danger-soft: #fceceb;
  --danger-line: #efc6c2;
  --ok-ink: #13704f;
  --cell-ok: #1f44ff;
  --cell-mix: #e3a12b;
  --cell-bad: #d6352a;
  --cell-none: #cbd0d7;
  --bar-in: #2d3238;
  --bar-out: #9aa8ff;
  --page: radial-gradient(70% 60% at 85% 110%, #c5cfe6, transparent 62%), radial-gradient(60% 50% at 0 0, #f2f3f5, transparent 70%), var(--bg);
  --sheet: linear-gradient(180deg, rgba(247, 248, 250, .9), rgba(236, 239, 243, .78));
  --edge: rgba(255, 255, 255, .85);
  --nav-glass: rgba(251, 251, 252, .82);
  --scrim: rgba(14, 18, 28, .32);
  --sh-1: 0 1px 2px rgba(20, 24, 34, .05);
  --sh-2: 0 1px 2px rgba(20, 24, 34, .05), 0 10px 26px -12px rgba(20, 24, 34, .16);
  --sh-3: 0 24px 60px -12px rgba(20, 24, 34, .3), 0 2px 8px rgba(20, 24, 34, .08);
  --r-xs: 6px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 24px;
  --r-pill: 999px;
  --sans: Onest, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gut: clamp(16px, 3vw, 32px);
}

/* Тёмная: та же, что в CRM. Включается системой или кнопкой темы (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #111316; --surface: #1b1e22; --surface-2: #202328; --surface-3: #262a2f;
    --line: #2c3036; --line-strong: #393e46; --line-dark: #4e545e;
    --text: #eef0f3; --text-2: #c9cdd3; --muted: #a7adb6; --faint: #969ca6;
    --accent: #f1f2f4; --accent-hover: #fff; --on-accent: #111316;
    --blue: #7fa6ff; --blue-soft: #16223d;
    --warn: #e3b25c; --warn-soft: #2a2313; --warn-line: #54431f;
    --danger: #ff8d80; --danger-soft: #331a19; --danger-line: #6a2e29;
    --ok-ink: #7fd8ae;
    --cell-ok: #5a76ff; --cell-mix: #e0a740; --cell-bad: #ff6a5c; --cell-none: #3a3f47;
    --bar-in: #c9cdd3; --bar-out: #5a76ff;
    --page: radial-gradient(70% 60% at 85% 110%, #1d2436, transparent 62%), var(--bg);
    --sheet: linear-gradient(180deg, rgba(29, 32, 37, .92), rgba(23, 26, 30, .88));
    --edge: rgba(255, 255, 255, .06);
    --nav-glass: rgba(33, 36, 41, .86);
    --scrim: rgba(0, 0, 0, .55);
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
    --sh-2: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px -4px rgba(0, 0, 0, .45);
    --sh-3: 0 18px 48px -8px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .4);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111316; --surface: #1b1e22; --surface-2: #202328; --surface-3: #262a2f;
  --line: #2c3036; --line-strong: #393e46; --line-dark: #4e545e;
  --text: #eef0f3; --text-2: #c9cdd3; --muted: #a7adb6; --faint: #969ca6;
  --accent: #f1f2f4; --accent-hover: #fff; --on-accent: #111316;
  --blue: #7fa6ff; --blue-soft: #16223d;
  --warn: #e3b25c; --warn-soft: #2a2313; --warn-line: #54431f;
  --danger: #ff8d80; --danger-soft: #331a19; --danger-line: #6a2e29;
  --ok-ink: #7fd8ae;
  --cell-ok: #5a76ff; --cell-mix: #e0a740; --cell-bad: #ff6a5c; --cell-none: #3a3f47;
  --bar-in: #c9cdd3; --bar-out: #5a76ff;
  --page: radial-gradient(70% 60% at 85% 110%, #1d2436, transparent 62%), var(--bg);
  --sheet: linear-gradient(180deg, rgba(29, 32, 37, .92), rgba(23, 26, 30, .88));
  --edge: rgba(255, 255, 255, .06);
  --nav-glass: rgba(33, 36, 41, .86);
  --scrim: rgba(0, 0, 0, .55);
  --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
  --sh-2: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px -4px rgba(0, 0, 0, .45);
  --sh-3: 0 18px 48px -8px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--page); background-attachment: fixed; color: var(--text);
  font: 400 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
b, strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--tile); outline-offset: 2px; border-radius: 6px; }
::selection { background: #cdd6ff; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.warn-ink { color: var(--warn); }
.danger-ink { color: var(--danger); }
.ok-ink { color: var(--ok-ink); }
.nowrap { white-space: nowrap; }

/* ───────── кнопки и поля ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--surface) 75%, transparent);
  cursor: pointer; white-space: nowrap; font-weight: 580; color: var(--text); text-decoration: none;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:hover { background: var(--surface); border-color: var(--line-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .55); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; min-height: 48px; font-size: 15px; }
.small-btn { min-height: 34px; padding: 0 14px; font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.link { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; justify-self: start; font-size: 13px; }
.link:hover { color: var(--text); }

.field { display: grid; gap: 8px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input {
  min-height: 48px; width: 100%; padding: 11px 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 15px; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
@media (pointer: coarse) { .input { font-size: 16px; } }
.input:hover { border-color: var(--line-dark); }
.input:focus { outline: none; border-color: var(--tile); box-shadow: 0 0 0 4px rgba(31, 68, 255, .14); }
.input[aria-invalid='true'] { border-color: var(--danger); }
.input.code { font-size: 26px; letter-spacing: .32em; text-align: center; font-weight: 600; padding-left: calc(16px + .32em); }
.pass { position: relative; }
.pass .input { padding-right: 52px; }
.pass-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: var(--r-pill); background: none; color: var(--faint); cursor: pointer; display: grid; place-items: center; }
.pass-eye:hover { color: var(--text); background: var(--surface-2); }
.pass-eye[aria-pressed='true'] .eye-off { display: none; }
.form-error { color: var(--danger); font-size: 13.5px; }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; border-radius: var(--r); }

/* ───────── вход ───────── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(32px + var(--safe-t)) var(--gut) calc(32px + var(--safe-b)); }
.login-card {
  width: min(400px, 100%); display: grid; gap: 22px; padding: 36px 32px 32px;
  background: var(--sheet); border: 1px solid var(--edge); border-radius: 28px; box-shadow: var(--sh-3);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
}
.login-mark { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 8px 18px -8px rgba(31, 68, 255, .6); }
.login-head { display: grid; gap: 8px; }
.login h1 { font-size: 30px; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; }
.login-head p { font-size: 14.5px; text-wrap: pretty; }

/* ───────── каркас ─────────
   Телефон: шапка сверху (знак, свежесть, меню) и пять кнопок снизу, посередине — синий помощник.
   Компьютер (от 1024 px): те же кнопки — меню слева, во всю высоту экрана. */
.side { display: contents; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
/* Стекло — на подложке, а не на самой шапке: backdrop-filter у шапки сделал бы её опорой для fixed-элементов внутри. */
.top::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--nav-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -.02em; text-decoration: none; }
.brand img { border-radius: 9px; }
.fresh { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fresh.stale { color: var(--danger); font-weight: 600; }

.me { position: relative; flex: none; }
.me-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
}
.me-btn:hover, .me-btn[aria-expanded='true'] { border-color: var(--line-dark); color: var(--text); }
.me-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 264px;
  display: grid; gap: 8px; padding: 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-3);
  animation: fade .14s ease both;
}
.me-label { font-size: 12px; font-weight: 600; color: var(--faint); padding: 0 4px; }
.me-theme { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line); }
.me-theme button { border: 0; background: none; min-height: 36px; padding: 0 4px; border-radius: 11px; cursor: pointer; font-size: 12.5px; font-weight: 560; color: var(--muted); line-height: 1.15; }
.me-theme button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.me-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: none; cursor: pointer; font-weight: 560; color: var(--danger); text-align: left; }
.me-item:hover { background: var(--danger-soft); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
  padding: 4px 6px calc(4px + var(--safe-b)); border-top: 1px solid var(--line);
  background: var(--nav-glass); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
}
.nav a {
  position: relative; display: grid; justify-items: center; align-content: end; gap: 3px; min-height: 56px; padding: 6px 2px 5px;
  text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: -.01em; border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
}
.nav a > span:not(.tab-count):not(.ai-orb) { white-space: nowrap; }
.nav-ic { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.nav a[aria-current='page'] { color: var(--tile); }
.nav a[aria-current='page'] .nav-ic { fill: color-mix(in srgb, var(--tile) 14%, transparent); stroke-width: 2; }
.nav .tab-count { position: absolute; top: 3px; left: calc(50% + 5px); min-width: 19px; height: 19px; font-size: 11px; box-shadow: 0 0 0 2px var(--surface); }
.ai-orb {
  width: 50px; height: 50px; margin-top: -20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tile); color: #fff; box-shadow: 0 10px 22px -8px rgba(31, 68, 255, .75), 0 0 0 4px var(--bg);
  transition: transform .16s ease;
}
.ai-orb svg { width: 25px; height: 25px; fill: currentColor; }
.nav-ai:active .ai-orb { transform: scale(.94); }
.nav-ai[aria-current='page'] .ai-orb { box-shadow: 0 10px 22px -8px rgba(31, 68, 255, .75), 0 0 0 4px var(--bg), 0 0 0 6px color-mix(in srgb, var(--tile) 40%, transparent); }
.tab-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 650; display: inline-grid; place-items: center; }
.tab-count:empty { display: none; }
.tab-count.critical { background: var(--cell-bad); color: #fff; }
.tab-count.warning { background: var(--cell-mix); color: #1d1502; }

.view { width: min(1180px, 100%); margin: 0 auto; padding: 22px var(--gut) calc(100px + var(--safe-b)); display: grid; gap: 18px; outline: none; align-content: start; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 20;
    padding: 22px 14px; border-right: 1px solid var(--line); background: var(--nav-glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  }
  .top { position: relative; flex-wrap: wrap; padding: 0 4px 0 8px; border: 0; gap: 10px 12px; }
  .top::before { display: none; }
  .brand { flex: 1; }
  .fresh { order: 3; flex-basis: 100%; margin: 0; }
  .me-menu { right: auto; left: 0; }
  .nav { position: static; display: grid; grid-template-columns: none; align-items: stretch; gap: 3px; padding: 0; border: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav a { grid-template-columns: 26px minmax(0, 1fr) auto; justify-items: start; align-items: center; align-content: center; gap: 12px; min-height: 46px; padding: 0 12px; font-size: 14.5px; font-weight: 580; color: var(--muted); }
  .nav a:hover { background: var(--surface-2); color: var(--text); }
  .nav a[aria-current='page'] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
  .nav a[aria-current='page'] .nav-ic { stroke: var(--tile); }
  .nav .tab-count { position: static; box-shadow: none; }
  .ai-orb { width: 26px; height: 26px; margin: 0; box-shadow: 0 4px 10px -4px rgba(31, 68, 255, .7); }
  .ai-orb svg { width: 16px; height: 16px; }
  .nav-ai[aria-current='page'] .ai-orb { box-shadow: 0 4px 10px -4px rgba(31, 68, 255, .7); }
  .nav-ai { order: -1; margin-bottom: 10px; background: var(--blue-soft); color: var(--text) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tile) 25%, transparent); }
  .nav-ai:hover { background: color-mix(in srgb, var(--tile) 14%, var(--surface)) !important; }
  .view { margin: 0; padding: 30px 40px 56px; gap: 20px; }
}

.sheet {
  background: var(--sheet); border: 1px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--sh-2);
  padding: 22px 24px;
}
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.sheet-head .muted { font-size: 13px; }

/* ───────── обзор: состояние ───────── */
.state { display: grid; grid-template-columns: minmax(0, 1fr); }
.state-main { display: grid; align-content: center; gap: 12px; padding: 12px 4px; }
.state-line { display: flex; align-items: center; gap: 14px; }
.state h1 { font-size: clamp(30px, 4.4vw, 48px); font-weight: 700; letter-spacing: -.045em; line-height: 1.04; text-wrap: balance; }
.pulse { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--cell-ok); box-shadow: 0 0 0 6px color-mix(in srgb, var(--cell-ok) 16%, transparent); }
.pulse.warning { background: var(--cell-mix); box-shadow: 0 0 0 6px color-mix(in srgb, var(--cell-mix) 20%, transparent); }
.pulse.critical { background: var(--cell-bad); box-shadow: 0 0 0 6px color-mix(in srgb, var(--cell-bad) 18%, transparent); }
.pulse.stale { background: var(--line-dark); box-shadow: 0 0 0 6px color-mix(in srgb, var(--line-dark) 20%, transparent); }
.state-sub { font-size: 15.5px; color: var(--muted); max-width: 60ch; text-wrap: pretty; }
.state-sub b { color: var(--text); font-weight: 600; }

.server { display: grid; gap: 14px; align-content: start; }
.server h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.meter { display: grid; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.meter-top b { font-weight: 600; }
.meter-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.meter-bar i { display: block; height: 100%; border-radius: inherit; background: var(--text-2); }
.meter-bar i.warning { background: var(--cell-mix); }
.meter-bar i.critical { background: var(--cell-bad); }
.meter-note { font-size: 12.5px; color: var(--faint); }

/* ───────── что требует внимания ───────── */
.alerts { display: grid; gap: 8px; }
.alerts-sub { font-size: 13px; font-weight: 500; color: var(--muted); margin: 18px 0 8px; }
.alert {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-align: left; width: 100%;
}
.alert:hover { border-color: var(--line-dark); }
.alert.critical { border-color: var(--danger-line); background: var(--danger-soft); }
.alert.warning { border-color: var(--warn-line); background: var(--warn-soft); }
.alert-what { display: grid; gap: 2px; min-width: 0; }
.alert-what b { font-size: 14.5px; }
.alert-what > span { color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }
.feed.short .more { display: none; }
.alert-when { display: grid; justify-items: end; font-size: 13px; color: var(--muted); white-space: nowrap; text-align: right; }

.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; background: var(--cell-ok); }
.dot.info { background: var(--cell-ok); }
.dot.warning { background: var(--cell-mix); }
.dot.critical { background: var(--cell-bad); }
.dot.none { background: transparent; box-shadow: inset 0 0 0 2px var(--cell-none); }

/* ───────── шахматка ───────── */
.board { display: grid; gap: 18px; }
.board-group { display: grid; gap: 4px; }
.board-group h3 { font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: baseline; }
.board-row {
  display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 74px; gap: 16px; align-items: center;
  padding: 5px 8px; margin: 0 -8px; border-radius: 10px; border: 0; background: none; width: calc(100% + 16px); text-align: left; cursor: pointer;
}
.board-row:hover { background: var(--surface-2); }
.board-name { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 560; }
.board-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-name em { font-style: normal; font-weight: 400; color: var(--faint); font-size: 12px; }
.cells { display: grid; grid-template-columns: repeat(96, minmax(0, 1fr)); gap: 2px; height: 18px; }
.cells i { border-radius: 2px; background: color-mix(in srgb, var(--cell-ok) 58%, transparent); }
.cells i.c0 { background: transparent; box-shadow: inset 0 0 0 1px var(--cell-none); }
.cells i.c2 { background: var(--cell-mix); }
.cells i.c3 { background: var(--cell-bad); }
.board-up { text-align: right; font-size: 13px; font-weight: 600; white-space: nowrap; }
.board-axis { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 74px; gap: 16px; padding: 0 0 0; }
.axis { position: relative; height: 18px; font-size: 11.5px; color: var(--faint); }
.axis span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.axis span::before { content: ''; position: absolute; left: 50%; top: -6px; width: 1px; height: 4px; background: var(--line-dark); }
.axis span.end { transform: translateX(-100%); }
.axis span.end::before { left: auto; right: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--cell-ok) 58%, transparent); }
.legend i.c0 { background: transparent; box-shadow: inset 0 0 0 1px var(--line-dark); }
.legend i.c2 { background: var(--cell-mix); }
.legend i.c3 { background: var(--cell-bad); }

/* Один раз при входе шахматка «включается» строка за строкой. */
@keyframes on { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.first .board-row { animation: on .4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 45ms); }
@media (prefers-reduced-motion: reduce) { .first .board-row { animation: none; } }

/* ───────── продукты ───────── */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 16px; }
.stat { display: grid; gap: 2px; align-content: start; min-width: 0; }
.stat-num { font-size: 26px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; white-space: nowrap; }
.stat-num small { font-size: 15px; font-weight: 600; color: var(--faint); letter-spacing: -.01em; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.trend { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.trend.up { color: var(--ok-ink); }
.trend.down { color: var(--danger); }
.trend.slight { color: var(--muted); }
.trend.flat, .trend.none { color: var(--faint); font-weight: 500; }
.stat .trend { margin-top: 3px; }
.row-act .trend { min-width: 44px; text-align: right; }
.unit { font-size: 12.5px; color: var(--muted); margin: -4px 0 12px; overflow-wrap: anywhere; }
.feed-more { margin-top: 12px; }
.chart { margin-top: 18px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.go { margin-top: 18px; }

/* ───────── лента ───────── */
.feed { display: grid; }
.feed-row { display: grid; grid-template-columns: 64px auto minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.feed-row:first-child { border-top: 0; }
.feed-row time { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.feed-row .dot { transform: translateY(1px); }
.feed-row .dot.back { background: transparent; box-shadow: inset 0 0 0 2px var(--cell-ok); }
.feed-day { font-size: 12.5px; font-weight: 650; color: var(--muted); padding: 14px 0 4px; }
.feed-day:first-child { padding-top: 0; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ───────── экран продукта ───────── */
.prod-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.prod-head h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.045em; line-height: 1.05; }
.prod-head p { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line); }
.seg button { border: 0; background: none; min-height: 32px; padding: 0 14px; border-radius: var(--r-pill); cursor: pointer; font-weight: 560; color: var(--muted); font-size: 13px; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.search { min-height: 40px; width: 220px; padding: 0 16px; border-radius: var(--r-pill); font-size: 14px; }

.rows { display: grid; }
.row-head, .row {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 12px minmax(180px, 1.7fr) 78px 92px 64px minmax(168px, 1fr) 92px 140px;
}
.row-head { padding: 0 14px 10px; font-size: 12px; color: var(--faint); }
.row-head span:nth-child(n+3) { text-align: right; }
.row-head span:nth-child(6) { text-align: left; }
.row {
  padding: 14px; border-radius: var(--r); border: 1px solid transparent; background: none; width: 100%; text-align: left; cursor: pointer;
  border-top-color: var(--line); border-radius: 0;
}
.row:first-of-type { border-top-color: transparent; }
.row:hover { background: var(--surface); border-color: var(--line); border-radius: var(--r); }
.row:hover + .row { border-top-color: transparent; }
.row-name { display: grid; gap: 2px; min-width: 0; }
.row-name b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name small { font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name .prob { font-size: 12.5px; font-weight: 560; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-num { text-align: right; font-size: 14px; font-weight: 560; white-space: nowrap; }
.row-num small { color: var(--faint); font-weight: 400; }
.row-act { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-act svg { flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 580; border: 1px solid var(--line-strong); color: var(--text-2); white-space: nowrap; }
.chip.ok { color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok-ink) 35%, transparent); }
.chip.warning { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.chip.critical { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }
.chip.quiet { color: var(--faint); border-style: dashed; }
.row-sub { justify-self: end; }
.kind { font-size: 11.5px; font-weight: 600; color: var(--faint); border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 0 7px; margin-left: 6px; vertical-align: 1px; }

/* ───────── панель компании ───────── */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fade .18s ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(760px, 100vw);
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--sh-3);
  overflow-y: auto; overscroll-behavior: contain; animation: slide .24s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes slide { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { animation: none; } }
.drawer-in { display: grid; gap: 16px; padding: calc(20px + var(--safe-t)) 24px calc(32px + var(--safe-b)); }
.d-top { position: sticky; top: calc(-20px - var(--safe-t)); z-index: 2; margin: calc(-20px - var(--safe-t)) -24px 0; padding: calc(20px + var(--safe-t)) 24px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display: grid; gap: 14px; }
.d-title { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.d-title h2 { font-size: 26px; font-weight: 700; letter-spacing: -.04em; line-height: 1.1; display: flex; align-items: center; gap: 12px; overflow-wrap: anywhere; }
.d-meta { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.d-meta a { color: var(--muted); }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.d-sec { background: var(--sheet); border: 1px solid var(--edge); border-radius: 20px; box-shadow: var(--sh-1); padding: 18px 20px; display: grid; gap: 14px; }
.d-sec h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.d-sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.d-sec-head .muted { font-size: 12.5px; }
.ups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 16px; }
.fact { display: grid; gap: 1px; min-width: 0; }
.fact b { font-size: 18px; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; }
.fact span { font-size: 12.5px; color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; height: 28px; }
.days i { border-radius: 3px; background: color-mix(in srgb, var(--cell-ok) 58%, transparent); }
.days i.c0 { background: transparent; box-shadow: inset 0 0 0 1px var(--cell-none); }
.days i.c2 { background: var(--cell-mix); }
.days i.c3 { background: var(--cell-bad); }
.days-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); }
.strip .cells { height: 22px; }
.problems { display: grid; gap: 8px; }
.list { display: grid; }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; align-items: baseline; }
.li:first-child { border-top: 0; }
.li small { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.li .what { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.li .what span { overflow-wrap: anywhere; }
.log { font-size: 12px; line-height: 1.5; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; overflow-wrap: anywhere; white-space: pre-wrap; margin: 0; font-family: var(--sans); }
.note-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12.5px; color: var(--faint); }
.d-close { flex: none; }

/* ───────── подтверждение и сообщения ───────── */
.confirm { border: 1px solid var(--edge); border-radius: 24px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--sh-3); width: min(420px, calc(100vw - 32px)); }
.confirm::backdrop { background: var(--scrim); }
.confirm-in { display: grid; gap: 12px; padding: 24px; }
.confirm h2 { font-size: 20px; font-weight: 700; letter-spacing: -.03em; }
.confirm p { font-size: 14.5px; text-wrap: pretty; }
.confirm-btns { display: flex; justify-content: end; gap: 8px; margin-top: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  max-width: min(480px, calc(100vw - 32px)); padding: 12px 18px; border-radius: var(--r); background: var(--accent); color: var(--on-accent);
  box-shadow: var(--sh-3); font-size: 14px; animation: fade .16s ease both;
}
.toast.bad { background: var(--danger); color: #fff; }

.skeleton { height: 220px; border-radius: var(--r-lg); background: var(--surface-2); opacity: .6; }
.banner { padding: 14px 18px; border-radius: var(--r); background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn); font-size: 14px; }
.banner b { font-weight: 650; }

/* ───────── планшет ───────── */
@media (max-width: 1080px) {
  .row-head, .row { grid-template-columns: 12px minmax(160px, 1.6fr) 74px 86px 60px minmax(160px, 1fr) 88px; }
  .row-head span:nth-child(8), .row > :nth-child(8) { display: none; }
}
@media (max-width: 900px) {
  .state { grid-template-columns: minmax(0, 1fr); }
  .duo { grid-template-columns: minmax(0, 1fr); }
}

/* ───────── телефон ───────── */
@media (max-width: 760px) {
  .alert { grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: start; }
  .alert > .dot { margin-top: 6px; }
  .alert-when { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0 10px; text-align: left; white-space: normal; }
  .view { padding: 18px 16px calc(96px + var(--safe-b)); gap: 14px; }
  .sheet { padding: 18px 16px; border-radius: 20px; }
  .state-main { padding: 4px 0; }
  .board-row, .board-axis { grid-template-columns: minmax(0, 1fr) 62px; gap: 4px 10px; }
  .board-row .cells { grid-column: 1 / -1; grid-row: 2; height: 14px; gap: 1px; }
  .board-axis > :first-child, .board-axis > :last-child { display: none; }
  .board-axis .axis { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-num { font-size: 23px; }
  .row-head { display: none; }
  .row {
    grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-areas: 'dot name up' '. act act' '. nums nums';
    gap: 8px 12px; padding: 14px 4px; align-items: start;
  }
  .row:hover { border-radius: var(--r); }
  .row > .dot { grid-area: dot; margin-top: 5px; }
  .row > .row-name { grid-area: name; }
  .row > .row-up { grid-area: up; }
  .row > .row-act { grid-area: act; }
  .row > .row-staff, .row > .row-deals, .row > .row-backup, .row > .row-sub { display: none; }
  .row > .row-mini { grid-area: nums; display: flex !important; flex-wrap: wrap; gap: 6px; }
  .tools { width: 100%; }
  .search { flex: 1 1 100%; width: auto; min-width: 0; }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-in { padding: calc(14px + var(--safe-t)) 16px calc(32px + var(--safe-b)); }
  .d-top { top: calc(-14px - var(--safe-t)); margin: calc(-14px - var(--safe-t)) -16px 0; padding: calc(14px + var(--safe-t)) 16px 14px; }
  .d-title h2 { font-size: 22px; }
  .d-sec { padding: 16px; border-radius: 18px; }
  .ups { gap: 8px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feed-row { grid-template-columns: 48px auto minmax(0, 1fr); gap: 10px; }
  .toast { bottom: calc(88px + var(--safe-b)); }
}
.row-mini { display: none; }

/* ───────── обращения ─────────
   Свой цвет — синий знак Sito: это не беда и не авария, а человек, который ждёт ответа. */
.tab-count.support { background: var(--tile); color: #fff; }
.seg-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: var(--r-pill); background: var(--tile); color: #fff; font-size: 11px; font-weight: 650; }
.dot.support { background: var(--tile); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile) 22%, transparent); }
.dot.them { background: transparent; box-shadow: inset 0 0 0 2px var(--tile); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.row.t-row { grid-template-columns: 12px minmax(150px, .9fr) minmax(0, 1.6fr) auto; }
.t-last { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.t-when { display: grid; justify-items: end; gap: 4px; font-size: 13px; white-space: nowrap; text-align: right; }

.d-role { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); align-self: end; padding-bottom: 3px; }
.thread { display: grid; gap: 10px; align-content: start; max-height: min(56vh, 620px); overflow-y: auto; overscroll-behavior: contain; margin: -4px -6px 0; padding: 4px 6px; scrollbar-width: thin; }
.thread:focus-visible { outline: 2px solid var(--tile); outline-offset: 2px; border-radius: var(--r-sm); }
.msg { display: grid; gap: 5px; justify-items: start; max-width: min(84%, 520px); justify-self: start; }
.msg.us { justify-self: end; justify-items: end; }
.msg-b { padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.us .msg-b { background: var(--tile); border-color: transparent; color: #fff; border-radius: 18px 18px 6px 18px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; }
.msg.us .msg-files { justify-content: end; }
.msg-files a { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.msg-files img { display: block; height: 148px; width: auto; max-width: 100%; object-fit: cover; }
.msg-meta { font-size: 12px; color: var(--faint); padding: 0 4px; }
.msg-day { display: flex; justify-content: center; margin: 6px 0 2px; }
.msg-day span { font-size: 12px; font-weight: 560; color: var(--faint); padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-3); }
.reply { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.reply textarea.input { min-height: 84px; }

@media (max-width: 760px) {
  .row.t-row { grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-areas: 'dot name when' '. last last'; gap: 6px 12px; }
  .t-row > .t-last { grid-area: last; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .t-row > .t-when { grid-area: when; }
  .msg { max-width: 92%; }
  .msg-files img { height: 120px; }
  .thread { max-height: 60vh; }
}
.stats.t-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; }
.stat-note { font-size: 12px; color: var(--faint); margin-top: 2px; text-wrap: pretty; }
@media (max-width: 760px) { .stats.t-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; } }
.l-short { display: none; }
.seg.t-seg button { display: inline-flex; align-items: center; white-space: nowrap; }
@media (max-width: 760px) {
  .seg.t-seg { display: flex; width: 100%; }
  .seg.t-seg button { flex: 1 1 auto; justify-content: center; padding: 0 6px; }
  .seg.t-seg .l-long { display: none; }
  .seg.t-seg .l-short { display: inline; }
}

/* ───────── оплаты ─────────
   Тот же язык цвета: красный — не оплачено, янтарный — скоро конец, синий — оплачено, пустой кружок — нет подписки. */
.stats.p-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; }
.p-group { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 4px; padding: 0 14px; }
.p-group:first-of-type { margin-top: 0; }
.p-group span { font-weight: 500; color: var(--faint); }
.row.p-row { grid-template-columns: 12px minmax(160px, 1.1fr) minmax(200px, 1.3fr) 130px 150px; }
.p-term { display: grid; gap: 2px; min-width: 0; }
.p-term b { font-size: 14px; font-weight: 600; }
.p-term small { font-size: 12.5px; color: var(--faint); }
.row-num small { display: block; }
.p-act { justify-self: end; }
.p-row .p-act .btn { pointer-events: none; }
.p-row:hover .p-act .btn { border-color: var(--line-dark); background: var(--surface-2); }

.p-form { gap: 18px; }
.p-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.p-amount { position: relative; max-width: 260px; }
.p-amount .input { width: 100%; padding-right: 52px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.p-amount span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 14px; pointer-events: none; }
.seg.p-seg { flex-wrap: wrap; border-radius: 18px; }
.seg.p-seg button { white-space: nowrap; }
.p-date { max-width: 220px; }
.p-result {
  display: grid; gap: 4px; padding: 16px 18px; border-radius: 16px;
  background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--tile) 22%, var(--line));
}
.p-result span { font-size: 12.5px; color: var(--muted); }
.p-result b { font-size: clamp(26px, 4vw, 34px); font-weight: 700; letter-spacing: -.04em; line-height: 1.08; color: var(--text); }
.p-result small { font-size: 13px; color: var(--text-2); text-wrap: pretty; }
.p-more summary { cursor: pointer; font-size: 13.5px; color: var(--muted); font-weight: 560; width: fit-content; }
.p-more summary:hover { color: var(--text); }
.p-more-in { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.p-wait { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.p-wait b { font-size: 15px; }
.p-wait p { font-size: 13.5px; margin-top: 2px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--tile) 25%, transparent); border-top-color: var(--tile); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
.p-li .what > span { display: grid; gap: 2px; }
.p-li-sub { font-size: 12.5px; color: var(--faint); white-space: normal !important; }
.li.p-li { align-items: center; }

@media (max-width: 1080px) {
  .row.p-row { grid-template-columns: 12px minmax(150px, 1fr) minmax(180px, 1.2fr) 120px auto; }
}
@media (max-width: 760px) {
  .stats.p-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .p-group { padding: 0 4px; }
  .row.p-row { grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-areas: 'dot name act' '. term term' '. num num'; gap: 6px 12px; }
  .p-row > .row-name { grid-area: name; }
  .p-row > .p-term { grid-area: term; }
  .p-row > .row-num { grid-area: num; text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); }
  .p-row > .row-num small { display: inline; margin-left: 6px; }
  .p-row > .row-num .p-none { margin-left: 0; }
  .p-row > .p-act { grid-area: act; }
  .p-row .p-act .btn { display: none; }
  .seg.p-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .seg.p-seg button { padding: 0 6px; }
  .p-amount { max-width: none; }
  .p-more-in { grid-template-columns: minmax(0, 1fr); }
}

/* ───────── главная: что сделать сейчас ─────────
   Каждое дело — карточка с кнопкой, которая его решает. Цвет полосы слева — тот же язык: синий — человек ждёт,
   красный — авария или неоплата, янтарный — замечание или скорый срок. */
.todo { display: grid; gap: 12px; }
.todo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px; }
.todo-head h2 { font-size: 20px; font-weight: 680; letter-spacing: -.03em; }
.todo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; align-items: start; }
.todo-card {
  --kind: var(--line-dark);
  position: relative; display: grid; gap: 8px; padding: 16px 18px 16px 21px; border-radius: 20px; overflow: hidden;
  background: var(--sheet); border: 1px solid var(--edge); box-shadow: var(--sh-1);
}
.todo-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kind); }
.todo-card.support { --kind: var(--tile); }
.todo-card.critical { --kind: var(--cell-bad); }
.todo-card.warning { --kind: var(--cell-mix); }
.todo-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.todo-kind { font-weight: 620; color: var(--text-2); }
.todo-card.support .todo-kind { color: var(--tile); }
.todo-card.critical .todo-kind { color: var(--danger); }
.todo-card.warning .todo-kind { color: var(--warn); }
.todo-card h3 { font-size: 16.5px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; overflow-wrap: anywhere; }
.todo-card h3 .faint { font-weight: 500; }
.todo-text { font-size: 14px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.todo-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.todo-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.todo-more { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px; }
.todo-empty { display: flex; align-items: center; gap: 16px; padding: 20px 22px; border-radius: 20px; background: var(--sheet); border: 1px solid var(--edge); box-shadow: var(--sh-1); }
.todo-empty svg { width: 40px; height: 40px; flex: none; fill: none; stroke: var(--ok-ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.todo-empty h2 { font-size: 18px; font-weight: 680; letter-spacing: -.02em; }
.todo-empty p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.spark-ic { width: 16px; height: 16px; flex: none; fill: var(--tile); }
.ask-btn { gap: 6px; color: var(--text-2); }
@media (pointer: coarse) { .todo-acts .btn, .ai-card-acts .btn { min-height: 42px; padding: 0 16px; } }

/* Вопрос помощнику прямо с главной. */
.ask-quick {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 7px 7px 9px; border-radius: var(--r-pill); background: var(--sheet); border: 1px solid var(--edge); box-shadow: var(--sh-1);
}
.ask-quick:focus-within { border-color: var(--tile); box-shadow: 0 0 0 4px rgba(31, 68, 255, .12); }
.ask-quick .ai-orb { width: 38px; height: 38px; margin: 0; box-shadow: none; }
.ask-quick .ai-orb svg { width: 19px; height: 19px; fill: #fff; }
.ask-quick .input { border: 0; background: none; box-shadow: none !important; min-height: 42px; padding: 0 4px; }
.ask-quick .btn { min-height: 42px; border-radius: var(--r-pill); }

/* Сворачиваемый блок: цифры и подробности — по нажатию, список дел и компаний — сразу. */
details.more { padding: 0; }
details.more > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; cursor: pointer; list-style: none;
  font-size: 16px; font-weight: 640; letter-spacing: -.015em; border-radius: var(--r-lg); -webkit-tap-highlight-color: transparent;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary:hover { color: var(--tile); }
.more-ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--faint); transition: transform .18s ease; }
details.more[open] .more-ic { transform: rotate(180deg); }
.more-in { display: grid; gap: 18px; padding: 0 24px 22px; }
.more-in .sheet { box-shadow: none; background: transparent; border-color: var(--line); padding: 18px; }
.more-sub { font-size: 14px; font-weight: 620; color: var(--muted); margin-top: 4px; }

.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.seg.seg-links a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: var(--r-pill); font-weight: 600; font-size: 14px; color: var(--muted); text-decoration: none; }
.seg.seg-links a[aria-current='page'] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.seg-n.critical { background: var(--cell-bad); }
.seg-n.warning { background: var(--cell-mix); color: #1d1502; }

/* ───────── помощник ─────────
   Ответ — без пузыря, как текст в документе; вопрос владельца — синий пузырь справа. Поле ввода прилипает к низу. */
.ai { display: grid; grid-template-rows: auto 1fr auto; gap: 16px; min-height: calc(100dvh - 160px); }
.ai-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.ai-head h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.045em; line-height: 1.05; }
.ai-head .muted { font-size: 13px; margin-top: 4px; }
.ai-log { display: grid; gap: 18px; align-content: start; }
.ai-msg { max-width: 760px; }
.ai-msg.me { justify-self: end; max-width: min(82%, 620px); padding: 10px 15px; border-radius: 20px 20px 6px 20px; background: var(--tile); color: #fff; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-msg.bot { justify-self: start; width: 100%; }
.ai-text { font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere; }
.ai-text > * + * { margin-top: 8px; }
.ai-text ul, .ai-text ol { padding-left: 22px; display: grid; gap: 4px; }
.ai-text b { font-weight: 650; }
.ai-cards { display: grid; gap: 10px; margin-top: 14px; }
.ai-card { display: grid; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--sheet); border: 1px solid var(--edge); box-shadow: var(--sh-1); }
.ai-card.done { opacity: .7; box-shadow: none; }
.ai-card-title { font-weight: 640; font-size: 15px; letter-spacing: -.01em; }
.ai-quote { margin: 0; border-left: 3px solid var(--tile); padding: 2px 0 2px 12px; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.ai-quote > * + * { margin-top: 6px; }
.ai-quote ul, .ai-quote ol { padding-left: 20px; }
.ai-card-note { font-size: 13.5px; color: var(--muted); }
.ai-card-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-msg.wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; }
.ai-dots { display: inline-flex; gap: 4px; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--tile); animation: blink 1.2s ease-in-out infinite; }
.ai-dots i:nth-child(2) { animation-delay: .15s; }
.ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ai-dots i { animation-duration: 3s; } }
.ai-msg.err { display: grid; gap: 10px; justify-items: start; padding: 12px 16px; border-radius: 16px; background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); font-size: 14.5px; }
.ai-hello { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 28px 8px 8px; }
.ai-hello h2 { font-size: 22px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; }
.ai-hello p { color: var(--muted); font-size: 14.5px; max-width: 46ch; text-wrap: pretty; }
.ai-orb.big { width: 64px; height: 64px; margin: 0; box-shadow: 0 14px 30px -12px rgba(31, 68, 255, .8); }
.ai-orb.big svg { width: 32px; height: 32px; }
.ai-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 8px; width: min(100%, 620px); margin-top: 10px; }
.ai-example { min-height: 48px; padding: 10px 16px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 540; font-size: 14px; text-align: left; cursor: pointer; }
.ai-example:hover { border-color: var(--tile); color: var(--tile); }
.ai-form {
  position: sticky; bottom: 16px; z-index: 5; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px;
  padding: 8px; border-radius: 26px; border: 1px solid var(--line-strong); background: var(--nav-glass); box-shadow: var(--sh-3);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
}
.ai-form .input { resize: none; min-height: 46px; max-height: 180px; padding: 12px 14px; border-radius: 19px; line-height: 1.4; background: var(--surface); }
.ai-send { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--tile); color: #fff; }
.ai-send svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ai-send:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 760px) {
  .todo-card { padding: 14px 16px 14px 19px; }
  .ask-quick .btn { padding: 0 14px; }
  .more-in { padding: 0 16px 18px; }
  details.more > summary { padding: 16px; font-size: 15.5px; }
  .prod-head { align-items: stretch; flex-direction: column; }
  .seg.seg-links { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .seg.seg-links a { justify-content: center; min-height: 40px; }
  .list-tools > .seg { flex: 1 1 auto; }
  .ai { min-height: calc(100dvh - 190px - var(--safe-b)); gap: 14px; }
  .ai-form { bottom: calc(72px + var(--safe-b)); }
  .ai-msg.me { max-width: 88%; }
  /* Компания и оплата — шторка снизу; обращение — на весь экран, как переписка в мессенджере. */
  .drawer { top: auto; height: calc(100dvh - 24px - var(--safe-t)); border-radius: 24px 24px 0 0; border-top: 1px solid var(--line); animation: rise .28s cubic-bezier(.2, .8, .2, 1) both; }
  .drawer.full { height: 100dvh; border-radius: 0; border-top: 0; }
  .drawer:not(.full) .drawer-in { padding-top: 14px; }
  .drawer:not(.full) .d-top { top: -14px; margin-top: -14px; padding-top: 26px; border-radius: 24px 24px 0 0; }
  .drawer:not(.full) .d-top::before { content: ''; position: absolute; top: 9px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line-dark); opacity: .45; }
}
@keyframes rise { from { transform: translateY(48px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1024px) {
  .ai { min-height: calc(100dvh - 86px); }
  .ai-form { bottom: 20px; }
}
