/* clear-address — дизайн-система под бренд ТАТ (tk-tat.ru + brand guideline).
   Внешний лист (CSP style-src 'self'); никаких inline style-атрибутов в разметке. */

/* ---------- Шрифт Geometria (самохостинг ассетов TAT) ---------- */
@font-face {
  font-family: 'geo-medium';
  src: url(/assets/fonts/geometria-medium.woff2) format('woff2'),
       url(/assets/fonts/geometria-medium.woff) format('woff');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'geo-extra';
  src: url(/assets/fonts/geometria-extrabold.woff2) format('woff2'),
       url(/assets/fonts/geometria-extrabold.woff) format('woff');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'geo-reg';
  src: url(/assets/fonts/geometria-regular.woff) format('woff');
  font-weight: 400;
  font-display: swap;
}

/* ---------- Токены ---------- */
:root {
  /* фирменные цвета */
  --c-orange: #ff5c35;
  --c-orange-press: #e84924;
  --c-orange-dark: #d53e1b;
  --c-blue: #2f1da9;
  --c-navy: #11154f;
  --c-ink: #353535;
  --c-muted: #6b6b6b;
  --c-faint: #aaaaaa;
  --c-bg: #f0f0f0;
  --c-surface: #ffffff;
  --c-tint: #fafafa;
  --c-tint2: #efefef;
  --c-border: #d4d4d4;
  --c-ok: #2f8f57;
  --c-warn: #b26a00;
  --c-err: #d53e1b;

  /* семантические роли */
  --accent: var(--c-orange);
  --accent-press: var(--c-orange-press);
  --on-accent: #ffffff;
  --secondary: var(--c-blue);
  --on-secondary: #ffffff;
  --text: var(--c-ink);
  --muted: var(--c-muted);
  --heading: var(--c-navy);
  --bg: var(--c-bg);
  --surface: var(--c-surface);
  --border: var(--c-border);
  --ring: var(--c-orange);

  /* шрифты */
  --font-body: 'geo-medium', 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'geo-extra', 'Montserrat', system-ui, sans-serif;
  --font-reg: 'geo-reg', var(--font-body);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* радиусы (near-square, геометрия бренда) */
  --r-1: 1px;
  --r-2: 2px;
  --r-3: 4px;
  --r-pill: 999px;

  /* отступы 4/8 */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* тени (синий подтон, blur ≤8px) */
  --sh-1: 0 1px 2px rgba(17, 21, 79, 0.06);
  --sh-2: 0 2px 8px rgba(17, 21, 79, 0.09);

  /* z-index */
  --z-dropdown: 20; --z-sticky: 30; --z-backdrop: 40;
  --z-modal: 50; --z-toast: 60; --z-tooltip: 70;

  /* motion */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --t-press: 120ms;
  --t-drop: 180ms;
  --t-modal: 240ms;

  /* раскладка */
  --container: 1120px;
  --container-app: 980px;
  --header-h: 64px;

  color-scheme: light;
}

/* ---------- Reset / база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--font-body);
  letter-spacing: 0.01em;
}
img, svg { max-width: 100%; }
svg { display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-press); text-decoration: underline; }
h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  color: var(--heading);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(28px, 5vw, 40px); }
h2 { font-size: clamp(22px, 4vw, 32px); }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
p { margin: 0 0 1em; max-width: 72ch; }
strong, b { font-family: var(--font-head); font-weight: 400; }
small { font-size: 0.85rem; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

/* утилиты */
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; color: var(--muted); }
.overflow { overflow-x: auto; }
.center { text-align: center; }
.stack > * + * { margin-top: var(--s-3); }
.nowrap { white-space: nowrap; }

/* ---------- Раскладка ---------- */
.wrap { max-width: var(--container); margin: 0 auto; padding: var(--s-5) var(--s-4); }
.wrap.app { max-width: var(--container-app); }
.grid-2 { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.row { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.actions { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }

/* ---------- Скип-ссылка (a11y) ---------- */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: var(--z-tooltip); padding: 10px 16px; background: var(--accent); color: var(--on-accent); border-radius: 0 0 var(--r-2) 0; font-family: var(--font-head); }
.skip-link:focus { left: 0; text-decoration: none; }

/* ---------- Шапка / подвал ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: var(--header-h); padding: 0 var(--s-4);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: var(--s-2); text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand__logo { height: 26px; width: auto; }
.brand__desc { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.16em; font-size: 10px; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: var(--s-3); }
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 13px;
  padding: var(--s-5) var(--s-4); margin-top: var(--s-7);
}
.site-footer .wrap { padding: 0; display: flex; gap: var(--s-4); flex-wrap: wrap; justify-content: space-between; }

/* ---------- Кнопки ---------- */
.btn {
  --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 18px;
  font-family: var(--font-head); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd); border-radius: var(--r-1);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-press) var(--ease-out), color var(--t-press) var(--ease-out),
              border-color var(--t-press) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn.is-disabled { background: var(--c-tint2); color: var(--c-faint); border-color: var(--border); cursor: not-allowed; transform: none; }
.btn--secondary { --btn-bg: var(--secondary); --btn-fg: var(--on-secondary); }
.btn--white { --btn-bg: var(--surface); --btn-fg: var(--muted); --btn-bd: var(--border); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--muted); --btn-bd: var(--border); }
.btn--ghost { border-style: dashed; text-transform: none; font-family: var(--font-body); letter-spacing: 0.01em; }
.btn--danger { --btn-bg: var(--c-err); --btn-fg: #fff; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 12px; }
.btn--lg { min-height: 56px; padding: 0 28px; font-size: 14px; }
.btn--block { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn--secondary:hover, .btn--white:hover, .btn--ghost:hover { --btn-bg: var(--accent); --btn-fg: #fff; --btn-bd: var(--accent); }
  .btn:hover { background: var(--btn-bg); filter: none; }
  .btn--secondary:hover { background: var(--accent); }
  .btn:not(.btn--secondary):not(.btn--white):not(.btn--ghost):not(.btn--danger):hover { background: var(--accent-press); }
}
.btn__spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; }
.btn.is-loading .btn__spinner { animation: ca-spin 0.7s linear infinite; }
.btn.is-loading { pointer-events: none; opacity: 0.85; }

/* ---------- Формы ---------- */
.field { display: block; margin: 0 0 var(--s-3); }
label, .label { display: block; font-family: var(--font-head); font-size: 13px; color: var(--heading); margin: 0 0 var(--s-1); }
.hint { color: var(--muted); font-size: 12px; margin: var(--s-1) 0 0; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-2);
  transition: border-color var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 92, 53, 0.18); }
input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true'] { border-color: var(--c-err); }
input::placeholder, textarea::placeholder { color: var(--c-faint); }
.field-error { color: var(--c-err); font-size: 13px; margin: var(--s-1) 0 0; }
.check { display: flex; gap: var(--s-2); align-items: flex-start; }
.check input[type='checkbox'] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.check span { color: var(--text); }

/* нативный select со стрелкой (фолбэк) */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ff5c35' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* поле с кнопкой показать/скрыть пароль */
.input-affix { position: relative; }
.input-affix input { padding-right: 44px; }
.input-affix__btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 32px; width: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
.input-affix__btn:hover { color: var(--accent); }

/* ---------- Карточки / панели ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3);
  padding: var(--s-5); margin: 0 0 var(--s-4);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); }
.panel__head { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.panel__body { padding: var(--s-5); }

/* ---------- Бейджи / пилюли ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-1); font-family: var(--font-head); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; background: var(--c-tint2); color: var(--heading); border: 1px solid var(--border); }
.badge--accent { background: rgba(255, 92, 53, 0.12); color: var(--accent-press); border-color: rgba(255, 92, 53, 0.35); }
.badge--blue { background: rgba(47, 29, 169, 0.1); color: var(--secondary); border-color: rgba(47, 29, 169, 0.3); }
.badge--ok { background: rgba(47, 143, 87, 0.12); color: var(--c-ok); border-color: rgba(47, 143, 87, 0.35); }

/* ---------- Alert / сообщения ---------- */
.alert { display: flex; gap: var(--s-2); align-items: flex-start; padding: 12px 14px; border-radius: var(--r-2); margin: 0 0 var(--s-3); border: 1px solid transparent; }
.alert svg { flex: 0 0 auto; margin-top: 2px; }
.alert--ok { background: rgba(47, 143, 87, 0.1); color: var(--c-ok); border-color: rgba(47, 143, 87, 0.3); }
.alert--err { background: rgba(213, 62, 27, 0.1); color: var(--c-err); border-color: rgba(213, 62, 27, 0.3); }
.alert--warn { background: rgba(178, 106, 0, 0.1); color: var(--c-warn); border-color: rgba(178, 106, 0, 0.3); }
.alert--info { background: rgba(47, 29, 169, 0.08); color: var(--secondary); border-color: rgba(47, 29, 169, 0.25); }

/* ---------- Код / результат ---------- */
.result-box { background: var(--c-tint); border: 1px solid var(--border); border-radius: var(--r-2); padding: var(--s-4); overflow-x: auto; }
.code { font-family: var(--font-mono); font-size: 13px; white-space: pre; }

/* ---------- Stat-плитки ---------- */
.stats { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { border: 1px solid var(--border); border-radius: var(--r-3); padding: var(--s-4); background: var(--surface); }
.stat__label { color: var(--muted); font-size: 13px; }
.stat__value { font-family: var(--font-head); font-size: 28px; color: var(--heading); font-variant-numeric: tabular-nums; margin-top: 4px; }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th { font-family: var(--font-head); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; color: var(--muted); text-align: left; padding: 10px var(--s-3); border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { text-align: left; padding: 10px var(--s-3); border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--c-tint); }
/* Плотный «cockpit» для админ-таблиц */
.cockpit thead th, .cockpit tbody td { padding: 7px var(--s-3); }
/* Горизонтальный скролл со «липкой» первой колонкой на узких экранах */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-2); }
@media (max-width: 640px) {
  .table-wrap.sticky1 th:first-child, .table-wrap.sticky1 td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .table-wrap.sticky1 tbody tr:hover td:first-child { background: var(--c-tint); }
}

/* ---------- Иконки ---------- */
.icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.btn .icon { width: 16px; height: 16px; }
.btn--lg .icon { width: 18px; height: 18px; }

/* ---------- Шапка: навигация / бургер (прогрессивное улучшение) ---------- */
.nav-toggle { display: none; }
@media (max-width: 720px) {
  .site-nav__email { display: none; }
  /* С JS: скрываем нав за бургером, показываем как выпадающую панель */
  html[data-js] .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; color: var(--heading);
    background: transparent; border: 1px solid var(--border); border-radius: var(--r-2); cursor: pointer;
  }
  html[data-js] .site-nav {
    position: absolute; top: 100%; right: 0; left: 0; display: none;
    flex-direction: column; align-items: stretch; gap: var(--s-2);
    padding: var(--s-3) var(--s-4); background: var(--surface);
    border-bottom: 1px solid var(--border); box-shadow: var(--sh-2); z-index: var(--z-dropdown);
  }
  html[data-js] .site-nav.is-open { display: flex; animation: ca-drop var(--t-drop) var(--ease-out); }
  html[data-js] .site-nav .btn { justify-content: flex-start; }
  .site-nav__user { justify-content: space-between; }
}
.site-nav__user { display: inline-flex; align-items: center; gap: var(--s-2); }
.site-nav__logout { margin: 0; }

/* ---------- Кастомный дропдаун (клиент строит из <select> в D2) ---------- */
.dropdown { position: relative; }
.dropdown__trigger {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  width: 100%; min-height: 44px; padding: 10px 12px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-2); cursor: pointer;
  font: inherit; transition: border-color var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out);
}
.dropdown__trigger:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 92, 53, 0.18); }
.dropdown__trigger .icon { color: var(--accent); transition: transform var(--t-drop) var(--ease-out); }
.dropdown[data-open] .dropdown__trigger .icon { transform: rotate(180deg); }
.dropdown__menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: var(--z-dropdown);
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); box-shadow: var(--sh-2);
  max-height: 280px; overflow-y: auto; transform-origin: top center;
}
.dropdown__menu[hidden] { display: none; }
.dropdown[data-open] .dropdown__menu { animation: ca-drop var(--t-drop) var(--ease-out); }
.dropdown__option { padding: 10px 12px; border-radius: var(--r-2); cursor: pointer; }
.dropdown__option[aria-selected='true'] { color: var(--accent-press); font-family: var(--font-head); }
.dropdown__option.is-active, .dropdown__option:hover { background: var(--c-tint); }

/* ---------- Модалка (нативный <dialog>) ---------- */
.modal { padding: 0; border: 0; background: transparent; max-width: min(92vw, 480px); width: 100%; color: var(--text); }
.modal::backdrop { background: rgba(17, 21, 79, 0.45); }
.modal__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); overflow: hidden; }
.modal[open] .modal__card { animation: ca-modal var(--t-modal) var(--ease-out); }
.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(--border); }
.modal__head h3 { margin: 0; }
.modal__close { display: inline-flex; width: 36px; height: 36px; padding: 0; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--muted); cursor: pointer; border-radius: var(--r-2); }
.modal__close:hover { color: var(--accent); background: var(--c-tint); }
.modal__body { padding: var(--s-5); }
.modal__foot { display: flex; gap: var(--s-2); justify-content: flex-end; padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); background: var(--c-tint); }

/* ---------- Тосты ---------- */
.toast-region { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--s-2); max-width: min(92vw, 380px); }
.toast { display: flex; align-items: flex-start; gap: var(--s-2); padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--r-2); box-shadow: var(--sh-2); animation: ca-toast-in var(--t-drop) var(--ease-out); }
.toast--ok { border-left-color: var(--c-ok); }
.toast--ok .icon { color: var(--c-ok); }
.toast--err { border-left-color: var(--c-err); }
.toast--err .icon { color: var(--c-err); }
.toast--info { border-left-color: var(--secondary); }
.toast--info .icon { color: var(--secondary); }
.toast.is-leaving { animation: ca-toast-out var(--t-drop) var(--ease-in-out) forwards; }
.toast__body { flex: 1; }
.toast__undo { background: transparent; border: 0; color: var(--accent); font: inherit; font-family: var(--font-head); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; padding: 2px 4px; }

/* ---------- Пустое состояние / скелетон ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-7) var(--s-4); color: var(--muted); text-align: center; }
.empty__icon { width: 40px; height: 40px; color: var(--c-faint); }
.skeleton { background: linear-gradient(90deg, var(--c-tint2) 25%, var(--c-tint) 37%, var(--c-tint2) 63%); background-size: 400% 100%; border-radius: var(--r-2); animation: ca-shimmer 1.4s ease infinite; min-height: 16px; }

/* ---------- Мозаика ТАТ (брендовый акцент) ---------- */
.mosaic { --sq: 14px; height: var(--sq); background-image:
    linear-gradient(90deg, var(--accent) 0 var(--sq), transparent var(--sq)),
    linear-gradient(90deg, var(--secondary) 0 var(--sq), transparent var(--sq)); }
.mosaic--bar { background-repeat: repeat-x; background-size: calc(var(--sq) * 3) var(--sq), calc(var(--sq) * 5) var(--sq); background-position: 0 0, var(--sq) 0; }

/* ---------- Логотип-знак: сборка при загрузке ---------- */
.logo-mark { width: 56px; height: 56px; }
.logo-mark__sq { transform-origin: 50% 50%; }
@media (prefers-reduced-motion: no-preference) {
  .logo-mark--animate .logo-mark__sq { animation: ca-assemble 520ms var(--ease-out) both; }
  .logo-mark--animate .logo-mark__sq--o2 { animation-delay: 70ms; }
  .logo-mark--animate .logo-mark__sq--b1 { animation-delay: 140ms; }
  .logo-mark--animate .logo-mark__sq--b2 { animation-delay: 210ms; }
}

/* ---------- Ссылка с брендовой стрелкой ---------- */
.link-arrow { display: inline-flex; align-items: center; gap: 6px; }
.link-arrow .icon { transition: transform var(--t-press) var(--ease-out); }
@media (hover: hover) { .link-arrow:hover .icon { transform: translateX(3px); } }

/* ---------- Раскладка: авторизация ---------- */
.main--auth { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--header-h) - 140px); padding: var(--s-6) var(--s-4); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); padding: var(--s-6); box-shadow: var(--sh-2); }
.auth-card__head { text-align: center; margin-bottom: var(--s-5); }
.auth-card__head .logo-mark { margin: 0 auto var(--s-3); }
.auth-card__foot { margin-top: var(--s-4); text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Раскладка: приложение ---------- */
.app-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.app-head h1 { margin: 0; }
.app-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; align-items: start; }
.app-grid > * { min-width: 0; } /* позволяем треку сжиматься < min-content (textarea) */
@media (min-width: 900px) { .app-grid { grid-template-columns: 1fr 1fr; } }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); padding: var(--s-6); text-align: center; color: var(--muted); background: var(--c-tint); border: 2px dashed var(--border); border-radius: var(--r-3); cursor: pointer; transition: border-color var(--t-press) var(--ease-out), background var(--t-press) var(--ease-out); }
.dropzone .icon { width: 32px; height: 32px; color: var(--c-faint); }
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: rgba(255, 92, 53, 0.06); }
.dropzone.is-dragover .icon, .dropzone.has-file .icon { color: var(--accent); }
.dropzone__file { font-family: var(--font-head); color: var(--heading); }
/* С JS прячем нативный input и делаем зону полноценным полем; без JS — input виден (фолбэк) */
.dropzone[data-enhanced] input[type='file'] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.dropzone:not([data-enhanced]) input[type='file'] { margin-top: var(--s-2); }

/* ---------- Раскладка: админка (shell) ---------- */
.admin { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 900px) { .admin { grid-template-columns: 216px 1fr; align-items: start; } }
.admin-nav { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--s-1); }
@media (min-width: 900px) { .admin-nav { position: sticky; top: calc(var(--header-h) + var(--s-4)); flex-direction: column; overflow: visible; padding: 0; } }
.admin-nav__link { display: inline-flex; align-items: center; gap: var(--s-2); white-space: nowrap; padding: 10px 12px; border-radius: var(--r-2); color: var(--muted); font-family: var(--font-head); font-size: 13px; border: 1px solid transparent; }
.admin-nav__link:hover { color: var(--heading); background: var(--c-tint); text-decoration: none; }
.admin-nav__link[aria-current='page'] { color: var(--accent-press); background: rgba(255, 92, 53, 0.1); border-color: rgba(255, 92, 53, 0.3); }
.admin-nav__link .icon { width: 16px; height: 16px; }
.admin-main { min-width: 0; }
.admin-main > h1 { margin-top: 0; }
.inline-form { display: flex; gap: var(--s-2); align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form .dropdown { min-width: 150px; }
/* блок кода с кнопкой «копировать» */
.code-scroll { position: relative; }
.code-scroll .code-copy { position: absolute; top: 8px; right: 8px; z-index: 1; }
.code-scroll .result-box { padding-top: var(--s-6); }

/* ---------- Анимации ---------- */
@keyframes ca-spin { to { transform: rotate(360deg); } }
@keyframes ca-drop { from { opacity: 0; transform: translateY(-6px) scaleY(0.98); } to { opacity: 1; transform: none; } }
@keyframes ca-modal { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes ca-toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes ca-toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes ca-shimmer { to { background-position: -400% 0; } }
@keyframes ca-assemble { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes ca-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .fade-up { animation: ca-fade-up 360ms var(--ease-out) both; }
}

/* Reduced-motion: гасим всё (должно оставаться последним) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
