:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #9eb3c8;
  --muted-strong: #c2d2e0;
  --bg: #061426;
  --bg-deep: #030b15;
  --panel: #0a2038;
  --panel-2: #0d2946;
  --line: rgba(145, 190, 226, .2);
  --line-strong: rgba(143, 213, 255, .42);
  --cyan: #44d8ff;
  --blue: #2b8cff;
  --green: #2dd4a7;
  --amber: #ffbd4a;
  --red: #ff6f86;
  --violet: #a58bff;
  --shadow: 0 24px 70px rgba(0, 4, 12, .38);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; background: var(--bg-deep); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 88% 5%, rgba(43, 140, 255, .19), transparent 32rem),
    radial-gradient(circle at 12% 9%, rgba(68, 216, 255, .1), transparent 28rem),
    linear-gradient(160deg, #07182c 0%, #04101e 68%, #030b15 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(97, 176, 238, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(97, 176, 238, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(68, 216, 255, .55); outline-offset: 2px; }

.shell { width: min(1540px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.brand { display: flex; min-width: 0; align-items: center; gap: 12px; }
.brand-mark { position: relative; display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(68, 216, 255, .45); border-radius: 13px; background: linear-gradient(145deg, rgba(43, 140, 255, .24), rgba(68, 216, 255, .06)); box-shadow: inset 0 0 22px rgba(68, 216, 255, .08); }
.brand-mark::before { width: 20px; height: 20px; border: 3px solid var(--cyan); border-right-color: transparent; border-radius: 50%; content: ""; transform: rotate(-28deg); }
.brand-mark::after { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: white; box-shadow: 0 0 12px var(--cyan); content: ""; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; overflow: hidden; font-size: 15px; letter-spacing: .09em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.brand-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.source-chip { display: inline-flex; min-height: 34px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(8, 31, 54, .82); padding: 0 12px; color: var(--muted-strong); font-size: 12px; font-weight: 800; }
.source-chip::before { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(45, 212, 167, .7); content: ""; }
.source-chip.review::before { background: var(--amber); box-shadow: 0 0 12px rgba(255, 189, 74, .65); }

.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .55fr); gap: 18px; margin-bottom: 18px; }
.hero-main, .hero-side, .panel { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(12, 42, 72, .88), rgba(5, 22, 40, .92)); box-shadow: var(--shadow); }
.hero-main { position: relative; min-width: 0; overflow: hidden; border-radius: 22px; padding: clamp(24px, 5vw, 56px); }
.hero-main::after { position: absolute; top: -80px; right: -50px; width: 260px; height: 260px; border: 34px solid rgba(68, 216, 255, .06); border-radius: 50%; content: ""; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { width: 22px; height: 1px; background: var(--cyan); content: ""; }
h1 { position: relative; z-index: 1; max-width: 850px; margin: 0; font-size: clamp(38px, 6vw, 76px); line-height: .98; letter-spacing: -.055em; overflow-wrap: anywhere; }
.hero-main p { position: relative; z-index: 1; max-width: 780px; margin: 20px 0 0; color: var(--muted-strong); font-size: clamp(15px, 2vw, 18px); line-height: 1.6; }
.hero-side { display: grid; align-content: space-between; border-radius: 22px; padding: 24px; }
.hero-side h2 { margin: 0 0 10px; font-size: 17px; }
.hero-side p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.live-line { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted-strong); font-size: 12px; }
.live-line b { color: white; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.metric { position: relative; isolation: isolate; min-width: 0; min-height: 124px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, rgba(12, 43, 74, .86), rgba(7, 26, 46, .9)); padding: 17px; }
.metric::after { position: absolute; z-index: 0; right: -30px; bottom: -48px; width: 110px; height: 110px; border: 20px solid rgba(68, 216, 255, .045); border-radius: 50%; pointer-events: none; content: ""; }
.metric span { position: relative; z-index: 1; display: block; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.metric strong { position: relative; z-index: 1; display: inline-block; width: auto; min-width: max-content; max-width: none; margin-top: 12px; font-size: clamp(23px, 3vw, 34px); font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.04em; overflow: visible; overflow-wrap: normal; white-space: nowrap; word-break: normal; }
.metric strong[data-value-size="wide"] { font-size: clamp(20px, 2.45vw, 30px); }
.metric strong[data-value-size="extra-wide"] { font-size: clamp(18px, 2vw, 26px); }
.metric small { position: relative; z-index: 1; display: block; width: 100%; max-width: 100%; margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.35; overflow: visible; overflow-wrap: break-word; white-space: normal; }
.metric.positive strong { color: #8df7d6; }
.metric.attention strong { color: #ffd384; }

.toolbar { position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 30; display: flex; align-items: end; gap: 10px; margin: 0 -8px 14px; border: 1px solid rgba(145,190,226,.18); border-radius: 14px; background: rgba(4,18,33,.92); padding: 10px; box-shadow: 0 14px 34px rgba(0,7,18,.32); backdrop-filter: blur(16px); }
.toolbar .search { min-width: 240px; flex: 1 1 420px; }
.toolbar label { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
input, select { min-width: 0; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; background: rgba(3, 16, 30, .9); padding: 0 12px; color: var(--ink); }
input::placeholder { color: #6f879f; }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(16, 53, 87, .8); padding: 0 14px; color: var(--ink); font-weight: 850; }
.button:hover { border-color: var(--cyan); background: rgba(24, 74, 116, .9); }
.button.primary { border-color: #238cff; background: linear-gradient(180deg, #2795ff, #156ed0); }
.button.ghost { background: rgba(4, 18, 33, .55); }
.button.compact { min-height: 34px; padding: 0 10px; font-size: 11px; }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; }

.panel { min-width: 0; overflow: hidden; border-radius: 18px; }
.panel-head { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 18px 20px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-head-actions { display: flex; min-width: 0; flex: 0 0 auto; align-items: center; gap: 8px; }
.panel[data-collapsible-panel="true"] > .panel-head { cursor: default; }
.panel[data-collapsed="true"] > .panel-head { border-bottom-color: transparent; }
.panel[data-collapsed="true"] > :not(.panel-head) { display: none !important; }
.panel-collapse-button { min-width: 54px; }
.sticky-decision-panel { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow: auto; }
.panel-count { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted-strong); font-size: 11px; font-weight: 850; }
.inline-control { display: grid; min-width: 140px; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.inline-control select { min-height: 36px; }

.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th { position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); background: #081c31; padding: 11px 14px; color: var(--muted); font-size: 10px; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.sort-button { border: 0; background: transparent; padding: 0; color: inherit; font: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; }
.sort-button::after { margin-left: 5px; color: rgba(158,179,200,.55); content: "↕"; }
.sort-button[aria-sort="ascending"]::after { color: var(--cyan); content: "↑"; }
.sort-button[aria-sort="descending"]::after { color: var(--cyan); content: "↓"; }
td { min-width: 100px; border-bottom: 1px solid rgba(145, 190, 226, .11); padding: 15px 14px; color: var(--muted-strong); font-size: 13px; vertical-align: top; }
tbody tr:hover { background: rgba(68, 216, 255, .035); }
tbody tr[role="button"] { cursor: pointer; }
tbody tr[role="button"]:focus-visible { outline: 3px solid rgba(68, 216, 255, .55); outline-offset: -3px; }
tbody tr:last-child td { border-bottom: 0; }
.load-cell { min-width: 165px; }
.load-cell strong, .route strong { display: block; color: white; font-size: 13px; overflow-wrap: anywhere; }
.load-cell span, .route span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.route { min-width: 210px; }
.money-cell { color: white; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.profit-value { color: #8df7d6; font-weight: 850; }
.profit-value.negative { color: #ff9aaa; }
.unknown { color: #ffd384; font-size: 11px; font-weight: 800; }
.status-pill { position: relative; display: inline-flex; max-width: 150px; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(8, 32, 55, .85); padding: 5px 18px; color: var(--muted-strong); font-size: 10px; font-weight: 850; line-height: 1.25; text-align: center; overflow-wrap: normal; word-break: normal; hyphens: none; }
.status-pill::before { position: absolute; left: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); content: ""; }
.status-pill.unassigned::before, .status-pill.tendered::before { background: var(--amber); }
.status-pill.delivered::before, .status-pill.closed::before { background: var(--green); }
.status-pill.attention::before { background: var(--red); }

.empty { padding: 50px 24px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 7px; color: white; }

.stage-rail { display: grid; grid-template-columns: repeat(9, minmax(112px, 1fr)); gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.stage-button { min-height: 82px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7, 28, 49, .8); padding: 12px; color: var(--ink); text-align: left; }
.stage-button:hover, .stage-button.active { border-color: rgba(68, 216, 255, .72); background: linear-gradient(145deg, rgba(25, 83, 127, .85), rgba(7, 32, 56, .9)); }
.stage-button span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.stage-button strong { display: block; margin-top: 9px; font-size: 25px; }

.command-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; }
.load-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.load-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(11, 38, 66, .9), rgba(6, 24, 43, .92)); padding: 15px; }
.load-card.attention { border-color: rgba(255, 111, 134, .55); }
.load-card-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 10px; }
.load-card-head h3 { min-width: 0; margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.load-card-head h3 span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 650; }
.card-route { display: flex; align-items: center; gap: 7px; margin-top: 14px; color: white; font-size: 13px; font-weight: 750; }
.card-route span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-route b { flex: 0 0 auto; color: var(--cyan); }
.card-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.card-meta div { min-width: 0; border: 1px solid rgba(145, 190, 226, .12); border-radius: 9px; background: rgba(2, 15, 28, .48); padding: 9px; }
.card-meta span { display: block; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.card-meta strong { display: block; margin-top: 5px; color: var(--muted-strong); font-size: 11px; overflow-wrap: anywhere; }
.signal-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 11px; color: var(--muted); font-size: 11px; }
.signal-row b { color: var(--muted-strong); }
.attention-note { margin-top: 10px; border: 1px solid rgba(255, 111, 134, .35); border-radius: 9px; background: rgba(107, 21, 43, .2); padding: 9px; color: #ffc3cc; font-size: 11px; line-height: 1.4; }

.attention-panel { align-self: start; }
.attention-list { display: grid; gap: 8px; padding: 12px; }
.attention-item { border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 20, 36, .7); padding: 11px; }
.attention-item strong { display: block; color: white; font-size: 12px; }
.attention-item p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.attention-item.risk { border-color: rgba(255, 111, 134, .45); }
.attention-item.critical { border-color: rgba(255, 111, 134, .65); }
.attention-item.high { border-color: rgba(255, 189, 74, .58); }
.attention-item span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.attention-main { display: block; width: 100%; min-width: 0; border: 0; background: transparent; padding: 0; color: inherit; text-align: left; }
.attention-main:hover strong { color: var(--cyan); }

.integrity-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(8, 31, 54, .82); padding: 12px 14px; font-size: 12px; }
.integrity-banner.good { border-color: rgba(45, 212, 167, .42); }
.integrity-banner.critical { border-color: rgba(255, 111, 134, .6); }
.integrity-banner span { color: var(--muted); }
.decision-panel { margin-bottom: 14px; border-color: rgba(68,216,255,.42); background: linear-gradient(130deg, rgba(10,61,87,.96), rgba(5,22,40,.94)); }
.decision-summary { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(240px,.6fr); gap: 12px; padding: 16px 20px 20px; }
.decision-summary > div { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: rgba(3,17,31,.58); padding: 14px; }
.decision-summary h3 { margin: 0; font-size: 20px; }
.decision-summary p { margin: 7px 0 0; color: var(--muted-strong); font-size: 12px; line-height: 1.5; }
.decision-summary .decision-value { color: #ffd384; font-size: clamp(25px,4vw,40px); font-variant-numeric: tabular-nums; }
.decision-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.analysis-layout, .map-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.map-layout { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); }
.compact-panel { min-height: 310px; }
.mini-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; }
.mini-stat-grid > div { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: rgba(3, 17, 31, .58); padding: 12px; }
.mini-stat-grid span, .scenario-result span, .aging-grid span { display: block; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.mini-stat-grid strong, .scenario-result strong, .aging-grid strong { display: block; margin-top: 7px; color: white; font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dense-list { display: grid; gap: 8px; max-height: 310px; overflow: auto; padding: 12px; }
.dense-item { display: block; width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(3, 17, 31, .58); padding: 11px; color: var(--ink); text-align: left; }
button.dense-item { cursor: pointer; }
button.dense-item:hover { border-color: var(--cyan); }
.dense-item strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.dense-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.saved-view-list { display: grid; gap: 8px; padding: 12px; }
.saved-view-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.saved-view-row .dense-item { min-height: 58px; }
.executive-brief { display: grid; gap: 9px; padding: 14px; }
.executive-brief > * { margin: 0; }
.executive-brief ul { display: grid; gap: 7px; padding-left: 18px; color: var(--muted-strong); font-size: 12px; line-height: 1.5; }
.replay-control { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(3, 17, 31, .58); padding: 13px; }
.replay-control input { width: 100%; min-height: 28px; padding: 0; }
.replay-control strong { color: var(--muted-strong); font-size: 11px; overflow-wrap: anywhere; }
.dense-item.good, .adapter.good { border-color: rgba(45, 212, 167, .38); }
.dense-item.critical, .adapter.critical { border-color: rgba(255, 111, 134, .48); }
.rank-list { display: grid; max-height: 390px; overflow: auto; }
.rank-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); padding: 13px 16px; }
.rank-row:last-child { border-bottom: 0; }
.rank-row > div { min-width: 0; }
.rank-row strong, .rank-row span { display: block; overflow-wrap: anywhere; }
.rank-row strong { font-size: 12px; }
.rank-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.rank-values { flex: 0 0 auto; text-align: right; }
.rank-values strong { color: #8df7d6; font-variant-numeric: tabular-nums; }
.scenario-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 14px 14px 0; }
.scenario-form label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.scenario-result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; }
.scenario-result > div, .aging-grid > div { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(3, 17, 31, .58); padding: 11px; }
.scenario-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.aging-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 14px; }
.adapter-grid { display: grid; gap: 8px; padding: 14px; }
.adapter { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 11px; }
.adapter strong { font-size: 12px; }
.adapter span { color: var(--muted); font-size: 10px; }
.trend-chart { display: grid; gap: 9px; padding: 14px; }
.trend-row { display: grid; grid-template-columns: 78px minmax(100px, 1fr) 145px; align-items: center; gap: 10px; }
.trend-row time, .trend-row strong { font-size: 10px; }
.trend-row time { color: var(--muted); }
.trend-row strong { text-align: right; }
.trend-track { position: relative; height: 14px; overflow: hidden; border-radius: 999px; background: rgba(3, 17, 31, .75); }
.trend-track span { position: absolute; left: 0; height: 100%; border-radius: inherit; }
.trend-gross { background: rgba(43, 140, 255, .55); }
.trend-profit { background: #2dd4a7; }
.benchmark-panel { padding: 4px; }
.benchmark-note { margin: 0; padding: 0 14px 14px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.action-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 14px; padding: 12px; }
.action-strip.inline { margin-top: 0; border: 0; box-shadow: none; }
.action-strip [role="status"] { min-width: 180px; flex: 1 1 auto; color: var(--muted); font-size: 11px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; border-top: 1px solid var(--line); padding: 12px; color: var(--muted); font-size: 11px; }

.load-map { width: 100%; min-height: 470px; background: #061426; }
.load-map > .empty { min-height: 390px; display: grid; align-content: center; }
.load-map > .button { display: flex; width: max-content; margin: -115px auto 0; position: relative; z-index: 1; }
.map-panel { min-height: 540px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 13px; border-bottom: 1px solid var(--line); padding: 9px 14px; color: var(--muted); font-size: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { display: inline-block; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: #ffbd4a; }
.map-legend i.trail { width: 22px; height: 4px; border: 0; border-radius: 999px; background: #39e875; }
.map-legend i.stop { background: #a58bff; }
.maplibregl-map { font-family: inherit; }
.maplibregl-ctrl-group { overflow: hidden; border: 1px solid var(--line) !important; border-radius: 10px !important; background: #0a2038 !important; }
.maplibregl-ctrl-group button { filter: invert(1); }
.risk-strip { display: flex; min-width: 0; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.risk-strip span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 7px; color: var(--muted-strong); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.risk-strip .grade-a, .risk-strip .on_time { border-color: rgba(45, 212, 167, .48); color: #8df7d6; }
.risk-strip .grade-d, .risk-strip .grade-f, .risk-strip .critical { border-color: rgba(255, 111, 134, .55); color: #ffc3cc; }
.risk-strip .high, .risk-strip .grade-c { border-color: rgba(255, 189, 74, .55); color: #ffe2aa; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.detail-dialog { width: min(820px, calc(100% - 28px)); max-height: 88vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 18px; background: linear-gradient(145deg, #0c2a48, #051628); padding: 22px; color: var(--ink); box-shadow: 0 30px 100px rgba(0, 0, 0, .68); }
.detail-dialog::backdrop { background: rgba(0, 8, 18, .78); backdrop-filter: blur(5px); }
.detail-dialog form { position: sticky; top: 0; z-index: 2; height: 0; text-align: right; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #0a2038; color: white; font-size: 23px; }
.detail-dialog h2 { margin: 0; padding-right: 48px; font-size: 28px; }
.detail-dialog h3 { margin: 24px 0 8px; font-size: 14px; }
.dialog-lead { color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline { display: grid; gap: 0; max-height: 310px; overflow: auto; }
.timeline > div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 14px; border-left: 2px solid rgba(68, 216, 255, .3); padding: 7px 0 7px 13px; }
.timeline time { color: var(--muted); font-size: 10px; }
.timeline span { font-size: 11px; }

.review-notice { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; border: 1px solid rgba(255, 189, 74, .35); border-radius: 12px; background: rgba(101, 63, 10, .22); padding: 11px 13px; color: #ffe2aa; font-size: 12px; line-height: 1.45; }
.review-notice b { color: white; }
.review-notice[hidden] { display: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .command-layout { grid-template-columns: minmax(0, 1fr); }
  .attention-panel, .sticky-decision-panel { position: static; max-height: none; }
  .insight-grid { grid-template-columns: 1fr 1fr; }
  .map-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 1540px); padding-top: 16px; }
  .topbar, .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar { position: static; margin-inline: 0; }
  .topbar { gap: 12px; }
  .source-chip { align-self: flex-start; }
  .hero { grid-template-columns: 1fr; }
  .hero-main { padding: 30px 22px; }
  .hero-side { min-height: 180px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .search { min-width: 0; flex-basis: auto; }
  .toolbar label { width: 100%; }
  .load-grid { grid-template-columns: 1fr; }
  .insight-grid, .analysis-layout { grid-template-columns: 1fr; }
  .decision-summary { grid-template-columns: 1fr; }
  .integrity-banner { align-items: flex-start; flex-direction: column; }
  .aging-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .load-map { min-height: 390px; }
}

@media (max-width: 520px) {
  .brand-copy span { display: none; }
  h1 { font-size: 42px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 110px; padding: 14px; }
  .metric strong { font-size: 24px; }
  .panel-head { align-items: flex-start; padding: 15px; }
  .panel-head-actions { align-items: flex-end; flex-direction: column-reverse; }
  .load-grid { padding: 10px; }
  .card-meta { grid-template-columns: 1fr; }
  .scenario-form, .scenario-result, .mini-stat-grid { grid-template-columns: 1fr; }
  .pager { flex-wrap: wrap; }
  .timeline > div { grid-template-columns: 1fr; gap: 3px; }
  .trend-row { grid-template-columns: 1fr; gap: 4px; }
  .trend-row strong { text-align: left; }
}

@media (max-width: 380px) {
  .metric-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .stage-button, tbody tr { transition: border-color .16s ease, background .16s ease, transform .16s ease; }
  .button:hover, .stage-button:hover { transform: translateY(-1px); }
}
