/* ==========================================================================
   TOP-RUSSIAN-GUNS — дизайн-система
   Направление: «воронёная сталь и латунь».
   Порядок файла: токены → база → раскладка → компоненты → шапка/подвал → утилиты
   ========================================================================== */

/* ---------- 1. Токены ---------- */
:root {
  /* Цвет: светлая тема */
  --bg:          #E9ECEE;   /* холодная бумага */
  --surface:     #FFFFFF;
  --surface-2:   #F3F5F6;
  --surface-3:   #DFE4E8;
  --ink:         #151C23;
  --ink-2:       #46525E;   /* ≥ 7:1 на surface */
  --ink-3:       #5A6672;   /* ≥ 4.5:1 на bg, surface и surface-2, только для второстепенного */
  --line:        #CBD2D8;
  --line-strong: #9AA6B1;

  --steel-950:   #0F161D;
  --steel-900:   #141D27;   /* воронение — шапка, тёмные блоки */
  --steel-800:   #1E2B38;
  --steel-700:   #2C3C4C;

  --brass-300:   #E8C77E;
  --brass-400:   #DDAE55;
  --brass-500:   #D4A040;   /* заливка основной кнопки */
  --brass-700:   #8A5A0B;   /* текст/ссылки латунного цвета на светлом (5.9:1 на белом) */

  --accent:        var(--brass-500);
  --accent-ink:    #141D27;           /* текст на латуни (8:1) */
  --accent-text:   var(--brass-700);  /* ссылки и акцентный текст */
  --link:          #1B5E9E;

  --focus:       #1B6FD0;
  --strong:      var(--steel-900);   /* заливка «тёмных» контролов: кнопка steel, активный чип */

  /* Статусы заявок и системные состояния: фон / текст / рамка */
  --st-new-bg:   #E3EEF9;  --st-new-fg:   #174F85;  --st-new-bd:   #A9C6E4;
  --st-work-bg:  #FBEFD2;  --st-work-fg:  #7A4F06;  --st-work-bd:  #E5C98A;
  --st-done-bg:  #DFF1E5;  --st-done-fg:  #1B5E38;  --st-done-bd:  #9ED0B1;
  --st-fail-bg:  #F8E1E1;  --st-fail-fg:  #9A2227;  --st-fail-bd:  #E3A9AB;
  --st-off-bg:   #E7EAED;  --st-off-fg:   #46525E;  --st-off-bd:   #BFC7CF;

  --danger:      #B3262B;
  --success:     #1F6B3F;

  /* Типографика */
  --font-display: 'Fira Sans Extra Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --font-body:    'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  --fs-xs:   0.8125rem;                          /* 13 */
  --fs-sm:   0.9375rem;                          /* 15 */
  --fs-base: 1rem;                               /* 16 */
  --fs-md:   1.125rem;                           /* 18 */
  --fs-lg:   1.375rem;                           /* 22 */
  --fs-xl:   clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-2xl:  clamp(2.25rem, 1.5rem + 3.4vw, 4rem);
  --fs-3xl:  clamp(2.75rem, 1.6rem + 5.4vw, 5.5rem);

  --lh-tight: 1.08;
  --lh-snug:  1.3;
  --lh-body:  1.55;

  /* Отступы: шаг 4px */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4.5rem;  --s-9: 6rem;

  /* Радиусы: у кнопок и полей меньше, чем у карточек — иерархия, а не один радиус на всё */
  --r-sm:   4px;
  --r-ctl:  6px;
  --r-card: 12px;
  --r-pill: 999px;

  /* Тени: границы несут основную работу, тени — только для всплывающих слоёв */
  --sh-1:   0 1px 0 rgb(20 29 39 / .05);
  --sh-2:   0 2px 8px rgb(20 29 39 / .10);
  --sh-pop: 0 18px 44px rgb(15 22 29 / .28);

  --tap: 44px;                 /* минимальная тап-зона */
  --wrap: 1200px;
  --header-h: 60px;

  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
}

/* Тёмная тема: по системе, если не выбрана явно; явный выбор — атрибут data-theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0E1419;
    --surface:     #171F27;
    --surface-2:   #1E2832;
    --surface-3:   #2A3642;
    --ink:         #E8EDF1;
    --ink-2:       #AAB6C1;
    --ink-3:       #8795A2;
    --line:        #2C3946;
    --line-strong: #4A5B6B;
    --accent-text: #E3B866;
    --link:        #7DB6EC;
    --focus:       #7DB6EC;
    --strong:      #33475A;
    --st-new-bg:   #17314C;  --st-new-fg:   #A9CDF3;  --st-new-bd:   #2E5B8A;
    --st-work-bg:  #3B2D10;  --st-work-fg:  #F0CF8A;  --st-work-bd:  #6E5420;
    --st-done-bg:  #153524;  --st-done-fg:  #9EDDB5;  --st-done-bd:  #2B6544;
    --st-fail-bg:  #402022;  --st-fail-fg:  #F2AEB0;  --st-fail-bd:  #7A3A3D;
    --st-off-bg:   #26313B;  --st-off-fg:   #AAB6C1;  --st-off-bd:   #44535F;
    --danger:      #F08A8E;
    --success:     #7FD3A0;
    --sh-1:        none;
    --sh-2:        0 2px 10px rgb(0 0 0 / .4);
    --sh-pop:      0 18px 44px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:          #0E1419;
  --surface:     #171F27;
  --surface-2:   #1E2832;
  --surface-3:   #2A3642;
  --ink:         #E8EDF1;
  --ink-2:       #AAB6C1;
  --ink-3:       #8795A2;
  --line:        #2C3946;
  --line-strong: #4A5B6B;
  --accent-text: #E3B866;
  --link:        #7DB6EC;
  --focus:       #7DB6EC;
  --strong:      #33475A;
  --st-new-bg:   #17314C;  --st-new-fg:   #A9CDF3;  --st-new-bd:   #2E5B8A;
  --st-work-bg:  #3B2D10;  --st-work-fg:  #F0CF8A;  --st-work-bd:  #6E5420;
  --st-done-bg:  #153524;  --st-done-fg:  #9EDDB5;  --st-done-bd:  #2B6544;
  --st-fail-bg:  #402022;  --st-fail-fg:  #F2AEB0;  --st-fail-bd:  #7A3A3D;
  --st-off-bg:   #26313B;  --st-off-fg:   #AAB6C1;  --st-off-bd:   #44535F;
  --danger:      #F08A8E;
  --success:     #7FD3A0;
  --sh-1:        none;
  --sh-2:        0 2px 10px rgb(0 0 0 / .4);
  --sh-pop:      0 18px 44px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* ---------- 2. База ---------- */
/* Базовые стили привязаны к .app, чтобы не конфликтовать с прежними страницами на Tailwind. */
.app, .app *, .app *::before, .app *::after { box-sizing: border-box; }

.app {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

.app :focus { outline: none; }
.app :focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Минимальный сброс браузерных стилей (специфичность нулевая, компоненты ниже его перекрывают) */
:where(.app) :where(h1, h2, h3, h4, h5, h6, p, figure, dl, dd, blockquote, pre, fieldset) { margin: 0; }
:where(.app) :where(h1, h2, h3, h4, h5, h6) { font-size: inherit; font-weight: inherit; }
:where(.app) :where(ul, ol) { margin: 0; padding: 0; list-style: none; }
:where(.app) :where(img, svg, video, canvas) { display: block; vertical-align: middle; }
:where(.app) :where(button, input, select, textarea) { font: inherit; color: inherit; margin: 0; }
:where(.app) :where(button) { background: none; border: 0; padding: 0; cursor: pointer; }
:where(.app) :where(table) { border-collapse: collapse; }
:where(.app) :where(hr) { border: 0; border-top: 1px solid var(--line); margin: 0; }
:where(.app) :where(summary) { cursor: pointer; }

.app img, .app svg, .app video { max-width: 100%; }
.app img { height: auto; }

.app a { color: var(--link); text-underline-offset: .18em; }
.app a:hover { text-decoration-thickness: 2px; }
/* Подчёркнуты только ссылки внутри текста; навигация и компоненты без подчёркивания */
.app a[class], .crumbs a, .footer a, .nav-desktop a, .drawer-links a, .menu__list a, .auth__links a { text-decoration: none; }
.app a[class]:hover, .crumbs a:hover, .footer a:hover { text-decoration: underline; }
.app a.btn:hover, .app a.chip:hover, .app a.brand:hover, .app a.rcard:hover, .app a.crow:hover, .app a.kpi:hover { text-decoration: none; }

.app ::selection { background: var(--brass-400); color: var(--steel-900); }

.skip-link {
  position: absolute; left: var(--s-3); top: -100px; z-index: 1000;
  background: var(--accent); color: var(--accent-ink); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-ctl); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s-3); }

/* Заголовки: узкий гротеск, без капслока */
.h1, .h2, .h3, .h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: .005em;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
.h1 { font-size: var(--fs-2xl); }
.h2 { font-size: var(--fs-xl); }
.h3 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
.h4 { font-size: var(--fs-md); line-height: var(--lh-snug); }
.display { font-size: var(--fs-3xl); }

.lead   { font-size: var(--fs-md); color: var(--ink-2); max-width: 60ch; }
.muted  { color: var(--ink-2); }
.small  { font-size: var(--fs-sm); }
.tiny   { font-size: var(--fs-xs); color: var(--ink-3); }
.prose  { max-width: 70ch; }
.prose > * + * { margin-top: var(--s-4); }

/* ---------- 3. Раскладка ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left));
}
@media (min-width: 768px) { .wrap { padding-inline: var(--s-6); } }

.main { flex: 1 0 auto; padding-block: var(--s-5) var(--s-8); }
@media (min-width: 768px) { .main { padding-block: var(--s-6) var(--s-9); } }

.main--flush { padding-block: 0; }

.section { padding-block: var(--s-7); }
@media (min-width: 768px) { .section { padding-block: var(--s-8); } }
.section--tight { padding-block: var(--s-6); }

.stack > * + * { margin-top: var(--stack, var(--s-4)); }
.stack--lg { --stack: var(--s-6); }
.stack--sm { --stack: var(--s-2); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s-3)); }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--nowrap { flex-wrap: nowrap; }

.grid { display: grid; gap: var(--gap, var(--s-4)); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s-3) var(--s-5); margin-bottom: var(--s-5);
}
.page-head__sub { color: var(--ink-2); margin: var(--s-2) 0 0; max-width: 60ch; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 4. Кнопки ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-5);
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1.5px solid var(--btn-bd); border-radius: var(--r-ctl);
  font: 600 var(--fs-base)/1 var(--font-body);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .08s var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.app a.btn { color: var(--btn-fg); text-decoration: none; }
.btn:hover { --btn-bg: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-bd: var(--accent); }
.btn--primary:hover { --btn-bg: var(--brass-400); --btn-bd: var(--brass-400); }
.btn--steel { --btn-bg: var(--strong); --btn-fg: #fff; --btn-bd: var(--strong); }
.btn--steel:hover { --btn-bg: var(--steel-700); --btn-bd: var(--steel-700); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn--ghost:hover { --btn-bg: var(--surface-3); }
.btn--danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: var(--danger); }
.btn--danger:hover { --btn-bg: var(--st-fail-bg); }
.btn--lg { min-height: 56px; padding: 0 var(--s-6); font-size: var(--fs-md); }
.btn--sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--tap); }
.btn--icon.btn--sm { width: 36px; }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- 5. Формы ---------- */
.field { display: block; }
.field + .field, .field + .row, .row + .field { margin-top: var(--s-4); }
.label {
  display: block; margin-bottom: var(--s-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
}
.label .opt { font-weight: 400; color: var(--ink-3); }

.input, .select, .textarea,
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="tel"], .field input[type="number"], .field input[type="search"],
.field select, .field textarea {
  display: block; width: 100%; min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-ctl);
  font: 400 1rem/1.4 var(--font-body);   /* 16px — iOS не увеличивает страницу при фокусе */
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  appearance: none; -webkit-appearance: none;
}
.textarea, .field textarea { min-height: 7.5rem; resize: vertical; }
.select, .field select {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366727E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .9rem center;
}
.input::placeholder, .textarea::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible,
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
  border-radius: var(--r-ctl);
}
.is-invalid, .field.has-error input, .field.has-error select, .field.has-error textarea {
  border-color: var(--danger) !important;
}
.hint  { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--ink-3); }
.error { margin: var(--s-2) 0 0; font-size: var(--fs-sm); color: var(--danger); font-weight: 500; }
.error::before { content: "Ошибка: "; font-weight: 600; }
.form-error {
  padding: var(--s-3) var(--s-4); border-radius: var(--r-ctl); margin-bottom: var(--s-4);
  background: var(--st-fail-bg); color: var(--st-fail-fg); border: 1px solid var(--st-fail-bd);
}

/* Поле пароля с кнопкой «показать» */
.input-group { position: relative; }
.input-group .input, .input-group input { padding-right: 3.25rem; }
.input-group__btn {
  position: absolute; top: 0; right: 0; width: var(--tap); height: 100%; min-height: var(--tap);
  display: grid; place-items: center; background: none; border: 0; cursor: pointer; color: var(--ink-2);
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
}
.input-group__btn:hover { color: var(--ink); }

/* Сегментный переключатель (способ связи и т. п.) */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; gap: 3px; background: var(--surface-3); border-radius: var(--r-ctl);
}
.seg__opt { position: relative; }
.seg__opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.seg__opt span {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-3);
  border-radius: calc(var(--r-ctl) - 2px); font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2);
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.seg__opt input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--sh-2); }
.seg__opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }

/* Чекбокс и переключатель */
.check { display: flex; gap: var(--s-3); align-items: flex-start; min-height: var(--tap); padding-block: var(--s-2); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--steel-800); flex: none; }
:root[data-theme="dark"] .check input { accent-color: var(--brass-500); }

/* ---------- 6. Карточки, бейджи, чипы ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--sh-1);
}
.card__body { padding: var(--s-4); }
@media (min-width: 768px) { .card__body { padding: var(--s-5); } }
.card--flat { background: var(--surface-2); box-shadow: none; }
.card--steel { background: var(--steel-900); border-color: var(--steel-800); color: #E8EDF1; }
.card--steel .h1, .card--steel .h2, .card--steel .h3 { color: #fff; }
.card--steel .muted { color: #AAB6C1; }

.badge {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .2em .65em; border-radius: var(--r-pill); border: 1px solid transparent;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; }
.badge--new      { background: var(--st-new-bg);  color: var(--st-new-fg);  border-color: var(--st-new-bd); }
.badge--progress { background: var(--st-work-bg); color: var(--st-work-fg); border-color: var(--st-work-bd); }
.badge--done     { background: var(--st-done-bg); color: var(--st-done-fg); border-color: var(--st-done-bd); }
.badge--rejected { background: var(--st-fail-bg); color: var(--st-fail-fg); border-color: var(--st-fail-bd); }
.badge--off      { background: var(--st-off-bg);  color: var(--st-off-fg);  border-color: var(--st-off-bd); }

.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s-4);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink); font-size: var(--fs-sm); font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.app a.chip { color: var(--ink); text-decoration: none; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--strong); color: #fff; border-color: var(--strong); }
.app a.chip.is-active { color: #fff; }

.tag { display: inline-block; padding: 1px 8px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink); font-size: var(--fs-xs); font-weight: 600; }

.count-dot {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
}
:root[data-theme="dark"] .count-dot { color: #1a0b0c; }

/* ---------- 7. Таблицы и списки (админка) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); padding: var(--s-3) var(--s-4); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }

.empty {
  text-align: center; padding: var(--s-8) var(--s-4); border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-card); color: var(--ink-2);
}
.empty .h3 { margin-bottom: var(--s-2); }

/* ---------- 8. Skeleton ---------- */
.skeleton {
  display: block; position: relative; overflow: hidden;
  background: var(--surface-3); border-radius: var(--r-ctl); min-height: 1em;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface) 60%, transparent) 50%, transparent 80%);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--img { aspect-ratio: 4 / 3; border-radius: 0; }

/* Изображение, которое подгружается лениво: фон-заглушка, пока нет данных */
.img-frame { position: relative; background: var(--surface-3); overflow: hidden; }
.img-frame img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s var(--ease); }
.img-frame img.is-loaded, .img-frame img[complete] { opacity: 1; }
.no-js .img-frame img { opacity: 1; }

/* ---------- 9. Прогресс ---------- */
.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); border-radius: inherit; transition: width .2s linear; }

/* ---------- 10. Модальные окна (<dialog>) ---------- */
.modal {
  border: 0; padding: 0; background: transparent; color: inherit;
  max-width: min(560px, calc(100vw - 24px)); width: 100%;
}
.modal::backdrop { background: rgb(10 15 20 / .6); backdrop-filter: blur(2px); }
.modal__panel {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--sh-pop); overflow: hidden;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.modal__body { padding: var(--s-5); max-height: 70vh; max-height: 70dvh; overflow: auto; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line); background: var(--surface-2); }
.modal[open] .modal__panel { animation: pop-in .18s var(--ease); }
@keyframes pop-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@media (max-width: 600px) {
  /* на телефоне модалка — нижний лист */
  .modal { margin: auto auto 0; max-width: 100%; }
  .modal__panel { border-radius: var(--r-card) var(--r-card) 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* Выдвижная панель (фильтры, меню) */
.sheet {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; visibility: hidden;
  transition: visibility 0s linear .25s;
}
.sheet.is-open { pointer-events: auto; visibility: visible; transition-delay: 0s; }
.sheet__scrim { position: absolute; inset: 0; background: rgb(10 15 20 / .55); opacity: 0; transition: opacity .25s var(--ease); }
.sheet.is-open .sheet__scrim { opacity: 1; }
.sheet__panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(340px, 88vw);
  background: var(--surface); box-shadow: var(--sh-pop);
  transform: translateX(-100%); transition: transform .25s var(--ease);
  display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain;
}
.sheet--right .sheet__panel { left: auto; right: 0; transform: translateX(100%); }
.sheet.is-open .sheet__panel { transform: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4); border-bottom: 1px solid var(--line); }
.sheet__body { padding: var(--s-4); flex: 1; }
.sheet__foot { padding: var(--s-4); border-top: 1px solid var(--line); display: flex; gap: var(--s-3); padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); }

/* ---------- 11. Тосты ---------- */
.toasts {
  position: fixed; z-index: 200; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding-inline: 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s-3);
  width: min(440px, 100%); padding: var(--s-3) var(--s-4);
  background: var(--steel-900); color: #fff; border-radius: var(--r-ctl);
  border-left: 5px solid var(--brass-500); box-shadow: var(--sh-pop);
  animation: toast-in .22s var(--ease);
}
.toast--success { border-left-color: #4CAF7A; }
.toast--error   { border-left-color: #E5595E; }
.toast__text { flex: 1; font-size: var(--fs-sm); padding-block: 2px; }
.toast__x { background: none; border: 0; color: #AAB6C1; cursor: pointer; width: 32px; height: 32px; margin: -4px -8px -4px 0; font-size: 20px; line-height: 1; }
.toast__x:hover { color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all .2s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- 12. Шапка, навигация, подвал ---------- */
.topbar { background: var(--steel-900); color: #fff; position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--steel-800); }
.topbar__in { display: flex; align-items: center; gap: var(--s-3); min-height: var(--header-h); }

.brand {
  display: inline-flex; align-items: center; gap: var(--s-3); text-decoration: none; color: #fff;
  min-height: var(--tap); margin-right: auto;
}
.app a.brand { color: #fff; text-decoration: none; }
.brand__mark { width: 30px; height: 30px; flex: none; color: var(--brass-500); }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; line-height: 1; white-space: nowrap; }
@media (min-width: 480px) { .brand__name { font-size: 1.5rem; } }
.brand__tag  { display: none; font-size: var(--fs-xs); color: #9FB0BF; line-height: 1.2; }
@media (min-width: 900px) { .brand__tag { display: block; } .brand__text { display: flex; flex-direction: column; gap: 3px; } }

.topbar .btn--ghost { --btn-fg: #E8EDF1; }
.topbar .btn--ghost:hover { --btn-bg: var(--steel-700); }
.topbar__phone { display: none; }
@media (min-width: 640px) { .topbar__phone { display: inline-flex; } .topbar__call-icon { display: none; } }

.nav-desktop { display: none; background: var(--surface); border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .nav-desktop { display: block; } .burger { display: none; } }
.nav-desktop ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1); }
.nav-desktop a, .nav-desktop summary {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 48px; padding: 0 var(--s-4);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: var(--fs-sm);
  border-bottom: 3px solid transparent; cursor: pointer; list-style: none;
}
.nav-desktop summary::-webkit-details-marker { display: none; }
.nav-desktop a:hover, .nav-desktop summary:hover { color: var(--accent-text); }
.nav-desktop a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }
.nav-desktop .push { margin-left: auto; }

.menu { position: relative; }
.menu__list {
  position: absolute; right: 0; top: 100%; z-index: 60; min-width: 200px; padding: var(--s-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--sh-pop);
}
.menu__list a { display: flex; width: 100%; border: 0 !important; border-radius: var(--r-sm); }
.menu__list a:hover { background: var(--surface-2); }

.drawer-links { list-style: none; margin: 0; padding: var(--s-2) 0; }
.drawer-links a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 52px; padding: 0 var(--s-5); color: var(--ink); text-decoration: none; font-weight: 500; font-size: var(--fs-md);
}
.drawer-links a:hover { background: var(--surface-2); }
.drawer-links a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--accent); background: var(--surface-2); font-weight: 600; }
.drawer-links hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-2) 0; }

.footer { background: var(--steel-900); color: #AAB6C1; margin-top: auto; }
.footer a { color: #E8EDF1; }
.footer__in { display: grid; gap: var(--s-5); padding-block: var(--s-6); }
@media (min-width: 768px) { .footer__in { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer__title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); color: #fff; margin: 0 0 var(--s-2); }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li a { display: inline-block; padding-block: var(--s-2); }
.footer__legal { border-top: 1px solid var(--steel-800); padding-block: var(--s-4); font-size: var(--fs-xs); }

/* ---------- 13. Утилиты и доступность ---------- */
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: var(--s-4) !important; }
.mt-5 { margin-top: var(--s-5) !important; }
.mb-4 { margin-bottom: var(--s-4) !important; }
.scroll-lock { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .app *, .app *::before, .app *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .skeleton::after { display: none; }
}
@media (forced-colors: active) {
  .btn, .input, .select, .textarea, .card { border: 1px solid CanvasText; }
}
