/* AI layer. Colours only from tokens (WhatsApp keeps its own look). */
.ailog { display: flex; flex-direction: column; }
.ail { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; animation: aiin .45s ease both; }
.ail:first-child { border-top: 0; }
.ail > i { color: var(--brand); font-size: 16px; filter: drop-shadow(0 0 5px var(--brand)); flex: none; }
.ail .grow { flex: 1; min-width: 0; }
@keyframes aiin { from { opacity: 0; transform: translateX(-6px); } }
.ai-foot { margin-top: 12px; font-size: 12px; color: var(--ink-muted); border-top: 1px dashed var(--line); padding-top: 10px; }

/* B/L reader */
.modal .box.wide { width: min(980px, 100%); }
.blx { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.bl { position: relative; border-radius: 10px; overflow: hidden; }
.bl-paper { background: var(--shell-ink); color: var(--shell); padding: 18px 20px; font-family: "JetBrains Mono", monospace; font-size: 11.5px; line-height: 1.5;
  transform: rotate(-.6deg); box-shadow: inset 0 0 60px color-mix(in srgb, var(--shell-muted) 35%, transparent); filter: contrast(.92) saturate(.6); }
.bl-t { font-size: 16px; font-weight: 600; letter-spacing: .12em; border-bottom: 2px solid var(--shell); padding-bottom: 6px; margin-bottom: 10px; }
.bl-t small { font-size: 10px; letter-spacing: .04em; font-weight: 500; margin-left: 8px; }
.bl-g { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.bl-g small, .bl-d small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .65; }
.bl-d { margin-top: 12px; border-top: 1px solid var(--shell-muted); padding-top: 8px; }
.bl-s { margin-top: 14px; font-size: 10px; opacity: .6; }
.hl { border-radius: 3px; transition: background .3s, box-shadow .3s; }
.hl.seen { background: color-mix(in srgb, var(--brand) 22%, transparent); }
.hl.on { background: color-mix(in srgb, var(--brand) 55%, transparent); box-shadow: 0 0 0 2px var(--brand), 0 0 16px var(--brand); }
.bl-scan { position: absolute; left: 0; right: 0; height: 40px; top: -40px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--brand) 35%, transparent), transparent); }
.bl-scan.on { animation: blscan 1.6s ease-in-out infinite; }
@keyframes blscan { from { top: -40px; } to { top: 100%; } }
.blf-h { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 8px; }
.bf { position: relative; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 6px; }
.bf small { display: block; color: var(--ink-muted); font-size: 11.5px; font-weight: 600; }
.bf b { font-size: 14px; }
.bf.in { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); animation: pop .3s ease; }
.conf { position: absolute; right: 10px; top: 10px; font-family: "JetBrains Mono", monospace; font-size: 11px; font-weight: 600; color: var(--brand); }
.conf.mid { color: var(--pending); }

/* plate check in Port app */
.pchk { min-height: 0; margin-bottom: 10px; }
.pc { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; font-size: 13px; }
.pc i { font-size: 22px; }
.pc small { display: block; color: var(--ink-muted); font-size: 12px; }
.pc.ok { background: var(--brand-tint); } .pc.ok i { color: var(--brand); }
.pc.warn { background: var(--pending-tint); } .pc.warn i { color: var(--pending); }
.pc.pop { animation: pop .3s ease; }

/* WhatsApp chats (third-party look) */
.wa-tabs { display: flex; background: #075e54; padding: 6px 8px 0; gap: 4px; position: sticky; top: 0; z-index: 3; }
.wa-tabs button { flex: 1; border: 0; background: transparent; color: rgba(255,255,255,.7); font-size: 12px; font-weight: 600; padding: 6px; border-bottom: 2px solid transparent; }
.wa-tabs button.on { color: #fff; border-color: #fff; }
.wa-tabs + .wa-h { top: 33px; }
.msg.me { align-self: flex-end; background: #d9fdd3; }
.wa-q { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 14px; margin-top: auto; }
.wa-q button { border: 1px solid #b7d8c9; background: #fff; color: #075e54; border-radius: 16px; padding: 6px 10px; font-size: 12px; font-weight: 600; }
.typing-b { display: inline-flex; gap: 4px; padding: 10px 12px; }
.typing-b span { width: 6px; height: 6px; border-radius: 50%; background: #8696a0; animation: blink 1s infinite; }
.typing-b span:nth-child(2) { animation-delay: .2s; } .typing-b span:nth-child(3) { animation-delay: .4s; }

@media (max-width: 860px) { .blx { grid-template-columns: minmax(0, 1fr); } }

/* outbound collections */
.g-out { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); align-items: start; }
.ocl { display: flex; flex-direction: column; gap: 10px; }
.oc { text-align: left; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; transition: border-color .2s, box-shadow .2s; }
.oc:hover { border-color: var(--ink-muted); }
.oc.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 0 24px -8px var(--brand); }
.oc-h { display: flex; justify-content: space-between; align-items: center; }
.oc-m { display: flex; gap: 10px; font-size: 12.5px; }
.oc-p { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-muted); }
.oc-p .track { flex: 1; height: 5px; }
.oc-s { display: flex; gap: 4px; } .oc-s i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.oc-s i.ok { background: var(--brand); } .oc-s i.now { background: var(--brand); opacity: .45; animation: blink 1.2s infinite; }
.ostep { list-style: none; margin: 0; padding: 0; position: relative; }
.ostep > li { position: relative; padding: 0 0 14px 44px; }
.ostep > li::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--line); }
.ostep > li:last-child::before { display: none; }
.ostep > li.ok::before { background: var(--brand); }
.os-h { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.os-i { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); }
.ostep > li.ok .os-i { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: 0 0 12px -2px var(--brand); }
.ostep > li.now .os-i { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.ostep > li:not(.ok):not(.now) b { color: var(--ink-muted); font-weight: 500; }
.os-t { margin-left: auto; font-size: 12px; color: var(--ink-muted); }
.os-r { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.os-b { margin-top: 10px; padding: 14px; border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--brand) 5%, transparent); animation: pop .3s ease; }
.os-b .acts { margin-top: 12px; display: flex; justify-content: flex-end; }
.ro { min-height: 40px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.aihint { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-muted); } .aihint i { color: var(--brand); }
.gate { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: center; }
.gate-cam { position: relative; height: 110px; border-radius: 10px; background: var(--shell); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.gate-cam .rec { position: absolute; left: 10px; top: 8px; font-family: "JetBrains Mono", monospace; font-size: 10.5px; color: var(--shell-muted); }
.gate-cam::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--brand) 18%, transparent) 50%, transparent 60%); background-size: 100% 200%; animation: gscan 1.6s linear infinite; }
@keyframes gscan { from { background-position: 0 -100%; } to { background-position: 0 100%; } }
.plate.big { height: 40px; font-size: 20px; padding: 0 14px; min-width: 120px; justify-content: center; box-shadow: 0 0 0 2px var(--brand), 0 0 18px var(--brand); }
.gate .checks { margin: 0; }
.scale.mini .kg { font-size: 38px; line-height: 46px; }
.load-h { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.load-h b { font-size: 18px; }
.track.big { height: 14px; }
.do { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; background: var(--surface); }
.do-h { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.do-h b { display: block; letter-spacing: .06em; } .do-h small { color: var(--ink-muted); font-size: 12px; }
.do-h i { font-size: 44px; color: var(--ink); }
.released { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: var(--brand-tint); border: 1px solid var(--brand); box-shadow: 0 0 24px -10px var(--brand); animation: pop .35s ease; }
.released i { font-size: 30px; color: var(--brand); }
.released small { display: block; color: var(--ink-muted); font-size: 12.5px; }
@media (max-width: 1100px) { .g-out { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .gate { grid-template-columns: minmax(0, 1fr); } }

/* booking slot board */
.card.mb { margin-bottom: 20px; }
.sb-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.sb-sum { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); }
.sb-sum b { color: var(--ink); font-size: 15px; }
.sb-sum .pk { color: var(--alert); } .sb-sum .qt { color: var(--brand); }
.sb-sum i { margin-right: 4px; }
.sb-grid { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 6px; align-items: end; }
.sb-h { display: flex; flex-direction: column; align-items: stretch; gap: 5px; text-align: center; border-radius: 8px; padding: 4px 3px; }
.sb-h.peak { background: color-mix(in srgb, var(--alert) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--alert) 30%, transparent); }
.sb-n { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.sb-col { display: flex; flex-direction: column; gap: 3px; }
.sb-c { position: relative; height: 22px; border-radius: 5px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); padding: 0; overflow: hidden; display: block; width: 100%; }
.sb-c i { position: absolute; left: 0; right: 0; bottom: 0; display: block; transition: height .6s ease; }
.sb-c.low i { background: color-mix(in srgb, var(--brand) 55%, transparent); }
.sb-c.mid i { background: color-mix(in srgb, var(--brand) 85%, var(--pending)); }
.sb-c.busy i { background: var(--pending); }
.sb-c.full i { background: var(--alert); }
.sb-c[data-t] { cursor: pointer; }
.sb-c[data-t]:hover { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-tint), 0 0 12px -2px var(--brand); }
.sb-c[disabled] { cursor: default; }
.sb-l { font-size: 11.5px; color: var(--ink-muted); }
.sb-leg { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--ink-muted); margin-top: 12px; }
.sb-leg i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.sb-leg i.low { background: color-mix(in srgb, var(--brand) 55%, transparent); } .sb-leg i.mid { background: color-mix(in srgb, var(--brand) 85%, var(--pending)); }
.sb-leg i.busy { background: var(--pending); } .sb-leg i.full { background: var(--alert); }
.ns { margin-top: 16px; border: 1px solid color-mix(in srgb, var(--alert) 45%, var(--line)); border-radius: 12px; padding: 6px 14px; background: color-mix(in srgb, var(--alert) 6%, transparent); }
.ns-h { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--alert); padding: 8px 0 2px; }
.ns .row { gap: 10px; font-size: 13.5px; }
@media (max-width: 860px) { .sb-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }

/* eight warehouses */
.wt-no { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--line); color: var(--ink-muted); font-size: 11px; margin-right: 6px; vertical-align: 1px; }
.hq-tag { font-size: 10px; font-weight: 700; color: var(--brand-ink); background: var(--brand); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: 2px; }
.wts { grid-template-columns: repeat(8, minmax(0, 1fr)); }
body.docked .wts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1500px) { .wts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) { .wts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* real map */
.lmap { height: 400px; border-radius: 10px; background: var(--surface); z-index: 0; }
.leaflet-container { font-family: var(--font-body); background: var(--surface); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--ink-muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--ink-muted) !important; }
.leaflet-bar a { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.lm-port span, .lm-wh span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transform: translate(-50%, -50%); position: absolute; font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 7px; }
.lm-port span { background: var(--surface-2); color: var(--info); border: 1px solid var(--info); }
.lm-wh span { background: var(--surface-2); color: var(--ink); border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); }
.lm-wh span b { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: var(--line); font-size: 10px; }
.lm-wh.off span { opacity: .55; border-style: dashed; }
.lm-wh.on span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: 0 0 14px var(--brand); }
.lm-route { stroke: var(--brand); stroke-dasharray: 4 8; opacity: .75; animation: flow 1.2s linear infinite; filter: drop-shadow(0 0 3px var(--brand)); }
.lm-route.me { opacity: 1; }
.lm-lorry { position: relative; }
.lm-lorry i { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 25%, transparent); }
.lm-lorry span { position: absolute; left: 8px; top: -22px; white-space: nowrap; font: 700 11px/1 "JetBrains Mono", monospace; color: var(--ink); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 3px 5px; border-radius: 4px; }
.lm-lorry.me i { background: var(--brand); width: 14px; height: 14px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 35%, transparent), 0 0 16px var(--brand); }
.lm-lorry.me span { color: var(--brand-ink); background: var(--brand); }
.map-wrap .map-hud { z-index: 500; } .map-wrap .eta { z-index: 500; }
.lm-wh span { padding: 0; width: 24px; height: 24px; justify-content: center; border-radius: 50%; }
.lm-wh span b { background: transparent; width: auto; height: auto; font-size: 11px; }
.leaflet-tooltip { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 20px -10px #000; font-weight: 600; }
.leaflet-tooltip-top:before { border-top-color: var(--line); }

/* list-first pages */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.back:hover { color: var(--brand); }
.dt th.sortable { cursor: pointer; user-select: none; } .dt th.sortable i { margin-left: 4px; opacity: .5; font-size: 12px; }
.dt-p { display: inline-flex; align-items: center; gap: 6px; } .dt-p .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.err { min-height: 0; color: var(--alert); font-size: 12px; margin-top: 4px; } .err:empty { display: none; }
.ev-hint { display: inline-flex; gap: 5px; align-items: center; color: var(--brand); font-size: 12.5px; font-weight: 600; }
.head .chip { margin-left: 2px; }
.od-sum { margin: -8px 0 18px; font-size: 16px; color: var(--ink); max-width: 860px; }
.trips { display: flex; flex-direction: column; gap: 10px; }
.trip { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 50%, transparent); }
.trip.moving { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 20px -10px var(--brand); }
.trip-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.trip-h .r { margin-left: auto; } .trip-h .chip .pulse { width: 6px; height: 6px; }
.pipe { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pipe span { position: relative; padding-top: 14px; }
.pipe span i { position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 2px; background: var(--line); }
.pipe span.ok i { background: var(--brand); } .pipe span.now i { background: linear-gradient(90deg, var(--brand), var(--line)); animation: blink 1.2s infinite; }
.pipe b { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); } .pipe span.ok b, .pipe span.now b { color: var(--ink); }
.pipe small { font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.tl-b { list-style: none; padding: 0; margin: 16px 0 0; display: flex; gap: 6px; }
.tl-b li { flex: 1; font-size: 12px; color: var(--ink-muted); padding-top: 8px; border-top: 3px solid var(--line); }
.tl-b li.ok { border-color: var(--brand); color: var(--ink); }
/* evidence */
.ev-sum { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); margin-bottom: 14px; }
.ev-sum b { margin-left: auto; color: var(--brand); font-size: 16px; }
.ev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ev { margin: 0; } .ev-img { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1672 / 941; background: var(--shell); }
.ev-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-plate { position: absolute; display: grid; place-items: center; background: var(--shell); color: var(--shell-ink); font: 600 clamp(7px, .6vw, 10px)/1 "JetBrains Mono", monospace; white-space: nowrap; padding: 0 4px; transform: translateX(-50%); border-radius: 2px; box-shadow: 0 0 0 2px var(--brand), 0 0 12px var(--brand); letter-spacing: .04em; }
.ev-tag { position: absolute; left: 8px; top: 8px; background: rgba(2,8,14,.65); color: #fff; font: 500 11px/1 "JetBrains Mono", monospace; padding: 5px 7px; border-radius: 5px; }
.ev-rec { position: absolute; right: 8px; top: 8px; color: #fff; font: 600 10.5px/1 "JetBrains Mono", monospace; display: inline-flex; gap: 5px; align-items: center; }
.ev-rec::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--alert); animation: blink 1s infinite; }
.ev figcaption { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.ev figcaption b { font-size: 18px; } .ev figcaption small { width: 100%; color: var(--ink-muted); font-size: 12px; }
.ev-put { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.ev-put img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; }
.ev-put small { display: block; color: var(--ink-muted); font-size: 12.5px; }
@media (max-width: 860px) { .ev-grid { grid-template-columns: 1fr; } .pipe { grid-template-columns: repeat(5, minmax(56px, 1fr)); overflow-x: auto; } .pipe b { font-size: 11px; } }
