/* Shipment Tracking — SwiftTrack TMS. Namespaced .st */
* { box-sizing: border-box; }
body { margin: 0; }
.st {
    --bg: #0b1220; --panel: #131c2e; --panel2: #0e1626; --line: #24304a;
    --ink: #e2e8f0; --muted: #8598b5; --brand: #eab308; --brand-ink: #fde047;
    --ok: #34d399; --warn: #fb923c; --danger: #f87171; --info: #60a5fa;
    --shadow: 0 16px 40px -24px rgba(0,0,0,.7);
    min-height: calc(100vh - 44px);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: radial-gradient(1100px 460px at 88% -10%, rgba(234,179,8,.12), transparent), var(--bg);
    color: var(--ink);
}
.st-btn { border: 0; cursor: pointer; border-radius: .6rem; padding: .6rem 1rem; font: 700 .86rem inherit; background: var(--brand); color: #0b1220; transition: transform .1s, background .15s; white-space: nowrap; }
.st-btn:hover { transform: translateY(-1px); }
.st-btn.ghost { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); }
.st-btn.ghost:hover { border-color: var(--brand); }
.st-btn.sm { padding: .4rem .7rem; font-size: .78rem; }
.st-btn:disabled { opacity: .4; cursor: not-allowed; }
.st-h2 { margin: 0 0 1.1rem; font-size: 1.25rem; }
.st-link { border: 0; background: transparent; color: var(--brand-ink); font: 600 .8rem inherit; cursor: pointer; }

/* Topbar */
.st-topbar { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: var(--panel); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; flex-wrap: wrap; }
.st-brand { display: flex; align-items: center; gap: .6rem; }
.st-logo { font-size: 1.6rem; }
.st-brand b { display: block; font-size: 1.05rem; }
.st-brand small { color: var(--muted); font-size: .72rem; }
.st-nav { display: flex; gap: .25rem; margin: 0 auto; flex-wrap: wrap; }
.st-navbtn { border: 0; background: transparent; color: var(--muted); padding: .5rem .8rem; border-radius: .6rem; font: 600 .85rem inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.st-navbtn:hover { color: var(--ink); background: var(--panel2); }
.st-navbtn.active { background: var(--brand); color: #0b1220; }
.st-badge { background: rgba(0,0,0,.2); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; min-width: 1.1rem; text-align: center; }
.st-navbtn.active .st-badge { background: rgba(11,18,32,.25); }
.st-top-actions { display: flex; align-items: center; gap: .6rem; }
.st-live-dot { color: var(--ok); font-size: .72rem; font-weight: 800; letter-spacing: .1em; display: inline-flex; align-items: center; gap: .4rem; }
.st-live-dot::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); animation: stpulse 1.3s infinite; }
@keyframes stpulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.st-view { max-width: 1440px; margin: 0 auto; padding: 1.5rem; }
.st-view[hidden] { display: none !important; }
.st-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem; box-shadow: var(--shadow); }
.st-card h3 { margin: 0 0 1rem; font-size: .95rem; }

/* TRACK */
.st-search { display: flex; gap: .5rem; max-width: 500px; margin: 0 auto 1.5rem; }
.st-search input { flex: 1; font: inherit; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel2); color: var(--ink); letter-spacing: .05em; }
.st-search button { border: 0; background: var(--brand); color: #0b1220; border-radius: .6rem; padding: 0 1.4rem; font: 700 .9rem inherit; cursor: pointer; }
.st-track-grid { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .st-track-grid { grid-template-columns: 1fr; } }
.st-track-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow); }
.st-track-summary { display: flex; flex-wrap: wrap; gap: 1rem 2rem; padding-bottom: 1.2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.st-track-summary .cell b { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .2rem; }
.st-track-summary .cell span { font-weight: 600; }
.st-status-pill { display: inline-block; font-size: .74rem; font-weight: 800; text-transform: uppercase; padding: .15rem .6rem; border-radius: 999px; }
.st-status-pill.out-for-delivery { background: rgba(234,179,8,.15); color: var(--brand-ink); }
.st-status-pill.in-transit { background: rgba(96,165,250,.15); color: var(--info); }
.st-status-pill.delivered { background: rgba(52,211,153,.15); color: var(--ok); }
.st-status-pill.exception { background: rgba(248,113,113,.15); color: var(--danger); }
.st-status-pill.booked, .st-status-pill.picked-up { background: rgba(133,152,181,.15); color: var(--muted); }
.st-exception-banner { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--danger); border-radius: .6rem; padding: .7rem 1rem; font-size: .85rem; margin-bottom: 1.2rem; }

.st-timeline .row { display: flex; gap: 1rem; }
.st-timeline .rail { display: flex; flex-direction: column; align-items: center; }
.st-timeline .dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); z-index: 1; }
.st-timeline .row.done .dot { background: var(--ok); border-color: var(--ok); }
.st-timeline .row.current .dot { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px rgba(234,179,8,.2); animation: stp 1.4s infinite; }
@keyframes stp { 0%,100% { box-shadow: 0 0 0 4px rgba(234,179,8,.2); } 50% { box-shadow: 0 0 0 9px rgba(234,179,8,.04); } }
.st-timeline .line { width: 2px; flex: 1; background: var(--line); min-height: 1.8rem; }
.st-timeline .row.done .line { background: var(--ok); }
.st-timeline .txt { padding-bottom: 1.5rem; }
.st-timeline .txt b { display: block; }
.st-timeline .txt small { color: var(--muted); font-size: .8rem; }
.st-timeline .row:last-child .txt { padding-bottom: 0; }

.st-track-map-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; box-shadow: var(--shadow); position: sticky; top: 76px; }
@media (max-width: 900px) { .st-track-map-card { position: static; } }
.st-map-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.st-map-head span { color: var(--muted); font-size: .8rem; }
.st-eta-big { color: var(--brand-ink); font-weight: 800; }
#st-track-map { width: 100%; height: auto; aspect-ratio: 1; background: #060b16; border-radius: .7rem; display: block; }
.st-driver-card { display: flex; align-items: center; gap: .7rem; margin-top: .8rem; padding: .7rem; background: var(--panel2); border-radius: .7rem; }
.st-driver-card .av { font-size: 1.5rem; }
.st-driver-card b { display: block; font-size: .88rem; }
.st-driver-card small { color: var(--muted); font-size: .74rem; }
.st-driver-card .call { margin-left: auto; border: 0; background: var(--ok); color: #06231a; width: 2.1rem; height: 2.1rem; border-radius: 50%; cursor: pointer; }
.st-delivery-opts { margin-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.st-delivery-opts button { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: .5rem; padding: .5rem .7rem; font: 600 .8rem inherit; cursor: pointer; text-align: left; }
.st-delivery-opts button:hover { border-color: var(--brand); }
.st-pod { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); border-radius: .6rem; padding: .7rem 1rem; font-size: .85rem; margin-top: 1rem; }

/* SHIPMENTS TABLE */
.st-ship-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.st-ship-head h2 { margin: 0; }
.st-ship-filters { display: flex; gap: .3rem; flex-wrap: wrap; }
.st-ship-filters button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: .35rem .8rem; font: 600 .78rem inherit; cursor: pointer; }
.st-ship-filters button.active { background: var(--brand); color: #0b1220; border-color: var(--brand); }
.st-table-wrap { overflow-x: auto; }
.st-table { min-width: 720px; background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; box-shadow: var(--shadow); }
.st-trow { display: grid; grid-template-columns: 1.3fr 1.6fr 1fr .9fr .8fr auto; gap: 1rem; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); font-size: .84rem; align-items: center; }
.st-trow:last-child { border-bottom: 0; }
.st-trow.head { background: var(--panel2); font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.st-trow:not(.head) { cursor: pointer; }
.st-trow:not(.head):hover { background: var(--panel2); }
.st-trow .awb { font-weight: 700; font-variant-numeric: tabular-nums; }
.st-trow .route { color: var(--muted); }
.st-trow .eta.late { color: var(--danger); font-weight: 700; }

.st-drawer-overlay { position: fixed; inset: 0; background: rgba(6,11,22,.6); display: flex; justify-content: flex-end; z-index: 120; }
.st-drawer-overlay[hidden] { display: none; }
.st-drawer-card { width: min(30rem, 100%); height: 100%; background: var(--panel); overflow: auto; padding: 1.5rem; animation: stslide .25s ease; }
@keyframes stslide { from { transform: translateX(30px); opacity: 0; } }
.st-drawer-card .dh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.st-drawer-card .dh b { font-size: 1.1rem; }
.st-drawer-card .dh button { border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.st-drawer-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* DISPATCH */
.st-dispatch-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .st-dispatch-grid { grid-template-columns: 1fr; } }
.st-fleet-map-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; box-shadow: var(--shadow); }
#st-fleet-map { width: 100%; height: auto; aspect-ratio: 1.15; background: #060b16; border-radius: .7rem; display: block; }
.st-drivers { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--shadow); position: sticky; top: 76px; }
@media (max-width: 1000px) { .st-drivers { position: static; } }
.st-drivers h3 { margin: 0 0 1rem; font-size: .95rem; }
.st-driver-item { border: 1px solid var(--line); border-radius: .8rem; padding: .8rem; margin-bottom: .7rem; background: var(--panel2); }
.st-driver-item .di-h { display: flex; align-items: center; gap: .6rem; }
.st-driver-item .di-h .av { font-size: 1.3rem; }
.st-driver-item .di-h b { font-size: .88rem; }
.st-driver-item .di-h .dstat { margin-left: auto; font-size: .68rem; font-weight: 800; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; }
.st-driver-item .di-h .dstat.en-route { background: rgba(234,179,8,.15); color: var(--brand-ink); }
.st-driver-item .di-h .dstat.loading { background: rgba(96,165,250,.15); color: var(--info); }
.st-driver-item .di-h .dstat.idle { background: rgba(133,152,181,.15); color: var(--muted); }
.st-driver-item .dmeta { font-size: .74rem; color: var(--muted); margin: .3rem 0 .5rem; }
.st-manifest { display: flex; flex-direction: column; gap: .25rem; }
.st-mstop { display: flex; align-items: center; gap: .5rem; font-size: .8rem; padding: .25rem 0; }
.st-mstop .mn { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .62rem; flex: none; }
.st-mstop.done .mn { background: var(--ok); border-color: var(--ok); color: #06231a; }
.st-mstop.next .mn { background: var(--brand); border-color: var(--brand); color: #0b1220; }
.st-mstop .ms-name { flex: 1; }
.st-mstop.done .ms-name { color: var(--muted); text-decoration: line-through; }
.st-driver-item .di-adv { width: 100%; margin-top: .6rem; }

/* BOOK */
.st-book-wrap { max-width: 720px; margin: 0 auto; }
.st-book-form { display: flex; flex-direction: column; gap: .9rem; }
.st-book-row { display: flex; gap: .6rem; }
.st-book-row .st-f { flex: 1; }
.st-f { display: flex; flex-direction: column; gap: .3rem; font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.st-f input, .st-f select { font: 400 .9rem inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--panel2); color: var(--ink); text-transform: none; }
.st-quote { background: var(--panel2); border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; font-size: .88rem; }
.st-quote .qr { display: flex; justify-content: space-between; padding: .2rem 0; color: var(--muted); }
.st-quote .qr.total { color: var(--ink); font-weight: 800; font-size: 1.1rem; border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .3rem; }

/* ANALYTICS */
.st-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.st-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.2rem; box-shadow: var(--shadow); }
.st-kpi b { font-size: 1.7rem; font-weight: 800; display: block; }
.st-kpi small { color: var(--muted); font-size: .78rem; }
.st-kpi .delta { color: var(--ok); font-size: .74rem; font-weight: 600; }
.st-analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .st-analytics-grid { grid-template-columns: 1fr; } }
.st-card-wide { grid-column: 1 / -1; }
#st-volchart { width: 100%; height: 200px; }
#st-statusdonut { width: 130px; height: 130px; display: block; margin: 0 auto; }
.st-donut-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; justify-content: center; font-size: .76rem; color: var(--muted); margin-top: .6rem; }
.st-donut-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.st-donut-legend i { width: .7rem; height: .7rem; border-radius: 3px; }
.st-hub-row { display: flex; align-items: center; gap: .8rem; padding: .5rem 0; font-size: .82rem; }
.st-hub-row .n { width: 9rem; color: var(--muted); flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-hub-row .bars { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.st-hub-row .bars .bg { height: 8px; background: var(--line); border-radius: 3px; overflow: hidden; }
.st-hub-row .bars .bg i { display: block; height: 100%; }
.st-hub-row .bars .bg.in i { background: var(--info); }
.st-hub-row .bars .bg.out i { background: var(--brand); }

/* Toast */
.st-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--brand); color: #0b1220; padding: .7rem 1.1rem; border-radius: .7rem; font: 700 .88rem inherit; z-index: 200; box-shadow: 0 15px 40px -12px rgba(0,0,0,.6); max-width: 90vw; }
.st-toast[hidden] { display: none; }

/* ==========================================================================
   Wave — light theme + dark re-assert (beats shared .ds-app fallback)
   ========================================================================== */
:root[data-demo-theme="dark"] .st { --bg:#0b1220;--panel:#131c2e;--panel2:#0e1626;--line:#24304a;--ink:#e2e8f0;--muted:#8598b5;--brand-ink:#fde047; }
@media (prefers-color-scheme: dark) { :root:not([data-demo-theme="light"]) .st { --bg:#0b1220;--panel:#131c2e;--panel2:#0e1626;--line:#24304a;--ink:#e2e8f0;--muted:#8598b5;--brand-ink:#fde047; } }
:root[data-demo-theme="light"] .st { --bg:#f5f8fc;--panel:#ffffff;--panel2:#eef3f9;--line:#dde5f0;--ink:#0f1a2e;--muted:#57677f;--brand-ink:#b45309; }
@media (prefers-color-scheme: light) { :root:not([data-demo-theme="dark"]) .st { --bg:#f5f8fc;--panel:#ffffff;--panel2:#eef3f9;--line:#dde5f0;--ink:#0f1a2e;--muted:#57677f;--brand-ink:#b45309; } }
