/* Stock Hub — clean, flat operations UI. All colours are central tokens: change them here. */
:root {
  color-scheme: light;
  --ink: #0F172A;          /* top bar, selected chips */
  --ink-2: #1E293B;
  --ink-3: #334155;
  --bg: #F4F5F7;           /* working surface */
  --panel: #FFFFFF;
  --panel-2: #F8FAFC;
  --border: #E3E6EB;
  --border-strong: #CBD5E1;
  --text: #111827;
  --muted: #5B6474;
  --faint: #8A93A3;
  --accent: #2563EB;       /* primary actions + selected states */
  --accent-hover: #1D4ED8;
  --accent-weak: #EFF6FF;
  --accent-ink: #1E3A8A;
  --focus: 0 0 0 3px rgba(37, 99, 235, .45);

  --ok-bg: #DCFCE7;  --ok-ink: #14532D;
  --sold-bg: #B91C1C; --sold-ink: #FFFFFF; --sold-weak: #FEF2F2;
  --gxo-bg: #E0F2FE; --gxo-ink: #0C4A6E;
  --site-bg: #EEF2F7; --site-ink: #1E293B;
  --transit-bg: #FEF3C7; --transit-ink: #78350F;
  --other-bg: #F3E8FF; --other-ink: #581C87;
  --auction-bg: #EDE9FE; --auction-ink: #4C1D95;
  --warn-bg: #FEF3C7; --warn-ink: #7C2D12; --warn-line: #D97706;
  --danger: #B91C1C; --danger-weak: #FEF2F2;
  --plate: #F6CE1C;

  --radius: 8px;
  --radius-lg: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 56px;
  --bottomnav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.4; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: 1px 4px; border-radius: 4px; }
h1, h2, h3 { margin: 0; letter-spacing: .02em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1[tabindex="-1"]:focus, main:focus { outline: none; box-shadow: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.upper { text-transform: uppercase; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- auth pages ---------- */
.auth-page { background: var(--bg); }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.auth-name { font-weight: 700; letter-spacing: .08em; }
.auth-site { font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.auth-title { font-size: 18px; letter-spacing: .06em; }
.auth-help { margin: 0; font-size: 13px; color: var(--muted); }
.auth-legal { margin: 0; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; display: flex; gap: 6px; align-items: flex-start; }
.auth-legal svg { flex: none; margin-top: 2px; }
.auth-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.form-error { margin: 0; background: var(--danger-weak); color: var(--danger); border: 1px solid #FCA5A5; border-radius: var(--radius); padding: 10px 12px; font-weight: 600; }
.form-notice { margin: 0; background: var(--accent-weak); color: var(--accent-ink); border-radius: var(--radius); padding: 10px 12px; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); }
.label .opt { font-weight: 400; color: var(--faint); letter-spacing: 0; text-transform: none; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; background: #fff; border: 1px solid var(--border-strong);
  border-radius: var(--radius); font-size: 16px; /* 16px stops iOS zooming */
}
.textarea { min-height: 84px; resize: vertical; }
.input-upper, .textarea.input-upper { text-transform: uppercase; }
.input-upper::placeholder { text-transform: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); background: #FFFBFB; }
.hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--danger); font-weight: 600; }
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 1px; top: 1px; bottom: 1px; min-height: 42px; min-width: 64px; border: 0; border-left: 1px solid var(--border); background: var(--panel-2); border-radius: 0 7px 7px 0; font-size: 12px; font-weight: 700; letter-spacing: .05em; cursor: pointer; color: var(--ink-3); }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 10px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented button { min-height: 44px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: #fff; font-weight: 600; cursor: pointer; }
.segmented button[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-weak); color: var(--accent-ink); padding: 0 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; background: var(--panel); min-width: 0; }
legend { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); padding: 0 6px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: #fff; font-weight: 700; letter-spacing: .03em; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { border-color: var(--danger); color: var(--danger); background: #fff; }
.btn-danger:hover { background: var(--danger-weak); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #991B1B; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { min-height: 52px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 10px; font-size: 13px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); border: 0; background: transparent; cursor: pointer; color: inherit; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(0,0,0,.15); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------- badges & identifiers ---------- */
.plate { display: inline-block; background: var(--plate); color: #111; font-family: var(--mono); font-weight: 700; padding: 2px 7px; border-radius: 4px; border: 1px solid rgba(17,17,17,.2); letter-spacing: .06em; white-space: nowrap; line-height: 1.3; }
.plate-lg { font-size: 18px; padding: 3px 10px; }
.unreg { display: inline-block; background: #fff; color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 4px; border: 1px dashed #9CA3AF; white-space: nowrap; letter-spacing: .04em; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; line-height: 1.3; }
.b-available { background: var(--ok-bg); color: var(--ok-ink); }
.b-sold { background: var(--sold-bg); color: var(--sold-ink); }
.b-gxo { background: var(--gxo-bg); color: var(--gxo-ink); }
.b-onsite { background: var(--site-bg); color: var(--site-ink); }
.b-transit { background: var(--transit-bg); color: var(--transit-ink); }
.b-other { background: var(--other-bg); color: var(--other-ink); }
.b-unknown { background: #fff; color: var(--muted); border: 1px dashed #9CA3AF; }
.b-cat { background: #fff; color: var(--ink-3); border: 1px solid var(--border-strong); }
.b-auction { background: var(--auction-bg); color: var(--auction-ink); }
.b-warn { background: var(--warn-bg); color: var(--warn-ink); }
.b-danger { background: var(--danger-weak); color: var(--danger); border: 1px solid #FCA5A5; }
.b-demo { background: #fff; color: #9A3412; border: 1px dashed #EA580C; }
.b-archived { background: var(--ink-3); color: #fff; }
.age-amber { color: #B45309; font-weight: 700; }
.age-red { color: var(--danger); font-weight: 700; }

/* ---------- app chrome ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); background: var(--ink); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; min-height: 44px; }
.brand .brand-mark { width: 30px; height: 30px; background: var(--accent); border-radius: 7px; }
.brand-name { font-weight: 700; letter-spacing: .08em; font-size: 14px; line-height: 1.1; }
.brand-site { font-size: 11px; color: #94A3B8; letter-spacing: .08em; }
.topnav { display: flex; gap: 2px; margin-left: 12px; }
.topnav a { color: #CBD5E1; text-decoration: none; padding: 0 12px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 6px; font-weight: 600; font-size: 13px; letter-spacing: .05em; }
.topnav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.topnav a[aria-current="page"] { background: var(--ink-2); color: #fff; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #CBD5E1; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; }
.live.offline .dot { background: #F59E0B; }
.live.offline { color: #FCD34D; }
.usermenu { position: relative; }
.usermenu > button { color: #E2E8F0; border: 1px solid #334155; border-radius: 8px; padding: 0 10px; min-height: 40px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 6px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); min-width: 220px; padding: 6px; box-shadow: 0 10px 30px rgba(15,23,42,.18); z-index: 50; }
.menu button, .menu a { display: flex; width: 100%; text-align: left; min-height: 44px; align-items: center; padding: 0 12px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--panel-2); }
.menu .menu-head { padding: 8px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.bottomnav { display: none; }
main { padding: 14px 16px 32px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.boot { min-height: 60vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }

.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 600; font-size: 14px; flex-wrap: wrap; }
.banner-offline { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #FCD34D; }
.banner-error { background: var(--danger-weak); color: var(--danger); border: 1px solid #FCA5A5; }
.banner-info { background: var(--accent-weak); color: var(--accent-ink); border: 1px solid #BFDBFE; }
.banner .btn { min-height: 36px; }

/* ---------- stock screen ---------- */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; min-height: 64px; display: flex; flex-direction: column; justify-content: space-between; }
.tile:hover { border-color: var(--border-strong); }
.tile[aria-pressed="true"] { border: 2px solid var(--accent); padding: 9px 11px; background: var(--accent-weak); }
.tile .t-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.tile .t-num { font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile.t-sold { border-left: 4px solid var(--sold-bg); border-radius: 0 var(--radius) var(--radius) 0; }
.tile.t-auction { border-left: 4px solid #6D28D9; border-radius: 0 var(--radius) var(--radius) 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .input { padding-left: 40px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.filters { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; margin-bottom: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.count-line { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: auto; max-height: calc(100vh - 290px); min-height: 240px; }
table.stock { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.stock th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.stock th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.stock th button:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
table.stock td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--panel); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.stock tbody tr { cursor: pointer; }
table.stock tbody tr:hover td { background: #F8FAFF; }
table.stock tbody tr.is-sold td { background: var(--sold-weak); }
table.stock tbody tr.is-selected td { background: var(--accent-weak); }
table.stock tbody tr:focus-visible { outline: none; }
table.stock tbody tr:focus-visible td { box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
table.stock .sticky-l { position: sticky; left: 0; z-index: 1; }
table.stock .sticky-l2 { position: sticky; z-index: 1; }
table.stock th.sticky-l, table.stock th.sticky-l2 { z-index: 3; }
table.stock td.sticky-edge, table.stock th.sticky-edge { box-shadow: 1px 0 0 var(--border); }
.col-actions { text-align: right; }
table.stock td.col-actions, table.stock th.col-actions { position: sticky; right: 0; z-index: 1; box-shadow: -1px 0 0 var(--border); }
table.stock th.col-actions { z-index: 3; }
table.stock td.wrap { white-space: normal; min-width: 150px; }
table.stock td.wrap .badge { white-space: normal; }

.cards { display: none; }
.vcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left; width: 100%; }
.vcard.is-sold { border-left: 5px solid var(--sold-bg); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.vcard .v-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vcard .v-ref { font-family: var(--mono); font-size: 14px; color: var(--ink-3); font-weight: 600; }
.vcard .v-model { font-size: 15px; font-weight: 700; }
.vcard .v-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.vcard .v-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.vcard mark, table.stock mark { background: #FEF08A; color: inherit; border-radius: 2px; }
.vcard-actions { display: flex; gap: 8px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty h2 { color: var(--text); margin-bottom: 6px; }

/* ---------- vehicle details panel ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(15,23,42,.18); }
.drawer-head { background: var(--panel); border-bottom: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.drawer-body { overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.detail-hero { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.detail-hero .v-model { font-size: 18px; font-weight: 700; }
.detail-hero .v-deriv { color: var(--muted); font-size: 14px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.actions .btn { width: 100%; }
.actions .btn, .vcard-actions .btn { white-space: normal; min-width: 0; line-height: 1.15; text-align: center; }
.actions .span-2 { grid-column: span 2; }
.sold-lock { grid-column: span 2; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--sold-weak); color: var(--danger); font-weight: 700; font-size: 13px; border: 1px solid #FCA5A5; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.card h2 { font-size: 12px; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--border); position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.timeline .t-type { font-weight: 700; letter-spacing: .03em; }
.timeline .t-meta { color: var(--muted); font-size: 12px; }
.diff { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border-radius: 6px; padding: 6px 8px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- dialogs & sheets ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--panel); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.dialog-wide { max-width: 820px; }
.dialog-head { padding: 14px 16px 8px; display: flex; align-items: flex-start; gap: 8px; }
.dialog-head h2 { font-size: 16px; flex: 1; letter-spacing: .05em; padding-top: 10px; }
.dialog-sub { font-size: 13px; color: var(--muted); padding: 0 16px 8px; }
.dialog-body { padding: 8px 16px 12px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dialog-foot { padding: 12px 16px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); flex-wrap: wrap; }
.grabber { display: none; }
.loc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.loc-tile { min-height: 56px; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; font-weight: 700; letter-spacing: .04em; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; text-align: center; }
.loc-tile small { font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0; }
.loc-tile[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-weak); color: var(--accent-ink); }
.loc-tile.is-current { color: var(--faint); border-style: dashed; }
.callout { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.callout-warn { background: var(--warn-bg); border-color: #FCD34D; color: var(--warn-ink); }
.callout-danger { background: var(--danger-weak); border-color: #FCA5A5; color: var(--danger); }
.confirm-id { display: flex; flex-direction: column; gap: 6px; background: var(--panel-2); border-radius: var(--radius); padding: 12px; }
.compare { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare th, .compare td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.compare th { font-size: 11px; color: var(--muted); letter-spacing: .05em; }
.compare .changed td { background: #FFFBEB; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 14px; border-radius: var(--radius); font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: center; pointer-events: auto; box-shadow: 0 10px 30px rgba(15,23,42,.3); }
.toast.t-ok::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #22C55E; flex: none; }
.toast.t-err { background: var(--danger); }

/* ---------- admin ---------- */
.subnav { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.subnav a { padding: 0 12px; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: .05em; border-bottom: 3px solid transparent; white-space: nowrap; }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
table.plain { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); }
table.plain th { text-align: left; font-size: 11px; color: var(--muted); letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--panel-2); position: sticky; top: 0; }
table.plain td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.scroll-x { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); }
.list-rows { display: flex; flex-direction: column; }
.list-rows > * { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-rows > *:last-child { border-bottom: 0; }
.stat { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.imp-row-ERROR td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.imp-row-WARNING td:first-child { box-shadow: inset 4px 0 0 var(--warn-line); }
.imp-row-OK td:first-child { box-shadow: inset 4px 0 0 #16A34A; }
.imp-row-EXCLUDED td { color: var(--faint); text-decoration: line-through; }
.issue { font-size: 12px; margin: 2px 0; }
.issue-ERROR { color: var(--danger); font-weight: 600; }
.issue-WARNING { color: var(--warn-ink); }
.issue-INFO { color: var(--muted); }
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: #16A34A; }

/* ---------- desktop vs phone ---------- */
@media (max-width: 899px) {
  :root { --topbar-h: 52px; }
  body.app-page { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  .topnav { display: none; }
  .brand-site { display: none; }
  .usermenu > button .um-name { display: none; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--border); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; min-height: 44px; }
  .bottomnav a[aria-current="page"] { color: var(--accent); }
  main { padding: 10px 12px 24px; }
  .tiles { display: flex; overflow-x: auto; gap: 8px; margin: 0 -12px 10px; padding: 0 12px; scrollbar-width: none; }
  .tile { min-width: 132px; flex: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 10px; padding: 0 12px; scrollbar-width: none; }
  .sticky-search { position: sticky; top: var(--topbar-h); z-index: 20; background: var(--bg); margin: 0 -12px; padding: 8px 12px; }
  .table-wrap { display: none; }
  .cards { display: flex; flex-direction: column; gap: 8px; }
  .desk-only { display: none !important; }
  .btn-sm, .chip { min-height: 44px; }
  .input, .select { min-height: 48px; }
  .drawer { width: 100vw; box-shadow: none; }
  .drawer-backdrop { display: none; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .dialog { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .grabber { display: block; width: 40px; height: 4px; background: var(--border-strong); border-radius: 2px; margin: 8px auto 0; }
  .dialog-foot { flex-direction: column-reverse; }
  .dialog-foot .btn { width: 100%; min-height: 52px; }
  .toasts { bottom: calc(var(--bottomnav-h) + 16px + env(safe-area-inset-bottom)); }
  .kv { grid-template-columns: minmax(110px, 42%) 1fr; }
}
@media (min-width: 900px) {
  .phone-only { display: none !important; }
}
@media print {
  .topbar, .bottomnav, .toolbar, .chips, .tiles, .drawer, .modal-backdrop { display: none !important; }
  .table-wrap { max-height: none; overflow: visible; border: 0; }
}
