/* =====================================================
   ULA FACTORY — оформление
   Цвета взяты из логотипа: чёрный + красный.
   Чёрный — кнопки и текст. Красный — только акценты
   (логотип, активная вкладка, прогресс заказа).
   Чтобы поменять цвет везде — правьте блок :root ниже.
   ===================================================== */

/* ---------- Шрифт Inter: файлы лежат на нашем сайте (папка fonts/) ----------
   Не грузится с Google: Google Fonts заблокирован в Китае, а наши байеры работают оттуда.
   Один «переменный» файл на алфавит, внутри все жирности 100–900; браузер скачивает только нужный алфавит.
   Китайские иероглифы — системные шрифты (PingFang, YaHei, Noto Sans SC). Лицензия Inter — SIL OFL. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-cyrillic-ext.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-vietnamese.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* =====================================================
   ДИЗАЙН-ТОКЕНЫ ULA FACTORY
   Три слоя: 1) палитра бренда → 2) роли (фон, текст, граница, акцент, статусы) → 3) старые имена,
   которыми пользуются остальные стили (--ink, --paper, --red…) — они ссылаются на роли.
   Тёмная тема переопределяет только роли (блок «ТЁМНАЯ ТЕМА» ниже) — не инверсия, свои значения.
   Контраст проверен по WCAG AA: обычный текст ≥ 4.5:1, рамки полей и значки ≥ 3:1.
   ===================================================== */
:root {
  /* 1. Палитра бренда */
  --brand-red: #B50919;          /* ULA — главный красный */
  --brand-red-hover: #970815;
  --brand-ink: #17191D;          /* FACTORY — графитовый чёрный */

  /* 2. Роли — светлая тема */
  --bg: #F7F8FA;                 /* фон страницы */
  --surface: #FFFFFF;            /* карточки, окна */
  --surface-raised: #FFFFFF;     /* меню, всплывающие окна (отделяются тенью) */
  --surface-sunken: #F1F3F6;     /* мягкий фон блоков внутри карточки */
  --text: #17191D;               /* основной текст: 16.6:1 на фоне */
  --text-2: #626873;             /* второстепенный: 5.3:1 на фоне, 5.6:1 на белом */
  --text-3: #8A9099;             /* подсказки в полях, неактивное */
  --border: #E8EBEF;             /* разделители (декоративные) */
  --border-strong: #D5D9E0;      /* рамки карточек и кнопок */
  --border-field: #8A9099;       /* рамка поля ввода: 3.2:1 — видна по WCAG */
  --accent: #B50919;             /* главные действия; белый текст на нём 7:1 */
  --accent-hover: #970815;
  --accent-text: #B50919;        /* красный текст и ссылки: 7:1 на белом */
  --accent-tint: #FCEBEC;        /* мягкий красный фон: текст --accent-text на нём 6:1 */
  --on-accent: #FFFFFF;
  --success: #27966C;  --success-text: #1E7A57;  --success-tint: #E8F5EF;
  --warning: #DCA43A;  --warning-text: #8A5A0B;  --warning-tint: #FBF3E2;
  --error: #C62828;    --error-text: #C62828;    --error-tint: #FDECEC;
  --info: #3478C8;     --info-text: #2B6CB5;     --info-tint: #EAF2FB;
  --neutral-btn: #17191D;        /* тёмная нейтральная кнопка (повторяющиеся действия в списках) */
  --neutral-btn-hover: #2A2D33;
  --on-neutral-btn: #FFFFFF;

  /* Типографика: Inter + системные шрифты для китайского */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", Arial, sans-serif;
  --font-display: var(--font);
  --font-brand: var(--font);
  --fs-2xs: 11px;   /* счётчики, мелкие метки */
  --fs-xs: 12px;    /* подписи */
  --fs-sm: 13px;    /* вторичный текст */
  --fs-md: 14px;    /* текст в карточках и таблицах */
  --fs-base: 15px;  /* кнопки, пункты меню */
  --fs-lg: 16px;    /* основной текст, поля ввода (iPhone не увеличивает страницу) */
  --fs-xl: 18px;    /* заголовок карточки */
  --fs-2xl: 20px;
  --fs-3xl: 22px;   /* заголовок раздела на телефоне */
  --fs-4xl: 24px;
  --fs-5xl: 28px;   /* заголовок раздела на компьютере, крупные числа */
  --fs-6xl: 34px;
  --lh-tight: 1.2;  --lh-snug: 1.35;  --lh-normal: 1.5;

  /* Отступы: шаг 4 / 8 px */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;  --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Скругления (меняются в Профиле → «Стиль углов») */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Размеры касания */
  --tap: 44px;
  --control-h: 46px;

  /* 3. Старые имена — ссылки на роли (ими пользуются все стили ниже) */
  --paper: var(--bg);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --ink: var(--text);
  --ink-soft: #2A2D33;
  --muted: var(--text-2);
  --red: var(--accent-text);
  --red-deep: var(--accent-hover);
  --red-tint: var(--accent-tint);
  --green: var(--success-text);
  --green-tint: var(--success-tint);
  --fill: #EEF0F3;               /* серая (второстепенная) кнопка: текст на ней 15:1 */
  --fill-2: #E2E5EA;
  --seg-on: #FFFFFF;
  /* --primary — «выбранное» (активный фильтр, переключатель, аватар): нейтральный тёмный, не красный.
     Красный для главных кнопок — это --accent (.btn-primary). */
  --primary: var(--neutral-btn);
  --primary-hover: var(--neutral-btn-hover);
  --on-primary: var(--on-neutral-btn);
  --hero: #17191D;
  --hover: #F1F3F6;
  --field: #FFFFFF;
  --topbar: rgba(255, 255, 255, 0.86);
  --soft: var(--surface-sunken);
  --danger-line: #EFC2C6;
  --invalid: #FFFBFB;
  --placeholder: var(--text-3);
  --backdrop: rgba(17, 18, 22, 0.48);
  --focus-ring: rgba(181, 9, 25, 0.28);
  color-scheme: light;
}

* { box-sizing: border-box; }

/* Основной стиль загрузился — запасная подсказка больше не нужна. */
#style-fallback { display: none; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-lg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, p, dl, dd, ol { margin: 0; padding: 0; }
h1 { font-family: var(--font-display); font-size: var(--fs-4xl); font-weight: 700; line-height: 1.2; }
h2 { font-size: var(--fs-xl); font-weight: 700; line-height: 1.3; }
h3 { font-size: var(--fs-xl); font-weight: 700; line-height: 1.3; }

a { color: var(--ink); text-decoration-color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red); }
button { font-family: inherit; }
img { max-width: 100%; }

.hidden { display: none !important; }
.muted { color: var(--muted); }

:focus-visible {
  outline: 3px solid rgba(181, 9, 25, 0.45);
  outline-offset: 2px;
}

/* Скрыть элемент визуально, но оставить для экранного диктора */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--fill);
  color: var(--ink);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--fill-2); color: var(--ink); }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }

.btn-danger { color: var(--red); background: var(--red-tint); }
.btn-danger:hover { background: var(--red-tint); color: var(--red-deep); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper); }

.btn-light { background: #fff; border-color: #fff; color: #17191D; } /* всегда белая кнопка с тёмным текстом */
.btn-light:hover { background: #ECEDEF; color: #17191D; }

.btn-block { width: 100%; }

.btn-file input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-5xl);
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }

/* ---------- Поля ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.field .opt { font-weight: 500; }

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--field);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-lg); /* 16px — чтобы iPhone не увеличивал страницу при вводе */
  line-height: 1.4;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input[type="file"] { min-height: 0; padding: 0; border: 0; }
::placeholder { color: var(--placeholder); opacity: 1; }

/* Поле с ошибкой */
[aria-invalid="true"] { border-color: var(--red); background: var(--invalid); }
[aria-invalid="true"]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(181, 9, 25, 0.15); }
.field-hint { font-size: var(--fs-sm); color: var(--muted); }
.field-error { font-size: var(--fs-sm); font-weight: 600; color: var(--red); }

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--red-tint);
  color: var(--red);
  font-size: var(--fs-md);
  font-weight: 700;
}

/* ---------- Логотип и шапка ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: block; width: 36px; height: 36px; border-radius: 9px; }
.brand-name {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-name b { color: var(--red); font-weight: 700; }

.logo-full { display: block; width: 96px; height: auto; margin: -4px auto 18px; border-radius: 50%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px 0;
}
#view-client .topbar-inner { padding-bottom: 10px; }
.topbar-actions { order: 3; display: flex; align-items: center; gap: 4px; }

/* Все разделы кабинета собраны в одном выпадающем меню. */
.section-menu-wrap { order: 2; position: relative; }
.section-menu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 12px 0 13px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--soft); color: var(--ink);
  font: inherit; font-size: var(--fs-base); font-weight: 700; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.section-menu-label { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-menu-chev { color: var(--muted); transition: transform .15s; }
.section-menu-btn[aria-expanded="true"] .section-menu-chev { transform: rotate(180deg); }
.section-menu-btn:hover, .section-menu-btn[aria-expanded="true"] { border-color: var(--muted); background: var(--surface); }
.section-menu-btn:focus-visible, .menu-action:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.section-menu { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; left: auto; display: grid; gap: 4px; width: min(270px, calc(100vw - 32px)); margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 14px 36px rgba(0,0,0,.18); }
.section-menu-list { order: initial; display: grid; gap: 2px; width: auto; margin: 0; overflow: visible; }
.section-menu .tab { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 9px; text-align: left; }
.section-menu .tab:hover, .section-menu .tab.active { background: var(--soft); }
.section-menu .tab.active::after { left: 0; right: auto; top: 9px; bottom: 9px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
.section-menu .badge-inline { margin-left: 8px; }
.menu-divider { margin: 4px 6px; border-top: 1px solid var(--line); }
.menu-action { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.menu-action:hover { background: var(--soft); }
.menu-logout { color: var(--red); }
.tab {
  position: relative;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 700;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--red);
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--paper);
}
.lang-switch button {
  min-width: 40px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.active { background: var(--primary); color: var(--on-primary); }
.lang-center { display: flex; justify-content: center; margin: 22px auto 0; width: fit-content; }

/* ---------- Вход ---------- */
.center-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.panel {
  width: 100%;
  max-width: 420px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
}
.panel h1 { margin-bottom: 6px; text-align: center; font-size: var(--fs-2xl); }
.panel .muted, .panel > p { margin-bottom: 22px; text-align: center; }

/* ---------- Контейнер ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}
.container-narrow { max-width: 640px; }

/* ---------- Склад: чёрная «грузовая бирка» ---------- */
.warehouse {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
  padding: 22px 20px 22px 26px;
  border-radius: var(--r-xl);
  background: var(--hero);
  color: #fff;
  overflow: hidden;
}
.warehouse::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--red);
}
.warehouse h2 { margin-bottom: 8px; font-size: var(--fs-md); font-weight: 700; color: rgba(255, 255, 255, 0.7); }
.warehouse-address {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}
.warehouse-contacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.contact {
  display: inline-flex;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.contact:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
.warehouse .btn { align-self: flex-start; }

/* ---------- Сводка ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.summary-item:nth-child(2n) { border-right: 0; }
.summary-item:nth-child(n+3) { border-bottom: 0; }
.summary-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.summary-value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.summary-value small { font-family: var(--font); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.summary-value.paid { color: var(--green); }
.summary-value.debt { color: var(--red); }
.fine-print { margin: 8px 4px 16px; font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Статусы-фильтры ---------- */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px 14px;
  padding: 2px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-base);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink); }
.chip b {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip.active b { background: color-mix(in srgb, var(--on-primary) 22%, transparent); color: var(--on-primary); }

/* ---------- Поиск ---------- */
.toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.toolbar .search { grid-column: 1 / -1; }
.toolbar .btn { width: 100%; }
.toolbar-new { display: none; }
.toolbar-clients { grid-template-columns: 1fr; margin-bottom: 4px; }
.date-field { display: grid; gap: 4px; }
.date-field span { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }

/* ---------- Карточки заказов ---------- */
.orders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 14px;
  align-items: start;
}
.orders .more { grid-column: 1 / -1; }

/* Цвет каждого статуса */
.st-new              { --st: #1D4FBF; --st-bg: #E7EEFC; }
.st-awaiting_payment { --st: #925A00; --st-bg: #FCEFD5; }
.st-purchasing       { --st: #6340B5; --st-bg: #EEE9FA; }
.st-china_warehouse  { --st: #0B6E78; --st-bg: #DDF1F3; }
.st-in_transit       { --st: #1C6FB0; --st-bg: #E3F0FA; }
.st-arrived          { --st: #146C43; --st-bg: #E2F3EA; }
.st-delivered        { --st: #4A4E57; --st-bg: #E9EBEE; }
.st-cancelled        { --st: #6E6F75; --st-bg: #ECECEE; }

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: inset 4px 0 0 var(--st, var(--line));
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-no {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.card-sub { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: var(--fs-md); color: var(--muted); }
.card-place { color: var(--ink); font-weight: 600; }
.flag-missing { color: var(--red); font-weight: 700; }

.pill {
  flex: none;
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--st-bg, var(--paper));
  color: var(--st, var(--ink));
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}

.card-product h3 { font-weight: 700; overflow-wrap: anywhere; }
.card-product p { margin-top: 2px; color: var(--muted); font-size: var(--fs-base); overflow-wrap: anywhere; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb {
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  overflow: hidden;
  cursor: zoom-in;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-more { font-size: var(--fs-base); font-weight: 700; color: var(--muted); cursor: pointer; }
.thumbs-large .thumb { width: 92px; height: 92px; }

.specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
}
.specs dt, .money dt, .info dt { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.specs dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.specs-2 { margin-top: 14px; }

.money { display: grid; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.money > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.money dt { font-size: var(--fs-md); font-weight: 600; }
.money dd { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.money-total { padding: 6px 0; margin: 2px 0; border-top: 1px dashed var(--line-strong); border-bottom: 1px dashed var(--line-strong); }
.money-total dt { font-size: var(--fs-base); font-weight: 700; color: var(--ink); }
.money-total dd { font-size: var(--fs-xl); font-weight: 700; }
.money-balance { margin-top: 4px; padding: 9px 12px; border-radius: var(--r-md); }
.money-balance dt { color: inherit; font-size: var(--fs-md); font-weight: 700; }
.money-balance dd { font-weight: 700; }
.money-balance.owe { background: var(--red-tint); color: var(--red); }
.money-balance.clear { background: var(--green-tint); color: var(--green); }

.card-history {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--soft);
  font-size: var(--fs-xs);
}
.card-history-label { color: var(--muted); }
.card-history strong { color: var(--ink); font-weight: 700; }
.card-history time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.meta { font-size: var(--fs-md); color: var(--ink); }
.meta span { color: var(--muted); margin-right: 4px; }
.note {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--paper);
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
}

.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.card-actions .btn-primary { grid-column: 1 / -1; }
.detail .card-actions .btn-danger { grid-column: 1 / -1; }

.state-box {
  padding: 36px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}
.state-box strong { color: var(--ink); font-size: var(--fs-xl); }

/* ---------- Блок «Данные клиента» в карточке заказа ---------- */
.client-box {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--soft);
}
.client-box h4 { margin: 0 0 10px; font-size: var(--fs-md); font-weight: 700; }
.client-box .info { padding-top: 0; border-top: 0; }
.client-box.empty { border-style: dashed; color: var(--muted); font-size: var(--fs-md); }
.client-box.empty h4 { color: var(--ink); }

/* ---------- Список клиентов ---------- */
.clients { display: grid; gap: 10px; }
.client-row {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.client-row-name { font-size: var(--fs-xl); font-weight: 700; overflow-wrap: anywhere; }
.client-row-date { margin-top: 2px; font-size: var(--fs-sm); color: var(--muted); }
.client-row-sum { margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.client-row-sum .cl-debt { color: var(--ink); font-weight: 700; }
.client-row-sum .cl-debt-bad { color: var(--red); font-weight: 700; }
.client-row-contacts { display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.client-row-contacts a { font-weight: 700; text-decoration: none; }
.client-row-contacts a:hover { text-decoration: underline; }
.client-row-place { font-size: var(--fs-base); overflow-wrap: anywhere; }
.client-row-place b { display: block; font-weight: 700; }
.client-row-place span { color: var(--muted); }
.client-row-orders { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.supplier-row .client-row-place p { margin: 6px 0 0; }
.supplier-row .client-row-orders { align-content: center; }
.order-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.order-tag:hover { border-color: var(--ink); }
.order-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); }

/* ---------- Кнопка «+» на телефоне ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 15;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--hero);
  color: #fff;
  font-size: var(--fs-6xl);
  line-height: 1;
  box-shadow: 0 8px 20px rgba(21, 20, 23, 0.35), inset 0 -3px 0 var(--red);
  cursor: pointer;
}
body.no-scroll .fab { display: none; }

/* ---------- Окна ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: flex-end; justify-content: center; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); }
.modal-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 94vh;
  max-height: 94dvh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--surface);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 20px 20px; -webkit-overflow-scrolling: touch; }
.modal-foot {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

fieldset { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; font-size: var(--fs-lg); font-weight: 700; }

.grid-2, .grid-3 { display: grid; grid-template-columns: 1fr; column-gap: 12px; }

.calc {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--paper);
}
.calc-row { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-md); }
.calc-row b { text-align: right; font-variant-numeric: tabular-nums; }
.calc-total { margin: 4px 0; padding: 6px 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); font-size: var(--fs-lg); }
.calc-balance { font-size: var(--fs-lg); font-weight: 700; }
.calc-balance.owe b { color: var(--red); }
.calc-balance.clear b { color: var(--green); }

.photo-previews { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.pv { position: relative; width: 88px; height: 88px; }
.pv img { width: 100%; height: 100%; object-fit: cover; border: 1px solid var(--line); border-radius: var(--r-md); }
.pv-x {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-xl);
  line-height: 1;
  cursor: pointer;
}

.detail { display: grid; gap: 16px; }
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.info { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.info dd { overflow-wrap: anywhere; white-space: pre-line; }

/* История статусов заказа */
.status-history { padding-top: 14px; border-top: 1px solid var(--line); }
.status-history h3 { margin-bottom: 10px; font-size: var(--fs-base); }
.status-history ol { display: grid; gap: 9px; list-style: none; }
.status-history li { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-md); }
.status-history time { color: var(--muted); font-size: var(--fs-xs); text-align: right; }
.status-history-name { overflow-wrap: anywhere; }
.client-hero .status-history { margin-top: 18px; border-color: rgba(255,255,255,.2); }
.client-hero .status-history time { color: rgba(255,255,255,.68); }

.status-list { display: grid; gap: 8px; }
.status-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.status-option .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--st); }
.status-option:hover { background: var(--hover); }
.status-option.current { border-color: var(--st); background: var(--st-bg); color: var(--st); }

.link-input { margin: 4px 0 12px; font-size: var(--fs-md); }
.stack { display: grid; gap: 8px; }

/* ---------- Просмотр фото ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 11, 13, 0.95);
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 6px; }
.lb-close, .lb-nav {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: var(--fs-5xl);
  line-height: 1;
  cursor: pointer;
}
.lb-close { top: 14px; right: 14px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #fff; font-size: var(--fs-md); }

/* ---------- Сообщения ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--fs-base);
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }

/* =====================================================
   СТРАНИЦА КЛИЕНТА
   ===================================================== */

/* Верхний чёрный блок: номер заказа и маршрут по статусам */
.client-hero {
  position: relative;
  margin: 4px 0 12px;
  padding: 22px 20px 20px 26px;
  border-radius: var(--r-xl);
  background: var(--hero);
  color: #fff;
  overflow: hidden;
}
.client-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--red);
}
.client-hero h1 { font-size: var(--fs-2xl); font-weight: 500; overflow-wrap: anywhere; }
.client-hero h1 .num { white-space: nowrap; }
.client-hero-date { margin-top: 4px; color: rgba(255, 255, 255, 0.65); font-size: var(--fs-md); }
.client-hero-status {
  margin: 18px 0 16px;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.3;
}
.client-hero .cancelled-note { margin-top: 18px; color: #FFB3BC; font-weight: 700; }

/* Маршрут: шаги заказа */
.steps { list-style: none; }
.steps li {
  position: relative;
  padding: 0 0 12px 30px;
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--fs-base);
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 18px;
  bottom: -2px;
  width: 2px;
  background: rgba(255, 255, 255, 0.18);
}
.steps li:last-child::before { display: none; }
.steps .dot {
  position: absolute;
  left: 0;
  top: 3px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: var(--hero);
}
.steps li.done { color: rgba(255, 255, 255, 0.85); }
.steps li.done::before { background: var(--red); }
.steps li.done .dot { border-color: var(--red); background: var(--red); }
.steps li.current { color: #fff; font-weight: 700; }
.steps li.current .dot { border-color: #fff; background: var(--red); box-shadow: 0 0 0 4px rgba(181, 9, 25, 0.45); }

.client-block {
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.client-block h2 { margin-bottom: 12px; font-size: var(--fs-lg); }
.client-block .card-product { margin-bottom: 12px; }
.client-block .thumbs { margin-bottom: 4px; }
.client-block .money { border-top: 0; padding-top: 0; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.cancelled-note { color: var(--red); font-weight: 700; }
.notfound { text-align: center; padding: 36px 20px; }
.notfound p { margin-top: 8px; color: var(--muted); }

/* Блок «Данные для доставки» */
.delivery-block { border-color: var(--ink); border-width: 2px; }
.delivery-block.filled { border-color: var(--line); border-width: 1px; }
.delivery-intro { margin: -6px 0 16px; color: var(--muted); font-size: var(--fs-base); }
.delivery-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.delivery-head h2 { margin: 0; }
.delivery-head .btn { min-height: 40px; padding: 6px 14px; }
.delivery-view { display: grid; gap: 10px; }
.delivery-view dt { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.delivery-view dd { font-weight: 700; overflow-wrap: anywhere; white-space: pre-line; }
.delivery-note { margin-top: 12px; font-size: var(--fs-sm); color: var(--muted); }

/* Переключатель «Доставка по адресу / Пункт выдачи» */
.seg { margin: 0 0 14px; }
.seg legend { margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.seg-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: var(--r-md); background: var(--paper); }
.seg-options label { position: relative; }
.seg-options input {
  position: absolute;
  inset: 0;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}
.seg-options input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--focus-ring), inset 0 -2px 0 var(--red); }
.seg-options input:focus-visible + span { outline: 3px solid rgba(181, 9, 25, 0.45); outline-offset: 1px; }

.delivery-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }
.delivery-actions.two { grid-template-columns: 1fr 2fr; }
.delivery-privacy { margin-top: 12px; font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Планшет и компьютер ---------- */
@media (min-width: 641px) {
  .fab { display: none; }
  .toolbar { grid-template-columns: minmax(240px, 1fr) 160px 160px auto auto; align-items: end; }
  .toolbar .search { grid-column: auto; }
  .toolbar .btn { width: auto; }
  .toolbar-new { display: inline-flex; }
  .toolbar-clients { grid-template-columns: minmax(240px, 480px) auto; justify-content: space-between; }
  .chips { margin: 0 0 14px; padding: 2px 0 6px; flex-wrap: wrap; overflow: visible; }

  .summary { grid-template-columns: repeat(4, 1fr); }
  .summary-item { border-bottom: 0; border-right: 1px solid var(--line); }
  .summary-item:nth-child(2n) { border-right: 1px solid var(--line); }
  .summary-item:last-child { border-right: 0; }
  .summary-value { font-size: var(--fs-4xl); }

  .warehouse { flex-direction: row; align-items: center; justify-content: space-between; padding: 26px 30px 26px 36px; }
  .warehouse-address { font-size: var(--fs-4xl); }
  .warehouse .btn { align-self: center; flex: none; }

  .client-hero { padding: 28px 28px 26px 36px; }
  .client-hero h1 { font-size: var(--fs-5xl); }
  .client-block { padding: 22px 24px; }
}

/* Компьютер: вкладки в одной строке с логотипом */
@media (min-width: 860px) {
  .topbar-inner { flex-wrap: nowrap; padding: 0 16px; min-height: 64px; }
  #view-client .topbar-inner { padding: 10px 16px; }
  .section-menu-wrap { margin-left: 20px; margin-right: auto; }
  .topbar-actions { order: 3; }

  /* клиенты — строкой-таблицей */
  .client-row { grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 1fr) minmax(200px, 1.6fr) minmax(160px, 1fr); align-items: start; gap: 16px; }
}

@media (min-width: 721px) {
  .modal { align-items: center; padding: 24px; }
  .modal-sheet { max-width: 780px; max-height: 90vh; border-radius: var(--r-xl); }
  .modal-small .modal-sheet { max-width: 460px; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .modal-foot { grid-template-columns: auto auto; justify-content: end; }
  .modal-foot .btn { min-width: 160px; }
  .delivery-form .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 481px) and (max-width: 720px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* На телефоне шапка компактная, а выход находится в меню разделов. */
@media (max-width: 480px) {
  .brand-name { font-size: var(--fs-md); }
  .lang-switch button { min-width: 34px; padding: 0 7px; }
  .topbar-actions { gap: 0; }
  .topbar-actions .icon-btn { width: 40px; height: 40px; }
  /* На телефоне переключатель языка скрыт в шапке, чтобы осталось место для кнопок. */
  #view-admin .topbar .lang-switch { display: none; }
}

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

/* =====================================================
   ЭТАП A: роли, кабинеты, приглашения
   ===================================================== */

/* Вкладка «Байеры» видна только админу */
body:not(.is-admin) .admin-only { display: none !important; }

/* Чужой кабинет (админ смотрит): прячем всё, что меняет данные */
body.readonly [data-write] { display: none !important; }

/* Красная плашка «Вы смотрите кабинет …» */
.ws-banner { background: var(--red); color: #fff; }
.ws-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  font-size: var(--fs-md);
  font-weight: 700;
}
.ws-banner .btn { min-height: 38px; padding: 6px 14px; }

/* Склад: кнопки и пустое состояние */
.warehouse-actions { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.btn-on-dark { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.warehouse-empty { max-width: 60ch; margin-bottom: 14px; color: rgba(255, 255, 255, 0.82); font-size: var(--fs-base); }

/* Раздел «Байеры» */
.section-title { margin: 24px 4px 12px; font-size: var(--fs-lg); }
.b-lead { margin: -6px 0 14px; font-size: var(--fs-base); }
.b-sub { margin: 20px 0 8px; font-size: var(--fs-md); font-weight: 700; }
.invite-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.invite-result { margin-top: 14px; padding: 14px; border-radius: var(--r-md); background: var(--green-tint); }
.invite-result p { margin-bottom: 8px; color: var(--green); font-size: var(--fs-md); font-weight: 700; }
.stack-row { grid-template-columns: 1fr 1fr; }
.invites { display: grid; gap: 6px; }
.invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 4px 12px;
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: var(--fs-md);
}
.buyer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.buyer-actions .btn { min-height: 40px; padding: 6px 14px; }

/* Регистрация байера */
#join-done .btn { margin-top: 18px; }

@media (min-width: 641px) {
  .invite-row { grid-template-columns: 1fr auto; }
}

/* Строка байера на компьютере: имя | телефон | счётчики | статус | кнопки */
@media (min-width: 860px) {
  .buyer-row { grid-template-columns: minmax(180px, 1.3fr) minmax(140px, 1fr) minmax(180px, 1.4fr) auto auto; align-items: center; }
}

/* Подзаголовки внутри «Цена и оплата»: Товар / Доставка / Оплата клиента */
.money-sub {
  margin: 8px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-md);
  font-weight: 700;
}


/* =====================================================
   ТЁМНАЯ ТЕМА
   Включается в ⚙️ Настройки → Внешний вид.
   «Авто» — как в телефоне/компьютере.
   ===================================================== */
html[data-theme="dark"] {
  --bg: #111216;
  --surface: #24262B;
  --surface-raised: #303238;
  --surface-sunken: #1B1D21;
  --text: #FFFFFF;               /* 18.7:1 на фоне */
  --text-2: #A4A7AE;             /* 6.3:1 на карточке, 5.3:1 на поднятой поверхности */
  --text-3: #80868F;
  --border: #34373D;
  --border-strong: #464A52;
  --border-field: #7D838D;       /* 3.4:1 к полю */
  --accent: #D51E32;             /* кнопка: белый текст 5.2:1 */
  --accent-hover: #E53347;
  --accent-text: #FF6B78;        /* красный текст на тёмном: 5.5:1 (#D51E32 даёт только 2.9) */
  --accent-tint: #3A1A1E;
  --on-accent: #FFFFFF;
  --success: #3FB383;  --success-text: #4FC08F;  --success-tint: #15302A;
  --warning: #DCA43A;  --warning-text: #E9B95A;  --warning-tint: #33290F;
  --error: #E5484D;    --error-text: #FF7A7F;    --error-tint: #3A1A1C;
  --info: #4A8FDC;     --info-text: #6FA8E8;     --info-tint: #17283D;
  --neutral-btn: #F1F3F6;
  --neutral-btn-hover: #FFFFFF;
  --on-neutral-btn: #17191D;

  --ink-soft: #E6E7EA;
  --fill: #303238;
  --fill-2: #3A3D44;
  --seg-on: #4A4E56;
  --hero: #24262B;
  --hover: #303238;
  --field: #1B1D21;
  --topbar: rgba(17, 18, 22, 0.84);
  --danger-line: #5A242B;
  --invalid: #2A1316;
  --backdrop: rgba(0, 0, 0, 0.62);
  --focus-ring: rgba(255, 107, 120, 0.4);
  color-scheme: dark;
}
html[data-theme="dark"] .st-new              { --st: #7FA6FF; --st-bg: rgba(127, 166, 255, 0.16); }
html[data-theme="dark"] .st-awaiting_payment { --st: #F2B84B; --st-bg: rgba(242, 184, 75, 0.16); }
html[data-theme="dark"] .st-purchasing       { --st: #B59CFF; --st-bg: rgba(181, 156, 255, 0.16); }
html[data-theme="dark"] .st-china_warehouse  { --st: #4FD1DB; --st-bg: rgba(79, 209, 219, 0.15); }
html[data-theme="dark"] .st-in_transit       { --st: #6CB8F5; --st-bg: rgba(108, 184, 245, 0.16); }
html[data-theme="dark"] .st-arrived          { --st: #4CC38A; --st-bg: rgba(76, 195, 138, 0.16); }
html[data-theme="dark"] .st-delivered        { --st: #B4B8C2; --st-bg: rgba(180, 184, 194, 0.14); }
html[data-theme="dark"] .st-cancelled        { --st: #8E9099; --st-bg: rgba(142, 144, 153, 0.14); }
html[data-theme="dark"] .client-hero,
html[data-theme="dark"] .warehouse { border: 1px solid var(--line); }

/* =====================================================
   НАСТРОЙКИ, РЕГИСТРАЦИЯ, ВХОД ЧЕРЕЗ GOOGLE
   ===================================================== */
.gear-btn { display: inline-grid; place-items: center; font-size: 0; }

/* разделы в окне настроек */
.settings-body .s-section { padding: 0 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.settings-body .s-section:last-of-type { border-bottom: 0; margin-bottom: 0; }
.settings-body h3 { margin: 0 0 12px; font-size: var(--fs-base); font-weight: 700; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }

/* «или» между обычным входом и Google */
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--muted); font-size: var(--fs-sm); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google { gap: 10px; }
.switch-auth { margin: 18px 0 0; text-align: center; font-size: var(--fs-md); color: var(--muted); }
.switch-auth a { font-weight: 700; }

/* Прибыль: в сводке (5-я плитка) и в расчёте */
.summary-profit { grid-column: 1 / -1; border-right: 0 !important; border-top: 1px solid var(--line); }
.calc-cost { color: var(--muted); }
.calc-profit b { color: var(--green); }
.calc-profit.loss b { color: var(--red); }
.money-profit dd { color: var(--green); font-weight: 700; }
.money-profit.loss dd { color: var(--red); }
.money-cost dt, .money-cost dd { color: var(--muted); }
@media (min-width: 641px) {
  .summary { grid-template-columns: repeat(5, 1fr); }
  .summary-profit { grid-column: auto; border-top: 0; }
}

/* =====================================================
   УМНЫЙ ПОМОЩНИК
   ===================================================== */
.assistant {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.assistant-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.as-static { cursor: default; }
.as-title { flex: 1; }
.as-count {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--red-tint);
  color: var(--red);
  font-size: var(--fs-sm);
  text-align: center;
}
.as-count:empty { display: none; }
.as-caret { color: var(--muted); transition: transform 0.15s; }
.assistant.collapsed .as-caret { transform: rotate(-90deg); }
.assistant.collapsed .assistant-list { display: none; }
.assistant-list { display: grid; border-top: 1px solid var(--line); }
.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-md);
}
.hint:first-child { border-top: 0; }
.hint::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.hint.warn::before { background: #DCA43A; }
.hint.bad::before { background: var(--red); }
.hint.good::before { background: var(--green); }
.hint-text { flex: 1; overflow-wrap: anywhere; }
.hint .btn { min-height: 34px; padding: 4px 12px; font-size: var(--fs-sm); }
.hint-ok { padding: 12px 16px; color: var(--muted); font-size: var(--fs-md); }
.hint-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 6px 6px 6px 14px;
  border-radius: var(--r-md);
  background: var(--red-tint);
  color: var(--red);
  font-size: var(--fs-md);
  font-weight: 700;
}
.hint-filter .btn { min-height: 34px; width: 34px; padding: 0; color: var(--red); font-size: var(--fs-2xl); }

/* =====================================================
   🤖 ИИ-ПОМОЩНИК (только админ)
   ===================================================== */
.ai-box {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.ai-log { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; padding: 0 16px; }
.ai-log:not(:empty) { padding: 12px 16px; border-top: 1px solid var(--line); }
.ai-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: var(--fs-base);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-me { justify-self: end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.ai-bot { justify-self: start; background: var(--soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-error { color: var(--red); }
.ai-wait { color: var(--muted); }
.ai-examples { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.ai-examples .chip { min-height: 36px; padding: 0 12px; font-size: var(--fs-sm); white-space: normal; text-align: left; }
.ai-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
.ai-form textarea { min-height: 48px; resize: none; }
.ai-form .btn { align-self: end; }
.ai-note { margin: 0; padding: 0 16px 12px; font-size: var(--fs-xs); color: var(--muted); }

/* Ссылки на условия и политику под формами входа и регистрации */
.legal-links { margin: 10px 0 0; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.legal-links a { color: var(--muted); }

/* ↻ Кнопка «Обновить»: значок крутится, пока идёт загрузка */
.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.client-actions { display: flex; align-items: center; gap: 6px; }
@media (prefers-reduced-motion: reduce) {
  .spinning svg { animation: none; opacity: 0.5; }
}

/* Очень узкие телефоны: на странице клиента — только значок логотипа, компактные языки */
@media (max-width: 360px) {
  #view-client .brand-name { display: none; }
  #view-client .client-actions .icon-btn { width: 36px; height: 36px; }
}

/* =====================================================
   💱 КАЛЬКУЛЯТОР ВАЛЮТ
   ===================================================== */
.fx-row { display: grid; grid-template-columns: 1fr; gap: 0 10px; align-items: end; }
.fx-swap { width: 48px; justify-self: center; margin-bottom: 14px; font-size: var(--fs-2xl); }
.fx-result { margin: 4px 0 12px; padding: 16px; border-radius: var(--r-md); background: var(--soft); border: 1px solid var(--line); }
.fx-big { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fx-result .muted { margin-top: 4px; font-size: var(--fs-md); white-space: pre-wrap; }
.fx-actions .btn { width: 100%; }
.fx-table { display: grid; gap: 0; }
.fx-cell { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.fx-cell:first-child { border-top: 0; }
.fx-cell small { font-size: var(--fs-xs); }
@media (min-width: 641px) {
  .fx-row { grid-template-columns: 1fr 1.4fr auto 1.4fr; }
  .fx-actions .btn { width: auto; }
}

@media (max-width: 520px) {
  .topbar-inner { gap: 8px; }
}

/* ---------- Мои курсы ---------- */
.fx-my { display: grid; grid-template-columns: 1fr; gap: 0 10px; align-items: end; }
.fx-my .btn { margin-bottom: 14px; }
@media (min-width: 640px) { .fx-my { grid-template-columns: 1fr auto; } }
#my-rates .fx-cell { align-items: center; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.link-btn:hover { color: var(--primary); }
.fx-del { width: 36px; height: 36px; font-size: var(--fs-lg); }

/* ---------- Загрузка / подсказка вместо белого экрана ---------- */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center;
        font: 16px/1.5 system-ui, -apple-system, sans-serif; color: var(--muted, #8a8790); background: var(--paper, #17191D); }
.boot b { color: var(--ink, #fff); }

/* =====================================================
   💬 ТЕХПОДДЕРЖКА
   ===================================================== */
body.is-admin .buyer-only { display: none !important; }
.badge-wrap { position: relative; }
.badge {
  position: absolute; top: 3px; right: 1px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font: 700 11px/18px var(--font); text-align: center;
}
.badge-inline {
  display: inline-block; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: var(--fs-xs); font-weight: 600; line-height: 20px; text-align: center; vertical-align: middle;
}
.badge.hidden, .badge-inline.hidden { display: none; }
.support-log { display: grid; gap: 8px; max-height: 52vh; min-height: 120px; overflow-y: auto; padding: 4px 2px 12px; }
.support-who { font-size: var(--fs-2xs); opacity: .75; margin-bottom: 2px; }
.support-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.support-form textarea { min-height: 64px; resize: vertical; }
.support-tech { margin-top: 6px; font-size: var(--fs-xs); }
.support-tech pre { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-2xs); }
.support-threads { display: grid; gap: 8px; }
.support-thread {
  display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit;
}
.support-thread:hover { border-color: var(--ink); }
.support-thread.unread { border-color: var(--red); }
.support-thread-top { display: flex; align-items: center; gap: 6px; }
.support-thread-top small { margin-left: auto; }
.support-thread-last { font-size: var(--fs-md); overflow-wrap: anywhere; }

/* Telegram-уведомления */
.tg-status { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--soft); border: 1px solid var(--line); font-size: var(--fs-md); }
.tg-status.on { border-color: #2e9d5b; }
.tg-steps { margin: 0 0 14px; padding-left: 20px; font-size: var(--fs-md); color: var(--muted); display: grid; gap: 6px; }


/* ---------- Шапка кабинета: логотип слева, справа — ↻ и меню «☰ Раздел ▾» ---------- */
#view-admin .topbar-inner { flex-wrap: nowrap; min-height: 64px; padding: 10px 16px; }
#view-admin .brand { margin-right: auto; min-width: 0; }
#view-admin .topbar-actions { order: 2; }
#view-admin .section-menu-wrap { order: 3; margin: 0 0 0 4px; }
@media (max-width: 480px) {
  #view-admin .topbar-inner { min-height: 58px; padding: 8px 12px; gap: 6px; }
  #view-admin .brand { gap: 8px; }
  #view-admin .brand-mark { width: 32px; height: 32px; }
  .section-menu-btn { height: 40px; padding: 0 10px 0 11px; gap: 6px; font-size: var(--fs-md); }
  .section-menu-label { max-width: 96px; }
}
/* очень узкий телефон: только значок логотипа, чтобы название раздела поместилось */
@media (max-width: 360px) {
  #view-admin .brand-mark { width: 30px; height: 30px; }
}

/* =====================================================
   ГЛАВНАЯ (Заказы) — порядок: заголовок → цифры → склад →
   помощник → поиск и статусы → короткие карточки
   ===================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.page-title { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; line-height: 1.1; }
.page-sub { margin-top: 4px; font-size: var(--fs-md); color: var(--muted); }
.page-sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
#tab-orders .toolbar-new { display: none; }

/* 4 цифры: на телефоне 2×2, на компьютере в ряд */
#tab-home .summary { grid-template-columns: repeat(2, 1fr); }
#tab-home .summary-item { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#tab-home .summary-item:nth-child(2n) { border-right: 0; }
#tab-home .summary-item:nth-child(n+3) { border-bottom: 0; }
#tab-home .summary-item.summary-profit { grid-column: auto; }

/* Склад — компактная тёмная полоска */
#tab-home .warehouse { gap: 12px; margin: 0 0 14px; padding: 14px 16px 14px 20px; border-radius: var(--r-lg); }
#tab-home .warehouse::before { width: 4px; }
#tab-home .warehouse h2 { margin-bottom: 4px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
#tab-home .warehouse-address { font-size: var(--fs-base); line-height: 1.45; letter-spacing: .01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#tab-home .warehouse-contacts { gap: 6px; margin-top: 8px; }
#tab-home .contact { padding: 5px 11px; font-size: var(--fs-sm); }
#tab-home .warehouse-actions { display: flex; gap: 8px; }
#tab-home .warehouse-actions .btn { min-height: 38px; padding: 0 14px; font-size: var(--fs-md); }

#tab-home .assistant { margin-bottom: 14px; }

/* Поиск + кнопка «Даты», под ними — статусы */
.list-controls { margin-bottom: 6px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.dates-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; }
.dates-toggle[aria-expanded="true"] { border-color: var(--ink); }
.dates-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.dates-dot.hidden { display: none; }
.date-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: end; margin-top: 10px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.date-filters .btn { grid-column: 1 / -1; }
.date-filters.hidden { display: none; }
#tab-orders .chips { margin-top: 12px; margin-bottom: 12px; }
#tab-orders .chip { min-height: 38px; font-size: var(--fs-md); }

/* Короткая карточка заказа */
#tab-orders .orders { gap: 12px; }
#tab-orders .card { gap: 12px; padding: 14px 14px 14px 18px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-main { display: flex; gap: 12px; align-items: center; cursor: pointer; min-width: 0; }
.card-photo { position: relative; flex: none; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line);
  border-radius: 12px; background: var(--paper); overflow: hidden; cursor: zoom-in; }
.card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-photo span { position: absolute; right: 4px; bottom: 4px; padding: 1px 6px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.6); color: #fff; font-size: var(--fs-2xs); font-weight: 600; }
.card-photo-empty { display: grid; place-items: center; font-size: var(--fs-5xl); cursor: pointer; }
.card-info { min-width: 0; }
.card-info h3 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#tab-orders .card-sub { gap: 2px 10px; margin-top: 3px; font-size: var(--fs-sm); }

.card-money { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 0;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--line); overflow: hidden; }
.card-money > div { display: grid; gap: 2px; padding: 8px 10px; background: var(--soft); }
.card-money dt { font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); }
.card-money dd { font-size: var(--fs-base); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card-money .owe dd { color: var(--red); }
.card-money .clear dd, .card-money .profit dd { color: var(--green); }
.card-money .profit.loss dd { color: var(--red); }
#tab-orders .card .note { margin: 0; font-size: var(--fs-sm); }

#tab-orders .card-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
#tab-orders .card-actions .btn { min-height: 40px; padding: 0 10px; font-size: var(--fs-md); }
.card-more { position: relative; }
.card-more > summary { list-style: none; width: 44px; font-size: var(--fs-2xl); line-height: 1; }
.card-more > summary::-webkit-details-marker { display: none; }
.card-more[open] > summary { border-color: var(--ink); }
.card-more-menu { position: absolute; z-index: 15; right: 0; bottom: calc(100% + 6px); display: grid; gap: 2px; min-width: 200px;
  padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 14px 36px rgba(0,0,0,.2); }

@media (min-width: 760px) {
  #tab-orders .toolbar-new { display: inline-flex; align-items: center; gap: 6px; }
  #tab-home .summary { grid-template-columns: repeat(4, 1fr); }
  #tab-home .summary-item { border-bottom: 0; }
  #tab-home .summary-item:nth-child(2n) { border-right: 1px solid var(--line); }
  #tab-home .summary-item:last-child { border-right: 0; }
  #tab-home .warehouse { flex-direction: row; align-items: center; justify-content: space-between; }
  #tab-home .warehouse-actions { flex: none; }
  .date-filters { grid-template-columns: 1fr 1fr auto; }
  .date-filters .btn { grid-column: auto; }
}
#tab-home .summary-profit { border-top: 0; }
#tab-orders .card-actions .btn-primary { grid-column: auto; }
#tab-orders .card-actions { grid-template-columns: 1fr 1.4fr auto; }
#tab-orders .card-actions .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================
   ✉️ СООБЩИТЬ КЛИЕНТУ
   ===================================================== */
.notify-langs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.notify-langs-label { margin-right: 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.notify-lang { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md); font-weight: 700; cursor: pointer; }
.notify-lang.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.notify-text { width: 100%; min-height: 190px; resize: vertical; line-height: 1.5; }
.notify-auto { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: var(--fs-md); color: var(--muted); cursor: pointer; }
.notify-auto input { width: 18px; height: 18px; }
#notify-to { margin: 8px 0 4px; }
#notify-warn { margin: 4px 0 8px; }

/* Карточка: [Открыть] [Сообщить клиенту] [⋯] */
#tab-orders .card-actions { grid-template-columns: .9fr 1.8fr auto; }
body.readonly #tab-orders .card-actions { grid-template-columns: 1fr auto; }
.btn-notify { font-weight: 700; }

/* =====================================================
   🧮 РАСЧЁТ ЦЕНЫ ДЛЯ КЛИЕНТА
   ===================================================== */
.quote-modes { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.quote-modes .notify-lang { min-height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.quote-save { padding: 6px 0 0; font-size: var(--fs-sm); color: var(--primary); text-decoration: underline; }
#tab-quote .field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
#tab-quote .grid-2, #tab-quote .grid-3 { margin-bottom: 4px; }

/* Результат: крупная цена для клиента */
.quote-price-box { display: grid; gap: 2px; margin: 4px 0 14px; padding: 16px; border-radius: var(--r-md);
  background: var(--hero); color: #fff; }
.quote-price-label { font-size: var(--fs-sm); font-weight: 600; color: rgba(255,255,255,.7); }
.quote-price { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quote-unit { font-size: var(--fs-md); color: rgba(255,255,255,.75); }
.quote-unit b { color: #fff; }
.quote-result.q-empty .quote-price-box { opacity: .55; }
#q-wa.disabled { opacity: .5; pointer-events: none; }
.quote-rates > summary { cursor: pointer; font-size: var(--fs-lg); font-weight: 700; margin-bottom: 4px; }

/* Плавающая плашка с ценой на странице расчёта */
.quote-bar { position: fixed; left: 50%; transform: translateX(-50%); z-index: 14;
  bottom: calc(14px + env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px;
  border: 0; border-radius: 14px; background: var(--hero); color: #fff; font: inherit; font-size: var(--fs-md); font-weight: 700;
  box-shadow: 0 10px 28px rgba(0,0,0,.28); cursor: pointer; }
.quote-bar b { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 500; font-variant-numeric: tabular-nums; }
.quote-bar.hidden { display: none; }
#tab-quote { padding-bottom: 110px; }

/* =====================================================
   💸 ДОЛГИ
   ===================================================== */
.summary-link { cursor: pointer; }
.summary-link:hover { background: var(--soft); }
.summary-link:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.debts-total { display: grid; gap: 2px; margin: 0 0 14px; padding: 16px; border-radius: var(--r-md); background: var(--hero); color: #fff; }
.debts-total:empty { display: none; }
.debts-total-label { font-size: var(--fs-sm); font-weight: 600; color: rgba(255,255,255,.7); }
.debts-total b { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.debts-total-sub { font-size: var(--fs-md); color: rgba(255,255,255,.75); }
.debts { display: grid; gap: 12px; }
.debt-card { display: grid; gap: 12px; padding: 16px 16px 16px 20px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: inset 4px 0 0 var(--line-strong); }
.debt-card.overdue { box-shadow: inset 4px 0 0 var(--red); }
.debt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.debt-head h3 { font-size: var(--fs-xl); font-weight: 700; overflow-wrap: anywhere; }
.debt-meta { margin-top: 2px; font-size: var(--fs-md); }
.debt-sum { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; color: var(--red); text-align: right; font-variant-numeric: tabular-nums; }
.debt-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.debt-flag { padding: 3px 10px; border-radius: var(--r-pill); background: var(--soft); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600; }
.debt-flag.late { background: var(--red-tint); border-color: transparent; color: var(--red); }
.muted-flag { color: var(--muted); }
.debt-orders { display: grid; gap: 4px; }
.debt-order { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: baseline; width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm); background: var(--soft); color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer; }
.debt-order:hover { background: var(--paper); }
.debt-order-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.debt-order-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.debt-order b { font-variant-numeric: tabular-nums; }
.debt-order small { grid-column: 1 / -1; }

/* =====================================================
   📊 ОТЧЁТ (прибыль)
   ===================================================== */
.r-export { align-self: flex-end; }
.r-summary { display: grid; gap: 10px; margin: 4px 0 14px; }
.r-main { display: grid; gap: 2px; padding: 16px; border-radius: var(--r-md); background: var(--hero); color: #fff; }
.r-main-label { font-size: var(--fs-sm); font-weight: 600; color: rgba(255,255,255,.7); }
.r-main b { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: #7BE0A6; }
.r-main.neg b { color: #FF8A96; }
.r-main-sub { font-size: var(--fs-md); color: rgba(255,255,255,.75); }
.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.r-cell { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.r-cell span { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.r-cell b { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.r-cell.neg b { color: var(--red); }
.r-list { display: grid; gap: 8px; }
.r-row { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.r-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.r-name { font-size: var(--fs-lg); font-weight: 700; overflow-wrap: anywhere; }
.r-profit { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-profit.pos { color: var(--green); }
.r-profit.neg { color: var(--red); }
.r-bar { height: 6px; border-radius: 3px; background: var(--paper); overflow: hidden; }
.r-bar i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.r-bar.neg i { background: var(--red); }
.r-meta { font-size: var(--fs-sm); color: var(--muted); }
.r-delta { font-weight: 700; white-space: nowrap; }
.r-delta.up { color: var(--green); }
.r-delta.down { color: var(--red); }
@media (min-width: 720px) { .r-grid { grid-template-columns: repeat(4, 1fr); } }

/* =====================================================
   📦 ПАРТИИ (несколько заказов одним карго)
   ===================================================== */
.batch-tag { padding: 1px 8px; border-radius: var(--r-pill); background: var(--soft); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600; color: var(--ink); }
.sh-list { display: grid; gap: 12px; }
.sh-card { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.sh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sh-head h3 { font-size: var(--fs-xl); font-weight: 700; overflow-wrap: anywhere; }
.sh-sub { margin-top: 2px; font-size: var(--fs-md); }
.sh-sum { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.sh-mix { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-meta { font-size: var(--fs-sm); }
.sh-summary { margin: 4px 0 8px; padding: 12px 14px; border-radius: var(--r-md); background: var(--soft); border: 1px solid var(--line); font-size: var(--fs-md); }
.sh-summary:empty { display: none; }
.sh-sum-big { margin-top: 2px; font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.sh-warn { margin: 6px 0; font-size: var(--fs-sm); font-weight: 600; color: var(--red); }
.sh-orders { display: grid; gap: 6px; margin-bottom: 10px; }
.sh-order { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.sh-order.off { opacity: .55; }
.sh-order-main { grid-column: 1; overflow-wrap: anywhere; }
.sh-order-nums { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-order-nums b { color: var(--ink); }
.sh-x { grid-column: 2; grid-row: 1 / span 2; width: 36px; height: 36px; font-size: var(--fs-lg); }
.sh-picker { display: grid; gap: 8px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--soft); }
.sh-pick-list { display: grid; gap: 4px; max-height: 280px; overflow-y: auto; }
.sh-pick { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); cursor: pointer; font-size: var(--fs-md); }
.sh-pick input { width: 18px; height: 18px; grid-row: 1 / span 2; }
.sh-pick-main { grid-column: 2; overflow-wrap: anywhere; }
.sh-pick-w { grid-column: 3; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.sh-pick .pill { grid-column: 2 / span 2; justify-self: start; }
.sh-status-box, .sh-notify { margin-top: 14px; }
.sh-status-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sh-notify-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: var(--fs-md); }
.sh-notify-row .btn { min-height: 38px; padding: 0 12px; }
#sh-delete { margin-top: 16px; width: 100%; }
.sh-warn.info { color: var(--muted); font-weight: 500; }

/* =====================================================
   📥 ЗАЯВКИ ПО ССЫЛКЕ
   ===================================================== */
.req-tag { background: var(--red-tint); border-color: transparent; color: var(--red); }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.rq-title { margin-bottom: 8px; font-size: var(--fs-3xl); line-height: 1.25; }
#request-content .client-block form { margin-top: 12px; }
#request-content .field.has-error input, #request-content .field.has-error textarea { border-color: var(--red); }
#request-content textarea { width: 100%; resize: vertical; line-height: 1.5; }
.rq-sent { text-align: center; display: grid; gap: 12px; }
.rq-check { margin: 4px auto 0; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--green-tint); color: var(--green); font-size: var(--fs-5xl); font-weight: 700; }
.rq-num { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; font-variant-numeric: tabular-nums; }
.rq-to { margin: -2px 0 8px; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }

/* ---- Команда (помощники) ---- */
body.is-staff .owner-only { display: none !important; }
.team-note { background: #eef6ff; border: 1px solid #b9d7f5; color: #17406b; padding: 10px 12px; border-radius: 10px; font-size: var(--fs-md); }
.tm-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.tm-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line, #e3e3e8); border-radius: 10px; }
.tm-row .link-input { width: 100%; margin-top: 6px; }
.tm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 6px 10px; font-size: var(--fs-sm); }

/* ---- Аналитика (дашборд) ---- */
.an-grid { display: grid; gap: 14px; margin-top: 8px; }
.an-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.an-kpi { display: grid; gap: 2px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.an-kpi span { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.an-kpi b { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.an-kpi.good b { color: var(--green); }
.an-kpi.neg b, .an-kpi.warn b { color: var(--red); }
.an-kpi.wide { grid-column: 1 / -1; }
.an-delta { font-style: normal; font-size: var(--fs-xs); font-weight: 600; }
.an-delta.up { color: var(--green); }
.an-delta.down { color: var(--red); }
.an-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.an-card h3 { margin: 0 0 12px; font-size: var(--fs-base); }
.an-legend { display: flex; gap: 14px; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 8px; }
.an-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.an-legend i.rev, .an-bars i.rev { background: var(--muted); opacity: .55; }
.an-legend i.pro, .an-bars i.pro { background: var(--green); }
.an-bars i.pro.neg { background: var(--red); }
.an-cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; height: 190px; align-items: stretch; }
.an-col { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; border-radius: 6px; }
.an-col.on, .an-col:hover { background: var(--hover); }
.an-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-height: 0; }
.an-bars i { display: block; width: 42%; max-width: 16px; border-radius: 4px 4px 0 0; min-height: 0; }
.an-lbl { font-size: var(--fs-2xs); color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.an-readout { margin: 10px 0 0; font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.an-readout b { color: var(--ink); }
.an-donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.an-donut { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.an-donut > div { width: 88px; height: 88px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; }
.an-donut b { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 500; line-height: 1.1; }
.an-donut span { font-size: var(--fs-2xs); color: var(--muted); }
.an-legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; min-width: 150px; }
.an-legend-list li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.an-legend-list li i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.an-legend-list li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.an-hrow { margin-bottom: 12px; }
.an-hrow:last-child { margin-bottom: 0; }
.an-hline { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); }
.an-hname { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.an-hline b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-hbar { height: 8px; background: var(--hover); border-radius: var(--r-pill); margin-top: 5px; overflow: hidden; }
.an-hbar i { display: block; height: 100%; background: var(--green); border-radius: var(--r-pill); }
.an-hbar.warn i { background: var(--red); }
.an-hbar.neg i { background: var(--red); }
.an-none { margin: 0; }
@media (min-width: 760px) {
  .an-kpis { grid-template-columns: repeat(4, 1fr); }
  .an-grid { grid-template-columns: repeat(2, 1fr); }
  .an-kpis, .an-card.wide { grid-column: 1 / -1; }
  .an-cols { height: 240px; }
  .an-lbl { font-size: var(--fs-xs); }
}

/* Аналитика: упрощённая верхняя часть */
.an-top { grid-column: 1 / -1; display: grid; gap: 12px; }
.an-insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.an-insights li { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r-sm); font-size: var(--fs-md); }
.an-insights li.up { border-left-color: var(--green); }
.an-insights li.down { border-left-color: var(--red); }
.an-hero { display: grid; gap: 2px; padding: 18px; border-radius: var(--r-md); background: var(--hero); color: #fff; }
.an-hero span { font-size: var(--fs-sm); font-weight: 600; color: rgba(255,255,255,.7); }
.an-hero b { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: #7BE0A6; }
.an-hero.neg b { color: #FF8A94; }
.an-hero small { font-size: var(--fs-sm); color: rgba(255,255,255,.7); }
.an-hero .an-delta.up { color: #7BE0A6; }
.an-hero .an-delta.down { color: #FF8A94; }
.an-kpis3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.an-kpis3 .an-kpi { padding: 12px 10px; }
.an-kpis3 .an-kpi b { font-size: var(--fs-base); }
.an-kpis3 .an-kpi small { font-size: var(--fs-2xs); color: var(--muted); font-family: var(--font); }
.an-more summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); padding: 6px 0 10px; }
.an-card.att { grid-column: 1 / -1; }
.an-live { margin: 0 0 8px; font-size: var(--fs-md); font-weight: 700; }
.an-ok { margin: 0; color: var(--green); font-weight: 700; font-size: var(--fs-md); }
.an-att-head { margin: 12px 0 6px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.an-att { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin-bottom: 6px; background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r-sm); font: inherit; font-size: var(--fs-md); color: inherit; text-align: left; cursor: pointer; }
.an-att.warn { border-left-color: #D98A00; }
.an-att.bad { border-left-color: var(--red); }
.an-att:hover { background: var(--hover); }
.an-att span { min-width: 0; overflow-wrap: anywhere; }
.an-att i { font-style: normal; color: var(--muted); font-size: var(--fs-xl); }
.an-tabs { margin: 0 0 14px; }

/* Аналитика: цель на месяц */
.an-card.goal { grid-column: 1 / -1; }
.an-goal-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.an-goal-line b { font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: 500; }
.an-goal-line span { color: var(--muted); font-size: var(--fs-md); }
.an-goal-bar { height: 12px; background: var(--hover); border-radius: var(--r-pill); margin: 10px 0; overflow: hidden; }
.an-goal-bar i { display: block; height: 100%; background: var(--green); border-radius: var(--r-pill); transition: width .4s; }
.an-goal-note { margin: 0 0 12px; font-size: var(--fs-md); color: var(--muted); }
.an-goal-form { display: flex; gap: 8px; flex-wrap: wrap; }
.an-goal-form input { flex: 1; min-width: 150px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--field); color: var(--ink); font: inherit; }

/* ---- Массовые действия ---- */
.sel-box { display: none; align-items: center; }
body.selecting .sel-box { display: inline-flex; margin-right: 4px; }
.sel-box input { position: absolute; opacity: 0; pointer-events: none; }
.sel-box span { width: 24px; height: 24px; border: 2px solid var(--line-strong); border-radius: 7px; background: var(--field); display: inline-block; position: relative; flex: none; }
.sel-box input:checked + span { background: var(--primary); border-color: var(--primary); }
.sel-box input:checked + span::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 12px; border: solid var(--on-primary); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
body.selecting #orders .card { cursor: pointer; }
body.selecting #orders .card.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
body.selecting .card-actions, body.selecting #fab { display: none; }
.bulk-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line-strong); box-shadow: 0 -8px 24px rgba(0,0,0,.14); }
.bulk-bar #bulk-count { font-weight: 700; margin-right: auto; }
.bq-list { display: grid; gap: 8px; margin-top: 12px; }
.bq-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.bq-row span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.bq-row.done { opacity: .6; }
.q-for { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--red-tint); border: 1px solid var(--danger-line); border-radius: var(--r-md); font-weight: 700; font-size: var(--fs-md); }
body.selecting #orders .card-actions { display: none !important; }
body.selecting #tab-orders { padding-bottom: 96px; }
body.selecting .sel-box + .order-no { margin-right: auto; }

/* Меню по группам, необязательные разделы */
.menu-group { display: block; padding: 10px 12px 4px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.r-back { margin-bottom: 8px; }
.an-detail { margin-top: 4px; }
.check-line { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-weight: 600; }
.check-line input { width: 20px; height: 20px; }

/* Подсказка для нового байера */
.onboard-card { margin: 0 0 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--r-lg); }
.ob-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ob-head h2 { margin: 0; font-size: var(--fs-xl); }
.ob-head span { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.ob-bar { height: 8px; background: var(--hover); border-radius: var(--r-pill); margin: 10px 0 12px; overflow: hidden; }
.ob-bar i { display: block; height: 100%; background: var(--green); border-radius: var(--r-pill); }
.ob-step { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; margin-bottom: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ob-step:hover:not(:disabled) { background: var(--hover); }
.ob-step b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--line); font-size: var(--fs-sm); flex: none; }
.ob-step.done { opacity: .6; cursor: default; }
.ob-step.done b { background: var(--green); color: #fff; }
.ob-step span { flex: 1; min-width: 0; font-weight: 700; font-size: var(--fs-md); }
.ob-step i { font-style: normal; color: var(--muted); font-size: var(--fs-xl); }
.ob-hide { margin-top: 4px; }

/* =====================================================
   ДИЗАЙН v2: спокойнее и компактнее (особенно на телефоне)
   ===================================================== */

/* Шапка: на узком экране только значок, чтобы не налезало на меню */
@media (max-width: 420px) {
  #view-client .topbar .brand-name, #view-request .topbar .brand-name { display: none; }
}

/* Заголовок раздела: название сверху, кнопки аккуратной строкой под ним */
.page-head { flex-wrap: wrap; align-items: flex-start; }
.page-head > div:first-child { flex: 1 1 200px; min-width: 0; }
.page-sub { max-width: 60ch; line-height: 1.45; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-pill { border-radius: var(--r-pill); min-height: 36px; padding: 0 14px; font-size: var(--fs-md); white-space: nowrap; }
@media (max-width: 640px) {
  .page-head { margin: 4px 0 12px; }
  .page-title { font-size: var(--fs-4xl); }
  .head-actions { width: 100%; }
}

/* Сводка: тихие плитки, нули серые, а не красные */
#tab-home .summary { margin-bottom: 6px; }
#tab-home .summary-item { padding: 12px 14px; gap: 2px; }
#tab-home .summary-label { font-size: var(--fs-xs); }
#tab-home .summary-value { font-size: var(--fs-xl); line-height: 1.3; }
.summary-value .zero, .summary-value .zero small { color: var(--muted) !important; }
#tab-home .fine-print { font-size: var(--fs-xs); margin: 0 0 12px; }

/* Склад: на телефоне одна строка, по нажатию раскрывается */
@media (max-width: 640px) {
  #tab-home .warehouse { padding: 12px 14px 12px 18px; gap: 8px; }
  #tab-home .warehouse h2 { cursor: pointer; display: flex; align-items: center; justify-content: flex-start; gap: 6px; margin: 0; }
  #tab-home .warehouse h2::after { content: "▾"; margin-left: auto; font-size: var(--fs-md); color: rgba(255,255,255,.6); transition: transform .15s; }
  #tab-home .warehouse.open h2::after { transform: rotate(180deg); }
  #tab-home .warehouse-address { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-md); }
  #tab-home .warehouse.open .warehouse-address { -webkit-line-clamp: unset; }
  #tab-home .warehouse:not(.open) .warehouse-contacts,
  #tab-home .warehouse:not(.open) #wh-edit { display: none; }
  #tab-home .warehouse-actions .btn { min-height: 34px; font-size: var(--fs-sm); }
}

/* Помощник: одна строка, пока не раскроете */
#tab-home .assistant-head { padding: 12px 14px; }

/* Карточка заказа: компактнее, деньги одной полоской */
#tab-orders .card { gap: 10px; padding: 14px 14px 14px 18px; }
#tab-orders .card-photo, #tab-orders .card-photo-empty { width: 52px; height: 52px; flex: none; border-radius: 12px; font-size: var(--fs-3xl); }
#tab-orders .card-main { gap: 12px; align-items: center; }
#tab-orders .card-info h3 { font-size: var(--fs-lg); line-height: 1.3; }
#tab-orders .card-sub { font-size: var(--fs-sm); }
.card-pay { display: grid; gap: 6px; padding: 10px 12px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-md); }
.card-pay.none { display: flex; gap: 12px; align-items: center; font-size: var(--fs-md); }
.pay-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pay-line b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.pay-owe { font-size: var(--fs-sm); font-weight: 600; color: var(--red); }
.pay-ok { font-size: var(--fs-sm); font-weight: 600; color: var(--green); }
.pay-bar { height: 6px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.pay-bar i { display: block; height: 100%; background: #D98A00; border-radius: var(--r-pill); }
.pay-bar.full i { background: var(--green); }
.pay-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.pay-profit { font-weight: 700; color: var(--green); }
.pay-profit.loss { color: var(--red); }
.pay-paid { color: var(--muted); font-size: var(--fs-sm); }
#tab-orders .card-history { padding: 0 2px; background: none; border: 0; font-size: var(--fs-xs); }
#tab-orders .card-actions { gap: 6px; }
#tab-orders .card-actions .btn { min-height: 40px; font-size: var(--fs-md); }

/* Пустые списки: дружелюбно, с картинкой */
#empty, .state-box[id$="-empty"] { padding: 32px 20px; text-align: center; line-height: 1.5; color: var(--muted); }
#empty::before, .state-box[id$="-empty"]::before { content: "📭"; display: block; font-size: var(--fs-6xl); margin-bottom: 8px; }
#empty strong { display: block; color: var(--ink); font-size: var(--fs-xl); margin-bottom: 4px; }

/* Поля и блоки: чуть больше воздуха и мягче углы */
.client-block { border-radius: var(--r-lg); }
.field > span { font-size: var(--fs-sm); }

/* Формы на телефоне: короткие поля по два в ряд — форма вдвое короче */
@media (max-width: 640px) and (min-width: 340px) {
  #tab-quote .grid-2, #tab-quote .grid-3,
  #order-form .grid-2, #order-form .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #tab-quote .field, #order-form .field { min-width: 0; }
  #tab-quote select, #order-form select { text-overflow: ellipsis; }
  #tab-quote .field > span, #tab-quote .field > label, #order-form .field > span { font-size: var(--fs-xs); }
}
@media (max-width: 640px) and (min-width: 340px) {
  #tab-quote .grid-2, #tab-quote .grid-3, #order-form .grid-2, #order-form .grid-3 { align-items: start; }
  #tab-quote .grid-2 .field > span, #tab-quote .grid-3 .field > span, #tab-quote .grid-3 .field > label,
  #order-form .grid-2 .field > span, #order-form .grid-3 .field > span { min-height: 2.7em; display: flex; align-items: flex-end; line-height: 1.3; }
  #tab-quote select, #order-form select { padding-right: 26px; font-size: var(--fs-md); }
}
#tab-quote .quote-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#tab-quote .quote-modes .notify-lang { padding: 4px 10px; font-size: var(--fs-xs); min-height: 30px; }

/* Знак в шапке: в светлой теме тёмная плитка (на белом не теряется), в тёмной — белая */
.brand-mark.bm-on-dark { display: none; }
html[data-theme="dark"] .brand-mark.bm-on-light { display: none; }
html[data-theme="dark"] .brand-mark.bm-on-dark { display: block; }

/* Группы меню: цветные заголовки, сворачиваются нажатием */
.section-menu .menu-group { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px 6px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; text-align: left; border-radius: 8px; }
.section-menu .menu-group:hover { background: var(--soft); }
.section-menu .menu-group i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.section-menu .menu-group span { flex: 1; }
.section-menu .menu-group .mg-caret { font-size: var(--fs-base); transition: transform .15s; }
.section-menu .menu-group.closed .mg-caret { transform: rotate(-90deg); }
.mg-main { color: #2F6FDE; }
.mg-money { color: #27966C; }
.mg-more { color: #8A5CF6; }
html[data-theme="dark"] .mg-main { color: #7FA6FF; }
html[data-theme="dark"] .mg-money { color: #4CC38A; }
html[data-theme="dark"] .mg-more { color: #B59CFF; }
.section-menu .tab.mg-hidden { display: none !important; }
/* открытый раздел виден всегда, даже в свёрнутой группе */
.section-menu .tab.mg-hidden.active { display: flex !important; }
.section-menu .tab[data-group="main"].active::after { background: #2F6FDE; }
.section-menu .tab[data-group="money"].active::after { background: #27966C; }
.section-menu .tab[data-group="more"].active::after { background: #8A5CF6; }

/* =====================================================
   ЕДИНЫЙ СТИЛЬ: одинаковые «кирпичики» во всех разделах
   (тени, кнопки, поля, плашки, иконки, анимации)
   ===================================================== */
:root {
  --shadow-sm: 0 1px 2px rgba(16, 16, 22, .04), 0 2px 6px rgba(16, 16, 22, .05);
  --shadow-md: 0 10px 30px rgba(16, 16, 22, .12);
  --shadow-lg: 0 24px 60px rgba(16, 16, 22, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --warn: #8A5A0B;
  --warn-tint: #FDF1DC;
  --r-btn: 12px;
}
html[data-theme="dark"] { --shadow-sm: none; --shadow-md: 0 10px 30px rgba(0,0,0,.45); --shadow-lg: 0 24px 60px rgba(0,0,0,.6); --warn: #F2B84B; --warn-tint: rgba(242,184,75,.14); }

/* Иконки: по центру строки, не сжимаются */
.ico { display: inline-block; flex: none; vertical-align: -0.18em; }
.btn .ico, .batch-tag .ico, .pay-ok .ico, .an-ok .ico { vertical-align: middle; }
.batch-tag { display: inline-flex; align-items: center; gap: 4px; }
.pay-ok { display: inline-flex; align-items: center; gap: 4px; }
.as-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--warn-tint); color: var(--warn); font-size: 0; }
.card-photo-empty { display: grid; place-items: center; color: var(--muted); background: var(--soft); }
#wh-title { display: flex; align-items: center; gap: 6px; }
.sh-warn { display: flex; gap: 8px; align-items: flex-start; }
.sh-warn .ico { margin-top: 1px; }
.icon-btn .ico { display: block; }
.rq-check .ico { display: block; }
.an-ok { display: flex; align-items: center; gap: 6px; }
.ob-step b .ico { display: block; }

/* Карточки и блоки: мягкая тень в светлой теме, одинаковые углы */
.client-block, .an-card, .an-kpi, .summary, .assistant, .sh-card, .onboard-card,
.r-row, .tm-row, .supplier-card, .client-card, .r-summary .r-cell {
  box-shadow: var(--shadow-sm);
}
/* у карточек заказов и долгов цветная полоска слева — тень добавляем к ней, а не вместо */
.card { box-shadow: inset 4px 0 0 var(--st, var(--line)), var(--shadow-sm); }
.debt-card { box-shadow: inset 4px 0 0 var(--line-strong), var(--shadow-sm); }
.debt-card.overdue { box-shadow: inset 4px 0 0 var(--red), var(--shadow-sm); }
.card, .client-block, .an-card, .sh-card, .onboard-card, .assistant, .summary { border-radius: 16px; }
@media (hover: hover) {
  #tab-orders .card { transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
  #tab-orders .card:hover { box-shadow: inset 4px 0 0 var(--st, var(--line)), var(--shadow-md); transform: translateY(-1px); }
}

/* Кнопки: один размер, один угол, лёгкое нажатие */
.btn { border-radius: var(--r-btn); transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: var(--fs-md); border-radius: 10px; }
.btn-pill { border-radius: var(--r-pill); }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .menu-group:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

/* Поля ввода: одинаковые, с мягкой подсветкой при вводе */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--focus-ring); }

/* Предупреждения («Нет адреса», «Нет цены») — спокойная жёлтая плашка, а не красная надпись */
.flag-missing { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--r-pill); background: var(--warn-tint); color: var(--warn); font-weight: 600; font-size: var(--fs-xs); line-height: 1.6; }

/* Плашки статусов: одного размера везде */
.pill { padding: 3px 10px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; }

/* Чипы-фильтры */
.chip { transition: background .15s, border-color .15s, color .15s; }

/* Окна: плавно выезжают снизу (на компьютере — появляются по центру) */
@keyframes ula-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ula-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ula-pop { from { transform: translateY(-6px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.open .modal-backdrop { animation: ula-fade .18s ease-out; }
.modal.open .modal-sheet { animation: ula-sheet .26s var(--ease); box-shadow: var(--shadow-lg); }
.section-menu:not(.hidden) { animation: ula-pop .16s var(--ease); box-shadow: var(--shadow-md); }
.toast { box-shadow: var(--shadow-md); transition: opacity .2s, transform .25s var(--ease); }
.card-more-menu { box-shadow: var(--shadow-md); animation: ula-pop .14s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Пустые списки: аккуратная иконка вместо эмодзи */
#empty::before, .state-box[id$="-empty"]::before {
  content: ""; width: 44px; height: 44px; margin: 0 auto 10px; background: var(--muted); opacity: .55;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M22 12h-6l-2 3h-4l-2-3H2'/><path d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M22 12h-6l-2 3h-4l-2-3H2'/><path d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z'/></svg>") center / contain no-repeat;
  font-size: 0;
}

/* Заголовки разделов — один стиль */
.page-title { letter-spacing: -.01em; }
.client-block h2, .an-card h3 { letter-spacing: -.005em; }
@media (max-width: 420px) { #tab-orders .card-history-label { display: none; } #tab-orders .card-history { flex-wrap: nowrap; } #tab-orders .card-history strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* Переключатели (вкл/выкл) вместо галочек в Настройках */
.seg-switches { display: grid; gap: 2px; }
.check-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-weight: 600; cursor: pointer; }
.check-line span { order: 1; }
.check-line input[type="checkbox"] { order: 2; -webkit-appearance: none; appearance: none; flex: none; width: 46px; height: 28px; margin: 0; border-radius: var(--r-pill);
  background: var(--line-strong); position: relative; cursor: pointer; transition: background .18s; }
.check-line input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.check-line input[type="checkbox"]:checked { background: var(--green); }
.check-line input[type="checkbox"]:checked::after { transform: translateX(18px); }
.check-line input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--focus-ring); }
.check-line input[type="checkbox"] { min-height: 0 !important; height: 28px !important; width: 46px !important; padding: 0 !important; border: 0 !important; box-sizing: border-box; }

/* Шапка справа: кнопка раздела и «обновить» в одном стиле — мягкие, без рамок */
.topbar-actions .gear-btn, #refresh-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--soft); color: var(--ink); transition: background .15s, transform .08s; }
.topbar-actions .gear-btn:hover, #refresh-btn:hover { background: var(--hover); }
.topbar-actions .gear-btn:active, #refresh-btn:active { transform: scale(.95); }
#refresh-btn svg { width: 19px; height: 19px; }
.section-menu-btn { height: 40px; padding: 0 10px 0 5px; gap: 8px; border: 0; border-radius: 12px; background: var(--soft); box-shadow: none; font-weight: 700; }
.section-menu-btn:hover, .section-menu-btn[aria-expanded="true"] { border: 0; background: var(--hover); }
.section-menu-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none; }
.section-menu-ico .ico { display: block; }
.section-menu-ico.g-main  { background: rgba(47, 111, 222, .12); color: #2F6FDE; }
.section-menu-ico.g-money { background: rgba(30, 158, 98, .13);  color: #27966C; }
.section-menu-ico.g-more  { background: rgba(138, 92, 246, .13); color: #8A5CF6; }
html[data-theme="dark"] .section-menu-ico.g-main  { background: rgba(127, 166, 255, .16); color: #7FA6FF; }
html[data-theme="dark"] .section-menu-ico.g-money { background: rgba(76, 195, 138, .16); color: #4CC38A; }
html[data-theme="dark"] .section-menu-ico.g-more  { background: rgba(181, 156, 255, .16); color: #B59CFF; }
.section-menu-chev { width: 15px; height: 15px; }
.topbar-actions { gap: 8px; }

/* Вход с кодом (2FA) */
.mfa-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 12px; background: var(--warn-tint); border: 1px solid var(--warn); border-radius: var(--r-md); font-weight: 700; font-size: var(--fs-md); color: var(--ink); }
.mfa-setup { display: grid; gap: 10px; margin: 8px 0 12px; padding: 14px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-md); justify-items: start; }
.mfa-steps { margin: 0; padding-left: 20px; font-size: var(--fs-md); line-height: 1.5; }
.mfa-qr { width: 180px; height: 180px; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.mfa-secret { display: inline-block; padding: 2px 8px; background: var(--hover); border-radius: 6px; font-size: var(--fs-sm); letter-spacing: .06em; word-break: break-all; cursor: pointer; }
#mfa-login-code, #mfa-code { letter-spacing: .3em; font-size: var(--fs-3xl); text-align: center; font-variant-numeric: tabular-nums; }
.mfa-setup .field { width: 100%; }
#mfa-off-code { letter-spacing: .3em; font-size: var(--fs-3xl); text-align: center; }
.cf-box { display: flex; justify-content: center; margin: 8px 0; min-height: 0; }

/* Обучение (пошаговый тур) */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour.hidden { display: none; }
.tour-shield { position: absolute; inset: 0; }                 /* ловит нажатия, чтобы страница под туром не реагировала */
.tour.dim .tour-shield { background: rgba(10, 10, 14, .66); }
.tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(10, 10, 14, .66), 0 0 0 3px rgba(255,255,255,.9); pointer-events: none; transition: left .22s var(--ease), top .22s var(--ease), width .22s var(--ease), height .22s var(--ease); }
.tour-card { position: fixed; padding: 16px 16px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: ula-pop .2s var(--ease); }
.tour-step { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tour-title { margin: 4px 0 6px; font-size: var(--fs-xl); }
.tour-text { margin: 0 0 14px; font-size: var(--fs-md); line-height: 1.5; color: var(--ink-soft); }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-spacer { flex: 1; }
body.touring { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .tour-hole { transition: none; } }
body.touring .section-menu .tab.mg-hidden { display: flex !important; }

/* Шапка кабинета на телефоне: логотип, название и ниже — название вашего кабинета (понятно, где вы) */
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
#view-admin .brand-name { display: block; font-size: var(--fs-base); }
.brand-ws { display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); }
.brand-ws:empty { display: none; }
@media (max-width: 480px) {
  #view-admin .topbar-inner { gap: 4px; padding: 8px 10px; }
  #view-admin .brand { gap: 7px; }
  #view-admin .brand-name { font-size: var(--fs-md); letter-spacing: 0; }
  .brand-ws { max-width: 82px; font-size: var(--fs-2xs); }
  .topbar-actions { gap: 4px; }
  .topbar-actions .gear-btn, #refresh-btn { width: 36px; height: 36px; border-radius: 11px; }
  .section-menu-btn { gap: 6px; padding: 0 8px 0 4px; }
  .section-menu-label { max-width: 70px; }
  .section-menu-ico { width: 28px; height: 28px; }
}
@media (max-width: 350px) { .brand-ws { display: none; } }

/* «Обновить» на телефоне переехало в меню, чтобы в шапке хватило места логотипу и названию раздела */
.menu-refresh { display: none; }
@media (max-width: 480px) {
  #refresh-btn { display: none; }
  .menu-refresh { display: flex; }
  .section-menu-label { max-width: 96px; }
  .brand-ws { max-width: 100px; }
}
.forgot-row { margin: -4px 0 12px; text-align: right; font-size: var(--fs-md); }
.forgot-row a { color: var(--muted); font-weight: 700; text-underline-offset: 3px; }
.reset-msg { padding: 10px 12px; background: var(--green-tint); color: var(--green); border-radius: var(--r-sm); font-weight: 700; font-size: var(--fs-md); }
.toast { width: max-content; max-width: min(380px, calc(100vw - 32px)); text-align: center; }

/* =====================================================
   ВХОД И РЕГИСТРАЦИЯ — профессиональный вид
   Компьютер: слева тёмная панель с логотипом и пользой, справа форма.
   Телефон: аккуратная карточка с логотипом сверху.
   ===================================================== */
.auth-screen { display: grid; grid-template-columns: 1fr; place-items: stretch; padding: 0;
  background: radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--red) 10%, transparent), transparent 60%), var(--paper); }
.auth-aside { display: none; }
.auth-panel { align-self: center; justify-self: center; width: 100%; max-width: 440px; margin: 24px 16px; padding: 32px 28px 26px;
  border-radius: 22px; box-shadow: var(--shadow-md); animation: ula-sheet .35s var(--ease); }
.auth-panel .logo-full { width: 120px; margin: -6px auto 14px; border-radius: 50%; }
.auth-panel h1 { font-family: var(--font-display); font-size: var(--fs-4xl); font-weight: 500; letter-spacing: -.01em; margin-bottom: 6px; }
.auth-panel > .muted, .auth-panel form > .muted { margin-bottom: 22px; font-size: var(--fs-md); }
.auth-panel .field { margin-bottom: 14px; }
.auth-panel .field > span { font-weight: 600; font-size: var(--fs-sm); color: var(--ink-soft); }
.auth-panel input:not([type="checkbox"]) { min-height: 50px; font-size: var(--fs-lg); background: var(--field); }
.auth-panel .btn-primary { min-height: 52px; font-size: var(--fs-lg); border-radius: 14px; }
.auth-panel .btn-google { min-height: 50px; border-radius: 14px; background: var(--surface); font-weight: 700; }
.auth-panel .btn-google:hover { background: var(--hover); }
.auth-panel .forgot-row { margin: -6px 0 14px; }
.auth-panel .form-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--red-tint); color: var(--red); font-weight: 700; font-size: var(--fs-md); text-align: left; }
.auth-panel .lang-center { margin-top: 18px; }

/* показать пароль */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 48px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover { background: var(--hover); color: var(--ink); }
.pw-eye.on { color: var(--ink); }
.pw-eye.on svg path { stroke-dasharray: 2 2; }

@media (min-width: 900px) {
  .auth-screen { grid-template-columns: minmax(380px, 46%) 1fr; }
  .auth-aside { display: flex; align-items: center; justify-content: center; padding: 48px;
    background: radial-gradient(800px 500px at 0% 0%, rgba(229, 72, 91, .28), transparent 60%), #141317; color: #fff; }
  .auth-aside-in { max-width: 420px; }
  .auth-mark { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 22px; }
  .auth-brand { font-family: var(--font-display); font-size: var(--fs-6xl); letter-spacing: -.01em; margin-bottom: 10px; }
  .auth-brand b { color: #FF5468; }
  .auth-tag { font-size: var(--fs-xl); line-height: 1.5; color: rgba(255,255,255,.72); margin: 0 0 30px; }
  .auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
  .auth-points li { display: flex; align-items: center; gap: 14px; }
  .auth-points span { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); font-weight: 700; font-size: var(--fs-md); }
  .auth-points b { font-weight: 600; font-size: var(--fs-lg); color: rgba(255,255,255,.9); }
  .auth-panel { margin: 40px auto; box-shadow: none; border: 0; background: transparent; }
  .auth-panel .logo-full { display: none; }
  .auth-panel h1, .auth-panel > .muted, .auth-panel form > .muted { text-align: left; }
}
.auth-panel { width: calc(100% - 32px); }
.auth-panel .legal-links a, .auth-panel .forgot-row a { text-decoration: none; }
.auth-panel .legal-links a:hover, .auth-panel .forgot-row a:hover { text-decoration: underline; }
@media (min-width: 900px) { .auth-panel { width: 100%; max-width: 420px; } }

/* =====================================================
   ШРИФТ И ФОН: спокойнее и приятнее
   Шрифт Inter — интерфейсный шрифт с кириллицей и вьетнамским; иероглифы — системные.
   ===================================================== */
body { font-feature-settings: "cv11" on; letter-spacing: -0.006em; text-rendering: optimizeLegibility; }
h1, h2, h3, .page-title, .modal-head h2, .auth-panel h1 { letter-spacing: -0.02em; }
h1, .page-title, .auth-panel h1 { font-weight: 700; }
.page-title { font-size: var(--fs-5xl); }
.modal-head h2 { font-weight: 700; font-size: var(--fs-xl); }
/* крупные цифры: жирные и ровные по ширине */
.summary-value, .order-no, .fx-big, .quote-price, .quote-bar b, .debts-total b, .debt-sum, .r-main b, .r-profit, .sh-sum,
.rq-num, .an-kpi b, .an-donut b, .an-hero b, .an-goal-line b, .pay-line b {
  font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.order-no { font-weight: 700; }
/* логотип-надпись остаётся фирменной */
.brand-name, .auth-brand { font-family: var(--font-brand); font-weight: 600; letter-spacing: -0.01em; }
.muted, .page-sub, .fine-print, .field-hint { letter-spacing: 0; }

/* Фон: ровный, без цветного свечения — спокойнее для рабочей программы */
body { background: var(--paper); }
/* шапка — слегка прозрачная, фон «просвечивает» */
.topbar { background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); }
/* карточки чуть светлее фона, чтобы не сливались */
.card, .client-block, .an-card, .an-kpi, .summary, .assistant, .sh-card, .onboard-card { background: var(--surface); }

/* =====================================================
   ЛЁГКАЯ АНИМАЦИЯ (короткая и мягкая; отключается, если в телефоне включено «Уменьшить движение»)
   ===================================================== */
@keyframes ula-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ula-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ula-shimmer { from { background-position: -240px 0; } to { background-position: 240px 0; } }
@keyframes ula-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* раздел появляется плавно при переключении */
#view-admin > main.container:not(.hidden) { animation: ula-rise .28s var(--ease) backwards; }

/* карточки появляются по очереди (только первые, чтобы длинный список не «ехал») */
#orders > .card, .an-grid > *, .debt-card, .sh-card, #clients > *, #suppliers > *, .r-row, .tm-row, .bq-row {
  animation: ula-rise .32s var(--ease) backwards;
}
#orders > .card:nth-child(1), .an-grid > *:nth-child(1) { animation-delay: .02s; }
#orders > .card:nth-child(2), .an-grid > *:nth-child(2) { animation-delay: .06s; }
#orders > .card:nth-child(3), .an-grid > *:nth-child(3) { animation-delay: .10s; }
#orders > .card:nth-child(4), .an-grid > *:nth-child(4) { animation-delay: .14s; }
#orders > .card:nth-child(5), .an-grid > *:nth-child(5) { animation-delay: .18s; }
#orders > .card:nth-child(n+6), .an-grid > *:nth-child(n+6) { animation-delay: .22s; }

/* полоски «сколько оплачено», цели и графиков заполняются слева направо */
.pay-bar i, .an-goal-bar i, .an-hbar i, .ob-bar i, .r-bar i { transform-origin: left center; animation: ula-grow .7s var(--ease) backwards .15s; }
.an-bars i { transform-origin: bottom center; animation: ula-bar-up .6s var(--ease) backwards .1s; }
@keyframes ula-bar-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* кнопки и чипы: мягкий отклик */
@media (hover: hover) {
  .btn:not(:disabled):hover { transform: translateY(-1px); }
  .btn-primary:not(:disabled):hover { box-shadow: 0 6px 16px rgba(0,0,0,.16); }
  .chip:hover { transform: translateY(-1px); }
}
.chip { transition: background .15s, border-color .15s, color .15s, transform .15s; }
.chip.active { animation: ula-pop .18s var(--ease); }
.fab { transition: transform .18s var(--ease), box-shadow .18s; }
.fab:active { transform: scale(.92); }

/* красная цифра «новое» слегка пульсирует, чтобы её заметили */
.badge-inline:not(.hidden), .as-count:not(:empty) { animation: ula-pulse 1.6s ease-in-out 2; }

/* загрузка: мерцающая полоска вместо простого текста */
.state-box[id$="-loading"]:not(.hidden), #loading:not(.hidden) {
  color: transparent; position: relative; min-height: 64px; border-radius: 14px;
  background: linear-gradient(90deg, var(--soft) 0, var(--hover) 120px, var(--soft) 240px) 0 0 / 480px 100% repeat-x;
  animation: ula-shimmer 1.2s linear infinite;
}

/* галочка «Заявка принята» появляется с лёгким «прыжком» */
.rq-check { animation: ula-pop .4s var(--ease) both; }

/* =====================================================
   ВИТРИНА
   ===================================================== */
.sp-wrap { max-width: 980px; }
.sp-head { margin: 6px 0 16px; }
.sp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .sp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .sp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sp-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 12px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); font: inherit; color: inherit;
  transition: transform .15s var(--ease), box-shadow .15s; animation: ula-rise .32s var(--ease) backwards; }
@media (hover: hover) { .sp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); } }
.sp-card.off { opacity: .55; }
.sp-photo { aspect-ratio: 1 / 1; width: 100%; border-radius: 12px; overflow: hidden; background: var(--soft); display: grid; place-items: center; color: var(--muted); }
.sp-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-photo.big { aspect-ratio: 4 / 3; border-radius: 14px; margin-bottom: 12px; }
.sp-card-title { padding: 0 4px; font-weight: 700; font-size: var(--fs-md); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.sp-card-price { padding: 0 4px; font-size: var(--fs-base); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-off { position: absolute; top: 14px; left: 14px; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(0,0,0,.65); color: #fff; font-size: var(--fs-2xs); font-weight: 600; }
.sp-back { margin: 4px 0 10px; }
.sp-item { max-width: 560px; margin: 0 auto; }
.sp-item-title { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.sp-item-price { font-size: var(--fs-2xl); font-weight: 700; margin: 0 0 10px; color: var(--green); }
.sp-item-desc { white-space: pre-line; color: var(--ink-soft); margin: 0 0 16px; line-height: 1.5; }
.sp-qty { display: flex; align-items: center; gap: 12px; }
.sp-qty .btn { width: 46px; min-height: 46px; padding: 0; font-size: var(--fs-3xl); }
.sp-qty b { min-width: 34px; text-align: center; font-size: var(--fs-2xl); font-variant-numeric: tabular-nums; }
.shop-linkbox h2 { font-size: var(--fs-lg); margin: 0 0 10px; }
.shop-link-row { display: flex; gap: 8px; margin-bottom: 8px; }
.shop-link-row .link-input { flex: 1; min-width: 0; }
.pr-photo-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.pr-preview { width: 110px; flex: none; }
/* Рассылка */
.clients-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.clients-actions .btn { flex: 1 1 auto; }
#modal-broadcast .chips { flex-wrap: wrap; overflow: visible; margin-bottom: 4px; }
#modal-broadcast .money-sub { margin: 14px 0 8px; }
#modal-broadcast #bc-next { margin: 4px 0 10px; }
.bc-none { margin: 8px 0; }
#modal-broadcast .notify-lang[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* =====================================================
   ИНСТРУМЕНТЫ: объёмный вес, трек-номер, счёт, этикетки, расходы
   ===================================================== */
.mini-link { display: inline-block; margin-top: 6px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: var(--fs-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.mini-link:hover { color: var(--muted); }
#q-wmodes .mini-link { margin: 0 0 0 4px; align-self: center; }

/* объёмный вес */
.vol-out { margin: 14px 0; display: grid; gap: 10px; }
.vol-big { display: grid; gap: 2px; padding: 16px 18px; border-radius: var(--r-md); background: var(--hero); color: #fff; }
.vol-big span { font-size: var(--fs-sm); font-weight: 600; color: rgba(255,255,255,.7); }
.vol-big b { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 600; font-variant-numeric: tabular-nums; color: #7BE0A6; }
.vol-big small { font-size: var(--fs-sm); color: rgba(255,255,255,.75); }
.vol-rows { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.vol-rows div { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--soft); }
.vol-rows dt { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.vol-rows dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* трек-номер */
.track-block .track-num { margin: 4px 0 12px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--fs-3xl); font-weight: 700; letter-spacing: .04em; overflow-wrap: anywhere; }
.track-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.track-actions .btn { flex: 1 1 140px; }
.trk-dd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; overflow-wrap: anywhere; }
.track-tag { background: var(--green-tint); border-color: transparent; color: var(--green); }

/* пакетная панель: на телефоне кнопки в две строки */
.bulk-bar #bulk-invoice, .bulk-bar #bulk-labels { white-space: nowrap; }
@media (max-width: 520px) {
  .bulk-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .bulk-bar #bulk-count { grid-column: 1 / -1; margin-right: 0; }
  .bulk-bar .btn { width: 100%; min-width: 0; padding-left: 6px; padding-right: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* аналитика: чистая прибыль */
.an-net { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.an-net span { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.an-net b { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-net.neg b { color: var(--red); }
.an-net.empty { justify-content: center; font-size: var(--fs-md); font-weight: 700; color: var(--muted); border-style: dashed; }
.an-net:hover { background: var(--hover); }

/* расходы */
.ex-grid { display: grid; gap: 14px; margin-top: 14px; }
.ex-sum { display: grid; gap: 8px; }
.ex-line { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-base); }
.ex-line span { color: var(--muted); font-weight: 600; }
.ex-line b { font-variant-numeric: tabular-nums; }
.ex-line.minus b { color: var(--red); }
.ex-net { display: grid; gap: 2px; margin-top: 4px; padding: 14px 16px; border-radius: var(--r-md); background: var(--hero); color: #fff; }
.ex-net span { font-weight: 700; color: rgba(255,255,255,.75); }
.ex-net b { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 600; color: #7BE0A6; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ex-net.neg b { color: #FF8A98; }
.ex-cat { display: grid; gap: 5px; margin-top: 10px; }
.ex-cat-top { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-md); }
.ex-cat-top span { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.ex-cat-top i, .ex-row > i { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.ex-cat-top b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-cat-top small { color: var(--muted); font-weight: 600; }
.ex-bar { height: 8px; border-radius: var(--r-pill); background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.ex-bar i { display: block; height: 100%; border-radius: var(--r-pill); }
.ex-list { display: grid; margin-top: 6px; }
.ex-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ex-row:last-child { border-bottom: 0; }
.ex-row:hover { background: var(--hover); }
body.readonly .ex-row { cursor: default; }
.ex-row-main { flex: 1; min-width: 0; display: grid; }
.ex-row-main small, .ex-row-side small { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-row-side { display: grid; text-align: right; }
.ex-row-side b { font-variant-numeric: tabular-nums; white-space: nowrap; }
#modal-expense .modal-foot #ex-delete { margin-right: auto; }
#modal-volume .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#modal-volume .grid-3 + .grid-3 { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.3fr); }
#modal-volume .field select { padding-left: 10px; padding-right: 26px; }

/* =====================================================
   СТАТУС НА КАРТОЧКЕ: плашка с точкой + шкала шагов
   ===================================================== */
.pill-dot { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 9px; border: 1px solid color-mix(in srgb, var(--st) 22%, transparent); }
.pill-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st) 18%, transparent); }
.pill-dot.st-in_transit::before, .pill-dot.st-purchasing::before { animation: ula-pulse 1.8s ease-in-out infinite; }
@keyframes ula-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--st) 6%, transparent); } }
@media (prefers-reduced-motion: reduce) { .pill-dot::before { animation: none !important; } }

.card-progress { display: flex; align-items: center; gap: 3px; margin-top: -2px; }
.card-progress i { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--line); }
.card-progress i.done { background: color-mix(in srgb, var(--st) 55%, transparent); }
.card-progress i.now { background: var(--st); }
.card-progress span { flex: none; margin-left: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-progress.st-delivered i.done, .card-progress.st-delivered i.now { background: var(--green); }

/* выданные и оплаченные убраны с главного экрана — ссылка на них */
.done-link { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-md); font-weight: 600; text-align: left; cursor: pointer; }
.done-link .ico { color: var(--green); flex: none; }
.done-link span { flex: 1; }
.done-link b { color: var(--ink); }
.done-link:hover { background: var(--hover); color: var(--ink); }

/* =====================================================
   ЗАГРУЗКА ЗАКАЗОВ ИЗ EXCEL
   ===================================================== */
.im-drop { display: grid; justify-items: center; gap: 10px; margin: 14px 0; padding: 26px 16px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--soft); text-align: center; transition: border-color .15s, background .15s; }
.im-drop .ico { color: var(--green); }
.im-drop b { font-size: var(--fs-lg); }
.im-drop small { color: var(--muted); }
.im-drop.over { border-color: var(--green); background: var(--green-tint); }
.im-error { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--red-tint); color: var(--red); font-weight: 600; font-size: var(--fs-md); }
.im-tips { display: grid; gap: 8px; font-size: var(--fs-md); color: var(--muted); }
.im-tips p { margin: 0; }
.im-tips .mini-link { justify-self: start; margin-top: 2px; }
.im-filename { margin: 0 0 4px; font-weight: 700; overflow-wrap: anywhere; }
.im-fields { margin: 10px 0 14px; }
.im-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.im-more { margin-top: 10px; }
.im-more summary { cursor: pointer; font-size: var(--fs-md); font-weight: 700; color: var(--muted); padding: 6px 0; }
.im-more .im-grid { margin-top: 6px; }
.im-field { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
.im-field.on { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: color-mix(in srgb, var(--green-tint) 55%, var(--surface)); }
.im-field.req:not(.on) { border-color: var(--red); }
.im-field > span { font-size: var(--fs-sm); font-weight: 600; }
#modal-import .im-field select { width: 100%; min-width: 0; min-height: 0; height: 36px; padding: 4px 26px 4px 8px; font-size: var(--fs-md); }
.im-field small { min-height: 1.2em; color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.im-table table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.im-table th { padding: 8px; text-align: left; font-size: var(--fs-xs); color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
.im-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.im-table tr:last-child td { border-bottom: 0; }
.im-table td small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.im-table .r { text-align: right; white-space: nowrap; }
.im-notes { display: grid; gap: 6px; margin: 12px 0; }
.im-notes p { margin: 0; padding: 8px 12px; border-radius: var(--r-md); background: var(--warn-tint); color: var(--warn); font-size: var(--fs-md); font-weight: 600; }
.im-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.im-actions #im-go { flex: 1 1 auto; max-width: 320px; }
.im-done { display: grid; justify-items: center; gap: 12px; padding: 10px 0; text-align: center; }
.im-done p { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.im-done-ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--green-tint); color: var(--green); }
.empty-import { margin-top: 14px; }
@media (max-width: 520px) { .im-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.im-list { display: grid; gap: 8px; }
.im-row { display: flex; gap: 10px; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.im-row-main { min-width: 0; display: grid; gap: 2px; }
.im-row-main b { overflow-wrap: anywhere; }
.im-row-main span { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.im-row-side { display: grid; justify-items: end; gap: 3px; text-align: right; flex: none; }
.im-row-side b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.im-row-side small { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.im-actions #im-back { flex: none; white-space: nowrap; }
.im-actions .btn { white-space: nowrap; }

/* фото тетради */
.im-photo-box { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.im-photo-box > .ico { flex: none; color: #7A4FD6; margin-top: 2px; }
.im-photo-box b { display: block; font-size: var(--fs-base); }
.im-photo-box p { margin: 4px 0 10px; color: var(--muted); font-size: var(--fs-md); }
.im-photo-box small { display: block; margin-top: 8px; color: var(--muted); font-size: var(--fs-xs); }
.im-reading { display: grid; justify-items: center; gap: 8px; margin: 14px 0; padding: 30px 16px; border-radius: var(--r-lg); background: var(--soft); text-align: center; }
.im-reading small { color: var(--muted); }
.im-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: #7A4FD6; animation: ula-spin .9s linear infinite; }
@keyframes ula-spin { to { transform: rotate(360deg); } }
.im-photo-hint { margin: 0 0 8px; }
.im-edit { padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 8px; }
.im-edit.unsure { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); background: color-mix(in srgb, var(--warn-tint) 45%, var(--surface)); }
.im-edit.bad { border-color: var(--red); }
.im-edit-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.im-edit-top b { font-size: var(--fs-xs); color: var(--muted); }
.im-unsure { font-size: var(--fs-xs); font-weight: 600; color: var(--warn); }
.im-del { margin-left: auto; width: 28px; height: 28px; font-size: var(--fs-xl); }
.im-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.im-edit-grid .w2 { grid-column: span 2; }
.im-edit-grid .w3 { grid-column: 1 / -1; }
#modal-import .im-edit-grid input, #modal-import .im-edit-grid select { width: 100%; min-width: 0; height: 36px; min-height: 0; padding: 4px 8px; font-size: var(--fs-md); }
.im-edit-grid label { display: grid; gap: 2px; min-width: 0; }
.im-edit-grid label > span { font-size: var(--fs-2xs); font-weight: 600; color: var(--muted); }
.im-edit-grid label { align-content: end; }

/* простой режим: лишние разделы спрятаны */
.section-menu .simple-hidden { display: none !important; }
.menu-simple span { font-weight: 700; }
body.simple-mode .menu-simple { color: var(--green); }

/* Telegram клиента */
.tgc-block .muted { margin: 0 0 12px; }
.tgc-on { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 700; color: var(--green); }
.tgc-btn { background: #229ED9 !important; border-color: #229ED9 !important; color: #fff !important; }
.tg-tag { background: color-mix(in srgb, #229ED9 14%, transparent); border-color: transparent; color: #1a87bb; }
html[data-theme="dark"] .tg-tag { color: #5cc3f0; }
/* установка на телефон */
.pwa-app { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.pwa-app img { border-radius: 14px; }
.pwa-app div { display: grid; }
.pwa-app span { color: var(--muted); font-size: var(--fs-md); }
.pwa-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; font-size: var(--fs-base); }
.menu-install span { font-weight: 700; }
.seg-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .seg-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Общая ссылка клиента: список всех его заказов ---------- */
.cab-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.cab-box h3 { margin-bottom: 6px; font-size: var(--fs-base); }
.cab-box .muted { margin-bottom: 10px; font-size: var(--fs-sm); }

.cab-debt.owe { background: var(--red-tint); border-color: var(--danger-line); color: var(--red); }
.cab-debt.clear { background: var(--green-tint); border-color: transparent; color: var(--green); }
.cab-debt h2 { margin-bottom: 0; font-size: var(--fs-lg); }
.cab-debt.owe h2 { margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; }
.cab-debt-sum { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 700; line-height: 1.2; }

.cab-list { display: grid; gap: 10px; }
.cab-card {
  display: flex; gap: 12px; align-items: flex-start; width: 100%;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.cab-card:hover { background: var(--hover); }
.cab-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cab-thumb { flex: none; width: 64px; height: 64px; border-radius: var(--r-sm); object-fit: cover; background: var(--soft); }
.cab-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cab-product { font-weight: 700; overflow-wrap: anywhere; }
.cab-meta { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.cab-status {
  align-self: flex-start; padding: 2px 10px; border-radius: var(--r-pill);
  background: var(--soft); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600;
}
.cab-status.s-arrived, .cab-status.s-delivered { background: var(--green-tint); border-color: transparent; color: var(--green); }
.cab-status.s-cancelled { color: var(--muted); }
.cab-owe { color: var(--red); font-size: var(--fs-sm); font-weight: 600; }
.cab-paid { color: var(--green); font-size: var(--fs-sm); font-weight: 600; }
.cab-done summary { cursor: pointer; list-style: none; }
.cab-done summary::-webkit-details-marker { display: none; }
.cab-done summary h2 { margin-bottom: 0; }
.cab-done[open] summary h2 { margin-bottom: 12px; }
.cab-back { margin-bottom: 12px; }

/* ---------- Логотип байера ---------- */
.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-preview { width: 84px; height: 84px; flex: none; border: 1px dashed var(--line, #ccc); border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; }
.logo-preview:empty::before { content: "LOGO"; font-size: var(--fs-xs); color: #999; letter-spacing: .08em; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-row .stack { flex: 1; }
.brand-logo { display: block; height: 36px; width: auto; max-width: 120px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-co { font-weight: 600; font-size: var(--fs-base); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Меню разделов: значки, спокойные заголовки групп ---------- */
.section-menu { max-height: calc(100dvh - 84px); overflow-y: auto; overscroll-behavior: contain; }
.section-menu .tab { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }
.section-menu .tab .tab-ico { display: grid; place-items: center; width: 22px; flex: none; color: var(--muted); font-style: normal; }
.section-menu .tab.active .tab-ico { color: var(--primary, #2F6FDE); }
.section-menu .tab.active::after,
.section-menu .tab[data-group].active::after { background: var(--primary, #2F6FDE); }
.section-menu .menu-group,
.section-menu .menu-group:hover { display: block; padding: 12px 12px 4px; background: none; cursor: default;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.section-menu .menu-group:first-child { padding-top: 4px; }
.section-menu .menu-group.mg-main, .section-menu .menu-group.mg-money, .section-menu .menu-group.mg-more { color: var(--muted); }
.section-menu .menu-action svg { color: var(--muted); }
.section-menu .menu-logout, .section-menu .menu-logout svg { color: var(--red, #d64545); }

/* ---------- Обмен сом → юань ---------- */
.fx-body { display: grid; gap: 14px; }
.fx-card h3 { margin: 0 0 6px; }
.fx-card h4 { margin: 14px 0 4px; font-size: var(--fs-md); }
.fx-rate { margin: 4px 0; font-size: var(--fs-4xl); font-weight: 700; letter-spacing: -.01em; }
.fx-date { margin: 0 0 6px; font-size: var(--fs-sm); color: var(--muted); }
.fx-date.old { color: #C27C00; }
.fx-note { margin: 6px 0; white-space: pre-wrap; }
.fx-form { display: grid; gap: 8px; margin-top: 10px; }
.fx-calc { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin: 10px 0; }
.fx-out { display: grid; gap: 4px; text-align: right; padding-bottom: 10px; }
.fx-out span { font-size: var(--fs-sm); color: var(--muted); }
.fx-out b { font-size: var(--fs-3xl); white-space: nowrap; }
.fx-list { display: grid; gap: 10px; margin-top: 10px; }
.fx-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.fx-row.st-done, .fx-row.st-cancelled { opacity: .7; }
.fx-row-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.fx-st { font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); background: var(--soft); }
.fx-row.st-new .fx-st { background: rgba(47,111,222,.14); color: var(--primary, #2F6FDE); }
.fx-row-sum { font-size: var(--fs-lg); }
.fx-row-sum small { color: var(--muted); }
.fx-row-meta { font-size: var(--fs-xs); color: var(--muted); }
.fx-row-note { font-size: var(--fs-md); white-space: pre-wrap; }
.fx-row-act { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-pub-title { margin: 0 0 4px; }
.fx-pub form { display: grid; gap: 8px; margin-top: 8px; }
.fx-pub .btn-block + .btn-block { margin-top: 6px; }
.fx-ok { font-weight: 700; color: #27966C; }
.fx-tiers { display: grid; gap: 4px; margin: 8px 0; }
.fx-tier { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--soft); font-size: var(--fs-base); }
.fx-tier b { white-space: nowrap; }
.fx-tier.on { background: rgba(30,158,98,.16); box-shadow: inset 0 0 0 1.5px #27966C; }
.fx-ed { display: grid; gap: 6px; }
.fx-ed-head, .fx-ed-row { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 8px; align-items: center; }
.fx-ed-head span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.fx-ed-row input { width: 100%; min-width: 0; }
.fx-ed-del { width: 36px; height: 36px; font-size: var(--fs-2xl); }
.fx-link { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.fx-link h4 { margin: 0; }
.fx-link-input { width: 100%; font-size: var(--fs-sm); }
.fx-sumbox { display: grid; gap: 2px; padding: 12px 14px; margin: 10px 0; border-radius: 12px; background: var(--soft); }
.fx-sumbox span { font-size: var(--fs-sm); color: var(--muted); }
.fx-sumbox b { font-size: var(--fs-5xl); letter-spacing: -.01em; }
.fx-sumbox small { color: var(--muted); }
.fx-req { margin: 10px 0; padding: 12px 14px; border-radius: 12px; border: 1.5px dashed var(--line); }
.fx-req h3 { margin: 0 0 4px; font-size: var(--fs-md); }
.fx-row.st-paid .fx-st { background: rgba(30,158,98,.16); color: #27966C; }
.fx-row-eta { font-weight: 600; color: #27966C; }
.fx-row.st-confirmed .fx-st { background: rgba(30,158,98,.16); color: #27966C; }
.fx-confirm { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--soft); }
.fx-eta-usual { margin: 0 0 6px; font-size: var(--fs-md); color: var(--muted); }
.fx-status h1 { margin: 2px 0 8px; font-size: var(--fs-3xl); line-height: 1.25; }
.fx-status-label { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.fx-eta-big { margin: 10px 0; padding: 14px; border-radius: 12px; background: rgba(30,158,98,.14); color: #27966C; font-size: var(--fs-xl); font-weight: 700; text-align: center; }
.fx-eta-big.late { background: rgba(194,124,0,.14); color: #C27C00; font-size: var(--fs-base); }
.fx-msg { margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: var(--soft); white-space: pre-wrap; }
.fx-steps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 0; }
.fx-steps li { position: relative; padding: 0 0 14px 28px; color: var(--muted); }
.fx-steps li::before { content: ""; position: absolute; left: 4px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.fx-steps li::after { content: ""; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.fx-steps li:last-child::after { display: none; }
.fx-steps li.ok { color: var(--ink); }
.fx-steps li.ok::before { background: #27966C; border-color: #27966C; }
.fx-steps li.cur { color: var(--ink); font-weight: 700; }
.fx-steps li.cur::before { border-color: #27966C; box-shadow: 0 0 0 4px rgba(30,158,98,.2); }
.fx-status.st-done h1 { color: #27966C; }
.fx-status.st-cancelled h1 { color: var(--muted); }
.fx-my-list { display: grid; gap: 6px; }

/* Проверка личности обменника (файл 30) */
.kyc-box { margin: 10px 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--soft); }
.kyc-box h4 { margin: 0 0 6px; }
.kyc-box .muted { margin: 0 0 4px; font-size: var(--fs-sm); }
.kyc-ok, .kyc-pub { margin: 6px 0; font-size: var(--fs-md); font-weight: 600; color: var(--green); }
.kyc-pub { font-size: var(--fs-sm); }
.kyc-wait { margin: 4px 0 0; font-weight: 600; }
.kyc-files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kyc-file { position: relative; display: grid; place-items: center; gap: 4px; min-height: 96px; padding: 6px; border-radius: var(--r-md);
  border: 1.5px dashed var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; overflow: hidden; font: inherit; }
.kyc-file.has { border-style: solid; border-color: var(--green); }
.kyc-file img { width: 100%; height: 64px; object-fit: cover; border-radius: var(--r-sm); }
.kyc-file small { font-size: var(--fs-2xs); line-height: 1.25; text-align: center; color: var(--muted); }
.kyc-plus { font-size: var(--fs-5xl); line-height: 1; color: var(--muted); }
.kyc-st-approved .fx-st { color: var(--green); }
.kyc-st-rejected .fx-st, .kyc-st-revoked .fx-st { color: var(--red); }

/* Обмен как P2P: отправка, подтверждение, спор (файл 31) */
.fx-flag { display: inline-block; margin: 4px 0; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600;
  color: #C62828; background: rgba(217, 45, 32, .1); }
.st-dispute .fx-st, .fx-row.st-dispute .fx-st { color: #C62828; }
.fx-row.st-dispute { border-color: rgba(217, 45, 32, .45); }
.fx-dispute { display: grid; gap: 8px; margin: 10px 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--soft); }
.fx-dispute.open { border-color: rgba(217, 45, 32, .45); }
.fx-dispute textarea { width: 100%; }
.fx-d-res { margin: 0; font-weight: 600; }
.fx-d-form { display: grid; gap: 6px; }
.fx-thread { display: grid; gap: 6px; max-height: 360px; overflow-y: auto; }
.fx-msg-row { display: grid; gap: 4px; max-width: 92%; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.fx-msg-row.mine { justify-self: end; background: var(--hover); }
.fx-msg-row.admin { border-color: var(--primary); }
.fx-msg-who { font-size: var(--fs-2xs); color: var(--muted); }
.fx-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-md); }
.fx-msg-img { padding: 0; border: 0; background: none; cursor: zoom-in; justify-self: start; }
.fx-msg-img img { display: block; max-width: 220px; max-height: 260px; border-radius: 8px; object-fit: cover; }
.fx-sent-box { display: grid; gap: 6px; margin: 10px 0; }
.fx-sent-box small { color: var(--muted); }
.fx-recv { display: grid; gap: 8px; margin: 10px 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--green); }
.fx-stars { display: flex; gap: 4px; }
.fx-stars button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--soft); color: var(--line-strong); font-size: var(--fs-4xl); cursor: pointer; }
.fx-stars button.on { color: #DCA43A; }
.fx-stars-line { color: #DCA43A; letter-spacing: 2px; }
.fx-stars-line.big { font-size: var(--fs-3xl); margin: 6px 0; }
.fx-stars-line .off { color: var(--line-strong); }
.fx-d-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0; }
.fx-d-sides > div { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--soft); font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.fx-d-sides small { color: var(--muted); }
.fx-protect { margin: 10px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.fx-d-btn { margin-top: 8px; }
@media (max-width: 420px) { .fx-d-sides { grid-template-columns: 1fr; } }

/* ---------- Иконки рядом с текстом (вместо эмодзи) ---------- */
.kyc-ok .ico, .kyc-pub .ico, .kyc-box h4 .ico, .fx-card h3 .ico, .fx-row-sum .ico, .fx-flag .ico, .fx-row-note .ico,
.fx-msg .ico, .fx-dispute b .ico, .tgc-block h2 .ico, .tg-tag .ico { margin-right: 6px; vertical-align: -0.15em; }
.tg-tag .ico { margin-right: 4px; }
.fx-protect { display: flex; gap: 8px; align-items: flex-start; }
.fx-protect .ico { flex: none; margin-top: 1px; color: var(--green); }

/* ---------- Плашка «Вышло обновление» (js/pwa.js) ---------- */
.pwa-update { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000;
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 32px); padding: 10px 10px 10px 16px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; background: #17191D; color: #fff; font-size: var(--fs-md); font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.pwa-update .btn { min-height: 36px; flex: none; }

/* Главная: новости и курс ULA */
.home-board { display: grid; gap: 8px; margin: 0 0 14px; }
.home-slot { margin: 0 0 14px; }
.home-board.hidden { display: none; }
/* Все карточки на главной — одного вида: значок слева, текст, кнопки. Компактно. */
.bd-card, .bd-post, .rate-card { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.bd-card { display: flex; align-items: flex-start; gap: 12px; }
.bd-ico, .rc-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--soft); color: var(--ink); }
.bd-news .bd-ico { background: var(--red-tint); color: var(--red); }
.bd-main { flex: 1; min-width: 0; }
.bd-main h3 { margin: 0 0 2px; font-size: var(--fs-base); font-weight: 600; }
.bd-main h3 span { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); }
.bd-text { margin: 0 0 8px; font-size: var(--fs-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.bd-invite .bd-text { color: var(--muted); }
.bd-post summary { cursor: pointer; font-weight: 600; }
.bd-post textarea { width: 100%; margin: 10px 0; }

/* Карточка «Курс юаня» на главной */
.rc-top { display: flex; align-items: center; gap: 12px; }
.rc-ico { background: var(--green-tint); color: var(--green); font-weight: 700; font-size: var(--fs-xl); }
.rc-main { flex: 1; min-width: 0; display: grid; }
.rc-label { font-size: var(--fs-sm); color: var(--muted); }
.rc-big { font-size: var(--fs-md); color: var(--muted); white-space: nowrap; }
.rc-big b { font-size: var(--fs-xl); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.rc-big b.down { color: var(--green); }
.rc-big b.up { color: var(--red); }
.rc-top .btn { flex: none; }
.rc-date { color: var(--green); }
.rc-more { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.rc-more summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); list-style-position: inside; }
.rc-more[open] summary { margin-bottom: 8px; }
.rc-date.old { color: var(--red); }
.rc-warn { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--red-tint); color: var(--red); font-size: var(--fs-md); font-weight: 500; }
.rc-warn .ico { flex: none; }
.rc-table { display: grid; }
.rc-th, .rc-tr { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 12px; }
.rc-th { padding-bottom: 6px; font-size: var(--fs-sm); color: var(--muted); }
.rc-th span:last-child { text-align: right; }
.rc-tr { padding: 7px 0; border-top: 1px solid var(--line); font-size: var(--fs-base); }
.rc-val { display: flex; gap: 10px; justify-content: flex-end; align-items: baseline; font-variant-numeric: tabular-nums; }
.rc-val s { color: var(--red); font-size: var(--fs-base); }
.rc-val b { font-weight: 600; }
.rc-val b.down { color: var(--green); }
.rc-val b.up { color: var(--red); }
.rc-note { margin: 8px 0 0; font-size: var(--fs-md); color: var(--muted); white-space: pre-wrap; }
.rc-chart { margin: 14px 0 0; padding: 12px; border-radius: 14px; background: var(--soft); }
.rc-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.rc-tabs button { min-height: 30px; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface); color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.rc-tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.rc-chart svg { display: block; width: 100%; height: 64px; }
.rc-line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; }
.rc-area { fill: var(--green-tint); }
.rc-dot { fill: var(--green); }
.rc-range { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.rc-empty { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.rc-calc { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin: 14px 0 12px; }
.rc-calc .field { margin: 0; }
.rc-out { display: grid; text-align: right; font-size: var(--fs-sm); color: var(--muted); }
.rc-out b { font-size: var(--fs-xl); font-weight: 700; color: var(--ink); white-space: nowrap; }
@media (max-width: 380px) { .rc-calc { grid-template-columns: 1fr; } .rc-out { text-align: left; } }

.promo-ref { text-align: center; }
.promo-ref p { margin: 6px 0 12px; color: var(--muted); }
.bd-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sp-cart { display: grid; gap: 10px; margin: 12px 0 16px; }
.sp-cart-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.sp-cart-t { flex: 1; min-width: 0; font-weight: 700; }
.sp-cart-t small { display: block; font-weight: 400; color: var(--muted); }
.sp-cart-row .sp-qty .btn { width: 38px; min-height: 38px; font-size: var(--fs-xl); }
.sp-cart-row .sp-qty b { font-size: var(--fs-lg); min-width: 24px; }
.sp-cartbar { position: sticky; bottom: 12px; margin-top: 16px; z-index: 5; }

/* короткая форма заказа и простой режим */
#order-form.form-short .adv { display: none !important; }
.form-more { margin-top: 4px; }
body.simple-mode #bulk-btn, body.simple-mode #import-btn, body.simple-mode #tab-home .summary + .fine-print { display: none !important; }

/* ---------- Круглые фильтры статусов (заказы) ---------- */
#tab-orders .chips-ico { gap: 4px; align-items: flex-start; padding-top: 10px; padding-bottom: 4px; scroll-padding: 0 16px; }
#tab-orders .chips-ico .chip {
  flex-direction: column; justify-content: flex-start; gap: 6px;
  width: 78px; min-height: 0; padding: 0 2px 8px;
  border: 0; border-radius: 12px; background: none; color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600; white-space: normal; text-align: center;
  position: relative; animation: none;
  transform: translateY(calc(var(--d, 0) * 5px));
  transition: transform .35s var(--ease), color .2s;
}
#tab-orders .chips-ico .chip:hover { transform: translateY(calc(var(--d, 0) * 5px - 2px)); }
#tab-orders .chips-ico .ci {
  position: relative; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--surface); color: var(--st, var(--ink));
  box-shadow: 0 2px 8px rgba(0,0,0,.08), inset 0 0 0 1px var(--line);
  transition: transform .35s var(--ease), background .25s, color .25s, box-shadow .25s;
}
#tab-orders .chips-ico .ci svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#tab-orders .chips-ico .chip-all .ci svg { fill: currentColor; stroke: none; }
#tab-orders .chips-ico .ci b {
  position: absolute; top: -4px; right: -6px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: var(--fs-xs); line-height: 22px;
}
#tab-orders .chips-ico .chip.zero .ci { opacity: .55; }
#tab-orders .chips-ico .cl { line-height: 1.2; min-height: 2.4em; }
#tab-orders .chips-ico .cl::after {
  content: ""; display: block; width: 22px; height: 3px; margin: 4px auto 0;
  border-radius: 3px; background: var(--st, var(--primary));
  transform: scaleX(0); transition: transform .3s var(--ease);
}
#tab-orders .chips-ico .chip.active { color: var(--ink); font-weight: 800; }
#tab-orders .chips-ico .chip.active .ci {
  transform: scale(1.14); background: var(--st, var(--primary)); color: #fff;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--st, var(--primary)) 35%, transparent);
}
#tab-orders .chips-ico .chip-all.active .ci { background: var(--ink); color: var(--surface); box-shadow: 0 8px 18px rgba(0,0,0,.22); }
#tab-orders .chips-ico .chip-all .cl::after { background: var(--ink); }
#tab-orders .chips-ico .chip.active .cl::after { transform: scaleX(1); }
#tab-orders .chips-ico .chip:focus-visible { box-shadow: none; }
#tab-orders .chips-ico .chip:focus-visible .ci { box-shadow: 0 0 0 3px var(--focus-ring); }
@media (prefers-reduced-motion: reduce) {
  #tab-orders .chips-ico .chip, #tab-orders .chips-ico .ci, #tab-orders .chips-ico .cl::after { transition: none; }
}
html[data-theme="dark"] #tab-orders .chips-ico .chip.active:not(.chip-all) .ci { color: #14161A; }

/* ---------- Расчёт цены: 3 понятных шага ---------- */
#tab-quote .q-steps { display: grid; gap: 12px; padding: 14px; }
#tab-quote .q-step {
  position: relative; padding: 14px 14px 12px; border-radius: 16px;
  background: var(--paper); border: 1px solid var(--line);
  transition: border-color .25s, background .25s;
  animation: q-in .4s var(--ease) backwards;
}
#tab-quote #q-step2 { animation-delay: .07s; }
#tab-quote #q-step3 { animation-delay: .14s; }
@keyframes q-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#tab-quote .q-step:focus-within { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--paper)); }
#tab-quote .q-step.done { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
#tab-quote .q-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
#tab-quote .q-num {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: var(--fs-base); font-style: normal;
  transition: background .25s, transform .3s var(--ease);
}
#tab-quote .q-num i { font-style: normal; }
#tab-quote .q-step.done .q-num { background: var(--green); transform: scale(1.06); }
#tab-quote .q-step.done .q-num i { font-size: 0; }
#tab-quote .q-step.done .q-num i::before { content: "✓"; font-size: var(--fs-xl); }
#tab-quote .q-step-t { flex: 1; min-width: 0; display: grid; }
#tab-quote .q-step-t b { font-size: var(--fs-lg); }
#tab-quote .q-step-t small { color: var(--muted); font-size: var(--fs-sm); }
#tab-quote .q-step-sum { font-style: normal; font-weight: 800; font-size: var(--fs-md); white-space: nowrap; font-variant-numeric: tabular-nums; }
#tab-quote .q-step-profit { color: var(--green); }
#tab-quote .q-step .field { margin-bottom: 0; }
#tab-quote .q-step input { font-size: var(--fs-xl); font-weight: 700; }
#tab-quote .q-step .quote-modes { margin-top: 10px; }
#tab-quote .q-mk { display: grid; gap: 10px; }
#tab-quote .q-mk-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#tab-quote .q-mk-chips .notify-lang { min-height: 40px; font-size: var(--fs-base); font-weight: 800; }
#tab-quote .q-more { margin-top: 10px; }
#tab-quote .q-more > summary { cursor: pointer; color: var(--primary); font-size: var(--fs-md); font-weight: 700; padding: 4px 0; list-style: none; }
#tab-quote .q-more > summary::-webkit-details-marker { display: none; }
#tab-quote .q-more[open] > summary { margin-bottom: 10px; }
#tab-quote .q-rates { margin-top: 0; padding: 12px 14px; border-radius: 16px; border: 1px dashed var(--line-strong); }
#tab-quote .q-rates > summary { color: var(--muted); }
#tab-quote .q-rates .grid-2 { gap: 10px; }
#tab-quote .quote-price-box.q-pop { animation: q-pop .35s var(--ease); }
@keyframes q-pop { 0% { transform: scale(1); } 40% { transform: scale(1.035); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  #tab-quote .q-step, #tab-quote .quote-price-box.q-pop { animation: none; }
}
#tab-quote .q-step .grid-2 { align-items: end; }



/* ---------- Нижнее меню на телефоне ---------- */
.bottom-nav { display: none; }
@media (max-width: 640px) {
  .bottom-nav {
    position: fixed; z-index: 16; left: 50%; transform: translateX(-50%);
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: calc(100vw - 20px); max-width: 460px;
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 6px;
    border-radius: 30px; border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
    box-shadow: 0 10px 30px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.06);
  }
  .bn-item {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 3px;
    min-height: 56px; padding: 6px 2px; border: 0; border-radius: 24px; background: none;
    color: var(--ink); font: inherit; font-size: var(--fs-2xs); font-weight: 600; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .25s var(--ease), transform .15s;
  }
  .bn-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn-ico { display: grid; place-items: center; width: 26px; height: 26px; transition: transform .3s var(--ease); }
  .bn-ico svg { stroke-width: 1.9; }
  .bn-item:active { transform: scale(.94); }
  .bn-item.active { background: color-mix(in srgb, var(--ink) 9%, transparent); font-weight: 800; }
  .bn-item.active .bn-ico { transform: translateY(-1px) scale(1.08); }
  .bn-item.active .bn-ico svg { stroke-width: 2.4; }
  .bn-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-pill); background: var(--red); color: #fff; font-size: var(--fs-2xs); line-height: 18px; font-style: normal; }
  .bn-badge.hidden { display: none; }
  body.no-scroll .bottom-nav { display: none; }
  /* место под меню: «+» и плашку с ценой поднимаем выше */
  #view-admin { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .quote-bar { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
.bottom-nav .bn-item.active::after { content: none; }

/* ---------- Профиль ---------- */
.profile { padding: 8px 0 24px; }
.pf-head { display: grid; justify-items: center; text-align: center; padding: 10px 0 18px; animation: q-in .45s var(--ease) backwards; }
.pf-ava-wrap { position: relative; width: 116px; height: 116px; padding: 5px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--primary), color-mix(in srgb, var(--primary) 25%, transparent), var(--primary)); }
.pf-ava { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--surface); border: 4px solid var(--paper); font: 800 36px/1 var(--font-display, system-ui); color: var(--ink); }
.pf-ava img { width: 100%; height: 100%; object-fit: cover; }
.pf-badge { position: absolute; right: 2px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); border: 3px solid var(--paper); }
.pf-name { margin: 14px 0 2px; font: 800 26px/1.15 var(--font-display, system-ui); overflow-wrap: anywhere; }
.pf-sub { margin: 0; color: var(--muted); font-size: var(--fs-base); }
.pf-mail { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 8px; border-radius: var(--r-xl);
  background: var(--surface); border: 1px solid var(--line); overflow: hidden; animation: q-in .45s var(--ease) .06s backwards; }
.pf-stats button { display: grid; gap: 2px; padding: 16px 6px; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.pf-stats button + button { border-left: 1px solid var(--line); }
.pf-stats b { font: 800 26px/1 var(--font-display, system-ui); font-variant-numeric: tabular-nums; }
.pf-stats span { color: var(--muted); font-size: var(--fs-sm); }
.pf-cap { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 4px 8px;
  font-size: var(--fs-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pf-cap em { font-style: normal; letter-spacing: 0; text-transform: none; font-size: var(--fs-sm); color: var(--primary); }
.pf-card { padding: 14px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); }
.pf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-chips .muted { margin: 0; }
.pf-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md); font-weight: 600; cursor: pointer;
  transition: transform .15s, border-color .2s; }
.pf-chip:active { transform: scale(.96); }
.pf-chip.ok { border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green); }
.pf-chip.todo { border-style: dashed; }
.pf-chip.todo b { color: var(--red); font-size: var(--fs-lg); }
.pf-progress { height: 6px; margin-bottom: 12px; border-radius: 6px; background: var(--paper); overflow: hidden; }
.pf-progress i { display: block; height: 100%; border-radius: 6px; background: var(--green); transition: width .5s var(--ease); }
.pf-row { display: flex; align-items: center; gap: 12px; }
.pf-row-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: var(--fs-2xl);
  background: color-mix(in srgb, var(--primary) 12%, transparent); }
.pf-row-t { flex: 1; display: grid; min-width: 0; }
.pf-row-t small { color: var(--muted); font-size: var(--fs-sm); }
.pf-switch { position: relative; flex: none; width: 64px; height: 36px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: linear-gradient(135deg, #F7C948, #FF9F43); transition: background .35s; }
.pf-switch i { position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .35s var(--ease), box-shadow .35s; }
.pf-switch.on { background: linear-gradient(135deg, #1B1F3B, #3A2F6B); }
.pf-switch.on i { transform: translateX(28px); background: #F4F1E8; box-shadow: inset -7px -3px 0 0 #D9D3C2; }
.pf-swatches { display: flex; justify-content: space-between; gap: 6px; }
.pf-sw { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); transition: transform .25s var(--ease); }
.pf-sw[data-pf-accent="ula"] { background: var(--ink); }
.pf-sw i { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; opacity: 0; transform: scale(.5); transition: opacity .2s, transform .25s var(--ease); }
.pf-sw[data-pf-accent="ula"] i { color: var(--paper); }
.pf-sw.on { transform: scale(1.08); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary); }
.pf-sw.on i { opacity: 1; transform: none; }
.pf-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 6px; }
.pf-ts { min-height: 52px; border-radius: var(--r-lg); border: 1.5px solid transparent; background: none; color: var(--ink); font-weight: 700; cursor: pointer; }
.pf-ts-s { font-size: var(--fs-sm); } .pf-ts-m { font-size: var(--fs-lg); } .pf-ts-l { font-size: var(--fs-xl); } .pf-ts-xl { font-size: var(--fs-3xl); }
.pf-ts.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.pf-styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pf-st { display: grid; gap: 8px; padding: 10px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: var(--fs-md); cursor: pointer; transition: border-color .2s, transform .15s; }
.pf-st:active { transform: scale(.97); }
.pf-st.on { border-color: var(--primary); }
.pf-st-demo { display: flex; align-items: flex-end; height: 54px; padding: 10px; background: var(--paper); }
.pf-st-demo i { width: 44px; height: 12px; background: color-mix(in srgb, var(--ink) 25%, transparent); }
.pf-st.on .pf-st-demo i { background: var(--primary); }
.pf-st-rounded .pf-st-demo { border-radius: 14px; } .pf-st-rounded .pf-st-demo i { border-radius: 8px; }
.pf-st-soft .pf-st-demo { border-radius: 20px; } .pf-st-soft .pf-st-demo i { border-radius: 12px; height: 14px; }
.pf-st-crisp .pf-st-demo { border-radius: 4px; } .pf-st-crisp .pf-st-demo i { border-radius: 2px; }
.pf-note { text-align: center; margin: 14px 0; }
#pf-settings { display: flex; gap: 8px; justify-content: center; align-items: center; }

/* карточка профиля в меню разделов */
.section-menu .menu-profile { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; margin-bottom: 6px; padding: 8px 12px;
  border-radius: 14px; background: var(--soft); text-align: left; }
.section-menu .menu-profile.active::after { display: none; }
.mp-ava { flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: var(--fs-lg); }
.mp-ava img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.mp-t { flex: 1; min-width: 0; display: grid; }
.mp-t b { color: var(--ink); font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-t small { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.mp-chev { color: var(--muted); font-size: var(--fs-3xl); }

/* ---------- Внешний вид: цвет главных кнопок (по умолчанию фирменный красный), размер текста, стиль углов ---------- */
html[data-accent="blue"][data-accent]:not(.x-) { --accent: #2F6FDE; --accent-hover: color-mix(in srgb, #2F6FDE 85%, #000); --on-accent: #fff; }
html[data-accent="violet"][data-accent]:not(.x-) { --accent: #7C5CFC; --accent-hover: color-mix(in srgb, #7C5CFC 85%, #000); --on-accent: #fff; }
html[data-accent="green"][data-accent]:not(.x-) { --accent: #15803D; --accent-hover: color-mix(in srgb, #15803D 85%, #000); --on-accent: #fff; }
html[data-accent="orange"][data-accent]:not(.x-) { --accent: #E8590C; --accent-hover: color-mix(in srgb, #E8590C 85%, #000); --on-accent: #fff; }
html[data-tsize="s"] #view-admin > main { zoom: .92; }
html[data-tsize="l"] #view-admin > main { zoom: 1.08; }
html[data-tsize="xl"] #view-admin > main { zoom: 1.16; }
html[data-ui="soft"] { --r-xl: 26px; --r-lg: 20px; --r-md: 14px; --r-sm: 12px; }
html[data-ui="crisp"] { --r-xl: 8px; --r-lg: 6px; --r-md: 5px; --r-sm: 4px; }
@media (prefers-reduced-motion: reduce) { .pf-head, .pf-stats { animation: none; } }

/* Аватар профиля в шапке — только на телефоне, где разделы уже в нижнем меню */
.top-profile { display: none; }
@media (max-width: 640px) {
  .section-menu-btn { display: none; }
  .top-profile { order: 2; display: grid; place-items: center; width: 44px; height: 44px; padding: 2px; border: 0; border-radius: 50%;
    background: conic-gradient(from 200deg, var(--primary), color-mix(in srgb, var(--primary) 20%, transparent), var(--primary));
    cursor: pointer; transition: transform .15s; }
  .top-profile:active { transform: scale(.92); }
  .top-profile .mp-ava { width: 40px; height: 40px; border: 2px solid var(--topbar, var(--surface)); font-size: var(--fs-base); }
  .top-profile.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
  .section-menu-wrap { order: 3; }
}

/* Профиль: редактирование фото, имени, компании */
button.pf-ava-wrap { border: 0; cursor: pointer; display: block; transition: transform .15s; }
button.pf-ava-wrap:active { transform: scale(.96); }
.pf-ava-wrap .pf-badge { width: 34px; height: 34px; }
.pf-edit-btn { margin-top: 12px; min-height: 36px; padding: 0 16px; border-radius: var(--r-pill); }
.pf-edit { display: grid; gap: 14px; margin-bottom: 8px; animation: q-in .3s var(--ease) backwards; }
.pf-edit .field { margin: 0; }
.pf-pic { display: flex; gap: 14px; align-items: center; }
.pf-pic-img { flex: none; width: 72px; height: 72px; border-radius: 16px; overflow: hidden; display: grid; place-items: center;
  background: var(--paper); border: 1px dashed var(--line-strong); color: var(--muted); }
.pf-pic-img.round { border-radius: 50%; }
.pf-pic-img img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.pf-pic-t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pf-pic-t small { color: var(--muted); font-size: var(--fs-sm); }
.pf-pic-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pf-pic-btns .btn { min-height: 34px; padding: 0 12px; font-size: var(--fs-sm); }
.pf-edit-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.pf-photo-del { margin-top: 6px; font-size: var(--fs-sm); color: var(--muted); }
button.pf-ava-wrap.busy { opacity: .6; animation: ula-pulse 1s ease-in-out infinite; }
@media (max-width: 640px) {
  body.no-bottom-nav .section-menu-btn { display: inline-flex; }
  body.no-bottom-nav .top-profile { order: 4; }
  body.no-bottom-nav #view-admin { padding-bottom: 0; }
  body.no-bottom-nav .fab { bottom: calc(18px + env(safe-area-inset-bottom)); }
  body.no-bottom-nav .quote-bar { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* ===== Страна байера: фильтр в списке байеров ===== */
.buyers-countries { margin: 0 0 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.buyers-countries::-webkit-scrollbar { display: none; }
.buyers-countries .chip { flex: none; white-space: nowrap; }
.b-flag { font-size: 1.05em; }

/* ===== Формы шагами (заказ, партия, товар витрины): как в калькуляторе ===== */
.fstep {
  margin: 0 0 12px; padding: 14px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--paper); transition: border-color .2s, background .2s;
}
.fstep:focus-within { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 4%, var(--paper)); }
.fstep.done { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.fstep-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fstep-num {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: var(--fs-md); font-style: normal;
  transition: background .25s, transform .3s var(--ease);
}
.fstep-ico { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.fstep-ico svg { width: 17px; height: 17px; }
.fstep.done .fstep-num:not(.fstep-ico) { background: var(--green); color: #fff; font-size: 0; transform: scale(1.06); }
.fstep.done .fstep-num:not(.fstep-ico)::before { content: "✓"; font-size: var(--fs-lg); }
.fstep-t { flex: 1; min-width: 0; display: grid; }
.fstep-t b { font-size: var(--fs-lg); }
.fstep-t small { color: var(--muted); font-size: var(--fs-sm); }
.fstep-sum {
  font-style: normal; font-weight: 800; font-size: var(--fs-md); white-space: nowrap; max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.fstep-sum:empty { display: none; }
.fstep .field:last-child, .fstep .grid-2:last-child .field, .fstep .grid-3:last-child .field { margin-bottom: 0; }
.fstep .calc { margin-top: 12px; }
.fstep[data-fs="photos"] .fstep-sum::before { content: "📷 "; }
.fstep[data-fs="sh-orders"] .fstep-sum::before { content: "📦 "; }
@media (prefers-reduced-motion: reduce) { .fstep, .fstep-num { transition: none; } }

/* ---------- Ошибки у пользователей (раздел «Байеры», js/errors.js) ---------- */
#errors-box { margin: 0 0 16px; }
.er-box { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.er-box > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.er-box > summary::-webkit-details-marker { display: none; }
.er-title { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.er-count { min-width: 22px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--red); color: #fff; font-size: var(--fs-xs); text-align: center; }
.er-ok { color: var(--green); font-size: var(--fs-sm); }
.er-hint { margin: 10px 0 4px; color: var(--muted); font-size: var(--fs-sm); }
.er-item { padding: 12px 0; border-top: 1px solid var(--line); }
.er-item:first-of-type { border-top: 0; }
.er-msg { margin: 0 0 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); word-break: break-word; }
.er-meta { margin: 0 0 4px; color: var(--muted); font-size: var(--fs-xs); word-break: break-word; }
.er-stack summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); margin: 4px 0; }
.er-stack pre { max-height: 180px; overflow: auto; margin: 4px 0 8px; padding: 8px; border-radius: 8px; background: var(--soft); font-size: var(--fs-2xs); white-space: pre-wrap; word-break: break-all; }

/* =====================================================
   СТИЛЬ APPLE (по правилам Apple Human Interface Guidelines)
   Цвета и шрифт — в блоке :root в начале файла. Здесь — формы:
   кнопки-«таблетки», карточки без рамок с мягкой тенью,
   переключатели как в iPhone, полупрозрачная шапка.
   Цвет кнопок, который байер выбрал в профиле, не трогаем.
   ===================================================== */
:root {
  --r-btn: 980px;   /* кнопки-«таблетки» */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .05);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .12);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .2);
}
html[data-ui="crisp"] { --r-btn: 6px; }

/* Заголовки — плотнее, как у Apple */
h1, .page-title { letter-spacing: -.022em; }
h2, h3 { letter-spacing: -.012em; }
.modal-head h2 { font-weight: 600; letter-spacing: -.01em; }

/* Шапка: полупрозрачная с размытием, тонкая линия снизу */
.topbar { -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: var(--surface); }
}

/* Кнопки */
.btn-sm, .auth-panel .btn-primary, .auth-panel .btn-google { border-radius: var(--r-btn); }
.btn-primary { box-shadow: none; }
.btn-ghost:hover { background: var(--fill); }

/* Карточки: без рамки, мягкая тень (в тёмной теме — просто светлее фона) */
.card, .client-block, .an-card, .an-kpi, .summary, .assistant, .sh-card, .onboard-card,
.supplier-card, .client-card, .debt-card, .er-box { border-color: transparent; }
.card, .client-block, .an-card, .sh-card, .onboard-card, .assistant, .summary, .er-box { border-radius: var(--r-lg); }

/* Вкладки: выбранная отмечается цветом кнопок (по умолчанию — чёрным) */
.tab.active::after { background: var(--primary); }

/* Переключатели — как в iPhone: серая дорожка, выбранный пункт — белая «плашка» с тенью */
.seg-options { background: var(--fill); border-radius: var(--r-md); padding: 3px; gap: 3px; }
.seg-options span { border-radius: calc(var(--r-md) - 3px); font-weight: 600; transition: background .2s var(--ease), color .2s; }
.seg-options input:checked + span { background: var(--seg-on); color: var(--ink); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }
.seg-options input:focus-visible + span { outline: 3px solid var(--focus-ring); }
.lang-switch { border: 0; background: var(--fill); }
.lang-switch button.active { background: var(--seg-on); color: var(--ink); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }

/* Поля ввода: при вводе — голубая подсветка, как у Apple */
input:focus, select:focus, textarea:focus { border-color: #0071E3; }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { border-color: #3478C8; }
:focus-visible { outline-color: var(--focus-ring); }

/* Меню и сообщения */
.section-menu { border-color: transparent; border-radius: var(--r-lg); }
.toast { border-radius: 980px; font-weight: 600; }

/* =====================================================
   ЖИВОЕ ПОЯВЛЕНИЕ: при входе и при переходе между разделами
   блоки «выезжают» по очереди, с лёгкой пружиной (как в iPhone).
   Классы view-in и tab-in ставит app.js (showView, switchTab).
   ===================================================== */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); }
@keyframes ula-in-up { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ula-in-down { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes ula-in-pop { from { opacity: 0; transform: translateY(40px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes ula-logo-in { from { opacity: 0; transform: scale(.55) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes ula-nav-in { from { opacity: 0; transform: translate(-50%, 130%); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes ula-aside-in { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

/* вход: карточка подпрыгивает, логотип «вкручивается», поля появляются по очереди */
.auth-screen.view-in .auth-panel { animation: ula-in-pop .7s var(--spring) backwards; }
.auth-screen.view-in .auth-panel .logo-full { animation: ula-logo-in .8s var(--spring) .12s backwards; }
.auth-screen.view-in .auth-panel > :not(.logo-full) { animation: ula-in-up .5s var(--ease) backwards; }
.auth-screen.view-in .auth-panel > :nth-child(2) { animation-delay: .2s; }
.auth-screen.view-in .auth-panel > :nth-child(3) { animation-delay: .25s; }
.auth-screen.view-in .auth-panel > :nth-child(4) { animation-delay: .3s; }
.auth-screen.view-in .auth-panel > :nth-child(5) { animation-delay: .35s; }
.auth-screen.view-in .auth-panel > :nth-child(6) { animation-delay: .4s; }
.auth-screen.view-in .auth-panel > :nth-child(n+7) { animation-delay: .45s; }
.auth-screen.view-in .auth-aside-in { animation: ula-aside-in .8s var(--ease) .1s backwards; }

/* кабинет: шапка съезжает сверху, нижнее меню выпрыгивает снизу */
#view-admin.view-in .topbar { animation: ula-in-down .55s var(--ease) backwards; }
@media (max-width: 640px) {
  #view-admin.view-in .bottom-nav { animation: ula-nav-in .7s var(--spring) .3s backwards; }
}

/* раздел: блоки появляются по очереди снизу вверх */
#view-admin main.tab-in > :not(.fab):not(.quote-bar):not(.hidden) { animation: ula-in-up .55s var(--ease) backwards; }
#view-admin main.tab-in > :nth-child(2) { animation-delay: .05s; }
#view-admin main.tab-in > :nth-child(3) { animation-delay: .1s; }
#view-admin main.tab-in > :nth-child(4) { animation-delay: .15s; }
#view-admin main.tab-in > :nth-child(5) { animation-delay: .2s; }
#view-admin main.tab-in > :nth-child(6) { animation-delay: .25s; }
#view-admin main.tab-in > :nth-child(n+7) { animation-delay: .3s; }
/* карточки заказов — «лесенкой» */
#view-admin main.tab-in .orders > .card { animation: ula-in-up .6s var(--ease) backwards; }
#view-admin main.tab-in .orders > .card:nth-child(1) { animation-delay: .3s; }
#view-admin main.tab-in .orders > .card:nth-child(2) { animation-delay: .37s; }
#view-admin main.tab-in .orders > .card:nth-child(3) { animation-delay: .44s; }
#view-admin main.tab-in .orders > .card:nth-child(4) { animation-delay: .51s; }
#view-admin main.tab-in .orders > .card:nth-child(n+5) { animation-delay: .58s; }

/* нажатие на нижнее меню и плитки — упругое, как в iPhone */
.bn-item:active { transform: scale(.88); transition: transform .1s; }
.bn-item { transition: background .25s var(--ease), transform .45s var(--spring); }

/* =====================================================
   ЧАТ ПОДДЕРЖКИ (js/support.js) — как мессенджер в iPhone:
   шапка с фото, пузырьки с хвостиком, время и ✓✓ внутри пузырька,
   «печатает…», поле ввода внизу с круглой кнопкой.
   ===================================================== */
.sp-modal .modal-sheet { height: 94vh; height: 94dvh; max-height: none; }
@media (min-width: 641px) { .sp-modal .modal-sheet { max-width: 560px; height: min(760px, 90vh); } }

.sp-head { gap: 12px; padding: 10px 10px 10px 16px; }
.sp-head-t { flex: 1; min-width: 0; }
.sp-head-t h2 { font-size: var(--fs-xl); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-status { margin: 1px 0 0; color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .2s; }
.sp-status.on { color: #1F9D55; }
html[data-theme="dark"] .sp-status.on { color: #27966C; }

.sp-ava { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 85%, #fff), var(--primary)); color: var(--on-primary);
  font-weight: 700; font-size: var(--fs-base); letter-spacing: .01em; }
.sp-ava img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.sp-ava-sm { width: 28px; height: 28px; font-size: var(--fs-2xs); align-self: flex-end; }
.sp-ava-sm.ghost { visibility: hidden; }
.sp-ava-lg { width: 76px; height: 76px; font-size: var(--fs-5xl); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }

.sp-log { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 8px; background: var(--paper); scroll-behavior: smooth; }
.sp-loading, .sp-empty { margin: auto; color: var(--muted); }
.sp-hello { margin: auto; display: grid; justify-items: center; gap: 8px; max-width: 320px; padding: 24px 12px; text-align: center; animation: ula-in-up .5s var(--ease) backwards; }
.sp-hello b { font-size: var(--fs-xl); }
.sp-hello p { margin: 0; color: var(--muted); font-size: var(--fs-md); }

.sp-day { display: flex; justify-content: center; margin: 10px 0 6px; position: sticky; top: 0; z-index: 1; }
.sp-day span { padding: 3px 10px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--surface) 85%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; box-shadow: var(--shadow-sm); }

.sp-row { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.sp-row.mine { justify-content: flex-end; }
.sp-row.tail { margin-bottom: 6px; }
.sp-row.sp-new { animation: sp-in .32s var(--spring, cubic-bezier(.34, 1.56, .64, 1)) backwards; }
.sp-row.mine.sp-new { transform-origin: bottom right; }
.sp-row.theirs.sp-new { transform-origin: bottom left; }
@keyframes sp-in { from { opacity: 0; transform: translateY(10px) scale(.92); } to { opacity: 1; transform: none; } }

.sp-bubble { position: relative; max-width: min(78%, 440px); padding: 7px 12px 7px; border-radius: 18px;
  font-size: var(--fs-lg); line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-row.mine .sp-bubble { background: #3478C8; color: #fff; }
.sp-row.theirs .sp-bubble { background: var(--surface); color: var(--ink); box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.sp-row.mine.tail .sp-bubble { border-bottom-right-radius: 6px; }
.sp-row.theirs.tail .sp-bubble { border-bottom-left-radius: 6px; }
.sp-row.mine:not(.tail) .sp-bubble { border-bottom-right-radius: 8px; }
.sp-row.theirs:not(.tail) .sp-bubble { border-bottom-left-radius: 8px; }
html[data-theme="dark"] .sp-row.theirs .sp-bubble { background: #262628; }

/* время и галочки — внутри пузырька, справа снизу */
.sp-meta { float: right; display: inline-flex; align-items: center; gap: 2px; margin: 6px 0 -3px 10px; font-size: var(--fs-2xs); opacity: .65; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-tick { display: inline-flex; font-style: normal; }
.sp-tick .ico { width: 13px; height: 13px; stroke-width: 2.6; }
.sp-tick .ico + .ico { margin-left: -8px; }
.sp-tick.read { opacity: 1; }
.sp-tick.wait { width: 11px; height: 11px; border: 1.6px solid currentColor; border-radius: 50%; position: relative; }
.sp-tick.wait::after { content: ""; position: absolute; left: 4px; top: 1px; width: 1.6px; height: 4px; background: currentColor; transform-origin: bottom; animation: spin 1s linear infinite; }
.sp-tick.fail { width: 15px; height: 15px; border-radius: 50%; background: #C62828; color: #fff; font-size: var(--fs-2xs); font-weight: 800; justify-content: center; }
.sp-row[data-retry] { cursor: pointer; }
.sp-row[data-retry] .sp-bubble { opacity: .7; }
.sp-row.mine .support-tech, .sp-row .support-tech { clear: both; }

/* «печатает…» — три прыгающие точки */
.sp-dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.sp-dots b { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .4; animation: sp-dot 1.2s infinite ease-in-out; }
.sp-dots b:nth-child(2) { animation-delay: .15s; }
.sp-dots b:nth-child(3) { animation-delay: .3s; }
@keyframes sp-dot { 0%, 60%, 100% { transform: none; opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
.sp-typing { padding: 12px 14px; color: var(--muted); }
.sp-typing .sp-dots b { width: 7px; height: 7px; }
.sp-loading .sp-dots b { width: 8px; height: 8px; }

/* поле ввода */
.sp-composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.sp-note { margin: 0 4px 6px; color: var(--muted); font-size: var(--fs-2xs); line-height: 1.35; }
.sp-note:empty { display: none; }
.sp-input { display: flex; align-items: flex-end; gap: 8px; }
.sp-input textarea { flex: 1; min-height: 40px !important; max-height: 132px; padding: 9px 14px; border-radius: 20px !important; resize: none;
  background: var(--paper); border-color: var(--line); line-height: 1.35; }
.sp-send { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: #3478C8; color: #fff; cursor: pointer; transition: transform .2s var(--spring, ease), opacity .2s; }
.sp-send:active { transform: scale(.88); }
.sp-input textarea:placeholder-shown + .sp-send { opacity: .45; transform: scale(.9); }

/* список обращений у админа: фото, имя, последнее сообщение */
.support-thread { grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; border-color: transparent; background: var(--soft); transition: background .15s, transform .15s; }
.support-thread:hover { border-color: transparent; background: var(--hover); }
.support-thread:active { transform: scale(.99); }
.support-thread.unread { border-color: transparent; background: color-mix(in srgb, #3478C8 8%, var(--soft)); }
.support-thread.unread b { font-weight: 800; }
.support-thread-body { display: grid; gap: 1px; min-width: 0; }
.support-thread-last { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.support-thread-last .badge-inline { margin-left: auto; flex: none; background: #3478C8; }
@media (prefers-reduced-motion: reduce) { .sp-log { scroll-behavior: auto; } }

/* =====================================================
   ЧАТ ПОДДЕРЖКИ В СТИЛЕ WHATSAPP
   Телефон: во весь экран, кнопка «назад», окно сжимается над клавиатурой (--sp-vh из js/support.js).
   Фон с узором, свои сообщения — зелёные, входящие — белые, «хвостик» у первого сообщения группы,
   прочитанные — синие ✓✓. Цвета — в переменных --wa-* (светлая и тёмная тема).
   ===================================================== */
.sp-modal {
  --wa-bg: #EFEAE2; --wa-head: #FFFFFF; --wa-in: #FFFFFF; --wa-out: #D9FDD3; --wa-text: #111B21; --wa-meta: #667781;
  --wa-read: #53BDEB; --wa-green: #00A884; --wa-bar: #F0F2F5; --wa-input: #FFFFFF; --wa-chip: #FFFFFF; --wa-chip-text: #54656F;
  --wa-doodle: rgba(11, 20, 26, .045);
}
html[data-theme="dark"] .sp-modal {
  --wa-bg: #0B141A; --wa-head: #202C33; --wa-in: #202C33; --wa-out: #005C4B; --wa-text: #E9EDEF; --wa-meta: rgba(233, 237, 239, .6);
  --wa-bar: #202C33; --wa-input: #2A3942; --wa-chip: #182229; --wa-chip-text: #8696A0; --wa-doodle: rgba(255, 255, 255, .03);
}
.sp-modal .modal-sheet { background: var(--wa-bg); color: var(--wa-text); }

/* шапка */
.sp-head { min-height: 60px; padding: 8px 8px 8px 14px; gap: 10px; background: var(--wa-head); border-bottom: 1px solid color-mix(in srgb, var(--wa-meta) 18%, transparent); }
.sp-head-t h2 { color: var(--wa-text); font-size: var(--fs-lg); }
.sp-status, .sp-status.on { color: var(--wa-meta); }
.sp-status.on .sp-dots, .sp-status:has(.sp-dots) { color: var(--wa-green); }
html[data-theme="dark"] .sp-status.on { color: var(--wa-meta); }
.sp-head .sp-ava { width: 40px; height: 40px; }
.sp-back { display: none; flex: none; place-items: center; width: 36px; height: 44px; margin-right: -6px; border: 0; background: none; color: var(--wa-green); cursor: pointer; }
.sp-close { color: var(--wa-meta); }

/* переписка: фон с узором */
.sp-log { gap: 2px; padding: 10px 6% 10px; background-color: var(--wa-bg);
  background-image:
    radial-gradient(circle at 20px 20px, var(--wa-doodle) 3px, transparent 3.5px),
    radial-gradient(circle at 70px 60px, transparent 7px, var(--wa-doodle) 7.5px, var(--wa-doodle) 9px, transparent 9.5px),
    radial-gradient(circle at 100px 15px, var(--wa-doodle) 2px, transparent 2.5px);
  background-size: 120px 90px; }
@media (max-width: 640px) { .sp-log { padding: 8px 10px; } }

.sp-day { margin: 12px 0 8px; }
.sp-day span { padding: 5px 12px; border-radius: 8px; background: var(--wa-chip); color: var(--wa-chip-text); font-size: var(--fs-sm); font-weight: 500;
  text-transform: none; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* пузырьки */
.sp-row { padding: 0 8px; }
.sp-row.head { margin-top: 8px; }
.sp-row.tail { margin-bottom: 0; }
.sp-bubble, .sp-row.mine .sp-bubble, .sp-row.theirs .sp-bubble,
.sp-row.mine.tail .sp-bubble, .sp-row.theirs.tail .sp-bubble,
.sp-row.mine:not(.tail) .sp-bubble, .sp-row.theirs:not(.tail) .sp-bubble {
  max-width: 82%; padding: 6px 8px 7px 9px; border-radius: 8px; color: var(--wa-text);
  font-size: var(--fs-lg); line-height: 1.38; box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.sp-row.mine .sp-bubble { background: var(--wa-out); }
.sp-row.theirs .sp-bubble, html[data-theme="dark"] .sp-row.theirs .sp-bubble { background: var(--wa-in); }
@media (max-width: 640px) { .sp-bubble, .sp-row.mine .sp-bubble, .sp-row.theirs .sp-bubble { font-size: var(--fs-lg); } }
/* «хвостик» у первого сообщения группы */
.sp-row.head.mine .sp-bubble { border-top-right-radius: 0; }
.sp-row.head.theirs .sp-bubble { border-top-left-radius: 0; }
.sp-row.head .sp-bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.sp-row.head.mine .sp-bubble::before { right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.sp-row.head.theirs .sp-bubble::before { left: -8px; background: var(--wa-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }

/* время и галочки */
.sp-meta { margin: 8px 0 -4px 12px; color: var(--wa-meta); opacity: 1; font-size: var(--fs-2xs); }
.sp-tick { color: var(--wa-meta); }
.sp-tick.read { color: var(--wa-read); }
.sp-tick .ico { width: 15px; height: 15px; }
.sp-tick .ico + .ico { margin-left: -10px; }
.sp-typing { color: var(--wa-meta); }

/* поле ввода */
.sp-composer { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--wa-bar); border-top: 0; }
.sp-note { color: var(--wa-meta); text-align: center; }
.sp-input { align-items: flex-end; gap: 6px; }
.sp-input textarea, .sp-input textarea:focus { min-height: 44px !important; padding: 11px 16px; border: 0; border-radius: 22px !important;
  background: var(--wa-input); color: var(--wa-text); box-shadow: 0 1px .5px rgba(11, 20, 26, .1); font-size: var(--fs-lg); }
.sp-input textarea::placeholder { color: var(--wa-meta); }
.sp-send { width: 44px; height: 44px; background: var(--wa-green); }
.sp-send svg { margin-left: -2px; }
.sp-input textarea:placeholder-shown + .sp-send { opacity: .55; transform: none; }

/* телефон: во весь экран, выезжает справа, как переход в чат */
@media (max-width: 640px) {
  .sp-modal .modal-backdrop { display: none; }
  .sp-modal .modal-sheet { position: fixed; left: 0; right: 0; top: var(--sp-top, 0); height: var(--sp-vh, 100dvh); max-height: none; border-radius: 0; }
  .sp-modal.open .modal-sheet { animation: sp-push .32s cubic-bezier(.2, .8, .2, 1); }
  .sp-modal .sp-head { padding-top: calc(8px + env(safe-area-inset-top)); padding-left: 4px; }
  .sp-back { display: grid; }
  .sp-close { display: none; }
}
@keyframes sp-push { from { transform: translateX(40%); opacity: 0; } to { transform: none; opacity: 1; } }

/* список обращений у админа — как список чатов */
.support-threads { gap: 0; }
.support-thread, .support-thread:hover, .support-thread.unread { padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.support-thread:hover { background: var(--hover); }
.support-thread .sp-ava { width: 48px; height: 48px; font-size: var(--fs-xl); }
.support-thread-top b { font-size: var(--fs-lg); }
.support-thread.unread .support-thread-top small { color: #00A884; font-weight: 600; }
.support-thread-last .badge-inline { background: #00A884; color: #fff; }
/* открыто окно (чат и др.) — плашка «Вышло обновление» не закрывает поле ввода, покажется после закрытия */
body.no-scroll .pwa-update { display: none; }
/* сообщения внизу экрана — над полем ввода чата */
body:has(.sp-modal.open) .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ---------- Чат: фото, скриншоты и файлы ---------- */
.sp-attach { flex: none; display: grid; place-items: center; width: 40px; height: 44px; border: 0; background: none; color: var(--wa-meta); cursor: pointer; transition: color .15s, transform .15s; }
.sp-attach:hover { color: var(--wa-green); }
.sp-attach:active { transform: scale(.9) rotate(-12deg); }
.sp-form-ok .sp-attach, .sp-composer.has-draft .sp-send { opacity: 1; }
.sp-composer.has-draft .sp-input textarea:placeholder-shown + .sp-send { opacity: 1; transform: none; }

/* выбранные файлы над полем ввода */
.sp-draft { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: none; }
.sp-draft::-webkit-scrollbar { display: none; }
.sp-chip { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--wa-input);
  box-shadow: 0 1px 2px rgba(11, 20, 26, .15); animation: sp-in .25s var(--spring, ease) backwards; }
.sp-chip img { width: 100%; height: 100%; object-fit: cover; }
.sp-chip .sp-file-ico { width: 100%; height: 100%; border-radius: 0; }
.sp-chip-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: var(--fs-base); line-height: 1; cursor: pointer; }

/* фото в сообщении: одно — крупно, несколько — плиткой */
.sp-bubble.has-files { padding: 3px 3px 6px; }
.sp-bubble.has-files.no-text { padding-bottom: 3px; }
.sp-bubble.has-files > :not(.sp-imgs):not(.sp-file):not(.sp-video):not(.sp-meta):not(.support-tech) { margin: 0 6px; }
.sp-bubble.has-files { white-space: normal; }
.sp-imgs { display: grid; gap: 3px; width: min(270px, 64vw); border-radius: 6px; overflow: hidden; }
.sp-imgs.n2, .sp-imgs.n3, .sp-imgs.n4 { grid-template-columns: 1fr 1fr; }
.sp-imgs.n3 .sp-img:first-child { grid-column: 1 / -1; }
.sp-img { position: relative; display: block; padding: 0; border: 0; background: color-mix(in srgb, var(--wa-meta) 18%, transparent); cursor: zoom-in; aspect-ratio: 1; overflow: hidden; }
.sp-imgs.n1 .sp-img { aspect-ratio: auto; min-height: 120px; max-height: 340px; }
.sp-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sp-imgs.n1 .sp-img img { height: auto; max-height: 340px; }
.sp-img-wait, .sp-file.wait { animation: ula-pulse 1.4s ease-in-out infinite; }
.sp-img-wait { position: absolute; inset: 0; }
.sp-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff; font-size: var(--fs-3xl); }
/* отправляется: кружок поверх */
.sp-up { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; background: rgba(0, 0, 0, .35); animation: spin .9s linear infinite; }
.sp-file .sp-up { position: static; flex: none; margin: 0; width: 22px; height: 22px; border-color: color-mix(in srgb, var(--wa-meta) 30%, transparent); border-top-color: var(--wa-green); background: none; }

/* документ: значок с расширением, имя, размер */
.sp-file { display: flex; align-items: center; gap: 10px; min-width: min(250px, 62vw); margin-bottom: 2px; padding: 9px 10px; border-radius: 6px;
  background: color-mix(in srgb, var(--wa-meta) 12%, transparent); color: var(--wa-text); text-decoration: none; }
.sp-file:hover { color: var(--wa-text); background: color-mix(in srgb, var(--wa-meta) 18%, transparent); }
.sp-file .ico { flex: none; color: var(--wa-meta); }
.sp-file-ico { flex: none; display: grid; place-items: center; width: 36px; height: 42px; border-radius: 5px; background: #E8505B; color: #fff;
  font-size: var(--fs-2xs); font-weight: 800; font-style: normal; letter-spacing: .02em; }
.sp-file-t { flex: 1; min-width: 0; display: grid; }
.sp-file-t b { font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file-t small { color: var(--wa-meta); font-size: var(--fs-xs); }
.sp-video { display: block; width: min(270px, 64vw); max-height: 360px; border-radius: 6px; background: #000; }
.sp-bubble.has-files .sp-meta { margin-right: 4px; }

/* перетаскивание файла в окно чата */
.sp-modal .modal-sheet.sp-drop::after { content: ""; position: absolute; inset: 8px; z-index: 5; border: 3px dashed var(--wa-green); border-radius: 14px;
  background: color-mix(in srgb, var(--wa-green) 10%, transparent); pointer-events: none; }

/* =====================================================
   ЧАТ ПОДДЕРЖКИ — В СТИЛЕ БРЕНДА ULA FACTORY
   Чёрная шапка как на логотипе, свои сообщения — фирменным красным,
   на фоне — еле заметный узор-тундук из знака ULA.
   ===================================================== */
.sp-modal {
  --wa-bg: #F3F2F4; --wa-head: #17191D; --wa-in: #FFFFFF; --wa-out: #B50919; --wa-text: #17191D; --wa-meta: #7A7880;
  --wa-read: #FFFFFF; --wa-green: #B50919; --wa-bar: #FFFFFF; --wa-input: #F3F2F4; --wa-chip: #FFFFFF; --wa-chip-text: #5D5B62;
  --ula-pattern: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22180%22%20height=%22180%22%20viewBox=%220%200%20180%20180%22%3E%3Cg%20transform=%22translate%2810%2012%29%20scale%28.62%29%22%3E%3Cg%20fill=%22none%22%20stroke=%22rgba%2821,20,23,0.055%29%22%20stroke-linecap=%22round%22%3E%3Cpath%20d=%22M14.5%2047A22%2022%200%201%201%2049.5%2047%22%20stroke-width=%223.6%22/%3E%3Cg%20stroke-width=%221.7%22%3E%3Cpath%20d=%22M16.3%2019.1C26%2022.1%2040.6%2031.1%2050.1%2042.5%22/%3E%3Cpath%20d=%22M14.3%2022.1C24.9%2024.4%2038.9%2033%2048.4%2044.9%22/%3E%3Cpath%20d=%22M12.6%2023.8C23.9%2026.7%2037.2%2034.9%2046.5%2046.8%22/%3E%3Cpath%20d=%22M47.7%2019.1C38%2022.1%2023.4%2031.1%2013.9%2042.5%22/%3E%3Cpath%20d=%22M49.7%2022.1C39.1%2024.4%2025.1%2033%2015.6%2044.9%22/%3E%3Cpath%20d=%22M51.4%2023.8C40.1%2026.7%2026.8%2034.9%2017.5%2046.8%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20transform=%22translate%28100%2098%29%20scale%28.62%29%20rotate%2812%2032%2032%29%22%3E%3Cg%20fill=%22none%22%20stroke=%22rgba%2821,20,23,0.055%29%22%20stroke-linecap=%22round%22%3E%3Cpath%20d=%22M14.5%2047A22%2022%200%201%201%2049.5%2047%22%20stroke-width=%223.6%22/%3E%3Cg%20stroke-width=%221.7%22%3E%3Cpath%20d=%22M16.3%2019.1C26%2022.1%2040.6%2031.1%2050.1%2042.5%22/%3E%3Cpath%20d=%22M14.3%2022.1C24.9%2024.4%2038.9%2033%2048.4%2044.9%22/%3E%3Cpath%20d=%22M12.6%2023.8C23.9%2026.7%2037.2%2034.9%2046.5%2046.8%22/%3E%3Cpath%20d=%22M47.7%2019.1C38%2022.1%2023.4%2031.1%2013.9%2042.5%22/%3E%3Cpath%20d=%22M49.7%2022.1C39.1%2024.4%2025.1%2033%2015.6%2044.9%22/%3E%3Cpath%20d=%22M51.4%2023.8C40.1%2026.7%2026.8%2034.9%2017.5%2046.8%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
html[data-theme="dark"] .sp-modal {
  --wa-bg: #0C0B0E; --wa-head: #17191D; --wa-in: #1B1D21; --wa-out: #B50919; --wa-text: #F2F1F4; --wa-meta: rgba(242, 241, 244, .55);
  --wa-green: #FF6B78; --wa-bar: #17191D; --wa-input: #24232A; --wa-chip: #1B1D21; --wa-chip-text: #A9A7B0; --ula-pattern: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22180%22%20height=%22180%22%20viewBox=%220%200%20180%20180%22%3E%3Cg%20transform=%22translate%2810%2012%29%20scale%28.62%29%22%3E%3Cg%20fill=%22none%22%20stroke=%22rgba%28255,255,255,0.035%29%22%20stroke-linecap=%22round%22%3E%3Cpath%20d=%22M14.5%2047A22%2022%200%201%201%2049.5%2047%22%20stroke-width=%223.6%22/%3E%3Cg%20stroke-width=%221.7%22%3E%3Cpath%20d=%22M16.3%2019.1C26%2022.1%2040.6%2031.1%2050.1%2042.5%22/%3E%3Cpath%20d=%22M14.3%2022.1C24.9%2024.4%2038.9%2033%2048.4%2044.9%22/%3E%3Cpath%20d=%22M12.6%2023.8C23.9%2026.7%2037.2%2034.9%2046.5%2046.8%22/%3E%3Cpath%20d=%22M47.7%2019.1C38%2022.1%2023.4%2031.1%2013.9%2042.5%22/%3E%3Cpath%20d=%22M49.7%2022.1C39.1%2024.4%2025.1%2033%2015.6%2044.9%22/%3E%3Cpath%20d=%22M51.4%2023.8C40.1%2026.7%2026.8%2034.9%2017.5%2046.8%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3Cg%20transform=%22translate%28100%2098%29%20scale%28.62%29%20rotate%2812%2032%2032%29%22%3E%3Cg%20fill=%22none%22%20stroke=%22rgba%28255,255,255,0.035%29%22%20stroke-linecap=%22round%22%3E%3Cpath%20d=%22M14.5%2047A22%2022%200%201%201%2049.5%2047%22%20stroke-width=%223.6%22/%3E%3Cg%20stroke-width=%221.7%22%3E%3Cpath%20d=%22M16.3%2019.1C26%2022.1%2040.6%2031.1%2050.1%2042.5%22/%3E%3Cpath%20d=%22M14.3%2022.1C24.9%2024.4%2038.9%2033%2048.4%2044.9%22/%3E%3Cpath%20d=%22M12.6%2023.8C23.9%2026.7%2037.2%2034.9%2046.5%2046.8%22/%3E%3Cpath%20d=%22M47.7%2019.1C38%2022.1%2023.4%2031.1%2013.9%2042.5%22/%3E%3Cpath%20d=%22M49.7%2022.1C39.1%2024.4%2025.1%2033%2015.6%2044.9%22/%3E%3Cpath%20d=%22M51.4%2023.8C40.1%2026.7%2026.8%2034.9%2017.5%2046.8%22/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.sp-log { background-color: var(--wa-bg); background-image: var(--ula-pattern); background-size: 180px 180px; }

/* шапка: чёрная, белый текст, тонкая красная линия снизу — как полоски у «FACTORY» на логотипе */
.sp-head { background: var(--wa-head); border-bottom: 0; box-shadow: inset 0 -2px 0 #B50919; color: #fff; }
.sp-head-t h2 { color: #fff; letter-spacing: -.01em; }
.sp-status, .sp-status.on { color: rgba(255, 255, 255, .62); }
.sp-status.on::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #27966C; vertical-align: 1px; }
.sp-status:has(.sp-dots) { color: #FF8A96; }
.sp-status:has(.sp-dots)::before { display: none; }
.sp-back, .sp-close { color: #fff; }
.sp-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sp-head .sp-ava { background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .14); }
.sp-ava.sp-brand { background: #17191D; }
.sp-ava.sp-brand img, .sp-head .sp-ava.sp-brand img { background: transparent; }

/* свои сообщения — фирменный красный, белый текст */
.sp-row.mine .sp-bubble { background: linear-gradient(160deg, #B5132A, #B50919 55%, #8E0D1B); color: #fff; }
.sp-row.head.mine .sp-bubble::before { background: #B5132A; }
.sp-row.mine .sp-meta, .sp-row.mine .sp-tick { color: rgba(255, 255, 255, .72); }
.sp-row.mine .sp-tick.read { color: #fff; }
.sp-row.mine .sp-file { background: rgba(255, 255, 255, .14); color: #fff; }
.sp-row.mine .sp-file:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.sp-row.mine .sp-file-t small, .sp-row.mine .sp-file .ico { color: rgba(255, 255, 255, .75); }
.sp-row.mine .sp-file-ico { background: #fff; color: #B50919; }
.sp-row.mine .support-tech summary { color: rgba(255, 255, 255, .8); }
.sp-bubble { box-shadow: 0 1px 1px rgba(21, 20, 23, .08), 0 2px 8px rgba(21, 20, 23, .05); }

/* даты — тёмные плашки с белым текстом */
.sp-day span { background: rgba(21, 20, 23, .72); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: none; letter-spacing: .02em; }

/* поле ввода: красная круглая кнопка, скрепка — красная при наведении */
.sp-composer { border-top: 1px solid color-mix(in srgb, var(--wa-meta) 18%, transparent); }
.sp-input textarea, .sp-input textarea:focus { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wa-meta) 22%, transparent); }
.sp-input textarea:focus { box-shadow: inset 0 0 0 1.5px #B50919; }
.sp-send { background: linear-gradient(160deg, #C4162E, #B50919); box-shadow: 0 4px 12px rgba(181, 9, 25, .35); }
.sp-input textarea:placeholder-shown + .sp-send { box-shadow: none; }

/* пустой чат: знак ULA и приветствие */
.sp-hello .sp-ava-lg { background: #17191D; box-shadow: 0 10px 30px rgba(181, 9, 25, .25); }
.sp-hello b { font-size: var(--fs-xl); letter-spacing: -.01em; }

/* перетаскивание и «печатает» — красным */
.sp-modal .modal-sheet.sp-drop::after { border-color: #B50919; background: rgba(181, 9, 25, .08); }
.sp-file .sp-up { border-top-color: var(--wa-green); }

/* список обращений у админа: метки красные */
.support-thread.unread .support-thread-top small { color: #B50919; }
.support-thread-last .badge-inline { background: #B50919; }
html[data-theme="dark"] .support-thread.unread .support-thread-top small { color: #FF6B78; }
#support-log .sp-row.mine .sp-bubble { color: #fff; }

/* ---------- Главная ---------- */
.home-h { margin: 0 0 8px; font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.home-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.home-more { padding: 0; font-size: var(--fs-md); font-weight: 600; color: var(--muted); white-space: nowrap; }
.home-act, .home-money { margin: 0 0 14px; }
/* «Разместить заказ»: «Новый заказ» — тёмная строка на всю ширину, ниже три плитки в ряд */
.ha-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ha-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 84px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  transition: border-color .15s, transform .15s var(--ease); }
.ha-tile:hover { border-color: var(--ink); }
.ha-tile:active { transform: scale(.98); }
.ha-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--soft); }
.ha-tile b { font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; }
.ha-tile small { display: none; font-size: var(--fs-xs); line-height: 1.3; color: var(--muted); }
.ha-main { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; justify-items: start; text-align: left;
  min-height: 64px; padding: 12px 16px; background: var(--ink); border-color: var(--ink); color: var(--surface); }
.ha-main:hover { border-color: var(--ink); }
.ha-main .ha-ico { grid-row: 1 / 3; background: rgba(255,255,255,.14); }
.ha-main b { font-size: var(--fs-xl); }
.ha-main small { display: block; color: rgba(255,255,255,.7); }
@media (min-width: 760px) {
  .ha-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .ha-main { grid-column: auto; }
  .ha-tile { align-items: flex-start; text-align: left; padding: 12px 14px; }
  .ha-tile b { font-size: var(--fs-base); }
  .ha-tile small { display: block; }
}
body.simple-mode #home-import, body.simple-mode #home-quote { display: none !important; }
body.readonly .ha-grid { display: none; }

/* ---------- Нижнее меню: белая плашка, посередине вырез и круглая красная «+» ---------- */
@media (max-width: 640px) {
  .bottom-nav { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
    filter: drop-shadow(0 8px 22px rgba(0,0,0,.16)) drop-shadow(0 1px 2px rgba(0,0,0,.06)); }
  .bottom-nav::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 30px; background: var(--surface); }
  .bottom-nav.has-plus::before {
    -webkit-mask: radial-gradient(circle 37px at 50% 0, transparent 36px, #000 37px);
    mask: radial-gradient(circle 37px at 50% 0, transparent 36px, #000 37px); }
  /* цвета логотипа: оранжевый круг «+», активный раздел — тёмно-оранжевый (читается на белом) */
  .bn-item.active { background: none; color: #B50919; }
  .bn-plus { align-content: end; padding-bottom: 7px; }
  .bn-plus-c { position: absolute; left: 50%; top: -28px; transform: translateX(-50%); display: grid; place-items: center;
    width: 58px; height: 58px; border-radius: 50%; background: #B50919; color: #fff;
    box-shadow: 0 8px 18px rgba(255,106,61,.45); transition: transform .2s var(--ease); }
  .bn-plus:active .bn-plus-c { transform: translateX(-50%) scale(.92); }
  .bn-plus span { color: var(--muted); }
  /* «+» внизу заменяет плавающую кнопку */
  body:not(.no-bottom-nav) #view-admin:has(.bottom-nav.has-plus) .fab { display: none; }
}

/* На телефоне «Новый заказ» — круглая «+» в нижнем меню, большую кнопку на главной прячем (на компьютере она остаётся) */
@media (max-width: 640px) { .ha-main { display: none; } }

/* ---------- Обмен у байера: две вкладки, «Обмен в ULA» первой ---------- */
.fx-subtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--soft); }
.fx-subtabs button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 12px; background: none;
  color: var(--muted); font: inherit; font-size: var(--fs-md); font-weight: 600; line-height: 1.2; cursor: pointer; }
.fx-subtabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.fx-tab-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--red); color: #fff; font-size: var(--fs-xs); line-height: 20px; }
.fx-hero-top { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.fx-hero-main { display: grid; min-width: 0; }
.fx-hero .rc-big b { font-size: var(--fs-5xl); }
.fx-hero .fx-calc { margin: 14px 0; padding: 12px; border-radius: 14px; background: var(--soft); }
.fx-sent { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--green-tint); color: var(--green); font-size: var(--fs-md); font-weight: 500; }
.fx-sent span { flex: 1; min-width: 160px; }
.fx-hero .rc-more { margin-top: 14px; }
.fx-hero .fx-steps { margin: 14px 0 0; padding: 12px; border-radius: 14px; background: var(--soft); font-size: var(--fs-md); color: var(--muted); display: grid; gap: 8px; list-style: none; counter-reset: fxs; }
.fx-hero .fx-steps li { position: relative; display: block; min-height: 24px; padding: 0 0 0 34px; counter-increment: fxs; line-height: 1.35; }
.fx-hero .fx-steps li::before { content: counter(fxs); position: absolute; left: 4px; top: -1px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--ink); color: var(--surface); font-size: var(--fs-sm); font-weight: 700; }
.fx-hero .fx-steps li::after { content: none; }
/* настройки «Моего обмена» — сворачиваются */
.fx-set > summary { cursor: pointer; font-size: var(--fs-base); font-weight: 600; list-style-position: inside; }
.fx-set[open] > summary { margin-bottom: 6px; }

/* ---------- Обмен: оплата → чек → заявка ---------- */
.fx-stepn { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; font-size: var(--fs-base); font-weight: 600; }
.fx-stepn i { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--surface); font-size: var(--fs-sm); font-style: normal; font-weight: 700; }
.fx-req { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 14px; background: var(--soft); }
.fx-req .fx-note { margin: 0; flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.fx-req-none { margin: 0; font-size: var(--fs-md); }
.fx-rcpt-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 64px; border: 2px dashed var(--line); border-radius: 14px; background: none;
  color: var(--ink); font: inherit; font-size: var(--fs-base); font-weight: 600; cursor: pointer; }
.fx-rcpt-add:hover { border-color: var(--ink); }
.fx-rcpt { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.fx-rcpt img, .fx-rcpt-pdf { flex: none; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--soft); }
.fx-rcpt-pdf { display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 700; font-style: normal; color: var(--muted); }
.fx-rcpt-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); }
.fx-rcpt-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: var(--fs-xl); cursor: pointer; }

/* ---------- Реквизиты с QR-кодом ---------- */
.fx-req { flex-wrap: wrap; align-items: center; }
.fx-req h3 { flex: 1 0 100%; margin: 0 0 4px; font-size: var(--fs-md); }
.fx-qr { flex: 1 0 100%; display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: zoom-in; }
.fx-qr img { width: 100%; max-width: 220px; aspect-ratio: 1; object-fit: contain; padding: 8px; border-radius: 14px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.fx-qr small { font-size: var(--fs-xs); }
.fx-qr-ed { margin: 4px 0; }
.fx-qr-ed .fx-rcpt img { object-fit: contain; background: #fff; }

/* ---------- Ступени курса: мелко, все видны, нужная подсвечена ---------- */
.fx-tiers-c .fx-tiers { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 10px 0; }
.fx-tiers-c .fx-tier { flex-direction: column; align-items: flex-start; gap: 0; padding: 6px 9px; border-radius: 10px; font-size: var(--fs-2xs); color: var(--muted); line-height: 1.3; }
.fx-tiers-c .fx-tier b { font-size: var(--fs-md); color: var(--ink); }
.fx-tiers-c .fx-tier.on { color: #27966C; }
.rate-card .fx-tiers-c .fx-tiers { margin: 10px 0 0; }
.rate-card .rc-calc { margin: 10px 0 0; }

/* Проверка личности: фото документов прямо в карточке */
.kyc-thumbs { display: flex; gap: 8px; margin: 10px 0 4px; }
.kyc-thumb { flex: 1; min-width: 0; padding: 0; border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 10px; background: none; overflow: hidden; cursor: zoom-in; display: grid; }
.kyc-thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.kyc-thumb small { padding: 4px 6px; font-size: var(--fs-2xs); color: var(--muted, #888); text-align: center; }

/* Обмен выключен — предупреждение над ссылкой */
.fx-off-warn { margin: 8px 0 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #DCA43A 14%, transparent); border: 1px solid color-mix(in srgb, #DCA43A 40%, transparent); }
.fx-off-warn p { margin: 0 0 8px; font-size: var(--fs-md); line-height: 1.4; }
.fx-off-warn p:last-child { margin: 0; }

/* Обмен байера: закрыто до проверки / что делать после проверки */
.fx-locked, .fx-next { margin: 10px 0; padding: 12px 14px; border-radius: 12px; font-size: var(--fs-md); line-height: 1.45; }
.fx-locked { background: color-mix(in srgb, var(--muted, #888) 12%, transparent); }
.fx-next { background: color-mix(in srgb, #22C55E 13%, transparent); border: 1px solid color-mix(in srgb, #22C55E 38%, transparent); }
.fx-locked ul, .fx-next ol { margin: 6px 0 0; padding-left: 20px; }
.fx-locked li, .fx-next li { margin: 3px 0; }

/* Карточка «Включить уведомления» на главной */
.push-card { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, #F97316 12%, var(--card, #fff)); border: 1px solid color-mix(in srgb, #F97316 35%, transparent); }
.push-card .push-ico { font-size: var(--fs-3xl); line-height: 1; }
.push-card b { display: block; font-size: var(--fs-base); }
.push-card p { margin: 3px 0 8px; font-size: var(--fs-sm); line-height: 1.4; color: var(--muted, #777); }
.push-card p:last-child { margin-bottom: 0; }

/* Заявка по ссылке: фото товара */
.rq-phs { display: flex; flex-wrap: wrap; gap: 8px; }
.rq-ph { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: var(--soft); border: 1px solid var(--line-strong); }
.rq-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rq-ph-x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: var(--fs-lg); line-height: 24px; padding: 0; cursor: pointer; }
.rq-ph-add { display: grid; place-content: center; justify-items: center; gap: 2px; cursor: pointer; border-style: dashed; color: var(--muted); text-align: center; }
.rq-ph-add span { font-size: var(--fs-3xl); line-height: 1; color: var(--ink); }
.rq-ph-add small { font-size: var(--fs-2xs); line-height: 1.1; padding: 0 4px; }

/* Заявка клиента: напоминание «дополните заказ» */
.rq-fill { display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 0; padding: 10px 12px; border: 1px solid #F0D58A; border-radius: 12px; background: #FFF8E1; color: #6B4E00; font: inherit; font-size: var(--fs-sm); line-height: 1.35; text-align: left; cursor: pointer; }
.rq-fill-ico { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #E0A800; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: var(--fs-sm); }
.rq-fill-txt { flex: 1; min-width: 0; }
.rq-fill-btn { flex: none; padding: 6px 10px; border-radius: 8px; background: #6B4E00; color: #fff; font-size: var(--fs-xs); }
.detail > .rq-fill { margin: 0 0 12px; }
html[data-theme="dark"] .rq-fill { background: #3A2F0B; border-color: #6B5512; color: #F5DD9A; }
html[data-theme="dark"] .rq-fill-btn { background: #F5DD9A; color: #3A2F0B; }

/* Заявка по ссылке: несколько карточек товаров */
.rq-item { display: grid; gap: 12px; margin: 0 0 14px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--soft); }
.rq-item .field { margin: 0; }
.rq-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rq-item-del { border: 0; background: none; color: var(--red); font: inherit; font-size: var(--fs-sm); cursor: pointer; padding: 4px 0; }
.rq-add-item { margin: 0 0 6px; }
.rq-sub { margin: 18px 0 8px; font-size: var(--fs-xl); }
.rq-res { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.rq-res .rq-num { font-size: var(--fs-3xl); }

/* Окно «Настройте ULA»: уведомления и местоположение (js/device.js) */
.perm-hero { display: grid; justify-items: center; gap: 6px; padding: 26px 20px 4px; text-align: center; }
.perm-hero img { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 6px 18px rgba(0, 0, 0, .14); }
.perm-hero h2 { margin: 6px 0 0; font-size: var(--fs-3xl); font-weight: 700; }
.perm-hero p { margin: 0; max-width: 320px; color: var(--muted); font-size: var(--fs-md); line-height: 1.4; }
.perm-rows { display: grid; gap: 10px; }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--soft); border: 1px solid var(--line); transition: background .2s; }
.perm-row.done { background: var(--green-tint); border-color: transparent; }
.perm-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); font-size: var(--fs-2xl); }
.perm-txt { flex: 1; min-width: 0; }
.perm-txt b { display: block; font-size: var(--fs-base); }
.perm-txt p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.35; }
.perm-row .btn-sm { flex: none; }
.perm-ok { flex: none; color: var(--green); font-weight: 600; font-size: var(--fs-md); }
.perm-no { flex: none; color: var(--red); font-size: var(--fs-sm); text-align: right; max-width: 92px; }
.perm-modal .modal-foot .btn { flex: 1; }

/* Чат поддержки у админа: с какого устройства пишет человек */
.sp-dev { flex: none; max-height: 40%; overflow-y: auto; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dev-card + .dev-card { border-top: 1px solid var(--line); }
.dev-card summary { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; cursor: pointer; font-size: var(--fs-sm); list-style: none; }
.dev-card summary::-webkit-details-marker { display: none; }
.dev-card summary b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-card summary b::before { content: "📱 "; }
.dev-card summary span { flex: none; color: var(--muted); }
.dev-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 2px 0 10px; font-size: var(--fs-sm); }
.dev-card dt { color: var(--muted); }
.dev-card dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dev-card code { font-size: var(--fs-2xs); color: var(--muted); }

/* Режим правки чужого кабинета у администратора (js/adminedit.js) */
body.admin-editing .ws-banner { background: #C2410C; }
.ws-banner-inner #ws-banner-text { flex: 1 1 260px; }
.admlog { display: grid; gap: 2px; }
.admlog-row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: var(--fs-md); line-height: 1.35; }
.admlog-row time { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.admlog-row small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.admlog-delete b { color: var(--red); }
.admlog-edit_on, .admlog-edit_off { background: var(--soft); border-radius: 8px; padding-left: 8px; }

/* Face ID: вход, блокировка, настройки в стиле iOS (js/passkey.js) */
:root { --ios-blue: #3478C8; --ios-green: #27966C; --ios-group: #FFFFFF; --ios-sep: rgba(60, 60, 67, .29); --ios-switch-off: #E9E9EA; }
:root[data-theme="dark"] { --ios-blue: #3478C8; --ios-green: #27966C; --ios-group: #24262B; --ios-sep: rgba(84, 84, 88, .65); --ios-switch-off: #39393D; }

/* экран входа: значок Face ID и подпись системным синим, без рамки — как в банковских приложениях */
.pk-login { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 16px auto 0; padding: 8px 16px; border: 0; background: none;
  color: var(--ios-blue); font: 500 15px/1.2 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; cursor: pointer; border-radius: 14px;
  -webkit-tap-highlight-color: transparent; transition: opacity .15s, transform .15s; }
.pk-login.hidden { display: none; }
.pk-login:active { opacity: .5; transform: scale(.97); }
.pk-login:disabled { opacity: .5; }

/* блокировка: размытый экран, значок приложения, Face ID — как экран блокировки в iOS */
.pk-lock { position: fixed; inset: 0; z-index: 2147483000; display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 82%, transparent); -webkit-backdrop-filter: blur(40px) saturate(1.8); backdrop-filter: blur(40px) saturate(1.8);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; color: var(--ink); text-align: center; }
.pk-lock.on { display: flex; animation: pk-in .25s ease-out; }
@keyframes pk-in { from { opacity: 0; } to { opacity: 1; } }
.pk-lock-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.pk-lock-icon { width: 76px; height: 76px; border-radius: 17px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); margin-bottom: 14px; }
.pk-lock-title { margin: 0; font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -.01em; }
.pk-lock-sub { margin: 0 0 36px; color: var(--muted); font-size: var(--fs-base); }
.pk-lock-btn { display: flex; flex-direction: column; align-items: center; gap: 12px; border: 0; background: none; color: var(--ios-blue); font: inherit; font-size: var(--fs-xl); cursor: pointer;
  padding: 10px 20px; border-radius: 16px; -webkit-tap-highlight-color: transparent; }
.pk-lock-btn:active { opacity: .5; }
.pk-lock-btn.busy .fid { animation: pk-pulse 1.1s ease-in-out infinite; }
@keyframes pk-pulse { 50% { opacity: .35; } }
.pk-lock-alt { border: 0; background: none; color: var(--ios-blue); font: inherit; font-size: var(--fs-base); padding: 12px; cursor: pointer; }
/* ушли в фон — данные не видны в переключателе приложений; заблокировано — под замком ничего не листается */
html.pk-cover body > *:not(.pk-lock) { filter: blur(24px); }
html.pk-locked, html.pk-locked body { overflow: hidden; }

/* настройки: сгруппированный список iOS */
.settings-body #s-passkey h3.ios-head, .ios-head { margin: 0 16px 7px; font-size: var(--fs-sm); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; color: var(--muted); }
.ios-head:not(:first-child) { margin-top: 22px; }
.ios-group { background: var(--ios-group); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.ios-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 16px; font-size: var(--fs-lg); cursor: default;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
label.ios-row { cursor: pointer; }
.ios-row + .ios-row::before { content: ""; position: absolute; top: 0; right: 0; left: 57px; border-top: .5px solid var(--ios-sep); }
.ios-row-sub + .ios-row::before, .ios-group > .ios-row-sub::before { left: 16px; }
.ios-row-sub { padding-left: 57px; }
.ios-tile { flex: none; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 7px; background: var(--ios-green); color: #fff; }
.ios-tile .fid { stroke-width: 3.6; }
.ios-tile-gray { background: #8E8E93; }
.ios-label { flex: 1; min-width: 0; }
.ios-two { display: flex; flex-direction: column; }
.ios-two span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-two small { color: var(--muted); font-size: var(--fs-sm); }
.ios-value select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-lg); text-align: right;
  padding: 4px 18px 4px 4px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cpath d='M2 2l6 6-6 6' fill='none' stroke='%23C4C4C7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center; background-size: 7px 12px; }
.ios-del { border: 0; background: none; color: #C62828; font: inherit; font-size: var(--fs-lg); padding: 6px 0 6px 8px; cursor: pointer; }
.ios-foot { margin: 7px 16px 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.35; }
/* переключатель iOS */
.ios-switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0; border-radius: 16px;
  background: var(--ios-switch-off); cursor: pointer; transition: background .25s; outline-offset: 2px; }
.ios-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .25s cubic-bezier(.3, .7, .4, 1); }
.ios-switch:checked { background: var(--ios-green); }
.ios-switch:checked::after { transform: translateX(20px); }
.ios-switch:disabled { opacity: .5; }
.ios-switch { width: 51px !important; height: 31px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; box-sizing: border-box; }
.ios-value select { width: auto; min-height: 0; }

/* ---------- Баланс клиента (предоплата, js/wallet.js) ---------- */
.wallet-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; justify-self: start; font-variant-numeric: tabular-nums; }
.wallet-chip:hover { border-color: var(--primary); color: var(--ink); }
.wallet-chip.pos { background: var(--green-tint); border-color: transparent; color: var(--green); }
.wallet-chip.neg { background: var(--red-tint); border-color: transparent; color: var(--red); }
.wallet-note { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: var(--fs-sm); color: var(--green); flex-basis: 100%; }
.wallet-order { display: grid; gap: 8px; margin: 10px 0; }
.wallet-order-line { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer; }
.wallet-order-line span { flex: 1; }
.wallet-order-line b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.wallet-order-line i { font-style: normal; color: var(--muted); font-size: var(--fs-xl); }
.wallet-order-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.wallet-order-btns .btn { flex: 1 1 200px; }
.wl-head { display: grid; gap: 10px; margin-bottom: 14px; }
.wl-cur { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2, rgba(120,120,128,.08)); }
.wl-big { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wl-sub { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: var(--fs-md); color: var(--muted); font-variant-numeric: tabular-nums; }
.wl-big.pos, .wl-sub .pos, .wl-amt.pos, .cab-wallet-sum.pos { color: var(--green); }
.wl-big.neg, .wl-sub .neg, .wl-amt.neg, .cab-wallet-sum.neg { color: var(--red); }
.wl-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.wl-acts .btn { flex: 1 1 140px; }
.wl-form { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.wl-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wl-form label { display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--muted); }
.wl-form .check-line { display: flex; color: var(--ink); font-size: var(--fs-md); }
.wl-h { margin: 18px 0 8px; font-size: var(--fs-base); }
.wl-list { list-style: none; margin: 0; padding: 0; }
.wl-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.wl-row:first-child { border-top: 0; }
.wl-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.wl-row-main small { font-size: var(--fs-xs); }
.wl-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.wl-undo { width: 32px; height: 32px; font-size: var(--fs-lg); color: var(--muted); }
.wl-empty { font-size: var(--fs-md); }
.cab-wallet-sum { font-family: var(--font-display); font-size: var(--fs-5xl); font-weight: 700; line-height: 1.2; margin: 0; }
.cab-wallet .wl-list { margin-top: 4px; }
.cab-wallet details { margin-top: 10px; }
@media (max-width: 420px) { .wl-form-row { grid-template-columns: 1fr; } }

/* Главная байера: спокойная рабочая панель с акцентом на действия и деньги. */
#tab-home .page-head {
  margin: 18px 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
#tab-home .page-title {
  font-size: clamp(27px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: -.035em;
}
#tab-home .home-act,
#tab-home .home-money { margin-bottom: 22px; }
#tab-home .home-h {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -.015em;
  text-transform: none;
}
#tab-home .home-more { color: var(--primary); font-weight: 700; }
#tab-home .ha-grid { gap: 10px; }
#tab-home .ha-tile {
  min-height: 94px;
  border-color: var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
#tab-home .ha-tile:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
#tab-home .ha-tile .ha-ico { background: var(--red-tint); color: var(--red); }
#tab-home .ha-main {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
#tab-home .ha-main .ha-ico { background: rgba(255,255,255,.14); color: var(--on-primary); }
#tab-home .ha-main small { color: color-mix(in srgb, var(--on-primary) 76%, transparent); }
@media (hover: hover) {
  #tab-home .ha-tile:hover { border-color: var(--red); box-shadow: var(--shadow-md); transform: translateY(-2px); }
  #tab-home .ha-main:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
}
#tab-home .summary { border-color: var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
#tab-home .summary-item { min-width: 0; padding: 15px 16px; }
#tab-home .summary-label { font-size: var(--fs-sm); }
#tab-home .summary-value { font-size: clamp(18px, 2.5vw, 22px); font-weight: 650; overflow-wrap: anywhere; }
#tab-home .assistant { border-color: var(--line); box-shadow: var(--shadow-sm); }
#tab-home .warehouse {
  background: linear-gradient(115deg, var(--hero), color-mix(in srgb, var(--hero) 87%, var(--red)));
  box-shadow: var(--shadow-sm);
}
@media (min-width: 760px) {
  #tab-home .home-act,
  #tab-home .home-money { margin-bottom: 26px; }
  #tab-home .ha-tile { min-height: 106px; }
}
@media (max-width: 640px) {
  #tab-home .page-head { margin: 12px 0 16px; padding-bottom: 12px; }
  #tab-home .home-act,
  #tab-home .home-money { margin-bottom: 18px; }
  #tab-home .ha-tile { min-height: 82px; }
  #tab-home .summary-item { padding: 13px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #tab-home .ha-tile { transition: none; }
}

/* Обзор бизнеса администратора: карточки не смешивают валюты. */
.bi-filters { padding: 18px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.bi-filter-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.bi-custom-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 10px; margin-top: 14px; }
.bi-filters .field { margin: 0; }
.bi-status:not(:empty) { margin: 12px 0; color: var(--muted); }
.bi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bi-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.bi-card span { display: block; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.bi-card strong { display: block; margin-top: 6px; font-size: var(--fs-xl); line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bi-card p, .bi-note { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.bi-note { margin: 18px 0 10px; }
.bi-currency { margin-top: 20px; }
.bi-currency h2 { margin: 0 0 10px; font-size: var(--fs-xl); }
.bi-unavailable { margin-top: 24px; }
.bi-unavailable summary { margin-bottom: 12px; font-size: var(--fs-base); font-weight: 700; cursor: pointer; }
@media (max-width: 700px) {
  .bi-filter-main { grid-template-columns: 1fr; }
  .bi-custom-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bi-custom-dates .btn { grid-column: 1 / -1; }
  .bi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bi-card { padding: 13px; }
  .bi-card strong { font-size: var(--fs-lg); }
}
@media (max-width: 360px) { .bi-grid { grid-template-columns: 1fr; } }

/* Совпадения клиентов (файл 52) */
.cll-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cll-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.cll-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cll-person { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.cll-reason { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.cll-reason.warn { color: var(--warn, #8A5A0B); }
.cll-acts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 480px) { .cll-pair { grid-template-columns: 1fr; } }
.cll-recon { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: var(--fs-md); }
.cll-recon .warn { color: var(--warn, #8A5A0B); font-weight: 600; }
.cll-acts select { max-width: 100%; min-width: 0; flex: 1 1 180px; }
.wallet-note.warn { color: var(--warn, #8A5A0B); }
.wallet-note .btn { margin-left: 8px; }

/* Уведомления клиентам: состояние очереди (файл 53) */
.nq-bad { color: var(--red, #C62828); font-weight: 700; }
.nq-actions { margin: 8px 0 12px; }
.nq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.nq-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.nq-item.nq-failed { border-color: var(--red, #C62828); }
.nq-head { overflow-wrap: anywhere; }
.nq-meta { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.nq-chip { display: inline-block; font-size: var(--fs-xs); font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--line); }
.nq-chip-sent { background: #d6f0dd; color: #14532d; }
.nq-chip-failed { background: #f8d7da; color: #7f1d1d; }
.nq-chip-pending, .nq-chip-processing { background: #fdebc8; color: #7a4a00; }
.nq-item details { font-size: var(--fs-sm); }
.nq-item details ul { margin: 6px 0 0; padding-left: 18px; }

/* Сроки и напоминания (файл 54) */
.dl-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; display: grid; gap: 8px; }
.dl-box h4 { margin: 0; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dl-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-md); }
.dl-tasks .bad { color: var(--red, #C62828); }
.dl-tasks .warn { color: var(--warn, #8A5A0B); }
.dl-hist { font-size: var(--fs-sm); margin: 6px 0 0; padding-left: 18px; }

/* ---------- Ежедневная работа (файл 55): «Сегодня», короткая карточка, форма по этапам, пояс ---------- */
.nav-for-admin { display: none; }
body.is-admin .nav-for-admin { display: inline; }
body.is-admin .nav-for-buyer { display: none; }
.mod-hidden { display: none !important; }

.today { margin: 0 0 14px; }
.today-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.today-head .home-h { margin: 0; }
.today-count { min-width: 24px; padding: 0 8px; border-radius: var(--r-pill); background: var(--red); color: #fff; font-size: var(--fs-sm); font-weight: 700; line-height: 24px; text-align: center; }
.today-list { display: grid; gap: 8px; }
.td-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 14px; }
.td-item.warn { border-left-color: #DCA43A; }
.td-item.bad { border-left-color: var(--red); }
.td-body { flex: 1; min-width: 0; }
.td-reason { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.td-order { margin: 2px 0 0; font-size: var(--fs-md); color: var(--muted); overflow-wrap: anywhere; }
.td-btn { flex: none; min-height: 44px; }
.td-more { margin-top: 2px; }
.td-empty { display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
@media (max-width: 480px) {
  .td-item { flex-direction: column; align-items: stretch; gap: 10px; }
  .td-btn { width: 100%; }
}

/* короткая карточка заказа */
.card-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 8px 0 2px; font-size: var(--fs-md); }
.card-facts .pay-owe, .card-facts .pay-ok { font-size: var(--fs-md); }
.ca-eta { color: var(--ink); }
.ca-eta.none { color: var(--muted); }
.card-step { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--muted); }
#tab-orders .card-actions, #tab-orders .card-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
#tab-orders .card-actions .btn-primary { grid-column: auto; min-height: 44px; white-space: normal; }
.card-more-info { grid-column: 1 / -1; }
.card-more-info > summary { list-style: none; cursor: pointer; width: 100%; min-height: 40px; display: flex; align-items: center; justify-content: center; font-size: var(--fs-md); }
.card-more-info > summary::-webkit-details-marker { display: none; }
.card-more-info[open] > summary { border-color: var(--ink); }
.card-more-body { display: grid; gap: 8px; margin-top: 8px; }
.card-more-body .card-more-menu { position: static; box-shadow: none; animation: none; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.card-more-body .menu-action { min-height: 44px; }
.status-option.suggested { box-shadow: inset 0 0 0 2px var(--focus-ring); }

/* форма: поля по этапу, ошибки, несохранённое, выбор клиента */
.stage-hint { display: none; margin: 4px 0; }
#order-form.form-short.stage-early:not(.stage-all) .stage-late { display: none !important; }
#order-form.form-short.stage-early:not(.stage-all) .stage-hint { display: block; }
#order-form .invalid { border-color: var(--red) !important; background: var(--invalid); }
.field-err { margin: 4px 0 0; color: var(--red); font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.unsaved { padding: 12px 16px; background: var(--red-tint); border-top: 1px solid var(--danger-line); }
.unsaved p { margin: 0 0 8px; font-weight: 700; }
.unsaved-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.unsaved-acts .btn { min-height: 44px; }
.client-pick { display: grid; gap: 6px; margin-bottom: 10px; }
.client-pick .field { margin: 0; }
.cp-results { display: grid; gap: 4px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: var(--surface); }
.cp-item { display: grid; gap: 2px; text-align: left; padding: 10px 12px; min-height: 44px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; font: inherit; }
.cp-item:hover, .cp-item:focus-visible { background: var(--hover); }
.cp-item small { color: var(--muted); overflow-wrap: anywhere; }
.cp-none { margin: 0; padding: 10px 12px; color: var(--muted); font-size: var(--fs-md); }
.cp-chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.cp-chosen span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
#tz-section.tz-warn { border-left: 4px solid #DCA43A; padding-left: 12px; }

/* ---- Кабинет клиента: следующий шаг, срок, связь (файл 56) ---- */
.next-step { border-left: 4px solid var(--ink); }
.next-step h2 { margin-bottom: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.next-step p { margin: 0 0 12px; font-size: var(--fs-xl); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.next-step p:last-child { margin-bottom: 0; }
.next-step .btn { width: 100%; justify-content: center; text-align: center; }
.cab-next { color: var(--ink); font-weight: 600; }
.cab-unpriced { margin: -4px 4px 12px; }
.cab-contact .track-actions { flex-wrap: wrap; }
.cab-contact .btn, .next-step .btn { min-height: 44px; }
.state-box .btn { margin-top: 12px; }
.cab-card:focus-visible, .next-step .btn:focus-visible, .cab-contact .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#client-content h1:focus { outline: none; }

/* =====================================================
   ПУТЬ ЗАКАЗА ДЛЯ КЛИЕНТА (js/tracking.js, файл 64)
   Шапка заказа тёмная в обеих темах, поэтому цвета шкалы внутри неё — свои, светлые.
   Анимации короткие и с ограниченным числом повторов; при «уменьшить движение» — статичная шкала.
   ===================================================== */
.tk-hero { --tk-ok: #3DBE7A; --tk-now: #FF6B78; }

/* текущий этап: иконка + название + человеческое описание */
.tk-now { display: flex; align-items: flex-start; gap: 14px; margin: 18px 0 4px; }
.tk-now-icon {
  position: relative; flex: none; display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.08); color: #fff;
}
.tk-now-text { min-width: 0; }
.tk-now-step { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; color: rgba(255, 255, 255, 0.6); }
.tk-now .client-hero-status { margin: 2px 0 4px; }
.tk-now-desc { font-size: var(--fs-base); line-height: 1.4; color: rgba(255, 255, 255, 0.82); }
.tk-dots { position: absolute; left: 0; right: 0; bottom: 7px; display: flex; justify-content: center; gap: 3px; }
.tk-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55; }
.tk-mover { position: absolute; left: 21px; bottom: 9px; color: #FFD166; line-height: 0; }
.tk-now-ready .tk-now-icon, .tk-now-received .tk-now-icon { background: rgba(61, 190, 122, 0.18); color: var(--tk-ok); }
.tk-ico .tk-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }

/* шкала: на телефоне вертикальная */
.tl { list-style: none; margin-top: 18px; }
.tl-step { position: relative; display: flex; align-items: flex-start; gap: 12px; padding-bottom: 10px; color: rgba(255, 255, 255, 0.55); font-size: var(--fs-base); }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.16); }
.tl-step:last-child::before { display: none; }
.tl-dot {
  position: relative; z-index: 1; flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22); background: var(--hero); color: rgba(255, 255, 255, 0.45);
}
.tl-label { padding-top: 4px; line-height: 1.3; overflow-wrap: anywhere; }
.tl-step.done { color: rgba(255, 255, 255, 0.85); }
.tl-step.done::before { background: var(--tk-ok); }
.tl-step.done .tl-dot { border-color: var(--tk-ok); background: var(--tk-ok); color: #fff; }
.tl-step.current { color: #fff; font-weight: 700; }
.tl-step.current .tl-dot { border-color: #fff; background: var(--tk-now); color: #fff; box-shadow: 0 0 0 4px rgba(229, 72, 91, 0.28); }

/* широкий экран: шапка шире колонки страницы, шкала горизонтальная */
@media (min-width: 1000px) {
  .client-hero.tk-hero { margin-left: -160px; margin-right: -160px; }
  .tl { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); margin-top: 24px; }
  .tl-step { flex-direction: column; align-items: center; gap: 0; padding: 0 4px; text-align: center; font-size: var(--fs-sm); }
  .tl-step::before { left: calc(50% + 16px); right: calc(16px - 50%); top: 13px; bottom: auto; width: auto; height: 2px; }
  .tl-label { padding-top: 8px; }
}

/* конфетти у «Получен клиентом» — один раз */
.tk-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tk-confetti i { position: absolute; top: -10px; width: 7px; height: 11px; border-radius: 2px; opacity: 0; }

/* карточка маршрута: Китай → [грузовик] → город. Стилизованная схема, не карта и не GPS */
.tk-route h2 { margin-bottom: 14px; }
.tk-map { --p: .5; position: relative; height: 64px; margin: 0 2px 8px; }
.tk-line {
  position: absolute; left: 20px; right: 20px; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 8px, transparent 8px 14px);
}
.tk-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(22px + (100% - 44px) * var(--p)); border-radius: 2px; background: var(--green); }
.tk-end {
  position: absolute; top: 50%; z-index: 1; display: grid; place-items: center;
  width: 40px; height: 40px; margin-top: -20px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--soft); color: var(--ink);
}
.tk-end-a { left: 0; }
.tk-end-b { right: 0; }
.tk-map.is-arrived .tk-end-b { border-color: var(--green); background: var(--green-tint); color: var(--green); }
.tk-vehicle {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center;
  left: calc(42px + (100% - 84px) * var(--p));   /* между значками начала и конца, не поверх них */
  width: 44px; height: 44px; margin: -30px 0 0 -22px; border-radius: 14px;
  background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.tk-map.is-arrived .tk-vehicle { left: calc(100% - 66px); }
.tk-ends { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-md); font-weight: 700; }
.tk-ends span { min-width: 0; overflow-wrap: anywhere; }
.tk-ends span:last-child { text-align: right; }
.tk-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.tk-facts dt { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.tk-facts dd { font-size: var(--fs-base); font-weight: 700; font-variant-numeric: tabular-nums; }
.tk-route .fine-print { margin: 12px 0 0; font-size: var(--fs-xs); }
/* спокойное сообщение о задержке: не красное, без тревоги */
.tk-late { margin-top: 12px; padding: 10px 12px; border-left: 3px solid #C98A00; border-radius: var(--r-sm); background: var(--soft); font-size: var(--fs-md); line-height: 1.4; }

/* история заказа */
.tk-hist { list-style: none; }
.tk-h { position: relative; display: grid; gap: 2px; margin-left: 5px; padding: 0 0 14px 18px; border-left: 2px solid var(--line); }
.tk-h:last-child { padding-bottom: 0; border-left-color: transparent; }
.tk-h::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border: 2px solid var(--muted); border-radius: 50%; background: var(--surface); }
.tk-h:first-child::before { border-color: var(--green); background: var(--green); }
.tk-h time { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.tk-h-title { font-size: var(--fs-base); font-weight: 700; overflow-wrap: anywhere; }
.tk-h.pay .tk-h-title { font-weight: 600; }
.tk-h-note { margin-top: 4px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--soft); font-size: var(--fs-md); overflow-wrap: anywhere; }
.tk-h-who { font-weight: 600; color: var(--muted); }

/* байер: блок в карточке заказа */
.tk-buyer { display: grid; gap: 8px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.tk-buyer h4 { margin: 0; }
.tk-b-ship { display: grid; gap: 8px; margin: 0; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.tk-b-ship legend { padding: 0 4px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.tk-b-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tk-b-ship .field, .tk-buyer > .field { margin: 0; }
.tk-b-note { color: #8A5A00; }
html[data-theme="dark"] .tk-b-note { color: #E8B04A; }
.tk-hist-b { margin-top: 8px; }

/* ---------- анимации: только если человек не просил уменьшить движение ---------- */
@media (prefers-reduced-motion: no-preference) {
  .tl-step.current .tl-dot { animation: tk-pulse 2.4s ease-out 0.4s 3; }
  .tk-now-icon { animation: tk-pop .5s ease-out both; }
  .tk-ico .tk-draw { animation: tk-draw .8s ease-out .35s both; }
  .tk-dots i { animation: tk-blink 1.2s ease-in-out 5; }
  .tk-dots i:nth-child(2) { animation-delay: .2s; }
  .tk-dots i:nth-child(3) { animation-delay: .4s; }
  .tk-a-buying .tk-ico { animation: tk-bob 1.6s ease-in-out 3; }
  .tk-mover { animation: tk-slide-in 1.4s cubic-bezier(.2, .7, .2, 1) .3s both; }
  .tk-a-packing .tk-lid { transform-box: fill-box; animation: tk-lid .9s ease-out .3s both; }
  .tk-a-shipped .tk-ico, .tk-a-local .tk-ico { animation: tk-roll 1.2s ease-in-out .5s 4 alternate; }
  .tk-a-arrived_dest .tk-wave { transform-box: fill-box; transform-origin: left center; animation: tk-wave 1.1s ease-in-out .3s 2; }
  .tk-now-ready .tk-now-icon { animation: tk-pop .5s ease-out both, tk-glow 1.8s ease-out .5s 2; }
  .tk-vehicle { animation: tk-drive 1.8s cubic-bezier(.2, .7, .2, 1) .2s both; }
  .tk-fill { animation: tk-fill 1.8s cubic-bezier(.2, .7, .2, 1) .2s both; }
  .tk-confetti i { animation: tk-fall 1.6s ease-in forwards; }
}
@keyframes tk-pulse { 0% { box-shadow: 0 0 0 4px rgba(229, 72, 91, .28); } 60% { box-shadow: 0 0 0 10px rgba(229, 72, 91, 0); } 100% { box-shadow: 0 0 0 4px rgba(229, 72, 91, .28); } }
@keyframes tk-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes tk-blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes tk-bob { 0%, 100% { transform: none; } 50% { transform: translateY(-2px) rotate(-3deg); } }
@keyframes tk-slide-in { from { transform: translateX(-30px); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes tk-lid { from { transform: translateY(-5px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes tk-roll { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@keyframes tk-wave { 0%, 100% { transform: none; } 50% { transform: skewY(-8deg) scaleX(.94); } }
@keyframes tk-glow { 0% { box-shadow: 0 0 0 0 rgba(61, 190, 122, .55); } 100% { box-shadow: 0 0 0 14px rgba(61, 190, 122, 0); } }
@keyframes tk-drive { from { left: 42px; } }
@keyframes tk-fill { from { width: 0; } }
@keyframes tk-fall { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx, 10px), 190px) rotate(320deg); } }

/* WhatsApp: inbox uses the existing workspace typography and controls. */
#tab-inbox [hidden]{display:none!important}.wa-layout{display:grid;grid-template-columns:minmax(250px,310px) minmax(0,1fr);border:1px solid var(--line,#E2E5EA);border-radius:18px;overflow:hidden;background:var(--surface)}
.wa-sidebar{padding:16px;border-right:1px solid var(--line,#E2E5EA)}.wa-sidebar>input,.wa-sidebar>select{width:100%;margin-bottom:10px;padding:11px;border:1px solid var(--line,#E2E5EA);border-radius:10px;background:var(--soft);color:inherit}
.wa-thread{display:flex;align-items:center;gap:11px;width:100%;border:0;border-radius:12px;background:transparent;text-align:left;padding:14px 10px;color:inherit;cursor:pointer}.wa-thread:hover,.wa-thread.selected{background:var(--hover)}.wa-avatar{display:grid;place-items:center;flex:0 0 38px;height:38px;border-radius:50%;background:var(--green-tint);color:var(--green);font-weight:700}.wa-thread-copy{min-width:0;flex:1}.wa-thread b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wa-thread small,.wa-note{color:var(--muted,#626873);font-size: var(--fs-xs)}.wa-thread small{display:block;margin-top:5px}.wa-count{padding:2px 7px;border-radius:12px;background:#19764d;color:white;font-size: var(--fs-xs)}.wa-chat-head{display:flex;justify-content:space-between;gap:14px;padding:20px;border-bottom:1px solid var(--line,#E2E5EA)}.wa-chat-head h2{font-size: var(--fs-xl);margin:0 0 5px}.wa-chat-head .btn{font-size: var(--fs-xs);padding:7px 10px}.wa-chat-head #wa-actions{display:flex;gap:6px;flex-wrap:wrap;align-content:flex-start}.wa-log{height:420px;overflow:auto;padding:20px;display:flex;flex-direction:column;gap:12px;background:var(--soft)}.wa-message{max-width:85%;padding:11px 14px;border-radius:14px;background:var(--surface);border:1px solid var(--line,#e5e5eb);overflow-wrap:anywhere}.wa-message p{white-space:pre-wrap;margin:0 0 7px;font-size: var(--fs-md)}.wa-message small{font-size: var(--fs-2xs);opacity:.65}.wa-out{align-self:flex-end;background:var(--green-tint);color:var(--ink)}.wa-in{align-self:flex-start}.wa-message .btn{font-size: var(--fs-2xs);padding:4px 8px;margin:5px}.wa-composer{display:flex;align-items:flex-end;gap:12px;padding:16px}.wa-composer textarea{flex:1;resize:vertical;min-height:54px;border:1px solid var(--line,#E2E5EA);border-radius:12px;padding:12px;background:var(--soft);color:inherit}.wa-client{padding:16px 20px;border-top:1px solid var(--line,#E2E5EA)}.wa-client summary,.wa-settings summary{font-weight:600;cursor:pointer}.wa-client h3{font-size: var(--fs-sm);color:var(--muted,#626873);margin:16px 0 10px}.wa-orders{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}.wa-order{padding:14px;border:1px solid var(--line,#E2E5EA);border-radius:12px}.wa-order p{font-size: var(--fs-sm);margin:7px 0;overflow-wrap:anywhere}.wa-order-link{border:0;background:none;color:inherit;font-weight:700;cursor:pointer;padding:0;text-decoration:underline}.wa-order .btn{font-size: var(--fs-xs);margin-top:7px}.wa-order small{opacity:.65}.wa-quote-state{color:#19764d;font-weight:600}.wa-empty{padding:30px 16px;color:var(--muted,#626873);font-size: var(--fs-md)}.wa-connection{font-size: var(--fs-sm);color:var(--muted,#626873);margin:0 0 16px}.wa-online{color:#19764d}.wa-settings{margin:24px 0;padding:20px;border:1px solid var(--line,#E2E5EA);border-radius:16px}.wa-settings form{margin-top:20px;max-width:700px}.wa-settings-grid{display:flex;flex-wrap:wrap;gap:16px;margin-bottom:20px}.wa-toggle{display:flex;align-items:center;gap:8px;font-size: var(--fs-sm)}.wa-toggle input{width:18px;height:18px}.wa-settings .field{margin-bottom:16px}.wa-settings textarea{width:100%}
[data-theme="dark"] .wa-out{background:#183c2c;color:#ddf6e7}[data-theme="dark"] .wa-avatar{background:#183c2c;color:#b6e7ce}
@media(max-width:760px){.wa-layout{grid-template-columns:1fr}.wa-sidebar{border-right:0;border-bottom:1px solid var(--line,#E2E5EA)}#wa-list{max-height:230px;overflow:auto}.wa-chat-head{flex-direction:column}.wa-message{max-width:95%}.wa-log{height:360px;padding:12px}.wa-composer{padding:12px;gap:8px}.wa-composer .btn{padding:12px}.wa-client{padding:14px}.wa-orders{grid-template-columns:1fr}}

.wa-pairing{display:flex;align-items:center;justify-content:space-between;gap:24px;margin:0 0 24px;padding:22px;border:1px solid var(--line);border-radius:18px;background:var(--surface)}.wa-pairing h2{font-size: var(--fs-xl);margin:0 0 10px}.wa-pairing p{font-size: var(--fs-md);margin:8px 0}.wa-pair-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}.wa-qr-wrap{width:260px;flex:0 0 260px;text-align:center}.wa-qr-wrap img{display:block;padding:8px;background:white;width:240px;height:240px;margin:auto;border-radius:10px}.wa-qr-wrap p{font-size: var(--fs-2xs)}@media(max-width:760px){.wa-pairing{flex-direction:column;align-items:stretch}.wa-qr-wrap{width:100%;flex:auto}.wa-pair-buttons .btn{flex:1}}

.wa-phone-panel{max-width:400px}.wa-phone-panel label{display:block;margin-bottom:8px}.wa-phone-panel input{display:block;width:100%;margin:8px 0 12px;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--text)}.wa-phone-code{font:700 30px monospace;letter-spacing:4px;user-select:all}.wa-phone-panel:has(>form[hidden]):has(>#wa-code-wrap[hidden]){display:none}

/* ---------- Карта маршрута Китай → Центральная Азия (js/tracking.js): упрощённая схема, не GPS ---------- */
.tk-geo {
  --g-bg: #FBFBFD; --g-sea: #DCE8F7; --g-land: #FBFBFD; --g-cn: #EDEFF3; --g-kg: #FFE3D2; --g-line: #C3C8D2;
  --g-route: #F0702D; --g-txt: #8A8F99; --g-pin: #FFFFFF; --g-pin-ink: #17191D;
  position: relative; margin: 0 -4px 6px; border-radius: 14px; overflow: hidden; aspect-ratio: 460 / 207;
}
html[data-theme="dark"] .tk-geo { --g-bg: #222226; --g-sea: #18263A; --g-land: #2A2A2F; --g-cn: #2C2C31; --g-kg: #4A2E22; --g-line: #46464D; --g-txt: #A4A7AE; --g-pin: #303238; --g-pin-ink: #F1F3F6; }
.tk-geo > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tk-geo .g-pin svg { display: block; }
.tk-geo .g-bg { fill: var(--g-bg); }
.tk-geo .g-sea { fill: var(--g-sea); }
.tk-geo .g-land, .tk-geo .g-other { fill: var(--g-land); stroke: var(--g-line); stroke-width: 1; stroke-linejoin: round; }
.tk-geo .g-cn { fill: var(--g-cn); stroke: var(--g-line); stroke-width: 1.2; stroke-linejoin: round; }
.tk-geo .g-kg { fill: var(--g-kg); stroke: var(--g-route); stroke-width: 1.4; stroke-opacity: .55; stroke-linejoin: round; }
.tk-geo .g-lbl { fill: var(--g-txt); font-size: var(--fs-sm); font-weight: 600; letter-spacing: .04em; text-anchor: middle; }
.tk-geo .g-left { text-anchor: start; }
.tk-geo .g-big { font-size: var(--fs-3xl); letter-spacing: .3em; opacity: .7; }
.tk-geo .g-kgl { fill: var(--g-route); font-size: var(--fs-2xs); }
.tk-geo .g-dot { fill: var(--g-pin); stroke: var(--g-route); stroke-width: 1.5; }
.tk-geo .g-route { fill: none; stroke: var(--g-route); stroke-opacity: .28; stroke-width: 3; stroke-dasharray: 2 6; stroke-linecap: round; stroke-linejoin: round; }
.tk-geo .g-done { fill: none; stroke: var(--g-route); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.tk-geo .g-truck-bg { fill: var(--g-route); stroke: #fff; stroke-width: 3; }
.tk-geo .g-truck-ico { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* подписи — обычный HTML поверх схемы: читаются на любой ширине */
.tk-geo .g-pin {
  position: absolute; z-index: 1; display: inline-flex; align-items: center; gap: 4px; max-width: 46%;
  padding: 3px 8px 3px 3px; border-radius: var(--r-pill); background: var(--g-pin); color: var(--g-pin-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14); font-size: var(--fs-2xs); line-height: 1.2; white-space: nowrap; pointer-events: none;
}
.tk-geo .g-pin b { overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.tk-geo .g-pin i { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--g-route); color: #fff; font-style: normal; }
.tk-geo .g-pin-border { padding: 2px 8px; font-size: var(--fs-2xs); opacity: .92; }
.tk-geo .g-pin-border b { font-weight: 600; }
.tk-geo.is-arrived .g-pin-end i { background: var(--green); }

@media (prefers-reduced-motion: no-preference) {
  .tk-geo .g-done { animation: tk-geo-draw 1.8s cubic-bezier(.2, .7, .2, 1) .2s both; }
  .tk-geo .g-pin-end i { animation: tk-geo-ping 1.8s ease-out 1.2s 3; }
  .tk-geo .g-pin { animation: tk-geo-fade .45s ease-out both; }
  .tk-geo .g-pin-border { animation-delay: .6s; }
  .tk-geo .g-pin-end { animation-delay: 1s; }
}
@keyframes tk-geo-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tk-geo-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes tk-geo-ping { 0% { box-shadow: 0 0 0 0 rgba(240, 112, 45, .55); } 100% { box-shadow: 0 0 0 10px rgba(240, 112, 45, 0); } }

/* Продлить срок доставки (js/tracking.js) */
.tk-ext { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tk-ext > span { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin-right: 2px; }
.tk-ext .btn { min-height: 36px; padding: 4px 12px; border: 1px solid var(--line-strong); background: var(--fill); color: var(--ink); font-size: var(--fs-md); font-weight: 700; }


/* =====================================================
   ДИЗАЙН-СИСТЕМА ULA FACTORY — слой компонентов
   Стоит последним: приводит к одному виду кнопки, поля, карточки, статусы, меню, окна и состояния
   во всех разделах. Цвета — только из токенов в начале файла (свои у светлой и тёмной темы).
   Правило красного: красным выделяется одно главное действие экрана, активный раздел и бренд.
   Повторяющиеся действия в списках — нейтральная тёмная кнопка.
   ===================================================== */
:root {
  --shadow-1: 0 1px 2px rgba(17, 18, 22, .05), 0 1px 3px rgba(17, 18, 22, .04);     /* карточки */
  --shadow-2: 0 4px 12px rgba(17, 18, 22, .08), 0 1px 3px rgba(17, 18, 22, .05);    /* наведение, плавающие кнопки */
  --shadow-3: 0 16px 40px rgba(17, 18, 22, .16), 0 2px 8px rgba(17, 18, 22, .06);   /* меню, окна */
  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);
  --r-btn: var(--r-md);
  --warn: var(--warning-text);
  --warn-tint: var(--warning-tint);
  --sidebar-w: 256px;
}
html[data-theme="dark"] {
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, .02);
  --shadow-2: 0 6px 16px rgba(0, 0, 0, .4);
  --shadow-3: 0 18px 48px rgba(0, 0, 0, .55);
  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);
  --warn: var(--warning-text);
  --warn-tint: var(--warning-tint);
}
html[data-ui="soft"] { --r-btn: var(--r-pill); }
html[data-ui="crisp"] { --r-btn: var(--r-xs); }

/* ---------- Типографика ---------- */
body { font-size: var(--fs-lg); line-height: var(--lh-normal); }
h1, .page-title { font-size: var(--fs-3xl); font-weight: 700; line-height: var(--lh-tight); letter-spacing: -.02em; }
h2 { font-size: var(--fs-xl); font-weight: 650; line-height: var(--lh-snug); letter-spacing: -.012em; }
h3 { font-size: var(--fs-lg); font-weight: 650; line-height: var(--lh-snug); letter-spacing: -.008em; }
.page-sub, .muted { color: var(--text-2); }
.page-sub { font-size: var(--fs-md); }
@media (min-width: 1024px) { h1, .page-title { font-size: var(--fs-5xl); } }
a { color: var(--accent-text); text-decoration-color: color-mix(in srgb, var(--accent-text) 40%, transparent); }
a:hover { color: var(--accent-hover); }
html[data-theme="dark"] a:hover { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* ---------- Логотип ---------- */
.bm-on-dark { display: none !important; }
html[data-theme="dark"] .bm-on-light { display: none !important; }
html[data-theme="dark"] .bm-on-dark { display: block !important; }
.brand { gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 0; object-fit: contain; }
.brand-name, .auth-brand { font-family: var(--font); font-weight: 800; letter-spacing: .01em; color: var(--text); }
.brand-name { font-size: var(--fs-lg); }
.brand-name b, .auth-brand b { color: var(--accent-text); font-weight: 900; letter-spacing: -.01em; }
.brand-name > span { font-weight: 700; font-size: .78em; letter-spacing: .22em; }
.logo-full { width: 132px; height: auto; margin: 0 auto 20px; border-radius: 0; }
.auth-panel .logo-full { width: 128px; border-radius: 0; margin: 0 auto 18px; }
.auth-mark { width: 64px; height: 64px; border-radius: 0; object-fit: contain; }
@media (min-width: 900px) {
  .auth-aside { background: #111216; }
  .auth-brand { letter-spacing: .02em; }
  .auth-brand b { color: #FF6B78; }
}
.auth-screen { background: var(--paper); }

/* ---------- Кнопки ---------- */
.btn {
  min-height: var(--control-h);
  padding: 0 var(--sp-4);
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: var(--fill);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: -.005em;
  box-shadow: none;
}
.btn:hover { background: var(--fill-2); color: var(--text); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-md); }
/* главная (красная) — одно главное действие на экране */
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
/* нейтральная тёмная — повторяющиеся действия в карточках списков */
.btn-neutral,
.card .btn-primary {
  background: var(--neutral-btn); border-color: var(--neutral-btn); color: var(--on-neutral-btn);
}
.btn-neutral:hover,
.card .btn-primary:hover {
  background: var(--neutral-btn-hover); border-color: var(--neutral-btn-hover); color: var(--on-neutral-btn);
}
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--error-tint); border-color: transparent; color: var(--error-text); }
.btn-danger:hover { background: var(--error-tint); color: var(--error-text); border-color: var(--error-text); }
.btn-light { background: #FFFFFF; border-color: #FFFFFF; color: #17191D; }
.btn-light:hover { background: #ECEEF1; color: #17191D; }
/* кнопка в процессе: <button aria-busy="true"> */
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-2) transparent var(--text-2) var(--text-2); animation: ula-spin .7s linear infinite;
}
.btn-primary[aria-busy="true"]::after { border-color: #fff transparent #fff #fff; }
@keyframes ula-spin { to { transform: rotate(360deg); } }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: var(--r-md); color: var(--text-2); }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ---------- Поля ввода ---------- */
.field { gap: 6px; margin-bottom: var(--sp-4); }
.field > span, .field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
input, select, textarea {
  min-height: var(--control-h);
  padding: 10px 14px;
  border: 1px solid var(--border-field);
  border-radius: var(--r-md);
  background: var(--field);
  color: var(--text);
  font-size: var(--fs-lg);
  transition: border-color .15s, box-shadow .15s;
}
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: var(--text-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--focus-ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-sunken); color: var(--text-3); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--accent); }
[aria-invalid="true"] { border-color: var(--error-text); background: var(--invalid); }
[aria-invalid="true"]:focus { border-color: var(--error-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 22%, transparent); }
.field-hint { font-size: var(--fs-sm); color: var(--text-2); }
.field-error { font-size: var(--fs-sm); color: var(--error-text); }
.form-error { background: var(--error-tint); color: var(--error-text); border-radius: var(--r-md); font-weight: 600; }

/* ---------- Карточки ---------- */
.card, .client-block, .an-card, .an-kpi, .summary, .assistant, .sh-card, .onboard-card,
.supplier-card, .client-card, .debt-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
/* статус заказа показывает метка; полоса слева — только тонкая и цветом статуса */
.card { box-shadow: inset 3px 0 0 var(--st, transparent), var(--shadow-1); padding: var(--sp-4) var(--sp-4) var(--sp-4) calc(var(--sp-4) + 3px); gap: var(--sp-3); }
@media (hover: hover) {
  #tab-orders .card:hover { box-shadow: inset 3px 0 0 var(--st, transparent), var(--shadow-2); transform: none; border-color: var(--border-strong); }
}
.order-no { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.01em; }
.card-sub { color: var(--text-2); font-size: var(--fs-sm); }
.card-product h3 { font-size: var(--fs-lg); font-weight: 650; }
.card-product p { color: var(--text-2); font-size: var(--fs-md); }
.specs dt, .money dt, .info dt { color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; }

/* ---------- Статусы: метка «таблетка» с точкой ---------- */
.st-new              { --st: #2B6CB5; --st-bg: #EAF2FB; }
.st-awaiting_payment { --st: #8A5A0B; --st-bg: #FBF3E2; }
.st-purchasing       { --st: #5B3FB0; --st-bg: #F0ECFA; }
.st-china_warehouse  { --st: #0A6B74; --st-bg: #E3F3F4; }
.st-in_transit       { --st: #1F63A6; --st-bg: #E6F0FA; }
.st-arrived          { --st: #1E7A57; --st-bg: #E8F5EF; }
.st-delivered        { --st: #4A4E56; --st-bg: #EEF0F3; }
.st-cancelled        { --st: #626873; --st-bg: #EEF0F3; }
html[data-theme="dark"] .st-new              { --st: #6FA8E8; --st-bg: rgba(111, 168, 232, .14); }
html[data-theme="dark"] .st-awaiting_payment { --st: #E9B95A; --st-bg: rgba(233, 185, 90, .14); }
html[data-theme="dark"] .st-purchasing       { --st: #B6A2F5; --st-bg: rgba(182, 162, 245, .14); }
html[data-theme="dark"] .st-china_warehouse  { --st: #5CCAD3; --st-bg: rgba(92, 202, 211, .13); }
html[data-theme="dark"] .st-in_transit       { --st: #7DB4EE; --st-bg: rgba(125, 180, 238, .14); }
html[data-theme="dark"] .st-arrived          { --st: #4FC08F; --st-bg: rgba(79, 192, 143, .14); }
html[data-theme="dark"] .st-delivered        { --st: #B9BCC3; --st-bg: rgba(185, 188, 195, .12); }
html[data-theme="dark"] .st-cancelled        { --st: #A4A7AE; --st-bg: rgba(164, 167, 174, .12); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .005em; }

/* «Сегодня»: у каждой задачи своё действие — спокойная серая кнопка, чтобы длинный список не был сплошь тёмным */
.td-btn.btn-primary { background: var(--fill); border-color: transparent; color: var(--text); }
.td-btn.btn-primary:hover { background: var(--fill-2); color: var(--text); }

/* Аватар в шапке телефона: спокойная рамка вместо цветного кольца */
@media (max-width: 640px) {
  .top-profile { background: var(--border-strong); }
  .top-profile.active { box-shadow: 0 0 0 3px var(--focus-ring); }
}

/* ---------- Счётчики ---------- */
.badge, .badge-inline { background: var(--accent); color: var(--on-accent); }
.badge { font: 700 var(--fs-2xs)/18px var(--font); }

/* ---------- Сообщения (toast) ---------- */
.toast { background: var(--neutral-btn); color: var(--on-neutral-btn); border-radius: var(--r-md); box-shadow: var(--shadow-3); font-weight: 600; }

/* ---------- Окна ---------- */
.modal-sheet { background: var(--surface); box-shadow: var(--shadow-3); }
.modal-head { border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: var(--fs-xl); font-weight: 700; }
.modal-backdrop { background: var(--backdrop); }
@media (min-width: 768px) { .modal-sheet { border-radius: var(--r-xl); } }

/* ---------- Таблицы ---------- */
table { font-variant-numeric: tabular-nums; }
th { color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }

/* ---------- Состояния: загрузка, пусто, ошибка ---------- */
.state-box { color: var(--text-2); }
#loading.state-box:not(.hidden), .state-box.is-loading {
  position: relative; min-height: 220px; padding: 0; font-size: 0; color: transparent;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent) -240px 0 / 240px 100% no-repeat,
    linear-gradient(var(--surface-sunken) 0 0) 0 0 / 100% 96px no-repeat,
    linear-gradient(var(--surface-sunken) 0 0) 0 112px / 100% 96px no-repeat;
  border-radius: var(--r-lg);
  animation: ula-shimmer 1.2s linear infinite;
}
#empty, .state-box[id$="-empty"] { padding: var(--sp-10) var(--sp-5); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); }
#empty strong { color: var(--text); font-size: var(--fs-xl); font-weight: 700; }
.state-error { padding: var(--sp-4); border-radius: var(--r-md); background: var(--error-tint); color: var(--error-text); font-weight: 600; }
.state-success { padding: var(--sp-4); border-radius: var(--r-md); background: var(--success-tint); color: var(--success-text); font-weight: 600; }

/* ---------- Шапка ---------- */
.topbar { background: var(--topbar); border-bottom: 1px solid var(--border); }
.lang-switch { background: var(--surface-sunken); border-color: var(--border); }
.lang-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
html[data-theme="dark"] .lang-switch button.active { background: var(--fill-2); }
.section-menu { background: var(--surface-raised); border-color: var(--border); box-shadow: var(--shadow-3); }
.section-menu .tab { color: var(--text-2); font-weight: 600; }
.section-menu .tab:hover { background: var(--hover); color: var(--text); }
.section-menu .tab.active { background: var(--accent-tint); color: var(--accent-text); }
.section-menu .tab.active::after { background: var(--accent); }
.tab.active::after { background: var(--accent); }

/* ---------- Нижнее меню (телефон) ---------- */
@media (max-width: 767px) {
  .bn-item { color: var(--text-2); }
  .bn-item.active { background: none; color: var(--accent-text); font-weight: 700; }
  .bn-badge { background: var(--neutral-btn); color: var(--on-neutral-btn); }
  .bn-plus-c { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
}
.fab { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-2); }

/* ---------- Заказы: панель действий в одну строку на телефоне ---------- */
@media (max-width: 767px) {
  #tab-orders .head-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  #tab-orders .head-actions::-webkit-scrollbar { display: none; }
  #tab-orders .head-actions .btn { flex: none; }
  /* круги статусов листаются — край плавно гаснет, видно, что дальше есть ещё */
  #tab-orders .chips-ico { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
/* опасное действие в меню карточки — отдельно от остальных */
.card-more-menu [data-act="delete"] { color: var(--error-text); }

/* ---------- Планшет ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
  .container { padding-left: var(--sp-6); padding-right: var(--sp-6); }
}

/* ---------- Компьютер: разделы — в боковой панели слева ---------- */
@media (min-width: 1024px) {
  #view-admin { padding-left: var(--sidebar-w); }
  /* шапка без размытия: иначе панель внутри неё не может прилипнуть к краю окна */
  #view-admin .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
  #view-admin .topbar-inner { max-width: none; justify-content: flex-end; padding: 10px var(--sp-8); min-height: 64px; }
  #view-admin .brand { position: fixed; z-index: 32; top: 0; left: 0; width: var(--sidebar-w); height: 64px; padding: 0 var(--sp-5);
    border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
  #view-admin .section-menu-btn { display: none; }
  #view-admin .section-menu,
  #view-admin .section-menu.hidden {
    display: flex !important; flex-direction: column; gap: 2px;
    position: fixed; z-index: 31; top: 64px; left: 0; bottom: 0; right: auto;
    width: var(--sidebar-w); margin: 0; padding: var(--sp-3);
    border: 0; border-right: 1px solid var(--border); border-radius: 0;
    background: var(--surface); box-shadow: none; overflow-y: auto; animation: none;
  }
  #view-admin .section-menu .tab { min-height: 40px; font-size: var(--fs-md); }
  #view-admin .section-menu .menu-action { min-height: 40px; font-size: var(--fs-md); color: var(--text-2); }
  #view-admin .section-menu .menu-action:hover { color: var(--text); }
  #view-admin .section-menu .menu-logout { color: var(--error-text); }
  #view-admin > main.container { max-width: 1200px; padding-left: var(--sp-8); padding-right: var(--sp-8); }
}


/* =====================================================
   ЗАСТАВКА ПРИ ВХОДЕ В ПРИЛОЖЕНИЕ (js/boot.js: раз за сессию, нажатие — пропустить,
   не показывается при «Уменьшить движение» и на страницах для клиентов)
   Всегда на графите — как иконка приложения и экран запуска телефона, без «вспышки» белым.
   Время (с):  0–.5 фон и мягкое свечение · .15–1.05 круг с линиями прорисовывается по часовой ·
               .95–1.4 красная дуга, 1.35 вспышка и волна · 1.2–1.75 буквы U-L-A · 1.55–2.1 FACTORY и линии ·
               2.3 знак «пролетает» внутрь, фон растворяется (сайт открывается на 2.4, заставка убирается на 3.05)
   ===================================================== */
@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.intro { display: none; }
.intro.play { display: block; position: fixed; inset: 0; z-index: 9999; overflow: hidden; cursor: pointer; color: #fff; }
.intro-bg { position: absolute; inset: 0; background: #111216;
  animation: intro-out .65s cubic-bezier(.5, 0, .2, 1) 2.4s forwards; }
.intro-glow { display: block; position: absolute; left: 50%; top: 46%; width: 90vmin; height: 90vmin; max-width: 560px; max-height: 560px;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(181, 9, 25, .22), rgba(181, 9, 25, 0));
  transform: translate(-50%, -50%) scale(.4); opacity: 0;
  animation: intro-glow 1.6s cubic-bezier(.2, .7, .2, 1) .1s forwards, intro-out .5s ease-in 2.35s forwards; }
.intro-mark { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 26px;
  animation: intro-through .7s cubic-bezier(.55, 0, .8, .3) 2.3s forwards; }

.intro-sym { position: relative; width: 144px; height: 144px; }
.intro-sym img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* круг и линии: открываются «стрелкой» по часовой, знак чуть приближается */
.is-lines { --sweep: 0deg;
  -webkit-mask: conic-gradient(from 0deg, #000 var(--sweep), transparent 0); mask: conic-gradient(from 0deg, #000 var(--sweep), transparent 0);
  transform: scale(.9) rotate(-8deg); opacity: 0;
  animation: is-draw .9s cubic-bezier(.6, .05, .25, 1) .15s forwards, is-settle 1s cubic-bezier(.2, .8, .2, 1) .15s forwards; }
/* красная дуга (от 0° до ~100°): прорисовывается следом и вспыхивает */
.is-arc { --sweep: 0deg;
  -webkit-mask: conic-gradient(from 0deg, #000 var(--sweep), transparent 0); mask: conic-gradient(from 0deg, #000 var(--sweep), transparent 0);
  animation: is-arc .5s cubic-bezier(.45, 0, .2, 1) .9s forwards, is-flash .7s ease-out 1.35s; }
/* волна от знака, когда дуга дорисована */
.is-pulse { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(213, 30, 50, .7); opacity: 0;
  animation: is-pulse .9s cubic-bezier(.2, .7, .2, 1) 1.35s; }

.intro-name { display: grid; justify-items: center; gap: 10px; font-family: var(--font); line-height: 1; }
.in-ula { display: flex; gap: .02em; font-size: 46px; font-weight: 900; letter-spacing: -.02em; color: #D51E32; }
.in-ula i { font-style: normal; display: inline-block; opacity: 0; transform: translateY(70%); clip-path: inset(0 0 0 0);
  animation: in-letter .55s cubic-bezier(.2, .9, .25, 1.15) forwards; }
.in-ula i:nth-child(1) { animation-delay: 1.2s; }
.in-ula i:nth-child(2) { animation-delay: 1.3s; }
.in-ula i:nth-child(3) { animation-delay: 1.4s; }
.in-f { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 700; color: #fff; }
.in-f > span { letter-spacing: .6em; margin-right: -.6em; opacity: 0; animation: in-word .6s cubic-bezier(.2, .7, .2, 1) 1.55s forwards; }
.in-f s { display: block; width: 26px; height: 3px; border-radius: 2px; background: #D51E32; transform: scaleX(0);
  animation: in-line .5s cubic-bezier(.2, .7, .2, 1) 1.75s forwards; }
.in-f s:first-child { transform-origin: right; }
.in-f s:last-child { transform-origin: left; }

@keyframes is-draw { to { --sweep: 360deg; } }
@keyframes is-settle { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes is-arc { to { --sweep: 112deg; } }   /* дуга занимает 3°–101° от верха */
@keyframes is-flash { 0% { filter: none; } 35% { filter: drop-shadow(0 0 10px rgba(255, 60, 80, .9)) brightness(1.25); } 100% { filter: none; } }
@keyframes is-pulse { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes intro-glow { to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes in-letter { to { opacity: 1; transform: none; } }
@keyframes in-word { from { opacity: 0; letter-spacing: 1.1em; margin-right: -1.1em; } to { opacity: 1; letter-spacing: .32em; margin-right: -.32em; } }
@keyframes in-line { to { transform: scaleX(1); } }
@keyframes intro-through { to { opacity: 0; transform: translate(-50%, -50%) scale(2.4); } }
@keyframes intro-out { to { opacity: 0; } }
/* браузер без @property: «стрелка» не анимируется — знак просто проявляется */
@media (max-width: 360px) { .intro-sym { width: 120px; height: 120px; } .in-ula { font-size: 40px; } }

/* =====================================================
   НАВИГАЦИЯ: разделы по задачам
   Группы: Главное · Деньги · Товары и доставка · Инструменты · Управление (только админ).
   Телефон: «Ещё» открывает шторку снизу (у самого пальца) с плитками разделов;
   то, что уже есть на нижней панели, в шторке не повторяется (.in-bn).
   ===================================================== */
.section-menu a.tab { display: flex; align-items: center; text-decoration: none; }
.sheet-head { display: none; }
.sheet-close { display: none; }
.section-menu-ico.g-goods { background: rgba(220, 164, 58, .16); color: #A86F0C; }
.section-menu-ico.g-admin { background: var(--surface-sunken); color: var(--text-2); }
html[data-theme="dark"] .section-menu-ico.g-goods { background: rgba(220, 164, 58, .18); color: #E9BC62; }

@media (max-width: 640px) {
  body:not(.no-bottom-nav) .topbar:has(.section-menu:not(.hidden)) { -webkit-backdrop-filter: none; backdrop-filter: none; }
  body:not(.no-bottom-nav) #view-admin .section-menu {
    position: fixed; z-index: 60; top: auto; left: 0; right: 0; bottom: 0;
    width: auto; max-height: min(86dvh, 720px);
    padding: 6px var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom));
    border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--surface-raised);
    box-shadow: var(--shadow-3);
    animation: ula-sheet-up .26s var(--ease, ease-out);
  }
  /* затемнение под шторкой: нажатие мимо закрывает её (общий обработчик клика вне меню) */
  body:not(.no-bottom-nav) #view-admin .section-menu-wrap:has(.section-menu:not(.hidden))::before { content: ""; position: fixed; inset: 0; z-index: 55;
    background: rgba(10, 11, 14, .48); animation: ula-fade-in .2s ease-out; }
  body:not(.no-bottom-nav) .sheet-head { display: flex; align-items: center; justify-content: center; position: sticky; top: -6px; z-index: 1;
    margin: -6px calc(-1 * var(--sp-4)) 4px; padding: 18px var(--sp-4) 8px; background: var(--surface-raised); }
  body:not(.no-bottom-nav) .sheet-head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px;
    margin-left: -19px; border-radius: 4px; background: var(--border-strong); }
  body:not(.no-bottom-nav) .sheet-head b { font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
  body:not(.no-bottom-nav) .sheet-close { display: inline-flex; align-items: center; justify-content: center; position: absolute;
    right: var(--sp-3); top: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--surface-sunken); color: var(--text-2); font-size: 22px; line-height: 1; }
  body:not(.no-bottom-nav) .sheet-close:active { transform: scale(.94); }
  body:not(.no-bottom-nav) #view-admin .section-menu { transition: transform .2s var(--ease, ease-out); touch-action: pan-y; }

  /* плитки: 3 в ряд, значок сверху, подпись снизу */
  body:not(.no-bottom-nav) .section-menu-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body:not(.no-bottom-nav) .section-menu .menu-profile,
  body:not(.no-bottom-nav) .section-menu .menu-group { grid-column: 1 / -1; }
  body:not(.no-bottom-nav) .section-menu .menu-group { padding: 10px 2px 0; }
  body:not(.no-bottom-nav) .section-menu .menu-group.mg-bn,
  body:not(.no-bottom-nav) .section-menu .tab.in-bn { display: none !important; }
  body:not(.no-bottom-nav) .section-menu .tab:not(.menu-profile) {
    position: relative; flex-direction: column; justify-content: center; gap: 6px;
    min-height: 82px; padding: 10px 6px; border-radius: var(--r-md);
    background: var(--surface-sunken); text-align: center;
    font-size: var(--fs-xs); font-weight: 600; line-height: 1.2; color: var(--text);
  }
  body:not(.no-bottom-nav) .section-menu .tab:not(.menu-profile) .tab-ico { width: 40px; height: 40px; border-radius: 12px;
    background: var(--surface-raised); color: var(--text-2); }
  body:not(.no-bottom-nav) .section-menu .tab:not(.menu-profile) .tab-ico svg { width: 22px; height: 22px; }
  body:not(.no-bottom-nav) .section-menu .tab:not(.menu-profile):active { transform: scale(.96); }
  body:not(.no-bottom-nav) .section-menu .tab.active:not(.menu-profile) { background: var(--accent-tint); color: var(--accent-text); }
  body:not(.no-bottom-nav) .section-menu .tab.active .tab-ico { color: var(--accent-text); }
  body:not(.no-bottom-nav) .section-menu .tab.active::after { display: none; }
  /* красная цифра — в углу плитки */
  body:not(.no-bottom-nav) .section-menu .tab:not(.menu-profile) .badge-inline { position: absolute; top: 6px; right: 6px; margin: 0; }
  /* действия (Обновить, Обучение, Выйти…) — компактным списком ниже */
  body:not(.no-bottom-nav) .section-menu .menu-divider { margin: var(--sp-3) 0 var(--sp-1); }
  body:not(.no-bottom-nav) .section-menu .menu-action { min-height: 46px; padding: 0 6px; }
}
@media (max-width: 340px) {
  body:not(.no-bottom-nav) .section-menu-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@keyframes ula-fade-in { from { opacity: 0; } }
@keyframes ula-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { #view-admin .section-menu { animation: none !important; } }

/* =====================================================
   ИГРА (js/game.js): заполненность заказов, «Всё сделано», серия дней, уровни, значки, награды
   ===================================================== */
.gm-bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-sunken); overflow: hidden; }
.gm-bar i { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .5s var(--ease, ease-out); }

/* кольцо в углу карточки заказа */
.gm-ring { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; color: var(--text-3); }
.gm-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.gm-ring circle { fill: none; stroke-width: 2.6; }
.gm-ring .gm-ring-bg { stroke: var(--border); }
.gm-ring .gm-ring-fg { stroke: var(--warning); stroke-linecap: round; }
.gm-ring b { position: relative; font-size: 7.5px; font-weight: 700; color: var(--text-2); letter-spacing: -.02em; }
.gm-ring.done { border-radius: 50%; background: var(--success); color: #fff; }
.card-top .gm-ring { margin-left: auto; }
.card-top .gm-ring + .pill { margin-left: 6px; }

/* в окне заказа: «Заполнено на 60 %» и кнопки «+ Вес» */
.gm-fill { display: grid; gap: 8px; margin: 10px 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-sunken); }
.gm-fill-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gm-fill-top b { font-size: var(--fs-md); }
.gm-fill-top span { font-size: var(--fs-sm); color: var(--text-2); }
.gm-fill-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-add { min-height: 34px; padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-pill); background: var(--surface-raised);
  color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.gm-add:hover { border-style: solid; border-color: var(--success); color: var(--success-text); }
.gm-fill.done { display: flex; align-items: center; gap: 8px; background: var(--success-tint); color: var(--success-text); font-weight: 600; font-size: var(--fs-md); }
.gm-focus { border-radius: var(--r-sm); animation: gm-focus 1.2s ease-out 2; }
@keyframes gm-focus { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* над списком заказов */
.gm-sum { display: grid; gap: 6px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.gm-sum-t { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.gm-sum.done .gm-sum-t { color: var(--success-text); }

/* огонёк серии рядом с «Что сделать сегодня» */
.today-streak:empty { display: none; }
.gm-streak { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 9px 0 7px; border-radius: var(--r-pill);
  background: var(--surface-sunken); color: var(--text-3); font-size: var(--fs-sm); }
.gm-streak.lit { background: var(--warning-tint); color: #C2410C; }
html[data-theme="dark"] .gm-streak.lit { color: #FB923C; }
.gm-streak b { color: inherit; }
.today-head .today-streak { margin-left: auto; }
.today-head:has(.today-streak:empty) .today-count { margin-left: 0; }

/* «Всё сделано на сегодня!» */
.gm-alldone { display: grid; justify-items: center; gap: 6px; padding: 26px 16px 22px; border-radius: var(--r-lg);
  background: var(--success-tint); color: var(--success-text); text-align: center; animation: gm-pop .45s var(--spring, ease-out); }
.gm-alldone-ico { display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 4px; border-radius: 50%; background: var(--success); color: #fff;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--success) 18%, transparent); }
.gm-alldone b { font-size: var(--fs-xl); color: var(--text); }
.gm-alldone span { font-size: var(--fs-md); color: var(--text-2); }
.gm-alldone small { font-size: var(--fs-xs); color: var(--text-3); }
@keyframes gm-pop { from { transform: scale(.94); opacity: 0; } }

/* итог недели */
.gm-week { margin: 16px 0 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.gm-week-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gm-week-head b { font-size: var(--fs-base); }
.gm-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); font-size: 20px; cursor: pointer; }
.gm-x:hover { background: var(--surface-sunken); color: var(--text); }
.gm-week-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-week-nums div { display: grid; gap: 2px; padding: 10px; border-radius: var(--r-md); background: var(--surface-sunken); }
.gm-week-nums b { font-size: var(--fs-2xl); line-height: 1.1; }
.gm-week-nums span { font-size: var(--fs-xs); color: var(--text-2); }
.gm-week-nums em { font-style: normal; font-size: var(--fs-xs); font-weight: 700; }
.gm-week-nums em.up { color: var(--success-text); }
.gm-week-nums em.down { color: var(--text-3); }

/* уровень в профиле */
.gm-level { display: flex; align-items: center; gap: 14px; }
.gm-lv-badge { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 16px; transform: rotate(45deg);
  background: var(--lv, #8A9099); box-shadow: 0 4px 14px color-mix(in srgb, var(--lv, #8A9099) 35%, transparent); }
.gm-lv-badge b { transform: rotate(-45deg); color: #fff; font-size: var(--fs-xl); font-weight: 800; }
.gm-lv-badge.big { width: 84px; height: 84px; border-radius: 24px; margin: 6px auto 18px; }
.gm-lv-badge.big b { font-size: var(--fs-5xl); }
.lv-0 { --lv: #8A9099; } .lv-1 { --lv: #3478C8; } .lv-2 { --lv: #27966C; } .lv-3 { --lv: #B8860B; } .lv-4 { --lv: #B50919; }
.gm-lv-t { display: grid; gap: 4px; flex: 1; min-width: 0; }
.gm-lv-t b { font-size: var(--fs-lg); }
.gm-lv-t span { font-size: var(--fs-sm); color: var(--text-2); }
.gm-lv-t .gm-bar i { background: var(--lv); }
.gm-how { margin: 8px 2px 0; font-size: var(--fs-sm); color: var(--text-2); }
.gm-how summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.gm-how p { margin: 8px 0; line-height: 1.5; }
.gm-rewards { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.gm-rewards li::before { content: "🔒 "; }
.gm-rewards li.ok { color: var(--success-text); }
.gm-rewards li.ok::before { content: "✓ "; }

/* значки */
.gm-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-bottom: 8px; }
.gm-badge { display: grid; justify-items: center; align-content: start; gap: 5px; padding: 14px 8px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border); text-align: center; }
.gm-badge-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface-sunken); color: var(--text-3); }
.gm-badge b { font-size: var(--fs-xs); line-height: 1.25; color: var(--text-3); }
.gm-badge small { font-size: var(--fs-2xs); line-height: 1.3; color: var(--text-3); }
.gm-badge.ok { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.gm-badge.ok .gm-badge-ico { background: var(--warning-tint); color: #A86F0C; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warning) 50%, transparent); }
html[data-theme="dark"] .gm-badge.ok .gm-badge-ico { color: #E9BC62; }
.gm-badge.ok b { color: var(--text); }
.gm-badge:not(.ok) .gm-badge-ico { opacity: .6; }

/* новый уровень */
.gm-lvup { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(10, 11, 14, .55); animation: ula-fade-in .2s ease-out; }
.gm-lvup-card { width: min(340px, 100%); padding: 28px 24px 22px; border-radius: var(--r-xl); background: var(--surface-raised); box-shadow: var(--shadow-3);
  text-align: center; animation: gm-pop .5s var(--spring, ease-out); }
.gm-lvup-card small { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; }
.gm-lvup-card h2 { margin: 4px 0 8px; font-size: var(--fs-4xl); }
.gm-lvup-card p { margin: 0 0 16px; color: var(--text-2); font-size: var(--fs-md); }
.gm-lvup-card .btn { margin-top: 8px; }

/* конфетти */
.gm-confetti { position: fixed; inset: 0; z-index: 210; pointer-events: none; overflow: hidden; }
.gm-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: gm-fall 2.1s cubic-bezier(.2,.6,.4,1) forwards; }
.gm-confetti i:nth-child(3n) { width: 6px; height: 6px; border-radius: 50%; }
@keyframes gm-fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }

/* награды: рамка аватара (с уровня «Байер») */
body.gm-frame .top-profile, body.gm-frame .menu-profile .mp-ava, body.gm-frame .pf-ava {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--gm-frame, #3478C8); }
body[data-gm-lv="2"] { --gm-frame: #27966C; } body[data-gm-lv="3"] { --gm-frame: #B8860B; } body[data-gm-lv="4"] { --gm-frame: #B50919; }
body.gm-frame .top-profile { background: var(--gm-frame, #3478C8); }
/* «Золотой» цвет кнопок (с уровня «Профи») */
html[data-accent="gold"][data-accent]:not(.x-) { --accent: #8A6A12; --accent-hover: color-mix(in srgb, #8A6A12 85%, #000); --on-accent: #fff; }
.pf-sw-lock { opacity: .55; cursor: not-allowed; }
.pf-sw-lock .pf-lock { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .gm-alldone, .gm-lvup, .gm-lvup-card, .gm-focus { animation: none !important; }
  .gm-bar i { transition: none; }
}

/* ===== Быстрые шаблоны нового заказа (js/templates.js) ===== */
.tpl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.tpl-row-t { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.tpl-row .chip { min-height: 44px; }
.tpl-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-sunken); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }

/* ===== Карточка клиента (js/clientcard.js) ===== */
.cc-head { display: grid; gap: 10px; margin-bottom: 14px; }
.cc-contact { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-contact .btn { min-height: 44px; }
.cc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
@media (min-width: 641px) { .cc-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cc-stat { padding: 10px 12px; border-radius: 12px; background: var(--surface-sunken); min-width: 0; }
.cc-stat span { display: block; font-size: var(--fs-xs, 12px); color: var(--muted); }
.cc-stat b { display: block; font-size: var(--fs-md, 16px); overflow-wrap: anywhere; }
.cc-stat.warn b { color: var(--warning, #b7791f); }
.cc-stat.bad b { color: var(--danger, #d92d20); }
.cc-actions { margin: 6px 0 16px; }
.cc-orders { display: grid; gap: 6px; }
.cc-order { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-align: left; font: inherit; cursor: pointer; }
.cc-order .pill { grid-row: span 2; }
.cc-order-p { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); min-width: 0; }
.cc-order small { grid-column: 2; color: var(--muted); }
.cc-order:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cc-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.cc-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cc-list li small { margin-left: auto; color: var(--muted); }
.cc-list b.neg { color: var(--danger, #d92d20); }

/* ===== Импорт: шаги и проверка строк (js/import.js) ===== */
.im-steps { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: ims; flex-wrap: wrap; }
.im-steps li { counter-increment: ims; display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.im-steps li::before { content: counter(ims); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-sunken); font-weight: 700; font-size: 12px; }
.im-steps li + li::after { content: none; }
.im-steps li.on { color: var(--text); font-weight: 600; }
.im-steps li.on::before { background: var(--primary); color: var(--on-primary); }
.im-steps li.done::before { content: "✓"; background: var(--success, #12b76a); color: #fff; }
.im-check-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
@media (min-width: 641px) { .im-check-sum { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.im-stat { padding: 10px 12px; border-radius: 12px; background: var(--surface-sunken); }
.im-stat b { display: block; font-size: 20px; }
.im-stat span { font-size: var(--fs-sm); color: var(--muted); }
.im-stat.ok b { color: var(--success, #12b76a); }
.im-stat.warn b { color: var(--warning, #b7791f); }
.im-stat.bad b { color: var(--danger, #d92d20); }
.im-issues { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.im-issues li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; border-left: 3px solid var(--line); background: var(--surface); }
.im-issues li.warn { border-left-color: var(--warning, #b7791f); }
.im-issues li.bad { border-left-color: var(--danger, #d92d20); }
.im-issues li span { overflow-wrap: anywhere; }
.im-issues li small { color: var(--text-2); }
.im-allok { padding: 10px 12px; border-radius: 10px; background: var(--surface-sunken); }
#im-report { margin-bottom: 8px; min-height: 44px; }

/* ===== Подпись «прибыль приблизительная» (docs/finance-model.md) ===== */
.fin-approx { color: var(--muted); }
small.fin-approx { display: block; font-size: var(--fs-2xs, 11px); font-weight: 400; }
p.fin-approx { margin: 6px 4px 10px; }

/* ===== Путь заказа: откуда срок, на сколько задержка, связь (js/tracking.js) ===== */
.tk-late { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tk-late p { margin: 0; flex: 1 1 200px; }
.tk-ask { min-height: 44px; }
.tk-src { margin-bottom: 0; }

/* ===== Доступность на телефоне: размер кнопок под палец (аудит 2026-11, tests/browser/smoke.mjs) =====
   Минимум WCAG 2.2 — 24 px; на сенсорном экране кнопки доводим до 44 px (рекомендация Apple и Google).
   Видимый размер почти не меняется: растёт область нажатия. */
.mini-link { min-height: 44px; display: inline-flex; align-items: center; }
@media (pointer: coarse), (max-width: 640px) {
  .lang-switch button { min-width: 44px; min-height: 44px; }
  #support-btn, .sheet-close { min-width: 44px; min-height: 44px; }
  .gm-add, .wallet-chip, .order-tag, .chip { min-height: 44px; }
  .client-row-contacts a, .phone-link { min-height: 44px; display: inline-flex; align-items: center; }
  .toolbar .btn-sm, .orders-tools .btn-sm, #req-link-btn, #bulk-btn, #import-btn { min-height: 44px; }
}
/* Видимый фокус для всех новых кнопок (карточка клиента, импорт, шаблоны) */
.cc-order:focus-visible, .tpl-row .chip:focus-visible, #im-report:focus-visible, .tk-ask:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 640px) { .tpl-row-t { flex-basis: 100%; } }

/* =====================================================
   Раздел «Команда» (js/teamwork.js, js/teamtasks.js; файлы 67–68).
   Без файлов 67–68 в базе раздела нет (.tw-only скрыт), а старая кнопка «Команда» (.tw-legacy) работает.
   ===================================================== */
body:not(.tw-on) .tw-only { display: none !important; }
body.tw-on .tw-legacy { display: none !important; }

.tw-head { display: grid; gap: var(--sp-3); padding: var(--sp-4); margin-bottom: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.tw-head:empty { display: none; }
.tw-me { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.tw-me-txt, .tw-row-txt { display: grid; gap: 2px; min-width: 0; }
.tw-me-txt b { font-size: var(--fs-lg); }
.tw-me-txt .muted, .tw-row-txt .muted { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.tw-ava { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-text); font-weight: 700; font-size: var(--fs-md); }
.tw-perms { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.tw-tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-pill); background: var(--fill); color: var(--text); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.tw-alert { margin: 0 0 var(--sp-3); padding: 10px 14px; border-radius: var(--r-md); background: var(--error-tint); color: var(--error-text); font-weight: 600; font-size: var(--fs-md); }
.tw-body { display: grid; gap: var(--sp-3); }
.tw-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; }
.tw-list { display: grid; gap: var(--sp-2); }

/* сотрудники, отделы, роли */
.tw-row { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.tw-row .tw-row-txt { flex: 1; }
.tw-row-act { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tw-row.tw-off { opacity: .75; background: var(--surface-sunken); }
.tw-warn { color: var(--warning-text); font-size: var(--fs-sm); }
.tw-invite .link-input { margin: 6px 0 0; }
.tw-tree .tw-row { margin-left: calc(var(--depth, 0) * 18px); }
.tw-perm-list { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.tw-perm-list .on { color: var(--success-text); font-weight: 600; }
.tw-perm-list .off { color: var(--muted); }
.tw-perm-pick { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding: 0; border: 0; }
.tw-perm-pick legend { margin-bottom: 6px; font-weight: 600; font-size: var(--fs-md); }
#tab-team label.check, #modal-tw-form label.check, #modal-tw-task label.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
#tab-team label.check input, #modal-tw-form label.check input, #modal-tw-task label.check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.tw-perm-pick label.check span { display: grid; gap: 2px; }
.tw-log-row { display: grid; grid-template-columns: 110px 1fr; gap: var(--sp-2); padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-md); }

/* задачи */
.tw-task { display: grid; gap: 6px; width: 100%; padding: 12px 14px; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--r-md); cursor: pointer; }
.tw-task:hover { border-color: var(--border-strong); }
.tw-task:focus-visible, .tw-notif:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tw-task.is-overdue { border-left-color: var(--error); }
.tw-task-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tw-num { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.tw-task-title { font-weight: 600; font-size: var(--fs-base); overflow-wrap: anywhere; }
.tw-task-meta { font-size: var(--fs-sm); }
.tw-overdue { color: var(--error-text); font-weight: 600; }
.tw-st, .tw-prio { display: inline-flex; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.tw-st-todo { background: var(--fill); color: var(--text); }
.tw-st-in_progress { background: var(--info-tint); color: var(--info-text); }
.tw-st-blocked { background: var(--warning-tint); color: var(--warning-text); }
.tw-st-submitted { background: var(--accent-tint); color: var(--accent-text); }
.tw-st-done { background: var(--success-tint); color: var(--success-text); }
.tw-st-cancelled { background: var(--fill); color: var(--muted); text-decoration: line-through; }
.tw-prio-low { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); }
.tw-prio-high { background: var(--warning-tint); color: var(--warning-text); }
.tw-prio-urgent { background: var(--error-tint); color: var(--error-text); }
.tw-closed > summary, .tw-history > summary { cursor: pointer; padding: 8px 0; color: var(--muted); font-weight: 600; font-size: var(--fs-md); }
.tw-closed .tw-list { margin-top: var(--sp-2); }

/* карточка задачи */
.tw-meta { display: grid; gap: 6px; margin: var(--sp-3) 0; }
.tw-meta-row { display: grid; grid-template-columns: 130px 1fr; gap: var(--sp-2); font-size: var(--fs-md); }
.tw-meta-row dt { color: var(--muted); }
.tw-meta-row dd { margin: 0; overflow-wrap: anywhere; }
.tw-desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 var(--sp-3); padding: 10px 12px; background: var(--surface-sunken); border-radius: var(--r-md); font-size: var(--fs-md); }
.tw-items { display: grid; gap: 4px; margin: 0 0 var(--sp-2); padding: 0; list-style: none; }
.tw-item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 6px 0; border-bottom: 1px solid var(--border); }
.tw-item.done span { color: var(--muted); text-decoration: line-through; }
.tw-add-row { display: flex; gap: var(--sp-2); align-items: flex-start; }
.tw-add-row input, .tw-add-row textarea { flex: 1; min-width: 0; }
.tw-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0; }
.tw-reason { padding: var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-sunken); }
.tw-reason .tw-actions { margin-bottom: 0; justify-content: flex-end; }
.tw-comments { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.tw-comment { padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-sunken); font-size: var(--fs-md); }
.tw-comment.mine { background: var(--info-tint); }
.tw-comment .muted { font-size: var(--fs-xs); }
.tw-comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tw-note { font-style: italic; overflow-wrap: anywhere; }
.tw-events { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: var(--fs-sm); }

/* уведомления */
.tw-notif { display: flex; gap: var(--sp-2); align-items: flex-start; width: 100%; padding: 10px 12px; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.tw-notif .tw-row-txt { font-size: var(--fs-md); }
.tw-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; }
.tw-notif.unread { border-color: var(--accent); }
.tw-notif.unread .tw-dot { background: var(--accent); }

@media (max-width: 640px) {
  .tw-row { flex-wrap: wrap; }
  .tw-row-act { width: 100%; justify-content: flex-start; }
  .tw-tree .tw-row { margin-left: calc(var(--depth, 0) * 10px); }
  .tw-meta-row { grid-template-columns: 110px 1fr; }
  .tw-log-row { grid-template-columns: 1fr; gap: 2px; }
  .tw-add-row { flex-wrap: wrap; }
  .tw-add-row .btn { width: 100%; }
  /* на телефоне — кнопки под палец (44 px) */
  #tab-team .btn-sm, #modal-tw-task .btn-sm, #modal-tw-form .btn-sm { min-height: 44px; }
  .tw-item .icon-btn { min-width: 44px; }
}

/* =====================================================
   Команда на заказах (js/teamorders.js, файл 69): состояние заказа, этапы, задержки, шаблоны.
   Сотрудник только со своими заказами (body.is-limited) видит только «Команду» и профиль.
   ===================================================== */
body.is-limited .section-menu .tab:not([data-tab="team"]):not([data-tab="profile"]),
body.is-limited .section-menu .menu-group,
body.is-limited #simple-btn, body.is-limited #tour-btn, body.is-limited #fab { display: none !important; }

.to-state-on_track { background: var(--success-tint); color: var(--success-text); }
.to-state-at_risk { background: var(--warning-tint); color: var(--warning-text); }
.to-state-delayed { background: var(--error-tint); color: var(--error-text); }
.to-ms-pending { background: var(--fill); color: var(--text); }
.to-ms-in_progress { background: var(--info-tint); color: var(--info-text); }
.to-ms-done { background: var(--success-tint); color: var(--success-text); }
.to-ms-delayed { background: var(--error-tint); color: var(--error-text); }
.to-ms-skipped { background: var(--fill); color: var(--muted); text-decoration: line-through; }

.to-duty { display: grid; grid-template-columns: 130px 1fr; gap: var(--sp-2); align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-md); }
.to-duty .tw-tag { margin: 2px 4px 2px 0; }
.to-off { opacity: .6; text-decoration: line-through; }
.to-x { display: inline-grid; place-items: center; min-width: 28px; min-height: 28px; margin: -4px -6px -4px 2px; border: 0; border-radius: 50%; background: none; color: inherit; font: inherit; font-weight: 700; padding: 0; cursor: pointer; }
.to-x:hover, .to-x:focus-visible { background: var(--hover); }
.to-duty + .btn, .to-ms + .tw-actions, .to-delay + .btn { margin-top: var(--sp-2); }
.to-ms { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-2); padding: 0; list-style: none; }
.to-ms-row { display: flex; gap: var(--sp-3); align-items: flex-start; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.to-ms-row.is-overdue { border-left: 4px solid var(--error); }
.to-ms-row .tw-row-txt { flex: 1; }
.to-delay { display: grid; gap: 6px; padding: 12px 14px; margin-bottom: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-sunken); }
.to-delay.open { border-color: var(--error); background: var(--error-tint); }
.to-delay p { margin: 0; }
.to-reason { font-weight: 600; overflow-wrap: anywhere; }
.to-resolution { color: var(--success-text); overflow-wrap: anywhere; }
.to-actions-list { display: grid; gap: 4px; }
.to-action { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.to-action:focus-visible, .to-order:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.to-steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 2px; font-size: var(--fs-md); }
.to-step-row { display: grid; grid-template-columns: 1fr 140px 72px 44px; gap: 6px; align-items: center; margin-bottom: 6px; }
.to-step-row input, .to-step-row select { min-width: 0; }
.to-detail { display: flex; gap: var(--sp-3); align-items: center; justify-content: space-between; padding: 12px 14px; margin: 12px 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-sunken); }
.to-detail p { margin: 2px 0 0; font-size: var(--fs-sm); }

@media (max-width: 640px) {
  .to-duty { grid-template-columns: 1fr; gap: 2px; }
  .to-ms-row { flex-wrap: wrap; }
  .to-step-row { grid-template-columns: 1fr 1fr 64px 44px; }
  .to-step-row input[name="st_title"] { grid-column: 1 / -1; }
  .to-detail { flex-wrap: wrap; }
  #modal-tw-order .btn-sm { min-height: 44px; }
  .to-x { min-width: 36px; min-height: 36px; }
}

/* =====================================================
   Операционный контроль и аналитика (js/teamops.js, js/teamreports.js; файлы 70–71).
   ===================================================== */
.tw-nav { display: grid; gap: 6px; margin-bottom: var(--sp-3); }
.tw-nav .chips { margin: 0; }
.tw-sub .chip { min-height: 32px; font-size: var(--fs-sm); }
.op-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-2); }
.op-tile { display: grid; gap: 2px; padding: 12px 14px; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.op-tile.op-static { cursor: default; }
.op-tile b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.op-tile span { font-size: var(--fs-sm); color: var(--text-2); }
.op-tile small { font-size: var(--fs-xs); }
.op-tile.op-bad { border-left: 4px solid var(--error); }
.op-tile.op-warn { border-left: 4px solid var(--warning); }
.op-tile:focus-visible, .op-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.op-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: var(--sp-2) 0 0; font-size: var(--fs-sm); }
.op-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.op-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.op-table caption { text-align: left; padding: 10px 12px 0; font-weight: 600; }
.op-table th, .op-table td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.op-table th:first-child, .op-table td:first-child { text-align: left; white-space: normal; }
.op-table th { color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }
.op-table tr:last-child td { border-bottom: 0; }
.op-bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--fill); }
.op-bar i { display: block; height: 100%; border-radius: 2px; background: var(--info); }
.op-sev-low { background: var(--fill); color: var(--text); }
.op-sev-medium { background: var(--info-tint); color: var(--info-text); }
.op-sev-high { background: var(--warning-tint); color: var(--warning-text); }
.op-sev-critical { background: var(--error-tint); color: var(--error-text); }
.op-ist-open { background: var(--error-tint); color: var(--error-text); }
.op-ist-investigating { background: var(--warning-tint); color: var(--warning-text); }
.op-ist-resolved { background: var(--success-tint); color: var(--success-text); }
.op-ist-closed { background: var(--fill); color: var(--muted); }
.op-sop-draft { background: var(--fill); color: var(--text); }
.op-sop-archived { background: var(--fill); color: var(--muted); }
.op-kv { margin: 0 0 var(--sp-2); overflow-wrap: anywhere; font-size: var(--fs-md); }
.op-events li { overflow-wrap: anywhere; }
.op-sop-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; margin: var(--sp-3) 0; border-radius: var(--r-md); background: var(--surface-sunken); font-size: var(--fs-md); line-height: var(--lh-normal); }
.op-sop-body.op-old { margin: 4px 0 var(--sp-3); color: var(--text-2); }
.op-acks { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-md); }
.op-acks li { display: flex; justify-content: space-between; gap: var(--sp-2); padding: 6px 0; border-bottom: 1px solid var(--border); }
.op-ack-ok span:last-child { color: var(--success-text); }
.op-ack-old span:last-child { color: var(--warning-text); }
.op-ack-no span:last-child { color: var(--error-text); }
.op-cal-tools { align-items: center; justify-content: flex-start; }
.op-cal-range { font-weight: 600; font-variant-numeric: tabular-nums; }
.op-cal-mine { margin-left: auto; font-size: var(--fs-sm); }
.op-cal { display: grid; gap: 6px; }
.op-day { display: grid; grid-template-columns: 120px 1fr; gap: 4px var(--sp-3); align-items: start; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.op-day.empty { opacity: .7; }
.op-day.today { border-color: var(--accent); }
.op-day-h { grid-row: span 20; font-weight: 600; font-size: var(--fs-sm); text-transform: capitalize; }
.op-item { display: flex; gap: 6px; align-items: baseline; width: 100%; padding: 4px 0; text-align: left; font: inherit; font-size: var(--fs-md); color: inherit; background: none; border: 0; cursor: pointer; overflow-wrap: anywhere; }
.op-item.mine { font-weight: 600; }
.op-item.late { color: var(--error-text); }
.op-time { flex: none; min-width: 44px; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.rp-chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding: 8px 4px 0; border-bottom: 1px solid var(--border-strong); }
.rp-col { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.rp-bar { width: min(24px, 70%); border-radius: 4px 4px 0 0; background: var(--info); }
.rp-col:hover .rp-bar { background: var(--info-text); }
.rp-x { position: absolute; bottom: -18px; font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.rp-chart + details { margin-top: 26px; }
.op-rep-tools { justify-content: space-between; align-items: center; }
.op-rep-tools .chips { margin: 0; }

@media (max-width: 640px) {
  .op-tiles { grid-template-columns: repeat(2, 1fr); }
  .op-day { grid-template-columns: 1fr; }
  .op-day-h { grid-row: auto; }
  .op-cal-mine { margin-left: 0; min-height: 44px; align-items: center; }
  .op-item { min-height: 44px; align-items: center; }
  .tw-sub .chip { min-height: 44px; }
  .tw-meta .link-btn { min-height: 44px; }
  .op-cal-tools .btn-sm { min-width: 44px; }
  .rp-x { display: none; }
  #modal-tw-doc .btn-sm { min-height: 44px; }
}

/* =====================================================
   «Мои цели» (js/goals.js, файл 72): фокус дня, таймер, доска, цели по горизонтам, календарь
   ===================================================== */
.gl-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.gl-tab { flex: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: var(--r-pill); padding: 8px 16px; font-size: var(--fs-md); font-weight: 600; cursor: pointer; }
.gl-tab[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.gl-panel { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.gl-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.gl-panel h2, .gl-hzh h2 { font-size: var(--fs-xl); font-weight: 600; margin: 0; }
.gl-panel h3 { font-size: var(--fs-base); font-weight: 600; margin: 0; }
.gl-meta { color: var(--text-2); font-size: var(--fs-sm); }
.gl-lede { color: var(--text-2); font-size: var(--fs-md); margin: 0; max-width: 62ch; }
.gl-empty { color: var(--text-2); font-size: var(--fs-md); margin: 0; }
.gl-sp { flex: 1; }
.gl-rowf { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gl-rowf > input { flex: 1 1 180px; min-width: 0; }
.gl-today { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 820px) { .gl-today { grid-template-columns: 1fr; } }
.gl-slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.gl-slot { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 12px; background: var(--surface-sunken); }
.gl-slot.empty { border-style: dashed; background: transparent; }
.gl-slot.is-done .gl-st { text-decoration: line-through; color: var(--text-2); }
.gl-n { font-weight: 700; color: var(--warning-text); font-size: var(--fs-xl); text-align: center; font-variant-numeric: tabular-nums; }
.gl-add-slot { grid-column: 2 / 4; justify-self: start; background: none; border: 0; color: var(--text-2); font-weight: 600; padding: 6px 0; cursor: pointer; font-size: var(--fs-md); }
.gl-add-slot:hover { color: var(--text); }
.gl-st, .gl-t { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; font-size: var(--fs-base); color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.gl-t { font-weight: 500; font-size: var(--fs-md); }
.gl-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gl-acts { display: flex; gap: 4px; }
.gl-ibtn { width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; font-size: 14px; line-height: 1; cursor: pointer; }
.gl-ibtn:hover { color: var(--text); }
.gl-ibtn.play { color: var(--warning-text); border-color: var(--warning); }
.gl-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--text-3); background: transparent; display: inline-grid; place-items: center; padding: 0; flex: none; cursor: pointer; color: #fff; }
.gl-check.on { background: var(--success); border-color: var(--success); }
.gl-check svg { width: 14px; height: 14px; }
.gl-chain { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: var(--fs-sm); color: var(--text-2); }
.gl-chain b { font-weight: 600; background: var(--info-tint); color: var(--info-text); font-size: var(--fs-2xs); border-radius: var(--r-xs); padding: 1px 6px; margin-right: 2px; }
.gl-chain i { font-style: normal; opacity: .6; }
.gl-timer { position: relative; width: min(210px, 64vw); aspect-ratio: 1; align-self: center; }
.gl-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.gl-ring circle { fill: none; stroke-width: 7; }
.gl-ring .bg { stroke: var(--surface-sunken); }
.gl-ring .fg { stroke: var(--warning); stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
.gl-clock { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 40px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.gl-ttask { text-align: center; color: var(--text-2); font-size: var(--fs-md); margin: 0; }
.gl-ttask b { color: var(--text); }
.gl-presets { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.gl-pre { border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--r-pill); padding: 6px 12px; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; color: var(--text); font-variant-numeric: tabular-nums; }
.gl-pre.on { background: var(--warning-tint); border-color: var(--warning); }
.gl-pre:disabled { opacity: .5; cursor: default; }
.gl-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.gl-stat { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.gl-stat b { font-size: var(--fs-4xl); font-variant-numeric: tabular-nums; }
.gl-stat span { color: var(--text-2); font-size: var(--fs-sm); }
.gl-quick { margin-bottom: 16px; }
.gl-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.gl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.gl-list li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.gl-list li:first-child { border-top: 0; }
.gl-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.gl-chip { font-size: var(--fs-xs); border-radius: var(--r-xs); padding: 2px 7px; background: var(--surface-sunken); color: var(--text-2); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gl-chip.late { background: var(--error-tint); color: var(--error-text); font-weight: 600; }
.gl-chip.now { background: var(--warning-tint); color: var(--warning-text); font-weight: 600; }
.gl-chip.goal { background: var(--info-tint); color: var(--info-text); }
.gl-bhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.gl-bhead select { width: auto; max-width: 100%; }
.gl-colswitch { display: none; gap: 4px; margin-bottom: 10px; overflow-x: auto; }
.gl-colswitch button { flex: none; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--r-pill); padding: 6px 12px; font-weight: 600; font-size: var(--fs-sm); color: var(--text); cursor: pointer; }
.gl-colswitch button[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.gl-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.gl-col { background: var(--surface-sunken); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; min-width: 0; }
.gl-col.over { border-color: var(--accent); background: var(--accent-tint); }
.gl-colh { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px; }
.gl-colhint { font-size: var(--fs-xs); color: var(--text-2); padding: 0 4px; margin-top: -6px; }
.gl-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 10px 11px; display: flex; flex-direction: column; gap: 6px; cursor: grab; position: relative; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.gl-card:hover { border-color: var(--text-3); }
.gl-card.dragging { opacity: .5; }
.gl-card.is-done .gl-ct { color: var(--text-2); text-decoration: line-through; }
.gl-ct { font-weight: 500; font-size: var(--fs-md); overflow-wrap: anywhere; padding-right: 16px; }
.gl-star { position: absolute; top: 8px; right: 9px; color: var(--warning); font-size: 14px; }
.gl-addc { background: none; border: 1px dashed var(--border-strong); border-radius: var(--r-md); padding: 8px; color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.gl-addc:hover { color: var(--text); border-color: var(--text-3); }
.gl-foot { margin-top: 12px; }
@media (max-width: 760px) { .gl-colswitch { display: flex; } .gl-board { display: block; } .gl-board > .gl-col { display: none; } .gl-board > .gl-col[data-active] { display: flex; } }
.gl-ladder { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 18px; font-size: var(--fs-md); color: var(--text-2); }
.gl-ladder span { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.gl-ladder i { font-style: normal; }
.gl-hz { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.gl-hzh { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gl-scale { display: inline-flex; gap: 2px; align-items: flex-end; }
.gl-scale i { width: 5px; border-radius: 2px; background: var(--border-strong); }
.gl-scale i:nth-child(1) { height: 6px; } .gl-scale i:nth-child(2) { height: 9px; } .gl-scale i:nth-child(3) { height: 12px; } .gl-scale i:nth-child(4) { height: 15px; }
.gl-scale i.on { background: var(--accent); }
.gl-ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
@media (max-width: 420px) { .gl-ggrid { grid-template-columns: 1fr; } }
.gl-goal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gl-goal.is-done { opacity: .72; }
.gl-gt { font-size: var(--fs-lg); font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.gl-bar { height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; margin-bottom: 4px; }
.gl-bar > span { display: block; height: 100%; background: var(--success); border-radius: 3px; }
.gl-goal details { font-size: var(--fs-md); }
.gl-goal summary { cursor: pointer; color: var(--accent-text); font-weight: 600; font-size: var(--fs-sm); }
.gl-goal h4 { margin: 8px 0 0; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.gl-txt { white-space: pre-wrap; margin: 4px 0 0; overflow-wrap: anywhere; }
.gl-gacts { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-hzempty { border: 1px dashed var(--border-strong); border-radius: var(--r-lg); padding: 14px; color: var(--text-2); font-size: var(--fs-md); margin: 0; }
.gl-calwrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .gl-calwrap { grid-template-columns: 1fr; } }
.gl-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.gl-calnav { display: flex; align-items: center; gap: 8px; }
.gl-calnav h2 { flex: 1; text-transform: capitalize; }
.gl-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.gl-wd { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); text-align: center; padding-bottom: 4px; }
.gl-day { height: 56px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm); padding: 5px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; min-width: 0; cursor: pointer; color: var(--text); }
.gl-day.out { background: transparent; color: var(--text-3); border-color: transparent; }
.gl-day.is-today .gl-dn { background: var(--text); color: var(--surface); border-radius: 6px; padding: 0 5px; }
.gl-day.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.gl-dn { font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.gl-marks { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 8px; width: 100%; }
.gl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text); display: inline-block; }
.gl-dot.late { background: var(--error); }
.gl-dia { width: 8px; height: 8px; background: var(--info); transform: rotate(45deg); display: inline-block; }
.gl-fbar { height: 4px; border-radius: 2px; background: var(--warning); width: 100%; display: inline-block; }
@media (max-width: 480px) { .gl-day { height: 46px; padding: 4px; } .gl-calnav h2 { font-size: var(--fs-lg); } }
.gl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); }
.gl-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.gl-legend .gl-fbar { width: 14px; }
.gl-tl { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); }
.gl-tl input { width: auto; }
.gl-dlg { border: 0; border-radius: var(--r-xl); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.gl-dlg::backdrop { background: rgba(10, 12, 16, .5); }
.gl-dlg form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.gl-dlg h2 { font-size: var(--fs-2xl); font-weight: 600; margin: 0; }
.gl-fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.gl-fld > span { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.gl-fr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .gl-fr { grid-template-columns: 1fr; } }
.gl-cb { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 500; }
.gl-cb input { width: 18px; height: 18px; min-height: 0; }
.gl-cl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.gl-cl li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); }
.gl-cl li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.gl-cl li.d span { text-decoration: line-through; color: var(--text-2); }
.gl-cl input { width: 17px; height: 17px; min-height: 0; }
.gl-x { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 4px; }
.gl-dacts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; }
.gl-danger { color: var(--error-text); }
.gl-danger[data-armed] { background: var(--error); border-color: var(--error); color: #fff; }
.gl-pg h4 { margin: 6px 0 4px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.gl-pick { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--border-strong); background: var(--surface-sunken); border-radius: var(--r-md); padding: 9px 11px; margin-bottom: 6px; cursor: pointer; color: var(--text); }
.gl-pick:hover { border-color: var(--accent); }
.gl-pick b { font-weight: 600; font-size: var(--fs-md); }
.gl-msg { font-size: var(--fs-sm); margin: 0; color: var(--text-2); }
.gl-msg.err { color: var(--error-text); }
@media (prefers-reduced-motion: reduce) { .gl-ring .fg { transition: none; } }

/* «Мои цели» — доски как в Trello: главная досок, своя доска со списками, архив, отмена удаления, неделя, «Фокус дня» на Главной */
.gl-c-blue { background: #2f6fdb; } .gl-c-green { background: #2e9e5b; } .gl-c-orange { background: #e07a1f; } .gl-c-red { background: #d64545; }
.gl-c-purple { background: #7b5cd6; } .gl-c-pink { background: #d3509a; } .gl-c-teal { background: #1e9aa0; } .gl-c-gray { background: #6b7280; }
.gl-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; margin-right: 5px; vertical-align: -1px; }
.gl-sw.lg { width: 22px; height: 22px; border-radius: 6px; margin: 0; }
.gl-search { margin: 0 0 18px; max-width: 560px; }
.gl-search input { width: 100%; }
.gl-bsec { margin-bottom: 26px; display: flex; flex-direction: column; gap: 10px; }
.gl-bsh { font-size: var(--fs-lg); font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.gl-bsi { color: var(--warning); margin-right: 6px; }
.gl-bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gl-btile { position: relative; min-width: 0; }
.gl-bopen, .gl-tpl { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 0 0 12px; overflow: hidden; cursor: pointer; color: var(--text); min-height: 112px; }
.gl-bopen:hover, .gl-tpl:hover { border-color: var(--text-3); }
.gl-cover { display: block; height: 44px; margin-bottom: 6px; }
.gl-btitle { font-weight: 600; font-size: var(--fs-base); padding: 0 12px; overflow-wrap: anywhere; }
.gl-bopen .gl-meta, .gl-tpl .gl-meta { padding: 0 12px; }
.gl-bgoal { display: flex; flex-direction: column; gap: 4px; padding: 4px 12px 0; }
.gl-bgoal .gl-bar { margin: 0; }
.gl-bstar { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(0, 0, 0, .28); color: #fff; font-size: 15px; cursor: pointer; opacity: .75; }
.gl-bstar.on { color: #ffd34d; opacity: 1; }
.gl-bstar:hover { opacity: 1; }
.gl-bstar.inline { position: static; background: var(--surface-sunken); color: var(--text-3); border: 1px solid var(--border-strong); }
.gl-bstar.inline.on { color: var(--warning); }
.gl-bnew { min-height: 112px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: transparent; color: var(--text-2); font-weight: 600; font-size: var(--fs-md); cursor: pointer; }
.gl-bnew:hover { color: var(--text); border-color: var(--text-3); }
.gl-arch { margin-bottom: 20px; }
.gl-arch summary { cursor: pointer; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.gl-arch .gl-list li { grid-template-columns: 16px minmax(0, 1fr) auto; }
.gl-glist li { grid-template-columns: 26px minmax(0, 1fr) auto; }
.gl-bname { font-size: var(--fs-xl); font-weight: 600; margin: 0; overflow-wrap: anywhere; min-width: 0; }
.gl-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warning-tint); color: var(--warning-text); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
.gl-lrow { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.gl-lrow > .gl-col { flex: 0 0 272px; scroll-snap-align: start; }
.gl-lt { background: none; border: 0; padding: 2px 0; font-weight: 600; font-size: var(--fs-base); color: var(--text); cursor: pointer; text-align: left; overflow-wrap: anywhere; min-width: 0; }
.gl-lt:hover { color: var(--accent-text); }
.gl-addf { display: flex; flex-direction: column; gap: 8px; }
.gl-addf textarea { width: 100%; resize: none; overflow: hidden; min-height: 64px; line-height: 1.4; overflow-wrap: anywhere; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.gl-addact { display: flex; align-items: center; gap: 8px; }
.gl-addact .gl-x { min-width: 36px; min-height: 36px; }
.gl-addc { width: 100%; min-height: 40px; }
textarea#glf-title { resize: none; overflow: hidden; line-height: 1.4; min-height: 42px; overflow-wrap: anywhere; }
.gl-newlist { min-height: 0; background: transparent; border-style: dashed; }
.gl-newlist input { width: 100%; }
.gl-newlist .btn { align-self: flex-start; }
@media (max-width: 640px) { .gl-lrow > .gl-col { flex-basis: 84vw; } }
.gl-ctr { display: flex; gap: 8px; align-items: flex-start; }
.gl-check.sm { width: 20px; height: 20px; border-width: 2px; margin-top: 1px; }
.gl-check.sm svg { width: 11px; height: 11px; }
.gl-chip.brd { display: inline-flex; align-items: center; border: 0; cursor: default; font: inherit; font-size: var(--fs-xs); }
button.gl-chip.brd { cursor: pointer; }
.gl-colors { border: 0; padding: 0; margin: 0; }
.gl-colors legend { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin-bottom: 5px; padding: 0; }
.gl-colors > div { display: flex; gap: 8px; flex-wrap: wrap; }
.gl-swl { position: relative; cursor: pointer; display: inline-flex; padding: 3px; border-radius: 9px; border: 2px solid transparent; }
.gl-swl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.gl-swl:has(input:checked) { border-color: var(--text); }
.gl-swl:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.gl-undo { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1200; display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--surface); border-radius: var(--r-md); padding: 10px 10px 10px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: calc(100vw - 32px); font-size: var(--fs-md); }
.gl-undo span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-undo .btn { flex: none; }
.gl-week { margin-top: 16px; }
.gl-wbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; }
.gl-wb { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.gl-wcol { width: 100%; max-width: 40px; height: 90px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border-strong); }
.gl-wcol i { display: block; width: 100%; background: var(--warning); border-radius: 4px 4px 0 0; min-height: 0; }
.gl-wv { font-size: var(--fs-xs); color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.gl-wb small { font-size: var(--fs-xs); color: var(--text-2); }
.gl-wb.now small { color: var(--text); font-weight: 700; }
.gl-home { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.gl-home .home-h { margin: 0; }
.gl-home .gl-t.is-done { text-decoration: line-through; color: var(--text-2); }
.gl-home .gl-t { cursor: default; }
