/* ============================================================================
   CarrierJourney — Design System
   Pure CSS. No frameworks. Light + dark themes via [data-theme].
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;

  --r-xs: 6px;  --r-sm: 9px;  --r-md: 14px;  --r-lg: 20px;  --r-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --t-fast: 130ms cubic-bezier(.4,0,.2,1);
  --t-med: 240ms cubic-bezier(.4,0,.2,1);

  --maxw: 1240px;
  --appbar-h: 60px;
  --sidenav-w: 264px;
}

/* Light theme */
[data-theme="light"] {
  --bg: #eef1f6;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #e4ebfb 0%, transparent 55%),
             radial-gradient(900px 500px at -10% 10%, #e9f6f1 0%, transparent 50%);
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f8;
  --border: #dde3ed;
  --border-strong: #c8d2e0;
  --text: #14213a;
  --text-2: #4a5872;
  --text-3: #7d899e;
  --primary: #2d4ef5;
  --primary-ink: #1c34b8;
  --primary-soft: #e7ecff;
  --accent: #0ea5a0;
  --accent-soft: #d7f4f1;
  --shadow-sm: 0 1px 2px rgba(20,33,58,.06), 0 1px 3px rgba(20,33,58,.08);
  --shadow-md: 0 4px 14px rgba(20,33,58,.08), 0 2px 6px rgba(20,33,58,.06);
  --shadow-lg: 0 18px 50px rgba(20,33,58,.18);
  --ok: #15a05a;   --ok-soft: #d8f3e3;
  --warn: #c47e0a; --warn-soft: #fbeed0;
  --danger: #d6443a; --danger-soft: #fbe0dd;
  --info: #2f72d8; --info-soft: #dde9fb;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg-grad: radial-gradient(1100px 560px at 100% -10%, #16224a 0%, transparent 55%),
             radial-gradient(900px 480px at -8% 8%, #0c2b2a 0%, transparent 52%);
  --surface: #111827;
  --surface-2: #161f33;
  --surface-3: #1d2840;
  --border: #283450;
  --border-strong: #36456a;
  --text: #eaf0fb;
  --text-2: #a7b4cd;
  --text-3: #76849f;
  --primary: #6b8bff;
  --primary-ink: #aebfff;
  --primary-soft: #1c2952;
  --accent: #2fd4cc;
  --accent-soft: #103734;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  --ok: #34c97e;   --ok-soft: #10331f;
  --warn: #e0a637; --warn-soft: #36290e;
  --danger: #ff6b5e; --danger-soft: #3a1714;
  --info: #6aa5f0; --info-soft: #122339;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--primary-soft); }

/* Scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ============================== App bar ============================== */
.appbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--appbar-h);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.appbar__brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding: 6px; border-radius: var(--r-sm); }
.appbar__brand:hover { background: var(--surface-2); }
.appbar__logo {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: var(--shadow-sm);
}
.appbar__title strong { display: block; font-size: 15px; line-height: 1.1; }
.appbar__title strong span { color: var(--primary); }
.appbar__title small { color: var(--text-3); font-size: 11px; letter-spacing: .02em; }
.appbar__controls { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

.field--inline { display: flex; flex-direction: column; gap: 2px; }
.field__label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; padding-left: 2px; }
.select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d899e' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-sm); padding: 7px 28px 7px 11px; font-size: 13px; font-weight: 500;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.conn {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 7px 13px; color: var(--text-2); font-size: 12.5px; font-weight: 600;
  transition: border-color var(--t-fast);
}
.conn:hover { border-color: var(--border-strong); }
.conn__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 0 currentColor; }
.conn[data-state="live"] .conn__dot { background: var(--ok); animation: pulse 2.2s infinite; }
.conn[data-state="demo"] .conn__dot { background: var(--warn); }
.conn[data-state="off"] .conn__dot { background: var(--danger); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(21,160,90,.5)} 70%{box-shadow:0 0 0 7px rgba(21,160,90,0)} 100%{box-shadow:0 0 0 0 rgba(21,160,90,0)} }

.iconbtn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: var(--t-fast);
}
.iconbtn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ============================== Layout ============================== */
.layout { display: grid; grid-template-columns: var(--sidenav-w) 1fr; align-items: start; }

.sidenav {
  position: sticky; top: var(--appbar-h);
  height: calc(100vh - var(--appbar-h));
  display: flex; flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.sidenav__heading { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 0 10px var(--sp-3); }
.sidenav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; position: relative; }

.navitem {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
  cursor: pointer; border: 1px solid transparent; position: relative;
  transition: var(--t-fast);
}
.navitem:hover { background: var(--surface-2); color: var(--text); }
.navitem.is-active { background: var(--primary-soft); color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.navitem__num {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border);
}
.navitem.is-active .navitem__num { background: var(--primary); color: #fff; border-color: var(--primary); }
.navitem__label { flex: 1; }
.navitem__count { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--surface-3); border-radius: var(--r-pill); padding: 1px 8px; }
.navitem.is-active .navitem__count { background: #fff; color: var(--primary-ink); }

.sidenav__footer { margin-top: auto; padding-top: var(--sp-4); }
.ctx { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px 14px; }
.ctx__label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; margin-bottom: 4px; }
.ctx__carrier { font-weight: 700; font-size: 14px; }
.ctx__policy { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; word-break: break-all; }

/* ============================== Content ============================== */
.content { padding: var(--sp-6) var(--sp-6) var(--sp-7); min-height: calc(100vh - var(--appbar-h)); outline: none; }
.wrap { max-width: var(--maxw); margin: 0 auto; }

.view-head { margin-bottom: var(--sp-5); }
.view-head__eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 8px; }
.view-head h1 { font-size: 27px; line-height: 1.15; }
.view-head p { color: var(--text-2); margin-top: 8px; max-width: 70ch; }
.view-head__row { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; }
.view-head__row .spacer { flex: 1; }

/* enter animation */
.fade-in { animation: fadeUp var(--t-med) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================== Cards ============================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card--pad { padding: var(--sp-5); }
.card--hover { transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast); cursor: pointer; }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.grid { display: grid; gap: var(--sp-4); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
@media (max-width: 1080px) { .grid--4 { grid-template-columns: repeat(2,1fr);} .grid--3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 720px) { .grid--4,.grid--3,.grid--2 { grid-template-columns: 1fr;} }

/* Stat tiles */
.stat { padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.stat__icon { position: absolute; right: -8px; top: -8px; opacity: .08; transform: scale(2.4); }
.stat__label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat__value { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat__sub { font-size: 12px; color: var(--text-2); }

/* ============================== Buttons ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 700;
  border: 1px solid transparent; transition: var(--t-fast); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover:not(:disabled) { background: var(--primary-ink); }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-3); }
.btn--outline { background: transparent; color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.btn--outline:hover:not(:disabled) { background: var(--primary-soft); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(.93); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--lg { padding: 13px 24px; font-size: 15px; }

.btnrow { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* ============================== Badges ============================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutral { background: var(--surface-3); color: var(--text-2); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge.no-dot::before { display: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }

/* ============================== Forms ============================== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.form-grid .col-span-2 { grid-column: 1 / -1; }
@media (max-width: 640px){ .form-grid { grid-template-columns: 1fr; } .form-grid .col-span-2 { grid-column: auto; } }

.field-block { display: flex; flex-direction: column; gap: 6px; }
.field-block > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-block .req { color: var(--danger); }
.input, .textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; font-family: inherit;
  transition: var(--t-fast);
}
.textarea { resize: vertical; min-height: 84px; }
.input:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.input.invalid, .textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { font-size: 11.5px; color: var(--danger); font-weight: 600; }
.field-hint { font-size: 11.5px; color: var(--text-3); }

.checkrow { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; transition: var(--t-fast); }
.checkrow:hover { border-color: var(--border-strong); }
.checkrow input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); }
.checkrow__text { font-size: 13px; }
.checkrow__text small { display: block; color: var(--text-3); font-size: 11.5px; }

.pillselect { display: flex; flex-wrap: wrap; gap: 8px; }
.pillopt { padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: var(--t-fast); user-select: none; }
.pillopt:hover { border-color: var(--border-strong); }
.pillopt.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }

.fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-5); margin: 0; }
.fieldset > legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 0 8px; }

/* ============================== Lifecycle stepper ============================== */
.journey { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; position: relative; padding: var(--sp-2) 0; }
.jstep { display: flex; flex-direction: column; align-items: center; gap: 9px; position: relative; padding: 0 4px; cursor: pointer; }
.jstep::before { content: ""; position: absolute; top: 23px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.jstep:first-child::before { display: none; }
.jstep.done::before, .jstep.current::before { background: linear-gradient(90deg, var(--accent), var(--primary)); }
.jstep__dot {
  position: relative; z-index: 1; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border);
  color: var(--text-3); transition: var(--t-med);
}
.jstep.done .jstep__dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.jstep.current .jstep__dot { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 6px var(--primary-soft); transform: scale(1.06); }
.jstep:hover .jstep__dot { border-color: var(--primary); }
.jstep__name { font-size: 12px; font-weight: 700; color: var(--text-2); text-align: center; }
.jstep.current .jstep__name { color: var(--primary-ink); }
.jstep__sub { font-size: 10.5px; color: var(--text-3); text-align: center; }
@media (max-width: 880px){ .journey { grid-template-columns: 1fr; gap: 4px; } .jstep { flex-direction: row; justify-content: flex-start; } .jstep::before{ display:none;} .jstep__name,.jstep__sub{ text-align:left;} }

/* ============================== Tables ============================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--t-fast); cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Definition list */
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13.5px; }
.dl dt { color: var(--text-3); font-weight: 600; }
.dl dd { margin: 0; color: var(--text); font-weight: 600; text-align: right; }

/* Key-value rows */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: none; }
.kv__k { color: var(--text-3); font-weight: 600; font-size: 13px; }
.kv__v { font-weight: 700; text-align: right; }

/* Section title */
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--sp-4); font-size: 16px; }
.section-title .badge { margin-left: auto; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 var(--sp-5); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.tl-item.is-muted::before { border-color: var(--border-strong); }
.tl-item.is-ok::before { border-color: var(--ok); background: var(--ok); }
.tl-item.is-danger::before { border-color: var(--danger); background: var(--danger); }
.tl-date { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.tl-title { font-weight: 700; margin-top: 1px; }
.tl-body { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* Premium hero */
.premium-hero { display: flex; align-items: baseline; gap: 12px; }
.premium-hero .amt { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.premium-hero .per { color: var(--text-3); font-weight: 600; }

/* Meter */
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width var(--t-med); }

/* Empty / loading states */
.empty { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--text-3); }
.empty__icon { font-size: 40px; margin-bottom: 10px; opacity: .7; }
.empty h3 { color: var(--text-2); margin-bottom: 6px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

.spinner { width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== Modal ============================== */
.modal-root { position: fixed; inset: 0; z-index: 80; display: none; }
.modal-root.is-open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(8,12,24,.55); backdrop-filter: blur(3px); animation: fadeIn var(--t-fast); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal__panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: modalIn var(--t-med);
}
.modal__panel.wide { width: min(860px, calc(100vw - 32px)); }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%,-50%) scale(1);} }
.modal__head { display: flex; align-items: center; gap: 12px; padding: var(--sp-5); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal__head h2 { font-size: 18px; }
.modal__head .sub { color: var(--text-3); font-size: 12.5px; }
.modal__close { margin-left: auto; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; font-size: 18px; line-height: 1; }
.modal__close:hover { color: var(--text); border-color: var(--border-strong); }
.modal__body { padding: var(--sp-5); }
.modal__foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); display: flex; gap: var(--sp-3); justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }

/* ============================== Toast ============================== */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-left-width: 4px;
  border-radius: var(--r-md); padding: 13px 15px; box-shadow: var(--shadow-lg);
  animation: toastIn var(--t-med);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.leaving { animation: toastOut var(--t-fast) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast--ok { border-left-color: var(--ok); }
.toast--err { border-left-color: var(--danger); }
.toast--info { border-left-color: var(--info); }
.toast--warn { border-left-color: var(--warn); }
.toast__icon { font-size: 17px; line-height: 1.4; }
.toast__body { flex: 1; }
.toast__title { font-weight: 700; font-size: 13.5px; }
.toast__msg { font-size: 12.5px; color: var(--text-2); margin-top: 2px; word-break: break-word; }
.toast__x { background: none; border: none; color: var(--text-3); font-size: 16px; line-height: 1; padding: 0 2px; }

/* ============================== Utilities ============================== */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--sp-2);} .gap-3 { gap: var(--sp-3);} .gap-4 { gap: var(--sp-4);} .gap-5{ gap: var(--sp-5);}
.mt-3 { margin-top: var(--sp-3);} .mt-4 { margin-top: var(--sp-4);} .mt-5 { margin-top: var(--sp-5);} .mt-6{ margin-top: var(--sp-6);}
.mb-3 { margin-bottom: var(--sp-3);} .mb-4 { margin-bottom: var(--sp-4);} .mb-5{ margin-bottom: var(--sp-5);}
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex1 { flex: 1; }
.hidden { display: none !important; }
.cap { text-transform: capitalize; }
.fw7 { font-weight: 700; }
.fs-sm { font-size: 12.5px; }
.fs-lg { font-size: 18px; }
.divider { height: 1px; background: var(--border); margin: var(--sp-4) 0; border: none; }

/* code/pre for raw payloads */
pre.code { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px; font-family: var(--font-mono); font-size: 12px; overflow: auto; color: var(--text-2); max-height: 320px; line-height: 1.55; }

/* responsive layout collapse */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .sidenav__heading, .sidenav__footer { display: none; }
  .sidenav__list { flex-direction: row; }
  .navitem { white-space: nowrap; }
  .content { padding: var(--sp-5) var(--sp-4); }
  .appbar__controls .field--inline .field__label { display: none; }
}
