/* ==========================================================================
   РЕЗЕРВ — запасной канал AdReplica. Дизайн-система «ACID SWISS» как у «Ячейки»:
   тёплый почти-чёрный, один кислотный акцент, волосяные линии, Unbounded для чисел,
   JetBrains Mono для индексов и метрик. Mobile-first: нижние вкладки, листы снизу.
   ========================================================================== */

@font-face { font-family: 'Unbounded'; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url('/fonts/unbounded-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url('/fonts/unbounded-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url('/fonts/onest-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url('/fonts/onest-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url('/fonts/jetbrains-mono-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Токены: тёмная тема ---------- */
:root {
  --bg: #0B0C0A; --bg-raise: #10120E; --surface: #151712; --surface-hi: #1C1F18;
  --line: #262A21; --line-strong: #363B2F;
  --text: #EDEFE5; --text-2: #A5AA95; --text-3: #6F7462;
  --acid: #CDFF3D; --acid-ink: #0B0C0A; --acid-text: #CDFF3D; --acid-soft: rgba(205, 255, 61, 0.10);
  --rose: #FF5D8F; --rose-soft: rgba(255, 93, 143, 0.12);
  --sky: #7CDCFF; --sky-soft: rgba(124, 220, 255, 0.10);
  --amber: #FFC15A; --amber-soft: rgba(255, 193, 90, 0.12);
  --bar: rgba(237, 239, 229, 0.16);
  --shadow-1: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 32px -18px rgba(0, 0, 0, 0.7);
  --shadow-2: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 6px rgba(0, 0, 0, 0.4), 0 24px 48px -20px rgba(0, 0, 0, 0.8);
  --shadow-pop: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 -30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--line-strong);
  --glow-acid: 0 0 0 1px rgba(205, 255, 61, 0.55), 0 10px 34px -10px rgba(205, 255, 61, 0.45);
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --gutter: clamp(16px, 4vw, 56px);
  --tabbar-h: 64px;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --sans: 'Onest', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F2F0E8; --bg-raise: #F7F5EF; --surface: #FBFAF6; --surface-hi: #FFFFFF; --line: #E0DCCF; --line-strong: #CCC7B6;
    --text: #13140F; --text-2: #565949; --text-3: #8A8C7C; --acid-text: #4E6B00; --acid-soft: rgba(132, 176, 0, 0.12);
    --rose: #D42F67; --rose-soft: rgba(212, 47, 103, 0.10); --sky: #0B7EA8; --sky-soft: rgba(11, 126, 168, 0.09); --amber: #A9670A; --amber-soft: rgba(169, 103, 10, 0.10);
    --bar: rgba(19, 20, 15, 0.14);
    --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 1px 2px rgba(19, 20, 15, 0.06), 0 14px 32px -20px rgba(19, 20, 15, 0.22);
    --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 2px 6px rgba(19, 20, 15, 0.07), 0 26px 50px -24px rgba(19, 20, 15, 0.3);
    --shadow-pop: 0 -30px 80px -24px rgba(19, 20, 15, 0.35), 0 0 0 1px var(--line-strong);
    --glow-acid: 0 0 0 1px rgba(78, 107, 0, 0.35), 0 10px 30px -12px rgba(132, 176, 0, 0.55);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F2F0E8; --bg-raise: #F7F5EF; --surface: #FBFAF6; --surface-hi: #FFFFFF; --line: #E0DCCF; --line-strong: #CCC7B6;
  --text: #13140F; --text-2: #565949; --text-3: #8A8C7C; --acid-text: #4E6B00; --acid-soft: rgba(132, 176, 0, 0.12);
  --rose: #D42F67; --rose-soft: rgba(212, 47, 103, 0.10); --sky: #0B7EA8; --sky-soft: rgba(11, 126, 168, 0.09); --amber: #A9670A; --amber-soft: rgba(169, 103, 10, 0.10);
  --bar: rgba(19, 20, 15, 0.14);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 1px 2px rgba(19, 20, 15, 0.06), 0 14px 32px -20px rgba(19, 20, 15, 0.22);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 2px 6px rgba(19, 20, 15, 0.07), 0 26px 50px -24px rgba(19, 20, 15, 0.3);
  --shadow-pop: 0 -30px 80px -24px rgba(19, 20, 15, 0.35), 0 0 0 1px var(--line-strong);
  --glow-acid: 0 0 0 1px rgba(78, 107, 0, 0.35), 0 10px 30px -12px rgba(132, 176, 0, 0.55);
  color-scheme: light;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--sans); font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: calc((100vw - 2 * var(--gutter)) / 12) 100%; background-position: var(--gutter) 0;
}
:root[data-theme="light"] body::before { background-image: linear-gradient(to right, rgba(19, 20, 15, 0.035) 1px, transparent 1px); }
::selection { background: var(--acid); color: var(--acid-ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; border-radius: 6px; }
:root[data-theme="light"] :focus-visible { outline-color: var(--acid-text); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 15px; height: 15px; }

.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.micro { font: 500 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); }
.kicker { font: 500 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-3); }
.kicker b { color: var(--acid-text); font-weight: 600; margin-right: 8px; }
.kicker span { margin: 0 6px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.pos { color: var(--acid-text); }
.neg { color: var(--rose); }

/* ---------- Каркас ---------- */
.app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 12px;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font: 700 17px/1 var(--display); letter-spacing: -0.03em; }
.brand-mark { width: 12px; height: 12px; border-radius: 3px; background: var(--acid); box-shadow: 0 0 18px rgba(205, 255, 61, 0.55); transition: transform 0.5s var(--ease-spring); }
.brand:hover .brand-mark { transform: rotate(45deg) scale(0.9); }
.brand-idx { font: 500 10px var(--mono); color: var(--text-3); letter-spacing: 0.08em; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; }
.nav { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.sync { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; white-space: nowrap; border-radius: 10px; border: 0; background: none; font: 500 11px var(--mono); color: var(--text-3); transition: background 0.2s, color 0.2s; }
.sync:hover { background: var(--surface); color: var(--text-2); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.sync[data-state="ok"] i { background: var(--acid); animation: pulse 2.6s infinite; }
.sync[data-state="stale"] i { background: var(--amber); }
.sync[data-state="err"] i { background: var(--rose); }
.sync[data-state="run"] i { background: var(--sky); animation: blink 0.9s ease-in-out infinite; }
.sync[data-state="run"] .ic { animation: spin 1s linear infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(205, 255, 61, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(205, 255, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(205, 255, 61, 0); } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 0; background: none; color: var(--text-2); transition: background 0.2s, color 0.2s, transform 0.2s var(--ease); }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

.page { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px var(--gutter) calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom)); animation: enter 0.5s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.page.still { animation: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font: 700 clamp(28px, 7vw, 44px)/0.95 var(--display); letter-spacing: -0.05em; margin-top: 10px; }
.page-title .n { font: 500 14px var(--mono); color: var(--text-3); letter-spacing: 0; vertical-align: 0.9em; margin-left: 6px; }

/* Нижние вкладки (телефон) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in oklab, var(--bg) 86%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3); font: 500 10.5px var(--sans); letter-spacing: 0.01em; transition: color 0.2s; }
.tabbar a .ic { width: 21px; height: 21px; transition: transform 0.35s var(--ease-spring); }
.tabbar a:active .ic { transform: scale(0.88); }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a::before { content: ''; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--acid); transform: scaleX(0); transition: transform 0.45s var(--ease); }
.tabbar a[aria-current="page"]::before { transform: scaleX(1); }
.tabbar .dot { position: absolute; top: 9px; left: calc(50% + 8px); width: 7px; height: 7px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 2px var(--bg); }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .page { padding-bottom: 64px; padding-top: 34px; }
  .nav { display: flex; gap: 4px; margin-left: 28px; }
  .nav a { position: relative; display: flex; align-items: baseline; gap: 7px; padding: 9px 14px; border-radius: 10px; font-weight: 500; color: var(--text-2); white-space: nowrap; transition: color 0.2s, background 0.2s; }
  .nav a:hover { color: var(--text); background: var(--surface); }
  .nav-idx { font: 500 10px var(--mono); color: var(--text-3); }
  .nav a::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--acid); transform: scaleX(0); transform-origin: left; transition: transform 0.45s var(--ease); }
  .nav a[aria-current="page"] { color: var(--text); }
  .nav a[aria-current="page"] .nav-idx { color: var(--acid-text); }
  .nav a[aria-current="page"]::after { transform: scaleX(1); }
}

/* ---------- Кнопки ---------- */
.btn {
  --bg-b: var(--surface-hi); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--bg-b); font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow-1);
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--text-3); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.5; pointer-events: none; }
.btn[aria-busy="true"] .ic { animation: spin 1s linear infinite; }
.btn-acid { background: var(--acid); color: var(--acid-ink); border-color: transparent; }
.btn-acid:hover { box-shadow: var(--glow-acid); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); box-shadow: none; border-color: var(--line); }
.btn-danger { color: var(--rose); }
.btn-danger:hover { border-color: var(--rose); background: var(--rose-soft); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 54px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn .arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Сегмент с бегущим индикатором */
.seg { position: relative; display: inline-flex; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { white-space: nowrap; position: relative; z-index: 1; border: 0; background: none; padding: 8px 13px; border-radius: 10px; font-weight: 500; font-size: 13.5px; color: var(--text-2); transition: color 0.25s; display: inline-flex; gap: 7px; align-items: baseline; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--acid-ink); }
.seg button .n { font: 500 11px var(--mono); opacity: 0.6; }
.seg-ind { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 10px; background: var(--acid); box-shadow: 0 6px 20px -6px rgba(205, 255, 61, 0.5); transition: transform 0.45s var(--ease), width 0.45s var(--ease); }

/* ---------- Поля ---------- */
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.label { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.11em; color: var(--text-3); }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.input, .field input, .field textarea {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--bg-raise);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; outline: none; font-size: 16px;
}
.field textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.5; font: 400 14px/1.5 var(--mono); }
.input:hover, .field input:hover, .field textarea:hover { border-color: var(--text-3); }
.input:focus, .field input:focus, .field textarea:focus { border-color: var(--acid); box-shadow: 0 0 0 4px var(--acid-soft); background: var(--surface); }
:root[data-theme="light"] .field input:focus, :root[data-theme="light"] .field textarea:focus { border-color: var(--acid-text); }
.form-error { color: var(--rose); font-size: 13.5px; font-weight: 500; min-height: 20px; margin-top: 4px; }
.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.search input { width: 100%; height: 42px; padding: 0 14px 0 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 15px; transition: border-color 0.2s, box-shadow 0.2s; }
.search input:focus { border-color: var(--acid); box-shadow: 0 0 0 4px var(--acid-soft); }

/* Ячейки кода 2FA: 3 + 3 */
.code { border: 0; padding: 0; margin: 0 0 6px; }
.code legend { padding: 0; margin-bottom: 9px; }
.code-cells { position: relative; display: grid; grid-template-columns: repeat(3, 1fr) 10px repeat(3, 1fr); gap: 7px; }
.code-cells .cell:nth-child(4) { grid-column-start: 5; }
.code-cells .cell {
  display: grid; place-items: center; aspect-ratio: 0.82; min-width: 0; font: 700 22px var(--display); border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--bg-raise); transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease-spring), background 0.2s; position: relative;
}
.code-cells .cell.filled { background: var(--surface-hi); border-color: var(--text-3); animation: pop-in 0.25s var(--ease-spring); }
.code-cells .cell.active { border-color: var(--acid); box-shadow: 0 0 0 4px var(--acid-soft); transform: translateY(-2px); }
.code-cells .cell.active:empty::after { content: ''; width: 2px; height: 26px; border-radius: 2px; background: var(--acid); animation: caret 1s steps(1) infinite; }
:root[data-theme="light"] .code-cells .cell.active { border-color: var(--acid-text); }
:root[data-theme="light"] .code-cells .cell.active:empty::after { background: var(--acid-text); }
@keyframes caret { 50% { opacity: 0; } }
@keyframes pop-in { from { transform: scale(0.92); } }
/* Настоящее поле лежит поверх ячеек: тап по любой ячейке фокусирует его. Шрифт 16px — без зума iOS. */
.code-real { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; font-size: 16px; color: transparent; background: transparent; caret-color: transparent; cursor: text; }
.shake { animation: shake 0.45s var(--ease); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* ---------- Вход ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; position: relative; z-index: 1; }
.login-art { padding: calc(22px + env(safe-area-inset-top)) var(--gutter) 26px; border-bottom: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; gap: 26px; }
.login-word { font: 800 clamp(58px, 19vw, 200px)/0.8 var(--display); letter-spacing: -0.07em; }
.login-word span { display: block; animation: rise 0.9s var(--ease) both; }
.login-word span:nth-child(2) { animation-delay: 0.08s; padding-left: 0.42em; }
.login-word .dot { display: inline-block; width: 0.16em; height: 0.16em; margin-left: 0.05em; border-radius: 0.03em; background: var(--acid); box-shadow: 0 0 40px rgba(205, 255, 61, 0.6); animation: dot 3.2s var(--ease) infinite; }
@keyframes rise { from { opacity: 0; transform: translateY(0.25em); } }
@keyframes dot { 0%, 100% { transform: none; } 50% { transform: rotate(45deg) scale(0.8); } }
.login-index { display: none; }
.login-panel { display: grid; align-content: start; justify-items: center; padding: 30px var(--gutter) calc(40px + env(safe-area-inset-bottom)); }
.login-form { width: min(420px, 100%); }
.login-form h1 { font: 700 clamp(26px, 7vw, 34px)/1 var(--display); letter-spacing: -0.045em; margin-top: 10px; }
.login-form > p.lead { margin: 12px 0 28px; color: var(--text-2); }
.login-form .btn { margin-top: 14px; }
.login-note { margin-top: 22px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.steps { display: flex; gap: 6px; margin: 0 0 22px; }
.steps i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); transition: background 0.4s; }
.steps i.on { background: var(--acid); }
.secret { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 14px 16px; border-radius: var(--r); border: 1px dashed var(--line-strong); background: var(--bg-raise); margin: 6px 0 14px; }
.secret code { font: 600 15px/1.45 var(--mono); letter-spacing: 0.08em; word-break: break-all; }
@media (min-width: 900px) {
  .login { grid-template-columns: 1.25fr 1fr; }
  .login-art { border-bottom: 0; border-right: 1px solid var(--line); justify-content: space-between; padding: var(--gutter); }
  .login-word { margin: 40px 0; }
  .login-index { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px 36px; }
  .login-index div { font: 500 11px var(--mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }
  .login-index b { display: block; font: 600 15px var(--sans); color: var(--text-2); text-transform: none; letter-spacing: 0; margin-top: 6px; }
  .login-panel { place-items: center; padding: var(--gutter); }
}

/* ---------- Сводка ---------- */
.hero { display: grid; gap: 34px; }
.hero-num { font: 700 clamp(58px, 17vw, 150px)/0.86 var(--display); letter-spacing: -0.065em; margin: 16px 0 16px -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-num .cur { font-size: 0.36em; vertical-align: 1.05em; letter-spacing: -0.02em; color: var(--text-3); margin-right: 0.06em; }
.hero-num .frac { color: var(--text-3); font-size: 0.5em; letter-spacing: -0.04em; }
.hero-meta { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.delta { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--mono); padding: 6px 10px; border-radius: 999px; }
.delta.up { color: var(--acid-text); background: var(--acid-soft); }
.delta.down { color: var(--rose); background: var(--rose-soft); }
.delta.flat { color: var(--text-3); background: var(--surface); }
.other-cur { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.other-cur span { font: 500 12px var(--mono); color: var(--text-2); padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); }

.bars { margin-top: 28px; }
.bars svg { display: block; width: 100%; height: 120px; overflow: visible; }
.bars .b { fill: var(--bar); transition: fill 0.2s, opacity 0.2s; }
.bars .b.today { fill: var(--acid); }
:root[data-theme="light"] .bars .b.today { fill: #9BCB00; }
.bars g:hover .b { fill: var(--text-2); }
.bars g:hover .b.today { fill: var(--acid); }
.bars .hit { fill: transparent; cursor: default; }
.bars-axis { display: flex; justify-content: space-between; margin-top: 10px; }
.bars-axis span { flex: 1; text-align: center; }
.bars-tip { min-height: 18px; margin-top: 8px; font: 500 12px var(--mono); color: var(--text-2); }

.attention { position: relative; padding: 20px 20px 8px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.attention-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.attention-head .n { font: 700 13px var(--display); min-width: 26px; height: 26px; padding: 0 7px; border-radius: 8px; display: grid; place-items: center; background: var(--rose); color: #0B0C0A; }
.attention-head .n.zero { background: var(--acid); }
.alert { position: relative; display: block; padding: 13px 0 13px 18px; border-top: 1px solid var(--line); transition: padding 0.25s var(--ease); }
.alert:first-of-type { border-top: 0; }
.alert::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--text-3); }
.alert.danger::before { background: var(--rose); box-shadow: 0 0 12px var(--rose); }
.alert.warn::before { background: var(--amber); }
.alert.info::before { background: var(--sky); }
a.alert:hover { padding-left: 24px; }
.alert-t { font-weight: 600; font-size: 14px; line-height: 1.35; }
.alert-s { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.calm { padding: 18px 0 16px; }
.calm b { font: 700 22px/1.1 var(--display); letter-spacing: -0.03em; display: block; margin-bottom: 6px; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); margin-top: 34px; }
.kpi { padding: 20px 16px 20px 0; border-bottom: 1px solid var(--line); position: relative; }
.kpi:nth-child(2n) { padding-left: 16px; border-left: 1px solid var(--line); }
.kpi-v { font: 600 clamp(24px, 6.4vw, 32px)/1 var(--display); letter-spacing: -0.045em; margin-top: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-v small { font: 500 13px var(--mono); color: var(--text-3); letter-spacing: 0; margin-left: 4px; }
.kpi-d { font: 500 12px var(--mono); margin-top: 8px; color: var(--text-3); }
@media (min-width: 900px) {
  .hero { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 28px; align-items: start; }
  .hero-main { grid-column: 1 / span 7; }
  .hero-side { grid-column: 9 / -1; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .kpi { border-bottom: 0; padding: 24px 20px; border-left: 1px solid var(--line); }
  .kpi:first-child { border-left: 0; padding-left: 0; }
  .kpi:nth-child(2n) { padding-left: 20px; }
}

/* ---------- Списки: кабинеты, профили ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.row {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center;
  padding: 16px 4px 16px 16px; border-bottom: 1px solid var(--line); transition: background 0.2s, padding 0.25s var(--ease);
}
.row::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 3px; background: var(--line-strong); }
.row.st-live::before { background: var(--acid); }
.row.st-bad::before { background: var(--rose); box-shadow: 0 0 10px var(--rose); }
.row.st-warn::before { background: var(--amber); }
.row.st-off::before { background: var(--line-strong); }
a.row:hover { background: linear-gradient(to right, var(--surface), transparent); padding-left: 20px; }
a.row:active { background: var(--surface); }
.row-t { font-weight: 600; font-size: 15px; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-s { font: 400 12px/1.4 var(--mono); color: var(--text-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-v { text-align: right; font: 600 17px/1.1 var(--display); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-v small { display: block; font: 500 11.5px var(--mono); color: var(--text-3); letter-spacing: 0; margin-top: 4px; }
.row-meta { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cap { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
.cap-track { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.cap-fill { height: 100%; border-radius: 4px; background: var(--text-2); transition: width 1s var(--ease); }
.cap-fill.hot { background: var(--amber); }
.cap-fill.full { background: var(--rose); }
.cap span { font: 500 11.5px var(--mono); color: var(--text-3); white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font: 600 11px/1 var(--mono); letter-spacing: 0.02em; white-space: nowrap; border: 1px solid transparent; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { color: var(--acid-text); background: var(--acid-soft); }
.pill.bad { color: var(--rose); background: var(--rose-soft); }
.pill.warn { color: var(--amber); background: var(--amber-soft); }
.pill.info { color: var(--sky); background: var(--sky-soft); }
.pill.off { color: var(--text-3); border-color: var(--line); }

/* Карточка профиля */
.cards { display: grid; gap: 12px; }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.card { position: relative; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); display: grid; gap: 14px; transition: border-color 0.2s, box-shadow 0.25s var(--ease); }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; font: 700 14px var(--display); letter-spacing: -0.04em; background: var(--surface-hi); border: 1px solid var(--line-strong); color: var(--text-2); }
.card-title { font-weight: 650; font-size: 16px; line-height: 1.25; }
.card-sub { font: 400 12px var(--mono); color: var(--text-3); margin-top: 3px; overflow-wrap: anywhere; }
.card-head .icon-btn { margin: -6px -8px 0 auto; }
.facts { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.7fr) minmax(0, 0.5fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact { padding: 11px 10px 11px 0; min-width: 0; }
.fact + .fact { padding-left: 12px; border-left: 1px solid var(--line); }
.fact b { display: block; margin-top: 6px; font: 600 14px/1.2 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-msg { font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; }
.card-msg.bad { color: var(--rose); background: var(--rose-soft); }
.card-msg.warn { color: var(--amber); background: var(--amber-soft); }
.card-msg.info { color: var(--text-2); background: var(--bg-raise); border: 1px dashed var(--line-strong); }
.card-msg b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }

/* ---------- Кабинет: детали ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; padding: 6px 0; transition: color 0.2s, gap 0.25s var(--ease); }
.back:hover { color: var(--text); gap: 10px; }
.acc-head { display: grid; gap: 12px; margin: 8px 0 24px; }
.acc-name { font: 700 clamp(24px, 6.4vw, 40px)/1.02 var(--display); letter-spacing: -0.045em; overflow-wrap: anywhere; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trio > div { padding: 16px 10px 16px 0; min-width: 0; }
.trio > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.trio .v { font: 600 clamp(18px, 5vw, 26px)/1 var(--display); letter-spacing: -0.045em; margin-top: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.section-t { display: flex; justify-content: space-between; align-items: baseline; margin: 34px 0 10px; }
.camp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.camp-t { display: flex; gap: 9px; align-items: center; font-weight: 600; font-size: 14px; min-width: 0; }
.camp-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.sdot.on { background: var(--acid); box-shadow: 0 0 10px rgba(205, 255, 61, 0.6); }
.sdot.bad { background: var(--rose); }
.sdot.wait { background: var(--sky); }
.camp-s { font: 400 12px var(--mono); color: var(--text-3); grid-column: 1; }
.camp-v { grid-row: 1 / span 2; grid-column: 2; text-align: right; font: 600 15px var(--mono); align-self: center; white-space: nowrap; }
.camp-v small { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; margin-top: 3px; }

/* ---------- Журнал ---------- */
.log { border-top: 1px solid var(--line); }
.log-row { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; }
.log-row time { font: 500 11.5px/1.7 var(--mono); color: var(--text-3); }
.log-row.warn p { color: var(--amber); }
.log-row.error p { color: var(--rose); }
.log-day { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); padding: 18px 0 8px; }

/* ---------- Лист снизу (телефон) / модалка (десктоп) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(5, 6, 4, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade 0.25s ease both; }
:root[data-theme="light"] .sheet-back { background: rgba(19, 20, 15, 0.28); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px var(--gutter) calc(26px + env(safe-area-inset-bottom)); border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--bg-raise); box-shadow: var(--shadow-pop); animation: up 0.45s var(--ease) both;
}
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 18px; }
.sheet h2 { font: 700 24px/1.05 var(--display); letter-spacing: -0.045em; margin: 8px 0 8px; }
.sheet .lead { color: var(--text-2); margin-bottom: 20px; font-size: 14px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet-actions .spacer { flex: 1; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.closing .sheet { animation: down 0.3s var(--ease) both; }
.closing.sheet-back, .closing .sheet-back { animation: fade 0.3s ease reverse both; }
@keyframes down { to { transform: translateY(100%); } }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(520px, calc(100vw - 40px)); border-radius: var(--r-xl); transform: translate(-50%, -50%); padding: 26px 28px 26px; animation: pop 0.35s var(--ease) both; }
  .sheet-grip { display: none; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); } }
  .closing .sheet { animation: popout 0.2s ease both; }
  @keyframes popout { to { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
}
.linkbox { display: grid; gap: 10px; padding: 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); margin-bottom: 16px; }
.linkbox code { font: 500 12px/1.5 var(--mono); color: var(--text-2); word-break: break-all; max-height: 92px; overflow: hidden; mask-image: linear-gradient(to bottom, #000 60%, transparent); -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); }
.ol { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.ol li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.ol li::before { content: counter(s, decimal-leading-zero); font: 600 11px/1.9 var(--mono); color: var(--acid-text); }

/* ---------- Пустые состояния, скелетоны, тосты ---------- */
.empty { padding: 46px 8px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty-mark { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--text-3); margin-bottom: 6px; }
.empty-mark .ic { width: 24px; height: 24px; }
.empty b { font: 700 20px/1.1 var(--display); letter-spacing: -0.035em; }
.empty p { color: var(--text-3); max-width: 340px; font-size: 14px; }
.empty .btn { margin-top: 10px; }
.sk { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-hi) 40%, var(--surface) 80%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.sk-line { height: 14px; margin: 10px 0; }
.sk-hero { height: clamp(58px, 17vw, 140px); width: 72%; margin: 18px 0; border-radius: 14px; }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-hi); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); font-size: 14px; font-weight: 500; animation: toast 0.45s var(--ease-spring) both; }
.toast i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--acid); }
.toast.err i { background: var(--rose); }
.toast.out { animation: toastout 0.3s ease both; }
@keyframes toast { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes toastout { to { opacity: 0; transform: translateY(8px); } }

.banner { display: grid; gap: 8px; padding: 16px 18px; border-radius: var(--r-lg); border: 1px dashed color-mix(in oklab, var(--amber) 55%, transparent); background: var(--amber-soft); margin-bottom: 22px; }
.banner b { font-weight: 650; }
.banner ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; }
.copyline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copyline code { font: 500 12.5px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Страница после входа профиля */
.cb { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; gap: 14px; padding: 40px var(--gutter); max-width: 620px; margin: 0 auto; }
.cb-mark { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 14px; background: var(--acid); box-shadow: 0 0 60px rgba(205, 255, 61, 0.45); animation: dot 3.2s var(--ease) infinite; }
.cb-bad .cb-mark { background: var(--rose); box-shadow: 0 0 60px rgba(255, 93, 143, 0.4); }
.cb h1 { font: 700 clamp(30px, 8vw, 48px)/1 var(--display); letter-spacing: -0.05em; }
.cb-text { color: var(--text-2); font-size: 16px; }
.cb-note { color: var(--text-3); font-size: 13px; margin-top: 10px; }

/* Документы: политика, удаление данных */
.doc { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top)) var(--gutter) 80px; }
.doc h1 { font: 700 clamp(34px, 8vw, 56px)/0.95 var(--display); letter-spacing: -0.055em; margin: 14px 0 12px; }
.doc h2 { font: 650 18px/1.3 var(--sans); margin: 34px 0 10px; }
.doc p, .doc li { color: var(--text-2); line-height: 1.65; }
.doc ul { padding-left: 20px; }
.doc a { color: var(--acid-text); text-decoration: underline; text-underline-offset: 3px; }
.doc .ol { margin-top: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
