/* HaulDesk - styles. Offline app: system fonts only (Bahnschrift ships with Windows 10/11). */
:root {
  --bg: #F1F3F1; --surface: #FFFFFF; --surface-2: #F7F8F6; --ink: #16202B; --muted: #5B6773; --line: #DCE0DF;
  --accent: #B86E0C; --accent-ink: #FFFFFF; --accent-soft: #F6E7CF;
  --rail: #16202B; --rail-ink: #C9D1D8; --rail-active: #F2B544;
  --ok: #1F7A4D; --ok-soft: #DDF0E5; --warn: #9A6400; --warn-soft: #FBEBC8; --bad: #B3261E; --bad-soft: #F8DEDB; --info: #23609E; --info-soft: #DCE8F5;
  --display: Bahnschrift, "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0F151B; --surface: #172029; --surface-2: #1C2631; --ink: #E6EBEF; --muted: #94A1AD; --line: #2A3642;
    --accent: #F0A83A; --accent-ink: #1A1206; --accent-soft: #3A2A12;
    --rail: #0A0F14; --rail-ink: #AEB9C3;
    --ok: #5CC98E; --ok-soft: #173526; --warn: #E9B64F; --warn-soft: #3A2E12; --bad: #F08A80; --bad-soft: #3D1D1A; --info: #7DB3EA; --info-soft: #18293B;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
svg { width: 18px; height: 18px; flex: none; }

.app { display: grid; grid-template-columns: 224px 1fr; min-height: 100%; }
.sidenav { background: var(--rail); color: var(--rail-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 0 10px; display: flex; flex-direction: column; gap: 4px; }
.brand .logo { font-family: var(--display); font-weight: 700; font-size: 26px; color: #fff; line-height: 1; letter-spacing: .01em; }
.brand .logo span { color: var(--rail-active); }
.brand b { font-weight: 500; color: var(--rail-ink); font-size: 12.5px; }
#sidenav { display: flex; flex-direction: column; gap: 2px; }
#sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--rail-ink); text-decoration: none; font-weight: 500; }
#sidenav a span { flex: 1; }
#sidenav a:hover { background: rgba(255,255,255,.06); }
#sidenav a.on { background: rgba(242,181,68,.14); color: #fff; box-shadow: inset 3px 0 0 var(--rail-active); }
#sidenav a:focus-visible, .bottomnav a:focus-visible { outline: 2px solid var(--rail-active); outline-offset: 1px; }
.navcount { font-style: normal; font-family: var(--mono); font-size: 11px; background: rgba(255,255,255,.1); border-radius: 10px; padding: 0 7px; }
.navcount:empty { display: none; }
.navcount.hot { background: #B3261E; color: #fff; }
.netstate { margin-top: auto; padding: 0 10px; font-size: 12.5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3DBA78; margin-right: 6px; }
.dot.off { background: var(--rail-active); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 28px 6px; }
.topbar h1 { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0; flex: 1; line-height: 1.1; }
.content { padding: 12px 28px 48px; display: flex; flex-direction: column; gap: 16px; }
.banner { margin: 8px 28px 0; padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }

.btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 7px 12px; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, .open-slot:focus-visible, .list-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.pill { border-radius: 999px; }
.btn.big { width: 100%; padding: 14px; font-size: 16px; font-weight: 600; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: default; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters .btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters .btn[aria-pressed="true"] .muted { color: inherit; opacity: .7; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.search { border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; padding: 7px 10px; min-width: 0; width: 280px; max-width: 100%; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2x { grid-template-columns: 1.4fr 1fr; align-items: start; }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.card.flush { padding: 0; }
.card h2 { font-family: var(--display); font-size: 20px; font-weight: 600; margin: 0 0 10px; }
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-h.wrap { flex-wrap: wrap; }
.card-h.plain { padding: 0 0 10px; border: 0; }
.card-h h2, .card-h h3 { margin: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.stat .v { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v.warn { color: var(--warn); }
.stat .n { font-size: 12px; color: var(--muted); }

.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tr.inactive td { opacity: .55; }
.tbl .empty, .empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.r { text-align: right; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.pad { padding: 12px 16px; margin: 0; }
.sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.lane { font-weight: 500; white-space: nowrap; }
.lane .arrow { color: var(--accent); margin: 0 6px; }

.chip { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; text-decoration: none; }
.c-ok { background: var(--ok-soft); color: var(--ok); }
.c-warn { background: var(--warn-soft); color: var(--warn); }
.c-bad { background: var(--bad-soft); color: var(--bad); }
.c-info { background: var(--info-soft); color: var(--info); }
.c-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.c-accent { background: var(--accent-soft); color: var(--accent); }

.alerts { display: flex; flex-direction: column; }
.alert { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.alert:last-child { border-bottom: 0; }
.alert:hover { background: var(--surface-2); }
.welcome { max-width: 680px; }
.welcome p { max-width: 62ch; }

/* dispatch board */
.board { display: grid; grid-template-columns: 160px repeat(7, minmax(96px, 1fr)); min-width: 860px; }
.board .hd { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.board .hd.today { color: var(--accent); }
.board .tr { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.board .cell { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); min-height: 64px; padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.board .cell.today { background: var(--accent-soft); }
.bar { display: block; border-radius: 6px; padding: 5px 7px; font-size: 11.5px; line-height: 1.25; background: var(--info-soft); color: var(--info); text-decoration: none; border: 1px solid transparent; }
.bar b { display: block; }
.bar.done { background: var(--ok-soft); color: var(--ok); }
.bar.booked { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.open-slot { all: unset; cursor: pointer; font-size: 11.5px; color: var(--muted); padding: 6px; border-radius: 6px; border: 1px dashed transparent; }
.open-slot:hover { border-color: var(--line); color: var(--accent); }

/* load detail */
.load-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.lane-big { font-family: var(--display); font-size: 28px; margin: 4px 0; }
.lane-big .lane { white-space: normal; }
.load-status { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.steps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.step { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.step i { height: 6px; border-radius: 3px; background: var(--line); }
.step.on i { background: var(--accent); }
.step.on span { color: var(--ink); font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.warnbox { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 10px 0 0; }
.files { display: flex; flex-direction: column; padding: 8px 16px 14px; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fname { flex: 1; min-width: 120px; overflow-wrap: anywhere; }

/* forms and modals */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form.one { grid-template-columns: 1fr; margin-bottom: 12px; }
.form h3 { grid-column: 1 / -1; margin: 6px 0 -4px; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--accent); }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.form label small { font-weight: 400; }
.form .full { grid-column: 1 / -1; }
.form input, .form select, .form textarea { border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; padding: 8px 10px; font-weight: 400; color: var(--ink); font-size: 14px; width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus, .search:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; font-size: 13.5px; }
.form label.check input { width: auto; }
.calc { display: flex; flex-wrap: wrap; gap: 20px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 14px; }
.calc div { display: flex; flex-direction: column; }
.calc span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.calc b { font-family: var(--mono); font-size: 16px; }
.attach { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; font-size: 12px; font-weight: 600; color: var(--muted); }
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,20,.55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; z-index: 40; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: min(520px, 100%); }
.modal.wide { width: min(760px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-family: var(--display); font-size: 21px; margin: 0; }
.modal-b { padding: 16px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

.list { display: flex; flex-direction: column; }
.list-row { all: unset; cursor: pointer; display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 90px; gap: 10px; align-items: center; }
.hbar .track { background: var(--surface-2); border-radius: 4px; height: 14px; }
.hbar .track div { height: 100%; background: var(--accent); border-radius: 4px; }
.hbar b { text-align: right; }

/* driver mode */
.driver { max-width: 460px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.drv-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--rail); color: #fff; padding: 14px 16px; border-radius: 12px; }
.drv-top .sub { color: var(--rail-ink); }
.drv-card { display: flex; flex-direction: column; gap: 12px; }
.dsteps { display: flex; gap: 4px; }
.dsteps i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.dsteps i.on { background: var(--accent); }
.stop { display: grid; grid-template-columns: 24px 1fr; gap: 10px; }
.pin { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.pin.d { background: var(--ink); color: var(--bg); }

.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.more-item { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); }
.more-item svg { width: 24px; height: 24px; color: var(--accent); }
.bottomnav { display: none; }

/* print (fee invoice) */
#print { display: none; }
@media print {
  body.printing .app, body.printing .bottomnav, body.printing .toast, body.printing .modal-bg { display: none !important; }
  body.printing #print { display: block; }
  body { background: #fff; color: #000; }
  .inv { font: 12px/1.5 "Segoe UI", Arial, sans-serif; color: #000; }
  .inv h1 { margin: 0; font-size: 22px; } .inv h2 { margin: 0; font-size: 16px; text-transform: uppercase; }
  .inv-h { display: flex; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 14px; }
  .inv-to { margin-bottom: 14px; }
  .inv table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
  .inv th, .inv td { border-bottom: 1px solid #bbb; padding: 6px; text-align: left; }
  .inv .r { text-align: right; }
}


/* team & login */
.userbox { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.05); }
.userbox:empty { display: none; }
.userbox b { color: #fff; font-weight: 600; font-size: 13px; }
.userbox > div { flex: 1; min-width: 0; }
.userbox .sub { color: var(--rail-ink); }
.userbox .btn { background: transparent; color: var(--rail-ink); border-color: rgba(255,255,255,.2); }
.av { width: 44px; height: 44px; border-radius: 50%; background: var(--rail-active); color: #16202B; display: grid; place-items: center; font-weight: 700; flex: none; }
.av.sm { width: 32px; height: 32px; font-size: 12px; }
.login-screen { position: fixed; inset: 0; z-index: 200; background: #16202B; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.login-box { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-box .logo { font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 1; }
.login-box .logo span { color: var(--accent); }
.login-box p { margin: 0; }
.login-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.login-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.login-tile.last, .login-tile:hover, .login-tile:focus-visible { border-color: var(--accent); outline: none; }
.login-tile small { color: var(--muted); }
.login-who { display: flex; align-items: center; gap: 12px; justify-content: center; text-align: left; }
#pinForm { display: flex; flex-direction: column; gap: 10px; max-width: 300px; width: 100%; margin: 0 auto; }
#pinIn { font-size: 22px; letter-spacing: .3em; text-align: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); }
#pinIn:focus { outline: 2px solid var(--accent); }
.linkbtn { all: unset; cursor: pointer; color: var(--info); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; align-self: center; }
.linkbtn:focus-visible { outline: 2px solid var(--accent); }
.warnbox.info { background: var(--warn-soft); color: var(--warn); margin: 0 0 10px; }
.lanebox { margin-top: 10px; font-size: 13px; line-height: 1.6; }
.lanebox:empty { display: none; }
.msgbox { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 10px; font-family: var(--mono); font-size: 13px; color: var(--ink); }
.more-item { font: inherit; text-align: left; cursor: pointer; }


.rcdrop { border: 1.5px dashed var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.rcdrop label { display: flex; flex-direction: column; gap: 2px; }
.rcdrop label span { font-size: 12.5px; color: var(--muted); }
.rcstatus { font-size: 13px; line-height: 1.6; }
.rcstatus:empty { display: none; }
.form .autofilled { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }

.linkbox { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 10px; font-family: var(--mono); font-size: 13px; color: var(--ink); }

@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2x, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidenav { display: none; }
  .topbar { padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 4px; }
  .topbar h1 { font-size: 25px; }
  .content { padding: 10px 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .banner { margin: 8px 16px 0; }
  .form { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .load-status { align-items: flex-start; }
  .hbar { grid-template-columns: 1fr 80px; } .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .search { width: 100%; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--rail); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30; }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--rail-ink); text-decoration: none; font-size: 11px; padding: 4px; border-radius: 6px; }
  .bottomnav a.on { color: var(--rail-active); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.tbl td b.mono { white-space: nowrap; }
