
  :root {
    color-scheme: light;
    /* Токены — взяты буквально из утверждённого макета Nasem-Apple-Glass-Reference.html
       (--nf-blue/--nf-text/--nf-muted/--nf-line/--nf-soft/--nf-tint), не придуманы заново
       (Довуд, 25.10.2026: «перенести конкретное оформление приложенного эталона»). */
    --accent: #315ee8; --ink: #172338; --muted: #59697f;
    --line: rgba(255,255,255,.65); --soft: #eaf0f8; --tint: #e1eaff;
    --green: #158565; --red: #bd4d44; --amber: #92621b;
    /* Плотность заливки карточек: при .79 фото цеха слишком отчётливо просвечивало под текстом
       (замечание проверки 26.10.2026). Стекло, размытие и объём сохранены — поднята только непрозрачность. */
    --glass-bg: rgba(255,255,255,.9); --glass-border: rgba(255,255,255,.65);
    --glass-shadow: 0 12px 28px rgba(17,37,74,.07), inset 0 1px 0 rgba(255,255,255,.48);
    --radius-lg: 20px; --radius-md: 13px;
    /* Рамка-«окно» вокруг интерфейса, как в эталоне: поля по краям и скругление. Включается
       только на широком экране (см. @media min-width:900px) — на телефоне поля съедали бы ширину. */
    --frame: 18px; --radius-xl: 24px; --page-bg: #e5eaf1;
  }
  * { box-sizing: border-box; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; margin: 0; color: var(--ink);
    background: var(--page-bg);
    min-height: 100vh;
  }
  /* Фон — фото цеха (размытое, затонировано), как в эталоне: :before — само фото, :after — диагональный
     тон поверх, чтобы оборудование было видно, но не мешало читать текст. Фото — /bg.jpg: отдаёт то, что
     лежит в R2 (settings/background.jpg), если владелец его туда положил, иначе — встроенная заглушка
     (handleBackgroundPhoto в worker.js) — «сменным через ресурс проекта», без передеплоя кода.
     На узком экране широкая панорама через cover превращается в нечитаемый обрезок (Довуд, 25.10.2026) —
     ниже 760px подменяем на отдельное высокое фото /bg-mobile.jpg (свой кроп того же цеха). */
  .bg-photo { position: fixed; inset: 0; z-index: -2; background-image: url('/bg.jpg'); background-size: cover; background-position: center; opacity: .64; }
  .bg-tint { position: fixed; inset: 0; z-index: -1; background: linear-gradient(120deg, rgba(237,243,250,.6), rgba(234,242,251,.46) 45%, rgba(202,217,240,.38)); pointer-events: none; }
  @media (max-width: 760px) {
    .bg-photo { background-image: url('/bg-mobile.jpg'); }
  }
  h1, h2, h3, p { margin: 0; }
  h1 { font-size: 27px; letter-spacing: -1px; font-weight: 650; margin-bottom: 12px; }
  h2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
  header {
    background: rgba(255,255,255,.73); backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
    color: var(--ink); padding: 16px 20px; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 10; gap: 8px; border-bottom: 1px solid var(--glass-border);
  }
  /* Шапка как в эталоне: слева «хлебные крошки» (Nasem Factory / Раздел), справа — язык и кто вошёл.
     ".who a" нарочно inline: общее "display:flex" у ссылок шапки ставило «Сменить PIN» и «выйти» в столбик. */
  header a { color: var(--ink); text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 9px; letter-spacing: -.2px; }
  header .hdr-left a { font-weight: 500; color: var(--muted); font-size: 13px; letter-spacing: 0; white-space: nowrap; }
  header .crumb-sep { color: var(--muted); font-size: 13px; margin: 0 -2px; }
  header .crumb { color: var(--ink); font-weight: 700; font-size: 13px; }
  header .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
  header .who a { font-weight: 600; color: var(--accent); opacity: 1; display: inline; }
  /* На телефоне правый блок шапки («RU UZ TJ · имя · Сменить PIN · выйти») не помещался и тянул
     ВСЮ страницу вширь: у него white-space:nowrap и он не умел сжиматься. На русском вылезало на
     2 px, на узбекском и таджикском — до 83 px, и вбок ехала каждая страница. Разрешаем переносить
     и сжимать; длинные крошки обрезаем многоточием. (Поймано проверкой на 390 px, 26.10.2026.) */
  @media (max-width: 620px) {
    header { padding: 12px 14px; gap: 6px; flex-wrap: wrap; }
    header .hdr-left { min-width: 0; flex: 1 1 60%; }
    header .crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
    header .who { flex: 1 1 auto; min-width: 0; white-space: normal; flex-wrap: wrap;
      justify-content: flex-end; gap: 8px; row-gap: 2px; font-size: 12px; }
    header .who #whoName { min-width: 0; overflow-wrap: anywhere; text-align: right; }
  }
  /* Видимый фокус клавиатуры. Был только у карточки идеи: по остальным кнопкам и ссылкам можно
     было ходить с клавиатуры вслепую. :focus-visible — не при клике мышью, только при Tab. */
  :where(button, a, select, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
  }
  .langsw { display: flex; }
  main { max-width: 1400px; margin: 0 auto; padding: 18px 24px 40px; animation: fadeSlide .4s ease both; }
  .card {
    background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
    backdrop-filter: blur(18px) saturate(135%); -webkit-backdrop-filter: blur(18px) saturate(135%);
    border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px;
    transition: transform .3s ease, box-shadow .3s ease;
  }
  .card:hover { transform: translateY(-3px); box-shadow: 0 19px 34px rgba(17,37,74,.11), inset 0 1px 0 rgba(255,255,255,.6); }
  .card a { color: inherit; text-decoration: none; display: block; }
  /* Длинная строка без пробелов (например, название компании) иначе растягивает карточку и страницу
     по горизонтали (BUG-03, аудит 27.10.2026) — тот же приём, что уже стоит у header .who #whoName. */
  .card { overflow-wrap: anywhere; }
  .muted { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
  input, select, button, textarea {
    font-size: 16px; padding: 11px 13px; border-radius: var(--radius-md); font-family: inherit;
    border: 1px solid var(--glass-border); width: 100%; margin-bottom: 10px; background: rgba(255,255,255,.85);
  }
  input:focus, select:focus, textarea:focus { outline: 2px solid rgba(49,94,232,.3); border-color: var(--accent); }
  button {
    background: linear-gradient(180deg, #4d7cff, #2755d6); color: #fff; border: 1px solid rgba(255,255,255,.35); font-weight: 700; cursor: pointer;
    border-radius: 12px; box-shadow: 0 6px 15px rgba(49,94,232,.24), inset 0 1px 0 rgba(255,255,255,.4);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  }
  button:hover { transform: translateY(-1px); }
  button:active { transform: translateY(0); }
  button:disabled { opacity: .55; cursor: default; transform: none; }
  button.secondary { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--ink); box-shadow: none; }
  button.secondary.on { background: var(--ink); color: #fff; box-shadow: 0 8px 20px rgba(23,35,56,.22); border-color: transparent; }
  button.add { background: linear-gradient(180deg, #1fc895, #0f9d6e); box-shadow: 0 6px 15px rgba(16,157,110,.26), inset 0 1px 0 rgba(255,255,255,.4); border-color: rgba(255,255,255,.35); }
  .row { display: flex; gap: 8px; }
  .row > * { flex: 1; }
  .err { color: #b91c1c; background: rgba(254,226,226,.7); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 8px 0; white-space: pre-wrap; }
  /* Подсветка конкретного поля рядом с текстом ошибки (BUG-02) — не меняет макет, только обводку. */
  .field-invalid { border-color: #b91c1c !important; }
  /* Пустой блок ошибки — это просто розовая полоса под формой, пока ошибки нет. Прячем, пока в нём
     нет текста: показывается сам, как только туда что-то запишут. */
  .err:empty { display: none; }
  .pill { display: inline-block; background: var(--tint); color: var(--accent); font-size: 12px; padding: 3px 9px; border-radius: 999px; margin-right: 6px; }
  .search { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 14px; }
  .search input { border: 0; outline: 0; background: transparent; width: 100%; margin-bottom: 0; padding: 0; }
  .search::before { content: '🔎'; font-size: 13px; opacity: .6; }
  .card a.list-item { display: flex; align-items: center; gap: 14px; }
  .avatar { width: 42px; height: 42px; background: var(--tint); border-radius: 14px; display: grid; place-items: center; color: var(--accent); font-weight: 800; font-size: 15px; flex-shrink: 0; }
  /* Значок-камера поверх аватара (26.10.2026) — админ меняет чужое фото прямо с карточки, без отдельной страницы. */
  .photo-edit-dot {
    position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent); color: #fff; border: 2px solid #fff; display: grid; place-items: center;
    font-size: 11px; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(17,37,74,.25);
  }
  .list-item small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
  .push { margin-left: auto; flex-shrink: 0; }
  .bigmoney { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin-top: 10px; }
  .bigmoney small { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-top: 2px; }
  .color-block { border: 1px dashed rgba(148,163,184,.6); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: rgba(255,255,255,.4); }
  .sizes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 10px; }
  .sizes-grid div { text-align: center; }
  /* Глассовая рамка inputs (rgba(255,255,255,.65) на светлом фоне) в плотном ряду одинаковых
     клеток читается как один сплошной блок — тут рамка темнее, чтобы ячейки было видно отдельно. */
  .sizes-grid input { margin-bottom: 0; padding: 8px; text-align: center; border-color: rgba(23,35,56,.22); background: rgba(255,255,255,.95); }
  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  td, th { padding: 8px 6px; border-bottom: 1px solid rgba(226,232,245,.9); text-align: left; }
  /* Матрица этапы×размеры в карточке заказа — кросс-таблица, не список, карточки-строки тут только мешали бы. */
  .matrix-table { font-variant-numeric: tabular-nums; }
  .matrix-table th { text-align: center; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; font-weight: 700; border-bottom-width: 2px; }
  .matrix-table th:first-child { text-align: left; }
  .matrix-table td { text-align: center; }
  .matrix-table tr > :first-child { text-align: left; font-weight: 600; }
  .matrix-table tr:nth-of-type(even) td { background: rgba(37,99,235,.04); }
  .matrix-table tr:last-child td { border-bottom: none; }
  .matrix-table td:last-child { color: var(--accent); }
  /* Подсветка строки сотрудника в табеле — при наведении и у последней выбранной (кликнутой) ячейки,
     чтобы не терять строку при горизонтальной прокрутке и прилипшем столбце ФИО. !important — ячейки
     дней уже красят себя инлайн-стилем (цвет отметки), иначе подсветка строки была бы не видна поверх. */
  .attn-table tr:hover td, .attn-table tr.row-sel td { background: rgba(37,99,235,.14) !important; }
  .top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
  /* Пустое состояние — светлая панель с объяснением, а не бледная надпись прямо на фотографии цеха.
     .empty-hint — вторая строка с подсказкой «что делать дальше», .empty-act — кнопка-переход. */
  .empty {
    text-align: center; color: var(--muted); padding: 28px 20px; background: var(--glass-bg);
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg); font-size: 14px;
    backdrop-filter: blur(18px) saturate(135%); -webkit-backdrop-filter: blur(18px) saturate(135%);
  }
  .empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 5px; }
  .empty-hint { font-size: 13px; }
  .empty-act { display: inline-block; margin-top: 12px; }
  /* Сводка списка — строкой внутри панели действий, а не отдельными большими карточками:
     это справочные числа, они не должны спорить по весу с самим списком. */
  .stat-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
  .stat-row b { color: var(--ink); font-size: 17px; font-weight: 700; margin-right: 3px; font-variant-numeric: tabular-nums; }
  /* Строка сотрудника: компактно, одна строка на человека вместо карточки на каждого. */
  .emp-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(226,232,245,.9); }
  .emp-row:last-child { border-bottom: none; }
  .emp-row[role="button"] { cursor: pointer; }
  .emp-row[role="button"]:hover { background: rgba(37,99,235,.04); }
  .emp-row b { font-size: 14px; }
  .emp-row small { display: block; color: var(--muted); font-size: 12.5px; }
  .emp-pay { font-size: 13px; color: var(--muted); white-space: nowrap; }
  /* Список «Сотрудники» — по 2 человека в строке (27.10.2026), порядок не меняется, только раскладка.
     Каждый .card — отдельная ячейка сетки, вложенный .emp-row теряет свой бордер/паддинг — они
     больше не нужны, т.к. у ячейки уже есть своя рамка/фон от .card. */
  .emp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; }
  .emp-grid .card { margin-bottom: 0; }
  .emp-grid .emp-row { padding: 0; border-bottom: none; }
  @media (max-width: 680px) { .emp-grid { grid-template-columns: 1fr; } }
  /* Легенда табеля: что означает каждая отметка и цвет. */
  .tabel-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
  .legend-item { display: flex; align-items: center; gap: 7px; }
  .legend-box { width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(28,43,72,.18); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink); flex-shrink: 0; }
  /* Шапка табеля (27.10.2026): 1-15 число — голубой фон, 16-конец месяца — зелёный, ТОЛЬКО на
     заголовках дат/дней недели (th), не на ячейках явки — см. .attn-table td ниже без этих классов. */
  .tabel-p1 { background: #dbeafe; }
  .tabel-p2 { background: #d1fae5; }
  .tabel-wd { font-size: 9.5px; font-weight: 600; color: var(--muted); line-height: 1.2; }
  .tabel-dn { line-height: 1.2; }
  .tabel-weekend .tabel-wd, .tabel-weekend .tabel-dn { color: #dc2626; font-weight: 700; }
  /* Значок-подсказка «смены за период» в ячейках 15-го и последнего числа — отдельная цель клика
     от самой ячейки (клик по ячейке по-прежнему переключает явку), нужен на телефоне, где нет hover. */
  .shift-ico { position: absolute; top: 0; right: 1px; font-size: 8px; line-height: 1; color: var(--accent); cursor: pointer; opacity: .8; user-select: none; }
  .shift-ico:hover { opacity: 1; }
  .shift-tip { position: fixed; z-index: 70; background: #fff; border: 1px solid rgba(28,43,72,.14); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.18); padding: 10px 12px; font-size: 12px; line-height: 1.5; max-width: 230px; pointer-events: none; }
  .shift-tip b { font-size: 12.5px; }
  @media (max-width: 550px) { .emp-row { flex-direction: column; align-items: flex-start; gap: 4px; } .emp-pay { white-space: normal; } }
  /* Панель действий: поиск и фильтры в одной строке с кнопкой раздела. */
  .act-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .act-bar .search-wrap { flex: 1 1 220px; min-width: 0; position: relative; }
  .act-bar input, .act-bar select { margin-bottom: 0; }
  .check-inline { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
  /* Счета — сетка: последняя карточка не растягивается на всю ширину ряда, как было у flex-строки. */
  .acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
  .acc-card { background: var(--soft); border-radius: var(--radius-md); padding: 13px 15px; }
  .acc-card b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; line-height: 1.2; }
  .acc-card small { color: var(--muted); font-size: 11.5px; }
  /* Карточка счёта кликабельна (правка начального остатка/даты, 26.10.2026) — сбрасываем вид кнопки
     по умолчанию (градиент/тень/белый текст из общего правила для button), оставляем вид обычной карточки. */
  button.acc-card { font-family: inherit; color: var(--ink); border: none; box-shadow: none; font-weight: 400; cursor: pointer; margin-bottom: 0; }
  button.acc-card:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(51,73,111,.1); }
  /* Пустое состояние внутри сетки занимает всю строку, а не одну узкую колонку. */
  .acc-grid .empty { grid-column: 1 / -1; }
  /* Приход ткани — партиями (дата+поставщик+место, без номера, см. схему): карточка сворачивается
     кликом по шапке, как и остальные списки в системе (Kids/разделы). */
  .wh-batch { margin-bottom: 12px; overflow: hidden; border-radius: var(--radius-md); }
  .wh-batch-head { background: var(--soft); padding: 13px 15px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .wh-batch-head b { font-size: 14.5px; }
  .wh-batch-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
  .wh-batch-chev { flex-shrink: 0; color: var(--muted); transition: transform .2s; }
  .wh-batch.open .wh-batch-chev { transform: rotate(180deg); }
  .wh-batch-rows { display: none; border: 1px solid var(--glass-border); border-top: none; border-radius: 0 0 var(--radius-md) var(--radius-md); }
  .wh-batch.open .wh-batch-rows { display: block; }
  .wh-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--glass-border); }
  .wh-row:last-child { border-bottom: none; }
  .wh-row-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
  .wh-row-right { text-align: right; flex-shrink: 0; }
  .wh-batch-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 15px; border: 1px solid var(--glass-border); border-top: none; }
  .wh-batch-actions button { width: auto; margin-bottom: 0; }
  @media (max-width: 480px) { .wh-batch-actions { flex-direction: column; } .wh-batch-actions button { width: 100%; } }
  /* Печать бейджа 43×25мм (26.10.2026) — на экране всегда скрыто; при печати, наоборот, скрывается
     всё ОСТАЛЬНОЕ (фон, шапка, модалки) и показывается только эта область, одна наклейка = одна
     страница. .print-root — общий приём, не только для бейджей, если печать понадобится ещё где-то. */
  .print-root { display: none; }
  @media print {
    body > *:not(.print-root) { display: none !important; }
    .print-root { display: block !important; }
    @page { size: 43mm 25mm; margin: 0; }
    html, body { margin: 0; padding: 0; background: #fff !important; }
  }
  .badge-page { break-after: page; }
  .badge-page:last-child { break-after: auto; }
  .badge-43x25 {
    width: 43mm; height: 25mm; box-sizing: border-box; padding: 1.3mm 1.5mm;
    display: flex; align-items: center; gap: 1.5mm; background: #fff; color: #000;
    font-family: Arial, Helvetica, sans-serif; overflow: hidden;
  }
  .badge-qr { width: 21mm; height: 21mm; flex-shrink: 0; background: #fff; }
  .badge-qr img, .badge-qr canvas, .badge-qr table { width: 100% !important; height: 100% !important; }
  .badge-info { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.6mm; line-height: 1.1; }
  .badge-brand { font-size: 5.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #000; }
  .badge-name { font-size: 7.5px; font-weight: 700; word-break: break-word; color: #000; }
  .badge-no { font-size: 7px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .2px; color: #000; }
  /* Накладная ткани (27.10.2026) — тот же .print-root, но страница А4, не бейдж 43×25мм: именованная
     CSS-страница (page: a4doc) переопределяет размер только для элементов с классом .a4doc. */
  @page a4doc { size: A4; margin: 14mm; }
  .print-root.a4doc { page: a4doc; }
  /* Табель/шаблон — широкая таблица (ФИО + до 31 дня + «Явок»), нужна альбомная страница, не книжная
     (28.10.2026). Именованная страница (page: ...) ненадёжно переключает ориентацию в реальной
     печати — вместо неё #printOrientationStyle (пустой тег <style>, см. разметку ниже) перед каждой
     печатью переписывается нужным @page целиком: альбомным для табеля/шаблона, пустым (к портретному
     a4doc по умолчанию) для всего остального — так орientation не остаётся «залипшей» от прошлой печати.
     thead повторяется на каждой печатной странице — табель редко влезает в одну. */
  .a4doc-page table thead { display: table-header-group; }
  .a4doc-page table.tabel-print { font-size: 10px; }
  .a4doc-page table.tabel-print th, .a4doc-page table.tabel-print td { padding: 2px 3px; text-align: center; }
  .a4doc-page table.tabel-print td:first-child, .a4doc-page table.tabel-print th:first-child { text-align: left; white-space: nowrap; }
  .a4doc-page table.tabel-print .tabel-print-blank { width: 16px; height: 14px; }
  .a4doc-page { break-after: page; font-family: Arial, Helvetica, sans-serif; color: #000; background: #fff; }
  .a4doc-page:last-child { break-after: auto; }
  .a4doc-page h2 { font-size: 17px; margin: 0 0 2px; }
  .a4doc-page .a4doc-sub { font-size: 13px; margin-bottom: 14px; }
  .a4doc-page table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
  .a4doc-page th, .a4doc-page td { border: 1px solid #333; padding: 4px 7px; text-align: left; }
  .a4doc-page tfoot td { font-weight: 700; }
  .a4doc-sign { display: flex; justify-content: space-between; margin-top: 40px; font-size: 13px; }
  .a4doc-sign span { display: inline-block; min-width: 220px; border-top: 1px solid #333; padding-top: 4px; }
  /* Предпросмотр бейджа на экране (не печать) — та же разметка, но с рамкой/тенью, чтобы было видно
     границы наклейки до печати. */
  .badge-preview-frame { display: inline-block; border: 1px solid rgba(28,43,72,.18); box-shadow: 0 2px 8px rgba(28,43,72,.1); }
  .badge-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--glass-border); }
  .badge-pick-row:last-child { border-bottom: none; }
  /* Управление доступом — редкое действие: свёрнуто, чтобы не спорить с заказами и долгом. */
  .access-box summary { cursor: pointer; list-style: none; }
  .access-box summary::-webkit-details-marker { display: none; }
  .access-box summary::before { content: '▸'; color: var(--muted); margin-right: 8px; display: inline-block; transition: transform .15s ease; }
  .access-box[open] summary::before { transform: rotate(90deg); }

  /* «Идеи»: карточка списка, описание идеи и лента обсуждения. Служебные значки — те же SVG,
     что в меню (💡/❓), а не эмодзи: эмодзи на Windows и на телефоне выглядят по-разному и
     ломают строку по высоте. */
  .idea-card { cursor: pointer; }
  .idea-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .idea-meta { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .idea-type { display: inline-flex; color: var(--accent); }
  .idea-type svg { width: 15px; height: 15px; }
  h2 .idea-type { margin-right: 7px; vertical-align: -2px; }
  .idea-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; margin-bottom: 14px; }
  .idea-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
  .idea-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 9px; display: block; }
  .idea-thread { max-height: 280px; overflow-y: auto; margin-bottom: 16px; }
  .idea-msg { padding: 10px 0; border-bottom: 1px solid rgba(49,94,232,.12); }
  .idea-msg:last-child { border-bottom: none; }
  .idea-msg-img { width: 90px; height: 90px; object-fit: cover; border-radius: 9px; margin-top: 6px; display: block; }

  /* Фон фабрики: предпросмотр того, что стоит сейчас, отдельно для компьютера и телефона. */
  .bg-variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
  .bg-preview { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: var(--radius-md); background: var(--soft); margin-bottom: 8px; }
  .bg-preview.tall { height: 190px; object-position: center; }
  .bg-req { font-size: 12px; margin-bottom: 10px; }
  .check-inline input { width: auto; margin: 0; }
  /* Вкладки: единое активное состояние с синим акцентом во всём приложении. */
  .tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
  .tabs .tab {
    width: auto; margin: 0; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
    background: var(--soft); color: var(--muted); box-shadow: none; border-radius: 999px;
  }
  .tabs .tab:hover { background: var(--tint); color: var(--ink); }
  .tabs .tab.on { background: var(--accent); color: #fff; }
  .tabs a.tab { text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
  .tabs a.tab svg { width: 15px; height: 15px; }
  .tabs a.tab.on, .tabs a.tab.on:visited { color: #fff; }
  /* Заглушка карточки заказа без фото — контурная иконка из общего набора вместо эмодзи. */
  .order-art-ico { color: var(--accent); opacity: .5; }
  .order-art-ico svg { width: 34px; height: 34px; }
  /* Подпись только для программ чтения с экрана — поле и так понятно по тексту-примеру. */
  .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; }
  /* Поле формы: подпись сверху, всегда видна. */
  .field { margin-bottom: 12px; }
  .field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
  .field > label .req { color: var(--red); font-weight: 700; }
  .form-legend { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
  .form-legend .req { color: var(--red); font-weight: 700; }
  .field input, .field select, .field textarea { margin-bottom: 0; }
  .form-actions { display: flex; gap: 10px; margin-top: 16px; }
  .form-actions button { margin-bottom: 0; width: auto; min-width: 150px; }
  /* Блок цвета в новом заказе: название и удаление в одной строке, удаление — компактная
     иконка-кнопка, а не широкая полоса во всю карточку. */
  .color-head { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
  .color-sub { font-size: 12px; margin: 12px 0 6px; }
  .color-total-row { margin-top: 10px; font-size: 13px; color: var(--muted); }
  .color-total-row b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
  /* Группа полей в длинной форме: «ткань → сколько → деньги → прочее» вместо сплошной колонки. */
  .form-group { padding-top: 14px; margin-top: 14px; border-top: 1px solid rgba(226,232,245,.9); }
  .form-group:first-of-type { padding-top: 0; margin-top: 0; border-top: none; }
  .group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
  .group-hint { font-size: 12px; margin-bottom: 10px; }
  .group-total { font-size: 13px; color: var(--accent); font-weight: 600; min-height: 18px; }
  .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
  @media (max-width: 550px) { .form-actions { flex-direction: column-reverse; } .form-actions button { width: 100%; } }
  /* Модальное окно: ширина по содержанию, на телефоне помещается в экран и прокручивается внутри. */
  /* Центрируем через inset+margin:auto, а НЕ через transform: у .card есть анимация появления,
     её последний кадр (transform: translateY(0) scale(1)) затирал бы любой transform, и окно
     уезжало из центра вниз-вправо. */
  .card.modal {
    display: none; position: fixed; inset: 0; margin: auto; height: fit-content;
    z-index: 31; width: 380px; max-width: calc(100vw - 28px); max-height: calc(100vh - 40px);
    overflow-y: auto; background: rgba(255,255,255,.97);
  }
  .card.modal.open { display: block; }
  .card.modal.wide { width: 620px; }
  .card.modal:hover { transform: none; box-shadow: var(--glass-shadow); }
  .modal-actions { display: flex; gap: 10px; margin-top: 16px; }
  .modal-actions button { margin-bottom: 0; }
  .icon-btn { padding: 6px 10px; line-height: 1; }
  /* Кнопка со значком + подписью: SVG не должен тянуть строку вверх и быть разного размера. */
  button svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }
  .icon-btn svg { margin-right: 0; width: 16px; height: 16px; }
  /* Действия в строке таблицы: раньше это были эмодзи-ссылки ✏️ и ✕ — разного размера на разных
     системах и без названия для экранного диктора. Теперь единые SVG с подписями. */
  .row-act {
    width: auto; padding: 5px; margin: 0 2px 0 0; background: transparent; box-shadow: none;
    color: var(--muted); line-height: 0; border-radius: 8px;
  }
  .row-act svg { width: 16px; height: 16px; margin: 0; }
  .row-act:hover { background: var(--soft); color: var(--accent); transform: none; }
  .row-act-del:hover { color: var(--red); background: rgba(189,77,68,.1); }
  @media (max-width: 550px) {
    .card.modal { width: auto; inset: 10px; max-height: calc(100vh - 20px); }
    .modal-actions { flex-direction: column-reverse; }
  }
  /* Широкая таблица прокручивается ВНУТРИ своей карточки — страница целиком вбок не едет. */
  @media (max-width: 760px) {
    .card:has(table) { overflow-x: auto; }
  }
  /* Посещённые ссылки не должны становиться фиолетовыми: цвет задаём явно везде, где ссылка — это
     навигация или элемент списка, а не текстовая ссылка в абзаце. */
  a:visited, .card a:visited, .nav-item:visited, .list-item:visited { color: inherit; }
  .nav-item:visited { color: var(--muted); }
  .nav-item.on:visited { color: var(--accent); }
  /* Удаляющее действие визуально отличается от основного и вторичного. */
  button.danger, a.danger { background: rgba(189,77,68,.1); color: var(--red); box-shadow: none; border: 1px solid rgba(189,77,68,.25); }
  button.danger:hover, a.danger:hover { background: rgba(189,77,68,.16); }
  /* Локализованная загрузка файла вместо браузерного «Choose File» (см. upgradeFileInputs в app.js). */
  .file-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
  .file-field input[type="file"] { display: none; }
  .file-btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: var(--radius-md);
    background: var(--soft); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .file-btn:hover { background: var(--tint); }
  .file-name { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .langsw-standalone { display: flex; justify-content: center; margin-bottom: 16px; }
  .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-bottom: 12px; }
  .kpi { padding: 18px; display: grid; gap: 6px; position: relative; }
  .kpi small { color: var(--muted); font-size: 12px; }
  .kpi strong { font-size: 29px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
  /* Компактный вариант .kpis — финансовый блок внизу Главной: меньше карточка, меньше цифра, чем
     обычные KPI (Довуд: «компактные финансовые блоки»). */
  .kpis.compact { grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
  .kpis.compact .kpi { padding: 13px 15px; }
  .kpis.compact .kpi strong { font-size: 21px; }
  /* Главная: верхний ряд — ровно три карточки (активные заказы / изделия в работе / сотрудники), как
     в эталоне Nasem-Apple-Glass-Reference.html. auto-fit вместо жёсткого repeat(3,…) — на трёх карточках
     ровно в три колонки на широком экране, само собирается в 2 и 1 на более узких без лишнего брейкпоинта. */
  /* Шапка Главной как в эталоне: мелкая строка даты капсом, крупный лёгкий заголовок, подзаголовок,
     кнопка действия справа. */
  .hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
  .hero-head button { width: auto; margin: 0; white-space: nowrap; }
  .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--muted); margin-bottom: 7px; }
  h1.hero-title { font-size: 33px; font-weight: 600; letter-spacing: -1.1px; margin-bottom: 6px; }
  .hero-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; margin-bottom: 14px; }
  .hero-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 7px; padding: 20px; position: relative; }
  .hero-card small { color: var(--muted); font-size: 12px; }
  .hero-card strong { font-size: 31px; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1; font-weight: 600; }
  /* Иконка в правом верхнем углу KPI-карточки — как в эталоне. */
  .hero-ico { position: absolute; top: 18px; right: 18px; color: var(--accent); opacity: .85; }
  .hero-ico svg { width: 18px; height: 18px; }
  /* Заголовок секции ВНУТРИ карточки (в эталоне он не висит над ней, а лежит первой строкой). */
  .card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
  .card-head h2 { margin-bottom: 0; }
  .card-note { margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(226,232,245,.9); color: var(--muted); font-size: 12px; }
  .card-note > div + div { margin-top: 7px; }
  /* «Вчера» — отдельной строкой; flex-wrap переносит целыми парами «этап N», а не рвёт их пополам. */
  .note-yest { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .note-yest b { color: var(--ink); font-weight: 600; }
  /* Финансовый блок: показатели лежат ВНУТРИ общей стеклянной панели, поэтому у плиток своя,
     более простая поверхность — иначе получилась бы карточка в карточке. */
  .kpis.inner { margin-bottom: 0; }
  .kpis.inner .kpi, .card a.kpi { display: grid; background: var(--soft); border-radius: var(--radius-md); box-shadow: none; border: none; text-decoration: none; color: inherit; }
  .shops-list { margin-top: 12px; font-size: 13px; }
  .shops-list > div { display: flex; justify-content: space-between; padding: 3px 0; gap: 12px; }
  /* Заголовок списка магазинов: без него цифра в скобках читалась как непонятный второй итог. */
  .shops-list > div.shops-head { color: var(--muted); font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; padding-bottom: 6px; border-bottom: 1px solid rgba(49,94,232,.12); margin-bottom: 4px; }
  /* Заголовок секции, стоящий прямо перед карточкой, визуально становится её первой строкой —
     как в эталоне, где заголовок лежит ВНУТРИ карточки. Сделано на :has() вместо правки разметки
     трёх десятков страниц; браузер без :has() просто покажет прежний вид, ничего не ломается.
     Условие ":has(h2)" — чтобы не приклеивать к карточке заголовок СТРАНИЦЫ (h1) из .top-actions. */
  h2:has(+ .card), .top-actions:has(h2):has(+ .card) {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 16px 16px 0; margin-bottom: 0;
    backdrop-filter: blur(18px) saturate(135%); -webkit-backdrop-filter: blur(18px) saturate(135%);
    animation: cardIn .5s cubic-bezier(.22,1,.36,1) both;
  }
  h2:has(+ .card) + .card, .top-actions:has(h2):has(+ .card) + .card {
    border-top: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding-top: 13px; animation-delay: inherit;
  }
  /* Приподнимать на hover только «приклеенную» половину нельзя — шов разъезжается. */
  h2:has(+ .card) + .card:hover, .top-actions:has(h2):has(+ .card) + .card:hover { transform: none; box-shadow: var(--glass-shadow); }
  .hero-card .hero-of { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
  .hero-sub { font-size: 12.5px; color: var(--muted); }
  /* «Путь производства» и «Требует внимания» рядом только с 1150px: на 900px боковая панель уже
     занимает 236px, на две колонки остаётся примерно по 310px, и заголовки с текстом событий
     рвутся на три строки. До 1150px блоки идут друг под другом. */
  .two-col { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
  @media (min-width: 1150px) {
    .two-col { grid-template-columns: 1.4fr 1fr; }
  }
  /* «Требует внимания» — список событий (иконка / заголовок / подпись), как в эталоне. */
  /* ".card a.…" — нарочно: общее ".card a { display:block }" выше по специфичности и иначе ломает grid/flex.
     (Бэктиков в комментариях этого CSS быть не может — он лежит в JS-шаблонной строке.) */
  .ev, .card a.ev { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid rgba(226,232,245,.9); text-decoration: none; color: inherit; }
  .ev:first-child { padding-top: 2px; } .ev:last-child { border-bottom: none; padding-bottom: 2px; }
  /* Иконка события — просто контур, без цветной плашки (как в эталоне); цветом отличается только смысл. */
  .ev-ico { display: grid; place-items: center; flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; color: var(--muted); }
  .ev-ico svg { width: 17px; height: 17px; }
  .ev-ico.late { color: var(--red); }
  .ev-ico.idle { color: var(--amber); }
  .ev-ico.money { color: var(--accent); }
  .ev b { display: block; font-size: 13.5px; line-height: 1.3; }
  .ev small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
  .pill.amber { background: rgba(146,98,27,.12); color: var(--amber); }
  /* Статус в таблице отгрузок окрашен по этапу — чем ближе к отгрузке, тем «зеленее» (как в эталоне). */
  .pill.st-ship, .pill.st-pack { background: rgba(21,133,101,.12); color: var(--green); }
  .pill.st-none { background: var(--soft); color: var(--muted); }
  /* Длинное пояснение под показателями. Как .card-note оно читалось плохо: мелкий серый текст
     прямо на фоновом фото цеха. Кладём на светлую поверхность и поднимаем размер до читаемого
     (замечание проверки 26.10.2026). Стиль тот же стеклянный, просто плотнее и крупнее. */
  .note-panel {
    background: rgba(255,255,255,.9); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
    padding: 14px 16px; margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--ink);
    box-shadow: var(--glass-shadow);
  }
  .note-panel b { font-weight: 650; }
  /* Оговорка, которую нельзя пропустить: отдельный блок с цветной полосой слева. */
  .note-warn {
    background: rgba(255,255,255,.93); border: 1px solid rgba(146,98,27,.3); border-left: 4px solid var(--amber);
    border-radius: var(--radius-md); padding: 14px 16px; margin: 0 0 14px; font-size: 14px; line-height: 1.55;
    color: var(--ink); box-shadow: var(--glass-shadow);
  }
  .note-warn .note-warn-ttl { display: block; font-weight: 700; color: var(--amber); margin-bottom: 4px; }
  /* Справка: лента «Что нового» по дням, как в утверждённом образце. День — заголовок карточки,
     клик по нему сворачивает; свежие записи помечены плашкой «новое». */
  .help-entry { padding: 10px 0; border-bottom: 1px solid rgba(49,94,232,.1); font-size: 14px; line-height: 1.5; }
  .help-entry:last-child { border-bottom: none; }
  .pill.help-new { background: rgba(146,98,27,.16); color: var(--amber); font-weight: 700; }
  /* Подпись под поиском: сколько записей видно из всего и в каких единицах цифры. */
  .list-note { margin-top: 10px; font-size: 12.5px; }
  .lnk { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 13px; white-space: nowrap; }
  /* «Предстоящие отгрузки» — таблица: модель/клиент · статус · готовность · дата. На телефоне модель
     занимает всю строку, остальные три — ряд под ней. */
  .ship-row, .card a.ship-row { display: grid; grid-template-columns: 1.7fr .9fr .9fr .8fr; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(226,232,245,.9); text-decoration: none; color: inherit; }
  .ship-row:last-child { border-bottom: none; padding-bottom: 2px; }
  .ship-head { padding: 2px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 700; }
  .ship-model { display: flex; gap: 10px; align-items: center; min-width: 0; }
  .ship-ico { width: 28px; height: 28px; border-radius: 8px; background: rgba(37,99,235,.1); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
  .ship-ico svg { width: 14px; height: 14px; }
  /* Модель и детали — одной строкой, как в эталоне («Костюм · партия #1024 · 1000 шт.»). */
  .ship-model b { font-size: 14px; }
  .ship-model small { color: var(--muted); font-size: 12.5px; }
  .ship-model > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ship-ready { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .mini-track { display: block; width: 72px; max-width: 100%; height: 4px; border-radius: 50px; background: rgba(232,237,245,.9); overflow: hidden; margin-top: 4px; }
  .mini-track > div { height: 100%; border-radius: 50px; background: var(--accent); }
  .ship-date { font-size: 13px; white-space: nowrap; }
  @media (max-width: 550px) {
    .ship-row, .card a.ship-row { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .ship-model { grid-column: 1 / -1; }
    .ship-head { display: none; }
    .ship-date { text-align: right; }
  }
  .order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px,1fr)); gap: 14px; }
  .order-card { padding: 0; overflow: hidden; }
  .order-art { height: 120px; background: linear-gradient(135deg, #d6e2f2, #a6b9d4); display: flex; align-items: center; justify-content: center; font-size: 34px; }
  .order-art img { width: 100%; height: 100%; object-fit: cover; }
  .order-body { padding: 14px 16px 16px; }
  .order-body .progress-row { margin-top: 10px; }
  .progress-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 13px; }
  .progress-row > span { width: 90px; flex-shrink: 0; }
  .progress-row > b { width: 60px; text-align: right; flex-shrink: 0; }
  .track { height: 8px; border-radius: 50px; background: rgba(232,237,245,.9); overflow: hidden; flex: 1; }
  .track > div { height: 100%; border-radius: 50px; background: var(--accent); transition: width .6s ease; }
  /* Лента этапов производства (карточка заказа, Довуд, 25.10.2026: «Ткань получена → Крой → Пошив →
     Нанесение → Упаковка → Отгрузка»). Только просмотр — клик разворачивает уже посчитанные на сервере
     данные (progress/events), никакой новой «передачи между участками» здесь не пишется. */
  .stage-ribbon { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-start; padding: 4px 0 2px; }
  .stage-node {
    flex: 1 1 86px; min-width: 78px; max-width: 120px; display: flex; flex-direction: column; align-items: center;
    gap: 6px; background: transparent; border: none; box-shadow: none; padding: 8px 4px; border-radius: var(--radius-md);
    cursor: pointer; transition: background .15s ease, transform .15s ease; position: relative; color: var(--ink);
  }
  .stage-node:hover { background: rgba(37,99,235,.06); transform: translateY(-1px); box-shadow: none; }
  .stage-node.on { background: rgba(37,99,235,.1); }
  /* Узел ленты как в эталоне: белый квадратик с мягкой тенью (не синяя плашка), иконка приглушена —
     главное в узле цифра. Активный/пройденный этап в карточке заказа остаётся синим. */
  .stage-node .sn-ico {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 17px;
    background: #fff; color: var(--muted); flex-shrink: 0; border: 1px solid var(--glass-border);
    box-shadow: 0 4px 10px rgba(17,37,74,.07); transition: background .15s ease, color .15s ease;
  }
  .stage-node .sn-ico svg { width: 19px; height: 19px; flex-shrink: 0; }
  .stage-node.on .sn-ico, .stage-node.done .sn-ico { background: var(--accent); color: #fff; }
  .stage-node .sn-count { font-size: 21px; font-weight: 700; letter-spacing: -.5px; line-height: 1; color: var(--ink); }
  .stage-node .sn-label { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.25; }
  .stage-node .sn-track { width: 100%; height: 4px; border-radius: 50px; background: rgba(232,237,245,.9); overflow: hidden; margin-top: 2px; }
  .stage-node .sn-track > div { height: 100%; border-radius: 50px; background: var(--accent); transition: width .5s ease; }
  /* Соединяющая линия между узлами — только на widescreen, на мобильном лента оборачивается в несколько
     строк (flex-wrap), и линия между рядами выглядела бы сломанной, поэтому прячем. */
  @media (min-width: 560px) {
    .stage-node:not(:last-child)::after {
      content: ''; position: absolute; top: 27px; left: 100%; width: 100%; height: 2px;
      background: rgba(148,163,184,.35); z-index: -1;
    }
  }
  .stage-detail { margin-top: 10px; animation: fadeSlide .25s ease both; }
  .stage-detail .muted { font-size: 12px; }
  /* Та же лента на Главной («Путь производства») — просто сводка, не ведёт в карточку заказа,
     поэтому без курсора-руки и hover-подсветки отдельного узла. */
  .stage-ribbon.static .stage-node { cursor: default; }
  .stage-ribbon.static .stage-node:hover { background: transparent; transform: none; }
  .hdr-left { display: flex; align-items: center; gap: 10px; }
  .menu-btn { width: auto; padding: 6px 11px; margin: 0; background: var(--soft); color: var(--ink); box-shadow: none; font-size: 17px; line-height: 1; border-radius: 10px; border: none; }
  .nav-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 19; }
  .nav-overlay.open { display: block; }
  .nav-menu {
    position: fixed; top: 0; left: -300px; bottom: 0; width: 236px; z-index: 20; padding: 18px 12px 14px; overflow-y: auto;
    background: rgba(255,255,255,.73); border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(24px) saturate(145%); -webkit-backdrop-filter: blur(24px) saturate(145%); transition: left .25s ease;
  }
  .nav-menu.open { left: 0; }
  /* Бренд-плашка сверху сайдбара — логотип-бейдж с градиентом + «nasem. / FACTORY OS», как в эталоне.
     На мобильном (сайдбар — выезжающий drawer) тоже видна, заголовок страницы в <header> её не дублирует. */
  .nf-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--glass-border); }
  .nf-brand .nf-logo {
    width: 32px; height: 32px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
    background: linear-gradient(145deg, #6d94ff, #2955d5); color: #fff; font-weight: 800; font-size: 16px;
    box-shadow: 0 6px 15px rgba(49,94,232,.26), inset 0 1px 1px rgba(255,255,255,.7);
  }
  .nf-brand .nf-word { font-size: 17px; font-weight: 700; letter-spacing: -.5px; color: var(--ink); line-height: 1.15; }
  .nf-brand .nf-word span { color: var(--muted); font-weight: 600; }
  .nf-brand small { display: block; font-size: 9px; font-weight: 700; letter-spacing: .14em; color: var(--muted); margin-top: 1px; }
  .nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; margin-bottom: 3px; transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease; }
  .nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
  button.secondary svg, a.secondary svg { width: 15px; height: 15px; flex-shrink: 0; vertical-align: -3px; }
  .nav-item:hover { background: var(--soft); color: var(--ink); transform: translateX(2px); }
  .nav-item.on { background: #fff; color: var(--accent); box-shadow: 0 4px 14px rgba(23,42,76,.08), inset 0 1px 0 rgba(255,255,255,.7); transform: none; }
  /* Группы в меню (Довуд, 24.10.2026: «слишком много листов, надо сгруппировать») — просто подписи
     между пунктами, без сворачивания: список и так укладывается в один экран телефона с подписями. */
  .nav-group-label { padding: 14px 14px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
  .nav-group-label:first-child { padding-top: 2px; }
  .nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 5px; }
  @keyframes fadeSlide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
  /* Карточки появляются по очереди, не все разом — так же, как в макете ChatGPT. */
  .card { animation: cardIn .5s cubic-bezier(.22,1,.36,1) both; }
  .card:nth-of-type(1) { animation-delay: .02s; } .card:nth-of-type(2) { animation-delay: .06s; }
  .card:nth-of-type(3) { animation-delay: .1s; } .card:nth-of-type(4) { animation-delay: .14s; }
  .card:nth-of-type(5) { animation-delay: .18s; } .card:nth-of-type(6) { animation-delay: .22s; }
  .card:nth-of-type(7) { animation-delay: .26s; } .card:nth-of-type(8) { animation-delay: .3s; }
  .card:nth-of-type(n+9) { animation-delay: .32s; }
  @keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
  button:active { transform: scale(.96); }
  input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease; }
  .nav-menu { transition: left .3s cubic-bezier(.32,.72,0,1); }
  .kpi strong, .bigmoney { transition: color .2s ease; }
  .toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(10px); z-index: 50;
    background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius-md); font-size: 14px;
    box-shadow: 0 14px 36px rgba(28,43,72,.28); opacity: 0; transition: opacity .25s ease, transform .25s ease;
    max-width: 90vw; text-align: center;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  .toast.toast-err { background: #b91c1c; }
  /* Постоянная боковая панель слева на широком экране (Довуд, 24.10.2026: «как в той вебке все листы
     были слева по порядку») — тот же приём, что .sidebar в старой вебке: на ширине ≥900px список
     разделов всегда на виду (не прячется за гамбургером), header/main сдвигаются вправо через
     padding-left на body. На телефоне (<900px) остаётся прежнее поведение — скрытый drawer по клику. */
  @media (min-width: 900px) {
    /* «Окно»: поля по краям + скругление. Фон-фото и сайдбар поджимаются внутрь рамки, шапка
       прилипает не к нулю, а к её верхнему краю. */
    body { padding: var(--frame) var(--frame) 44px calc(236px + var(--frame)); }
    .bg-photo, .bg-tint { inset: var(--frame); border-radius: var(--radius-xl); }
    .nav-menu {
      left: var(--frame) !important; top: var(--frame); bottom: var(--frame);
      padding-top: 24px; box-shadow: none; border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    }
    header { top: var(--frame); border-radius: 0 var(--radius-xl) 0 0; }
    /* Полосы сверху и снизу: при прокрутке содержимое уходит под край «окна», а не поверх поля. */
    body::before, body::after {
      content: ''; position: fixed; left: 0; right: 0; height: var(--frame);
      background: var(--page-bg); z-index: 15; pointer-events: none;
    }
    body::before { top: 0; }
    body::after { bottom: 0; }
    /* Гасим ТОЛЬКО подложку бокового меню (на широком экране оно всегда раскрыто). Раньше правило
       било по всем .nav-overlay разом, и модальные окна на компьютере оставались без затемнения —
       окно «висело» на странице без отделения от неё. */
    #navOverlay { display: none !important; }
    /* Только кнопку ☰ — она открывает то же боковое меню, которое на широком экране и так раскрыто
       всегда. #backBtn раньше гасился тем же правилом (общий класс .menu-btn) — на десктопе некуда
       было нажать «назад» (Довуд, 27.10.2026, скриншот карточки клиента без кнопки назад). */
    #menuBtn { display: none; }
  }
  @media (max-width: 550px) {
    header { padding: 11px 14px; } main { padding: 14px 12px 32px; } .kpi strong { font-size: 20px; }
    .hero-card strong { font-size: 26px; }
    /* На телефоне в шапке не хватает ширины на всё. Прячем бренд и имя, оставляем название раздела
       (полезнее бренда — видно, где находишься), язык, PIN и выход; правый блок сжимаем. */
    header .hdr-left a, header .crumb-sep, header .who .who-name { display: none; }
    header { gap: 6px; }
    header .who { font-size: 12px; gap: 6px; }
    .hero-head { flex-direction: column; align-items: stretch; gap: 12px; }
    .hero-head button { align-self: flex-start; }
    h1.hero-title { font-size: 27px; }
    /* Тяжёлый блюр на телефоне — заметная нагрузка на слабый GPU (Довуд, эталон: «избегать тяжёлого
       блюра на мобильном»). Меньший радиус держит узнаваемое стекло, но дешевле отрисовывается. */
    header, .card, .nav-menu { backdrop-filter: blur(10px) saturate(130%); -webkit-backdrop-filter: blur(10px) saturate(130%); }
  }
  /* Графики Uzum (Заказы/Продажи/Возвраты) — общий .uz-chart из renderUzChart_(). */
  .chart-wrap { position: relative; }
  .uz-chart { width: 100%; height: auto; display: block; overflow: visible; }
  .uz-chart .chart-grid { stroke: rgba(23,35,56,.08); stroke-width: 1; }
  .uz-chart .chart-axis { font-size: 11px; fill: var(--muted); font-family: inherit; }
  .uz-chart polyline { transition: opacity .3s ease; }
  .uz-chart .chart-dot { fill: transparent; cursor: pointer; }
  .uz-chart .chart-dot:hover, .uz-chart .chart-dot:focus-visible { fill: rgba(49,94,232,.12); outline: none; }
  .chart-card { animation: fadeIn .35s ease both; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  .chart-tip {
    position: absolute; z-index: 5; background: var(--ink); color: #fff; padding: 7px 10px; border-radius: 10px;
    font-size: 12px; line-height: 1.35; white-space: nowrap; pointer-events: none; box-shadow: 0 8px 20px rgba(23,35,56,.25);
  }
  .chart-tip .muted { color: rgba(255,255,255,.72); font-size: 11px; }
  .chart-empty { padding: 32px 8px; text-align: center; color: var(--muted); font-size: 13px; }
  .chart-toggle { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }
  .chart-toggle button { width: auto; padding: 5px 11px; font-size: 12px; margin: 0; }
  @media (max-width: 480px) { .chart-tip { font-size: 11px; max-width: calc(100vw - 48px); white-space: normal; } }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
  }
  /* ===== Язык: одна кнопка текущего языка + выпадающий список (эталон login-glass-v1) =====
     Раньше все три языка висели в строку (RU UZ TJ) на каждом экране. Теперь видна только
     текущая раскладка — флаг и код, а в шапке компьютера при достаточной ширине полное название.
     Компонент один на всё приложение (langSwitcherHtml в app.js): вход, ТВ-экран, отметка явки,
     мини-приложение «Оплата» и шапка берут его же, чтобы не расходились. */
  .lang-flag {
    display: inline-block; width: 20px; height: 14px; border-radius: 3px; flex-shrink: 0;
    background-size: cover; background-position: center; box-shadow: 0 0 0 1px rgba(24,37,56,.07);
  }
  /* Флаги — SVG из flag-icons (MIT), встроены как в эталоне: не зависят от того, умеет ли
     система рисовать эмодзи-флаги (в Windows они показываются буквами «RU», а не флагом). */
  .lang-flag[data-flag="ru"] { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGlkPSJmbGFnLWljb25zLXJ1IiB2aWV3Qm94PSIwIDAgNjQwIDQ4MCI+CiAgPHBhdGggZmlsbD0iI2ZmZiIgZD0iTTAgMG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9IjEwMCUiIGhlaWdodD0iMTAwJSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcwIC0xMjEuMikiLz4KICAgIDx1c2UgeGxpbms6aHJlZj0iI3RqLWMiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMjEuMiAtNzApIi8+CiAgICA8dXNlIHhsaW5rOmhyZWY9IiN0ai1jIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQwKSIvPgogIDwvZz4KICA8dXNlIHhsaW5rOmhyZWY9IiN0ai1kIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjhjMzAwIiB0cmFuc2Zvcm09Im1hdHJpeCgtMSAwIDAgMSA2NDAgMCkiLz4KPC9zdmc+Cg=="); }
  .lang-pick { position: relative; z-index: 5; }
  .lang-pick .lang-btn {
    display: flex; align-items: center; gap: 7px; width: auto; margin: 0; min-height: 36px;
    padding: 7px 9px; border: 1px solid #dde5f0; border-radius: 11px; background: rgba(255,255,255,.85);
    color: var(--ink); font-size: 11px; font-weight: 600; box-shadow: none;
  }
  .lang-pick .lang-btn:hover { transform: none; }
  .lang-pick .lang-chev { width: 12px; height: 12px; color: #7b889b; flex-shrink: 0; transition: transform .2s ease; }
  .lang-pick .lang-btn[aria-expanded="true"] .lang-chev { transform: rotate(180deg); }
  .lang-pick .lang-full { display: none; }
  .lang-menu {
    position: absolute; top: calc(100% + 8px); right: 0; width: 184px; padding: 6px; z-index: 40;
    background: #fff; border: 1px solid #e6ecf3; border-radius: 15px; box-shadow: 0 12px 30px rgba(38,62,99,.16);
    animation: langRise .16s ease-out;
  }
  .lang-menu button {
    width: 100%; display: flex; align-items: center; gap: 9px; margin: 0; box-shadow: none;
    background: none; border: 0; padding: 11px 10px; border-radius: 10px; text-align: left;
    font-size: 13px; font-weight: 400; color: var(--ink); min-height: 44px;
  }
  .lang-menu button:hover { background: #edf3ff; transform: none; }
  .lang-tick { margin-left: auto; color: var(--accent); font-weight: 700; }
  @keyframes langRise { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
  /* В шапке места мало (слева постоянный список разделов) — полное название языка показываем
     только когда экран действительно широкий, иначе остаётся флаг + код. */
  @media (min-width: 1100px) {
    header .lang-pick .lang-full { display: inline; }
    header .lang-pick .lang-code { display: none; }
  }
  /* ===== Окно входа — оформление утверждённого эталона Nasem-Login-Glass-Reference.html
     (login-glass-v1, 26.10.2026). Размеры, отступы, цвета, тени и анимации взяты из него
     буквально, не придуманы заново. Отличия от эталона — только оговорённые в ТЗ:
       • фон берётся из действующей настройки владельца (/bg.jpg и /bg-mobile.jpg из R2),
         а не из фотографии, встроенной в эталон для переносимости;
       • карточка центрируется по настоящей высоте экрана (в эталоне высота сцены была задана
         числом), при низком окне и открытой клавиатуре страница прокручивается;
       • приветствие зависит от времени Ташкента, вход — настоящий серверный;
       • служебной панели просмотра эталона в приложении нет.
     Всё под #nfa, чтобы правила страницы входа не задевали остальное приложение. ===== */
  body.auth { background: var(--page-bg); }
  @media (min-width: 900px) {
    /* На входе нет бокового списка разделов — слева не нужно место под него, рамка-окно остаётся. */
    body.auth { padding: var(--frame); }
  }
  #nfa {
    --nfa-blue: #2862ef; --nfa-ink: #182538; --nfa-muted: #627085;
    max-width: none; margin: 0; animation: none; color: var(--nfa-ink);
    font-size: 14px; line-height: 1.5; padding: 28px 36px 24px;
    display: flex; flex-direction: column; min-height: 100vh;
  }
  @media (min-width: 900px) { #nfa { min-height: calc(100vh - var(--frame) * 2); } }
  /* В эталоне у кнопок и полей стоит font: inherit — вместе со шрифтом наследуется и межстрочное
     расстояние. В приложении наследуется только сам шрифт, поэтому задаём явно: без этого подписи
     в кнопках стояли чуть плотнее, чем в эталоне. */
  #nfa button, #nfa input { line-height: 1.5; }
  /* Световые пятна: очень медленное движение, цикл 16 с. На телефоне движение выключено. */
  .nfa-orb { position: fixed; z-index: -1; border-radius: 50%; pointer-events: none; filter: blur(60px);
    animation: nfa-breathe 16s ease-in-out infinite alternate; }
  .nfa-orb-a { width: 380px; height: 380px; background: rgba(140,184,255,.4); left: 12%; top: 15%; }
  .nfa-orb-b { width: 310px; height: 310px; background: rgba(180,199,255,.4); right: 3%; bottom: 3%; animation-delay: -8s; }
  .nfa-top { display: flex; align-items: center; gap: 14px; color: #34445d; }
  .nfa-top > span:first-child { font-size: 22px; font-weight: 700; letter-spacing: -1px; }
  .nfa-top > span:last-child { font-size: 10px; letter-spacing: 2.3px; border-left: 1px solid rgba(105,124,150,.2); padding-left: 14px; }
  .nfa-dot { color: var(--nfa-blue); }
  .nfa-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px 0 26px; }
  .nfa-login {
    position: relative; width: 440px; max-width: 100%; padding: 24px 34px 25px;
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(249,252,255,.9));
    border: 1px solid rgba(255,255,255,.95); border-radius: 30px;
    box-shadow: 0 28px 70px rgba(41,73,113,.13), 0 7px 20px rgba(49,84,126,.07), inset 0 1px 0 #fff;
    backdrop-filter: blur(26px); -webkit-backdrop-filter: blur(26px);
    animation: nfa-rise .65s cubic-bezier(.2,.8,.2,1) both;
  }
  /* Светлый верхний край карточки — один мягкий проблеск при открытии. */
  .nfa-login:after {
    content: ""; position: absolute; pointer-events: none; inset: -1px; border-radius: 30px;
    border-top: 1px solid #fff; box-shadow: 0 -4px 22px rgba(255,255,255,.47); animation: nfa-glint 1.3s ease-out both;
  }
  .nfa-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .nfa-eyebrow { font-size: 9px; letter-spacing: 1.7px; font-weight: 600; color: #67788f; }
  .nfa-brand-mark { position: relative; width: 76px; height: 76px; margin: 23px auto 13px; display: grid; place-items: center; }
  /* Фактура ткани — почти незаметная маска только в зоне логотипа, под текстом и полями её нет. */
  .nfa-brand-mark:before {
    content: ""; position: absolute; inset: -10px; border-radius: 30px;
    background: repeating-linear-gradient(45deg, rgba(117,145,184,.03) 0 1px, transparent 1px 4px),
                repeating-linear-gradient(-45deg, rgba(117,145,184,.03) 0 1px, transparent 1px 4px);
    -webkit-mask-image: radial-gradient(#000, transparent 70%); mask-image: radial-gradient(#000, transparent 70%);
  }
  /* Швейная нить: тонкая синяя линия раскрывает рамку вокруг логотипа за 950 мс, один раз. */
  .nfa-thread { position: absolute; inset: 0; border: 1px solid rgba(114,156,255,.42); border-radius: 24px;
    clip-path: inset(0 100% 0 0); animation: nfa-sew .95s .12s ease forwards; }
  .nfa-thread:after { content: ""; position: absolute; width: 5px; height: 5px; right: 4px; top: 6px;
    border-radius: 50%; background: #5384ff; box-shadow: 0 0 9px #397bff; }
  .nfa-logo {
    position: relative; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px;
    background: linear-gradient(145deg, #6595ff, #255bea 75%); color: #fff; font-size: 42px; font-weight: 600; line-height: 1;
    box-shadow: inset 0 1px 2px rgba(255,255,255,.533), 0 9px 20px rgba(40,98,239,.22);
    animation: nfa-logo .7s ease-out both; overflow: hidden;
  }
  .nfa-logo span { position: absolute; width: 24px; height: 110px; transform: rotate(30deg);
    background: rgba(255,255,255,.15); left: -70px; animation: nfa-shine 1.3s .4s ease-out both; }
  #nfa .nfa-brand { display: block; text-align: center; font-size: 22px; font-weight: 650; letter-spacing: -.8px;
    margin: 0; padding: 0; border: 0; }
  .nfa-os { text-align: center; font-size: 9px; color: #7b889b; letter-spacing: 3px; margin-top: 2px; }
  .nfa-intro { text-align: center; margin: 27px 0 26px; }
  .nfa-greeting { font-size: 12px; color: #47658b; margin: 0 0 6px; }
  #nfa h1 { font-size: 26px; letter-spacing: -1.05px; font-weight: 600; line-height: 1.2; margin: 0 0 10px; }
  .nfa-subtitle { font-size: 12px; color: var(--nfa-muted); margin: 0; }
  #nfa .nfa-form label { display: block; font-size: 12px; font-weight: 600; margin: 0 0 7px; }
  .nfa-input-wrap {
    display: flex; align-items: center; gap: 11px; min-height: 51px; padding: 0 14px; margin-bottom: 18px;
    background: rgba(247,249,252,.9); border: 1px solid #dbe4ef; border-radius: 13px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  }
  .nfa-input-wrap > .nfa-ic { width: 17px; height: 17px; color: #8493a8; flex-shrink: 0; }
  .nfa-input-wrap:focus-within { border-color: #6491ff; background: #fff; box-shadow: 0 0 0 4px rgba(57,119,255,.07); }
  #nfa .nfa-input-wrap input {
    width: 100%; min-width: 0; height: 50px; margin: 0; padding: 0; border: 0; border-radius: 0;
    background: transparent; color: var(--nfa-ink); font-size: 16px;
  }
  #nfa .nfa-input-wrap input:focus { outline: none; }
  #nfa .nfa-input-wrap input::placeholder { color: #95a1b1; font-size: 14px; }
  #nfa .nfa-eye { display: grid; place-items: center; width: auto; min-width: 30px; min-height: 32px; margin: 0;
    padding: 5px; border: 0; border-radius: 8px; background: none; color: #7c8ba1; box-shadow: none; }
  #nfa .nfa-eye:hover { transform: none; }
  #nfa .nfa-eye svg { width: 17px; height: 17px; }
  #nfa .nfa-submit {
    width: 100%; min-height: 52px; margin: 0; padding: 1px 6px; border: 1px solid #3265ec; border-radius: 14px;
    background: linear-gradient(180deg, #467cff, #285deb); color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 7px 16px rgba(40,98,239,.16);
    display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; font-weight: 600;
    transition: transform .2s ease, box-shadow .2s ease;
  }
  #nfa .nfa-submit:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(40,98,239,.27); }
  #nfa .nfa-submit:disabled { cursor: wait; transform: none; opacity: 1; }
  #nfa .nfa-submit svg { width: 17px; height: 17px; }
  .nfa-spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.33); border-top-color: #fff;
    border-radius: 50%; animation: nfa-spin .75s linear infinite; }
  /* Ошибка раскрывается под полями, карточку не трясёт. */
  .nfa-error { display: flex; align-items: flex-start; gap: 8px; margin: -3px 0 16px; padding: 11px;
    background: #fff0f0; color: #ac3545; border: 1px solid #f6d2d7; border-radius: 10px; font-size: 12px;
    animation: nfa-rise .2s ease; }
  .nfa-error svg { width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; }
  .nfa-assistance { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px;
    margin: 19px -8px 0; font-size: 11px; color: #8590a0; }
  #nfa .nfa-assistance button { width: auto; margin: 0; padding: 5px 2px; border: 0; background: transparent;
    color: #526e96; font-size: 11px; font-weight: 400; box-shadow: none; }
  #nfa .nfa-assistance button:hover { text-decoration: underline; transform: none; }
  .nfa-help { margin-top: 13px; padding: 13px; background: #edf4ff; border: 1px solid #dbe8ff; border-radius: 13px;
    animation: nfa-rise .2s ease; }
  .nfa-help > div { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #345b94; }
  .nfa-help svg { width: 16px; height: 16px; flex-shrink: 0; }
  #nfa .nfa-help-close { width: auto; min-width: 25px; min-height: 25px; margin: 0 0 0 auto; padding: 0;
    border: 0; background: none; color: #345b94; font-size: 20px; line-height: 1; box-shadow: none; }
  #nfa .nfa-help-close:hover { transform: none; }
  .nfa-help p { font-size: 12px; color: #506984; margin: 8px 0 0; }
  .nfa-signature { display: flex; align-items: center; gap: 12px; margin-top: 23px; }
  .nfa-signature span { flex: 1; height: 1px; background: #dfe6ef; }
  .nfa-signature p { font-size: 10px; color: #8090a4; margin: 0; letter-spacing: .3px; }
  .nfa-footnote { font-size: 11px; color: #566b87; margin: 20px 0 0; text-align: center; }
  .nfa-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 3px;
    font-size: 9px; letter-spacing: 1.5px; color: #566b87; }
  .nfa-bottom > span:last-child { letter-spacing: .2px; font-size: 10px; }
  /* Успех — только после ответа сервера: короткая галочка и растворение карточки. */
  .nfa-success { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 30px; text-align: center;
    background: rgba(251,253,255,.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 30px; animation: nfa-rise .35s ease-out; }
  .nfa-success-icon { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 23px;
    background: #e8f1ff; color: var(--nfa-blue); box-shadow: 0 8px 24px rgba(40,98,239,.07); }
  .nfa-success-icon svg { width: 32px; height: 32px; }
  #nfa .nfa-success h2 { font-size: 25px; font-weight: 650; letter-spacing: -.7px; margin: 22px 0 8px; }
  .nfa-success p { color: #64778d; font-size: 13px; margin: 0; }
  @keyframes nfa-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes nfa-logo { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
  @keyframes nfa-glint { from { opacity: 0; } 40% { opacity: 1; } to { opacity: .6; } }
  @keyframes nfa-sew { to { clip-path: inset(0 0 0 0); } }
  @keyframes nfa-shine { to { left: 100px; } }
  @keyframes nfa-breathe { to { transform: translate(30px, -24px) scale(1.08); } }
  @keyframes nfa-spin { to { transform: rotate(360deg); } }
  @media (max-width: 520px) {
    /* Телефон: рамки-окна нет, поля страницы 16 px, карточки 24 px, радиус 25 px — как в эталоне. */
    #nfa { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
    .nfa-center { padding: 28px 0 22px; }
    .nfa-login { padding: 22px 24px; border-radius: 25px; }
    .nfa-login:after { border-radius: 25px; }
    .nfa-success { border-radius: 25px; }
    #nfa h1 { font-size: 24px; }
    .nfa-eyebrow { font-size: 8px; letter-spacing: 1px; }
    .nfa-bottom { justify-content: center; }
    .nfa-bottom > span:first-child { display: none; }
    .lang-pick .lang-btn { min-height: 40px; }
    #nfa .nfa-assistance button { min-height: 38px; }
    /* Область нажатия у иконок на телефоне — не меньше 44 на 44 (требование ТЗ; в эталоне
       было 30x32 и 25x25, это единственное место, где мы сознательно крупнее эталона). */
    #nfa .nfa-eye, #nfa .nfa-help-close { min-width: 44px; min-height: 44px; }
    .nfa-orb { animation: none; filter: blur(35px); }
  }
  @media (prefers-reduced-motion: reduce) {
    #nfa *, #nfa *:before, #nfa *:after { animation: none !important; transition: none !important; }
    .nfa-thread { clip-path: none; }
    .nfa-logo span { display: none; }
  }
  /* [hidden] у блоков с display:flex сам по себе не срабатывает — гасим явно. */
  .nfa-error[hidden], .nfa-success[hidden] { display: none; }
