/* Portable Exit: one page, three roles. Phones first; wider screens add columns. */
:root {
  --ink: #0b1324;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --navy: #0b1324;
  --navy-2: #13213d;
  --amber: #f59e0b;
  --amber-ink: #3b2300;
  --teal: #14b8a6;
  --violet: #8b5cf6;
  --rose: #f43f5e;
  --ship: #f59e0b;      /* shipper */
  --dispatch: #14b8a6;  /* dispatcher */
  --pricing: #8b5cf6;   /* pricing manager */
  --accent: var(--amber);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  font-size: 15px; line-height: 1.45;
}
a { color: inherit; }
button, input, select { font: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

body[data-persona="shipper"] { --accent: var(--ship); }
body[data-persona="dispatch"] { --accent: var(--dispatch); }
body[data-persona="pricing"] { --accent: var(--pricing); }

/* ─── landing ─────────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(139, 92, 246, .35), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(20, 184, 166, .30), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  padding: 28px 20px 36px;
}
.hero-inner { max-width: 1120px; margin: 0 auto; position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--amber), var(--rose)); color: #fff; font-size: 16px;
}
.eyebrow { margin-top: 36px; display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fcd34d; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); padding: 5px 10px; border-radius: 999px; }
.hero h1 { font-size: 36px; line-height: 1.05; letter-spacing: -.03em; margin: 14px 0 12px; font-weight: 850; }
.hero h1 .strike { color: #94a3b8; text-decoration: line-through; text-decoration-color: var(--rose); text-decoration-thickness: 4px; }
.hero h1 .glow { background: linear-gradient(90deg, #fcd34d, #f472b6 60%, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lede { font-size: 17px; color: #cbd5e1; max-width: 620px; margin: 0; }
.hero-grid { display: grid; gap: 24px; }
.hero-cta { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn-hero { background: #fff; color: var(--ink); border: 0; padding: 12px 18px; border-radius: 12px; font-weight: 800; cursor: pointer; text-decoration: none; }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .2); padding: 12px 18px; border-radius: 12px; font-weight: 700; cursor: pointer; text-decoration: none; }

/* before / after: the 40-branch function vs the rate-card rows */
.versus { display: grid; gap: 12px; }
.code {
  background: rgba(2, 6, 23, .55); border: 1px solid rgba(148, 163, 184, .2); border-radius: 14px;
  padding: 14px 14px 10px; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #cbd5e1; overflow: hidden; position: relative;
}
.code .title, .rows .title { font: 700 11px/1 ui-sans-serif, system-ui; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; display: flex; justify-content: space-between; }
.code .title { color: #fda4af; }
.code .k { color: #f472b6; } .code .s { color: #fcd34d; } .code .c { color: #64748b; }
.code .fade { position: absolute; left: 0; right: 0; bottom: 0; height: 54px; background: linear-gradient(transparent, rgba(11, 19, 36, .95)); }
.code .badge { position: absolute; right: 12px; bottom: 10px; background: var(--rose); color: #fff; font: 800 12px ui-sans-serif, system-ui; padding: 4px 9px; border-radius: 999px; }
.rows { background: rgba(255, 255, 255, .06); border: 1px solid rgba(94, 234, 212, .35); border-radius: 14px; padding: 14px; }
.rows .title { color: #5eead4; }
.matrix-mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.matrix-mini th { color: #94a3b8; font-weight: 600; text-align: right; padding: 4px 6px; }
.matrix-mini th:first-child { text-align: left; }
.matrix-mini td { padding: 6px; text-align: right; border-top: 1px solid rgba(148, 163, 184, .15); color: #e2e8f0; font-variant-numeric: tabular-nums; }
.matrix-mini td:first-child { text-align: left; color: #fff; font-weight: 600; }
.matrix-mini td.live { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { color: #e2e8f0; } 50% { color: #5eead4; } }

.section { max-width: 1120px; margin: 0 auto; padding: 36px 20px; }
.section h2 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; }
.section .sub { color: var(--muted); margin: 0 0 20px; max-width: 680px; }

.personas { display: grid; gap: 14px; }
.persona-card {
  position: relative; display: block; text-decoration: none; background: var(--card); border-radius: 20px; padding: 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; overflow: hidden;
}
.persona-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(15, 23, 42, .06), 0 18px 40px rgba(15, 23, 42, .12); }
.persona-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.persona-card .avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--c) 16%, white); }
.persona-card h3 { margin: 14px 0 2px; font-size: 19px; }
.persona-card .who { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.persona-card ul { margin: 0 0 14px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.persona-card ul li { margin: 3px 0; }
.persona-card .go { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: color-mix(in srgb, var(--c) 75%, black); }
.persona-card .route { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); margin-top: 8px; }

.concerns { display: grid; gap: 14px; }
.concern { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.concern .q { font-size: 13px; color: var(--rose); font-weight: 700; font-style: italic; margin-bottom: 8px; }
.concern h4 { margin: 0 0 6px; font-size: 16px; }
.concern p { margin: 0; color: var(--ink-2); font-size: 14px; }
.concern .see { margin-top: 10px; font-size: 13px; font-weight: 700; }
.concern .see a { color: var(--violet); }

.exit-strip { background: var(--navy); color: #cbd5e1; }
.exit-strip .section { padding: 28px 20px; }
.exit-items { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.exit-items span { font: 12px ui-monospace, Menlo, monospace; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); color: #e2e8f0; padding: 6px 10px; border-radius: 8px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* ─── persona shell ───────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.topbar .brand { color: var(--ink); text-decoration: none; font-size: 15px; }
.topbar .brand .logo { width: 26px; height: 26px; font-size: 14px; }
.topbar .brand .name { display: none; }
.persona-switch { margin-left: auto; position: relative; }
.persona-switch select {
  appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 30px 7px 12px; font-weight: 700; font-size: 13px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.tabs { max-width: 1120px; margin: 0 auto; display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; }
.tabs a { white-space: nowrap; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 14px; padding: 10px 10px; border-bottom: 3px solid transparent; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

.page { max-width: 1120px; margin: 0 auto; padding: 18px 16px 60px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.page-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.page-head .who { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.role-banner {
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 90%, black), color-mix(in srgb, var(--accent) 60%, #0b1324));
  display: flex; gap: 14px; align-items: center;
}
.role-banner .avatar { font-size: 30px; width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; flex: none; }
.role-banner h2 { margin: 0; font-size: 18px; }
.role-banner p { margin: 2px 0 0; opacity: .9; font-size: 14px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 850; letter-spacing: -.02em; margin-top: 2px; }
.kpi.warn .value { color: #b45309; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 14px 16px; }

/* list of records: one card per row on phones */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 16px; text-decoration: none; }
.list a.row:hover { background: #f8fafc; }
.row .title { font-weight: 750; }
.row .meta { color: var(--muted); font-size: 13px; }
.row .amount { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.group-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 16px 6px; background: #fafbfd; border-top: 1px solid var(--line); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.await { background: #fef3c7; color: #92400e; }
.chip.dim { background: #ede9fe; color: #5b21b6; }
.chip.scale { background: #dcfce7; color: #166534; }

/* invoice */
.invoice-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 16px; background: #0b1324; color: #fff; }
.invoice-total .label { font-size: 13px; color: #94a3b8; font-weight: 600; }
.invoice-total .value { font-size: 32px; font-weight: 850; letter-spacing: -.02em; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.line .name { font-weight: 750; }
.line .how { grid-column: 1 / -1; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.line .how b { color: var(--ink-2); font-weight: 700; }
.line .amt { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.line.off { opacity: .5; }

.weigh-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.weigh-track .step { border-radius: 12px; border: 1px solid var(--line); padding: 10px; background: #fafbfd; }
.weigh-track .step .label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.weigh-track .step .value { font-size: 18px; font-weight: 850; margin-top: 2px; font-variant-numeric: tabular-nums; }
.weigh-track .step.hot { border-color: color-mix(in srgb, var(--violet) 50%, white); background: #f5f3ff; }
.callout { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 12px; }
.callout.dim { background: #f5f3ff; color: #4c1d95; }
.callout.await { background: #fffbeb; color: #78350f; }
.callout.ok { background: #f0fdf4; color: #14532d; }

/* the hybrid-boundary receipt */
.receipt { border: 2px dashed color-mix(in srgb, var(--dispatch) 60%, white); background: #f0fdfa; border-radius: 14px; padding: 14px; margin-top: 12px; font-size: 14px; }
.receipt h4 { margin: 0 0 8px; font-size: 14px; color: #115e59; }
.receipt code { font: 12.5px ui-monospace, Menlo, monospace; background: #fff; border: 1px solid #ccfbf1; padding: 1px 6px; border-radius: 6px; }
.receipt ol { margin: 6px 0 0; padding-left: 20px; }
.receipt li { margin: 3px 0; }

/* forms */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field select { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 11px 12px; background: #fff; }
.field input:focus, .field select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, white); border-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg label { border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px 8px; text-align: center; cursor: pointer; font-weight: 700; font-size: 13px; background: #fff; }
.seg label small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; margin-top: 2px; }
.seg input { display: none; }
.seg input:checked + label, .seg label.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, white); box-shadow: 0 0 0 1px var(--accent) inset; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 800; cursor: pointer; text-decoration: none; background: var(--accent); color: #fff; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.light { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* pricing matrix */
.matrix-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px; }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.matrix th { font-size: 12px; color: var(--muted); font-weight: 700; background: #fafbfd; }
.matrix th small { display: block; font-weight: 600; text-transform: none; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix tr:last-child td { border-bottom: 0; }
.matrix td a.rate { display: inline-block; text-decoration: none; font-weight: 800; font-variant-numeric: tabular-nums; padding: 5px 9px; border-radius: 9px; background: #f5f3ff; color: #5b21b6; }
.matrix td a.rate:hover { background: var(--pricing); color: #fff; }
.matrix td a.rate small { display: block; font-weight: 600; font-size: 10px; opacity: .75; }
.matrix td .cls { font-weight: 800; text-decoration: none; }
.matrix td .cls small { display: block; color: var(--muted); font-weight: 600; }

.compare { width: 100%; border-collapse: collapse; }
.compare th, .compare td { padding: 9px 12px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.compare th { font-size: 12px; color: var(--muted); border-top: 0; }
.compare th:first-child, .compare td:first-child { text-align: left; }
.delta-up { color: #b91c1c; font-weight: 800; }
.delta-down { color: #15803d; font-weight: 800; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: #fef9c3; } 100% { background: transparent; } }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: 92vw; }
.toast.err { background: #b91c1c; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }

/* provenance: derived values say they can explain themselves */
[data-er-dag] { border-bottom: 1px dotted color-mix(in srgb, currentColor 45%, transparent); cursor: help; }
.why-tip { position: fixed; z-index: 70; max-width: 340px; background: #0b1324; color: #e2e8f0; border-radius: 12px; padding: 10px 12px; font-size: 13px; box-shadow: 0 12px 30px rgba(2, 6, 23, .3); pointer-events: none; }
.why-tip .f { font-weight: 800; color: #fff; margin-bottom: 4px; }
.why-tip code { display: block; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #5eead4; white-space: pre-wrap; word-break: break-word; margin: 4px 0; }
.why-tip .d { color: #94a3b8; }

/* ─── wider screens ───────────────────────────────────────────────────────── */
@media (min-width: 720px) {
  .hero { padding: 32px 32px 56px; }
  .hero h1 { font-size: 54px; }
  .hero-grid { grid-template-columns: 1.1fr 1fr; align-items: end; gap: 40px; }
  .personas { grid-template-columns: repeat(3, 1fr); }
  .concerns { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .topbar .brand .name { display: inline; }
  .page { padding: 24px 24px 80px; }
  .split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
}
