/* Colours taken from the Farsley Transport logo */
:root {
  --ink: #102033; --muted: #5d6e80; --line: #dbe3ec; --line2: #eef2f6; --bg: #eef3f8; --panel: #fff;
  --brand: #0a4a8c; --brand2: #0b7fc1; --brand-soft: #e6f1fb; --brand-deep: #073566;
  --amber: #e89a00; --amber-soft: #fff4dc; --red: #c43a28; --red-soft: #fdebe8;
  --green: #1d7d4c; --green-soft: #e3f4ea; --cyan-soft: #def3fb; --violet-soft: #eee8fb;
  --radius: 10px; --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(16,32,51,.06), 0 2px 8px rgba(16,32,51,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.r { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- Office shell ---------- */
.demo-bar { background: var(--brand-deep); color: #c9dcf0; font-size: 12px; padding: 4px 20px; display: flex; gap: 10px; align-items: center; }
.demo-bar strong { color: #fff; font-weight: 600; }
.demo-bar button { margin-left: auto; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 1px 10px; font-size: 12px; }
.masthead { background: #fff; display: flex; align-items: center; gap: 20px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.masthead img { height: 42px; display: block; }
.masthead .app-name { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 14px; line-height: 1.2; }
.masthead .app-name b { display: block; color: var(--brand); font-size: 15px; }
.tools { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); }
.tools select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: #fff; color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; color: var(--ink); font-weight: 500; }
.switch input { appearance: none; width: 36px; height: 20px; background: #c4cfdb; border-radius: 10px; position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand2); }
.switch input:checked::after { left: 18px; }
.btn-phone { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; font-weight: 600; }
.btn-phone:hover { background: var(--brand2); }
.navband { background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%); position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 6px rgba(7,53,102,.18); }
.nav { display: flex; gap: 4px; padding: 0 14px; }
.nav a { color: #dcebfa; text-decoration: none; padding: 11px 16px; font-weight: 600; border-bottom: 3px solid transparent; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on { color: #fff; border-bottom-color: #fff; }

.layout { display: flex; align-items: flex-start; }
.main { flex: 1; min-width: 0; padding: 20px; }
.phone-panel { width: 410px; flex: none; position: sticky; top: 44px; height: calc(100vh - 44px); background: #dde6ef; border-left: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 14px 0; }
.phone-panel .ph-head { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.phone-frame { width: 370px; flex: 1; max-height: 790px; border: 10px solid #121a24; border-radius: 34px; overflow: hidden; background: #000; box-shadow: 0 14px 34px rgba(7,53,102,.28); }
.phone-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

h1 { font-size: 22px; margin: 0; color: var(--brand-deep); }
h2 { font-size: 15px; margin: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.spacer { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 14px; font-weight: 600; text-decoration: none; color: var(--ink); display: inline-block; line-height: 1.3; }
.btn:hover { border-color: #b3c3d4; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand2); border-color: var(--brand2); }
.btn.small { padding: 3px 10px; font-size: 12.5px; }
.btn.icon { padding: 3px 12px; font-size: 20px; line-height: 1.2; }
.btn.link { border: 0; background: none; color: var(--brand2); padding: 0; text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: default; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel.pad { padding: 18px; }
.kbd { font: 11px var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #fff; }
.viewonly { background: var(--brand-soft); color: var(--brand); font-weight: 700; border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-unallocated { background: var(--amber-soft); color: #8a5a00; }
.st-allocated { background: var(--brand-soft); color: var(--brand); }
.st-in_progress, .st-collected { background: var(--cyan-soft); color: #075f86; }
.st-delivered { background: var(--green-soft); color: var(--green); }
.st-closed { background: #e6eaef; color: #2b3746; }
.st-exported { background: var(--violet-soft); color: #4b3296; }
.st-cancelled { background: var(--red-soft); color: var(--red); }
.ts-empty { background: #e9eef3; color: #3d4b5a; }
.ts-part_loaded { background: var(--amber-soft); color: #8a5a00; }
.ts-loaded { background: var(--brand-soft); color: var(--brand); }
.ts-off_road { background: var(--red-soft); color: var(--red); }
.flag { color: var(--red); font-weight: 700; margin-left: 4px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--line2); color: var(--muted); margin-left: 6px; font-weight: 700; vertical-align: 1px; }
.tag.agency { background: var(--amber-soft); color: #8a5a00; }
.tag.subcontract { background: var(--violet-soft); color: #4b3296; }
.haz { display: inline-block; background: #f07800; color: #fff; font-weight: 800; font-size: 10.5px; padding: 0 5px; border-radius: 3px; vertical-align: 1px; }

/* ---------- Board ---------- */
.datebar { display: flex; align-items: center; gap: 6px; }
.datebar input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; font-weight: 600; }
.today-tag { background: var(--brand-soft); color: var(--brand); font-weight: 700; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; }
.blocks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.blk { border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; color: #fff; box-shadow: var(--shadow); }
.blk b { font-size: 26px; line-height: 1.1; font-weight: 800; }
.blk span { font-size: 12.5px; font-weight: 600; opacity: .92; }
.b-total { background: var(--brand-deep); }
.b-amber { background: var(--amber); }
.b-blue { background: var(--brand); }
.b-cyan { background: var(--brand2); }
.b-green { background: var(--green); }
.b-red { background: var(--red); }
.blk.zero { background: #fff; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.seg-tabs { display: inline-flex; gap: 4px; background: #dfe7f0; padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.seg-tabs a { padding: 6px 14px; text-decoration: none; color: #3b4d61; font-weight: 600; border-radius: 7px; }
.seg-tabs a .n { font-weight: 700; font-size: 11.5px; background: rgba(10,74,140,.1); color: var(--brand); border-radius: 999px; padding: 0 7px; margin-left: 6px; }
.seg-tabs a:hover { background: rgba(255,255,255,.6); }
.seg-tabs a.on { background: #fff; color: var(--brand-deep); box-shadow: 0 1px 3px rgba(16,32,51,.15); }
.seg-tabs a.warn .n { background: var(--amber); color: #fff; }

.groups { display: flex; flex-direction: column; gap: 12px; }
.grp { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.grp-unalloc { border-left-color: var(--amber); }
.grp-unalloc .grp-h { background: var(--amber-soft); }
.grp-net { border-left-color: #9aa8b6; }
.grp.drop { outline: 3px dashed var(--brand2); outline-offset: -3px; background: var(--brand-soft); }
.grp-h { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: #f5f8fb; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; flex: none; }
.grp-net .avatar { background: #8494a5; }
.grp-title { font-weight: 700; font-size: 15px; color: var(--brand-deep); }
.badge { background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 0 8px; }
.grp-hint { color: #8a5a00; font-size: 12.5px; }
.asg { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fld { display: inline-flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 12.5px; }
.fld > span { padding: 4px 8px; background: var(--line2); color: var(--muted); font-weight: 600; font-size: 11.5px; }
.fld select, .fld input[type=time] { border: 0; background: transparent; padding: 4px 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); max-width: 150px; }
.fld.chk { padding: 4px 8px; gap: 6px; }
.fld.chk span { background: none; padding: 0; color: var(--ink); font-size: 12.5px; }
.fld select:disabled, .fld input:disabled { color: var(--ink); opacity: 1; appearance: none; }
.grp-empty { padding: 12px 16px; color: var(--muted); font-style: italic; }
.grp-empty.net { color: #5d6e80; }
.allclear { background: var(--green-soft); color: var(--green); font-weight: 700; padding: 14px 16px; border-radius: var(--radius); }

table.board { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.board th { text-align: left; font-weight: 700; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding: 7px 10px; border-bottom: 1px solid var(--line2); }
.board td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; overflow: hidden; text-overflow: ellipsis; }
.board tr:last-child td { border-bottom: 0; }
.board tr.job:hover td { background: #f7fafd; }
.board tr.job.attn td { background: #fff6f4; }
.board tr.job.attn td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.board .jobno { white-space: nowrap; }
.board .jobno a { font-weight: 800; text-decoration: none; color: var(--brand); font-size: 13.5px; }
.board .place b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .place span { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .cmt { color: #3b4d61; font-size: 12.5px; }
.board select.cell { width: 100%; border: 1px solid var(--line); background: #fff; padding: 3px 4px; border-radius: 6px; font-size: 12.5px; }
.board .drvname { font-weight: 600; }
tr.job[draggable=true] { cursor: grab; }
.ord { display: inline-flex; flex-direction: column; vertical-align: middle; margin-right: 3px; }
.ord button { border: 0; background: none; padding: 0 2px; line-height: 9px; font-size: 9px; color: #9aa8b6; }
.ord button:hover:not(:disabled) { color: var(--brand); }
.ord button:disabled { opacity: .3; }
.foot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.foot .panel { padding: 12px 16px; }
.foot h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 0 0 8px; }
.pill { display: inline-flex; gap: 6px; border: 1px solid var(--line); background: #f7f9fb; border-radius: 999px; padding: 3px 11px; margin: 2px 6px 2px 0; font-size: 12.5px; font-weight: 600; }
.pill i { font-style: normal; color: var(--muted); font-weight: 500; }

/* ---------- Forms ---------- */
.form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 18px; }
.form .full { grid-column: 1 / -1; }
.form .half { grid-column: span 2; }
.form-sec { grid-column: 1 / -1; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--brand); border-bottom: 2px solid var(--brand-soft); padding-bottom: 4px; margin-top: 6px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.field label .req { color: var(--red); }
.field input[type=text], .field input[type=number], .field input[type=date], .field input:not([type]), .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.field textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(11,127,193,.22); border-color: var(--brand2); }
.checks { display: flex; gap: 18px; align-items: center; padding-top: 24px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.stops { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.stop-row { display: grid; grid-template-columns: 110px 1.4fr 1.4fr 1fr 110px 120px 32px; gap: 8px; align-items: end; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.stop-row.collect { border-left: 5px solid var(--brand2); }
.stop-row.deliver { border-left: 5px solid var(--green); }
.stop-row .x { height: 36px; border: 0; background: none; color: var(--muted); font-size: 18px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; }
.err { color: var(--red); font-weight: 600; }
.success { border: 1px solid #b9e1c8; background: var(--green-soft); border-radius: var(--radius); padding: 14px 18px; display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.success .big { font-size: 22px; font-weight: 800; color: var(--green); }

/* ---------- Job detail ---------- */
.grid2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.card-h { padding: 11px 18px; border-bottom: 1px solid var(--line2); background: #f5f8fb; border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; gap: 8px; }
.card-b { padding: 14px 18px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 7px 12px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.stoplist { list-style: none; padding: 0; margin: 0; }
.stoplist li { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.stoplist li:last-child { border: 0; }
.stoplist .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand2); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 12px; }
.stoplist .n.deliver { background: var(--green); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line2); }
.timeline li:last-child { border: 0; }
.timeline time { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pod { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.pod img { max-height: 140px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.attn-box { background: var(--red-soft); border: 1px solid #f1c3bb; color: #7d1f12; border-radius: var(--radius); padding: 11px 16px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
.mapbox { width: 100%; height: 260px; border: 0; display: block; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Trailers ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.card { border-radius: var(--radius); padding: 12px 16px; color: #fff; box-shadow: var(--shadow); }
.card .v { font-size: 28px; font-weight: 800; line-height: 1.1; }
.card .l { font-size: 12.5px; font-weight: 600; opacity: .92; }
.c-green { background: var(--green); } .c-blue { background: var(--brand); } .c-amber { background: var(--amber); } .c-red { background: var(--red); }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); background: #f5f8fb; }
.list th:first-child { border-radius: var(--radius) 0 0 0; } .list th:last-child { border-radius: 0 var(--radius) 0 0; }
.list td { padding: 10px 14px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list tr.stale td:first-child { box-shadow: inset 4px 0 0 var(--amber); }
.list .edit-row td { background: var(--brand-soft); }
.inline-form { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: 10px; align-items: end; }
.hist { font-size: 12.5px; margin: 0; padding-left: 18px; color: #3b4d61; }
.filters { display: inline-flex; gap: 4px; background: #dfe7f0; padding: 4px; border-radius: 10px; }
.filters button { border: 0; background: none; border-radius: 7px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: #3b4d61; }
.filters button.on { background: #fff; color: var(--brand-deep); box-shadow: 0 1px 3px rgba(16,32,51,.15); }

/* ---------- Close-out ---------- */
.list input.money { width: 92px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; text-align: right; }
.over { color: var(--red); font-weight: 600; }
.step-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; }

/* ---------- Map ---------- */
.mapgrid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.mapgrid .panel { overflow: hidden; }
.mlist { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 230px); overflow: auto; }
.mlist button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line2); background: #fff; padding: 10px 14px; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; }
.mlist button:hover { background: #f7fafd; }
.mlist button.on { background: var(--brand-soft); box-shadow: inset 4px 0 0 var(--brand); }
.mlist b { display: block; color: var(--brand-deep); }
.mlist small { color: var(--muted); display: block; font-size: 12.5px; }
.bigmap { width: 100%; height: calc(100vh - 290px); min-height: 420px; border: 0; display: block; }
.mapnote { font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-top: 1px solid var(--line2); background: #f8fafc; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--brand-deep); color: #fff; padding: 11px 20px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; font-weight: 600; max-width: 90vw; box-shadow: 0 8px 24px rgba(7,53,102,.3); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--red); }

@media (max-width: 1500px) { .phone-panel { display: none; } }
@media (max-width: 1100px) { .blocks { grid-template-columns: repeat(3, 1fr); } }
@media print {
  .demo-bar, .navband, .phone-panel, .datebar, .no-print, .tools { display: none !important; }
  .main { padding: 0; } body { background: #fff; } .grp, .panel { box-shadow: none; }
}

/* ---------- Driver app ---------- */
.drv-app { --d-bg: #eef3f8; --d-card: #fff; --d-ink: #102033; --d-muted: #5d6e80; --d-line: #dbe3ec;
  font-size: 17px; background: var(--d-bg); color: var(--d-ink); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
@media (prefers-color-scheme: dark) {
  .drv-app { --d-bg: #0b1420; --d-card: #16212e; --d-ink: #eef3f8; --d-muted: #9fb0c2; --d-line: #273648; }
  body.driver-mode { background: #0b1420; }
}
body.driver-mode { background: #eef3f8; }
.d-top { background: linear-gradient(90deg, var(--brand) 0%, var(--brand2) 100%); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; display: flex; align-items: center; gap: 10px; min-height: 58px; position: sticky; top: 0; z-index: 5; }
.d-top .t { font-weight: 700; font-size: 18px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-top button { background: none; border: 0; color: #fff; font-size: 20px; min-height: 44px; min-width: 40px; padding: 0 6px; }
.sendind { font-size: 13px; background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px 10px; white-space: nowrap; font-weight: 600; }
.d-body { flex: 1; padding: 14px 14px 120px; }
.d-logo { background: #fff; border-radius: 16px; padding: 18px; margin-bottom: 18px; text-align: center; }
.d-logo img { max-width: 100%; height: auto; max-height: 90px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--d-line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg button { border: 0; background: none; min-height: 44px; border-radius: 9px; font-weight: 700; color: var(--d-muted); font-size: 16px; }
.seg button.on { background: var(--d-card); color: var(--d-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.jcard { display: block; width: 100%; text-align: left; background: var(--d-card); border: 1px solid var(--d-line); border-left: 6px solid var(--brand2); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; color: var(--d-ink); text-decoration: none; }
.jcard.done { border-left-color: var(--green); opacity: .75; }
.jcard .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.jcard .no { font-weight: 800; font-size: 19px; }
.jcard .stt { font-size: 13px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--d-bg); color: var(--d-muted); }
.jcard .cust { color: var(--d-muted); font-size: 15px; }
.jcard .next { margin-top: 10px; font-weight: 700; font-size: 18px; }
.jcard .next small { display: block; font-weight: 500; color: var(--d-muted); font-size: 15px; }
.d-empty { text-align: center; color: var(--d-muted); padding: 40px 10px; }
.dstop { background: var(--d-card); border: 1px solid var(--d-line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.dstop .h { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.dstop .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--brand2); flex: none; }
.dstop.deliver .n { background: var(--green); }
.dstop.done { opacity: .6; }
.dstop .what { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--d-muted); font-weight: 800; }
.dstop .where { font-weight: 700; }
.dstop .st { margin-left: auto; font-size: 14px; color: var(--d-muted); text-align: right; font-weight: 600; }
.dstop .more { padding: 0 14px 14px; }
.dstop .addr { line-height: 1.35; font-size: 18px; }
.instr { background: #fff4dc; color: #4a3500; border-left: 4px solid var(--amber); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 16px; }
@media (prefers-color-scheme: dark) { .instr { background: #3a2f12; color: #ffe6a6; } }
.dbtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; border-radius: 14px; border: 1px solid var(--d-line); background: var(--d-card); color: var(--d-ink); font-size: 17px; font-weight: 700; text-decoration: none; }
.dbtn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.dbtn.go { background: var(--green); border-color: var(--green); color: #fff; }
.drow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.dbtn.on { background: #fff4dc; border-color: var(--amber); color: #6b4a00; }
.d-actionbar { position: sticky; bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--d-bg) 75%, transparent); }
.slide { position: relative; height: 60px; border-radius: 16px; background: var(--green); color: #fff; font-weight: 700; display: grid; place-items: center; user-select: none; touch-action: none; overflow: hidden; }
.slide.blue { background: var(--brand); }
.slide .knob { position: absolute; left: 4px; top: 4px; width: 52px; height: 52px; border-radius: 12px; background: #fff; color: var(--green); display: grid; place-items: center; font-size: 28px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.slide.blue .knob { color: var(--brand); }
.slide .lbl { padding-left: 50px; font-size: 17px; }
.d-field { margin-bottom: 14px; }
.d-field label { display: block; font-weight: 700; margin-bottom: 6px; }
.d-field input, .d-field textarea { width: 100%; min-height: 52px; font-size: 18px; border-radius: 12px; border: 1px solid var(--d-line); padding: 10px 12px; background: var(--d-card); color: var(--d-ink); }
.sigpad { width: 100%; height: 190px; background: #fff; border: 2px dashed var(--d-line); border-radius: 12px; touch-action: none; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--d-line); background: var(--d-card); color: var(--d-ink); font-size: 16px; font-weight: 600; }
.chips button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.thumbs img { width: 86px; height: 86px; object-fit: cover; border-radius: 10px; border: 1px solid var(--d-line); }
.step { font-size: 13px; color: var(--brand2); font-weight: 800; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.d-info { background: var(--d-card); border: 1px solid var(--d-line); border-radius: 14px; padding: 6px 16px; margin-bottom: 12px; }
.d-info .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--d-line); }
.d-info .row:last-child { border: 0; }
.d-note { font-size: 14px; color: var(--d-muted); text-align: center; margin-top: 16px; }
.picker button { display: flex; justify-content: space-between; width: 100%; min-height: 56px; align-items: center; padding: 0 16px; margin-bottom: 8px; border-radius: 12px; border: 1px solid var(--d-line); background: var(--d-card); color: var(--d-ink); font-size: 17px; font-weight: 600; }
.d-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: var(--d-muted); }
.d-meta span { background: var(--d-bg); border-radius: 8px; padding: 2px 9px; font-weight: 600; }
.d-meta span.haz { background: #f07800; color: #fff; }
.board .place b .tag { display: inline-block; font-size: 10.5px; }
.board .place b span.tag { color: var(--muted); }
.masthead img { height: 46px; }
.btn-undo, .btn-save { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 600; color: var(--ink); }
.btn-undo:disabled { opacity: .45; cursor: default; }
.btn-save.dirty { background: var(--amber); border-color: var(--amber); color: #fff; }
.demo-bar #discard { margin-left: auto; }
.demo-bar #discard + #reset { margin-left: 0; }
/* Job page: row 1 = Details beside the Route map (same height); row 2 = Stops beside the driver record */
.jobgrid > .routecard { align-self: stretch; display: flex; flex-direction: column; }
.jobgrid > .routecard .mapbox { flex: 1; height: auto; min-height: 260px; }
/* Row 2: Stops and the driver record share one height; POD sits below the record */
.jobgrid > .stopscard, .jobgrid > .stopscard + section { align-self: stretch; }
.jobgrid > .podcard { grid-column: 2; }

/* ---------- Fixed shell: header, nav band and page title stay put; only the data scrolls ---------- */
#app.office-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
#app.office-shell > .demo-bar, #app.office-shell > .masthead, #app.office-shell > .navband { flex: none; }
#app.office-shell .navband { position: relative; }
#app.office-shell .layout { flex: 1; min-height: 0; align-items: stretch; }
#app.office-shell .main { overflow-y: auto; padding-top: 0; scroll-padding-top: 70px; }
#app.office-shell .main > .page-head { position: sticky; top: 0; z-index: 15; background: var(--bg); margin: 0 -20px 12px; padding: 16px 20px 12px; }
#app.office-shell .phone-panel { position: static; height: auto; }
@media print {
  #app.office-shell { height: auto; display: block; overflow: visible; }
  #app.office-shell .layout { display: block; }
  #app.office-shell .main { overflow: visible; }
  #app.office-shell .main > .page-head { position: static; }
}

/* Booking form sized to fit the screen without scrolling */
.form.compact { gap: 10px 16px; padding: 14px 16px; }
.form.compact .stops { gap: 6px; }
.form.compact .stop-row { padding: 6px 10px; }
.form.compact .field label { margin-bottom: 2px; }
.form.compact .field input, .form.compact .field select { padding: 6px 10px; }
.form.compact .field textarea { min-height: 52px; padding: 6px 10px; }
.form.compact .checks { padding-top: 20px; }
.form.compact .stop-add { grid-column: 1 / -1; margin-top: -4px; }
.success.compact { padding: 8px 14px; margin: 0 0 10px; }
.success.compact .big { font-size: 18px; }

/* Board: compact day summary sits in the fixed title bar, vehicle tabs on the row below */
.blocks.mini { display: flex; gap: 6px; margin: 0 0 0 8px; }
.blocks.mini .blk { flex-direction: row; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; line-height: 1; min-height: 30px; }
.blocks.mini .blk b { font-size: 17px; }
.blocks.mini .blk span { font-size: 11.5px; white-space: nowrap; }
.page-head > .row-break { flex-basis: 100%; height: 0; }
.page-head > .seg-tabs { margin: 0; }
.blocks.mini { flex: 1 1 auto; margin: 0 0 0 16px; }
.blocks.mini .blk { flex: 1 1 0; min-width: 120px; justify-content: center; }
/* Trailer log: the summary blocks double as filters */
.tblocks .blk { border: 0; font: inherit; cursor: pointer; transition: filter .15s, box-shadow .15s; }
.tblocks .blk:hover { filter: brightness(1.12); }
.tblocks .blk.on { opacity: 1; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand-deep); }
/* Board: vehicle tabs all the same width */
.page-head > .seg-tabs a { width: 132px; text-align: center; }
/* Trailer log blocks match the board's block width and sit right-aligned, so they line up when switching pages
   (the board title row uses about 511px for its title, date bar, margin and gaps) */
.blocks.mini.tblocks { flex: none; margin-left: auto; width: calc((100% - 511px) * 5 / 6 + 24px); }
.page-head > .seg-tabs + .btn { margin-left: auto; }
.main > .page-head > h1 { min-height: 36px; display: flex; align-items: center; } /* same row height on every page, so the blocks line up */

/* Fill from email (AI) */
.btn.ai-btn { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn.ai-btn:hover { background: var(--brand2); border-color: var(--brand2); }
.ai-dlg { border: 0; border-radius: 14px; padding: 0; width: min(760px, 92vw); box-shadow: 0 20px 60px rgba(7,53,102,.35); }
.ai-dlg::backdrop { background: rgba(7,30,56,.45); }
.ai-box { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ai-h h2 { margin: 0 0 2px; color: var(--brand-deep); font-size: 18px; }
.ai-box textarea { width: 100%; min-height: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 13px/1.45 var(--font); resize: vertical; }
.ai-box textarea:focus { outline: 3px solid rgba(11,127,193,.22); border-color: var(--brand2); }
.ai-drop { border: 2px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; color: var(--muted); }
.ai-drop.hot { border-color: var(--brand2); background: var(--brand-soft); }
.ai-files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.ai-files .pill button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.ai-foot { display: flex; align-items: center; gap: 10px; }
.ai-status { font-size: 13px; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--brand-soft); border-top-color: var(--brand2); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-filled { background: #fff6d6 !important; border-color: var(--amber) !important; }
label.ai-filled { border-radius: 6px; padding: 2px 6px; margin: -2px -6px; }
.ai-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; background: var(--brand); border: 1px solid var(--brand); color: #fff; border-radius: var(--radius); padding: 8px 14px; margin: 0 0 10px; font-size: 13px; position: relative; padding-right: 36px; }
.ai-bar .ai-notes { color: #d6e6f7; flex-basis: 100%; font-size: 12.5px; }
.ai-bar .x { position: absolute; right: 8px; top: 4px; border: 0; background: none; font-size: 18px; color: #fff; cursor: pointer; }
.stop-row.locked { opacity: .75; }
.stop-row .x.lock { display: grid; place-items: center; font-size: 14px; }
.poditem + .poditem { border-top: 1px solid var(--line2); margin-top: 12px; padding-top: 12px; }
.podstop { font-weight: 700; color: var(--brand-deep); margin-bottom: 4px; }
.ai-dlg[open]:not(:modal) { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 8990; }
.demo-bar .guide-link { margin-left: auto; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 1px 10px; text-decoration: none; }
.demo-bar .guide-link:hover { background: rgba(255,255,255,.12); }
.demo-bar .guide-link ~ button, .demo-bar .guide-link ~ #discard { margin-left: 0; }

/* Send to driver */
.btn.small.send { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.small.send:hover { background: var(--brand2); border-color: var(--brand2); }
.board td .btn.small.send { display: block; margin-top: 4px; padding: 2px 8px; font-size: 11.5px; white-space: nowrap; }
.board td .sent { display: block; margin-top: 3px; font-size: 11.5px; color: var(--green); font-weight: 600; white-space: nowrap; }
.board td .unsent { display: block; margin-top: 3px; font-size: 11.5px; color: #8a5a00; font-weight: 600; }
.grp-h .btn.small.send { padding: 2px 10px; font-size: 12px; }
