/* Prolux Inbound — utilitarian ops UI. Layout: top bar + tabs, one screen per job, side drawer for details. */
:root {
  --bg: #f1f4f7; --surface: #fff; --surface-2: #f7f9fb; --line: #d9e0e7; --fg: #14202b; --muted: #5d6b78;
  --accent: #1b5e8f; --accent-2: #e8f1f8; --accent-fg: #fff;
  --ok: #1f7a4a; --ok-bg: #e3f3ea; --warn: #9a5b00; --warn-bg: #fdf0d8; --bad: #b3261e; --bad-bg: #fbe4e2; --info: #1b5e8f; --info-bg: #e3eef8; --idle: #5d6b78; --idle-bg: #e9edf1;
  --f-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif; --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 8px;
}
* { box-sizing: border-box }
html, body { height: 100% }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--f-body) }
button, input, select, textarea { font: inherit; color: inherit }
a { color: var(--accent) }
[hidden] { display: none !important }

/* top */
.top { position: sticky; top: 0; z-index: 900; background: var(--surface); border-bottom: 1px solid var(--line) }
.top .row { display: flex; align-items: center; gap: 14px; padding: 8px max(16px, env(safe-area-inset-left)); flex-wrap: wrap }
.brand { font-weight: 800; font-size: 16px; letter-spacing: -.01em; white-space: nowrap }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 6px }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0 }
nav.tabs a { padding: 7px 12px; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; position: relative }
nav.tabs a.on { background: var(--accent-2); color: var(--accent) }
nav.tabs a .dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; text-align: center; margin-left: 4px }
.who { color: var(--muted); font-size: 12px; white-space: nowrap }
.alerts { display: flex; flex-direction: column; gap: 0 }
.alert { padding: 7px max(16px, env(safe-area-inset-left)); font-weight: 500; border-top: 1px solid var(--line) }
.alert.bad { background: var(--bad-bg); color: var(--bad) } .alert.warn { background: var(--warn-bg); color: var(--warn) } .alert.info { background: var(--info-bg); color: var(--info) }

main { padding: 16px max(16px, env(safe-area-inset-left)) 40px }
.screen { max-width: 1400px; margin: 0 auto }
h2 { font-size: 18px; margin: 0 }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted) }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px }
.bar .grow { flex: 1 }
.muted { color: var(--muted) } .small { font-size: 12px }
.mono { font-family: var(--f-mono); font-weight: 600; letter-spacing: .02em; white-space: nowrap }

button, .btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; color: var(--fg) }
button:hover, .btn:hover { border-color: var(--accent) }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg) }
button.danger { color: var(--bad) }
button.ghost { background: transparent; border-color: transparent; padding: 4px 8px }
button:disabled { opacity: .5; cursor: default }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--surface); width: 100%; min-width: 0 }
textarea { resize: vertical }
label.f { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0 }
label.f > span.hint { font-weight: 400 }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px }
.grid.two { grid-template-columns: 1fr 1fr }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; color: var(--fg) } .check input { width: auto }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.1 }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em }
.stat.bad { border-color: var(--bad); background: var(--bad-bg) } .stat.bad b, .stat.bad span { color: var(--bad) }
.stat.warn { border-color: var(--warn); background: var(--warn-bg) } .stat.warn b, .stat.warn span { color: var(--warn) }

.tbl { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r) }
table { width: 100%; border-collapse: collapse }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0 }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums }
tr:last-child td { border-bottom: 0 }
tr.click { cursor: pointer } tr.click:hover td { background: var(--surface-2) }
.sub { color: var(--muted); font-size: 12px }
.empty { padding: 30px 16px; text-align: center; color: var(--muted) }
.empty b { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--idle-bg); color: var(--idle) }
.s-booked { background: var(--idle-bg); color: var(--idle) } .s-sailing { background: var(--info-bg); color: var(--info) }
.s-at_port, .s-on_rail { background: var(--warn-bg); color: var(--warn) } .s-at_ramp, .s-out_for_delivery { background: #fbe9d0; color: #8a4b00 }
.s-delivered, .s-returned { background: var(--ok-bg); color: var(--ok) }
.r-late { background: var(--bad-bg); color: var(--bad) } .r-soon { background: var(--warn-bg); color: var(--warn) } .r-ok { background: var(--ok-bg); color: var(--ok) }
.k-quote_reply, .k-quote_request { background: #efe6fa; color: #5b2a91 } .k-arrival_notice, .k-rail, .k-delivery { background: var(--warn-bg); color: var(--warn) }
.code { font-family: var(--f-mono); font-weight: 700; background: var(--fg); color: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 12px }

/* map */
.mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; height: calc(100vh - 150px); min-height: 480px }
#map { border-radius: var(--r); border: 1px solid var(--line); min-height: 420px; z-index: 1 }
.side { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-width: 0 }
.next { padding: 10px 12px; cursor: pointer } .next:hover { border-color: var(--accent) }
.next .t { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
.pin { background: var(--c, #1b5e8f); color: #fff; font: 700 11px/1 var(--f-mono); padding: 4px 6px; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); white-space: nowrap; transform: translate(-50%, -50%); display: inline-block }
.pin.est { border-style: dashed }
.pin.place { background: #14202b }
.leaflet-tooltip.tip { padding: 8px 10px; border-radius: 6px; font: 12px/1.4 var(--f-body); min-width: 210px }
.tip b.n { font-family: var(--f-mono) }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px }

/* trucks calendar */
.cal { display: grid; grid-template-columns: 54px repeat(7, minmax(110px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto }
.cal .hd { padding: 8px; font-weight: 700; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; font-size: 13px }
.cal .hd.today { color: var(--accent) } .cal .hd.closed { color: var(--muted); font-weight: 500 }
.cal .hr { font-size: 11px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; border-top: 1px solid var(--line) }
.cal .col { position: relative; border-left: 1px solid var(--line) }
.cal .slot { border-top: 1px solid var(--line); height: 34px; cursor: pointer } .cal .slot.closed { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--bg) 6px, var(--bg) 12px); cursor: not-allowed }
.cal .slot:not(.closed):hover { background: var(--accent-2) }
.appt { position: absolute; left: 3px; right: 3px; background: var(--accent); color: #fff; border-radius: 5px; padding: 3px 6px; font-size: 12px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2) }
.appt.st-arrived { background: #8a4b00 } .appt.st-done { background: var(--ok) } .appt.warnings { box-shadow: inset 4px 0 0 #f2b65a }
.need { padding: 9px 12px; cursor: pointer } .need:hover { border-color: var(--accent) }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(10, 18, 26, .4); z-index: 1000 }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); z-index: 1001; overflow-y: auto; padding: 18px max(18px, env(safe-area-inset-right)) 30px 18px; box-shadow: -8px 0 24px rgba(0,0,0,.15) }
.drawer h2 { margin-bottom: 4px }
.drawer section { margin-top: 16px }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px }
.msgs { display: grid; gap: 6px; margin-top: 10px }
.msg { padding: 8px 10px; border-radius: 6px; font-weight: 500 }
.msg.block { background: var(--bad-bg); color: var(--bad) } .msg.warn { background: var(--warn-bg); color: var(--warn) } .msg.info { background: var(--info-bg); color: var(--info) } .msg.ok { background: var(--ok-bg); color: var(--ok) }
.chips { display: flex; gap: 6px; flex-wrap: wrap }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; background: var(--surface); font-size: 13px; font-weight: 600 }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent) }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 12px }
.timeline li { display: flex; gap: 8px } .timeline .when { color: var(--muted); min-width: 92px }
.timeline li.est { color: var(--muted); font-style: italic }
.email { white-space: pre-wrap; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; width: 100%; font-family: var(--f-body); min-height: 220px }
.best td { background: var(--ok-bg) }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 6px; z-index: 2000; font-weight: 600; max-width: calc(100% - 32px) }

/* login */
.login { max-width: 380px; margin: 12vh auto; padding: 24px }
.login h1 { font-size: 22px; margin: 0 0 4px }

.cpill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none }
.cs-done { background: var(--ok-bg); color: var(--ok) } .cs-bad { background: var(--bad-bg); color: var(--bad) } .cs-soon { background: var(--warn-bg); color: var(--warn) } .cs-open { background: var(--idle-bg); color: var(--idle) }
.comp.problem, .comp.late { border-left: 4px solid var(--bad) } .comp.soon { border-left: 4px solid var(--warn) } .comp.ok { border-left: 4px solid var(--ok) }
tr.lvl-late td, tr.lvl-problem td { background: var(--bad-bg) }
.chart { width: 100%; height: auto; display: block; margin: 6px 0 }
.chart .ax { font-size: 11px; fill: var(--muted) }

@media (max-width: 900px) {
  .mapwrap { grid-template-columns: 1fr; height: auto } #map { height: 60vh }
  .grid.two { grid-template-columns: 1fr }
  .trk { grid-template-columns: 1fr !important }
  nav.tabs { order: 3; flex: 1 0 100% }
  .brand small { display: none }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important } }
/* Nov 23: info tips, mini charts, pop-up, factory notes */
.info { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); font: 600 10px/1 var(--f-body, system-ui); font-style: normal; cursor: help; position: relative; vertical-align: 1px; margin-left: 3px; text-transform: none; letter-spacing: 0 }
.info:hover, .info:focus { color: var(--accent); border-color: var(--accent) }
.info:hover::after, .info:focus::after { content: attr(data-tip); position: absolute; z-index: 30; left: 50%; top: 20px; transform: translateX(-50%); width: min(300px, 80vw); padding: 8px 10px; border-radius: 6px; background: var(--fg); color: var(--surface); font: 400 12px/1.45 var(--f-body, system-ui); white-space: normal; text-align: left; box-shadow: 0 4px 14px rgb(0 0 0 / .18) }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 0 0 12px }
.mini-chart { display: block; text-align: left; padding: 8px 10px; cursor: zoom-in; background: var(--surface); width: 100% }
.mini-chart > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em }
.chart.mini { height: 110px; width: 100%; display: block }
.modal { position: fixed; inset: 0; z-index: 60; background: rgb(10 20 30 / .45); display: grid; place-items: center; padding: 16px }
.modal .box { background: var(--surface); color: var(--fg); border-radius: 10px; padding: 18px 20px; width: min(860px, 100%); max-height: 90vh; overflow: auto; position: relative; box-shadow: 0 12px 40px rgb(0 0 0 / .3) }
.modal .box .close { position: absolute; right: 10px; top: 10px }
ul.notes { list-style: none; margin: 0 0 8px; padding: 0 } ul.notes li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line) } ul.notes .grow { flex: 1 }
b.bad { color: #b42318 }
.stat span.info, span.info { text-transform: none !important; letter-spacing: 0 !important; font-size: 10px !important; font-weight: 600 !important }
.info:hover::after, .info:focus::after { text-transform: none; letter-spacing: 0; font-weight: 400 }
.info.tip-left:hover::after, .info.tip-left:focus::after { left: auto; right: -6px; transform: none }
.info.tip-right:hover::after, .info.tip-right:focus::after { left: -6px; transform: none }
@media (max-width: 1500px) { nav.tabs a { padding: 7px 8px; font-size: 14px } header .sub, #today { display: none } }
/* Nov 23 (Dustin): menu stands out more; logo goes back to the map */
.top { background: var(--accent); border-bottom: 0; box-shadow: 0 2px 8px rgb(0 0 0 / .12) }
a.brand { color: #fff; text-decoration: none; font-size: 17px } a.brand:hover { opacity: .9 } a.brand small { color: rgb(255 255 255 / .75) }
nav.tabs a { color: rgb(255 255 255 / .85); font-weight: 600 }
nav.tabs a:hover { background: rgb(255 255 255 / .14); color: #fff }
nav.tabs a.on { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .15) }
nav.tabs a .dot { background: #e5484d; box-shadow: 0 0 0 2px var(--accent) }
.top #who, .top .who, .top .sub { color: rgb(255 255 255 / .85) } .top button, .top .btn { background: rgb(255 255 255 / .12); color: #fff; border-color: rgb(255 255 255 / .35) }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)) } @media (max-width: 1100px) { .grid.three { grid-template-columns: 1fr } }
