/* Платформа Гудстафф — стили. Цвета, шрифты и размеры — из DOCS/design/02-dizain-sistema.md и макетов в Claude Design.
   Встроенных стилей в разметке нет (защита CSP), всё — классами отсюда. */

/* ---------- Цвета ---------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0C0B0A;
  --panel: #100F0D;
  --surface: #151311;
  --surface-2: #1B1815;
  --surface-3: #221E1A;
  --scrollbar: #4A433D;
  --scrollbar-hover: #6A615A;
  --menu: #1B1815;
  --border: #2A2622;
  --border-soft: #1E1B18;
  --border-strong: #3D3732;
  --text: #F5F2EE;
  --muted: #A8A199;
  --faint: #8C857D;
  --accent: #FF6A1A;
  --accent-text: #0C0B0A;
  --accent-soft: #2A170C;
  --sel-border: #FF6A1A;
  --link: #FF8A4C;
  --input-bg: #100F0D;
  --focus: #FF6A1A;
  --focus-ring: #45230F;
  --ok: #7BD88F;
  --warn: #FFC24D;
  --warn-text: #FFC24D;
  --off: #5C5650;
  --danger: #FF6B8A;
  --danger-border: #5A2433;
  --danger-ring: #3A1520;
  --ghost: #1C1916;
  --shadow: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F4F1;
  --panel: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F8F6F3;
  --surface-3: #F0EDE8;
  --scrollbar: #BDB5AB;
  --scrollbar-hover: #9C948A;
  --menu: #FFFFFF;
  --border: #E4DFD8;
  --border-soft: #EEEAE4;
  --border-strong: #CEC7BE;
  --text: #141210;
  --muted: #5C554E;
  --faint: #6E675F;
  --accent: #FF6A1A;
  --accent-text: #141210;
  --accent-soft: #FFF1E8;
  --sel-border: #141210;
  --link: #B8430A;
  --input-bg: #FFFFFF;
  --focus: #141210;
  --focus-ring: #FFD3B8;
  --ok: #2F8A44;
  --warn: #B7791F;
  --warn-text: #8A5A00;
  --off: #A39C94;
  --danger: #C0123C;
  --danger-border: #F3C2CD;
  --danger-ring: #FBE3E8;
  --ghost: #ECE7E0;
  --shadow: rgba(20, 18, 16, 0.16);
}

:root {
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Unbounded', 'Onest', sans-serif;
  --radius: 6px;
  --radius-lg: 8px;
}

/* ---------- Переходы между страницами ----------
   Страницы обычные, серверные; браузер сам плавно меняет одну на другую (View Transitions).
   Шапка, надпись на фоне и меню слева помечены именами — они стоят на месте, меняется только середина.
   Браузер без поддержки просто открывает страницу как раньше. */
@view-transition { navigation: auto; }
.auth__top { view-transition-name: auth-top; }
.auth__ghost { view-transition-name: auth-ghost; }
.side { view-transition-name: app-side; }
::view-transition-old(root) { animation: vt-fade-out 120ms ease-in both; }
::view-transition-new(root) { animation: vt-fade-in 200ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
::view-transition-group(*) { animation-duration: 200ms; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(6px); } }
/* Смена темы (app.js, applyTheme): страница целиком, одним снимком, без сдвигов. Новая тема проявляется поверх
   старой, а старая остаётся непрозрачной под ней — так в середине нет провала яркости. */
html.theme-switching * { view-transition-name: none; }
html.theme-switching::view-transition-old(root) { animation: none; }
html.theme-switching::view-transition-new(root) { animation: vt-theme-in 0.4s ease both; }
@keyframes vt-theme-in { from { opacity: 0; } }
/* Браузер без плавных переходов: плавно меняются цвета. */
html.theme-fade, html.theme-fade * {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease !important;
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* Фон и на html: пока грузится новая страница, под ней тот же цвет, а не белый. */
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--link); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Полосы прокрутки — тонкие, в цветах темы, без стрелок: у страницы, таблиц и списков.
   Chrome, Edge, Яндекс Браузер и Safari рисуют по ::-webkit-scrollbar (стандартные свойства в Chrome оставляют
   стрелки и отключают эти правила, поэтому их здесь нет). Firefox — по стандартным свойствам. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--scrollbar) padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-hover); }
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--scrollbar) transparent; }
  * { scrollbar-width: thin; }
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.nums { font-variant-numeric: tabular-nums; }
.danger-text { color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- Знак компании ---------- */
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__name { font-family: var(--display); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.brand__sub { font-size: 14px; color: var(--muted); font-weight: 400; }

/* ---------- Экраны входа ---------- */
.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.auth__top {
  padding: 28px 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.auth__main {
  flex: 1;
  padding: 48px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth__box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.auth__box--wide { max-width: 460px; }
/* Надпись на фоне — как в макете на любой ширине: в макете 1440 точек шрифт 208 (14,44% ширины), отступ 32 (2,22%),
   слово уходит за правый край. Размеры от ширины экрана, а не в точках: на широком мониторе слово не обрывается
   посередине. */
.auth__ghost {
  padding: 0 2.222vw;
  font-family: var(--display);
  font-size: clamp(56px, 14.444vw, 560px);
  line-height: 0.78;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ghost);
  white-space: nowrap;
  margin-bottom: -0.0865em;
  user-select: none;
}
.auth h1 { font-family: var(--display); font-size: 40px; line-height: 1.05; font-weight: 600; letter-spacing: -0.01em; }
.auth__lead { font-size: 16px; color: var(--muted); margin-top: -8px; }
.back {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back:hover { color: var(--text); text-decoration: none; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 14px; font-weight: 600; }
.field__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field__hint { font-size: 13px; color: var(--muted); }
.field__error { font-size: 13px; color: var(--danger); }
.input {
  height: 48px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 16px;
  background: var(--input-bg);
  color: var(--text);
}
.input--sm { height: 34px; font-size: 14px; padding: 0 10px; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.input--error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-ring); }
.input::placeholder { color: var(--faint); }
.password {
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 6px 0 14px;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.password:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.password--error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-ring); }
.password input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 16px; background: transparent; }
/* Глазик в поле пароля: открытый — пароль скрыт, перечёркнутый — пароль виден */
.password__eye {
  width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.password__eye:hover { color: var(--text); background: var(--surface-3); }
.password__eye-off { display: none; }
.password__eye[aria-pressed="true"] .password__eye-open { display: none; }
.password__eye[aria-pressed="true"] .password__eye-off { display: inline; }
/* Под паролем: слева галочка, справа «Забыли пароль?» */
.login-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.search {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 14px; background: transparent; color: var(--text); }

/* Выпадающий список: обычный <select> в обёртке .select со стрелкой (partials/icon.html, chevron) — работает
   с клавиатуры, с читалками экрана, на телефоне открывается системный выбор. Закрытый список — по дизайн-системе
   везде. Открытый — тоже, где браузер умеет настраиваемые списки (Chrome, Edge, Яндекс Браузер); в остальных
   открывается системный, в цветах темы. */
.select { position: relative; display: inline-flex; align-items: center; width: 280px; max-width: 100%; }
.select select {
  appearance: none;
  width: 100%;
  height: 34px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.select select:hover { border-color: var(--border-strong); }
.select select:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.select > svg { position: absolute; right: 10px; color: var(--faint); pointer-events: none; transition: transform 0.15s ease; }
.select option { background: var(--surface-2); color: var(--text); }
@supports (appearance: base-select) {
  .select select, .select select::picker(select) { appearance: base-select; }
  /* В этом режиме список — строка flex; без выравнивания текст прижимается к верху */
  .select select { align-items: center; }
  .select select::picker-icon { display: none; }
  .select:has(select:open) > svg { transform: rotate(180deg); }
  .select select::picker(select) {
    margin-block: 4px;
    padding: 4px;
    max-height: 340px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--menu);
    color: var(--text);
    box-shadow: 0 12px 32px var(--shadow);
    transition: opacity 0.15s ease, translate 0.15s ease, overlay 0.15s allow-discrete, display 0.15s allow-discrete;
  }
  /* Полоса прокрутки списка — как у страницы: общие правила ::-webkit-scrollbar сюда не доходят */
  .select select::picker(select)::-webkit-scrollbar { width: 10px; }
  .select select::picker(select)::-webkit-scrollbar-track { background: transparent; }
  .select select::picker(select)::-webkit-scrollbar-button { display: none; }
  .select select::picker(select)::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--scrollbar) padding-box;
  }
  .select select::picker(select)::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-hover); }
  .select select:not(:open)::picker(select) { opacity: 0; translate: 0 -4px; }
  @starting-style {
    .select select:open::picker(select) { opacity: 0; translate: 0 -4px; }
  }
  .select option {
    gap: 12px;
    padding: 7px 10px;
    border-radius: 4px;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
  }
  .select option:hover, .select option:focus-visible { background: var(--surface-3); outline: none; }
  .select option:checked { font-weight: 600; }
  /* Галочка у выбранного — справа, цветом акцента; рисунок тот же, что у галочек в формах (icon.html, check) */
  .select option::checkmark {
    order: 1;
    flex: none;
    width: 14px;
    height: 14px;
    margin-inline-start: auto;
    content: "";
    background: var(--accent);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='square'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  }
}
@media (prefers-reduced-motion: reduce) {
  .select > svg, .select select::picker(select) { transition: none; }
}

/* Выбор нескольких пунктов (фильтр журнала): кнопка как у списка, под ней панель с галочками (popover). Панель не
   закрывается после выбора; выбор уходит формой по её кнопке. Закрывается щелчком мимо или Esc.
   Под кнопкой панель держит привязка CSS (anchor); где браузер её не знает — app.js ставит панель сам. */
.multi { position: relative; width: 280px; max-width: 100%; anchor-scope: --multi; }
.multi__button {
  anchor-name: --multi;
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.multi__button > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi__button > svg { color: var(--faint); transition: transform 0.15s ease; }
.multi__button:hover { border-color: var(--border-strong); }
.multi__button:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.multi:has(.multi__panel:popover-open) .multi__button { border-color: var(--border-strong); }
.multi:has(.multi__panel:popover-open) .multi__button > svg { transform: rotate(180deg); }
.multi__panel {
  position-anchor: --multi;
  position-area: block-end span-inline-end;
  position-try-fallbacks: flip-block;
  inset: auto;
  margin: 4px 0;
  min-width: anchor-size(width);
  width: max-content;
  max-width: min(420px, calc(100vw - 32px));
  max-height: min(420px, 60vh);
  overflow: hidden auto;
  scrollbar-gutter: stable;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--menu);
  color: var(--text);
  box-shadow: 0 12px 32px var(--shadow);
  transition: opacity 0.15s ease, translate 0.15s ease, overlay 0.15s allow-discrete, display 0.15s allow-discrete;
}
.multi__panel:not(:popover-open) { opacity: 0; translate: 0 -4px; }
@starting-style {
  .multi__panel:popover-open { opacity: 0; translate: 0 -4px; }
}
.multi__group {
  margin-top: 4px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.multi__option {
  gap: 10px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
}
.multi__option:hover, .multi__option:has(input:focus-visible) { background: var(--surface-3); }
.multi__option input:focus-visible + .check__box { outline: none; }
.multi__option .check__box { width: 16px; height: 16px; }
.multi__option .check__box svg { width: 11px; height: 11px; }
.multi__option:has(input:checked) { font-weight: 600; }
.multi__footer { display: none; }
@media (prefers-reduced-motion: reduce) {
  .multi__button > svg, .multi__panel { transition: none; }
}

/* Над таблицей, когда стоят фильтры: сколько нашлось и как сбросить */
.results { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; font-size: 14px; color: var(--muted); }

/* Полоска надёжности пароля: 4 деления, как на макете */
.meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.meter span { height: 4px; border-radius: 2px; background: var(--border-strong); transition: background-color 0.15s ease; }
[data-theme="light"] .meter span { background: var(--border); }
.meter[data-level="1"] span:nth-child(-n + 1) { background: var(--danger); }
.meter[data-level="2"] span:nth-child(-n + 2) { background: var(--warn); }
.meter[data-level="3"] span:nth-child(-n + 3) { background: var(--ok); }
.meter[data-level="4"] span { background: var(--ok); }

/* Галочка */
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--muted); cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 20px; height: 20px; border-radius: 4px; border: 1.5px solid var(--border-strong);
  background: var(--input-bg); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.check__box svg { visibility: hidden; }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box svg { visibility: visible; }
.check input:focus-visible + .check__box { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Клетки кода */
.code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.code__cell {
  height: 60px; min-width: 0; text-align: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-family: var(--display); font-size: 26px; font-weight: 600;
  background: var(--input-bg); color: var(--text);
}
.code__cell:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.code--error .code__cell { border-color: var(--danger); }
.code-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }

/* Плитки выбора (роль) и плитки-галочки (магазины) */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile {
  position: relative;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: transparent;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile__dot {
  width: 18px; height: 18px; border-radius: 9px; border: 1.5px solid var(--border-strong); flex: none; margin-top: 1px;
}
.tile__text { display: flex; flex-direction: column; gap: 3px; }
.tile__name { font-size: 15px; font-weight: 600; }
.tile__hint { font-size: 13px; color: var(--muted); }
.tile:has(input:checked) { border-color: var(--sel-border); background: var(--accent-soft); }
.tile:has(input:checked) .tile__dot { border: 5px solid var(--accent); }
.tile:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.tile--box { height: 52px; padding: 0 14px; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; }
.tile--box .check__box { width: 20px; height: 20px; }
.tile--box:has(input:checked) .check__box { background: var(--accent); border-color: var(--accent); }
.tile--box:has(input:checked) .check__box svg { visibility: visible; }

/* Общая роль видит все магазины — выбор магазинов не нужен */
.role-form:has(.tile--global input:checked) [data-stores] { display: none; }

/* Переключатель из двух-трёх кнопок (тема) */
.segmented { display: inline-flex; align-self: flex-start; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.segmented button {
  height: 40px; min-width: 104px; padding: 0 16px; border: 0; border-right: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 15px; font-weight: 500; cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--link); font-weight: 700; }

/* ---------- Кнопки ---------- */
.btn {
  height: 46px;
  padding: 0 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, filter 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: var(--accent-text); }
.btn--primary:hover { filter: brightness(1.06); }
.btn--wide { width: 100%; justify-content: space-between; padding: 0 18px; height: 48px; font-size: 16px; }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border-strong); font-weight: 600; }
.btn--secondary:hover { background: var(--surface-3); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger-border); font-weight: 600; }
.btn--sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn--xs { height: 34px; padding: 0 12px; font-size: 14px; }
.btn--link { background: transparent; border: 0; padding: 0; height: auto; color: var(--link); font-weight: 600; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--border); padding-top: 20px; }
.inline-form { display: inline; margin: 0; }

/* ---------- Сообщения ---------- */
.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.alert--error { border-color: var(--danger-border); color: var(--danger); background: transparent; }
.alert--success .dot { background: var(--ok); }
.alert--warning .dot { background: var(--warn); }
.alert .dot { margin-top: 6px; }
.messages { display: flex; flex-direction: column; gap: 8px; }

/* Точка состояния */
.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; display: inline-block; background: var(--off); }
.dot--ok { background: var(--ok); }
.dot--warn { background: var(--warn); }
.dot--off { background: var(--off); }
.dot--danger { background: var(--danger); }
.dot--accent { background: var(--accent); }
.state { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ---------- Приложение: меню слева ---------- */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side {
  flex: 1 1 232px;
  max-width: 100%;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.side__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 0 2px 0 10px; }
.side__brand { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.side__brand .brand__sub { font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  height: 36px;
  border-radius: var(--radius);
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav__item:hover { color: var(--text); text-decoration: none; background: var(--surface-3); }
.nav__item--active { color: var(--text); font-weight: 600; background: var(--surface-3); }
.nav__item--active::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
/* Кнопка-значок. Переключатель темы показывает действие: в тёмной теме солнце (включить светлую), в светлой луна
   (Кирилл, 03.11.2026). */
.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); }
.theme-toggle svg { position: absolute; transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
.theme-toggle__sun { opacity: 1; transform: none; }
.theme-toggle__moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="light"] .theme-toggle__sun { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .theme-toggle__moon { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .theme-toggle svg { transition: none; } }
/* Блок «кто вошёл»: ведёт в профиль — при наведении подсвечивается, как пункт меню, и показывает стрелку. */
.me { border-top: 1px solid var(--border); padding: 10px 0 0; display: flex; align-items: center; gap: 4px; }
.me__link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 400;
  transition: background-color 0.15s ease;
}
.me__link:hover { background: var(--surface-3); text-decoration: none; }
.me__link--active { background: var(--surface-3); }
.me__info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.me__name, .me__role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me__name { font-size: 13px; font-weight: 600; }
.me__role { font-size: 12px; color: var(--muted); }
.me__chevron { color: var(--muted); opacity: 0; transform: translateX(-4px); transition: opacity 0.15s ease, transform 0.15s ease; }
.me__link:hover .me__chevron, .me__link--active .me__chevron, .me__link:focus-visible .me__chevron { opacity: 1; transform: none; }
.me__logout {
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--link);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.me__logout:hover { background: var(--surface-3); }
.avatar {
  width: 30px; height: 30px; border-radius: var(--radius); background: var(--surface-3); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none;
}
.avatar--lg { width: 56px; height: 56px; border-radius: var(--radius-lg); font-family: var(--display); font-size: 22px; font-weight: 600; }
.avatar--off { color: var(--faint); }

.page {
  flex: 999 1 560px;
  min-width: 0;
  padding: 30px 36px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page h1 { font-family: var(--display); font-size: 30px; line-height: 1.1; font-weight: 600; }
.title-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* Вкладки */
.tabs { display: flex; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border); }
.tabs__item {
  height: 40px; padding: 0 14px; display: inline-flex; align-items: center;
  border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 400;
}
.tabs__item:hover { color: var(--text); text-decoration: none; }
.tabs__item--active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.tabs__tools { margin-left: auto; padding-bottom: 6px; flex: 0 1 300px; }

/* Карточки-разделы */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.panel--form { width: 100%; max-width: 760px; padding: 26px; gap: 22px; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel h2, .section-title {
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.columns { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.columns > * { flex: 1 1 380px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

/* Подпись — значение */
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv--plain { grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; }

/* Списки строк (устройства, история) */
.list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.list__row {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 15px;
}
.list__row:last-child { border-bottom: 0; }
.list__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history__row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 15px; line-height: 1.4; }

/* Таблицы */
.table-box { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; background: var(--surface); }
.table { min-width: 860px; }
.table__head, .table__row { display: grid; gap: 16px; align-items: center; padding: 10px 16px; }
.table__head {
  border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.table__row { border-bottom: 1px solid var(--border-soft); font-size: 14px; padding-top: 9px; padding-bottom: 9px; }
.table__row:last-child { border-bottom: 0; }
.table__row--off { color: var(--faint); }
.table__empty { padding: 28px 16px; font-size: 14px; color: var(--muted); }
.table--staff .table__head, .table--staff .table__row {
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, 1.4fr);
}
.table--journal .table__head, .table--journal .table__row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.8fr) minmax(0, 1.8fr) minmax(0, 0.9fr);
}
.person { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; font-weight: 400; }
.person:hover { text-decoration: none; }
.person:hover .person__name { color: var(--link); }
/* Строка со ссылкой на человека — подсвечиваем целиком, чтобы было видно, что по ней можно перейти. */
.table__row:has(.person) { transition: background-color 0.15s ease; }
.table__row:has(.person):hover { background: var(--surface-2); }
.person__text { display: flex; flex-direction: column; min-width: 0; }
.person__name { font-weight: 600; }
.person__sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Приглашение отправлено: ссылка */
.link-field { display: flex; gap: 8px; }
.link-field .input { font-size: 14px; height: 44px; }

/* Приложение для кодов */
.qr { width: 200px; height: 200px; border-radius: var(--radius); background: #FFFFFF; padding: 6px; display: flex; align-items: center; justify-content: center; }
.qr svg { width: 100%; height: 100%; }
.secret { font-size: 16px; font-weight: 600; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: 0.04em; }
.step { display: flex; flex-direction: column; gap: 12px; }
.step__title { font-size: 15px; font-weight: 600; }

/* Главная */
.welcome { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.1; }
.store-list { display: flex; flex-wrap: wrap; gap: 10px; }
.store-chip {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 10px 14px; font-weight: 600; font-size: 15px;
}

/* Страница ошибки */
.error-code { font-family: var(--display); font-size: 72px; font-weight: 700; color: var(--accent); line-height: 1; }

/* Листание */
.pager { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); }

/* ---------- Телефон: колонки встают друг под друга ---------- */
@media (max-width: 760px) {
  .auth__top { padding: 18px 16px 0; }
  .auth__main { padding: 32px 16px 16px; }
  .auth h1 { font-size: 32px; }
  .page { padding: 22px 16px 28px; }
  .page h1, .welcome { font-size: 24px; }
  .tiles, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .brand__sub { display: none; }
  .tabs__tools { flex-basis: 100%; margin-left: 0; padding-top: 8px; }
  .panel--form { padding: 18px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .history__row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .select, .multi, .row > .search { width: 100%; }
  .multi__footer {
    display: block;
    position: sticky;
    bottom: -4px;
    margin: 4px -4px -4px;
    padding: 8px;
    border-top: 1px solid var(--border);
    background: var(--menu);
  }

  /* Меню: сверху строка «знак — тема — аватар», под ней пункты в ряд */
  .app { flex-direction: column; }
  .side {
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 8px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .side__top { flex: 1; align-items: center; padding: 0; }
  .side__brand { padding: 0; }
  .side > .spacer { display: none; }
  .me { order: 2; border-top: 0; padding: 0; gap: 2px; }
  .me__link { padding: 3px; }
  .me__info, .me__chevron { display: none; }
  .nav { order: 3; flex-basis: 100%; flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav__item { flex: none; height: 34px; }
  .nav__item--active::after { display: none; }

  /* Таблицы: строка — карточка, без прокрутки вбок */
  .table { min-width: 0; }
  .table__head { display: none; }
  .table--journal .table__row { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 12px 16px; }
  .table--staff .table__row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 16px; }
  .table--staff .table__row > .person { grid-column: 1 / -1; }
  .table--staff .table__row > :nth-child(3), .table--staff .table__row > :nth-child(5) { justify-self: end; text-align: right; }
}
