/* Zomit console — один файл стилей. Токены — только здесь; тёмная тема — по системе
   (prefers-color-scheme) или явно (html[data-theme]). Мобильная ширина — 390px. */
:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #eceef3;
  --text: #16181d;
  --muted: #5d6472;
  --line: #dfe2e8;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  --ok: #1c7c46;
  --ok-bg: #e3f4ea;
  --warn: #9a5b00;
  --warn-bg: #fff1d6;
  --danger: #c0262d;
  --danger-bg: #fde7e8;
  --info-bg: #e7edff;
  --shadow: 0 1px 2px rgba(20, 23, 30, .06), 0 2px 8px rgba(20, 23, 30, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 16px;
  --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f13; --surface: #171a21; --surface-2: #20242d; --text: #eceef3; --muted: #9aa1ae;
    --line: #2a2f3a; --accent: #6d8dff; --accent-text: #0d0f13; --ok: #5fd08e; --ok-bg: #12301f;
    --warn: #f0b457; --warn-bg: #33260f; --danger: #ff6b70; --danger-bg: #3a1417; --info-bg: #1a2446;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f13; --surface: #171a21; --surface-2: #20242d; --text: #eceef3; --muted: #9aa1ae;
  --line: #2a2f3a; --accent: #6d8dff; --accent-text: #0d0f13; --ok: #5fd08e; --ok-bg: #12301f;
  --warn: #f0b457; --warn-bg: #33260f; --danger: #ff6b70; --danger-bg: #3a1417; --info-bg: #1a2446;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 16px; font-weight: 700; }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 12px; font-weight: 650; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 14px; word-break: break-all; }

/* верхняя панель: 56px, логотип слева, меню и выход справа */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .logo { font-weight: 800; font-size: 18px; color: var(--text); }
.topbar .logo small { font-weight: 500; font-size: 13px; color: var(--muted); margin-left: 6px; }
/* пункты меню переносятся на вторую строку: на 390px прокрутка вбок уносила «Выйти» за экран */
.topbar nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: auto; min-width: 0; }
.topbar nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px;
  border-radius: var(--radius-sm); color: var(--muted); font-weight: 550; white-space: nowrap; }
.topbar nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.page { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }
.page.narrow { max-width: 420px; padding-top: 48px; }

/* карточка */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: var(--gap); }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; flex: 1; min-width: 0; }

/* строки списка: вся строка — ссылка или кнопка, высота от 56px */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
/* значения в строке не обрезаются: название переносится по словам, а почта и длинные
   идентификаторы (класс .long) — по буквам. У названия «anywhere» нельзя: в тесной строке плашка с
   кнопкой сжимали его до «Склейк / а / карточе / к» (ревью V6, W1) */
.row .title { font-weight: 600; overflow-wrap: break-word; }
.row .title.long { overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: 14px; }
a.row { color: var(--text); text-decoration: none; }
/* строка аккаунта: название и подпись — своей зоной во всю ширину, плашки и кнопка — под ними
   (иначе на 390px плашки сжимали название до «Ди…») */
.row.stack { flex-wrap: wrap; align-items: flex-start; }
.row.stack .grow { flex: 1 1 100%; }
.row.stack .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 auto; }
a.row::after { content: "›"; color: var(--muted); font-size: 22px; padding-left: 4px; }

/* кнопки: высота 44px (тап-зона), главная — одна на экран */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 16px var(--font);
  cursor: pointer; background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 8px; }
.btn.block { width: 100%; }
/* маленькая кнопка ниже обычной только шрифтом: тап-зона остаётся 44px (ревью V3) */
.btn.small { min-height: var(--tap); font-size: 14px; padding: 0 12px; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions.center { justify-content: center; }
.actions.end { justify-content: flex-end; }
.mt8 { margin-top: 8px; }
/* отступ снизу у главной кнопки экрана: без него «+ Сборщик» и «+ Новый аккаунт» стояли вплотную к
   карточке и полю ниже (ревью W3) */
.mb16 { margin-bottom: var(--gap); }

/* поля: подпись над полем, подсказка под ним, ошибка красным под подсказкой */
.field { margin-bottom: 16px; }
/* :not(.check) — флажок и радиокнопка внутри .field остаются строкой «поле + текст» (ревью V5) */
.field label:not(.check), .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number],
.field input[type=tel], .field input[type=search], .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: 16px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.field textarea { min-height: 88px; resize: vertical; }
.field .unit-wrap { display: flex; align-items: center; gap: 8px; }
.field .unit-wrap input { flex: 1; }
.field .unit { color: var(--muted); min-width: 24px; }
.field .hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.field .error { color: var(--danger); font-size: 14px; margin-top: 6px; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; }
.code-input { font: 600 24px var(--mono); letter-spacing: 6px; text-align: center; }

/* плашка состояния */
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: var(--info-bg); color: var(--accent); }

/* сообщение внутри экрана */
.note { border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; background: var(--info-bg); }
.note.warn { background: var(--warn-bg); color: var(--text); }
.note.danger { background: var(--danger-bg); color: var(--text); }
.note.ok { background: var(--ok-bg); color: var(--text); }

/* состояния загрузки, пусто, ошибка */
.state { text-align: center; padding: 32px 16px; color: var(--muted); }
.state .big { font-size: 17px; color: var(--text); font-weight: 600; margin-bottom: 8px; }
.skeleton { height: 56px; border-radius: var(--radius-sm); margin-bottom: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* сегменты выбора (режим функции, тема) */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--radius-sm); }
.seg button { flex: 1; min-height: var(--tap); border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: 550 15px var(--font); padding: 0 6px; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
/* фокус на выборе, когда вариант ещё не выбран, — тонкая пунктирная рамка вокруг группы или самого
   варианта: широкая сплошная рамка на «Wildberries» читалась как выбранный вариант (ревью W2) */
.seg:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }
.seg button:focus-visible { outline: 1px dashed var(--accent); outline-offset: -3px; }

/* окно поверх страницы: снизу на телефоне, по центру на широком экране */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, .5); display: flex;
  align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
.modal h2 { font-size: 20px; }
.modal .text { white-space: pre-line; margin-bottom: 16px; }
@media (min-width: 600px) { .modal-back { align-items: center; } .modal { border-radius: var(--radius); } }

/* показать один раз: значение моноширинно, кнопка «Скопировать» */
.once { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.once .value { font: 600 16px var(--mono); word-break: break-all; user-select: all; }

/* всплывающее сообщение: снизу по центру, 4 секунды */
.toast-host { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 60; display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 440px; width: 100%; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-weight: 550; }
.toast.danger { background: var(--danger); color: #fff; }

/* переключатель темы внизу страницы — тише основного */
.theme-pick { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.theme-pick .label { display: block; color: var(--muted); font-size: 14px; margin: 0 2px 8px; }
.theme-pick .seg button { font-size: 14px; }

/* функция в карточке «Функции»: название слева, плашка справа; не помещается — плашка уходит
   под название, а не налезает на него (ревью V4) */
.feature { padding: 12px 0; border-top: 1px solid var(--line); }
.feature:first-child { border-top: 0; padding-top: 0; }
.feature .head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feature .title { flex: 1 1 auto; min-width: 0; font-size: 17px; overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.hidden { display: none !important; }
