/*
 * mp-ui.css — Marketplace Prep shared COMPONENT layer (CANONICAL)  [ADR 0075]
 *
 * The "bones" half of the one-platform design system. mp-tokens.css supplies the
 * design language (color / type / spacing / radius); this file supplies the
 * components built from it — app shell, sidebar/nav, buttons, form fields, cards,
 * KPI/stat readouts, tables, pills/chips/badges, alerts, status LEDs — so every
 * surface stops re-rolling its own. Extracted and tokenized from the mature sets
 * in sites/ops/ops-shell.css (shell/nav/LED/picker), the Shipping Wallet inline
 * styles (KPI/table/pill vocabulary), and sites/portal/portal.css (buttons/fields).
 *
 * Load AFTER mp-tokens.css:
 *   <link rel="stylesheet" href="/mp-tokens.css">
 *   <link rel="stylesheet" href="/mp-ui.css">
 *
 * Shared-asset managed (shared-assets.json): edit ONLY this canonical file; the
 * per-surface copies are generated by sync-shared-assets.sh and drift-gated by
 * check-shared-assets.sh. Copies are added to the manifest AS EACH SURFACE MIGRATES.
 *
 * ── NAMESPACE ────────────────────────────────────────────────────────────────
 * Every class here is prefixed `mp-`. This is deliberate: each surface still has
 * its own unprefixed `.btn` / `.card` / `.panel` / `.alert` that mean different
 * things, so a surface can adopt these components ONE AT A TIME (swap `.btn` ->
 * `.mp-btn`, delete the local rule) with zero collision. Modifiers use BEM-ish
 * `--` suffixes (`.mp-btn--ghost`, `.mp-pill--bad`).
 *
 * ── THE TWO CONTEXTS (read before adding anything) ───────────────────────────
 * 1. CHASSIS (header + sidebar) is a DARK graphite bar in BOTH light and dark
 *    themes. Its internals therefore use the theme-INDEPENDENT on-brand tokens
 *    (--mp-on-brand, --mp-on-brand-muted, --mp-line-on-brand) and white-alpha
 *    literals for hover — both correct because the ground is ALWAYS dark. Never
 *    use --mp-fg (dark ink in light theme) on the chassis; it would vanish.
 * 2. CONTENT (main column: cards, tables, KPIs, forms) FLIPS with the theme. Its
 *    text uses --mp-fg / --mp-fg-muted, surfaces use --mp-bg-*, and hovers/tints
 *    use the theme-aware --mp-interactive-bg-hover (dark-alpha on light,
 *    white-alpha on dark). NEVER a raw rgba(255,255,255,.n) hover here — it is
 *    invisible on the light ground.
 *
 * ── READABILITY CONTRACT (owner requirement) ─────────────────────────────────
 * Body/secondary text uses --mp-fg / --mp-fg-muted (both AA in both themes).
 * --mp-fg-faint is ~3:1 — decorative/large/uppercase-label only, never body.
 * Green is a FILL (dark --mp-on-primary ink on it), or --mp-primary-dark as green
 * text on a light ground. Every accent pill pairs its accent text token with its
 * accent -bg token, both of which flip per theme, so contrast holds in both.
 */

/* ============================================================
   0. SKIP LINK (first focusable element)
   ============================================================ */
.mp-skip-link {
  position: absolute; left: -9999px; top: 0; z-index: var(--mp-z-modal);
  padding: 10px 16px;
  background: var(--mp-primary); color: var(--mp-on-primary);
  font-family: var(--mp-ff-body); font-size: var(--mp-text-base); font-weight: var(--mp-fw-semibold);
  border-radius: 0 0 var(--mp-r-ctrl) 0; text-decoration: none; white-space: nowrap;
}
.mp-skip-link:focus { left: 0; top: 0; outline: 2px solid var(--mp-fg-on-brand); outline-offset: -3px; }

/* ============================================================
   1. APP SHELL — sticky brand bar + sidebar + content column
   The HEADER is the always-dark chassis (on-brand tokens, see §3). The SIDEBAR
   FLIPS with the theme (owner decision 2026-07-16), so it is a CONTENT-context
   surface: its rail uses --mp-sidebar-bg and its nav uses the standard --mp-fg*/
   --mp-line/--mp-interactive-* tokens — never on-brand.
   ============================================================ */
:root {
  --mp-header-h: 56px;
  --mp-sidebar-w: 240px;
}

.mp-shell > mp-header { position: sticky; top: 0; z-index: var(--mp-z-sticky); }

.mp-appshell { display: flex; align-items: flex-start; min-height: calc(100dvh - var(--mp-header-h)); }

.mp-sidebar {
  position: sticky; top: var(--mp-header-h); align-self: flex-start;
  width: var(--mp-sidebar-w); flex: 0 0 var(--mp-sidebar-w);
  height: calc(100dvh - var(--mp-header-h));
  overflow-y: auto;
  background: var(--mp-sidebar-bg);              /* flips: light-gray in light, graphite in dark */
  border-right: 1px solid var(--mp-line);
  padding: var(--mp-sp-4) var(--mp-sp-3);
  display: flex; flex-direction: column;
}

.mp-nav { display: flex; flex-direction: column; }
.mp-nav-group { margin-bottom: var(--mp-sp-2); }
.mp-nav-label {
  font-size: 10.5px; font-weight: var(--mp-fw-semibold); text-transform: uppercase; letter-spacing: var(--mp-ls-wide);
  color: var(--mp-fg-faint); padding: 12px 10px 6px;
}
.mp-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--mp-r-card);
  color: var(--mp-fg-muted); font-size: 13.5px; font-weight: var(--mp-fw-medium);
  text-decoration: none; border-left: 2px solid transparent;
  transition: background var(--mp-dur-fast), color var(--mp-dur-fast);
}
.mp-nav-item:hover { background: var(--mp-interactive-bg-hover); color: var(--mp-fg); }
.mp-nav-item.is-active {
  color: var(--mp-fg); background: color-mix(in srgb, var(--mp-primary) 14%, transparent);
  border-left-color: var(--mp-primary);
}
.mp-nav-item.is-soon { opacity: .45; cursor: default; }
.mp-nav-ico { width: 18px; height: 18px; flex: none; }
.mp-nav-text { flex: 1; min-width: 0; }
.mp-nav-soon {
  font-size: 9px; font-weight: var(--mp-fw-semibold); text-transform: uppercase; letter-spacing: var(--mp-ls-wide);
  color: var(--mp-fg-faint);
}

/* sidebar footer: system-status LED + restricted notice */
.mp-sidebar-foot { margin-top: auto; padding-top: var(--mp-sp-3); border-top: 1px solid var(--mp-line); }
.mp-sys { display: flex; align-items: center; gap: 9px; padding: var(--mp-sp-2) 10px; }
.mp-sys-label { font-size: 11.5px; color: var(--mp-fg-muted); }
.mp-restricted { padding: 4px 10px 2px; font-size: 10px; letter-spacing: var(--mp-ls-normal); color: var(--mp-fg-faint); }

/* content column (CONTENT context — theme-aware) */
.mp-main { flex: 1 1 auto; min-width: 0; padding: 28px 32px 64px; }
.mp-content { width: 100%; max-width: 1080px; }

.mp-pagehead { margin: 0 0 22px; }
.mp-pagehead h1 {
  font-family: var(--mp-ff-display); font-size: var(--mp-text-2xl); font-weight: var(--mp-fw-bold);
  letter-spacing: var(--mp-ls-tight); margin: 0 0 3px; color: var(--mp-fg);
}
.mp-pagehead p { margin: 0; color: var(--mp-fg-muted); font-size: 13.5px; }

/* responsive: sidebar collapses to a horizontal strip */
@media (max-width: 720px) {
  .mp-appshell { flex-direction: column; }
  .mp-sidebar {
    position: static; width: 100%; flex: none; height: auto;
    border-right: none; border-bottom: 1px solid var(--mp-line);
    padding: var(--mp-sp-2) 10px;
  }
  .mp-nav { flex-direction: row; flex-wrap: wrap; gap: var(--mp-sp-1); }
  .mp-nav-group { margin-bottom: 0; display: flex; align-items: center; gap: var(--mp-sp-1); flex-wrap: wrap; }
  .mp-nav-label { display: none; }
  .mp-nav-item { border-left: none; border-bottom: 2px solid transparent; padding: var(--mp-sp-2) 10px; }
  .mp-nav-item.is-active { border-left: none; border-bottom-color: var(--mp-primary); }
  .mp-sidebar-foot { margin-top: 0; padding-top: var(--mp-sp-2); border-top: none; }
  .mp-restricted { display: none; }
  .mp-main { padding: 22px 18px 48px; }
}

/* ============================================================
   2. STATUS LED  (chassis + inline)
   ============================================================ */
.mp-led { width: 8px; height: 8px; border-radius: 50%; background: var(--mp-fg-faint); flex: none; }
.mp-led[data-state="online"]   { background: var(--mp-primary-light); box-shadow: 0 0 8px color-mix(in srgb, var(--mp-primary-light) 70%, transparent); }
.mp-led[data-state="down"]     { background: var(--mp-danger); box-shadow: 0 0 8px color-mix(in srgb, var(--mp-danger) 55%, transparent); }
.mp-led[data-state="checking"] { background: var(--mp-fg-faint); animation: mp-led-pulse 1.1s ease-in-out infinite; }
@keyframes mp-led-pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ============================================================
   3. USER-CONTEXT CHIP  (projected into mp-header slot="ops-context")
   Chassis context — always-dark — so on-brand tokens throughout.
   ============================================================ */
.mp-userchip { display: flex; align-items: center; gap: 10px; color: var(--mp-on-brand); }
.mp-userchip-email { font-size: 12.5px; color: var(--mp-on-brand); }
.mp-userchip-role {
  font-size: 10px; font-weight: var(--mp-fw-semibold); text-transform: uppercase; letter-spacing: var(--mp-ls-wider);
  color: var(--mp-primary-light);
  padding: 2px 8px; border-radius: var(--mp-r-pill);
  background: color-mix(in srgb, var(--mp-primary-light) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--mp-primary-light) 24%, transparent);
}
.mp-userchip-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mp-ff-display); font-size: 13px; font-weight: var(--mp-fw-bold);
  color: var(--mp-on-primary); background: linear-gradient(135deg, var(--mp-primary-light), var(--mp-primary));
  flex: none;
}
/* sign-out + icon buttons sit on the dark chassis */
.mp-chassis-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--mp-r-ctrl); cursor: pointer;
  font: inherit; font-size: var(--mp-text-sm); font-weight: var(--mp-fw-medium);
  color: var(--mp-on-brand-muted); background: rgba(255, 255, 255, .04); border: 1px solid var(--mp-line-on-brand);
  transition: color var(--mp-dur-fast), border-color var(--mp-dur-fast);
}
.mp-chassis-btn:hover { color: var(--mp-on-brand); border-color: var(--mp-line-on-brand-strong); }
.mp-chassis-btn--icon { width: 30px; height: 30px; padding: 0; justify-content: center; }
.mp-chassis-btn--icon svg { width: 16px; height: 16px; display: block; }

@media (max-width: 560px) { .mp-userchip-email { display: none; } }

/* ============================================================
   4. BUTTONS  (CONTENT context)
   Base = green primary fill with dark ink. Variants below.
   ============================================================ */
.mp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  font-family: var(--mp-ff-body); font-size: var(--mp-text-base); font-weight: var(--mp-fw-semibold);
  border-radius: var(--mp-r-ctrl); border: 1px solid transparent;
  background: var(--mp-primary); color: var(--mp-on-primary);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: filter var(--mp-dur-fast), background var(--mp-dur-fast), border-color var(--mp-dur-fast), opacity var(--mp-dur-fast);
}
.mp-btn:hover:not(:disabled) { filter: brightness(1.06); }
.mp-btn:disabled { opacity: .45; cursor: default; }

.mp-btn--ghost {
  background: var(--mp-interactive-bg); color: var(--mp-fg);
  border-color: var(--mp-interactive-border); font-weight: var(--mp-fw-medium);
}
.mp-btn--ghost:hover:not(:disabled) { background: var(--mp-interactive-bg-hover); border-color: var(--mp-line-strong); filter: none; }

.mp-btn--danger {
  background: var(--mp-danger-bg); color: var(--mp-danger);
  border-color: color-mix(in srgb, var(--mp-danger) 32%, transparent); font-weight: var(--mp-fw-semibold);
}
.mp-btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--mp-danger) 16%, var(--mp-danger-bg)); filter: none; }

/* CTA on amber (attention actions) — dark ink on amber fill, always legible */
.mp-btn--cta { background: var(--mp-warn); color: #2a1d02; }

.mp-btn--block { width: 100%; }
.mp-btn--sm { padding: 6px 13px; font-size: var(--mp-text-sm); }
.mp-btn--xs { padding: 2px 9px; font-size: var(--mp-text-xs); }

.mp-btn:focus-visible { outline: 2px solid var(--mp-focus); outline-offset: 2px; }

/* ============================================================
   5. FORM FIELDS  (CONTENT context)
   ============================================================ */
.mp-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--mp-sp-4); }
.mp-field > label, .mp-field > span.mp-label {
  font-size: var(--mp-text-xs); font-weight: var(--mp-fw-semibold);
  letter-spacing: var(--mp-ls-wide); text-transform: uppercase; color: var(--mp-fg-muted);
}

.mp-input, .mp-select, .mp-textarea {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px;
  font-family: var(--mp-ff-body); font-size: var(--mp-text-base);
  color: var(--mp-fg); background: var(--mp-bg-surface);
  border: 1px solid var(--mp-line-strong); border-radius: var(--mp-r-ctrl);
  outline: none;
  transition: background var(--mp-dur-fast), border-color var(--mp-dur-fast), box-shadow var(--mp-dur-fast);
}
.mp-input::placeholder, .mp-textarea::placeholder { color: var(--mp-fg-faint); }
.mp-input.mp-mono, .mp-input--mono { font-family: var(--mp-ff-mono); }
.mp-select { cursor: pointer; }
.mp-textarea { resize: vertical; min-height: 60px; }
.mp-input:focus, .mp-select:focus, .mp-textarea:focus {
  border-color: var(--mp-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-focus) 22%, transparent);
}
.mp-input.is-invalid, .mp-input--invalid { border-color: var(--mp-danger); }
.mp-hint { font-size: var(--mp-text-sm); color: var(--mp-fg-muted); margin: 6px 0 0; }

/* checkbox row */
.mp-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--mp-fg-muted); line-height: var(--mp-lh-normal); }
.mp-check input { margin-top: 2px; accent-color: var(--mp-primary); }

/* ============================================================
   6. CARDS / PANELS / NOTES  (CONTENT context)
   ============================================================ */
.mp-card {
  display: flex; flex-direction: column;
  padding: 18px 20px; border-radius: var(--mp-r-card);
  border: 1px solid var(--mp-line); background: var(--mp-bg-surface);
}
.mp-card--raised { background: var(--mp-bg-surface-2); }
a.mp-card { text-decoration: none; color: inherit; transition: border-color var(--mp-dur-fast), transform var(--mp-dur-fast), background var(--mp-dur-fast); }
a.mp-card:hover { border-color: var(--mp-primary-border); transform: translateY(-1px); background: var(--mp-bg-surface-2); }

.mp-panel { margin-bottom: 28px; }
.mp-panel > h2, .mp-section-h {
  font-family: var(--mp-ff-body); font-size: var(--mp-text-sm); font-weight: var(--mp-fw-semibold);
  text-transform: uppercase; letter-spacing: var(--mp-ls-wide); color: var(--mp-fg-muted);
  margin: 0 0 12px;
}
.mp-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }

.mp-note {
  background: var(--mp-bg-surface); border: 1px solid var(--mp-line); border-radius: var(--mp-r-card);
  padding: 16px 18px; color: var(--mp-fg-muted); font-size: 13px; line-height: var(--mp-lh-relaxed);
}
.mp-note strong { color: var(--mp-fg); }

.mp-empty { padding: 38px; text-align: center; color: var(--mp-fg-muted); font-size: 13px; }

/* attention banner — calm by default; amber + CTA when actionable */
.mp-attention {
  display: flex; align-items: center; gap: var(--mp-sp-4);
  padding: 17px 20px; border-radius: var(--mp-r-card);
  border: 1px solid var(--mp-line); border-left: 4px solid var(--mp-line-strong);
  background: var(--mp-bg-surface);
}
.mp-attention.is-actionable {
  border-color: color-mix(in srgb, var(--mp-warn) 38%, transparent);
  border-left-color: var(--mp-warn); background: var(--mp-warn-bg);
}

/* ============================================================
   7. KPI / STAT / REVENUE-BAND readouts  (CONTENT context)
   Display face, big + tight, tabular numerals. Semantic value colors.
   ============================================================ */
.mp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-bottom: 26px; }
.mp-kpi {
  background: var(--mp-bg-surface); border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-card); padding: 15px 17px;
}
.mp-kpi-k { font-size: var(--mp-text-xs); color: var(--mp-fg-faint); text-transform: uppercase; letter-spacing: var(--mp-ls-wide); }
.mp-kpi-v {
  font-family: var(--mp-ff-display); font-size: var(--mp-text-2xl); font-weight: var(--mp-fw-bold);
  margin-top: 6px; letter-spacing: -0.5px; color: var(--mp-fg); font-variant-numeric: tabular-nums;
}
.mp-kpi-v--good  { color: var(--mp-success); }
.mp-kpi-v--bad   { color: var(--mp-danger); }
.mp-kpi-v--warn  { color: var(--mp-warn); }
.mp-kpi-v--info  { color: var(--mp-info); }
.mp-kpi-v--muted { color: var(--mp-fg-muted); }

/* status readout strip (NOC-style, equal cells) */
.mp-statstrip {
  display: flex; flex-wrap: wrap;
  border: 1px solid var(--mp-line); border-radius: var(--mp-r-card);
  background: var(--mp-bg-surface); margin-bottom: 28px; overflow: hidden;
}
.mp-stat { flex: 1 1 170px; min-width: 150px; padding: 14px 18px; border-right: 1px solid var(--mp-line); display: flex; flex-direction: column; gap: 6px; }
.mp-stat:last-child { border-right: none; }
.mp-stat-k { font-size: var(--mp-text-xs); font-weight: var(--mp-fw-medium); text-transform: uppercase; letter-spacing: var(--mp-ls-wide); color: var(--mp-fg-faint); }
.mp-stat-v { font-family: var(--mp-ff-body); font-weight: var(--mp-fw-medium); font-size: 13.5px; color: var(--mp-fg); display: flex; align-items: center; gap: 8px; word-break: break-word; }
.mp-stat-v.is-muted { color: var(--mp-fg-faint); }
.mp-stat-v code, .mp-stat-v .mp-mono { font-family: var(--mp-ff-mono); font-size: 12.5px; }

/* revenue band — cost -> billed -> margin, margin given primacy (one green) */
.mp-revband {
  display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 1px;
  background: var(--mp-line); border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-card); overflow: hidden; margin-bottom: 30px;
}
.mp-revband-seg { background: var(--mp-bg-surface); padding: 17px 20px; }
.mp-revband-seg.is-primary { background: var(--mp-success-bg); }
.mp-revband-k { font-size: var(--mp-text-xs); color: var(--mp-fg-muted); text-transform: uppercase; letter-spacing: var(--mp-ls-wide); }
.mp-revband-v { font-family: var(--mp-ff-display); font-weight: var(--mp-fw-bold); font-size: var(--mp-text-2xl); margin-top: 8px; letter-spacing: -0.5px; line-height: 1; color: var(--mp-fg); font-variant-numeric: tabular-nums; }
.mp-revband-seg.is-primary .mp-revband-v { font-size: 40px; color: var(--mp-success); }  /* green TEXT => AA token, not the fill */
.mp-revband-sub { font-size: 11.5px; color: var(--mp-fg-muted); margin-top: 5px; }
@media (max-width: 560px) { .mp-revband { grid-template-columns: 1fr; } }

/* ============================================================
   8. TABLES  (CONTENT context)
   ============================================================ */
.mp-table-wrap { overflow-x: auto; border: 1px solid var(--mp-line); border-radius: var(--mp-r-card); }
.mp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mp-table thead th {
  background: var(--mp-bg-surface); color: var(--mp-fg-muted);
  font-size: var(--mp-text-xs); font-weight: var(--mp-fw-semibold); text-transform: uppercase; letter-spacing: var(--mp-ls-wide);
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--mp-line); white-space: nowrap;
}
.mp-table th.num, .mp-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mp-table tbody tr { border-bottom: 1px solid var(--mp-line); transition: background var(--mp-dur-fast); }
.mp-table tbody tr:last-child { border-bottom: none; }
.mp-table tbody tr:hover { background: var(--mp-interactive-bg-hover); }
.mp-table tbody tr.is-clickable { cursor: pointer; }
.mp-table tbody td { padding: 9px 14px; color: var(--mp-fg); white-space: nowrap; }
.mp-table td.mono, .mp-table td.mp-mono { font-family: var(--mp-ff-mono); font-size: 12px; }
.mp-table td.muted { color: var(--mp-fg-muted); }

.mp-amount-debit  { color: var(--mp-danger); font-family: var(--mp-ff-mono); }
.mp-amount-credit { color: var(--mp-success); font-family: var(--mp-ff-mono); }

/* ============================================================
   9. PILLS / CHIPS / BADGES  (CONTENT context)
   Semantic base + modifiers. Map domain states -> a semantic modifier
   (e.g. debit/negative -> --bad, credit/active -> --good, opening -> --info).
   Each pairs an accent text token with its accent -bg token; both flip per
   theme so contrast holds in light AND dark.
   ============================================================ */
.mp-pill {
  display: inline-block; border-radius: var(--mp-r-sm);
  font-size: 10px; font-weight: var(--mp-fw-semibold); letter-spacing: var(--mp-ls-wide);
  padding: 2px 7px; text-transform: uppercase;
  color: var(--mp-fg-muted); background: var(--mp-bg-subtle);
}
.mp-pill--good { color: var(--mp-success); background: var(--mp-success-bg); }
.mp-pill--bad  { color: var(--mp-danger);  background: var(--mp-danger-bg); }
.mp-pill--warn { color: var(--mp-warn);    background: var(--mp-warn-bg); }
.mp-pill--info { color: var(--mp-info);    background: var(--mp-info-bg); }
.mp-pill--neutral { color: var(--mp-fg-muted); background: var(--mp-bg-subtle); }
/* fully-rounded variant (counters, session badges) — not the square-cornered default */
.mp-pill--round { border-radius: var(--mp-r-pill); padding: 3px 10px; text-transform: none; letter-spacing: var(--mp-ls-normal); }

/* the 8 identity hues (freight gates, carrier/client status boards) — each pairs
   its theme-flipping --mp-status-<hue> text token with the ground-independent
   --mp-status-<hue>-bg tint; AA in both themes (check-contrast-aa.py). */
.mp-pill--green  { color: var(--mp-status-green);  background: var(--mp-status-green-bg); }
.mp-pill--amber  { color: var(--mp-status-amber);  background: var(--mp-status-amber-bg); }
.mp-pill--orange { color: var(--mp-status-orange); background: var(--mp-status-orange-bg); }
.mp-pill--violet { color: var(--mp-status-violet); background: var(--mp-status-violet-bg); }
.mp-pill--blue   { color: var(--mp-status-blue);   background: var(--mp-status-blue-bg); }
.mp-pill--red    { color: var(--mp-status-red);    background: var(--mp-status-red-bg); }
.mp-pill--mint   { color: var(--mp-status-mint);   background: var(--mp-status-mint-bg); }
.mp-pill--tan    { color: var(--mp-status-tan);    background: var(--mp-status-tan-bg); }

/* small status pill with border (roster/list use) */
.mp-status-pill {
  font-size: 10px; font-weight: var(--mp-fw-semibold); text-transform: uppercase; letter-spacing: var(--mp-ls-normal);
  border-radius: var(--mp-r-sm); padding: 1px 6px;
  color: var(--mp-fg-muted); background: var(--mp-bg-subtle); border: 1px solid var(--mp-line);
}
.mp-status-pill--info { color: var(--mp-info); background: var(--mp-info-bg); border-color: transparent; }
.mp-status-pill--bad  { color: var(--mp-danger); background: var(--mp-danger-bg); border-color: transparent; }

.mp-chip {
  display: inline-block; background: var(--mp-interactive-bg-hover); color: var(--mp-fg-muted);
  border-radius: var(--mp-r-sm); font-size: var(--mp-text-xs); padding: 1px 7px; margin: 0 3px 3px 0;
  font-family: var(--mp-ff-mono);
}
.mp-badge {
  font-size: 10px; font-weight: var(--mp-fw-semibold); letter-spacing: var(--mp-ls-normal);
  color: var(--mp-info); background: var(--mp-info-bg); border-radius: var(--mp-r-sm); padding: 1px 5px;
}

/* ============================================================
   10. ALERTS / STATUS BANNERS  (CONTENT context)
   .mp-alert = inline form alert (hidden until .is-shown).
   .mp-banner = live status line (hidden until a state class is present).
   ============================================================ */
.mp-alert {
  display: none;
  padding: 11px 13px; border-radius: var(--mp-r-ctrl);
  font-size: 13px; line-height: var(--mp-lh-snug); margin-bottom: 18px;
  border-left: 3px solid transparent;
}
.mp-alert.is-shown { display: block; }
.mp-alert--bad { background: var(--mp-danger-bg); color: var(--mp-danger); border-left-color: var(--mp-danger); }
.mp-alert--good { background: var(--mp-success-bg); color: var(--mp-success); border-left-color: var(--mp-primary); }
.mp-alert--warn { background: var(--mp-warn-bg); color: var(--mp-warn); border-left-color: var(--mp-warn); }
.mp-alert--info { background: var(--mp-info-bg); color: var(--mp-info); border-left-color: var(--mp-info); }

.mp-banner { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--mp-r-ctrl); font-size: 13px; display: none; }
.mp-banner--bad     { background: var(--mp-danger-bg);  color: var(--mp-danger);  border: 1px solid color-mix(in srgb, var(--mp-danger) 30%, transparent);  display: block; }
.mp-banner--info    { background: var(--mp-info-bg);    color: var(--mp-info);    border: 1px solid color-mix(in srgb, var(--mp-info) 25%, transparent);    display: block; }
.mp-banner--warn    { background: var(--mp-warn-bg);    color: var(--mp-warn);    border: 1px solid color-mix(in srgb, var(--mp-warn) 30%, transparent);    display: block; }
.mp-banner--good    { background: var(--mp-success-bg); color: var(--mp-success); border: 1px solid color-mix(in srgb, var(--mp-primary) 30%, transparent); display: block; }

/* ============================================================
   11. SHARED CLIENT-PICKER  (client-picker.js)  — CONTENT context
   ============================================================ */
.mp-picker { position: relative; }
.mp-picker-input {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: var(--mp-text-sm); padding: 9px 11px;
  color: var(--mp-fg); background: var(--mp-bg-surface);
  border: 1px solid var(--mp-line-strong); border-radius: var(--mp-r-card);
}
.mp-picker-input::placeholder { color: var(--mp-fg-faint); }
.mp-picker-input:focus {
  outline: none; border-color: var(--mp-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-focus) 22%, transparent);
}
.mp-picker-pop {
  position: absolute; z-index: var(--mp-z-dropdown); left: 0; right: 0; top: calc(100% + 4px);
  max-height: 320px; overflow-y: auto;
  background: var(--mp-bg-surface); border: 1px solid var(--mp-line-strong);
  border-radius: var(--mp-r-card); box-shadow: var(--mp-shadow-lg); padding: 5px;
}
.mp-picker-msg { padding: 12px 11px; color: var(--mp-fg-muted); font-size: var(--mp-text-sm); }
.mp-picker-msg--err { color: var(--mp-danger); cursor: pointer; }
.mp-picker-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-radius: var(--mp-r-ctrl);
  padding: 8px 10px; color: var(--mp-fg);
}
.mp-picker-row:hover, .mp-picker-row.is-active { background: var(--mp-bg-subtle); }
.mp-picker-name { font-weight: var(--mp-fw-semibold); font-size: var(--mp-text-sm); }
.mp-picker-cid { font-family: var(--mp-ff-mono); font-size: var(--mp-text-xs); color: var(--mp-fg-faint); margin-top: 2px; }

/* ============================================================
   12. PRE-AUTH GATE  (checking / sign-in / denied splash)  — CONTENT context
   Full-viewport centered card shown before the shell mounts. Every authed
   surface rolled its own .gate/.gate-inner; this is the one canonical form.
   ============================================================ */
.mp-center {
  min-height: 100dvh; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--mp-bg-subtle) 0%, var(--mp-bg-page) 42%);
}
.mp-gate {
  width: min(440px, calc(100% - 40px)); padding: 6px;
  background: var(--mp-bg-surface); border: 1px solid var(--mp-line); border-radius: var(--mp-r-xl);
}
.mp-gate-inner {
  padding: 44px 34px 38px; background: var(--mp-bg-surface-2);
  border-radius: var(--mp-r-lg); text-align: center;
}
.mp-gate-brand { display: inline-flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.mp-gate-brand img { height: 30px; width: auto; }
.mp-gate-brand-name { font-family: var(--mp-ff-body); font-weight: var(--mp-fw-medium); font-size: 15px; color: var(--mp-fg); }
.mp-gate-brand-name .mp-dim { color: var(--mp-primary-dark); font-weight: var(--mp-fw-semibold); }
.mp-gate-h {
  font-family: var(--mp-ff-display); font-size: var(--mp-text-2xl); font-weight: var(--mp-fw-bold);
  letter-spacing: var(--mp-ls-tight); margin: 0 0 8px; color: var(--mp-fg);
}
.mp-gate-sub { font-size: 14px; line-height: var(--mp-lh-normal); color: var(--mp-fg-muted); margin: 0 0 20px; }

/* ============================================================
   13. SPINNER  (indeterminate)  — works on any ground
   ============================================================ */
.mp-spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--mp-line-strong); border-top-color: var(--mp-primary);
  animation: mp-spin .8s linear infinite; margin: 0 auto; flex: none;
}
.mp-spinner--sm { width: 16px; height: 16px; }
.mp-spinner--lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes mp-spin { to { transform: rotate(360deg); } }

/* ============================================================
   14. MODAL  (centered sheet + scrim)  — CONTENT context
   .mp-modal is the full-viewport overlay; toggle visibility with [hidden] or a
   .is-open class on the surface's side. .mp-modal-card is the sheet itself.
   ============================================================ */
.mp-modal {
  position: fixed; inset: 0; z-index: var(--mp-z-modal);
  display: grid; place-items: center; padding: 20px;
  background: var(--mp-bg-overlay);
  animation: mp-modal-in var(--mp-dur-slow) var(--mp-ease);
}
@keyframes mp-modal-in { from { opacity: 0; } to { opacity: 1; } }
.mp-modal-card {
  width: min(460px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto;
  background: var(--mp-bg-surface); border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-lg); box-shadow: var(--mp-shadow-xl);
}
.mp-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--mp-line);
}
.mp-modal-head h2 { margin: 0; font-size: 15px; font-weight: var(--mp-fw-semibold); color: var(--mp-fg); }
.mp-modal-x {
  background: none; border: none; font-size: 20px; line-height: 1;
  color: var(--mp-fg-faint); cursor: pointer; padding: 2px 6px;
}
.mp-modal-x:hover { color: var(--mp-fg); }
.mp-modal-body { padding: 18px 20px; color: var(--mp-fg); }
.mp-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--mp-line); background: var(--mp-bg-surface-2);
}
