/* ads — интерфейс.
   Цвет несёт только состояние кабинета: работает / нужно действие / отключён.
   Всё остальное — графит на холодно-сером. Один шрифт (Onest), цифры табличные. */
:root {
  --canvas: #edeff1;
  --surface: #ffffff;
  --ink: #101418;
  --ink-2: #2c333b;
  --muted: #5b6470;
  --faint: #8a929c;
  --line: #dce0e5;
  --line-soft: #e8ebee;

  --ok: #15803d;      --ok-bg: #e7f4ec;
  --act: #a35207;     --act-bg: #fbf0e1;   --act-line: #f0d2a8;
  --off: #6b7280;     --off-bg: #eef0f2;
  --bad: #b42318;

  --focus: #2949e6;
  --r: 12px; --r-sm: 8px;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(16, 20, 24, .06), 0 8px 24px -12px rgba(16, 20, 24, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--canvas);
       -webkit-font-smoothing: antialiased; }
/* Табличные цифры только там, где числа стоят столбиком: в логинах «1» иначе с дырой. */
.table td, .check-when, .acc-cell, .ledger-head { font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ── Верхняя панель ─────────────────────────────────────────── */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.01em;
         text-decoration: none; color: var(--ink); }
.brand-mark { width: 24px; height: 24px; color: var(--ink); }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; padding: 8px 12px; border-radius: var(--r-sm); }
.nav a:hover { color: var(--ink); background: var(--canvas); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--canvas); }
.bar-me { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; }
.bar-ws { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--muted); cursor: pointer; text-decoration: underline;
            text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

/* ── Страница ───────────────────────────────────────────────── */
.page { max-width: 1120px; margin: 0 auto; padding: 40px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
h1 { font-size: 32px; line-height: 1.15; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 18px; letter-spacing: -.01em; margin: 0 0 14px; font-weight: 600; }
.lead { color: var(--muted); margin: 8px 0 0; max-width: 62ch; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px;
        margin-bottom: 20px; }
.back:hover { color: var(--ink); }

/* ── Кнопки ─────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
       border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: 15px; cursor: pointer;
       text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--faint); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--line); }
.btn-danger:hover { border-color: var(--bad); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: progress; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }

/* ── Реестр кабинетов ───────────────────────────────────────── */
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.ledger-head, .acc { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, .9fr) minmax(0, .8fr) 24px;
                     gap: 20px; align-items: center; padding: 0 22px 0 26px; }
.ledger-head { height: 40px; font-size: 13px; color: var(--faint); border-bottom: 1px solid var(--line-soft); }
.acc { position: relative; min-height: 76px; padding-top: 14px; padding-bottom: 14px; text-decoration: none; color: inherit;
       border-bottom: 1px solid var(--line-soft); transition: background .12s; }
.acc:last-child { border-bottom: 0; }
.acc:hover { background: #f7f8f9; }
.acc::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 3px 3px 0; background: var(--line); }
.acc.h-ok::before { background: var(--ok); }
.acc.h-action::before { background: var(--act); }
.acc.h-off::before { background: var(--off); opacity: .5; }
.acc.h-off { color: var(--muted); }
.acc-login { font-weight: 600; font-size: 17px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub { color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-cell { font-size: 14px; color: var(--ink-2); min-width: 0; }
.acc-cell .muted { color: var(--faint); }
.acc-todo { grid-column: 1 / -1; margin-top: 2px; font-size: 14px; color: var(--act); }
.chev { width: 20px; height: 20px; color: var(--faint); }

.state { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.state.ok { color: var(--ok); } .state.action { color: var(--act); } .state.off { color: var(--off); } .state.pending { color: var(--faint); }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 48px 32px; text-align: center; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 auto 24px; }

/* ── Кабинет ────────────────────────────────────────────────── */
.verdict { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -.025em; font-weight: 700; margin: 0; max-width: 22ch; }
.verdict .who { color: var(--ink); }
.verdict.ok .tail { color: var(--ok); } .verdict.action .tail { color: var(--act); } .verdict.off .tail { color: var(--off); }
.verdict-sub { color: var(--muted); margin: 12px 0 0; font-size: 16px; }
.acc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.acc-actions .sep { flex: 1; }

.todo { margin-top: 28px; background: var(--act-bg); border: 1px solid var(--act-line); border-radius: var(--r); padding: 20px 22px; }
.todo-title { font-weight: 600; color: #6b3604; margin: 0 0 6px; }
.todo p { margin: 0; color: #4a2a08; max-width: 70ch; }
.todo .btn { margin-top: 14px; }

.section { margin-top: 40px; }
.checks { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.check { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 20px; align-items: baseline; padding: 16px 22px;
         border-bottom: 1px solid var(--line-soft); }
.check:last-child { border-bottom: 0; }
.check-name { color: var(--muted); font-size: 14px; }
.check-val { font-size: 15px; }
.check-val small { display: block; color: var(--faint); font-size: 13px; margin-top: 2px; }
.check-when { color: var(--faint); font-size: 13px; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
         overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--faint); font-size: 13px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table .dim td { color: var(--faint); }
.table-wrap { overflow-x: auto; }

details.journal { margin-top: 40px; }
details.journal summary { cursor: pointer; color: var(--muted); font-weight: 500; padding: 8px 0; }
details.journal summary:hover { color: var(--ink); }
.journal .bad { color: var(--bad); }

/* ── Вход ───────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-pitch { background: var(--ink); color: #e7eaee; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-pitch .brand { color: #fff; }
.auth-pitch .brand-mark { color: #fff; }
.auth-pitch .brand-mark path { stroke: var(--ink); }
.pitch { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.025em; font-weight: 700; color: #fff; max-width: 16ch; margin: 0; }
.pitch-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; color: #b9c0c9; max-width: 44ch; }
.pitch-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.pitch-list svg { width: 18px; height: 18px; margin-top: 3px; color: #7fd1a0; }
.auth-foot { color: #7d8692; font-size: 13px; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 380px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #e2e5e9; border-radius: 10px; padding: 4px; margin-bottom: 28px; }
.tabs button { min-height: 40px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16,20,24,.1); }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.input { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
         font: inherit; font-size: 16px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(41, 73, 230, .15); }
.form-error { color: var(--bad); font-size: 14px; min-height: 20px; margin: 4px 0 12px; }
.auth-form .btn { width: 100%; }

/* ── Настройки ──────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .input { flex: 1; min-width: 220px; }
.key-once { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--ok-bg); border: 1px solid #bfe3cc; }
.key-once code { display: block; margin-top: 8px; word-break: break-all; font-size: 14px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; max-width: 70ch; }

/* ── Уведомление ────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px;
         border-radius: 10px; font-size: 14px; box-shadow: 0 12px 30px -10px rgba(16,20,24,.5); z-index: 50; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); }

.skeleton { height: 76px; background: linear-gradient(90deg, #f1f3f5, #f7f8f9, #f1f3f5); background-size: 200% 100%;
            animation: shimmer 1.2s infinite; border-bottom: 1px solid var(--line-soft); }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Узкие экраны ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-pitch { padding: 32px 24px; gap: 28px; }
  .auth-foot { display: none; }
}
@media (max-width: 760px) {
  .bar-in { gap: 14px; padding: 0 16px; }
  .bar-ws { display: none; }
  .page { padding: 28px 16px 64px; }
  h1 { font-size: 26px; }
  .ledger-head { display: none; }
  .acc { grid-template-columns: minmax(0, 1fr) 24px; gap: 4px 12px; padding: 14px 16px 14px 20px; }
  .acc .acc-cell { grid-column: 1; }
  .acc .chev { grid-row: 1; grid-column: 2; }
  .check { grid-template-columns: 1fr; gap: 2px; }
  .acc-actions .sep { display: none; }
}
