/* ── workspace.css — dense operational surfaces (load cockpit, tabs, kv). ────
 * This is a logistics app: information-dense, scannable, everything visible.
 * Simplicity = organizing the operational chaos, not hiding fields.
 */

/* ── Load cockpit header ─────────────────────────────────────────────────── */
.cockpit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.cockpit-ref { display: flex; align-items: center; gap: 12px; }
.cockpit-ref h1 { font-size: var(--fs-2xl); }
.cockpit-lane { color: var(--t2); font-size: var(--fs-md); margin-top: 4px; }
.cockpit-actions { display: flex; gap: 8px; align-items: center; }

/* Party chain: shipper → broker → carrier → driver */
.chain { display: flex; align-items: stretch; gap: 0; margin: var(--sp-3) 0; flex-wrap: wrap; border: 1px solid var(--hair); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.chain-node { flex: 1; min-width: 150px; padding: 10px 14px; border-right: 1px solid var(--hair); position: relative; }
.chain-node:last-child { border-right: 0; }
.chain-role { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--t3); font-weight: 600; }
.chain-name { font-weight: 600; font-size: var(--fs-md); margin-top: 2px; }
.chain-sub { font-size: var(--fs-xs); color: var(--t2); }
.chain-node.empty .chain-name { color: var(--t3); font-weight: 400; }
.chain-arrow { align-self: center; color: var(--signal); padding: 0 2px; font-weight: 700; }

/* KPI strip — many small operational numbers at a glance */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--sp-3); }
.kpi { background: var(--surface); padding: 10px 14px; }
.kpi-k { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--t3); font-weight: 600; }
.kpi-v { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-md); margin-top: 2px; }
.kpi-v.pos { color: var(--ok); } .kpi-v.neg { color: var(--stop); } .kpi-v.sig { color: var(--signal); }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hair); margin-bottom: var(--sp-4); overflow-x: auto; }
.tab { padding: 11px 16px; font-size: var(--fs-md); font-weight: 500; color: var(--t2); border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--dur); position: relative; }
.tab:hover { color: var(--t0); }
.tab[aria-selected="true"] { color: var(--t0); border-bottom-color: var(--signal); }
.tab-badge { margin-left: 7px; font-size: 10px; font-family: var(--font-mono); background: var(--surface-3); color: var(--t2); padding: 1px 6px; border-radius: 999px; }
.tab[aria-selected="true"] .tab-badge { background: var(--signal-soft); color: var(--signal); }

/* ── kv grid — dense definition list (label:value) ───────────────────────── */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 var(--sp-5); }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); }
.kv-k { color: var(--t2); font-size: var(--fs-sm); flex: 0 0 auto; }
.kv-v { font-weight: 500; font-size: var(--fs-sm); text-align: right; font-variant-numeric: tabular-nums; }
.kv-v.mono { font-family: var(--font-mono); }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--t3); font-weight: 700; margin: var(--sp-4) 0 8px; }
.section-label:first-child { margin-top: 0; }

/* dense two-column cockpit body */
.cockpit-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-4); align-items: start; }
@media (max-width: 1000px) { .cockpit-cols { grid-template-columns: 1fr; } }

/* stop cards (dense) */
.stop-card { border: 1px solid var(--hair); border-radius: var(--r-md); padding: 14px; margin-bottom: 10px; background: var(--surface); }
.stop-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stop-seq { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.stop-seq.pick { background: var(--ok-soft); color: var(--ok); } .stop-seq.drop { background: var(--signal-soft); color: var(--signal); }
.acc-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--t1); margin: 2px 4px 0 0; }

/* dense doc/activity rows */
.drow { display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.arow { display: grid; grid-template-columns: 16px 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: var(--fs-sm); }
.arow .dot-tl { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); margin-top: 5px; }

@media (max-width: 900px) { .kpi-strip { grid-template-columns: repeat(3, 1fr); } }

/* ── Book wizard stepper ─────────────────────────────────────────────────── */
.bk-stepper { display: flex; align-items: center; gap: 6px; margin-bottom: var(--sp-5); }
.bk-dot { display: flex; align-items: center; gap: 8px; color: var(--t2); font-weight: 500; font-size: var(--fs-md); }
.bk-dot-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.bk-dot.cur { color: var(--t0); } .bk-dot.cur .bk-dot-n { background: var(--signal); color: var(--signal-ink); }
.bk-dot.done { color: var(--ok); } .bk-dot.done .bk-dot-n { background: var(--ok-soft); color: var(--ok); cursor: pointer; }
.bk-line { flex: 1; max-width: 70px; height: 2px; background: var(--hair); } .bk-line.done { background: var(--ok); }

/* ── Kanban drag-and-drop + view toggle ─────────────────────────────────── */
.tile[draggable="true"] { cursor: grab; }
.tile.dragging { opacity: .5; cursor: grabbing; }
.col-body { min-height: 60px; transition: background var(--dur); border-radius: var(--r-md); }
.col-body.drag-over { background: var(--signal-soft); outline: 2px dashed var(--signal); outline-offset: -2px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 2px; }
.seg-btn { padding: 6px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; color: var(--t2); }
.seg-btn.on { background: var(--surface-3); color: var(--t0); }

/* ── Reports (rep-view) ─────────────────────────────────────────────────── */
.rep-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.rep-kpi { padding: 16px 18px; }
.rep-kpi-val { font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.rep-kpi-sub { font-size: var(--fs-xs); color: var(--t2); margin-top: 3px; min-height: 14px; }
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: start; }
.rep-card { min-width: 0; }
.rep-bar { margin-bottom: 12px; }
.rep-bar-top { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin-bottom: 5px; }
.rep-bar-label { color: var(--t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 10px; }
.rep-bar-val { color: var(--t0); font-weight: 600; }
.rep-bar-track { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rep-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--signal), var(--signal-fill)); }
.rep-table td, .rep-table th { padding: 9px 6px; }
.rep-cell-label { font-size: var(--fs-sm); color: var(--t0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.rep-cell-track { height: 3px; border-radius: 999px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.rep-cell-fill { height: 100%; background: var(--signal); opacity: .7; border-radius: 999px; }
@media (max-width: 1000px) { .rep-kpis { grid-template-columns: repeat(2, 1fr); } .rep-grid { grid-template-columns: 1fr; } }

/* ── Quote sections (shp-quote) + rate check (car-market) ───────────────── */
.quote-sec { margin-bottom: var(--sp-4); }
.quote-sec-title { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--t2); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--hair); }
.field-hint { font-size: 11px; color: var(--t3); margin-top: 2px; }
.input-suffixed { position: relative; display: flex; align-items: center; }
.input-suffixed .input { padding-right: 40px; width: 100%; }
.input-suffix { position: absolute; right: 12px; font-size: var(--fs-sm); color: var(--t3); pointer-events: none; }
.quote-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tog { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--hair); font-size: var(--fs-sm); cursor: pointer; user-select: none; }
.tog input { accent-color: var(--signal); width: 15px; height: 15px; }
.acc-cluster { margin-bottom: 12px; }
.acc-cluster-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--t3); font-weight: 600; margin-bottom: 7px; }
.summary-total { border-bottom: 0; border-top: 1px solid var(--hair); margin-top: 4px; padding-top: 12px; font-weight: 700; }
.summary-total .v { font-size: var(--fs-md); }
.bench { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--t2); }
.bench-track { position: relative; flex: 1; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--surface-3), var(--signal-soft), var(--surface-3)); }
.bench-mark { position: absolute; top: 50%; width: 3px; height: 16px; border-radius: 2px; background: var(--signal); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 25%, transparent); }
.rate-rpm { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--hair); margin-bottom: 14px; }
.rate-verdict { display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 11px 13px; border: 1px solid; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; }
.rate-verdict .ico { width: 17px; height: 17px; }

/* ── Modal dialog ───────────────────────────────────────────────────────── */
/* z-index 2000 keeps the modal above Leaflet map panes/controls (which reach
   ~1000) — a load-cockpit map must never overlap an open dialog. */
.modal-back { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.62); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: mfade .16s ease; }
@keyframes mfade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg, 16px); box-shadow: 0 24px 60px rgba(0,0,0,.5); animation: mrise .18s ease; }
.modal-card--wide { max-width: 720px; }
@keyframes mrise { from { transform: translateY(8px); opacity: .6; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--hair); position: sticky; top: 0; background: var(--surface); border-radius: var(--r-lg, 16px) var(--r-lg, 16px) 0 0; }
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); }
.modal-x { width: 30px; height: 30px; border-radius: 8px; color: var(--t2); font-size: 15px; background: var(--surface-2); }
.modal-x:hover { color: var(--t0); background: var(--surface-3); }
.modal-body { padding: 20px; }
.doc-note { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: var(--r-md); background: var(--signal-soft); border: 1px solid var(--hair); font-size: var(--fs-sm); color: var(--t1); margin-bottom: 16px; }
.file-drop { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px dashed var(--line, var(--t3)); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; font-size: var(--fs-sm); color: var(--t2); }
.file-drop.has-file { border-style: solid; border-color: var(--ok); color: var(--ok); }
.endorse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 8px; }
.pay-lines { border: 1px solid var(--hair); border-radius: var(--r-md); overflow: hidden; margin: 4px 0 14px; }
.pay-line { display: flex; justify-content: space-between; padding: 11px 14px; font-size: var(--fs-sm); border-bottom: 1px solid var(--hair); }
.pay-line:last-child { border-bottom: 0; }
.pay-line.total { font-weight: 700; background: var(--surface-2); }
.pay-time { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: var(--fs-sm); }
.pay-time-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--surface-3); margin: 0 auto; }
.pay-time.done .pay-time-dot { background: var(--ok); }

/* ── Tenders — the carrier money moment (full detail + negotiation) ────────── */
.tender-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: var(--sp-4); }
.tender-card { padding: var(--sp-4); display: flex; flex-direction: column; gap: 12px; }
.tender-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tender-lane { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); margin-top: 3px; }
.tender-stop { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hair); }
.tender-stop:nth-of-type(1) { border-top: 0; }
.tender-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.tf { display: flex; flex-direction: column; gap: 2px; }
.tf-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--t3); font-weight: 700; }
.tf-v { font-size: var(--fs-sm); color: var(--t1); font-weight: 600; }
.tender-acc { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.tender-note { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; padding: 9px 11px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--hair); }
.tender-expiry { margin-top: 2px; }
.tender-actions { gap: 8px; }
/* rate confirmation (e-sign confirm sheet) */
.ratecon { border: 1px solid var(--hair); border-radius: var(--r-md); overflow: hidden; margin-bottom: 16px; }
.rc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: var(--fs-sm); border-bottom: 1px solid var(--hair); }
.rc-row:last-child { border-bottom: 0; }
.rc-k { color: var(--t2); } .rc-v { color: var(--t0); font-weight: 600; text-align: right; }
.esign-ack { align-items: flex-start; gap: 10px; margin-top: 14px; font-size: var(--fs-sm); color: var(--t1); }
/* broker-side negotiation rows */
.tender-neg { padding: 12px 0; border-top: 1px solid var(--hair); }
.tender-neg:first-of-type { border-top: 0; }
.tender-neg-counter { margin-top: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--signal-soft); border: 1px solid var(--hair); }
.tender-neg-note { font-size: var(--fs-sm); color: var(--t1); font-style: italic; max-width: 46%; text-align: right; }

/* ── Shipper quote: dims, computed class, validation gates (S1) ───────────── */
.dim-row { display: flex; align-items: center; gap: 6px; }
.dim-row .input { text-align: center; padding-left: 8px; padding-right: 8px; }
.dim-x { color: var(--t3); font-weight: 600; }
.quote-class { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-top: 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--hair); }
.val-banner { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); font-size: 12.5px; line-height: 1.35; margin-bottom: 8px; border: 1px solid; }
.val-banner .ico, .val-banner svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.val-err { background: var(--stop-soft); border-color: color-mix(in srgb, var(--stop) 40%, transparent); color: var(--stop); }
.val-warn { background: var(--signal-soft); border-color: var(--hair); color: var(--t1); }

/* ── External loads (C2): Pro tag + segmented status/payment controls ─────── */
.pro-tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 999px; background: var(--signal-soft); color: var(--signal); vertical-align: middle; margin-left: 8px; }
.seg { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 4px; flex-wrap: wrap; }
.seg-btn { flex: 1; min-width: 72px; padding: 8px 6px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--t2); text-align: center; transition: all .12s; }
.seg-btn:hover { color: var(--t0); background: var(--surface-3); }
.seg-btn.is-on { background: var(--signal); color: var(--signal-ink); }

/* ── shipper documents tray + invoice detail (Wave 1) ─────────────────────── */
.doc-item { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; margin-bottom: 4px; transition: background .12s; }
.doc-item[data-ready="1"]:hover { background: var(--surface-2); }
.doc-item[data-ready="0"] { opacity: .62; }
.doc-item .check-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.doc-item .check-ico svg { width: 15px; height: 15px; }
.inv-total td { border-top: 2px solid var(--t0); padding-top: 12px; }
.dispute-row { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.dispute-row:last-child { border-bottom: 0; }

/* ── shipper reports — sentence-first insight cards (Wave 2) ───────────────── */
.insight-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.insight { padding: 16px 18px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--hair); border-left: 3px solid var(--t3); }
.insight--neg { border-left-color: var(--stop); background: var(--stop-soft); }
.insight--warn { border-left-color: var(--warn); }
.insight--ok { border-left-color: var(--ok); background: var(--ok-soft); }
.insight--sig { border-left-color: var(--signal); }
.insight-text { font-size: 14.5px; font-weight: 600; line-height: 1.4; color: var(--t0); }
.insight-sub { font-size: 12px; color: var(--t2); margin-top: 4px; }
@media (max-width: 860px) { .insight-grid { grid-template-columns: 1fr; } }

/* ── shipper references + milestone rail (Wave 3) ─────────────────────────── */
.ref-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 var(--sp-4); }
.ref-chip { font-size: 12px; color: var(--t1); background: var(--surface-2); border: 1px solid var(--hair); border-radius: 999px; padding: 4px 12px; }
.ref-chip b { color: var(--t2); font-weight: 600; margin-right: 6px; text-transform: uppercase; font-size: 10px; letter-spacing: .05em; }
.map-badge--warn { background: var(--stop-soft) !important; color: var(--stop) !important; }
.ms-rail { display: flex; flex-wrap: wrap; gap: 2px; }
.ms { flex: 1; min-width: 84px; position: relative; padding: 0 4px 12px; text-align: center; }
.ms-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--hair); margin: 0 auto 6px; position: relative; z-index: 1; }
.ms--done .ms-dot { background: var(--ok); border-color: var(--ok); }
.ms:not(:last-child)::after { content: ''; position: absolute; top: 5px; left: 50%; width: 100%; height: 2px; background: var(--hair); z-index: 0; }
.ms--done:not(:last-child)::after { background: var(--ok); }
.ms-label { font-size: 11px; font-weight: 600; color: var(--t1); line-height: 1.25; }
.ms--done .ms-label { color: var(--t0); }
.ms-time { font-size: 10px; color: var(--t2); margin-top: 2px; }

/* claim denied milestone */
.ms--bad .ms-dot { background: var(--stop); border-color: var(--stop); }
.ms--bad.ms--done .ms-label { color: var(--stop); }

/* ── notifications panel + rail bell (Wave: notifications) ─────────────────── */
.rail-notif { width: 100%; background: transparent; border: 0; cursor: pointer; text-align: left; font: inherit; }
.notif-list { display: flex; flex-direction: column; }
.notif-row { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--hair); }
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--surface-2); border-radius: 8px; }
.notif-row.is-unread { background: var(--signal-soft); border-radius: 8px; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--t3); }
.notif-dot--ok { background: var(--ok); } .notif-dot--signal { background: var(--signal); }
.notif-dot--stop { background: var(--stop); } .notif-dot--info { background: var(--signal); }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-detail { font-size: 12.5px; color: var(--t2); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--t3); margin-top: 3px; }

/* notification preferences (in the alerts panel) */
.notif-prefs { border-bottom: 1px solid var(--hair); margin-bottom: 8px; }
.notif-prefs-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; border: 0; cursor: pointer; font: 600 13px/1 inherit; color: var(--t1); padding: 8px 4px 12px; }
.notif-prefs-toggle .chev { color: var(--t3); }
.notif-prefs-body { padding: 4px 4px 12px; }
.notif-pref-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--t1); cursor: pointer; }
.notif-prefs-note { font-size: 11px; color: var(--t3); margin-top: 8px; }
