/* ============================================================================
   R3 Console — design foundation.
   Mirrors the rainplan-explorer design system (same token names/values) so the
   build reads as native to the platform, at internal-tool density. Components
   are added here as pages need them (P1b/P1c). See docs/design.md.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg-deep: #FFFFFF;
  --bg-panel: #F9FAFB;        /* was #F5F6F8 */
  --bg-card: #FFFFFF;
  --bg-input: #FAFAFA;

  /* Brand / status accents (from rainplan-explorer) */
  --accent-water: #1570EF;   /* blue   — active / current / info */
  --accent-rain:  #067647;   /* green  — complete / approved */
  --accent-warm:  #E87B2F;   /* amber  — in-review / warning / TEST */
  --accent-danger:#D92D20;   /* red    — error / disapproved / LIVE / destructive (new) */

  /* Navy (admin rp-navy / rp-navy-dark) */
  --navy:      #032870;
  --navy-deep: #0C264D;

  /* Text */
  --text-primary: #181D27;
  --text-muted:   #535862;
  --text-onaccent:#FFFFFF;
  --border: #E4E7EC;          /* was #E9EAEB */

  /* Type */
  --font-display: 'Montserrat', system-ui, -apple-system, sans-serif;  /* was Sora */
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

  /* Radii / shadow */
  --radius-sm: 8px;           /* was 6px */
  --radius-md: 12px;
  --radius-lg: 12px;          /* was 20px */
  --radius-pill: 100px;
  --shadow-glow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lift: 0 8px 24px rgba(0, 0, 0, 0.10);

  /* Motion */
  --dur-fast: 200ms;
  --dur-base: 240ms;
  --ease-out: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden attr must beat component display rules (.info-row flex, etc.) */
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-panel);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy); margin: 0 0 0.4em; }
a { color: var(--accent-water); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-water);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute; left: 8px; top: -40px; background: var(--bg-card);
  padding: 8px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-glow);
  transition: top var(--dur-fast) ease;
}
.skip-link:focus { top: 8px; }

/* ── app header ───────────────────────────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.app-header__brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.app-header__brand span { color: var(--accent-water); }
.app-header__spacer { flex: 1; }
.app-header__user { font-size: 0.85rem; color: var(--text-muted); }
.app-header__logout {
  background: none; border: 0; color: var(--accent-water); cursor: pointer;
  font: inherit; font-size: 0.85rem; padding: 4px 6px;
}

/* ── environment (TEST / LIVE) toggle badge ───────────────────────────────── */
[data-env-toggle] {
  font-family: var(--font-display); font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.04em; cursor: pointer; border: 1px solid transparent;
  padding: 4px 12px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 6px;
}
[data-env-toggle]::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
[data-env-toggle][data-env="test"] {
  color: #B45309; background: rgba(232, 123, 47, 0.12); border-color: rgba(232, 123, 47, 0.30);
}
[data-env-toggle][data-env="live"] {
  color: #B42318; background: rgba(217, 45, 32, 0.12); border-color: rgba(217, 45, 32, 0.45);
}

/* ── status pills (.detail-badge) — AA-darkened text on 8% tints ──────────── */
.detail-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 600; line-height: 1;
  padding: 4px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.detail-badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.detail-badge--blue   { color: #0B4FB0; background: rgba(21, 112, 239, 0.12); }
.detail-badge--green  { color: #045B36; background: rgba(6, 118, 71, 0.12); }
.detail-badge--amber  { color: #B45309; background: rgba(232, 123, 47, 0.14); }
.detail-badge--purple { color: #5B21B6; background: rgba(124, 58, 237, 0.12); }
.detail-badge--gray   { color: #414651; background: rgba(83, 88, 98, 0.10); }
.detail-badge--danger { color: #B42318; background: rgba(217, 45, 32, 0.12); }

/* ── buttons ──────────────────────────────────────────────────────────────── */
.cta-button {
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
  color: var(--text-onaccent); background: var(--accent-water); border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: var(--radius-sm);
  transition: background var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.cta-button:hover { background: #195ABD; }
.cta-button:disabled { opacity: 0.5; cursor: not-allowed; }
.cta-button--warm { background: var(--accent-warm); }

/* ── form fields ──────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.field-input, .field-select, .field-textarea {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--text-primary);
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background var(--dur-fast) ease;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none; background: #fff;
  border-color: var(--accent-water); box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1);
}
.field-input[readonly], .field-input:disabled { background: var(--bg-panel); color: var(--text-muted); cursor: not-allowed; }
.field-input.error, .field-select.error, .field-textarea.error { border-color: var(--accent-danger); box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.1); }

/* ── skeleton loading ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #eef0f3 25%, #e3e6ea 37%, #eef0f3 63%);
  background-size: 400% 100%; border-radius: var(--radius-sm);
  animation: r3-shimmer 1.4s ease infinite;
}
.skeleton--text { height: 0.8em; margin: 0.35em 0; }
.skeleton--heading { height: 1.4em; width: 40%; }
.skeleton--card { height: 96px; border-radius: var(--radius-md); }
@keyframes r3-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── containers ───────────────────────────────────────────────────────────── */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-glow);
}

/* ── inline info / empty / error row (replaces the blocking modal) ────────── */
.info-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--bg-panel); border: 1px solid var(--border);
}
.info-row--error { background: rgba(217, 45, 32, 0.06); border-color: rgba(217, 45, 32, 0.30); }
.info-row__icon { flex: 0 0 auto; }
.info-row__body { flex: 1; }
.info-row__retry {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 12px; cursor: pointer; font: inherit; font-size: 0.85rem;
}

/* ── workspace (lists) ────────────────────────────────────────────────────── */
.workspace-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.workspace-head h1 { margin-right: auto; }
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 4px 0 20px; }
@media (max-width: 880px) { .kpi-strip { grid-template-columns: repeat(2, 1fr); } }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.kpi-card__label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-card__value { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; margin-top: 4px; color: var(--navy); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text-primary); }
.tab--active { color: var(--accent-water); border-bottom-color: var(--accent-water); }
.tab__count { font-size: 0.72rem; color: var(--text-muted); background: var(--bg-panel); border-radius: var(--radius-pill); padding: 1px 8px; }
.tab__count:empty { display: none; }
/* In-card tab bar (per application card): same .tabs/.tab/.tab-panel as the
   detail-page tabs, just a hair of separation from the record bar above it and
   allowed to wrap (an application card carries up to six tabs). */
.tabs--in-card { margin-top: 4px; flex-wrap: wrap; }

.search { width: 100%; max-width: 420px; margin-bottom: 12px; font: inherit; font-size: 0.95rem; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); }
.search:focus { outline: none; background: #fff; border-color: var(--accent-water); box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1); }

/* List controls — search + Status/Assignee filter dropdowns (review deck 2026-06-23). */
.list-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 12px; }
.list-controls .search { margin-bottom: 0; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.filter-bar:empty { display: none; }
.filter { display: inline-flex; align-items: center; gap: 6px; }
.filter__k { font-family: var(--font-display); font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.filter__select { font: inherit; font-size: 0.9rem; color: var(--text-primary); background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 28px 7px 10px; cursor: pointer; }
.filter__select:focus { outline: none; background: #fff; border-color: var(--accent-water); box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1); }

.table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.r3-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.r3-table caption { text-align: left; padding: 12px 14px 4px; color: var(--text-muted); font-size: 0.78rem; }
.r3-table thead th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.r3-table thead th.td-num { text-align: right; }
.r3-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.r3-table tbody tr:last-child td { border-bottom: 0; }
.r3-table tbody tr.clickable { cursor: pointer; }
.r3-table tbody tr.clickable:hover { background: var(--bg-panel); }
/* contact name (submitter) shown beneath the linked address in the Parcel cell */
.row-sub { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.r3-table .td-num { text-align: right; font-variant-numeric: tabular-nums; }
.r3-table a.row-link { color: var(--navy); text-decoration: none; font-weight: 500; }
.r3-table a.row-link:hover { color: var(--accent-water); text-decoration: underline; }
.table-state { margin: 0; border-radius: var(--radius-md); }

/* ── detail console ───────────────────────────────────────────────────────── */
.back-link { display: inline-block; color: var(--accent-water); text-decoration: none; font-size: 0.85rem; margin-bottom: 6px; }
.back-link:hover { text-decoration: underline; }
.detail-sub { color: var(--text-muted); font-size: 0.85rem; margin: 2px 0 0; }

.stepper { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 16px 0 24px; }
.step__node { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); }
.step__node[data-state="done"] { color: #045B36; background: rgba(6, 118, 71, 0.10); border-color: rgba(6, 118, 71, 0.30); }
.step__node[data-state="current"] { color: #0B4FB0; background: rgba(21, 112, 239, 0.10); border-color: rgba(21, 112, 239, 0.35); }
.step__node[data-state="review"] { color: #B45309; background: rgba(232, 123, 47, 0.12); border-color: rgba(232, 123, 47, 0.30); }
.step__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.step__sep { color: #cfd3da; padding: 0 2px; }

.section-h { font-family: var(--font-display); font-size: 1.05rem; margin: 26px 0 10px; color: var(--navy); }
.case-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 16px; overflow: hidden; }
.case-card__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.case-card__title { font-family: var(--font-display); font-weight: 700; color: var(--navy); }
.case-card__modified { margin-left: auto; font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.case-card__body { padding: 18px; }
.subsection { padding: 6px 0 4px; }
.subsection + .subsection { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 16px; }
/* Level-1 stage header — a quiet display-font title (no longer the tiny uppercase eyebrow). */
.subsection__label { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--navy); text-transform: none; letter-spacing: 0; margin: 0 0 14px; }
/* The "· staff-editable" / "· read-only" provenance tag — a quiet muted pill. */
.ro-tag { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--bg-panel); padding: 2px 7px; border-radius: var(--radius-pill); margin-left: 8px; vertical-align: middle; }
.subsection__label .ro-tag { color: var(--text-muted); }

.fact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 22px; }
@media (max-width: 760px) { .fact-grid { grid-template-columns: repeat(2, 1fr); } }
.fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact__k { font-size: 0.7rem; color: var(--text-muted); }
.fact__v { font-size: 0.95rem; word-break: break-word; }
/* Hidden-fields inspector: long dotted key-paths need one column + breakable, mono keys. */
.fact-grid--paths { grid-template-columns: 1fr; gap: 10px 0; }
.fact-grid--paths .fact__k { word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.ff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
@media (max-width: 760px) { .ff-grid { grid-template-columns: 1fr; } }
.ff-grid .full { grid-column: 1 / -1; }

.bmp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bmp-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); cursor: pointer; user-select: none; }
.bmp-chip input { margin: 0; }
.bmp-chip:has(input:checked) { border-color: var(--accent-water); background: rgba(21, 112, 239, 0.06); color: #0B4FB0; }

.save-bar { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.save-bar__status { font-size: 0.82rem; color: var(--text-muted); margin-right: auto; }
.save-bar__status[data-tone="dirty"] { color: #B45309; }
.save-bar__status[data-tone="ok"] { color: var(--accent-rain); }
.save-bar__status[data-tone="err"] { color: var(--accent-danger); }
.save-bar__status[data-tone="warn"] { color: var(--accent-warm); } /* read-only/locked-stage note */

/* editable stage grid */
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: start; }
@media (max-width: 760px) { .edit-grid { grid-template-columns: repeat(2, 1fr); } }
/* Fixed 2-up grid for short date-pair stages (Legal Agreement) so paired dates stay side by
   side — e.g. Budget Requested / Budget Approved on row 1, LA Routed / LA Executed on row 2. */
.edit-grid--pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 720px; }
@media (max-width: 560px) { .edit-grid--pairs { grid-template-columns: 1fr; } }
.efield { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.efield.full { grid-column: 1 / -1; }
.efield__k { font-size: 0.68rem; font-weight: 500; color: var(--text-muted); }
/* Level-2 group sub-header — a full-width labelled separator inside an edit-grid (no input;
   groups the leaf fields below it). Used by the Project/Approval clusters (.field-group) and
   the Closeout bucket groups (.closeout-group); both share these rules. Reads as a section rule. */
.closeout-group, .field-group { grid-column: 1 / -1; gap: 0; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
.closeout-group:first-child, .field-group:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.closeout-group .efield__k, .field-group .efield__k { font-family: var(--font-display); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--navy); }
/* Level-3 read-only value — an inert boxed cell that matches an input's footprint (so a
   read-only field sits flush beside editable ones inside an edit-grid). */
.efield__ro { min-height: 36px; display: flex; align-items: center; max-width: 320px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-panel); color: var(--text-muted); font-size: 0.9rem; }
.efield input, .efield textarea, .efield select { font: inherit; font-size: 0.9rem; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); width: 100%; }
.efield input, .efield select { max-width: 320px; }  /* cap so single fields don't stretch absurdly wide; textarea keeps 100% */
.efield textarea { resize: vertical; }
.efield input:focus, .efield textarea:focus, .efield select:focus { outline: none; background: #fff; border-color: var(--accent-water); box-shadow: 0 0 0 3px rgba(21, 112, 239, 0.1); }
/* Status-trigger date fields: filling one DERIVES the application status, so flag them red. */
.efield--trigger input { border-color: var(--accent-danger); box-shadow: 0 0 0 1px rgba(217, 45, 32, 0.22); }
.efield--trigger input:focus { border-color: var(--accent-danger); box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.14); }
.efield__drives { color: var(--accent-danger); font-weight: 700; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.03em; margin-left: 4px; }
.doc-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.doc-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; color: var(--accent-water); background: var(--bg-card); }
.doc-link:hover { border-color: var(--accent-water); }
.doc-thumb { width: 100%; max-width: 220px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 6px; }
.doc-link__size { color: var(--text-muted); font-weight: 400; }

/* ── Photos & Documents viewer (Plus Page media interface) ─────────────────── */
/* A label + an optional upload control on one row above the grid/rows. */
.subsection__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.subsection__bar .subsection__label { margin: 0; }
.media-upload { cursor: pointer; font-size: 0.8rem; padding: 6px 12px; }
.media-upload--busy { opacity: 0.55; pointer-events: none; }
/* Photo thumbnails — 100px squares, 6px gutters (matches the Figma sketch). */
.photo-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.photo-thumb { width: 100px; height: 100px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--bg-panel); text-decoration: none; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb:hover { border-color: var(--accent-water); }
/* Placeholder for an entity_media_id GET /media can't return yet (api-3) — dashed
   amber so it reads as pending, never as a broken image. */
.photo-thumb--pending { border-style: dashed; border-color: rgba(232, 123, 47, 0.5); background: rgba(232, 123, 47, 0.06); padding: 6px; }
.photo-thumb__id { font-size: 0.62rem; font-weight: 600; color: var(--accent-warm); text-align: center; line-height: 1.3; word-break: break-word; }
.info-row--pending { background: rgba(232, 123, 47, 0.06); border-color: rgba(232, 123, 47, 0.30); }

/* detail tabs + collapsible case accordions */
.tab-panel { display: none; }
.tab-panel--active { display: block; }
.case-card__head--toggle { cursor: pointer; user-select: none; }
.case-card__head--toggle:hover { background: var(--bg-panel); }
.case-card__head--toggle:focus-visible { outline: 2px solid var(--accent-water); outline-offset: -2px; }
.acc-chevron { margin-left: auto; color: var(--text-muted); transition: transform 200ms ease; font-size: 0.8rem; }
.case-card__head--open .acc-chevron { transform: rotate(90deg); }

/* ── JSON inspectors (ghost toggles + floating non-modal panel) ───────────── */
.record-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.ghost-button {
  font-family: var(--font-display); font-weight: 600; font-size: 0.8rem;
  color: var(--text-muted); background: transparent; cursor: pointer;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.ghost-button:hover { color: var(--accent-water); border-color: var(--accent-water); }
.ghost-button[aria-expanded="true"] { color: #0B4FB0; border-color: var(--accent-water); background: rgba(21, 112, 239, 0.06); }

/* Non-modal on purpose: the form stays editable while open, and every input
   re-renders the JSON so staff verify exactly what Save will submit.
   Bottom-LEFT so it never covers the right-aligned Save buttons. */
.payload-pop {
  position: fixed; left: 16px; bottom: 16px; z-index: 60;
  width: min(440px, calc(100vw - 32px)); max-height: min(60vh, 520px);
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lift);
  padding: 12px 14px;
}
.payload-pop__head { display: flex; align-items: center; gap: 8px; }
.payload-pop__title { font-family: var(--font-display); font-weight: 600; font-size: 0.85rem; color: var(--text-primary); margin-right: auto; }
.payload-pop__act { padding: 4px 10px; font-size: 0.72rem; }
.payload-pop__endpoint { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }
.payload-pop__pre {
  flex: 1; overflow: auto; margin: 8px 0 0; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem; line-height: 1.5; color: var(--text-primary);
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); white-space: pre; tab-size: 2;
}
.payload-pop__note { margin: 8px 0 0; font-size: 0.7rem; color: var(--text-muted); }

/* ── Roadmap + Guide (TEST-only pages + header links) ─────────────────────── */
/* Both header pills (Roadmap, Guide) share this style; both are TEST-gated by
   roadmap-link.js (visible in TEST, hidden in LIVE). */
.app-header__roadmap {
  display: inline-flex; align-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 0.8rem;
  color: var(--accent-water); text-decoration: none;
  padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.app-header__roadmap:hover { border-color: var(--accent-water); background: rgba(21, 112, 239, 0.06); }
.app-header__roadmap:focus-visible { outline: 2px solid var(--accent-water); outline-offset: 2px; }

/* ── Guide / walkthrough (TEST-only blog page) ────────────────────────────── */
.guide { max-width: 820px; margin: 0 auto; }
.guide__meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--text-muted); margin: 0 0 10px;
}
.guide__lede {
  font-size: 1.05rem; line-height: 1.6; color: var(--text-muted);
  margin: 0 0 36px; max-width: 66ch;
}
.guide__section { margin: 0 0 44px; }
.guide__section h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.3rem;
  color: var(--text-primary); margin: 0 0 12px;
}
.guide__section p { line-height: 1.66; margin: 0 0 14px; max-width: 66ch; }
.guide__section p:last-child { margin-bottom: 0; }
.guide__section ul { line-height: 1.66; margin: 0 0 14px; padding-left: 20px; max-width: 66ch; }
.guide__section li { margin: 5px 0; }
.guide__section code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em;
  background: var(--bg-panel); padding: 1px 5px; border-radius: var(--radius-sm);
}
.guide-shot {
  margin: 20px 0 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--bg-panel); box-shadow: var(--shadow-lift);
}
.guide-shot img { display: block; width: 100%; height: auto; }
.guide-shot figcaption {
  padding: 11px 16px; font-size: 0.8rem; line-height: 1.5; color: var(--text-muted);
  border-top: 1px solid var(--border); background: var(--bg-card);
}
.guide-shot figcaption b { color: var(--text-primary); font-weight: 600; }
.guide__callout {
  border-left: 3px solid var(--accent-warm); background: var(--bg-panel);
  padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0 0;
  font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); max-width: 66ch;
}
.guide__end {
  margin: 8px 0 0; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 0.9rem; color: var(--text-muted);
}

/* ── TEST-only tag ────────────────────────────────────────────────────────── */
/* The amber TEST pill marks TEST-only labels (now just the /guide walkthrough page).
   The "Test journey" harness + closeout "PO-submit" panel that used it were removed
   2026-06-23. Amber = the TEST data source. */
.test-tag {
  display: inline-block; vertical-align: 1px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.6rem;
  letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
  color: var(--text-onaccent); background: var(--accent-warm);
  padding: 2px 5px; border-radius: var(--radius-sm); margin-right: 2px;
}

.roadmap-cat { margin-bottom: 26px; }
.roadmap-cat__title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  margin: 0 0 4px; display: flex; align-items: center; gap: 8px;
}
.roadmap-cat__count {
  font-family: var(--font-body); font-weight: 600; font-size: 0.72rem; color: var(--text-muted);
  background: var(--bg-panel); border-radius: var(--radius-pill); padding: 1px 9px;
}
.roadmap-cat__blurb { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 12px; }

/* items reuse .case-card + the accordion; the summary stays visible, the body holds the detail */
.roadmap-card .case-card__head { border-bottom: 0; padding-bottom: 8px; }
.roadmap-card__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; font-size: 0.72rem;
  color: var(--text-muted); background: var(--bg-panel); padding: 1px 6px; border-radius: var(--radius-sm);
}
.roadmap-card__summary { margin: 0; padding: 0 18px 14px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.45; }
/* "date + PR #" tracking pill — which PR last addressed an item, and when. */
.roadmap-card__track { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: -6px 0 0; padding: 0 18px 14px; font-size: 0.72rem; color: var(--text-muted); }
.roadmap-card__track-pin { font-size: 0.78rem; }
.roadmap-card__track-pr { color: var(--accent-water); font-weight: 600; text-decoration: none; }
.roadmap-card__track-pr:hover { text-decoration: underline; }
.roadmap-card__track-pr:focus-visible { outline: 2px solid var(--accent-water); outline-offset: 2px; border-radius: var(--radius-sm); }
.roadmap-card .case-card__body { border-top: 1px solid var(--border); }
.roadmap-card .fact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .roadmap-card .fact-grid { grid-template-columns: 1fr; } }
.roadmap-detail { font-size: 0.9rem; line-height: 1.5; margin: 12px 0 0; }
.roadmap-detail--evidence { color: var(--text-muted); font-size: 0.85rem; }

/* "Issue draft" block — story / steps / interface impact (or concept), at the top of
   the expanded body so each card reads like a fileable issue; the facts + detail +
   evidence below stay the engineering notes. */
.roadmap-issue {
  margin: 0 0 16px; padding: 13px 15px; background: var(--bg-panel);
  border: 1px solid var(--border); border-left: 3px solid var(--accent-water);
  border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 13px;
}
.roadmap-issue__row { display: flex; flex-direction: column; gap: 5px; }
.roadmap-issue__label {
  font-family: var(--font-display); font-weight: 600; font-size: 0.62rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--navy);
}
.roadmap-issue__label--concept { color: var(--accent-warm); }
/* user story + recommended fix surfaced in the always-visible description */
.roadmap-card__story { margin: -4px 0 0; padding: 0 18px 8px; font-size: 0.9rem; line-height: 1.5; color: var(--text-primary); }
.roadmap-card__fix { margin: 0; padding: 0 18px 14px; font-size: 0.9rem; line-height: 1.5; color: var(--text-primary); }
.roadmap-card__story-tag, .roadmap-card__fix-tag {
  font-family: var(--font-display); font-weight: 600; font-size: 0.58rem; letter-spacing: 0.06em;
  text-transform: uppercase; border: 1px solid var(--border);
  padding: 2px 7px; border-radius: var(--radius-pill); margin-right: 7px; white-space: nowrap;
}
.roadmap-card__story-tag { color: var(--navy); background: var(--bg-panel); }
.roadmap-card__fix-tag { color: var(--accent-rain); background: rgba(6, 118, 71, 0.08); }
/* "Pending · live cutover" pill — items parked until the TEST→LIVE data swap; verdict colour-coded
   (survives = red, so a real bug is never mistaken for "the cutover will fix it"). The `why` sub-line
   carries the evidentiary basis, tinted to match the verdict. */
.roadmap-card__cutover { margin: 0; padding: 0 18px 14px; }
.roadmap-card__cutover-head { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--text-muted); }
.roadmap-card__cutover-head strong { color: var(--text-primary); }
.roadmap-card__cutover-tag {
  font-family: var(--font-display); font-weight: 600; font-size: 0.58rem; letter-spacing: 0.06em;
  text-transform: uppercase; border: 1px solid var(--border);
  padding: 2px 7px; border-radius: var(--radius-pill); margin-right: 7px; white-space: nowrap;
  color: var(--accent-warm); background: rgba(232, 123, 47, 0.1);
}
.roadmap-card__cutover-why { margin: 6px 0 0; padding: 5px 0 4px 11px; border-left: 2px solid var(--border); font-size: 0.82rem; line-height: 1.5; color: var(--text-muted); }
.roadmap-card__cutover-why strong { color: var(--text-primary); font-weight: 600; }
.roadmap-card__cutover--survives .roadmap-card__cutover-tag { color: #B42318; background: rgba(217, 45, 32, 0.12); }
.roadmap-card__cutover--resolves .roadmap-card__cutover-tag { color: #045B36; background: rgba(6, 118, 71, 0.12); }
.roadmap-card__cutover--likely   .roadmap-card__cutover-tag { color: #0B4FB0; background: rgba(21, 112, 239, 0.12); }
.roadmap-card__cutover--survives .roadmap-card__cutover-why { border-left-color: rgba(217, 45, 32, 0.45); }
.roadmap-card__cutover--resolves .roadmap-card__cutover-why { border-left-color: rgba(6, 118, 71, 0.45); }
.roadmap-card__cutover--likely   .roadmap-card__cutover-why { border-left-color: rgba(21, 112, 239, 0.45); }
.roadmap-card__cutover--uncertain .roadmap-card__cutover-why { border-left-color: rgba(232, 123, 47, 0.45); }
.roadmap-issue__impact { margin: 0; font-size: 0.88rem; line-height: 1.5; color: var(--text-muted); }
.roadmap-issue__steps {
  margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px;
  font-size: 0.88rem; line-height: 1.45; color: var(--text-muted);
}
.roadmap-issue__steps li { padding-left: 2px; }

/* read-modify-write convention callout (top of the roadmap; warm = attention) */
.roadmap-note {
  margin: 4px 0 22px; padding: 11px 14px; background: rgba(232, 123, 47, 0.07);
  border: 1px solid var(--border); border-left: 3px solid var(--accent-warm);
  border-radius: var(--radius-sm); font-size: 0.84rem; line-height: 1.5; color: var(--text-primary);
}
.roadmap-note strong { font-family: var(--font-display); color: var(--navy); }
.roadmap-note code { font-size: 0.86em; }

/* ── top navigation bar ───────────────────────────────────────────────────── */
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 20px; min-height: 56px; background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.topnav__brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--navy); text-decoration: none; margin-right: 10px; }
.topnav__brand span { color: var(--accent-water); }
.topnav__spacer { flex: 1; }
.topnav__link { font-family: var(--font-display); font-weight: 600; font-size: 0.8rem; color: var(--accent-water); text-decoration: none; padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--radius-pill); }
.topnav__link:hover { border-color: var(--accent-water); }

/* ── detail console: form column + sticky context rail ────────────────────── */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .detail-layout { grid-template-columns: 1fr; } }
.detail-main { min-width: 0; }
.detail-rail { min-width: 0; position: sticky; top: 16px; }
.detail-rail__title { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; color: var(--navy); margin: 0 0 12px; }
.detail-rail__status { margin: 0 0 14px; }
.detail-rail .fact-grid { grid-template-columns: 1fr; gap: 12px 0; }   /* single-column summary in the rail */

/* ── Submitted-form receipt (read-only "View submitted form" side panel) ───── */
.form-receipt-trigger { margin-left: auto; align-self: center; }
.form-receipt {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(560px, 94vw);
  background: var(--bg-card); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
  animation: receipt-in var(--dur-base) var(--ease-out);
}
.form-receipt__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex: none;
}
.form-receipt__title { font-family: var(--font-display); color: var(--navy); font-size: 1rem; margin: 0; }
.form-receipt__sub { color: var(--text-muted); font-size: 0.78rem; margin: 4px 0 0; }
.form-receipt__close {
  border: 1px solid var(--border); background: var(--bg-panel); border-radius: var(--radius-sm);
  width: 30px; height: 30px; cursor: pointer; color: var(--text-muted); flex: none; font-size: 0.9rem;
}
.form-receipt__close:hover { border-color: var(--accent-water); color: var(--navy); }
.form-receipt__body { flex: 1; overflow-y: auto; padding: 8px 20px 28px; }
.receipt-sec { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
.receipt-sec:first-child { border-top: none; margin-top: 0; padding-top: 6px; }
.receipt-sec__h { font-family: var(--font-display); font-weight: 600; color: var(--navy); font-size: 0.95rem; margin: 0 0 12px; }
.receipt-sec--extra .receipt-sec__h { color: var(--text-muted); }
.receipt-item { font-family: var(--font-display); font-weight: 600; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 8px; }
.receipt-empty { color: var(--text-muted); font-size: 0.85rem; margin: 2px 0 0; }
.receipt-note { color: var(--text-muted); font-size: 0.76rem; background: var(--bg-panel); border-radius: var(--radius-sm); padding: 8px 11px; margin-top: 12px; line-height: 1.45; }
/* Q&A readability — the question (muted) sits directly above a prominent answer as a tight pair;
   long questions span the full width, short scalars share the 2-col grid. Scoped to the panel so
   the app's other .fact rows (parcel rail, consultation strip) are untouched. */
.form-receipt .fact-grid { gap: 15px 22px; align-items: start; }
.form-receipt .fact { display: flex; flex-direction: column; gap: 3px; }
.form-receipt .fact__k { font-size: 0.78rem; font-weight: 400; color: var(--text-muted); line-height: 1.45; }
.form-receipt .fact__v { font-size: 0.95rem; font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.form-receipt .fact__v--blank { font-weight: 400; color: var(--text-muted); }
.form-receipt .fact__unit { color: var(--text-muted); font-weight: 400; }
.form-receipt .receipt-grp { grid-column: 1 / -1; font-family: var(--font-display); font-weight: 600; font-size: 0.8rem; color: var(--navy); line-height: 1.4; margin: 6px 0 0; }
.fact--full { grid-column: 1 / -1; }
@keyframes receipt-in { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Closeout (parent-central): parent summary + per-child final-asset blocks ── */
.closeout-parent { background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 14px; }
.closeout-parent__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.closeout-parent__head h4 { margin: 0; font-size: 1.05rem; }
.closeout-parent__sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.closeout-parent__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.closeout-parent__roll { margin-left: auto; color: var(--accent-rain); font-weight: 600; font-size: 0.8rem; }
.co-chip { font-size: 0.72rem; font-weight: 500; padding: 3px 10px; border-radius: var(--radius-pill); background: #EEF2FB; color: var(--navy); border: 1px solid #DCE3F5; }
.co-child { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; background: var(--bg-card); }
.co-child__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.co-child__title { font-weight: 600; color: var(--navy); }
.co-assets-label { font-size: 0.68rem; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.co-assets { display: flex; flex-wrap: wrap; gap: 8px; }
.asset-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 500; padding: 4px 10px; border-radius: var(--radius-sm); background: rgba(6,118,71,0.10); color: var(--accent-rain); border: 1px solid rgba(6,118,71,0.25); }
.co-locked { margin-top: 8px; }
.asset-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 16px; padding: 10px 0; border-top: 1px dashed var(--border); }
.asset-row:first-child { border-top: 0; padding-top: 0; }
.ghost-btn { margin-top: 10px; font-family: var(--font-body); font-weight: 600; font-size: 0.82rem; color: var(--navy); background: #FBFCFE; border: 1px dashed #B9C2D6; border-radius: var(--radius-pill); padding: 6px 14px; cursor: pointer; }
.ghost-btn:hover { background: #F1F5FD; }
.save-bar--commit { justify-content: flex-end; }

/* ── Forms & widgets launcher ─────────────────────────────────────────────── */
.forms-context { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; margin: 0 0 22px; }
.forms-context__top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.forms-context__label { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.forms-mode { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.forms-mode__btn { border: 0; background: var(--bg-card); color: var(--text-muted); font: inherit; font-size: 13px; padding: 5px 14px; cursor: pointer; }
.forms-mode__btn--on { background: var(--navy); color: var(--text-onaccent); }
.forms-context__search { width: 100%; margin: 0 0 10px; }
.forms-context__results { position: relative; display: grid; gap: 2px; margin: -4px 0 10px; }
.forms-result { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 11px; cursor: pointer; font: inherit; }
.forms-result:hover { border-color: var(--accent-water); }
.forms-result--empty { color: var(--text-muted); cursor: default; }
.forms-result__addr { font-weight: 600; }
.forms-result__owner { color: var(--text-muted); font-size: 13px; }
.forms-result__pid { margin-left: auto; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.forms-summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 12px; }
.forms-summary__head { margin-bottom: 6px; }
.forms-summary__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid var(--border); }
.forms-summary__row:first-of-type { border-top: 0; }
.forms-summary__rec { font-size: 13px; font-variant-numeric: tabular-nums; }
.forms-summary__row--empty { color: var(--text-muted); justify-content: flex-start; }
.forms-summary__rest .forms-summary__row:first-of-type { border-top: 1px solid var(--border); }
.forms-summary__more { display: inline-flex; align-items: center; font: inherit; font-size: 12px; font-weight: 600; color: var(--accent-water); background: none; border: 0; padding: 6px 0 2px; cursor: pointer; }
.forms-summary__more:hover { text-decoration: underline; }
.forms-ids { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.forms-id { display: flex; flex-direction: column; gap: 3px; }
.forms-id__k { font-size: 11px; color: var(--text-muted); font-family: var(--font-body); }
.forms-id input { width: 100%; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.forms-ids__note { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.launch-cat { margin: 0 0 18px; }
.launch-cat__title { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 9px; }
.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.launch-card { display: flex; flex-direction: column; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 13px 15px; }
.launch-card__head { display: flex; align-items: flex-start; gap: 8px; }
.launch-card__name { font-weight: 600; font-size: 14px; flex: 1; }
.launch-card__host { font-size: 11px; color: var(--text-muted); background: var(--bg-panel); border-radius: var(--radius-sm); padding: 2px 7px; white-space: nowrap; }
.launch-card__desc { font-size: 12px; color: var(--text-muted); margin: 0; }
.launch-card__params { display: flex; flex-wrap: wrap; gap: 5px; }
.launch-card__param { font-size: 11px; color: var(--text-muted); background: var(--bg-panel); border-radius: var(--radius-sm); padding: 2px 7px; font-variant-numeric: tabular-nums; }
.launch-card__foot { margin-top: auto; display: flex; align-items: center; gap: 9px; }
.launch-card__go { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: 13px; text-decoration: none; border: 0; border-radius: var(--radius-sm); padding: 8px 13px; background: var(--navy); color: var(--text-onaccent); cursor: pointer; }
.launch-card__go[disabled] { background: var(--bg-panel); color: var(--text-muted); cursor: not-allowed; }
.launch-card__hint { font-size: 11px; color: var(--text-muted); }

/* ── in-page confirmation (window.R3Confirm) — replaces native confirm() ───── */
/* A deliberate decision gate (not an error/loading state), so a modal is the
   intended exception to the inline-only rule. */
.r3-confirm__backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 23, 42, 0.55);
}
.r3-confirm__backdrop[hidden] { display: none; }
.r3-confirm {
  width: 100%; max-width: 420px; padding: 20px 22px;
  background: var(--bg-card, #fff); color: var(--text-primary, #0f172a);
  border-radius: var(--radius-md, 10px);
  box-shadow: var(--shadow-lift, 0 12px 32px rgba(0, 0, 0, 0.24));
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
}
.r3-confirm__title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
.r3-confirm__body { margin: 0 0 18px; color: var(--text-muted, #475569); line-height: 1.45; white-space: pre-line; }
.r3-confirm__actions { display: flex; justify-content: flex-end; gap: 10px; }
.r3-confirm--danger .cta-button { background: var(--accent-danger, #b91c1c); border-color: var(--accent-danger, #b91c1c); }

/* ── Activity tab roll-up report (activity-app.js) ───────────────────────────── */
.activity { display: flex; flex-direction: column; gap: 20px; }
.activity__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.activity__title { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--navy); margin: 0; }
.activity__sub { margin: 4px 0 0; font-size: 0.8rem; color: var(--text-muted); }
.activity__windows { display: inline-flex; gap: 4px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; }
.activity__win { border: 0; background: transparent; color: var(--text-muted); font-size: 0.78rem; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill); cursor: pointer; }
.activity__win--active { background: var(--navy); color: var(--text-onaccent); }
.activity__hint { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.activity__hint strong, .activity__notice strong { color: var(--text-primary); }
.activity__notice { margin: 0; }
.activity__kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi-card--good .kpi-card__value { color: var(--accent-rain); }
.activity__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.activity__panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; }
.activity__h3 { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); margin: 0 0 14px; text-transform: uppercase; letter-spacing: 0.03em; }
.activity__section { display: flex; flex-direction: column; }
.activity__bar { margin-bottom: 12px; }
.activity__bar:last-child { margin-bottom: 0; }
.activity__bar-head { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 5px; }
.activity__bar-n { font-weight: 700; color: var(--text-primary); }
.activity__bar-track { height: 8px; background: var(--bg-panel); border-radius: var(--radius-pill); overflow: hidden; }
.activity__bar-fill { height: 100%; background: var(--accent-water); border-radius: var(--radius-pill); }
.activity__bar-fill--navy { background: var(--navy); }
.activity__spark { display: flex; align-items: flex-end; gap: 3px; height: 92px; }
.activity__spark-col { flex: 1; min-width: 3px; background: var(--accent-water); border-radius: 3px 3px 0 0; }
.activity__spark-axis { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; }
.activity__panel--email { display: flex; flex-direction: column; }
.activity__email-n { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; color: var(--navy); line-height: 1.1; }
.activity__email-lbl { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.activity__email-note { font-size: 0.74rem; color: var(--accent-warm); margin: auto 0 0; line-height: 1.4; }
.activity__empty { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.activity__time { white-space: nowrap; color: var(--text-muted); font-size: 0.78rem; }
.activity__ref { color: var(--text-muted); font-size: 0.82rem; }
.activity__feed td { vertical-align: middle; }

/* prefers-reduced-motion stays LAST (locked convention): the universal !important
   zeroing must override every transition/animation declared above, incl. the shell. */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0.01ms; --dur-base: 0.01ms; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
