/* =====================================================================
   UPG Склад — стилі
   ---------------------------------------------------------------------
   Кольори задані змінними (токенами) — світла тема за замовчуванням,
   темна вмикається автоматично за налаштуваннями пристрою.
   Розмітка адаптивна: телефон (від 320 px) → планшет → ПК.
   ===================================================================== */

:root {
  --bg: #f6f7f9;          /* фон сторінки */
  --surface: #ffffff;     /* картки, таблиця, панелі */
  --surface-2: #f0f2f5;   /* вторинні поверхні, заголовки таблиці */
  --border: #d9dde3;      /* рамки */
  --text: #1b1f24;        /* основний текст */
  --muted: #5d6673;       /* другорядний текст */
  --accent: #1f6feb;      /* основний колір дій */
  --accent-ink: #ffffff;  /* текст на акцентному кольорі */
  --accent-soft: #e3edff; /* підсвітка вибраного */
  --star: #d99a00;        /* позначка головного фото */
  --danger: #cf222e;      /* видалення */
  --ok: #1a7f37;          /* успіх */
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --radius: 10px;
  color-scheme: light;
}

/* Темна тема (за налаштуваннями системи) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232b;
    --border: #2d343e;
    --text: #e6e9ee;
    --muted: #98a2b0;
    --accent: #4c8dff;
    --accent-ink: #0b0d10;
    --accent-soft: #1c2a44;
    --star: #f2c14e;
    --danger: #ff6b6b;
    --ok: #3fb950;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Верхня панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 17px; white-space: nowrap; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; }

/* ---------- Елементи форм і кнопки ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
  min-height: 38px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  min-height: 38px; padding: 7px 14px; border-radius: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.btn input[type=file] { display: none; }

/* ---------- Основна область ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* Панель інструментів реєстру: фільтри + перемикач виду */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar select { width: auto; max-width: 220px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--muted); font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { width: auto; min-height: 0; }

/* Перемикач «Таблиця / Фото» */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit; font-weight: 600; border: 0; background: var(--surface); color: var(--muted);
  padding: 7px 14px; cursor: pointer; min-height: 36px;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); }

/* ---------- Реєстр: таблиця ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; box-shadow: var(--shadow);
}
table.reg { width: 100%; border-collapse: collapse; }
.reg th, .reg td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.reg th {
  position: sticky; top: 0; background: var(--surface-2); font-size: 13px; color: var(--muted);
  font-weight: 600; white-space: nowrap; user-select: none;
}
.reg th[data-sort] { cursor: pointer; }
.reg th[data-sort]:hover { color: var(--text); }
.reg th .arrow { font-size: 11px; margin-left: 3px; }
.reg tbody tr { cursor: pointer; }
.reg tbody tr:hover { background: var(--accent-soft); }
.reg tbody tr:last-child td { border-bottom: 0; }
.reg td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reg td.name { font-weight: 600; min-width: 180px; }
.reg td.muted { color: var(--muted); font-size: 14px; }
.reg .thumb {
  width: 56px; height: 56px; border-radius: 6px; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border);
}
.noimg {
  display: grid; place-items: center; color: var(--muted);
  background: var(--surface-2); font-size: 22px;
}
.reg .noimg { width: 56px; height: 56px; border-radius: 6px; border: 1px dashed var(--border); }
.badge {
  display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; text-align: center;
}

/* ---------- Реєстр: плитки з фото ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow); color: var(--text);
  display: flex; flex-direction: column;
}
.tile:hover { border-color: var(--accent); }
.tile .ph { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; }
.tile .ph .noimg { position: absolute; inset: 0; font-size: 40px; }
.tile .ph .badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; }
.tile .body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.tile .t-name { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-qty { font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .big { font-size: 44px; }

/* ---------- Картка товару ---------- */
.item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.item-head h1 { font-size: 20px; margin: 0; flex: 1; min-width: 200px; }
.item-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.panel h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }

/* Галерея: велике фото + стрічка мініатюр */
.stage {
  position: relative; aspect-ratio: 4 / 3; background: var(--surface-2);
  border-radius: 8px; overflow: hidden; display: grid; place-items: center;
}
.stage img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.stage .noimg { position: absolute; inset: 0; font-size: 15px; text-align: center; padding: 16px; flex-direction: column; display: flex; align-items: center; justify-content: center; gap: 6px; }
.stage .noimg .big { font-size: 48px; }
.stage .main-flag {
  position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
}
.stage .counter {
  position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 13px; padding: 3px 9px; border-radius: 99px;
}
.stage.drop { outline: 3px dashed var(--accent); outline-offset: -6px; }

.strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 4px; scroll-snap-type: x proximity; }
.strip button {
  position: relative; flex: 0 0 auto; width: 74px; height: 74px; padding: 0; border-radius: 8px;
  border: 2px solid transparent; background: var(--surface-2); cursor: pointer; overflow: hidden; scroll-snap-align: start;
}
.strip button img { width: 100%; height: 100%; object-fit: cover; }
.strip button[aria-current=true] { border-color: var(--accent); }
.strip .star {
  position: absolute; left: 3px; top: 2px; color: var(--star); font-size: 16px;
  text-shadow: 0 0 3px rgba(0,0,0,.7);
}
.strip .pending { opacity: .55; }

.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-actions .grow { flex: 1; }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Прогрес завантаження */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Форма картки */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form .full { grid-column: 1 / -1; }
.form .qty { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.form-actions .spacer { flex: 1; }
.meta { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* Журнал змін */
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.events li { display: flex; gap: 8px; }
.events time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Лайтбокс ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center; touch-action: pan-y;
}
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; user-select: none; }
.lightbox button {
  position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff;
  font-size: 28px; width: 48px; height: 48px; border-radius: 50%; cursor: pointer;
}
.lightbox button:hover { background: rgba(255,255,255,.25); }
.lb-close { right: 14px; top: max(14px, env(safe-area-inset-top)); font-size: 22px !important; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #ddd; font-size: 14px; }

/* ---------- Спливаючі повідомлення ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); font-size: 14px;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* =====================================================================
   ЕТАП 2: адреси, швидке додавання, сканер, етикетки
   ===================================================================== */

/* Банер активної адреси в режимі швидкого додавання */
.active-loc {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  border: 2px solid var(--accent); background: var(--accent-soft);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
}
.active-loc .lbl { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.active-loc .path { font-size: 18px; font-weight: 700; line-height: 1.3; }
.active-loc .grow { flex: 1; min-width: 200px; }
.active-loc.none { border-style: dashed; border-color: var(--border); background: var(--surface); }
.active-loc select { width: auto; max-width: 100%; }

/* Підказки існуючих карток під полем назви */
.suggest { position: relative; }
.suggest-list {
  position: absolute; z-index: 15; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); max-height: 320px; overflow-y: auto;
}
.suggest-list button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; color: var(--text); font: inherit; padding: 8px 10px; cursor: pointer;
}
.suggest-list button:hover, .suggest-list button:focus { background: var(--accent-soft); }
.suggest-list img, .suggest-list .noimg { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; font-size: 16px; }
.suggest-list small { display: block; color: var(--muted); }
.chosen {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.chosen img, .chosen .noimg { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; font-size: 18px; }
.chosen .grow { flex: 1; min-width: 0; }

/* Блок «Де лежить» у картці */
.stock-table { width: 100%; border-collapse: collapse; }
.stock-table td, .stock-table th { padding: 6px 4px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.stock-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.stock-table input { width: 90px; min-height: 34px; padding: 5px 8px; text-align: right; }
.stock-table .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.stock-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.stock-add select { flex: 1 1 220px; width: auto; }
.stock-add input { width: 100px; }
.total-line { font-size: 15px; margin-bottom: 8px; }
.total-line b { font-size: 20px; }

/* Дерево адрес */
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { border-bottom: 1px solid var(--border); }
.tree .row { display: flex; align-items: center; gap: 8px; padding: 7px 4px; min-height: 44px; }
.tree .row:hover { background: var(--surface-2); }
.tree .ico { width: 22px; text-align: center; flex: 0 0 auto; }
.tree .nm { font-weight: 600; color: var(--text); }
.tree .kind { color: var(--muted); font-size: 12px; }
.tree .code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.tree .grow { flex: 1; min-width: 0; }
.tree .acts { display: flex; gap: 4px; flex: 0 0 auto; }
.tree .acts .btn { min-height: 30px; padding: 2px 8px; font-size: 13px; }
.addform {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; align-items: end;
  padding: 10px; margin: 4px 0 10px; background: var(--surface-2); border-radius: 8px;
}
.addform label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.addform .preview { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }

/* Сторінка адреси */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--accent); }
.loc-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.loc-head .qr { width: 120px; height: 120px; background: #fff; border-radius: 8px; padding: 4px; border: 1px solid var(--border); }
.loc-head .grow { flex: 1; min-width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
}
.chip:hover { border-color: var(--accent); }
.big-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Сканер */
.scanner { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 16px; }
.scan-box { width: min(480px, 100%); background: var(--surface); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.scan-title { font-weight: 700; text-align: center; }
.scan-video { position: relative; aspect-ratio: 1 / 1; background: #000; border-radius: 10px; overflow: hidden; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.scan-video.off { display: none; }
.scan-msg { font-size: 14px; color: var(--muted); text-align: center; min-height: 20px; }
.scan-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Друк етикеток */
.labels-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.sheet { display: grid; grid-template-columns: repeat(3, 64mm); gap: 3mm; justify-content: start; }
.label {
  width: 64mm; height: 34mm; background: #fff; color: #000; border: 1px dashed #bbb; border-radius: 2mm;
  display: flex; gap: 2mm; padding: 2mm; overflow: hidden; break-inside: avoid;
}
.label img { width: 30mm; height: 30mm; flex: 0 0 auto; }
.label .txt { display: flex; flex-direction: column; min-width: 0; justify-content: center; gap: .6mm; }
.label .k { font-size: 7pt; text-transform: uppercase; letter-spacing: .05em; color: #444; }
.label .n { font-size: 14pt; font-weight: 800; line-height: 1.05; word-break: break-word; }
.label .p { font-size: 6.5pt; color: #333; line-height: 1.15; max-height: 3.5em; overflow: hidden; }
.label .c { font: 700 8pt ui-monospace, Consolas, monospace; margin-top: auto; }

@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff !important; }
  .topbar, .labels-tools, .no-print, #toasts { display: none !important; }
  main { padding: 0; max-width: none; }
  .label { border-color: #ccc; }
}

/* ---------- Офлайн-режим ---------- */
.net-badge { font-size: 12px; font-weight: 700; color: #fff; background: var(--danger); padding: 4px 8px; border-radius: 99px; white-space: nowrap; }
body.anon .net-badge { display: none; }
.q-thumb { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; font-size: 20px; }
.queued td { opacity: .75; font-style: italic; }

/* ---------- Етап 4: пропозиція ШІ ---------- */
.ai-box { margin-top: 14px; border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px; background: var(--accent-soft); display: grid; gap: 8px; }
.ai-box.err { border-color: var(--danger); background: var(--surface); }
.ai-row { display: grid; grid-template-columns: 22px 130px 1fr; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.ai-row input { width: auto; min-height: 0; margin-top: 3px; }
.ai-row.same { opacity: .6; cursor: default; }
.ai-lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.ai-conf { display: block; font-size: 12px; font-weight: 700; }
.ai-val { word-break: break-word; }
.ai-pre { white-space: pre-wrap; font-size: 12px; background: var(--surface); padding: 8px; border-radius: 6px; margin: 6px 0; }
.ai-doubts ul, .ai-dups ul { margin: 4px 0; padding-left: 20px; font-size: 14px; }
.ai-dups { border-left: 3px solid var(--star); padding-left: 10px; }
@media (max-width: 640px) { .ai-row { grid-template-columns: 22px 1fr; } .ai-row .ai-val { grid-column: 2; } }

/* ---------- Етап 3: вхід, ролі, користувачі ---------- */
/* Поки вхід не виконано — ховаємо навігацію й пошук */
body.anon .topbar .search, body.anon .topbar .btn { display: none; }
/* Роль «Перегляд» — ховаємо кнопки змін (сервер однаково не дозволить) */
body[data-role=viewer] .need-edit { display: none !important; }
/* Лише адміністратор: архівування, перейменування адрес */
body:not([data-role=admin]) .need-admin { display: none !important; }
.auth-box { max-width: 380px; margin: 40px auto; }
.auth-box h1 { font-size: 22px; margin: 0 0 4px; }
.auth-box .form { grid-template-columns: 1fr; }
.auth-box .btn.primary { width: 100%; margin-top: 6px; }
.users-table td, .users-table th { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.users-table th { font-size: 12px; color: var(--muted); }
.users-table select { width: auto; }
.users-table tr.off td { opacity: .5; }

/* ---------- Етикетки для принтера P15 ---------- */
.p15-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.p15-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; }
.p15-img {
  width: 100%; height: auto; background: #fff; border: 1px solid #ccc; border-radius: 4px;
  image-rendering: pixelated;  /* показуємо точки принтера чітко, без розмиття */
}
.p15-acts { display: flex; gap: 8px; }
#p15tools label { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Картка адреси: фото + примітка ---------- */
.loc-card { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.chip-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; margin: -3px 0 -3px -6px; }
.tree .ico { width: 34px; }
.tree .ico img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
@media (max-width: 900px) { .loc-card { grid-template-columns: 1fr; } }

/* ---------- Чернетки (фото зараз — заповнення потім) ---------- */
.badge.draft { background: var(--star); color: #1b1f24; vertical-align: middle; }
.draft-banner {
  border: 1px solid var(--star); background: color-mix(in srgb, var(--star) 14%, var(--surface));
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
}
.draft-banner .hint { display: block; margin-top: 4px; }

/* ---------- Адаптивність ---------- */
@media (max-width: 900px) {
  .item-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .brand span, .hide-sm { display: none; }
  .form { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .toolbar select { max-width: none; flex: 1 1 40%; }
  /* У таблиці на телефоні ховаємо другорядні колонки */
  .reg .opt { display: none; }
  .lb-prev, .lb-next { display: none; } /* на телефоні — свайп */
}
