/* Dispatch Desk — office UI */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --panel-2: #f8fafc; --ink: #0f172a; --ink-2: #475569; --muted: #64748b;
  --line: #e2e8f0; --line-2: #cbd5e1;
  --brand: #0f2a4a; --brand-ink: #ffffff; --accent: #f59e0b; --accent-ink: #1f1300;
  --primary: #1d4ed8; --primary-ink: #fff; --primary-soft: #dbeafe;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --hot: #b91c1c; --hot-soft: #fee2e2;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 8px rgba(15, 23, 42, .05);
  --side: 220px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --panel: #111a2b; --panel-2: #0f1727; --ink: #e5e9f0; --ink-2: #b6c0cf; --muted: #8a96a8;
    --line: #1f2b40; --line-2: #2c3a54; --brand: #0a1a30; --primary: #3b82f6; --primary-soft: #172a4d;
    --ok: #4ade80; --ok-soft: #10301d; --warn: #fbbf24; --warn-soft: #3a2a08; --hot: #f87171; --hot-soft: #3d1414;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 0 0 8px; }
.sub-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
p { margin: 0 0 8px; }
code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.mono { font-family: var(--mono); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--hot); }
.ok-text { color: var(--ok); }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.loading { padding: 40px; color: var(--muted); text-align: center; }
[hidden] { display: none !important; }

/* ---------- shell */
#app { min-height: 100vh; }
nav.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--brand); color: #cbd5e1; display: flex; flex-direction: column; z-index: 30; }
nav.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--brand); font-size: 16px; flex: none; }
nav.side ul { list-style: none; margin: 0; padding: 4px 8px; flex: 1; overflow-y: auto; }
nav.side li a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-weight: 500; }
nav.side li a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
nav.side li a.active { background: rgba(255, 255, 255, .13); color: #fff; }
nav.side .ico { width: 20px; text-align: center; opacity: .9; }
nav.side .me { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; flex-direction: column; gap: 2px; color: #fff; }
nav.side .me .muted { color: #94a3b8; text-transform: capitalize; }
nav.side .me .link { color: #93c5fd; text-align: left; padding: 0; }
.topbar { display: none; }
main { margin-left: var(--side); padding: 22px 28px 60px; max-width: 1500px; outline: none; }
.nav-scrim { display: none; }

@media (max-width: 900px) {
  nav.side { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.nav-open nav.side { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .brand { color: #fff; font-weight: 700; flex: 1; }
  .topbar .icon-btn { color: #fff; font-size: 20px; }
  main { margin-left: 0; padding: 14px 14px 60px; }
}

/* ---------- page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { margin: 0 0 6px; font-size: 13px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:focus-visible, .icon-btn:focus-visible, .link:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--hot); border-color: var(--hot); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--hot); border-color: var(--hot-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.big { min-height: 46px; font-size: 15px; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; color: var(--ink-2); cursor: pointer; font-size: 15px; min-width: 32px; min-height: 32px; border-radius: 6px; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.danger:hover { color: var(--hot); }
.icon-btn[disabled] { opacity: .3; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.link.danger { color: var(--hot); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }

/* ---------- cards, grids, forms */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid-2, .grid-4 { display: grid; gap: 10px 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-4 .wide { grid-column: span 2; }
.grid-2 .full, .grid-4 .full { grid-column: 1 / -1; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } .grid-4 .wide { grid-column: auto; } }
.section-h { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.section-h:first-child { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--hot); }
.hint { color: var(--muted); font-size: 11px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; min-height: 36px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 60px; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
input[disabled], select[disabled], textarea[disabled] { background: var(--panel-2); color: var(--ink-2); }
input[type=file] { border: 0; padding: 0; min-height: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; padding: 6px 0; }
.checks { display: flex; gap: 6px 22px; flex-wrap: wrap; }
.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.form-actions.row { flex-direction: row; justify-content: space-between; }
details summary { cursor: pointer; color: var(--primary); font-weight: 600; margin: 10px 0; }

/* ---------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tfoot th { border-top: 2px solid var(--line-2); border-bottom: 0; font-size: 13px; color: var(--ink); text-transform: none; letter-spacing: 0; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: var(--panel-2); }
table.grid tr.clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
table.grid.compact td { padding: 6px 8px; }
table.grid td.num, table.grid th.num { text-align: right; }
.sub { color: var(--muted); font-size: 12px; }

/* ---------- chips / badges / alerts */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; text-transform: capitalize; }
.st-draft { background: var(--panel-2); color: var(--muted); }
.st-dispatched { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.st-acknowledged, .st-at_pickup, .st-in_transit, .st-at_delivery { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.st-delivered { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-completed, .st-invoiced { background: #ede9fe; color: #6d28d9; border-color: transparent; }
.st-paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.st-cancelled { background: var(--hot-soft); color: var(--hot); border-color: transparent; text-decoration: line-through; }
@media (prefers-color-scheme: dark) { .st-dispatched { background: #1e1b4b; color: #a5b4fc; border-color: #312e81; } .st-completed, .st-invoiced { background: #2e1065; color: #c4b5fd; } }
.ent-active { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ent-in_shop { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ent-out_of_service { background: var(--hot-soft); color: var(--hot); border-color: transparent; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; margin-left: 4px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.hot { background: var(--hot-soft); color: var(--hot); border-color: transparent; }
.alert { padding: 8px 12px; border-radius: 8px; margin: 0 0 8px; font-weight: 500; border: 1px solid transparent; }
.alert.error { background: var(--hot-soft); color: var(--hot); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.warnings.inline { margin-bottom: 10px; }
.sent-banner { display: flex; gap: 8px; align-items: center; }

/* ---------- board */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.counter { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--ink); font: inherit; box-shadow: var(--shadow); }
.counter b { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter span { color: var(--muted); font-size: 12px; font-weight: 600; }
.counter.hot { border-color: var(--hot); background: var(--hot-soft); }
.counter.hot b, .counter.hot span { color: var(--hot); }
.counter.warn { border-color: var(--warn); background: var(--warn-soft); }
.counter.warn b, .counter.warn span { color: var(--warn); }
.counter.active { outline: 2px solid var(--primary); outline-offset: -2px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters > * { width: auto; }
.filters .search { flex: 1 1 280px; }
.filters select { flex: 0 1 180px; }
.custom-range { display: inline-flex; gap: 6px; align-items: center; }
.group { margin-bottom: 18px; }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; gap: 8px; align-items: center; margin: 0 0 6px; }
.group-title .count { background: var(--line); color: var(--ink-2); border-radius: 999px; padding: 0 8px; font-size: 11px; }
.board-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty p { margin-bottom: 14px; }

/* ---------- dispatch form */
.dispatch-form { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.form-side .sticky { position: sticky; top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
@media (max-width: 1100px) {
  .dispatch-form { grid-template-columns: 1fr; }
  .form-side { order: 2; }
  .form-side .sticky { position: static; }
}
.cust-panel { margin-top: 10px; }
.cust-panel:empty { display: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0 0 8px; }
.kv > span, .kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; }
.kv.money dd, .kv.money b { text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { font-weight: 800; font-size: 15px; color: var(--ink); border-top: 1px solid var(--line-2); padding-top: 4px; }
.note { background: var(--warn-soft); color: var(--ink); border-radius: 6px; padding: 6px 9px; margin: 6px 0; white-space: pre-wrap; }
.note.small { font-size: 12px; background: var(--panel-2); }
.stops { display: flex; flex-direction: column; gap: 12px; }
fieldset.stop { position: relative; border: 1px solid var(--line-2); border-left: 5px solid var(--primary); border-radius: 8px; padding: 12px 14px 10px; margin: 0; background: var(--panel-2); }
fieldset.stop.delivery { border-left-color: var(--ok); }
fieldset.stop legend { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-weight: 700; }
fieldset.stop legend select { width: auto; min-height: 30px; padding: 3px 8px; font-weight: 700; }
.stop-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: 12px; }
.stop-tools { position: absolute; right: 8px; top: -2px; display: flex; gap: 2px; background: var(--panel); border-radius: 8px; }
.stop-foot { margin-top: 6px; font-size: 12px; }
.stop-add { display: flex; gap: 8px; }
.accessorials { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.accessorials .acc-row { align-self: stretch; }
.acc-row { display: grid; grid-template-columns: 1fr 140px 36px; gap: 8px; }
.totals { margin-top: 14px; max-width: 360px; margin-left: auto; }
.totals .kv { grid-template-columns: 1fr auto; }

/* ---------- dispatch detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line-2); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before { content: ''; position: absolute; left: -26px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 3px solid var(--primary); }
.timeline li.delivery::before { border-color: var(--ok); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.here::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(245, 158, 11, .25); }
.tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-type { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tl-times { font-size: 12px; color: var(--ok); margin-top: 3px; }
.docs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.doc { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.doc.new { border-color: var(--hot); background: var(--hot-soft); }
.doc-open { flex: 1; display: flex; gap: 10px; align-items: center; background: none; border: 0; text-align: left; cursor: pointer; color: var(--ink); font: inherit; padding: 0; min-width: 0; }
.doc-open img, .doc-icon { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; background: var(--panel-2); display: grid; place-items: center; font-weight: 800; font-size: 11px; color: var(--muted); border: 1px solid var(--line); }
.doc-text { display: flex; flex-direction: column; min-width: 0; }
.doc-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.doc-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 6px; }
.events { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.events li { display: grid; grid-template-columns: 120px 110px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.events .when { color: var(--muted); }
.events .who { font-weight: 600; }
@media (max-width: 560px) { .events li { grid-template-columns: 1fr; gap: 0; } }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); min-width: 220px; z-index: 10; padding: 4px; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; font: inherit; color: var(--ink); border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--panel-2); }
.big-number { font-family: var(--mono); font-size: 44px; font-weight: 800; letter-spacing: .12em; text-align: center; padding: 12px; background: var(--panel-2); border-radius: 10px; margin: 10px 0 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; }
.stat b { font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.hot { border-color: var(--hot); } .stat.hot b { color: var(--hot); }
ul.plain { list-style: none; padding: 0; margin: 0 0 10px; }
ul.plain li { padding: 4px 0; }
.notes-log { list-style: none; padding: 0; margin: 10px 0 0; }
.notes-log li { border-top: 1px solid var(--line); padding: 8px 0; }
.note-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.contact-form { margin: 8px 0; padding: 10px; background: var(--panel-2); border-radius: 8px; }
.logo-preview { max-height: 80px; max-width: 260px; display: block; margin-bottom: 8px; background: #fff; padding: 6px; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- modal, toasts */
.overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); font-weight: 600; transition: opacity .4s, transform .4s; }
.toast.error { background: var(--hot); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand), #1e3a5f 60%, var(--bg) 60%); }
.login-form { background: var(--panel); padding: 28px; border-radius: 14px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.warn-text { color: var(--warn, #b45309); font-weight: 600; }
.company-id-big { font: 800 34px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; color: var(--primary); padding: 10px 0; }
.login-form .center, .center { text-align: center; }
nav.side .me .company-id { text-transform: none; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; cursor: pointer; }
.check-row input { margin-top: 3px; }
.block { display: block; }
.app-login-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brand-big { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; margin-bottom: 4px; }

@media print {
  nav.side, .topbar, .page-head .actions, .filters, #toasts { display: none !important; }
  main { margin: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
ul.contacts { list-style: none; padding: 0; margin: 0 0 6px; }
ul.contacts li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.contact-lines { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.contact-lines a { overflow-wrap: anywhere; }

/* Board on a phone: each load becomes a card. */
@media (max-width: 700px) {
  .filters select, .filters .search { flex: 1 1 100%; }
  .board-table thead { display: none; }
  .board-table, .board-table tbody { display: block; background: none; border: 0; }
  .board-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
  table.grid.board-table td { border: 0; padding: 0; }
  table.grid.board-table tr.clickable:hover td { background: none; }
  .board-table .c-num { grid-column: 1; font-size: 15px; }
  .board-table .c-status { grid-column: 2; }
  .board-table .c-total { grid-column: 3; }
  .board-table .c-dates, .board-table .c-cust, .board-table .c-lane, .board-table .c-truck { grid-column: 1 / -1; }
  .board-table .c-load { grid-column: 1 / 3; }
  .board-table .c-docs { grid-column: 3; grid-row: 1; text-align: right; }
  .board-table .c-docs:empty { display: none; }
  .board-table .c-lane > div { display: inline; }
  .board-table .c-lane .sub { margin-left: 4px; }
}
.ai-fill { border-style: dashed; }
.ai-fill input[type=file] { max-width: 100%; }
.ai-hint { margin-bottom: 14px; }

/* ---------- owner page (owner.html) */
body.owner main.owner-main { margin: 0 auto; padding: 22px 28px 60px; max-width: 1400px; }
.owner-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--brand); color: #fff;
  padding: 10px 28px; padding-top: max(10px, env(safe-area-inset-top)); }
.owner-bar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-decoration: none; }
.owner-bar nav { display: flex; gap: 4px; flex: 1; }
.owner-bar nav a { color: #cbd5e1; padding: 7px 12px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.owner-bar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.owner-bar nav a.active { background: rgba(255, 255, 255, .13); color: #fff; }
.owner-bar .who { display: flex; gap: 10px; align-items: center; }
.owner-bar .who .muted { color: #94a3b8; }
.owner-bar .who .link { color: #93c5fd; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav b { min-width: 140px; text-align: center; }
.card.notice { border-color: var(--warn); background: var(--warn-soft); }
.owner-table td { vertical-align: middle; }
.inv-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.inv-cell .badge { margin-left: 0; }
.inv-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.config-line { white-space: pre-wrap; word-break: break-all; font: 12px/1.4 var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; user-select: all; }
.login-form.wide-form { width: min(560px, 100%); }
.owner-cols { align-items: start; }
.owner-cols > .card { margin-bottom: 0; }
.owner-cols + .card { margin-top: 14px; }
@media (max-width: 900px) {
  .owner-bar { padding: 10px 14px; gap: 10px; }
  .owner-bar nav { order: 3; flex-basis: 100%; }
  body.owner main.owner-main { padding: 14px 14px 60px; }
  .owner-cols { grid-template-columns: 1fr; }
  .owner-cols > .card { margin-bottom: 14px; }
}
.card form .grid-4 + .grid-4 { margin-top: 10px; }

/* ---------- sign-up follow-up: confirm-email banner, welcome note, getting started */
.confirm-banner { margin-left: var(--side); display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 16px; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line); font-size: 13px; }
@media (max-width: 900px) { .confirm-banner { margin-left: 0; } }
.notice-box { background: var(--primary-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.getting-started .progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: -2px 0 12px; }
.getting-started .progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.getting-started ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.getting-started li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; }
.getting-started li > div { flex: 1; min-width: 0; }
.getting-started li.next { background: var(--primary-soft); }
.getting-started li.ok b { color: var(--muted); text-decoration: line-through; font-weight: 600; }
.getting-started .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.getting-started li.ok .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
