/* Prize Fulfilment dashboard design system. Plain CSS, no build step.
   Scale: 4px spacing grid · radius 6/8 · base 13.5px · one accent (blue) · gold for premium value. */
:root {
  --sidebar-bg: #0e1421;
  --sidebar-bg-2: #151d2e;
  --sidebar-text: #97a3b8;
  --sidebar-text-strong: #e6eaf1;
  --sidebar-border: #1f2a3d;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e7ee;
  --border-strong: #cfd6e0;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eaf1ff;
  --gold: #a16207;
  --gold-soft: #fef6e0;

  --success: #067647; --success-bg: #ecfdf3; --success-bd: #abefc6;
  --warning: #b54708; --warning-bg: #fffaeb; --warning-bd: #fedf89;
  --danger:  #b42318; --danger-bg:  #fef3f2; --danger-bd:  #fecdca;
  --info:    #175cd3; --info-bg:    #eff8ff; --info-bd:    #b2ddff;
  --neutral: #475467; --neutral-bg: #f2f4f7; --neutral-bd: #e4e7ec;

  --r-sm: 6px; --r: 8px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --focus: 0 0 0 3px rgba(37, 99, 235, .28);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
code, .mono { font-family: var(--mono); font-size: 12px; }
h1, h2, h3 { margin: 0; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13.5px; font-weight: 650; }
p { margin: 0 0 var(--s3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}
.brandmark { display: flex; align-items: center; gap: var(--s3); padding: var(--s5) var(--s5) var(--s4); color: var(--sidebar-text-strong); }
.brandmark .logo {
  width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brandmark .name { font-weight: 650; font-size: 14px; line-height: 1.2; }
.brandmark .sub { font-size: 11px; color: var(--sidebar-text); }
.nav { padding: var(--s2) var(--s3); flex: 1; }
.nav-group { margin-bottom: var(--s4); }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #5d6a80; padding: var(--s2) var(--s3) var(--s1); font-weight: 600; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: 7px var(--s3); border-radius: var(--r-sm); color: var(--sidebar-text); font-weight: 500;
  border-left: 2px solid transparent;
}
.nav a:hover { background: var(--sidebar-bg-2); color: var(--sidebar-text-strong); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--sidebar-bg-2); color: #fff; border-left-color: var(--accent); }
.nav .count { font-size: 11px; background: #2a3550; color: #dfe5ef; border-radius: 10px; padding: 0 7px; font-weight: 600; }
.nav .count.warn { background: #5a3a0b; color: #fde7b0; }
.sidebar-foot { border-top: 1px solid var(--sidebar-border); padding: var(--s4) var(--s5); display: grid; gap: var(--s3); }
.whoami { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #26324a; color: #dfe5ef; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.whoami .who { min-width: 0; }
.whoami .who b { display: block; color: var(--sidebar-text-strong); font-weight: 600; font-size: 12.5px; }
.whoami .who span { display: block; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .btn { width: 100%; justify-content: center; background: transparent; color: var(--sidebar-text); border-color: #2a3550; }
.sidebar-foot .btn:hover { background: var(--sidebar-bg-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s6);
}
.crumbs { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.search { position: relative; width: 300px; max-width: 34vw; }
.search input { width: 100%; padding-left: 30px; height: 32px; background: var(--surface-2); }
.search::before { content: ""; position: absolute; left: 11px; top: 10px; width: 9px; height: 9px; border: 1.6px solid var(--faint); border-radius: 50%; }
.search::after { content: ""; position: absolute; left: 20px; top: 19px; width: 5px; height: 1.6px; background: var(--faint); transform: rotate(45deg); }
.content { padding: var(--s6); max-width: 1480px; width: 100%; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head .lede { color: var(--muted); margin: var(--s1) 0 0; max-width: 760px; }
.page-head .actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.section { margin-top: var(--s6); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: inherit; font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--surface); border-color: var(--danger-bd); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #912018; }
.btn-ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* ---------------------------------------------------------------- forms */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); height: 32px; padding: 0 10px; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; }
input[type="checkbox"] { height: auto; width: 15px; height: 15px; accent-color: var(--accent); vertical-align: -3px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field { display: grid; gap: 5px; margin-bottom: var(--s4); }
.field > label, .label { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.field .hint { color: var(--muted); font-size: 12px; }
.field input:not([type="checkbox"]), .field select { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--s4); }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.form-narrow { max-width: 560px; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: end; padding: var(--s3); }
.filters .f { display: grid; gap: 3px; }
.filters .f label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.filters input[type="search"] { width: 240px; }

/* ---------------------------------------------------------------- cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.card-body { padding: var(--s4) var(--s5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--border); min-height: 48px; flex-wrap: wrap; }
.card-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.grid { display: grid; gap: var(--s4); }
.grid-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: var(--s5); align-items: start; }
.stack > * + * { margin-top: var(--s4); }

/* ---------------------------------------------------------------- metrics */
.metric { padding: var(--s4); }
.metric .m-label { font-size: 12px; color: var(--muted); font-weight: 550; display: flex; justify-content: space-between; gap: var(--s2); }
.metric .m-value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric .m-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.metric.is-premium { border-color: #f0dfb2; background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; }
.metric.is-premium .m-value { color: var(--gold); }
.metric.is-warning .m-value { color: var(--warning); }
.metric.is-danger .m-value { color: var(--danger); }
.metric .m-bar { height: 3px; border-radius: 2px; background: var(--neutral-bg); margin-top: var(--s3); overflow: hidden; }
.metric .m-bar span { display: block; height: 100%; background: var(--accent); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .primary { color: var(--text); font-weight: 600; }
.table .sub { display: block; color: var(--muted); font-size: 12px; }
.truncate { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.truncate.w-lg { max-width: 420px; }
.truncate.w-sm { max-width: 160px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }

/* ---------------------------------------------------------------- pills & badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid; white-space: nowrap; line-height: 1;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot::before { display: none; }
.tone-success { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.tone-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-bd); }
.tone-danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-bd); }
.tone-info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-bd); }
.tone-neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-bd); }
.tone-accent  { color: var(--accent);  background: var(--accent-soft); border-color: #c7d7fe; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border: 1px solid; }
.tag.test { color: #5b21b6; background: #f5f3ff; border-color: #ddd6fe; }
.tag.live { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-bd); }
.tag.sandbox { color: #5b21b6; background: #f5f3ff; border-color: #ddd6fe; }
.tag.production { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-bd); }
.env-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; border: 1px solid; }
.env-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.env-production { color: #fff; background: var(--danger); border-color: var(--danger); }
.env-sandbox { color: #6d28d9; background: #f5f3ff; border-color: #ddd6fe; }
.env-test { color: #0e7490; background: #ecfeff; border-color: #a5f0fc; }
.sidebar .env-badge.env-sandbox { background: #2a2350; color: #d6ccff; border-color: #3d3470; }
.sidebar .env-badge.env-test { background: #11343d; color: #a5f0fc; border-color: #1d4a55; }

/* ---------------------------------------------------------------- alerts, empty states */
.alert { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid; margin-bottom: var(--s4); font-size: 13px; }
.alert b { font-weight: 650; }
.alert-success { color: #054f31; background: var(--success-bg); border-color: var(--success-bd); }
.alert-danger { color: #7a271a; background: var(--danger-bg); border-color: var(--danger-bd); }
.alert-warning { color: #7a2e0e; background: var(--warning-bg); border-color: var(--warning-bd); }
.alert-info { color: #194185; background: var(--info-bg); border-color: var(--info-bd); }
.alert ul { margin: 0; padding-left: 18px; }
.empty { text-align: center; padding: var(--s6) var(--s5); color: var(--muted); }
.empty .e-title { color: var(--text); font-weight: 600; font-size: 13.5px; }
.empty .e-text { margin: 4px auto var(--s3); max-width: 460px; font-size: 12.5px; }

/* ---------------------------------------------------------------- key/value, timeline, checklist */
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 7px var(--s4); margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv-section { padding: var(--s4) var(--s5); border-top: 1px solid var(--border); }
.kv-section:first-child { border-top: 0; }
.kv-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin-bottom: var(--s3); }
.timeline { list-style: none; margin: 0; padding: var(--s4) var(--s5); }
.timeline li { position: relative; padding: 0 0 var(--s4) 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 2px; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.t-success::before { background: var(--success); }
.timeline li.t-warning::before { background: #f79009; }
.timeline li.t-danger::before { background: var(--danger); }
.timeline li.t-info::before { background: var(--accent); }
.timeline .t-head { display: flex; justify-content: space-between; gap: var(--s2); }
.timeline .t-title { font-weight: 600; color: var(--text); font-size: 12.5px; }
.timeline .t-time { color: var(--faint); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .t-meta { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.checklist li.done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .c-title { font-weight: 600; color: var(--text); }
.checklist li.done .c-title { color: var(--muted); }
.checklist .c-text { color: var(--muted); font-size: 12px; }
.progress { height: 6px; background: var(--neutral-bg); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); }

/* ---------------------------------------------------------------- provider cards */
.provider-card .p-head { display: flex; gap: var(--s3); align-items: center; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.p-logo { width: 38px; height: 38px; border-radius: 8px; background: #0e1421; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.p-logo.alt { background: var(--accent-soft); color: var(--accent); }
.p-title { min-width: 0; flex: 1; }
.p-title b { display: block; font-size: 14px; color: var(--text); }
.p-title span { font-size: 12px; color: var(--muted); }
.p-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.p-stats > div { padding: var(--s3) var(--s5); border-left: 1px solid var(--border); }
.p-stats > div:first-child { border-left: 0; }
.p-stats .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.p-stats .v { font-size: 15px; font-weight: 650; color: var(--text); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- secret reveal */
.secret-box { border: 1px solid var(--warning-bd); background: var(--warning-bg); border-radius: var(--r); padding: var(--s4); }
.secret-value { display: flex; gap: var(--s2); align-items: stretch; margin-top: var(--s3); }
.secret-value code { flex: 1; min-width: 0; background: #0e1421; color: #e6eaf1; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; overflow-wrap: anywhere; user-select: all; }

/* ---------------------------------------------------------------- details / danger zone */
details.disclosure > summary { cursor: pointer; list-style: none; color: var(--accent); font-size: 12.5px; font-weight: 550; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸ "; color: var(--faint); }
details.disclosure[open] > summary::before { content: "▾ "; }
details.disclosure pre { margin: 6px 0 0; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); font: 11.5px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 560px; }
.action-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-top: 1px solid var(--border); }
.action-row:first-child { border-top: 0; }
.action-row .a-title { font-weight: 600; color: var(--text); font-size: 13px; }
.action-row .a-text { color: var(--muted); font-size: 12px; }
.action-row form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
.action-row input:not([type="checkbox"]) { width: 170px; }
.danger-zone { border-color: var(--danger-bd); }
.danger-zone > .card-head { background: var(--danger-bg); border-bottom-color: var(--danger-bd); border-radius: var(--r) var(--r) 0 0; }
.danger-zone > .card-head h2 { color: var(--danger); }

/* ---------------------------------------------------------------- pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- auth page */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--sidebar-bg); padding: var(--s6); }
.auth .card { width: 100%; max-width: 380px; }
.auth .brandmark { padding: 0 0 var(--s5); color: var(--text); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1360px) { .grid-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { display: none; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: var(--s2); }
  .nav-group { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
  .nav-label { display: none; }
  .sidebar-foot { grid-template-columns: 1fr auto auto; align-items: center; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: var(--s4); }
  .kv { grid-template-columns: 130px minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- review fixes (visual QA at 1280/1440) */
/* Flex children default to min-width:auto, which let wide tables stretch the page instead of scrolling. */
.main > .content { min-width: 0; }
/* Paint the sidebar column full height (sticky sidebar + long pages). */
.app { background: linear-gradient(to right, var(--sidebar-bg) 236px, var(--bg) 236px); }
/* Operational tables stay on one line per row; long values truncate with a title tooltip. */
.table td { white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 180px; }
.metric .m-label span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Action rows put the form beside the description when there is room, below it when there is not. */
.action-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.action-row > :first-child { flex: 1 1 200px; min-width: 0; }
.action-row > form, .action-row > div:last-child:not(:first-child) { flex: 0 1 auto; }
.action-row .truncate, .p-title .truncate { display: block; max-width: 100%; }
.provider-card { display: flex; flex-direction: column; }
.provider-card .card-foot { margin-top: auto; }
.value-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.value-grid > div { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); }
.value-grid > div:nth-child(even) { border-left: 1px solid var(--border); }
.value-grid .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.value-grid .v { font-size: 17px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
@media (max-width: 960px) { .app { background: var(--bg); } }
/* Absolutely positioned descendants (e.g. .sr-only headers) must be clipped by the scrolling wrapper. */
.table-wrap { position: relative; }
/* Narrow-column action rows: description above, controls below, left aligned. */
.action-row.stacked { display: block; }
.action-row.stacked > form, .action-row.stacked > div:last-child:not(:first-child) { margin-top: 8px; justify-content: flex-start; }
.action-row.stacked input:not([type="checkbox"]) { flex: 1 1 140px; width: auto; }
/* Secondary lines in tables never widen a column. */
.table td .sub { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Optional columns give way on laptop widths (data remains in tooltips / detail pages). */
@media (max-width: 1535px) { .col-optional { display: none; } }
.table th, .table td { padding-left: 10px; padding-right: 10px; }

/* ---------------------------------------------------------------- customer rewards marketplace (portal catalogue) */
.rewards-toolbar { display: grid; gap: var(--s3); margin-bottom: var(--s4); }
.rewards-search { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.rewards-search input[type="search"] { flex: 1 1 280px; max-width: 460px; height: 38px; padding-left: 12px; font-size: 14px; }
.rewards-search select { height: 38px; }
.rewards-tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.rewards-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: -1px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; text-decoration: none; }
.rewards-tabs a:hover { color: var(--text); }
.rewards-tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.rewards-tabs .count { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--neutral-bg); border-radius: 999px; padding: 1px 7px; }
.rewards-tabs a[aria-current="page"] .count { color: var(--accent); background: var(--accent-soft); }
.rewards-summary { color: var(--muted); font-size: 12.5px; margin: 0 0 var(--s3); }

.rewards-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.reward-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); color: inherit; text-decoration: none; overflow: hidden; transition: border-color .12s ease, box-shadow .12s ease; }
.reward-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 14px rgba(16, 24, 40, .08); text-decoration: none; }
.reward-card:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.reward-card:hover .reward-cta { color: var(--accent-hover); }
.reward-art { aspect-ratio: 16 / 9; background: var(--surface-2); border-bottom: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.reward-art img { width: 100%; height: 100%; object-fit: contain; padding: 18px; }
.reward-tile { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; background: var(--tile-bg); color: var(--tile-fg); }
.reward-tile-name { font-size: clamp(18px, 2vw, 24px); font-weight: 800; letter-spacing: .1em; line-height: 1.15; overflow-wrap: anywhere; }
.reward-tile-name.is-long { font-size: clamp(14px, 1.5vw, 18px); letter-spacing: .06em; }
.reward-tile-type { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .65; }
.reward-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.reward-type { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.reward-name { margin: 0; font-size: 15.5px; font-weight: 650; color: var(--text); line-height: 1.3; }
.reward-value { font-size: 15px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 2px; }
.reward-value span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.reward-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; flex-wrap: wrap; }
.reward-cta { font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.reward-card.is-off .reward-art { filter: grayscale(1); opacity: .55; }
.reward-card.is-off .reward-name, .reward-card.is-off .reward-value { color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-available { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.chip-paused { color: #344054; background: var(--neutral-bg); border-color: var(--neutral-bd); }
.chip-paused::before { background: #f79009; }
.chip-off { color: var(--faint); background: var(--surface-2); border-color: var(--border); }
.chip-off::before { display: none; }

.rewards-empty .empty { padding: var(--s8) var(--s5); }

.reward-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s4); align-items: start; }
.reward-detail-main { display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr); overflow: hidden; border-radius: 12px; }
.reward-detail-main .reward-art { aspect-ratio: auto; min-height: 240px; height: 100%; border-bottom: 0; border-right: 1px solid var(--border); }
.reward-art-lg .reward-tile-name { font-size: clamp(24px, 2.6vw, 34px); }
.reward-detail-body { padding: var(--s5); display: grid; gap: 10px; align-content: start; }
.reward-detail-name { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; }
.reward-detail-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.reward-detail-desc { margin: 4px 0 0; color: var(--text-2); max-width: 620px; line-height: 1.55; }
.reward-detail-values { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.reward-detail-values .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.reward-value-lg { font-size: 22px; }
.value-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.value-chips span { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--surface-2); }
.code-snippet { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); font-family: var(--mono); font-size: 12.5px; overflow-x: auto; }

@media (max-width: 1440px) { .rewards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .rewards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reward-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .reward-detail-main { grid-template-columns: minmax(0, 1fr); }
  .reward-detail-main .reward-art { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) { .rewards-grid { grid-template-columns: minmax(0, 1fr); } }
/* Mode/environment badges never wrap onto two lines in the narrow mobile top bar. */
.env-badge { white-space: nowrap; flex: none; }
/* Delivery mode radio cards (portal settings). */
.delivery-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.delivery-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.delivery-option input { margin-top: 3px; }
.delivery-option .hint { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.delivery-option input[type="radio"] { width: 16px; height: 16px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.delivery-option > span { flex: 1; min-width: 0; }
table[aria-label="Delivery by brand"] td { white-space: normal; }

/* ---- Physical rewards (customer-facing) ------------------------------------------------- */
.reward-demo-tag { display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; vertical-align: 1px; }

/* Claim / shipping form */
.stack-form { display: grid; gap: var(--s5); padding: var(--s5); }
.stack-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.stack-form legend { font-weight: 650; font-size: 13px; color: var(--text); padding: 0 0 2px; letter-spacing: .01em; }
.stack-form .f { display: grid; gap: 5px; }
.stack-form .f > label { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.stack-form .f input, .stack-form .f select { width: 100%; height: 40px; }
.stack-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.stack-form .hint, .hint { color: var(--muted); font-size: 12px; margin: 0; }
.stack-form .req { color: var(--danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; padding-top: var(--s2); border-top: 1px solid var(--border); }
.claim-summary { padding: var(--s4); display: grid; gap: 6px; }
.claim-summary .reward-art { aspect-ratio: 16 / 9; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 6px; }
@media (max-width: 640px) { .stack-form .form-row { grid-template-columns: 1fr; } }

/* Delivery panel + progress timeline */
.delivery-panel { padding: var(--s5); display: grid; gap: var(--s5); }
.delivery-stage { display: grid; gap: 6px; }
.delivery-blurb { margin: 2px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.delivery-tracking { margin: 0; }
.demo-advance { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); border-top: 1px dashed var(--border); padding-top: var(--s4); }

.progress-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.progress-steps li { position: relative; display: flex; align-items: center; gap: var(--s3); padding: 0 0 var(--s5) 0; min-height: 28px; }
.progress-steps li:last-child { padding-bottom: 0; }
.progress-steps .step-dot { position: relative; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); z-index: 1; }
.progress-steps li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.progress-steps li:last-child::after { display: none; }
.progress-steps .step-label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.progress-steps li.is-done .step-dot { background: var(--success); border-color: var(--success); }
.progress-steps li.is-done::after { background: var(--success); }
.progress-steps li.is-done .step-label { color: var(--text-2); }
.progress-steps li.is-current .step-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.progress-steps li.is-current .step-label { color: var(--text); font-weight: 700; }

/* ---- Platform-admin impersonation banner ---------------------------------------------- */
/* Deliberate, premium charcoal bar with a single amber indicator — prominent but not an error. */
.impersonation-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  background: var(--sidebar-bg); color: #e6eaf1; border: 1px solid #2a3550; border-left: 3px solid #f59e0b;
  border-radius: var(--r); padding: 11px 16px; margin-bottom: var(--s5); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); }
.impersonation-bar .imp-text { display: inline-flex; align-items: center; gap: 9px; }
.impersonation-bar .imp-text::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.impersonation-bar .imp-text strong { color: #fff; font-weight: 650; }
.impersonation-bar .btn { background: transparent; color: #e6eaf1; border-color: #3a465f; font-weight: 600; }
.impersonation-bar .btn:hover { background: var(--sidebar-bg-2); color: #fff; }

/* ---- Portal polish: interaction + choice cards ---------------------------------------- */
.btn { transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease; }
.btn:active:not([disabled]) { transform: translateY(0.5px); }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, .35); }
/* A labelled set of selectable option cards (reused by claim workflow + delivery settings). */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); }
.choice-card { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer; background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease, background .12s ease; }
.choice-card:hover { border-color: var(--border-strong); }
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-card:has(input:focus-visible) { box-shadow: var(--focus); }
.choice-card input[type="radio"] { width: 16px; height: 16px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.choice-card .cc-body { min-width: 0; }
.choice-card .cc-title { font-weight: 650; color: var(--text); font-size: 13px; }
.choice-card .cc-text { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.45; }
/* De-emphasised, collapsible technical details on detail pages. */
.tech-details { border-top: 1px solid var(--border); padding: var(--s4) var(--s5); }
.tech-details > summary { cursor: pointer; list-style: none; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.tech-details > summary::-webkit-details-marker { display: none; }
.tech-details > summary::after { content: " ▸"; color: var(--faint); }
.tech-details[open] > summary::after { content: " ▾"; }
.tech-details .kv { margin-top: var(--s3); }
.tech-details .kv dd { font-size: 12px; color: var(--muted); }

/* ---- Portal-scoped layout refinements (never affects the platform admin) --------------- */
/* A slightly narrower, more focused content column reads as a premium product surface. */
.app[data-area="portal"] .content { max-width: 1280px; }
.app[data-area="portal"] .card { border-radius: var(--r); }
/* Clickable table rows get a clearer affordance in the portal. */
.app[data-area="portal"] .table tbody tr:hover td { background: var(--accent-soft); }
.app[data-area="portal"] .table td .btn-sm { opacity: .85; }
.app[data-area="portal"] .table tbody tr:hover .btn-sm { opacity: 1; }

/* Send-reward wizard (portal). Progressive enhancement: steps stack if JS is off. */
.send-wizard .card { margin-bottom: var(--s4); }
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s4); padding: 0; }
.stepper li { display: flex; align-items: center; gap: var(--s2); flex: 1 1 160px; min-width: 150px;
  padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.stepper li .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 12px; }
.stepper li.is-current { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.stepper li.is-current .n { background: var(--accent); color: #fff; border-color: var(--accent); }
.stepper li.is-done { color: var(--text); }
.stepper li.is-done .n { background: var(--ok, #2e7d32); color: #fff; border-color: transparent; }
.is-invalid { outline: 2px solid var(--danger, #c0392b); outline-offset: 1px; }
@media (max-width: 640px) { .stepper li { flex-basis: 100%; } }
