/* =========================================================================
   First Page MCP Portal — design system
   Tokens are the brand values observed from firstpage.hk and already shipping
   in firstpage-mcp/templates/base.html. Extend here; never re-declare hex
   outside this :root block.
   ========================================================================= */

:root {
  /* ── brand ─────────────────────────────────────────────────────────── */
  --fp-blue:        #427FE0;   /* fill / graphic only — 3.93:1 on white */
  --fp-blue-dark:   #396BB1;   /* text + actions — 5.30:1 on white */
  --fp-blue-light:  #EAF1FC;
  --fp-navy:        #00225D;
  --fp-navy-soft:   #0A2E6E;
  --fp-sky:         #109CDE;
  --fp-red:         #FF5254;   /* the one accent */
  --fp-red-dark:    #D93A3C;
  --fp-red-light:   #FDEBEB;
  --fp-green:       #17946B;
  --fp-green-light: #E4F6EF;
  --fp-amber:       #B7791F;
  --fp-amber-light: #FDF3D7;

  /* ── neutrals ─────────────────────────────────────────────────────── */
  --fp-bg:          #F3F4FA;
  --fp-white:       #FFFFFF;
  --fp-text:        #2A2F3A;
  --fp-text-muted:  #667085;
  --fp-border:      #E4E8F0;

  /* ── derived (color-mix only — no new hex) ────────────────────────── */
  --fp-surface-2:   color-mix(in oklch, var(--fp-blue) 6%, var(--fp-white));
  --fp-surface-3:   color-mix(in oklch, var(--fp-blue) 12%, var(--fp-white));
  --fp-ink-soft:    color-mix(in oklch, var(--fp-navy) 55%, var(--fp-text));
  --fp-on-navy:     color-mix(in oklch, var(--fp-white) 78%, var(--fp-navy));
  --fp-on-navy-dim: color-mix(in oklch, var(--fp-white) 62%, var(--fp-navy));
  --fp-rail:        color-mix(in oklch, var(--fp-navy) 94%, black);
  --fp-navy-deep:   color-mix(in oklch, var(--fp-navy) 82%, black);
  --fp-blue-hover:  color-mix(in oklch, var(--fp-blue-dark) 84%, black);
  --fp-blue-wash:   color-mix(in oklch, var(--fp-blue) 14%, transparent);
  --fp-red-hover:   color-mix(in oklch, var(--fp-red-dark) 88%, black);
  /* accent ink = the coral family at a text-safe contrast (≥4.5:1 on --fp-bg and on white) */
  --fp-accent-ink:  color-mix(in oklch, var(--fp-red-dark) 88%, black);
  --fp-zebra:       color-mix(in oklch, var(--fp-blue) 5%, var(--fp-white));

  --fp-shadow:      0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --fp-shadow-lg:   0 12px 18px 0 rgba(0, 0, 0, .05), 0 24px 48px -12px rgba(0, 34, 93, .18);
  --fp-shadow-pop:  0 24px 64px -16px rgba(0, 34, 93, .38);
  --fp-radius:      8px;
  --fp-radius-sm:   4px;
  --fp-focus:       0 0 0 3px color-mix(in oklch, var(--fp-blue) 40%, transparent);

  /* ── type ─────────────────────────────────────────────────────────── */
  --fp-font: "proxima-nova", "Proxima Nova", "Avenir Next", "Nunito Sans",
             system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Helvetica,
             "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
             "Noto Sans CJK TC", sans-serif;
  --fp-display: "proxima-nova", "Proxima Nova", "Avenir Next", "Nunito Sans",
                system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Helvetica,
                "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --fp-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Cascadia Mono",
             Menlo, Consolas, "Liberation Mono", monospace;
}

/* ── reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fp-bg);
  color: var(--fp-text);
  font-family: var(--fp-font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: var(--fp-blue-dark); text-decoration: none; }
a:hover { color: var(--fp-navy); text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; cursor: pointer; }
p { margin: 0 0 12px; text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }
:focus-visible { outline: none; box-shadow: var(--fp-focus); border-radius: var(--fp-radius-sm); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── type scale ──────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--fp-display); color: var(--fp-navy); margin: 0; font-weight: 700; }
h1 { font-size: 27px; line-height: 1.2; letter-spacing: -.022em; font-weight: 800; }
h2 { font-size: 17px; line-height: 1.3; letter-spacing: -.012em; }
h3 { font-size: 15px; line-height: 1.35; letter-spacing: -.005em; }
.eyebrow {
  font-size: 11px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .22em; color: var(--fp-accent-ink); margin: 0 0 10px;
}
.lead { font-size: 15px; color: var(--fp-text-muted); max-width: 68ch; margin: 0; }
.meta { font-family: var(--fp-mono); font-size: 12px; color: var(--fp-text-muted); letter-spacing: .02em; }
.num, .mono { font-family: var(--fp-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--fp-text-muted); }
.tiny { font-size: 12.5px; }
.strong { font-weight: 700; color: var(--fp-navy); }

/* ── shell: top bar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--fp-navy);
  border-bottom: 1px solid color-mix(in oklch, var(--fp-white) 12%, var(--fp-navy));
}
.topbar-inner {
  display: flex; align-items: center; gap: 22px;
  height: 58px; padding: 0 22px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 19px; width: auto; }
.brand-sep { width: 1px; height: 22px; background: color-mix(in oklch, var(--fp-white) 24%, var(--fp-navy)); }
.brand-name {
  font-size: 12.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .16em; color: var(--fp-white);
}
.brand-name em { font-style: normal; color: color-mix(in oklch, var(--fp-sky) 45%, white); }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.env {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--fp-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--fp-on-navy); text-decoration: none;
  background: color-mix(in oklch, var(--fp-white) 10%, transparent);
  border: 1px solid color-mix(in oklch, var(--fp-white) 18%, transparent);
  border-radius: 999px; padding: 4px 11px;
}
.env i { width: 6px; height: 6px; border-radius: 999px; background: var(--fp-green); display: block; }
.userchip {
  display: flex; align-items: center; gap: 9px;
  padding-left: 18px; border-left: 1px solid color-mix(in oklch, var(--fp-white) 18%, var(--fp-navy));
}
.avatar {
  width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--fp-blue-dark), var(--fp-navy));
  color: var(--fp-white); font-size: 12px; font-weight: 800;
  display: grid; place-items: center; letter-spacing: .02em;
}
.userchip-name { font-size: 13px; color: var(--fp-white); font-weight: 600; line-height: 1.25; }
.userchip-mail { font-family: var(--fp-mono); font-size: 10.5px; color: var(--fp-on-navy-dim); line-height: 1.25; }

/* ── shell: rail + main ──────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: start; }
.rail {
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto;
  background: var(--fp-rail);
  padding: 22px 0 28px;
  display: flex; flex-direction: column;
}
.rail-label {
  font-family: var(--fp-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .18em;
  color: color-mix(in oklch, var(--fp-white) 42%, var(--fp-navy));
  padding: 0 20px; margin: 20px 0 8px;
}
.rail-label:first-child { margin-top: 0; }
.rail-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 20px 9px 17px;
  color: color-mix(in oklch, var(--fp-white) 72%, var(--fp-navy));
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  border-left: 3px solid transparent;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.rail-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .82; }
.rail-link:hover {
  background: color-mix(in oklch, var(--fp-white) 7%, transparent);
  color: var(--fp-white); text-decoration: none;
}
.rail-link[aria-current="page"] {
  background: color-mix(in oklch, var(--fp-blue) 22%, transparent);
  color: var(--fp-white); border-left-color: var(--fp-blue);
}
.rail-link[aria-current="page"] svg { opacity: 1; }
.rail-count {
  margin-left: auto; font-family: var(--fp-mono); font-size: 10.5px;
  color: color-mix(in oklch, var(--fp-white) 52%, var(--fp-navy));
}
.rail-foot {
  margin-top: auto; padding: 22px 20px 0;
  border-top: 1px solid color-mix(in oklch, var(--fp-white) 12%, var(--fp-navy));
  font-family: var(--fp-mono); font-size: 10.5px; line-height: 1.7;
  color: color-mix(in oklch, var(--fp-white) 46%, var(--fp-navy));
}
.rail-foot a { color: color-mix(in oklch, var(--fp-white) 68%, var(--fp-navy)); }
.rail-foot a:hover { color: var(--fp-white); }
.main { min-width: 0; padding: 30px 32px 64px; }
.wrap { max-width: 1200px; margin: 0 auto; }
.wrap-narrow { max-width: 900px; margin: 0 auto; }

/* ── page head ───────────────────────────────────────────────────────── */
.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 24px;
}
.pagehead .lead { margin-top: 8px; }
.pagehead-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumb {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--fp-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--fp-text-muted); margin-bottom: 12px;
}
.crumb span { color: var(--fp-text-muted); }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--fp-radius-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 700; letter-spacing: .01em;
  text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--fp-blue-dark); color: var(--fp-white); box-shadow: var(--fp-shadow); }
.btn-primary:hover { background: var(--fp-blue-hover); color: var(--fp-white); }
.btn-secondary { background: var(--fp-white); color: var(--fp-navy); border-color: var(--fp-border); }
.btn-secondary:hover { background: var(--fp-surface-2); border-color: var(--fp-blue); color: var(--fp-navy); }
.btn-ghost { background: transparent; color: var(--fp-blue-dark); padding: 0 10px; }
.btn-ghost:hover { background: var(--fp-blue-light); color: var(--fp-navy); }
.btn-danger { background: var(--fp-accent-ink); color: var(--fp-white); }
.btn-danger:hover { background: var(--fp-red-hover); color: var(--fp-white); }
.btn-danger-ghost { background: transparent; color: var(--fp-red-dark); border-color: color-mix(in oklch, var(--fp-red-dark) 40%, var(--fp-white)); }
.btn-danger-ghost:hover { background: var(--fp-red-light); color: var(--fp-red-dark); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn[disabled] { background: var(--fp-surface-3); color: var(--fp-text-muted); border-color: transparent; cursor: not-allowed; box-shadow: none; }

/* ── surfaces ────────────────────────────────────────────────────────── */
.card {
  background: var(--fp-white); border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius); box-shadow: var(--fp-shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 16px 20px 0;
}
.card-sub { font-size: 13px; color: var(--fp-text-muted); margin: 4px 0 0; }
.card-body { padding: 18px 20px; }
/* A card whose head carries the filter chips (and no body) needs a gap before
   the table it filters. */
.card-head + .tablewrap { margin-top: 14px; }
.card-foot {
  padding: 13px 20px; border-top: 1px solid var(--fp-border);
  background: var(--fp-surface-2); border-radius: 0 0 var(--fp-radius) var(--fp-radius);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── band (the one flourish: brand gradient) ─────────────────────────── */
.band {
  position: relative; overflow: hidden;
  border-radius: var(--fp-radius);
  background: linear-gradient(180deg, var(--fp-blue-dark) 0%, var(--fp-navy) 100%);
  color: var(--fp-white);
  padding: 26px 28px;
  box-shadow: var(--fp-shadow-lg);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
}
.band::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in oklch, var(--fp-white) 10%, transparent), transparent 45%);
}
.band > * { position: relative; z-index: 1; }
.band h2 { color: var(--fp-white); font-size: 21px; letter-spacing: -.015em; }
.band p { color: color-mix(in oklch, var(--fp-white) 88%, transparent); margin: 6px 0 0; font-size: 14px; max-width: 62ch; }
.band-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.band .btn-primary { background: var(--fp-white); color: var(--fp-blue-dark); }
.band .btn-primary:hover { background: color-mix(in oklch, var(--fp-white) 88%, var(--fp-navy)); color: var(--fp-navy); }
.band .btn-secondary { background: transparent; color: var(--fp-white); border-color: color-mix(in oklch, var(--fp-white) 55%, transparent); }
.band .btn-secondary:hover { background: color-mix(in oklch, var(--fp-white) 16%, transparent); border-color: var(--fp-white); color: var(--fp-white); }

/* endpoint chip */
.endpoint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 18px; padding: 10px 12px 10px 14px;
  background: color-mix(in oklch, var(--fp-navy) 34%, transparent);
  border: 1px solid color-mix(in oklch, var(--fp-white) 24%, transparent);
  border-radius: var(--fp-radius-sm);
}
.endpoint .u { font-family: var(--fp-mono); font-size: 12.5px; color: var(--fp-white); word-break: break-all; }
.endpoint .k {
  font-family: var(--fp-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in oklch, var(--fp-white) 70%, transparent);
}

/* ── metrics ─────────────────────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metrics.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { background: var(--fp-white); border: 1px solid var(--fp-border); border-radius: var(--fp-radius); padding: 16px 18px; box-shadow: var(--fp-shadow); }
.metric-k { font-family: var(--fp-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fp-text-muted); }
.metric-v { font-family: var(--fp-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: var(--fp-navy); line-height: 1.1; margin-top: 8px; }
.metric-v small { font-size: 13px; font-weight: 700; color: var(--fp-text-muted); letter-spacing: 0; margin-left: 4px; }
.metric-d { font-size: 12.5px; color: var(--fp-text-muted); margin-top: 5px; }

/* ── pills / dots ────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--fp-mono); font-size: 11px; letter-spacing: .04em;
  background: var(--fp-surface-3); color: var(--fp-ink-soft); white-space: nowrap;
}
.pill-ok { background: var(--fp-green-light); color: color-mix(in oklch, var(--fp-green) 78%, black); }
.pill-warn { background: var(--fp-amber-light); color: color-mix(in oklch, var(--fp-amber) 78%, black); }
.pill-danger { background: var(--fp-red-light); color: color-mix(in oklch, var(--fp-red-dark) 82%, black); }
.pill-info { background: var(--fp-blue-light); color: color-mix(in oklch, var(--fp-blue-dark) 84%, black); }
.dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; display: block; flex-shrink: 0; }

/* ── chips ───────────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 0 13px;
  background: var(--fp-white); color: var(--fp-navy);
  border: 1px solid var(--fp-border); border-radius: 999px;
  font-size: 13px; font-weight: 600;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.chip:hover { background: var(--fp-surface-2); border-color: var(--fp-blue); }
.chip.is-on { background: var(--fp-navy); border-color: var(--fp-navy); color: var(--fp-white); }
.chip-n { font-family: var(--fp-mono); font-size: 11px; color: var(--fp-text-muted); }
.chip.is-on .chip-n { color: color-mix(in oklch, var(--fp-white) 72%, var(--fp-navy)); }

/* ── tabs ────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--fp-border); overflow-x: auto; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 11px 15px; font-size: 13.5px; font-weight: 600; color: var(--fp-text-muted);
  white-space: nowrap; transition: color .14s ease, border-color .14s ease;
}
.tab:hover { color: var(--fp-navy); }
.tab.is-on { color: var(--fp-navy); border-bottom-color: var(--fp-blue); }
.tabpanel[hidden] { display: none; }
.tabpanel { margin-top: 14px; }

/* ── tables ──────────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; }
.tablewrap.scroll-y { max-height: 540px; overflow-y: auto; }
.tablewrap.scroll-y thead th { position: sticky; top: 0; z-index: 1; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  font-family: var(--fp-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--fp-text-muted);
  text-align: left; padding: 11px 16px; background: var(--fp-surface-2);
  border-bottom: 1px solid var(--fp-border); white-space: nowrap;
}
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--fp-border); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--fp-zebra); }
.tbl-num { text-align: right; font-family: var(--fp-mono); font-variant-numeric: tabular-nums; }
.tbl-nowrap { white-space: nowrap; }
.tbl-actions { text-align: right; white-space: nowrap; }
.tbl-click { cursor: pointer; }
.tbl-key { font-family: var(--fp-mono); font-size: 12.5px; color: var(--fp-navy); }
.tbl-tool { font-family: var(--fp-mono); font-size: 12.5px; font-weight: 600; color: var(--fp-navy); }

/* ── kv ──────────────────────────────────────────────────────────────── */
.kv { display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--fp-border); font-size: 13.5px; }
.kv-row:last-child { border-bottom: 0; }
.kv-k { color: var(--fp-text-muted); }
.kv-v { color: var(--fp-navy); font-weight: 600; }

/* ── tiles ───────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tile {
  text-align: left; background: var(--fp-white); border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius); padding: 16px; box-shadow: var(--fp-shadow);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  display: flex; flex-direction: column; gap: 8px;
}
.tile:hover { border-color: var(--fp-blue); box-shadow: var(--fp-shadow-lg); }
.tile:active { transform: translateY(1px); }
.tile.is-on { border-color: var(--fp-blue); box-shadow: 0 0 0 2px var(--fp-blue-wash); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-name { font-family: var(--fp-mono); font-size: 12.5px; font-weight: 600; color: var(--fp-navy); word-break: break-word; }
.tile-desc { font-size: 13px; color: var(--fp-text-muted); margin: 0; line-height: 1.55; }
.tile-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.tile-cat { font-family: var(--fp-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--fp-text-muted); }

/* ── steps ───────────────────────────────────────────────────────────── */
.step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 16px; }
.step-num {
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--fp-navy); color: var(--fp-white);
  font-family: var(--fp-mono); font-size: 13px; font-weight: 600;
  display: grid; place-items: center;
}
.step-rail { display: flex; flex-direction: column; align-items: center; gap: 6px; align-self: stretch; }
.step-line { width: 1px; flex: 1; background: var(--fp-border); min-height: 12px; }
.step-body { padding-bottom: 28px; min-width: 0; }
.step-body > h2 { margin-bottom: 4px; }

/* ── code ────────────────────────────────────────────────────────────── */
.code { border: 1px solid var(--fp-border); border-radius: var(--fp-radius); overflow: hidden; background: var(--fp-navy-deep); }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 14px;
  background: color-mix(in oklch, var(--fp-white) 8%, var(--fp-navy-deep));
  border-bottom: 1px solid color-mix(in oklch, var(--fp-white) 14%, var(--fp-navy-deep));
}
.code-file { font-family: var(--fp-mono); font-size: 11.5px; color: color-mix(in oklch, var(--fp-white) 82%, var(--fp-navy)); }
.code pre {
  margin: 0; padding: 15px 16px; overflow-x: auto;
  font-family: var(--fp-mono); font-size: 12.5px; line-height: 1.7;
  color: color-mix(in oklch, var(--fp-white) 92%, var(--fp-navy));
}
.code .tok-k { color: var(--fp-sky); }
.code .tok-s { color: color-mix(in oklch, var(--fp-white) 66%, var(--fp-navy)); }
.code .tok-a { color: color-mix(in oklch, var(--fp-red) 62%, var(--fp-white)); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in oklch, var(--fp-white) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--fp-white) 26%, transparent);
  color: var(--fp-white); border-radius: var(--fp-radius-sm);
  padding: 4px 9px; font-size: 11.5px; font-weight: 600;
  font-family: var(--fp-mono); letter-spacing: .04em;
}
.copy-btn:hover { background: color-mix(in oklch, var(--fp-white) 24%, transparent); border-color: var(--fp-white); }
.copy-btn.is-done { background: var(--fp-green); border-color: var(--fp-green); }

/* ── inline key reveal ───────────────────────────────────────────────── */
.keyrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.keyval {
  font-family: var(--fp-mono); font-size: 13px; color: var(--fp-navy);
  background: var(--fp-surface-2); border: 1px dashed var(--fp-border);
  border-radius: var(--fp-radius-sm); padding: 7px 11px; word-break: break-all;
}
.keyval b { color: var(--fp-accent-ink); }

/* ── notes (tinted, never a left bar) ────────────────────────────────── */
.note { border-radius: var(--fp-radius); padding: 14px 16px; display: flex; gap: 12px; font-size: 13.5px; }
.note svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.note h3 { margin-bottom: 2px; }
.note p { margin: 0; }
.note-info { background: var(--fp-blue-light); color: color-mix(in oklch, var(--fp-blue-dark) 80%, black); }
.note-info h3 { color: color-mix(in oklch, var(--fp-blue-dark) 70%, black); }
.note-warn { background: var(--fp-amber-light); color: color-mix(in oklch, var(--fp-amber) 85%, black); }
.note-warn h3 { color: color-mix(in oklch, var(--fp-amber) 78%, black); }
.note-danger { background: var(--fp-red-light); color: color-mix(in oklch, var(--fp-red-dark) 88%, black); }
.note-danger h3 { color: color-mix(in oklch, var(--fp-red-dark) 80%, black); }
.note-ok { background: var(--fp-green-light); color: color-mix(in oklch, var(--fp-green) 85%, black); }
.note-ok h3 { color: color-mix(in oklch, var(--fp-green) 78%, black); }

/* ── fields ──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--fp-navy); letter-spacing: .01em; }
.hint { font-size: 12px; color: var(--fp-text-muted); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--fp-border); border-radius: var(--fp-radius-sm);
  background: var(--fp-white); color: var(--fp-text); font: inherit; font-size: 14px;
}
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in oklch, var(--fp-blue) 45%, var(--fp-border)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--fp-blue); box-shadow: var(--fp-focus); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.searchwrap { position: relative; flex: 1 1 260px; min-width: 200px; }
.searchwrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--fp-text-muted); pointer-events: none; }
.searchwrap .input { padding-left: 34px; }
/* In a card body the search sits above the chips, not in the head. The base
   `flex: 1 1 260px` is sized for a row; as a child of the column-flex
   `.card-body.stack` its 260px basis would be read as a height, so pin it to an
   auto-height block. The container's gap spaces it from the chips and the text. */
.card-body > .searchwrap { display: block; flex: none; width: 100%; }

/* ── bars ──────────────────────────────────────────────────────────────── */
.bar { height: 6px; border-radius: 999px; background: var(--fp-surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--fp-blue-dark); display: block; }
.bar-fill.is-ok { background: var(--fp-green); }
.bar-fill.is-warn { background: var(--fp-amber); }
.bar-fill.is-danger { background: var(--fp-red-dark); }

/* ── modal + drawer ──────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in oklch, var(--fp-navy) 52%, transparent);
  display: grid; place-items: center; padding: 24px;
}
.scrim[hidden] { display: none; }
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--fp-white); border-radius: var(--fp-radius);
  box-shadow: var(--fp-shadow-pop);
}
.modal-head { padding: 20px 22px 0; }
.modal-head h2 { font-size: 19px; }
.modal-head p { margin: 6px 0 0; font-size: 13.5px; color: var(--fp-text-muted); }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--fp-border); background: var(--fp-surface-2);
  border-radius: 0 0 var(--fp-radius) var(--fp-radius);
}
.scrim-right { place-items: stretch; justify-items: end; padding: 0; }
.drawer {
  width: 100%; max-width: 560px; height: 100%; overflow-y: auto;
  background: var(--fp-white); border-left: 1px solid var(--fp-border);
  box-shadow: var(--fp-shadow-pop); display: flex; flex-direction: column;
}
.drawer-head {
  padding: 18px 22px; border-bottom: 1px solid var(--fp-border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; background: var(--fp-white); z-index: 2;
}
.drawer-body { padding: 20px 22px 30px; display: flex; flex-direction: column; gap: 18px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--fp-radius-sm);
  background: var(--fp-surface-2); border: 1px solid var(--fp-border);
  color: var(--fp-navy); display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn:hover { background: var(--fp-surface-3); border-color: var(--fp-blue); }
.icon-btn svg { width: 15px; height: 15px; }
.drawer-section { display: flex; flex-direction: column; gap: 10px; }
.drawer-section > h3 {
  font-family: var(--fp-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--fp-text-muted);
}

/* ── toast ───────────────────────────────────────────────────────────── */
.toasts {
  position: fixed; z-index: 120; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--fp-navy); color: var(--fp-white);
  border-radius: 999px; padding: 9px 18px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--fp-shadow-pop);
  animation: toastin .18s ease-out;
}
.toast svg { width: 15px; height: 15px; color: var(--fp-green); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── empty ───────────────────────────────────────────────────────────── */
.empty { padding: 46px 24px; text-align: center; }
.empty h3 { color: var(--fp-navy); margin-bottom: 6px; }
.empty p { color: var(--fp-text-muted); font-size: 13.5px; margin: 0 auto; max-width: 46ch; }

/* ── footer ──────────────────────────────────────────────────────────── */
.pagefoot {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--fp-border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--fp-text-muted);
}

/* ── responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .metrics, .metrics.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 10px 12px; gap: 4px;
  }
  .rail-label, .rail-foot, .rail-count { display: none; }
  .rail-link { border-left: 0; border-bottom: 3px solid transparent; border-radius: var(--fp-radius-sm); padding: 9px 12px; white-space: nowrap; }
  .rail-link[aria-current="page"] { border-left: 0; border-bottom-color: var(--fp-blue); }
  .main { padding: 22px 18px 48px; }
  .split, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .band { grid-template-columns: minmax(0, 1fr); }
  .env { display: none; }
  /* touch targets: 44px minimum once the rail collapses to a phone/tablet bar */
  .btn, .btn-sm, .chip, .input, .select { min-height: 44px; }
  .tab { padding: 13px 15px; }
  .rail-link { padding: 12px 13px; }
  .icon-btn { width: 42px; height: 42px; }
  .copy-btn { padding: 9px 12px; }
}
@media (max-width: 640px) {
  .metrics, .metrics.is-3, .tiles, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .kv-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .topbar-inner { gap: 12px; padding: 0 14px; }
  .userchip-name, .userchip-mail { display: none; }
  .metric-v { font-size: 26px; }
}
/* ── Release notes ─────────────────────────────────────────────────────
   A version timeline. One entry per release, newest first, on a continuous
   rail so the four version bumps read as a single history. Change groups use
   the Keep a Changelog headings plus "Internal" for CI, docs and refactors. */
.timeline { display: flex; flex-direction: column; }
.rel { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 18px; padding-bottom: 20px; }
.rel:last-child { padding-bottom: 0; }
.rel-rail { position: relative; display: flex; justify-content: center; }
.rel-rail::before { content: ""; position: absolute; top: 14px; bottom: -20px; left: 50%; width: 1px; background: var(--fp-border); }
.rel-dot { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 8px; border-radius: 999px; background: var(--fp-white); border: 3px solid color-mix(in oklch, var(--fp-blue) 42%, var(--fp-border)); }
.rel.is-latest .rel-dot { background: var(--fp-blue-dark); border-color: var(--fp-blue-light); box-shadow: 0 0 0 1px var(--fp-blue-dark); }
.rel-body { min-width: 0; background: var(--fp-white); border: 1px solid var(--fp-border); border-radius: var(--fp-radius); box-shadow: var(--fp-shadow); overflow: hidden; }
.rel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 20px 0; }
.rel-ver { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--fp-mono); font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--fp-navy); }
.rel-meta { margin: 7px 0 0; }
.rel-sum { margin: 12px 20px 0; font-size: 14px; color: var(--fp-text); max-width: 74ch; }
.chg { padding: 0 20px 16px; }
.chg-h { display: flex; align-items: center; gap: 9px; margin-top: 16px; font-family: var(--fp-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--fp-text-muted); }
.chg-h::before { content: ""; width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; background: var(--fp-blue-dark); }
.chg-group[data-group="Changed"] .chg-h::before { background: var(--fp-amber); }
.chg-group[data-group="Fixed"] .chg-h::before { background: var(--fp-green); }
.chg-group[data-group="Removed"] .chg-h::before { background: var(--fp-red-dark); }
.chg-group[data-group="Internal"] .chg-h::before { background: var(--fp-text-muted); }
.chg-list { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chg-list li { position: relative; padding-left: 15px; font-size: 13.5px; line-height: 1.62; color: var(--fp-text); }
.chg-list li::before { content: ""; position: absolute; left: 3px; top: 9px; width: 4px; height: 4px; border-radius: 999px; background: color-mix(in oklch, var(--fp-navy) 34%, var(--fp-white)); }
.chg-list code { font-family: var(--fp-mono); font-size: 12px; color: var(--fp-navy); background: var(--fp-surface-2); border: 1px solid var(--fp-border); border-radius: var(--fp-radius-sm); padding: 1px 5px; }
.chg-ref { display: inline-block; font-family: var(--fp-mono); font-size: 11px; color: var(--fp-text-muted); background: var(--fp-surface-2); border: 1px solid var(--fp-border); border-radius: var(--fp-radius-sm); padding: 1px 6px; margin-left: 5px; white-space: nowrap; }
.chg-more { padding: 4px 20px 16px; }
.code + * { margin-top: 12px; }
.rel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--fp-border); background: var(--fp-surface-2); font-size: 12.5px; color: var(--fp-text-muted); }
.rel-foot .mono { color: var(--fp-ink-soft); }
.verlist-row { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--fp-border); font-size: 13px; align-items: baseline; }
.verlist-row:last-child { border-bottom: 0; }
.verlist-v { font-family: var(--fp-mono); font-size: 12.5px; font-weight: 700; color: var(--fp-navy); }
@media (max-width: 980px) {
  .rel { grid-template-columns: 18px minmax(0, 1fr); gap: 13px; }
}
@media (max-width: 640px) {
  .rel-ver { font-size: 15.5px; }
  .rel-sum { margin-left: 16px; margin-right: 16px; }
  .rel-head, .chg, .chg-more, .rel-foot { padding-left: 16px; padding-right: 16px; }
  .verlist-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* filter rows: two chip groups stacked with their own captions */
.filter-rows { display: flex; flex-direction: column; gap: 14px; }
.filter-row { display: flex; flex-direction: column; gap: 8px; }
.filter-row > .hint { margin: 0; }

/* what's new card (index.html): the newest release-note entry — metadata left, summary right */
.news-item { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr); gap: 0 36px; align-items: start; }
.news-side { min-width: 0; display: flex; flex-direction: column; gap: 9px; padding-right: 36px; border-right: 1px solid var(--fp-border); }
.news-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.news-ver { font-family: var(--fp-mono); font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--fp-navy); }
.news-ver a { color: inherit; text-decoration: none; border-bottom: 1px solid color-mix(in oklch, var(--fp-navy) 32%, transparent); }
.news-ver a:hover { border-bottom-color: var(--fp-navy); }
.news-side .meta { margin: 0; }
.news-body { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.news-sum { margin: 0; max-width: 62ch; font-size: 13.5px; line-height: 1.62; color: var(--fp-text); text-wrap: pretty; }
.news-counts { display: flex; flex-wrap: wrap; gap: 5px 16px; }
.news-count { font-family: var(--fp-mono); font-size: 11px; letter-spacing: .04em; color: var(--fp-text-muted); }
.news-count b { font-weight: 700; color: var(--fp-navy); }
@media (max-width: 640px) {
  .news-item { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .news-side { padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--fp-border); }
}

/* =========================================================================
   Repo additions (firstpage-mcp). The design project ships seven authenticated
   screens; these two pieces are what serving them from a real app needs: a
   health-toned top-bar pill (the design hardcoded green) and the sign-in card,
   which the design never covered. No hex outside :root — same rules apply.
   ========================================================================= */

/* ── environment pill: tone from the worst recorded service status ────── */
.env.is-ok i { background: var(--fp-green); }
.env.is-warn i { background: var(--fp-amber); }
.env.is-danger i { background: var(--fp-red-dark); }
.env.is-unknown i { background: color-mix(in oklch, var(--fp-white) 55%, var(--fp-navy)); }
.env.is-warn, .env.is-danger, .env.is-unknown { color: var(--fp-white); }

/* ── sign-in / registration card (no rail, no second nav surface) ─────── */
.auth { max-width: 460px; margin: 0 auto; padding: 56px 0 80px; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 22px; text-align: center; }
.auth-mark {
  width: 46px; height: 46px; border-radius: 10px;
  background: linear-gradient(180deg, var(--fp-blue-dark) 0%, var(--fp-navy) 100%);
  color: var(--fp-white); font-family: var(--fp-display);
  font-size: 21px; font-weight: 900; display: grid; place-items: center;
  box-shadow: var(--fp-shadow-lg);
}
.auth-head h1 { font-size: 20px; letter-spacing: -.015em; }
.auth-head .lead { margin-top: 4px; }
.auth-card { background: var(--fp-white); border: 1px solid var(--fp-border); border-radius: var(--fp-radius); box-shadow: var(--fp-shadow-lg); padding: 26px; }
.auth-card .stack { gap: 16px; }
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 4px 0; font-family: var(--fp-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fp-text-muted); }
.auth-sep::before, .auth-sep::after { content: ""; height: 1px; flex: 1; background: var(--fp-border); }
.auth-alt { margin-top: 18px; font-size: 12.5px; color: var(--fp-text-muted); }
.auth-foot { margin-top: 14px; text-align: center; font-family: var(--fp-mono); font-size: 11px; color: var(--fp-text-muted); }
.google-btn { width: 100%; justify-content: center; }
.google-btn svg { width: 17px; height: 17px; }
.legal { max-width: 820px; margin: 0 auto; padding: 34px 0 80px; }
.legal h1 { margin-bottom: 14px; }
.legal h2 { margin: 26px 0 8px; }
.legal p, .legal li { color: var(--fp-text); }
.legal ul { padding-left: 20px; }

/* ── spacing + small layout utilities ────────────────────────────────────
   The design reached for inline `style` for these; a screen that needs one of
   them takes the class instead, so no portal screen carries inline CSS. */
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-14 { margin-top: 14px; }
.mt-18 { margin-top: 18px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.chips.is-stacked { flex-direction: column; align-items: flex-start; gap: 8px; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { margin: 0; }

/* Full-width action inside a card or form (the sign-in/registration cards). */
.btn-block { width: 100%; justify-content: center; }
