/* FBS сборка — две темы: «ночь» (тёмная, по референсу SelSup) и «день» (светлая).
   Переключатель — кнопка ◐, выбор хранится на устройстве, дефолт — системная тема.
   Дисциплина: зелёный/жёлтый/красный = ТОЛЬКО срок сборки. */

/* --- Manrope, self-hosted: никаких внешних CDN (Россия), всё из /static/fonts --- */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/manrope-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/manrope-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/manrope-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/manrope-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/manrope-cyrillic-700.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/manrope-latin-700.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("/static/fonts/manrope-cyrillic-800.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("/static/fonts/manrope-latin-800.woff2") format("woff2"); }

:root {
  /* ночь (дефолт) */
  color-scheme: dark;   /* родные чекбоксы, скроллбары и каретка — в цвет темы */
  --bg-0: #070b14;
  --bg-1: #0b1020;
  --surface: #101625;
  --surface-2: #141c30;
  --border: rgba(122, 160, 255, .12);
  --text: #eaf0fa;
  --muted: #8e9bb3;
  --muted-2: #7d8aa3;   /* ≥4.5:1 на чернильном фоне */
  --accent: #3564ff;
  --accent-2: #35b6ff;
  --cyan: #65ddd2;
  --cta-grad: linear-gradient(135deg, #2f5bff, #1738a4);
  --cta-shadow: 0 10px 24px rgba(35, 80, 220, .35);
  --done-grad: linear-gradient(135deg, #18b568, #0d7a44);
  --done-shadow: 0 10px 24px rgba(24, 181, 104, .30);
  --green: #3edc8a;
  --green-bg: rgba(62, 220, 138, .12);
  --green-brd: rgba(62, 220, 138, .25);
  --green-glow: rgba(62, 220, 138, .6);
  --yellow: #ffb324;
  --yellow-bg: rgba(255, 179, 36, .12);
  --yellow-brd: rgba(255, 179, 36, .25);
  --yellow-glow: rgba(255, 179, 36, .6);
  --red: #ff4a3c;
  --red-bg: rgba(255, 74, 60, .14);
  --red-brd: rgba(255, 74, 60, .35);
  --red-glow: rgba(255, 74, 60, .7);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 28px rgba(3, 6, 14, .45);
  --page-bg:
    radial-gradient(1200px 600px at 80% -10%, rgba(53, 100, 255, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(0, 167, 231, .10), transparent 55%),
    linear-gradient(180deg, #0b1020, #070b14 60%);
  --topbar-bg: rgba(11, 16, 32, .82);
  --pick-bg: rgba(53, 100, 255, .16);
  --focus-ring: rgba(53, 100, 255, .22);
  --bg: var(--bg-1); /* алиас для шаблонов */
  /* --- лента сборки --- */
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --wrap: 1200px;
  --topbar-h: 56px;
  --rail: rgba(122, 160, 255, .10);      /* волосяная линия между строками */
  --row-hover: rgba(122, 160, 255, .05);
  --row-red: rgba(255, 74, 60, .07);     /* подсветка горящей строки */
  --tile-bg: rgba(122, 160, 255, .05);
  --tile-active: rgba(53, 100, 255, .18);
  --chip-bg: rgba(122, 160, 255, .09);
  --field-bg: rgba(7, 11, 20, .55);
  --pop-bg: #121a2c;
  --shadow-sm: 0 2px 8px rgba(3, 6, 14, .35);
  --shadow-pop: 0 18px 44px rgba(3, 6, 14, .6);
}

[data-theme="light"] {
  /* день */
  color-scheme: light;
  --bg-0: #e9edf5;
  --bg-1: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: rgba(30, 60, 130, .13);
  --text: #17203a;
  --muted: #5d6b85;
  --muted-2: #697690;   /* ≥4.5:1 на белом — склад читает мелкие подписи издалека */
  --accent: #3f51e6;
  --accent-2: #0a6ab0;
  --cyan: #0c7488;
  --cta-grad: linear-gradient(135deg, #4353e8, #2f3ec4);
  --cta-shadow: 0 10px 22px rgba(63, 81, 230, .28);
  --done-grad: linear-gradient(135deg, #16a25c, #0d7a44);
  --done-shadow: 0 10px 22px rgba(22, 162, 92, .28);
  /* светофор на свету: тексты таймеров обязаны держать 4.5:1 — это главное,
     что читают со склада, иногда через плечо и под бликом от окна */
  --green: #127849;
  --green-bg: rgba(20, 138, 78, .10);
  --green-brd: rgba(20, 138, 78, .30);
  --green-glow: rgba(20, 138, 78, .35);
  --yellow: #8a5f00;
  --yellow-bg: rgba(232, 161, 0, .14);
  --yellow-brd: rgba(200, 140, 0, .35);
  --yellow-glow: rgba(232, 161, 0, .45);
  --red: #c42316;
  --red-bg: rgba(210, 40, 26, .10);
  --red-brd: rgba(210, 40, 26, .30);
  --red-glow: rgba(210, 40, 26, .40);
  --shadow: 0 8px 24px rgba(30, 50, 100, .10);
  --page-bg:
    radial-gradient(1100px 550px at 85% -10%, rgba(67, 83, 232, .08), transparent 60%),
    linear-gradient(180deg, #f3f6fb, #e9edf5 60%);
  --topbar-bg: rgba(255, 255, 255, .85);
  --pick-bg: rgba(63, 81, 230, .10);
  --focus-ring: rgba(63, 81, 230, .20);
  --rail: rgba(30, 60, 130, .11);
  --row-hover: rgba(30, 60, 130, .04);
  --row-red: rgba(210, 40, 26, .05);
  --tile-bg: rgba(30, 60, 130, .05);
  --tile-active: rgba(63, 81, 230, .13);
  --chip-bg: rgba(30, 60, 130, .06);
  --field-bg: #ffffff;
  --pop-bg: #ffffff;
  --shadow-sm: 0 1px 3px rgba(30, 50, 100, .10);
  --shadow-pop: 0 18px 40px rgba(30, 50, 100, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.45 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; }
h1 { font-size: 24px; font-weight: 800; margin: 0 0 14px; letter-spacing: -.015em; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 12px; letter-spacing: -.01em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
code {
  background: rgba(122, 160, 255, .10); padding: 2px 6px; border-radius: 6px;
  font-size: 13px; color: var(--cyan);
}

/* --- переключатель темы --- */
.theme-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 20px; cursor: pointer; line-height: 1;
}
.theme-toggle:hover { color: var(--text); }

/* --- шапка --- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 20px; min-height: var(--topbar-h); flex-wrap: wrap;
  background: var(--topbar-bg); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 18px; letter-spacing: .02em; color: var(--text); }
.logo b { color: var(--accent-2); font-weight: 800; }
.queue-badge {
  background: var(--cta-grad); color: #fff; box-shadow: var(--cta-shadow);
  padding: 5px 14px; border-radius: 999px; font-weight: 700; font-size: 14px;
}
.username { font-weight: 600; font-size: 14px; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-link:hover { color: var(--text); }
.btn-plain { background: none; border: none; cursor: pointer; padding: 0; font: inherit; }
.page-name { color: var(--muted); }

/* связь с сервером: точка + слово, красный только когда реально отвалилось */
.conn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 4px 10px 4px 8px; border-radius: 999px;
  background: var(--chip-bg); border: 1px solid transparent;
}
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.conn-off { display: none; }
.conn.off { color: var(--red); background: var(--red-bg); border-color: var(--red-brd); }
.conn.off .conn-dot { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.conn.off .conn-on { display: none; }
.conn.off .conn-off { display: inline; }

@keyframes pulse { 50% { opacity: .6; } }

/* ==========================================================================
   ЛЕНТА СБОРКИ
   Не карточки, а плотная таблица: и 4 заказа, и 400 читаются сверху вниз
   одним взглядом, без листания. Цвет в строке значит ровно одно — сколько
   осталось до дедлайна. Пилюли = данные и действия, скруглённые прямо-
   угольники = поля и панели.
   ========================================================================== */

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor;
      stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* --- панель управления под шапкой --- */
.deck {
  position: sticky; top: var(--topbar-h); z-index: 30;
  background: var(--topbar-bg); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.deck-row { display: flex; align-items: center; gap: 16px; padding-top: 12px;
            padding-bottom: 12px; flex-wrap: wrap; }

/* счётчики = фильтры: одно и то же, незачем дублировать двумя рядами.
   overflow-x — не только для мобилы: гарантия, что плашки никогда не наедут
   на поиск, в какую бы ширину ни попал монитор на складе. */
.tiles {
  display: flex; align-items: stretch; gap: 8px; flex: 1 1 620px; min-width: 0;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tiles::-webkit-scrollbar { display: none; }
.tile {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 94px; padding: 7px 13px;
  background: var(--tile-bg); border: 1px solid transparent; border-radius: 14px;
  color: var(--muted); font-family: inherit; text-align: left; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.tile:hover { background: var(--chip-bg); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.is-active { background: var(--tile-active); border-color: var(--accent); }
.tile-num { font-size: 23px; font-weight: 800; line-height: 1.15; letter-spacing: -.035em;
            color: var(--text); font-variant-numeric: tabular-nums; }
.tile-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
              font-weight: 600; white-space: nowrap; }
.tile .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.tile-hero { min-width: 120px; }
.tile-hero .tile-num { font-size: 29px; }
.tile-red .tile-label      { color: var(--red); }
.tile-yellow .tile-label   { color: var(--yellow); }
.tile-green .tile-label    { color: var(--green); }
.tile-progress .tile-label { color: var(--accent-2); }
.tile-done .tile-label     { color: var(--cyan); }
.tile-red:not(.is-zero) .dot { box-shadow: 0 0 8px var(--red-glow); }
/* ноль — это не тревога: гасим плашку, чтобы горело только то, что горит */
.tile.is-zero .tile-num, .tile.is-zero .tile-label { color: var(--muted); }
.tile.is-zero .dot { box-shadow: none; }

/* --- поиск и «мои направления» --- */
.tools { display: flex; align-items: center; gap: 10px; flex: 1 1 380px;
         min-width: 0; justify-content: flex-end; }
.search {
  display: flex; align-items: center; gap: 9px; flex: 1 1 210px; min-width: 0; max-width: 340px;
  height: 44px; padding: 0 6px 0 13px;
  background: var(--field-bg); border: 1px solid var(--border); border-radius: 12px;
  color: var(--muted-2);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.search input {
  flex: 1; min-width: 0; width: auto; height: 42px; padding: 0;
  border: 0; background: none; border-radius: 0;
  font: 500 14px var(--font); color: var(--text);
}
.search input:focus { outline: none; border: 0; box-shadow: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--chip-bg); color: var(--muted); cursor: pointer;
  font: 400 18px/1 var(--font);
}
.search-clear:hover { color: var(--text); }
.search-clear[hidden] { display: none; }

.dests { position: relative; flex: none; }
.ctl {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 13px;
  background: var(--field-bg); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
  transition: border-color .15s ease, color .15s ease;
}
.ctl:hover { border-color: var(--accent); }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ctl[aria-expanded="true"] { color: var(--text); border-color: var(--accent); }
.ctl.has-pick { color: var(--text); border-color: var(--accent); background: var(--tile-active); }
.ctl-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ctl-count[hidden] { display: none; }
.ctl .chev { width: 16px; height: 16px; transition: transform .18s ease; }
.ctl[aria-expanded="true"] .chev { transform: rotate(180deg); }

.pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 296px;
  background: var(--pop-bg); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-pop); padding: 8px;
}
.pop[hidden] { display: none; }
.pop-head { display: flex; align-items: center; justify-content: space-between;
            gap: 8px; padding: 6px 8px 8px; }
.pop-title { font-size: 11px; font-weight: 700; color: var(--muted);
             text-transform: uppercase; letter-spacing: .07em; }
.pop-clear { background: none; border: 0; padding: 2px; cursor: pointer;
             color: var(--accent-2); font: 600 13px var(--font); }
.pop-clear:hover { text-decoration: underline; }
.pop-list { max-height: min(46vh, 330px); overflow-y: auto;
            display: flex; flex-direction: column; gap: 2px; }
.pop-row {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px;
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text);
}
.pop-row:hover { background: var(--chip-bg); }
.pop-row.is-on { background: var(--tile-active); }
.pop-row input[type="checkbox"] {
  width: 18px; height: 18px; flex: none; margin: 0; padding: 0;
  border: 0; border-radius: 4px; background: none; accent-color: var(--accent);
}
.pop-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-n { margin-left: auto; flex: none; color: var(--muted-2); font-size: 13px;
         font-weight: 700; font-variant-numeric: tabular-nums; }
.pop-hint { margin: 9px 8px 3px; font-size: 12px; line-height: 1.4; color: var(--muted-2); }
.pop-empty { padding: 14px 10px; font-size: 13px; color: var(--muted-2); }

/* --- доска --- */
.board-wrap { padding-top: 18px; padding-bottom: 44px; }
.board {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.board.is-empty { display: none; }

.grid-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 78px 186px 140px 196px;
  grid-template-areas: "photo main qty dest timer act";
  align-items: center; gap: 0 16px; padding: 0 18px;
}
.colhead {
  height: 34px; background: var(--bg-1); color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.colhead .c-qty, .colhead .c-timer { text-align: center; }
.colhead .c-act { text-align: right; text-transform: none; letter-spacing: .01em;
                  font-size: 12px; font-weight: 600; }

.order {
  min-height: 80px; padding-top: 8px; padding-bottom: 8px;
  border-top: 1px solid var(--rail); transition: background .13s ease;
}
.order:first-of-type { border-top: 0; }
.order:hover { background: var(--row-hover); }
.order.light-red { background: var(--row-red); }
.order.light-red:hover { background: var(--red-bg); }
.order.status-assembled { opacity: .5; }
.order.status-assembled:hover { opacity: .78; }
.order[hidden] { display: none; }

.c-photo { grid-area: photo; }
.c-main  { grid-area: main; min-width: 0; }
.c-qty   { grid-area: qty; text-align: center; }
.c-dest  { grid-area: dest; min-width: 0; }
.c-timer { grid-area: timer; text-align: center; }
.c-act   { grid-area: act; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

.c-photo img, .c-photo .photo-stub {
  display: block; width: 48px; height: 62px; object-fit: cover;
  border-radius: 8px; background: var(--bg-1); border: 1px solid var(--border);
}
.photo-stub { display: flex; align-items: center; justify-content: center;
              color: var(--muted); font-size: 12px;
              background: var(--chip-bg); border: 1px solid var(--border);
              border-radius: var(--radius-sm); }
.c-photo .photo-stub svg { width: 21px; height: 21px; fill: none; stroke: currentColor;
              stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.o-title { font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -.011em;
           color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 0; }
.o-art { font-size: 12.5px; font-weight: 600; color: var(--accent-2); letter-spacing: .02em;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-size { flex: none; padding: 2px 9px; border-radius: 999px;
          background: var(--chip-bg); border: 1px solid var(--border);
          font-size: 12.5px; font-weight: 800; color: var(--text); white-space: nowrap; }
.o-size i { font-style: normal; margin-right: 4px; font-size: 10px; font-weight: 600;
            letter-spacing: .04em; color: var(--muted); }
.o-cab { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.o-state { margin-top: 3px; font-size: 12px; line-height: 1.3; font-weight: 600;
           color: var(--accent-2); }
.o-state.ok { color: var(--green); }

.qty { display: inline-flex; align-items: baseline; gap: 3px;
       font-size: 13px; font-weight: 600; color: var(--muted); }
.qty i { font-style: normal; font-size: 11px; font-weight: 600; }
.qty-many { padding: 4px 11px; border-radius: 999px;
            background: var(--tile-active); border: 1px solid var(--accent);
            font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--text);
            font-variant-numeric: tabular-nums; }
.qty-many i { color: var(--accent-2); font-weight: 700; }

.dest-name { display: flex; align-items: center; gap: 6px; min-width: 0;
             font-size: 15px; font-weight: 700; color: var(--text); }
.dest-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest-pin { width: 14px; height: 14px; color: var(--muted-2); }

.timer {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 106px; padding: 7px 11px; border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 800; letter-spacing: -.012em; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.light-green  .timer { color: var(--green);  background: var(--green-bg);  border-color: var(--green-brd); }
.light-yellow .timer { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-brd); }
.light-red    .timer { color: var(--red);    background: var(--red-bg);    border-color: var(--red-brd);
                       animation: hot 1.9s cubic-bezier(.22,.9,.3,1) infinite; }
/* единственный анимированный момент на экране — то, что горит прямо сейчас */
@keyframes hot {
  0%      { box-shadow: 0 0 0 0 var(--red-glow); }
  70%,100%{ box-shadow: 0 0 0 8px rgba(255, 74, 60, 0); }
}
.stamp { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
         min-width: 106px; padding: 6px 11px; border-radius: 999px;
         background: var(--green-bg); border: 1px solid var(--green-brd);
         font-size: 13px; font-weight: 700; color: var(--green);
         font-variant-numeric: tabular-nums; }
.stamp .ic { width: 15px; height: 15px; stroke-width: 2.3; }

.c-act > form { flex: 1 1 auto; min-width: 0; display: flex; }
.c-act > form.act-icon { flex: 0 0 auto; }

/* --- кнопки --- */
.btn {
  border: none; border-radius: 999px; padding: 12px 22px; font-size: 15px; font-weight: 700;
  cursor: pointer; min-height: 46px; font-family: inherit; color: #fff;
}
/* кнопка-ссылка (<a class="btn">): без этого инлайновая ссылка ломается на строки */
a.btn {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
a.btn-wide { display: flex; }
.btn-primary { background: var(--cta-grad); box-shadow: var(--cta-shadow); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-done { background: var(--done-grad); box-shadow: var(--done-shadow); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 6px 12px; min-height: 0; font-size: 13px; }
.btn-wide { width: 100%; }
.btn:active { transform: translateY(1px); }

/* кнопки внутри строки ленты — объявлены ПОСЛЕ .btn, иначе .btn затирает паддинг и рамку */
.btn-row { width: 100%; min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn-icon {
  width: 44px; height: 44px; min-height: 44px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.btn-icon svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor;
                stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon:hover { color: var(--text); border-color: var(--accent); background: var(--chip-bg); }

/* --- карточки/формы --- */
.center-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px; margin-bottom: 16px;
}
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.logo-big { font-weight: 800; font-size: 26px; margin-bottom: 18px; letter-spacing: .03em; color: var(--text); }
.logo-big b { color: var(--accent-2); font-weight: 800; }
.stack { display: flex; flex-direction: column; gap: 11px; }
.stack-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input, select {
  padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; width: 100%; background: var(--bg-1); color: var(--text); font-family: inherit;
}
input::placeholder { color: var(--muted-2); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.form-grid { max-width: 400px; }
.alert { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-brd); padding: 10px; border-radius: var(--radius-sm); margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 14px; }
.muted-link { display: inline-block; margin-top: 14px; color: var(--muted); font-size: 14px; }
.inline { display: inline; }

.packer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.packer-pick input { display: none; }
.packer-pick span {
  display: block; padding: 15px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 700; cursor: pointer; background: var(--bg-1); color: var(--text);
}
.packer-pick input:checked + span {
  border-color: var(--accent); background: var(--pick-bg);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.empty { text-align: center; padding: 66px 20px 74px; color: var(--muted); }
.empty[hidden] { display: none; }
.empty-art { color: var(--muted-2); opacity: .45; margin-bottom: 18px; }
.empty-art svg { width: 62px; height: 62px; fill: none; stroke: currentColor;
                 stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.empty-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em;
               margin-bottom: 8px; color: var(--text); }
.empty-sub { font-size: 14px; line-height: 1.55; max-width: 48ch; margin: 0 auto; }
.empty-filter .btn { margin-top: 20px; }

/* --- админка --- */
.admin { max-width: 900px; margin: 20px auto; padding: 0 14px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { color: var(--muted-2); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.tbl tr.inactive { opacity: .4; }
.invite-row { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.qr { display: block; width: 180px; height: 180px; border-radius: var(--radius-sm); background: #fff; }
.auth-card .qr { margin: 0 auto 16px; }
.qr-sm { width: 120px; height: 120px; }

/* --- поставки --- */
.alert-warn { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-brd); padding: 10px; border-radius: var(--radius-sm); margin-bottom: 10px; }
.supply-group { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.supply-group-title { font-weight: 700; color: var(--cyan); margin-bottom: 8px; font-size: 14px; }
.order-check { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.order-check input { width: auto; }

/* --- печать этикеток / QR --- */
.print-page { max-width: 700px; margin: 20px auto; padding: 0 14px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.sticker-page { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.sticker-page img { display: block; width: 58mm; }

/* --- фокус с клавиатуры: виден всегда, на обеих темах --- */
.btn:focus-visible, .pop-clear:focus-visible, .search-clear:focus-visible,
.nav-link:focus-visible, .btn-plain:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}
.pop-row:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ==================== АДАПТИВ ==================== */

@media (max-width: 1120px) {
  .grid-row { grid-template-columns: 48px minmax(0, 1fr) 72px 148px 126px 164px;
              gap: 0 12px; padding: 0 14px; }
  .btn-row { padding: 0 10px; font-size: 13.5px; }
  .dest-name { font-size: 14px; }
  .timer { min-width: 96px; font-size: 14px; }
  .stamp { min-width: 96px; }
}

/* планшет и телефон: шапка уезжает, липнет только панель управления */
@media (max-width: 900px) {
  .topbar { position: static; }
  .deck { top: 0; }
  .deck-row { gap: 12px; padding-top: 10px; padding-bottom: 10px; }
  .tiles { flex: 1 1 100%; margin: 0 -20px; padding: 0 20px 2px; }
  .tools { flex: 1 1 100%; }
  .search { max-width: none; }
  .colhead { display: none; }
  .board-wrap { padding-top: 12px; padding-bottom: 84px; }
  .board { border-radius: 14px; }

  .grid-row {
    grid-template-columns: 60px minmax(0, 1fr) auto;
    grid-template-areas:
      "photo main  timer"
      "photo dest  qty"
      "act   act   act";
    gap: 8px 14px; padding: 12px 14px;
  }
  .order { min-height: 0; padding-top: 12px; padding-bottom: 12px; }
  .c-photo { align-self: start; }
  .c-photo img, .c-photo .photo-stub { width: 60px; height: 74px; }
  .c-qty, .c-timer { text-align: right; }
  .c-act { margin-top: 4px; }
  .o-title { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical;
             -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  /* на телефоне артикул не режем многоточием — по нему ищут вещь на полке */
  .o-meta { flex-wrap: wrap; row-gap: 4px; }
  .o-art { overflow: visible; text-overflow: clip; }
  .timer, .stamp { min-width: 0; font-size: 15px; }
  .btn-row { min-height: 52px; font-size: 15px; }
  .btn-icon { width: 52px; height: 52px; min-height: 52px; }
  .pop { width: min(320px, calc(100vw - 32px)); }
  /* кнопка темы уезжает влево, к фото: там нечего нажимать, а справа — «Начать сборку» */
  .theme-toggle { right: auto; left: 12px; bottom: 12px; width: 40px; height: 40px;
                  font-size: 17px; opacity: .75; }
  .theme-toggle:hover, .theme-toggle:focus-visible { opacity: 1; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 12px; }
  .topbar { padding: 8px 12px; gap: 6px 10px; }
  /* меню в одну прокручиваемую строку: три строки ссылок съедали пол-экрана */
  .topbar-right { flex-wrap: nowrap; width: 100%; overflow-x: auto;
                  scrollbar-width: none; justify-content: flex-start; }
  .topbar-right::-webkit-scrollbar { display: none; }
  .topbar-right > * { flex: none; white-space: nowrap; }
  .tiles { margin: 0 -12px; padding: 0 12px 2px; }
  /* поиск и направления — во всю ширину, по строке на каждый: пальцем удобнее */
  .tools { flex-wrap: wrap; }
  .search, .dests { flex: 1 1 100%; max-width: none; }
  .ctl { width: 100%; justify-content: flex-start; }
  .ctl .chev { margin-left: auto; }
  .grid-row { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px 10px; padding: 12px; }
  .c-photo img, .c-photo .photo-stub { width: 52px; height: 64px; }
  .o-title { font-size: 14.5px; }
  .qr { width: 140px; height: 140px; }
  .btn { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
