/* TTAH Transportation, Phase 1 styles. */

:root {
  --navy: #1d3557;
  --ink: #1b2430;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f5f6f8;
  --card: #fff;
  --blue: #2463c7;   --blue-bg: #e8f0fc;
  --green: #1e7b4b;  --green-bg: #e5f4ec;
  --amber: #a15c00;  --amber-bg: #fff3dc;
  --red: #c2352b;    --red-bg: #fdecea;
  --yellow: #8a6500; --yellow-bg: #fff4cc; --yellow-line: #e3b21b;
  --gray-bg: #eef0f3;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body.modal-open { overflow: hidden; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }

/* ---------- layout: left sidebar */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 190px; flex: none; background: var(--navy); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; padding: 0 6px; }
.brand:hover { text-decoration: none; }
.logo { background: #fff; color: var(--navy); font-weight: 800; font-size: 12px; letter-spacing: .04em; padding: 5px 7px; border-radius: 5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: #cdd8ea; padding: 8px 10px; border-radius: 6px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: #8fa2c0; padding: 0 6px; line-height: 1.6; }
.sidebar-foot .linklike { color: #b9cae6; font-size: 11px; }
#main { flex: 1; min-width: 0; padding: 22px 26px 40px; max-width: 1400px; }
.user-pick { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.user-pick select { font-size: 12px; min-height: 30px; padding: 3px 6px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.user-pick option { color: var(--ink); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head > .muted { margin-right: auto; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; margin-bottom: 6px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.toolbar { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; max-width: 860px; margin-left: auto; margin-right: auto; }
.doc-width { max-width: 860px; margin-left: auto; margin-right: auto; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-ink { color: var(--ink); }
.ok { color: var(--green); font-size: 12px; font-weight: 600; white-space: nowrap; }
.audit { font-size: 11.5px; color: #8a94a6; margin-top: 8px; line-height: 1.5; }
td .audit { margin-top: 2px; }
.panel-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.banner { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--amber-bg); color: #6b3d00; border: 0; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font: inherit; cursor: pointer; text-align: left; }
.banner .chev { margin-left: auto; color: inherit; }
.empty { color: var(--muted); padding: 14px; text-align: center; font-size: 13px; }
.note { background: var(--blue-bg); color: #1b3f7a; padding: 9px 12px; border-radius: 6px; margin: 0 auto 12px; font-size: 13px; max-width: 860px; }
.modal .note { max-width: none; }
.note.amber { background: var(--amber-bg); color: #6b3d00; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 1px solid #cfd6e1; background: #fff; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; min-height: 36px; }
.btn:hover { background: #f5f7fa; text-decoration: none; }
.btn-sm { padding: 3px 9px; font-size: 13px; min-height: 30px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #1c54ad; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #a82c24; }
.btn:disabled { opacity: .55; cursor: default; }
body.busy { cursor: progress; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--ink); }
.btn-block { width: 100%; margin-bottom: 10px; }
.linklike { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.icon-btn { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid #cfd6e1; border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 14px; font: inherit; font-weight: 500; cursor: pointer; color: var(--muted); min-height: 34px; }
.seg button.on { background: var(--navy); color: #fff; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #cfd6e1; background: #fff; border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.chip.match { border-color: var(--blue); background: var(--blue-bg); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; vertical-align: 1px; }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: var(--gray-bg); color: var(--muted); }
.badge.slate { background: #e9edf3; color: #475467; }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.faded { background: var(--gray-bg); color: #98a2b3; }

input, select, textarea { font: inherit; font-size: 16px; padding: 6px 9px; border: 1px solid #cfd6e1; border-radius: 6px; background: #fff; color: var(--ink); min-height: 36px; }
.filters select, .filters input, .cal-filters select { font-size: 14px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0f5; border-color: var(--blue); }
input:disabled, select:disabled { background: #f3f4f6; color: #6b7280; }

/* ---------- Home */
.attn { display: flex; flex-direction: column; }
.attn-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; background: none; border: 0; border-top: 1px solid var(--line); font: inherit; color: inherit; cursor: pointer; text-align: left; }
.attn-row:first-child { border-top: 0; }
.attn-row:hover { background: #f8fafc; }
.attn-row > span:nth-child(2) { flex: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.amber { background: #e0a33b; }
.dot.gray { background: #98a2b3; }
.dot.yellow { background: var(--yellow-line); }
.dot.red { background: var(--red); }
.chev { color: var(--muted); font-size: 18px; line-height: 1; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--line); color: inherit; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: #f8fafc; text-decoration: none; }

/* ---------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 7px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f8fafc; }
.tbl tr.row-muted td { color: #98a2b3; }
.tbl tr.row-add td { background: #fffbf3; }
.tbl input[type=text], .tbl input[type=tel] { width: 100%; min-width: 110px; }
.table-foot { padding: 8px 9px 0; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filters input[type=search] { flex: 1; min-width: 160px; }
.tbl .filter-row td { padding: 0 6px 8px; border-bottom: 0; }
.tbl .filter-row td:first-child { padding-left: 0; }
.filter-row select, .filter-row input { width: 100%; min-width: 120px; font-size: 13px; min-height: 32px; padding: 4px 6px; }

/* ---------- calendar */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { margin: 0; min-width: 190px; text-align: center; font-size: 16px; }
.cal-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding: 5px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfc; }
.cal-cell { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; min-height: 92px; padding: 4px; background: #fff; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font: inherit; color: inherit; cursor: pointer; min-width: 0; }
.cal-cell:hover { background: #f7f9fc; }
.cal-cell.out { background: #fbfbfc; }
.cal-cell.out .cal-num { color: #b0b8c4; }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-cell.today .cal-num { background: var(--navy); color: #fff; border-radius: 999px; }
.cal-num { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-evs { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev { font-size: 11px; line-height: 1.3; padding: 0 4px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
/* Route colors: GRAY expected/unconfirmed · YELLOW confirmed · GREEN invoiced · FADED GRAY cancelled */
.ev-expected { background: #eef0f3; color: #475467; border: 1px dashed #98a2b3; }
.ev-confirmed { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-line); }
.ev-invoiced { background: var(--green-bg); color: var(--green); border: 1px solid #8fcca9; }
.ev-cancelled { background: #f6f7f9; color: #b0b8c4; text-decoration: line-through; border: 1px solid transparent; }
.cal-count { display: none; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* week view: the main working view */
.wk-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wk-day { display: flex; flex-direction: column; min-width: 0; min-height: 360px; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; }
.wk-day.today { background: #fff; border-color: var(--navy); box-shadow: inset 0 3px 0 var(--navy); }
.wk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 4px; padding: 9px 8px 7px; border-bottom: 1px solid var(--line); }
.wk-dow { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); }
.wk-date { font-size: 12px; color: var(--muted); }
.wk-day.today .wk-date { color: var(--navy); font-weight: 600; }
.wk-add { min-height: 26px; padding: 0 8px; font-size: 18px; line-height: 1; }
.wk-bulk { display: flex; gap: 4px; margin: 6px 6px 0; }
.wk-bulk .btn { flex: 1; min-height: 28px; padding: 2px 6px; font-size: 12px; }
.day-bulk { display: flex; gap: 8px; margin-bottom: 10px; }
.day-bulk .btn { flex: 1; }
.wk-runs { display: flex; flex-direction: column; gap: 6px; padding: 6px; }
.wk-none { font-size: 12px; color: #b0b8c4; text-align: center; padding: 10px 0; }
.wk-run { background: #fff; border: 1px solid var(--line); border-left: 3px solid #b6bfcc; border-radius: 6px; min-width: 0; }
.wk-body { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 7px 5px; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; }
.wk-body:hover { background: #f5f8fc; }
.wk-body > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-time { font-size: 12px; font-weight: 700; }
.wk-cust { font-size: 13px; font-weight: 600; }
.wk-sub { font-size: 12px; color: var(--muted); }
.wk-acts { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 6px 6px; }
.wk-acts .btn { flex: 1; min-height: 28px; padding: 2px 6px; font-size: 12px; }
.wk-expected { background: #f2f4f7; border-color: #cfd5de; border-style: dashed; border-left: 4px solid #98a2b3; }
.wk-confirmed { background: var(--yellow-bg); border-color: #f0d27a; border-left: 4px solid var(--yellow-line); }
.wk-invoiced { background: var(--green-bg); border-color: #b7e0c7; border-left: 4px solid var(--green); }
.wk-cancelled { opacity: .5; }
.mark { font-size: 11px; font-weight: 700; color: inherit; opacity: .8; margin-left: 2px; }
.wk-confirmed .mark { color: var(--yellow); }
.wk-invoiced .mark { color: var(--green); }
.wk-cancelled .wk-cust { text-decoration: line-through; }

.day-panel { position: sticky; top: 14px; }
.runs { display: flex; flex-direction: column; gap: 6px; }
.run { display: grid; grid-template-columns: 64px 1fr; gap: 2px 8px; border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.run-time { font-weight: 600; font-size: 13px; padding-top: 1px; }
.run-main { min-width: 0; }
.run-main a { color: var(--ink); }
.run-note { font-size: 12px; color: var(--muted); font-style: italic; }
.run-actions { grid-column: 2; display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.run-actions:empty { display: none; }
.run-expected { background: #f7f8fa; border-style: dashed; border-left: 4px solid #98a2b3; }
.run-confirmed { background: #fffbea; border-left: 4px solid var(--yellow-line); }
.run-invoiced { background: #f4fbf7; border-left: 4px solid var(--green); }
.run-cancelled { opacity: .55; }

/* ---------- customer */
.info { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.fin > div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.fin > div:last-child { border-bottom: 0; }
.fin-bal b { font-size: 18px; }
.hist-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.hist-row:first-child { border-top: 0; }

/* choose invoice / email */
.choice-route { margin-bottom: 10px; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice { display: flex; flex-direction: column; gap: 2px; text-align: left; background: #fff; border: 1px solid #cfd6e1; border-radius: 8px; padding: 11px 13px; font: inherit; color: inherit; cursor: pointer; }
.choice:hover { border-color: var(--blue); background: var(--blue-bg); }
.choice span { font-size: 13px; color: var(--muted); }
.attach { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; justify-self: start; background: #fafbfc; }
.attach-icon { background: var(--red); color: #fff; font-size: 9px; font-weight: 800; padding: 2px 4px; border-radius: 3px; }

/* ---------- forms / modal */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: #475467; }
.field input, .field select, .field textarea { width: 100%; }
.span-2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { min-height: 0; width: 18px; height: 18px; }
.hint { font-size: 12px; min-height: 0; }
.form-error { background: var(--red-bg); color: var(--red); padding: 7px 10px; border-radius: 6px; margin-top: 10px; font-size: 13px; }
.form-error[hidden] { display: none; }
.day-picks { display: flex; gap: 5px; flex-wrap: wrap; }
.day-picks label { cursor: pointer; }
.day-picks input { position: absolute; opacity: 0; pointer-events: none; }
.day-picks span { display: inline-block; padding: 6px 10px; border: 1px solid #cfd6e1; border-radius: 6px; font-size: 13px; }
.day-picks input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }

.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 16px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 10px; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-card.wide { max-width: 640px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 10px 10px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast[hidden] { display: none; }
.toast .linklike { color: #9cc0f5; font-weight: 600; }

/* ---------- invoice / statement documents */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; max-width: 860px; margin: 0 auto 14px; padding: 40px 44px; }
.doc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 16px; border-bottom: 2px solid var(--navy); }
.doc-brand { display: flex; gap: 10px; align-items: flex-start; }
.doc-brand .logo { background: var(--navy); color: #fff; font-size: 14px; padding: 8px 10px; }
.doc-kind { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: .06em; }
.doc-meta { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; flex-wrap: wrap; }
.label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.meta-tbl { border-collapse: collapse; }
.meta-tbl td { padding: 2px 0 2px 16px; }
.meta-tbl td:first-child { color: var(--muted); padding-left: 0; }
.doc-lines th { background: #f5f7fa; }
.doc-totals { margin-left: auto; max-width: 340px; margin-top: 10px; }
.tot-row { display: flex; justify-content: space-between; gap: 16px; padding: 4px 9px; }
.tot-row.grand { border-top: 2px solid var(--navy); margin-top: 4px; padding-top: 8px; font-size: 17px; font-weight: 700; }
.doc-addr { color: var(--muted); line-height: 1.5; margin-top: 2px; }
.doc-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.6; }
#print-area { display: none; }

/* ---------- sign-in screens */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 26px 24px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.06); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .logo { background: var(--navy); color: #fff; font-size: 13px; padding: 7px 9px; }
.login-brand h1 { font-size: 19px; }
.login-card .btn-block { margin: 4px 0 0; min-height: 44px; font-size: 15px; }
.login-card .linklike { align-self: center; font-size: 14px; padding: 6px; }
.login-msg { background: var(--blue-bg); color: #1b3f7a; padding: 9px 11px; border-radius: 6px; font-size: 13px; }
.login-msg.error { background: var(--red-bg); color: var(--red); }
.login-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.login-card p { margin: 0; }
.mobile-foot { display: none; }
.tbl.ready td { vertical-align: top; }
.tbl.ready td.actions { vertical-align: middle; }

/* ---------- iPad */
@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .day-panel { position: static; }
}
@media (max-width: 980px) {
  /* week view becomes a list of days */
  .wk-grid { grid-template-columns: 1fr; }
  .wk-day { min-height: 0; scroll-margin-top: 64px; }
  .wk-head { align-items: center; }
  .wk-head > div { display: flex; gap: 8px; align-items: baseline; }
  .wk-runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
  .wk-none { text-align: left; padding: 2px 4px; }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- phone: sidebar becomes a top bar */
@media screen and (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 20; flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; }
  .brand-text, .sidebar-foot { display: none; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; scrollbar-width: none; }
  .nav a { flex: 1 0 auto; text-align: center; padding: 7px 6px; font-size: 13px; }
  #main { padding: 14px 12px 30px; }
  h1 { font-size: 19px; }
  .panel { padding: 12px; }
  .page-head .head-actions { width: 100%; }
  .page-head .seg { flex: 1 0 auto; }
  .hide-sm { display: none; }
  .seg button { flex: 1; }
  .cal-cell { min-height: 50px; padding: 3px; align-items: center; }
  .cal-evs { display: none; }
  .cal-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 999px; background: var(--blue-bg); color: var(--blue); font-size: 11px; font-weight: 700; padding: 0 5px; }
  .cal-count.pending { background: #e4e7ec; color: #475467; }
  .cal-filters, .cal-filters select { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .modal { padding: 0; align-items: stretch; }
  .modal-card { border-radius: 0; min-height: 100%; max-width: none !important; display: flex; flex-direction: column; }
  .modal-card form { flex: 1; display: flex; flex-direction: column; }
  .modal-body { flex: 1; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  .info { grid-template-columns: 1fr; gap: 0; }
  .info dt { margin-top: 6px; font-size: 12px; }
  .mobile-foot { display: block; text-align: center; font-size: 13px; color: var(--muted); padding: 18px 0 4px; }
  /* Drivers on phones: big, simple touch targets */
  .wk-runs { grid-template-columns: 1fr; gap: 8px; }
  .wk-body { padding: 10px 12px 8px; }
  .wk-time { font-size: 15px; }
  .wk-cust { font-size: 16px; }
  .wk-sub { font-size: 14px; }
  .wk-acts { gap: 8px; padding: 0 10px 10px; }
  .wk-acts .btn { min-height: 46px; font-size: 16px; }
  .wk-bulk { margin: 8px 8px 0; gap: 6px; }
  .wk-bulk .btn { min-height: 44px; font-size: 15px; }
  .wk-add { min-height: 40px; min-width: 44px; font-size: 22px; }
  .wk-dow { font-size: 15px; }
  .wk-date { font-size: 14px; }
  .run-actions .btn { min-height: 44px; font-size: 15px; flex: 1; }
  .cal-nav .btn { min-height: 40px; min-width: 40px; }
  .nav a { padding: 9px 7px; font-size: 13px; }
  .paper { padding: 20px 16px; }
  .doc-top { flex-direction: column-reverse; }
}

/* ---------- print: only the chosen document */
@media print {
  /* Zero page margin stops the browser adding its own title / date / URL header. */
  @page { margin: 0; }
  body { background: #fff; font-size: 12px; }
  .modal, .toast, .sidebar, .toolbar, .note, .head-actions { display: none !important; }
  body.printing .app { display: none !important; }
  body.printing #print-area { display: block; }
  .paper { border: 0; border-radius: 0; padding: 14mm 16mm; max-width: none; margin: 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  a { color: inherit; }
  .badge { border: 1px solid currentColor; }
  .no-print { display: none !important; }
}
