/*
  Setu citizen frontend — main stylesheet (Phase 2 rebuild).

  GOVERNING REFERENCE: refrences/dashboard.png — a LIGHT SaaS dashboard.
  Light cool-grey canvas, crisp white cards on hairline borders, whisper
  shadows (separation is border-first), a single solid near-black primary
  action button, one restrained blue accent, a modern grotesque sans.

  Everything routes through tokens.css — no raw hex/rgba in here except a
  couple of justified alpha one-offs (pure-black scrims/overlays that have
  no semantic token). button1.txt/button2.txt informed button SHAPE,
  WEIGHT and HIERARCHY only — NOT their liquid/gradient-blur effects. No
  gradients, no glass, no dark surfaces anywhere in the shell.

  This is a pure re-skin: every selector matches markup the view modules
  already emit. No class was added or renamed.

  NOTE: the .auth-* rules at the bottom are intentionally left as a clean
  light placeholder — the auth screen's real redesign (particle backdrop +
  split panel) is Phase 3. They're kept coherent, not final.
*/

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
}
h1, h2, h3, .serif { font-family: var(--font-display); letter-spacing: var(--tracking-tight); }
.brand .word, .stat .n, .cred-title { font-family: var(--font-display); }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; }
::selection { background: var(--accent-soft); }

/* ============================================================
   KINETIC FABRIC BACKGROUND — fixed, behind everything.
   Ported from refrences/background.txt. The canvas paints the --paper
   fill itself, so it becomes the app's living backdrop. pointer-events
   are off so it never blocks the UI (it reads the global mouse position).
   ============================================================ */
#fabricBg {
  position: fixed;
  inset: 0;
  z-index: var(--z-background); /* -1: below the app shell */
  pointer-events: none;
}
#fabricBg canvas { display: block; width: 100%; height: 100%; }
/* App chrome/content must sit above the backdrop and stay readable. The
   topbar keeps its own translucent blur; the shell is transparent so the
   fabric shows through the gutters around the content. */
main.shell, #modalHost, #toast { position: relative; z-index: var(--z-base); }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ============================================================
   BUTTONS
   Primary: solid near-black (dashboard.png "Top Up"/"Contact team").
   Ghost:   white with a hairline border (dashboard.png "Documentation").
   Sage:    success-green, the verified/reuse affordance.
   Shape/weight/hierarchy from button1/2.txt; NO liquid/gradient.
   ============================================================ */
.btn {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  border: 1px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
}
/* apple-design §1: tactile press feedback, instant. The press must land
   faster than the hover settle, so it reads as a direct physical response
   rather than a lazy tween — scope just the transform to --dur-instant. */
.btn:active { transform: scale(0.97); transition: transform var(--dur-instant) var(--ease); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ============================================================
   FOCUS — accessibility sweep (Phase 5). Every natively-focusable
   interactive element gets one consistent, visible ring routed through
   --shadow-focus. Text-style buttons use a rounded ring so it reads.
   (Clickable non-button rows/cards — .app-top-click, tr.row-click — are
   divs/trs with JS handlers and are NOT natively focusable; making them
   keyboard-reachable needs tabindex/role in the view markup, which is out
   of Phase-5's JS scope — flagged in the report, not silently changed.)
   ============================================================ */
nav.tabs button:focus-visible,
.section-head .link:focus-visible,
.logout-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-xs);
}

/* Click-only rows/cards made keyboard-reachable (Phase 6): role="button"
   tabindex="0" in the view markup + this visible focus ring + an
   Enter/Space keydown path in the view JS. */
.app-top-click:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}
tr.row-click:focus-visible {
  outline: none;
  /* box-shadow on a <tr> is unreliable across browsers; use a clear
     inset outline that renders consistently on table rows. */
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: var(--shadow-sm); }
.btn-primary:disabled { background: var(--primary-disabled); color: var(--on-primary); opacity: 1; }

/* Ghost = white with a hairline border (clean secondary action). */
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--ink-muted); }

.btn-sage { background: var(--success); color: var(--on-color); }
.btn-sage:hover:not(:disabled) { background: var(--success); filter: brightness(0.94); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: var(--text-sm); }

/* ============================================================
   FORM FIELDS
   ============================================================ */
.field { margin-bottom: var(--space-4); }
.field label {
  display: block; font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--ink-soft); margin-bottom: var(--space-2);
}
.field input {
  width: 100%; border: 1px solid var(--line-strong); background: var(--card);
  padding: 11px 14px; border-radius: var(--radius-sm); outline: none;
  font-size: var(--text-sm); color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.field input::placeholder { color: var(--ink-muted); }
.field input:focus { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.field-error { color: var(--danger); font-size: var(--text-xs); margin-top: 5px; }
.field-hint { color: var(--ink-soft); font-size: var(--text-xs); margin-top: 5px; }

/* ============================================================
   APP SHELL / TOPBAR — dashboard.png: white bar, hairline base,
   breadcrumb-style brand left, citizen + action right.
   ============================================================ */
/* apple-design §12: translucent chrome, content scrolls under, hairline
   base instead of a hard divider. */
/* ============================================================
   APP SHELL — left sidebar + main content (reference dashboard layout).
   ============================================================ */
.app-layout { display: grid; grid-template-columns: var(--sidebar-w, 248px) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--dur-med) var(--ease); }

.sidebar {
  display: flex; flex-direction: column;
  background: rgba(244, 241, 232, 0.78);
  backdrop-filter: blur(16px) saturate(180%); -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-right: 1px solid var(--line);
  padding: var(--space-6) var(--space-4);
  position: sticky; top: 0; height: 100vh; z-index: var(--z-sticky);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 0 var(--space-2) var(--space-2); margin-bottom: var(--space-6); }
.sidebar-toggle { flex: none; background: none; border: 0; color: var(--ink-muted); display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.sidebar-toggle svg { width: 18px; height: 18px; }
.sidebar-toggle:hover { background: var(--surface-sunken); color: var(--ink); }
.sidebar-toggle:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* --- collapsed sidebar: icon-only rail --- */
.app-layout.sidebar-collapsed { --sidebar-w: 76px; }
.sidebar-collapsed .brand .word,
.sidebar-collapsed .side-label,
.sidebar-collapsed .who .role,
.sidebar-collapsed .logout-btn { display: none; }
.sidebar-collapsed .sidebar-brand { flex-direction: column; gap: var(--space-3); }
.sidebar-collapsed .side-nav button { justify-content: center; padding: 10px 0; }
.sidebar-collapsed .who { justify-content: center; }

.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand .mark svg { width: 100%; height: 100%; }
.brand .word { font-family: var(--font-display); font-weight: var(--weight-bold); font-size: var(--text-lg); letter-spacing: var(--tracking-tight); }
.brand .word span { color: var(--accent); }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav button {
  display: flex; align-items: center; gap: var(--space-3);
  border: 0; background: transparent; width: 100%; text-align: left;
  padding: 10px var(--space-3); border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-soft);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.side-nav button .side-ico { display: grid; place-items: center; color: var(--ink-muted); transition: color var(--dur-fast) var(--ease); }
.side-nav button .side-ico svg { width: 19px; height: 19px; display: block; }
.side-nav button:hover:not(.active) { background: var(--surface-sunken); color: var(--ink); }
.side-nav button.active { background: var(--card); color: var(--ink); font-weight: var(--weight-semibold); box-shadow: var(--shadow-xs); }
.side-nav button.active .side-ico { color: var(--accent); }
.side-nav button:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: var(--space-4); margin-top: var(--space-4); }
/* Group the avatar + name + logout into one visibly-bounded "account" card
   so they read as a single unit, not loose icons floating at the edge
   (usability audit #4). The role="group"/aria-label on .who names it for
   assistive tech; this gives the same grouping visually. */
.who { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
.who .role { flex: 1; min-width: 0; font-size: var(--text-xs); color: var(--ink-muted); line-height: 1.3; }
.who .role b { display: block; color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-color);
  display: grid; place-items: center; font-weight: var(--weight-bold); font-size: var(--text-sm);
  font-family: var(--font-display);
}
.logout-btn { flex: none; background: none; border: 0; color: var(--ink-muted); display: grid; place-items: center; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.logout-btn svg { width: 18px; height: 18px; }
.logout-btn:hover { color: var(--danger); background: var(--surface-sunken); }
.logout-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

main.shell { padding: var(--space-8) var(--space-10) 90px; max-width: 1180px; width: 100%; min-width: 0; overflow-x: hidden; }

/* clean pill search field on the services page */
input.field {
  border: 1px solid var(--line-strong); background: var(--card);
  padding: 11px 16px; border-radius: var(--radius-pill); outline: none;
  font-size: var(--text-sm); color: var(--ink); width: 100%;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input.field::placeholder { color: var(--ink-muted); }
input.field:focus { border-color: var(--accent); box-shadow: var(--shadow-focus); }

.view { display: none; }
.view.active { display: block; }

/* Tablet/mobile: sidebar collapses to a top bar with a horizontal nav. */
@media (max-width: 860px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; gap: var(--space-4); padding: 10px var(--space-5); border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { margin: 0; padding: 0; }
  .side-nav { flex-direction: row; flex: 1; gap: 2px; overflow-x: auto; }
  .side-nav button { padding: 8px 12px; white-space: nowrap; }
  .side-nav button .side-label { display: none; }
  .side-nav button.active { box-shadow: none; background: var(--surface-sunken); }
  .sidebar-foot { border-top: 0; margin: 0; padding: 0; }
  .who .role { display: none; }
  main.shell { padding: var(--space-6) var(--space-5) 70px; }
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-5); gap: var(--space-3); flex-wrap: wrap; }
.section-head h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin: 0; }
/* Text-link action (e.g. "Manage", "View all"). Shares one definition with
   the auth switch link (.auth-link) so the interface keeps a SINGLE
   text-button style rather than several near-duplicate one-offs — this is
   the "too many button styles" consolidation (usability audit #1). */
.section-head .link { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--accent); background: none; border: 0; padding: 0; text-underline-offset: 2px; }
.section-head .link:hover { text-decoration: underline; }
.section-head .link:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }
.section-note { color: var(--ink-soft); margin: 0 0 var(--space-6); max-width: 62ch; font-size: var(--text-sm); }

/* ============================================================
   DASHBOARD HERO
   ============================================================ */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--space-12); align-items: center;
  padding-bottom: var(--space-8); margin-bottom: var(--space-8); border-bottom: 1px solid var(--line);
}
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: var(--space-6); } }
.hero .kicker { color: var(--accent); font-weight: var(--weight-semibold); font-size: var(--text-sm); margin-bottom: var(--space-3); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.hero h1 { font-size: var(--text-3xl); line-height: var(--leading-3xl); margin: 0 0 var(--space-4); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tighter); max-width: 11em; }
.hero p { color: var(--ink-soft); font-size: var(--text-md); line-height: var(--leading-base); max-width: 44ch; margin: 0 0 var(--space-5); }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.netmap svg { width: 100%; height: auto; display: block; }

/* ============================================================
   STAT ROW — dashboard.png inner boxes: white, hairline, tight radius.
   ============================================================ */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); }
@media (max-width: 700px) { .stat-row { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-5); box-shadow: var(--shadow-xs); transition: box-shadow var(--dur-med) var(--ease), transform var(--dur-med) var(--ease); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat .n { font-family: var(--font-sans); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--ink); letter-spacing: var(--tracking-tight); }
.stat .l { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; }

/* ============================================================
   DASHBOARD (reference layout): greeting header, step strip, status
   card, activity history.
   ============================================================ */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-6); }
.dash-greeting { font-size: var(--text-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); margin: 0; color: var(--ink); }
.dash-sub { color: var(--ink-soft); font-size: var(--text-sm); margin: 4px 0 0; }
.dash-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* step strip — 3 numbered stages joined in one bordered bar */
.step-strip { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); overflow: hidden; margin-bottom: var(--space-6); }
@media (max-width: 760px) { .step-strip { grid-template-columns: 1fr; } }
.step { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-5); border-right: 1px solid var(--line); }
.step:last-child { border-right: 0; }
@media (max-width: 760px) { .step { border-right: 0; border-bottom: 1px solid var(--line); } .step:last-child { border-bottom: 0; } }
.step[role="button"] { cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.step[role="button"]:hover { background: var(--surface-sunken); }
.step[role="button"]:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
/* Trailing chevron on clickable steps — a resting signifier that the step
   is interactive, present before hover (usability audit #5). It nudges
   right and darkens on hover/focus for extra feedback. */
.step-go { margin-left: auto; flex: none; display: grid; place-items: center; color: var(--ink-muted); transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.step-go svg { width: 16px; height: 16px; display: block; }
.step[role="button"]:hover .step-go,
.step[role="button"]:focus-visible .step-go { color: var(--accent); transform: translateX(2px); }
.step-badge { width: 30px; height: 30px; flex: none; border-radius: var(--radius-pill); display: grid; place-items: center; font-size: var(--text-sm); font-weight: var(--weight-bold); }
.step-badge.done { background: var(--success); color: var(--on-color); }
.step-badge.done svg { width: 16px; height: 16px; }
.step-badge.active { background: var(--accent-soft); color: var(--accent); border: 1.5px solid var(--accent); }
.step-badge.todo { background: var(--surface-sunken); color: var(--ink-muted); border: 1.5px solid var(--line-strong); }
.step-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.step.active .step-title { color: var(--accent); }
.step-desc { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; }

/* dash grid: credential cards (left, wide) + status card (right) */
/* Single-column stack: the credential grid sits in its own row, and the
   status ("Getting started") card sits in its OWN full-width row below it,
   both in normal document flow. Previously this was a `minmax(0,1fr) 300px`
   two-column grid — but between ~980px and ~1120px the rigid inner
   `.cred-grid` (repeat(3,1fr)) couldn't shrink to fit the narrowed 1fr
   column and overflowed into the fixed 300px status-card cell, so the
   status card's text appeared clipped behind the Driving Licence card.
   Stacking removes the side-by-side entirely, so nothing can overflow into
   the status card. The `.cred-grid` internals are unchanged. */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; margin-bottom: var(--space-6); }
.dash-cred { min-width: 0; }
/* The status ("Getting started") card holds only a badge + two short lines,
   so stretched full-width it leaves a large dead horizontal band that pushes
   "Connected departments" down (usability audit #3). Cap it to a compact
   card and left-align it in its row. We deliberately do NOT revert to a
   side-by-side grid column — that reintroduced the cred-grid overflow noted
   above; constraining width in single-column flow fixes the density without
   that risk. */
#statusCard { max-width: 420px; }
.dash-cred .cred-grid { margin-bottom: 0; }
@media (max-width: 560px) { .dash-cred .cred-grid { grid-template-columns: 1fr; } }

/* status ("live") card */
.status-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); overflow: hidden; }
.status-preview { background: var(--surface-sunken); border-bottom: 1px solid var(--line); padding: var(--space-5); }
.status-preview svg { width: 100%; height: auto; display: block; max-height: 150px; }

/* small network motif parked at the foot of the dashboard — decorative,
   deliberately compact (a little triangle), centered, clearly separated
   from the content above it. */
.netmap-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
}
.netmap-footer-art { width: 100%; max-width: 220px; }
.netmap-footer-art svg { width: 100%; height: auto; display: block; opacity: 0.85; }
.netmap-footer-cap { font-size: var(--text-xs); color: var(--ink-muted); text-align: center; }
.status-body { padding: var(--space-5); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 3px 10px; border-radius: var(--radius-pill); margin-bottom: var(--space-3); }
.status-badge.live { background: var(--success-soft); color: var(--success); }
.status-badge.idle { background: var(--surface-sunken); color: var(--ink-muted); }
.status-badge .cdot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: currentColor; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ink); margin-top: var(--space-2); }
.status-line b { font-weight: var(--weight-bold); }
.status-line-sub { color: var(--ink-soft); }
.status-ico { display: grid; place-items: center; color: var(--ink-muted); }
.status-ico svg { width: 16px; height: 16px; }
.status-meta { font-size: var(--text-xs); color: var(--ink-muted); margin: 2px 0 0 24px; }

/* activity history rows */
.dash-activity .section-head { margin-bottom: var(--space-4); }
.act-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-2); border-radius: var(--radius-sm); border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.act-row:last-child { border-bottom: 0; }
.act-row:hover { background: var(--surface-sunken); }
.act-row:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.act-main { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.act-glyph { width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--dept-accent-soft, var(--accent-soft)); color: var(--dept-accent, var(--accent)); }
.act-glyph svg { width: 18px; height: 18px; }
.act-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.act-meta { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; }
.act-when { font-size: var(--text-xs); color: var(--ink-muted); white-space: nowrap; }
@media (max-width: 620px) { .act-when { display: none; } }

/* connected departments (the mock services Setu integrates) */
.dash-connected { margin-bottom: var(--space-6); }
.conn-list { display: flex; flex-direction: column; gap: var(--space-2); }
.conn-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
.conn-glyph { width: 38px; height: 38px; flex: none; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--dept-accent-soft, var(--accent-soft)); color: var(--dept-accent, var(--accent)); }
.conn-glyph svg { width: 20px; height: 20px; }
.conn-body { min-width: 0; }
.conn-name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.conn-meta { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-chip { justify-self: end; }
.conn-btn { flex: none; white-space: nowrap; }
@media (max-width: 620px) {
  .conn-row { grid-template-columns: auto 1fr auto; }
  .conn-chip { display: none; }
}

/* ============================================================
   LAYOUT GRID + PANELS / SIDE CARDS
   ============================================================ */
.layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-5); align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); }
.panel-pad { padding: var(--space-6); }
.stack { display: flex; flex-direction: column; gap: var(--space-5); }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-5) var(--space-6); box-shadow: var(--shadow-xs); }
.side-card h3 { font-size: var(--text-sm); margin: 0 0 var(--space-4); font-weight: var(--weight-bold); }
.empty-note { color: var(--ink-muted); font-size: var(--text-sm); padding: var(--space-2) 0; }

/* ============================================================
   DATA-FETCH ERROR BANNER
   Shown only when a view's data fetch actually FAILS (network error,
   non-2xx, timeout) — never for a legitimately empty/new account. Same
   danger-soft/danger palette as .auth-form-error so the error language is
   consistent across the app; carries an inline retry that re-runs the
   fetch without a full page reload. Tokens only, no ad hoc colours.
   ============================================================ */
.data-error-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}
.data-error-banner .deb-ico { flex: none; width: 18px; height: 18px; }
.data-error-banner .deb-ico svg { width: 100%; height: 100%; display: block; }
.data-error-banner .deb-text { flex: 1 1 auto; line-height: var(--leading-sm); }
.data-error-banner .deb-retry { flex: none; }

/* ============================================================
   APPLICATION ITEMS + RELAY TRACK (dashboard mini-track)
   ============================================================ */
.app-item { padding: var(--space-5) 0; border-bottom: 1px solid var(--line); }
.app-item:first-child { padding-top: 0; }
.app-item:last-child { border-bottom: 0; padding-bottom: 0; }
.app-top { display: flex; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.app-top-click { cursor: pointer; }
.app-name { font-weight: var(--weight-semibold); font-size: var(--text-md); }
.app-meta { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 3px; }

/* status chips — readable fills on the light canvas, semantic colour + soft tint */
.chip { font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; height: fit-content; }
.chip-progress { background: var(--info-soft); color: var(--info); }
.chip-done { background: var(--success-soft); color: var(--success); }
.chip-wait { background: var(--surface-sunken); color: var(--ink-soft); }
.chip-failed { background: var(--danger-soft); color: var(--danger); }

.track { display: flex; align-items: center; gap: 0; }
.tnode { display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative; }
.tdot { width: 11px; height: 11px; border-radius: var(--radius-pill); background: var(--surface-sunken); border: 2px solid var(--line-strong); z-index: 1; transition: background var(--dur-med) var(--ease), border-color var(--dur-med) var(--ease); }
.tdot.done { background: var(--success); border-color: var(--success); }
.tdot.now { background: var(--accent); border-color: var(--accent); box-shadow: var(--shadow-focus); }
.tdot.failed { background: var(--danger); border-color: var(--danger); }
.tlabel { font-size: 10.5px; color: var(--ink-muted); white-space: nowrap; }
.tline { flex: 1; height: 2px; background: var(--line-strong); margin-bottom: 19px; transition: background var(--dur-med) var(--ease); }
.tline.done { background: var(--success); }
.tline.failed { background: var(--danger); }

/* ============================================================
   DOCUMENTS
   ============================================================ */
.doc-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-bottom: 1px dashed var(--line); }
.doc-row:last-child { border-bottom: 0; padding-bottom: 0; }
.doc-row:first-child { padding-top: 0; }
.doc-name { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.doc-src { font-size: var(--text-xs); color: var(--ink-muted); }
.dot-ok { width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--success); display: inline-block; margin-right: 6px; }
.dot-pending { width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--line-strong); display: inline-block; margin-right: 6px; }

/* ============================================================
   CREDENTIAL CARDS — colourful dashboard components (PAN / Licence /
   Identity). Each department gets its own gradient theme + 3D-ish glyph,
   inspired by the SaaS service-grid reference. Data-driven: colour + copy
   come from the citizen's real linked_references, not hardcoded stats.
   ============================================================ */
.cred-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); margin-bottom: var(--space-6); }
@media (max-width: 900px) { .cred-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .cred-grid { grid-template-columns: 1fr; } }

/* Clean white credential cards. Department identity comes from a single
   coloured left rail + a soft-tinted glyph — colour carries MEANING, not
   decoration (design-taste §4.2 one-accent + colour-for-meaning). No
   gradients, no bloom, no white-on-colour contrast risk. */
.cred-card {
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--dept-accent, var(--accent));
  border-radius: var(--radius-md);
  padding: var(--space-6);
  background: var(--card);
  color: var(--ink);
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-med) var(--ease), box-shadow var(--dur-med) var(--ease);
}
.cred-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* per-department accent (solid) — drives glyph tiles, rails and top bars
   across cred / service / doc cards. Government-appropriate, desaturated. */
.theme-tax      { --dept-accent: #4A6B32; --dept-accent-soft: #E2EAD6; } /* olive green */
.theme-identity { --dept-accent: #8A7847; --dept-accent-soft: #EDE6D2; } /* gold */
.theme-licence  { --dept-accent: #9A6B2F; --dept-accent-soft: #F0E6CF; } /* amber-brown */

/* ============================================================
   DEPARTMENT 3D ART — big glossy per-service illustration, à la
   dashboard.png (each service card carries a large colourful 3D glyph).
   Implemented with emoji so it's full-colour, offline-safe and needs no
   image assets. A soft tinted tile + drop shadow gives the "object
   resting on the card" depth the reference has. Decorative only.
   ============================================================ */
.dept-art {
  display: inline-grid; place-items: center; flex: none; line-height: 1;
  border-radius: var(--radius-md);
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,0.9), transparent 60%),
    var(--dept-accent-soft, var(--accent-soft));
  filter: drop-shadow(0 6px 10px rgba(17, 19, 23, 0.14));
  -webkit-user-select: none; user-select: none;
}
/* size scale */
.dept-art-sm { width: 48px; height: 48px; font-size: 26px; }
.dept-art-md { width: 64px; height: 64px; font-size: 36px; }
.dept-art-lg { width: 84px; height: 84px; font-size: 48px; }
/* a gentle idle float so the art reads as a 3D object, not a sticker.
   Cut entirely for reduced-motion. */
@keyframes dept-art-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: no-preference) {
  .dept-art { animation: dept-art-float 4.5s ease-in-out infinite; }
  .service:hover .dept-art, .cred-card:hover .dept-art, .doc-card:hover .dept-art { animation-duration: 2.4s; }
}

.cred-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.cred-glyph {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--dept-accent-soft, var(--accent-soft));
  color: var(--dept-accent, var(--accent));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cred-glyph svg { width: 24px; height: 24px; display: block; }
.cred-status {
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--success-soft); color: var(--success);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.cred-status .cdot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: currentColor; display: inline-block; }
.cred-status.pending { background: var(--surface-sunken); color: var(--ink-muted); }

.cred-body { }
.cred-kind { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--dept-accent, var(--accent)); }
.cred-title { font-size: var(--text-md); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); margin: 2px 0 0; color: var(--ink); }
.cred-ref { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink-soft); margin-top: var(--space-2); word-break: break-all; }
.cred-ref.empty { color: var(--ink-muted); font-style: italic; font-family: var(--font-sans); }
.cred-foot { font-size: var(--text-xs); color: var(--ink-muted); margin-top: var(--space-3); }
/* Plain caption footer ("Verified 2h ago") — unchanged look. */
.cred-foot-note { color: var(--ink-muted); }
/* Actionable footer ("Link this record…") — a real text link with clear
   affordance: accent colour, an arrow glyph, underline + nudge on hover
   (usability audit #2). Uses the department accent so it reads as this
   card's action, consistent with the coloured left rail. */
.cred-foot-link {
  display: inline-flex; align-items: center; gap: var(--space-1);
  background: none; border: 0; padding: 0;
  font: inherit; font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--dept-accent, var(--accent)); cursor: pointer;
  text-underline-offset: 2px;
}
.cred-foot-link svg { width: 13px; height: 13px; transition: transform var(--dur-fast) var(--ease); }
.cred-foot-link:hover { text-decoration: underline; }
.cred-foot-link:hover svg { transform: translateX(2px); }
.cred-foot-link:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }

.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 900px) { .doc-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .doc-grid { grid-template-columns: 1fr; } }
.doc-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); background: var(--card); box-shadow: var(--shadow-xs); transition: box-shadow var(--dur-med) var(--ease), transform var(--dur-med) var(--ease); }
.doc-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--dept-accent, var(--accent)); }
.doc-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.doc-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.doc-glyph { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--dept-accent-soft, var(--accent-soft)); color: var(--dept-accent, var(--accent)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-glyph svg { width: 22px; height: 22px; display: block; }
.doc-ref { font-family: var(--font-mono); color: var(--ink); }
.doc-card .status { font-size: var(--text-xs); font-weight: var(--weight-semibold); padding: 3px 10px; border-radius: var(--radius-pill); display: inline-block; }
.status-ok { background: var(--success-soft); color: var(--success); }
.status-warn { background: var(--warning-soft); color: var(--warning); }
.doc-card h3 { margin: 0 0 4px; font-size: var(--text-md); }
.doc-card p { margin: 0 0 var(--space-4); font-size: var(--text-sm); color: var(--ink-soft); word-break: break-word; }

/* ============================================================
   SERVICES GRID
   ============================================================ */
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); margin-top: var(--space-1); }
@media (max-width: 900px) { .service-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .service-grid { grid-template-columns: 1fr; } }
.service { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); background: var(--card); display: flex; flex-direction: column; box-shadow: var(--shadow-xs); transition: box-shadow var(--dur-med) var(--ease), transform var(--dur-med) var(--ease); }
/* coloured top accent bar keyed to the department theme (kept for meaning) */
.service::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--dept-accent, var(--accent)); }
.service:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.service-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.service-glyph { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--dept-accent-soft, var(--accent-soft)); color: var(--dept-accent, var(--accent)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.service-glyph svg { width: 22px; height: 22px; display: block; }
.service .src { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--dept-accent, var(--accent)); display: block; letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.service h3 { font-size: var(--text-md); margin: 0 0 var(--space-2); font-weight: var(--weight-semibold); }
.service p { font-size: var(--text-sm); color: var(--ink-soft); margin: 0 0 var(--space-4); flex: 1; }
.service .reuse-badge { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--success); margin-bottom: var(--space-3); }

/* ============================================================
   APPLICATIONS TABLE
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: left; padding: var(--space-3) 6px; border-bottom: 1px solid var(--line); }
th { font-size: var(--text-xs); color: var(--ink-muted); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
td b { font-weight: var(--weight-semibold); }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: var(--surface-sunken); }

/* department tag — a small coloured, glyphed pill used in the apps table
   so each department reads at a glance with its theme colour */
.dept-tag { display: inline-flex; align-items: center; gap: 7px; font-weight: var(--weight-medium); }
.dept-tag-glyph { width: 24px; height: 24px; border-radius: var(--radius-xs); background: var(--dept-accent-soft, var(--accent-soft)); color: var(--dept-accent, var(--accent)); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dept-tag-glyph svg { width: 13px; height: 13px; display: block; }

/* ============================================================
   APPLICATION DETAIL — call history
   ============================================================ */
.detail-back { margin-bottom: var(--space-5); }
.call-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-4); align-items: start;
  padding: var(--space-4) 0; border-bottom: 1px dashed var(--line);
}
.call-row:last-child { border-bottom: 0; padding-bottom: 0; }
.call-dot { width: 9px; height: 9px; border-radius: var(--radius-pill); margin-top: 5px; }
.call-dot.ok { background: var(--success); }
.call-dot.fail { background: var(--danger); }
.call-endpoint { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); word-break: break-all; }
.call-summary { font-size: var(--text-sm); color: var(--ink-soft); margin-top: 4px; word-break: break-word; }
.call-meta { font-size: var(--text-xs); color: var(--ink-muted); text-align: right; white-space: nowrap; }
.reuse-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--success); background: var(--success-soft); padding: 2px 8px; border-radius: var(--radius-pill); margin-top: 6px;
}

/* ============================================================
   CONSENT MODAL — light surface, soft scrim.
   ============================================================ */
.modal-veil {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: var(--z-modal); display: none; align-items: center; justify-content: center; padding: var(--space-5);
}
.modal-veil.open { display: flex; }
.modal { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); max-width: 460px; width: 100%; padding: var(--space-8); box-shadow: var(--shadow-modal); }
.modal .kicker { color: var(--accent); font-weight: var(--weight-semibold); font-size: var(--text-xs); margin-bottom: var(--space-2); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.modal h3 { margin: 0 0 var(--space-2); font-size: var(--text-lg); }
.modal .desc { color: var(--ink-soft); font-size: var(--text-sm); margin: 0 0 var(--space-5); }
.consent-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-bottom: 1px dashed var(--line); font-size: var(--text-sm); color: var(--ink-soft); }
.consent-row:last-of-type { border-bottom: 0; }
.consent-row .fld { font-weight: var(--weight-semibold); color: var(--ink); }
.consent-row .from { color: var(--ink-muted); font-size: var(--text-xs); }
.modal-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); }
.modal-actions .btn { flex: 1; }
.reference-field { margin-top: var(--space-1); }

/* ============================================================
   RELAY CENTERPIECE — light chrome (motion/timing stays in relay.js).
   ============================================================ */
.relay-veil {
  position: fixed; inset: 0; background: var(--overlay);
  z-index: var(--z-relay); display: none; align-items: center; justify-content: center; padding: var(--space-5);
}
.relay-veil.open { display: flex; }
.relay-card {
  background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); max-width: 520px; width: 100%;
  padding: var(--space-10) var(--space-8); box-shadow: var(--shadow-modal); text-align: center;
}
.relay-card .relay-kicker { color: var(--ink-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); margin-bottom: var(--space-2); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.relay-card h3 { margin: 0 0 var(--space-8); font-size: var(--text-xl); }
.relay-track { display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-8); }
.relay-result { text-align: left; }
.relay-result .headline { font-size: var(--text-md); font-weight: var(--weight-bold); margin-bottom: var(--space-2); }
.relay-result .headline.ok { color: var(--success); }
.relay-result .headline.fail { color: var(--danger); }
.relay-result .message { font-size: var(--text-sm); color: var(--ink-soft); margin-bottom: var(--space-4); }
.relay-summary-box {
  background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4); font-size: var(--text-xs); font-family: var(--font-mono);
  color: var(--ink); word-break: break-word; margin-bottom: var(--space-4);
}
.relay-actions { display: flex; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-2); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: var(--space-8); transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: var(--on-color); padding: var(--space-3) var(--space-5); border-radius: var(--radius-sm);
  font-size: var(--text-sm); transition: transform var(--dur-med) var(--ease); z-index: var(--z-toast); max-width: 90vw;
  box-shadow: var(--shadow-modal);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ============================================================
   LOADING — spinner. Dark variant reads on the light canvas.
   ============================================================ */
.spinner {
  width: 16px; height: 16px; border-radius: var(--radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.4); /* on-primary spinner (inside near-black buttons) */
  border-top-color: #fff; animation: spin 0.7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: var(--line-strong); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-note { color: var(--ink-muted); font-size: var(--text-sm); padding: var(--space-5) 0; display: flex; align-items: center; gap: var(--space-2); }

/* ============================================================
   AUTH SCREEN — two-column split (refrences/signup.txt): the form on one
   column, a large branded gradient/mesh panel on the other. One rounded
   card holds both; a plain text link swaps sign-in / sign-up (no OAuth —
   the gateway has none). Trust-first token palette; the kinetic-fabric
   backdrop shows through behind the card.
   ============================================================ */
.auth-screen {
  position: relative; min-height: 100vh; width: 100%;
  display: flex; justify-content: center; align-items: center;
  padding: var(--space-6);
  background: transparent; /* kinetic-fabric backdrop shows through */
}

/* The card: two columns on desktop — a friendly illustration half on the
   left and the form half on the right, matching the reference sign-up. On a
   clean white card so the line-art and the form read crisply. */
.auth-grid {
  position: relative; width: 100%; max-width: 940px;
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 600px;
  background: #FFFFFF; border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-modal);
  overflow: hidden;
}

/* --- illustration column (reference's hand-drawn faces half) --- */
.auth-art-col {
  position: relative; display: flex; flex-direction: column;
  padding: var(--space-10) var(--space-8);
  background: #FFFFFF;
}
.auth-brand { justify-content: flex-start; }
.auth-art {
  flex: 1; display: grid; place-items: center;
  color: var(--ink); /* line-art inherits olive ink */
}
.auth-art-svg { width: 78%; max-width: 320px; height: auto; }
.auth-art-spark { fill: var(--gold); stroke: var(--gold); }

/* --- form column --- */
.auth-form-col { display: flex; align-items: center; justify-content: center; padding: var(--space-12) var(--space-10); }
.auth-form-inner { width: 100%; max-width: 380px; }

.auth-form { display: flex; flex-direction: column; }
.auth-form.hidden { display: none; }

.auth-title { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--ink); margin: 0 0 var(--space-2); letter-spacing: var(--tracking-tight); }
.auth-sub { color: var(--ink-soft); font-size: var(--text-sm); line-height: var(--leading-sm); margin: 0 0 var(--space-8); }
.auth-form-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--text-sm); margin-bottom: var(--space-4); }

/* labeled field — label sits above a clean underlined input (reference style) */
.af-field { display: block; margin: 0 0 var(--space-5); }
.af-label {
  display: block; font-size: var(--text-xs); color: var(--ink-muted);
  margin: 0 0 var(--space-1); letter-spacing: var(--tracking-wide);
}
.af-field input {
  width: 100%; height: 34px; padding: 0 0 var(--space-1);
  background: none; border: 0; border-bottom: 1.5px solid var(--line-strong);
  outline: none; font-family: var(--font-sans); font-size: var(--text-base);
  color: var(--ink); font-weight: var(--weight-medium);
  transition: border-color var(--dur-fast) var(--ease);
}
.af-field input::placeholder { color: var(--ink-muted); font-weight: var(--weight-regular); }
.af-field input:focus { border-bottom-color: var(--accent); }

/* password field: input + inline reveal eye */
.af-input-wrap { position: relative; display: block; }
.af-input-wrap input { padding-right: 34px; }
.af-reveal {
  position: absolute; right: 0; bottom: 3px;
  display: grid; place-items: center; width: 28px; height: 28px;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-muted);
  transition: color var(--dur-fast) var(--ease);
}
.af-reveal svg { width: 18px; height: 18px; }
.af-reveal:hover, .af-reveal.is-on { color: var(--ink); }
.af-reveal:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }

/* agreement checkbox (reference has consent checkboxes above the CTA) */
.af-check {
  display: grid; grid-template-columns: 18px 1fr; gap: var(--space-3);
  align-items: start; margin: var(--space-6) 0 0;
  font-size: var(--text-xs); line-height: var(--leading-sm); color: var(--ink-soft);
  cursor: pointer;
}
.af-check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; }

/* primary CTA — the reference's full-width yellow button */
.auth-submit {
  width: 100%; height: 50px; margin-top: var(--space-6); border: 0; outline: none;
  border-radius: var(--radius-sm); background: var(--gold); color: var(--ink);
  font-family: var(--font-sans); font-weight: var(--weight-semibold); font-size: var(--text-base); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.auth-submit:hover:not(:disabled) { filter: brightness(0.96); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.auth-submit:active:not(:disabled) { transform: scale(0.99); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-submit:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.auth-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--ink); font-weight: var(--weight-semibold);
  text-decoration: underline; text-underline-offset: 2px;
}
.auth-link:hover { color: var(--accent); }
.auth-link:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }

/* --- officials console footnote (low-emphasis, NOT a citizen action) --- */
.auth-officials-footer {
  margin: var(--space-8) 0 0;
  text-align: center;
}
.auth-officials-footer a {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.auth-officials-footer a:hover { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.auth-officials-footer a:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }

/* --- responsive: stack the illustration on top, form below --- */
@media (max-width: 860px) {
  .auth-grid { grid-template-columns: 1fr; max-width: 460px; min-height: 0; }
  .auth-art-col { order: -1; padding: var(--space-8) var(--space-8) var(--space-4); }
  .auth-art-svg { width: 52%; max-width: 220px; }
  .auth-form-col { padding: var(--space-6) var(--space-8) var(--space-10); }
}
@media (max-width: 480px) {
  .auth-screen { padding: 0; }
  .auth-grid { border-radius: 0; border: 0; min-height: 100vh; }
}

/* ============================================================
   LANDING PAGE (Phase 4) — pre-auth marketing surface.
   Light theme per dashboard.png. Solid near-black CTAs (gradient TEXT on
   the headline is allowed per lock screen 1.txt / hero1.txt; gradient
   BUTTONS are not). data-reveal elements are animated by GSAP in
   landing.js; they default to visible so a JS/GSAP failure never hides
   content (GSAP sets opacity:0 synchronously on mount when it runs).
   ============================================================ */
.landing {
  position: absolute; inset: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  background: transparent; color: var(--ink);
}

/* The kinetic-fabric backdrop (mounted on <body>) shows through here; the
   old static hub-spoke gradient is retired in favour of it. A whisper-soft
   top wash keeps the hero readable over the mesh without hiding it. */
.landing-bg { position: absolute; top: 0; left: 0; right: 0; height: 620px; pointer-events: none; z-index: var(--z-base);
  background: radial-gradient(70% 60% at 50% 0%, rgba(184,166,120,0.28), transparent 72%);
}

/* --- fixed blurred nav (lock screen 1.txt) --- */
.lp-nav { position: sticky; top: 0; z-index: var(--z-sticky); transition: background var(--dur-med) var(--ease), border-color var(--dur-med) var(--ease), box-shadow var(--dur-med) var(--ease); border-bottom: 1px solid transparent; }
.lp-nav.scrolled { background: rgba(244, 241, 232, 0.82); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom-color: var(--line); box-shadow: var(--shadow-xs); }
.lp-nav-inner { max-width: 1180px; margin: 0 auto; padding: 14px var(--space-10); display: flex; align-items: center; justify-content: space-between; }
.lp-nav-actions { display: flex; gap: var(--space-2); }

/* --- hero (hero1.txt) --- */
.lp-hero { position: relative; z-index: var(--z-base); }
/* Split hero (reference pattern): copy on the left, product visual on the
   right. Text left-aligned; visual in a card beside it. Colours/fonts/
   animation unchanged — layout only. */
.lp-hero-inner { max-width: 1180px; margin: 0 auto; padding: var(--space-16) var(--space-8) var(--space-12); display: grid; grid-template-columns: 1.05fr 0.95fr; gap: var(--space-12); align-items: center; text-align: left; }
.lp-hero-copy { min-width: 0; }
.lp-kicker { color: var(--accent); font-weight: var(--weight-semibold); font-size: var(--text-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; margin-bottom: var(--space-4); }
.lp-headline { font-size: var(--text-3xl); line-height: var(--leading-3xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tighter); margin: 0 0 var(--space-5); }
.lp-grad { background: linear-gradient(90deg, var(--ink), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.lp-sub { color: var(--ink-soft); font-size: var(--text-md); line-height: var(--leading-base); max-width: 44ch; margin: 0 0 var(--space-6); }
.lp-cta { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* trusted-by style strip under the CTAs. These three departments ARE the
   value proposition, so they read as prominent chips, not tiny metadata:
   the label is bumped off the 11.5px floor (issue 1) and each department
   is a bordered, higher-contrast chip rather than dot-separated grey text
   (issue 3). */
.lp-trust { margin-top: var(--space-8); }
.lp-trust-label { display: block; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink-soft); letter-spacing: var(--tracking-wide); text-transform: uppercase; margin-bottom: var(--space-3); }
.lp-trust-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.lp-trust-item { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); background: var(--accent-soft); border: 1px solid var(--accent-soft); border-radius: var(--radius-pill, 999px); padding: 6px var(--space-3); }

/* right-column visual */
.lp-hero-visual { min-width: 0; }
.lp-preview-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); padding: var(--space-8) var(--space-8) var(--space-6); }
.lp-preview-net { max-width: 460px; margin: 0 auto; }
.lp-preview-net svg { width: 100%; height: auto; display: block; }
.lp-preview-caption { color: var(--ink-muted); font-size: var(--text-xs); margin-top: var(--space-4); text-align: center; }

/* hero collapses to a single centered column on narrow screens */
@media (max-width: 860px) {
  .lp-hero-inner { grid-template-columns: 1fr; gap: var(--space-8); text-align: center; }
  .lp-sub { margin-left: auto; margin-right: auto; }
  .lp-cta, .lp-trust-row { justify-content: center; }
  .lp-hero-visual { order: -1; } /* visual on top on mobile, like the references' stacked view */
}

/* --- section shells --- */
.lp-features-inner, .lp-depts-inner, .lp-final-inner { max-width: 1080px; margin: 0 auto; padding: var(--space-16) var(--space-6); }
.lp-eyebrow { color: var(--accent); font-weight: var(--weight-semibold); font-size: var(--text-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; margin-bottom: var(--space-3); text-align: center; }
.lp-h2 { font-size: var(--text-2xl); line-height: var(--leading-2xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); text-align: center; margin: 0 0 var(--space-10); max-width: 22ch; margin-left: auto; margin-right: auto; }

/* --- feature grid (feature1.txt) --- */
.lp-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
@media (max-width: 900px) { .lp-feature-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .lp-feature-grid { grid-template-columns: 1fr; } }
.lp-feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--shadow-xs); transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.lp-feature:hover { box-shadow: var(--shadow-sm); border-color: var(--line-strong); transform: translateY(-2px); }
/* Larger, higher-contrast icon anchors (issue 4): a solid accent tile with
   a white glyph reads clearly in both the blue and the olive/gold themes,
   replacing the faint accent-on-tint that washed out against white. */
.lp-feature-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--accent); color: #fff; margin-bottom: var(--space-4); }
.lp-feature-icon svg { width: 26px; height: 26px; stroke-width: 2; }
.lp-feature h3 { font-size: var(--text-md); margin: 0 0 var(--space-2); font-weight: var(--weight-semibold); }
.lp-feature p { font-size: var(--text-sm); color: var(--ink-soft); margin: 0; line-height: var(--leading-base); }

/* --- departments band --- */
.lp-depts { background: var(--surface-sunken); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lp-dept-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
@media (max-width: 900px) { .lp-dept-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .lp-dept-grid { grid-template-columns: 1fr; } }
.lp-dept { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--shadow-xs); }
/* Title leads the card (issue 5): the heading + its small kind eyebrow sit
   at the top-left, with the art pushed to the right, so the primary label
   is the first thing scanned rather than being buried under the graphic. */
.lp-dept-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.lp-dept-titles { min-width: 0; }
.lp-dept-kind { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--accent); text-transform: uppercase; letter-spacing: var(--tracking-wide); margin-bottom: var(--space-1); }

/* hero preview: a small trio of the three service arts under the network
   diagram, echoing dashboard.png's colourful 3D service glyphs. */
.lp-preview-arts { display: flex; justify-content: center; gap: var(--space-5); margin-top: var(--space-5); flex-wrap: wrap; }
.lp-preview-art { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lp-preview-art span { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-soft); }
.lp-dept h3 { font-size: var(--text-md); margin: 0; font-weight: var(--weight-semibold); }
.lp-dept p { font-size: var(--text-sm); color: var(--ink-soft); margin: 0; line-height: var(--leading-base); }

/* --- final CTA --- */
.lp-final-inner { text-align: center; }
/* Center the final CTA buttons to match the centered heading (issue 6):
   text-align:center doesn't affect the flex row, so center it explicitly. */
.lp-final .lp-cta { margin-top: var(--space-2); justify-content: center; }

/* --- footer (minimal) --- */
.lp-footer { border-top: 1px solid var(--line); background: var(--card); }
.lp-footer-inner { max-width: 1080px; margin: 0 auto; padding: var(--space-8) var(--space-6); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.lp-footer-note { font-size: var(--text-xs); color: var(--ink-muted); max-width: 48ch; }

@media (max-width: 700px) {
  .lp-nav-inner { padding: 12px var(--space-5); }
  .lp-hero-inner { padding: var(--space-12) var(--space-5) var(--space-10); }
  .lp-features-inner, .lp-depts-inner, .lp-final-inner { padding: var(--space-12) var(--space-5); }
}

/* ============================================================
   INTERACTION POLISH (apple-design §1/§10, animate §7)
   Two craft fixes over the existing hover states, kept additive so no
   earlier rule is disturbed:

   1. POINTER GATING. Every hover that MOVES an element (the -2px card
      lifts) is re-scoped to fine pointers only. On touch, `:hover` sticks
      after a tap and leaves a card frozen mid-lift until the next tap
      elsewhere — the classic false-hover. Colour/shadow-only hovers are
      harmless on touch and are left global. We only gate the transforms.

   2. SMOOTH TEXT-LINK / CHIP TRANSITIONS. Text links and status chips
      changed colour instantly (no transition property named for `color`).
      Give them the same quick, named colour transition the buttons use so
      nothing in the UI snaps between states.

   transform + opacity only — compositor-friendly, no layout/paint.
   Everything degrades through the motion tokens: under
   prefers-reduced-motion the durations collapse to ~0 (tokens.css), so
   these become instant, never removed-and-jarring.
   ============================================================ */

/* Smooth the colour shift on text-style links + status chips. */
.section-head .link,
.auth-link,
.cred-foot-link,
.chip,
.cred-status,
.status-badge,
.doc-card .status {
  transition: color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

/* Gate the moving (translateY lift) hovers to devices with a real hover +
   fine pointer. The lift itself is unchanged; it just no longer sticks on
   touch. The resting transition (already declared on each card) stays, so
   the lift eases both in on hover and back out on leave. */
@media (hover: hover) and (pointer: fine) {
  .stat:hover { transform: translateY(-2px); }
  .cred-card:hover { transform: translateY(-2px); }
  .service:hover { transform: translateY(-2px); }
  .doc-card:hover { transform: translateY(-2px); }
  .lp-feature:hover { transform: translateY(-2px); }
  .auth-submit:hover:not(:disabled) { transform: translateY(-1px); }
}
/* On coarse/no-hover pointers, keep the shadow/colour affordance from the
   base rules but ensure no residual transform is left applied. */
@media not all and (hover: hover) and (pointer: fine) {
  .stat:hover, .cred-card:hover, .service:hover,
  .doc-card:hover, .lp-feature:hover, .auth-submit:hover { transform: none; }
}

/* ============================================================
   TAB-SWITCH VIEW TRANSITION (apple-design §7, animate §5)
   The router used to swap #viewRoot's innerHTML instantly — the new tab's
   content teleported in. This gives the whole panel a short fade + upward
   settle on every navigation, so switching Dashboard / Find a service /
   Documents / Applications reads as a considered arrival, not a hard cut.

   - transform + opacity only (compositor-friendly, no layout thrash).
   - ease-out (never ease-in on UI): decelerates into place.
   - duration is the --dur-med motion token, so prefers-reduced-motion
     collapses it to ~0; the media query below also drops the transform
     entirely, leaving a pure (near-instant) opacity settle for comprehension.
   - runs alongside the per-card GSAP staggers inside each view: the panel
     eases in as a unit while its cards stagger on top — one coherent motion,
     not two competing ones (the panel move is only 8px / 220ms, short
     enough not to fight the card reveal).
   ============================================================ */
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-enter { animation: viewEnter var(--dur-med) var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  /* Keep a gentle opacity settle (aids comprehension of the swap) but drop
     all positional movement — the vestibular-safe equivalent. */
  @keyframes viewEnter { from { opacity: 0; } to { opacity: 1; } }
  .view-enter { animation: viewEnter 140ms linear; }
}

/* ============================================================
   "JUST VERIFIED" STATUS REVEAL (animate §2 state-indication, §7)
   When a relay flips a department from "Not linked" to "Verified", the
   view re-renders and the badge would otherwise appear already-green with
   no transition (the old element is gone — see just-verified.js). This
   plays a single, tasteful reveal on ONLY that one badge:

     - a soft ring flash in the success colour, expanding then fading, so
       the eye is drawn to exactly what changed (state indication);
     - one gentle scale pulse (1 -> 1.06 -> 1) so the badge reads as
       "just settled into place", not merely recoloured.

   It's a one-shot: the class is removed after ~1.4s (anim.js), so the
   resting state is the calm green badge with no residual motion. Applies
   to all three badge shapes (credential card, connected-departments chip,
   documents card) via a shared class. transform + box-shadow only.

   The ring uses the badge's own ::after so no extra DOM is needed; the
   badges are already position-relative-friendly inline-flex pills.
   ============================================================ */
.just-verified {
  position: relative;
  animation: justVerifiedPulse 620ms var(--ease-out) 1;
}
.just-verified::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-pill);
  /* success-tinted ring; expands + fades so it reads as a confirmation
     ripple rather than a persistent outline. */
  box-shadow: 0 0 0 2px var(--success);
  opacity: 0;
  pointer-events: none;
  animation: justVerifiedRing 720ms var(--ease-out) 1;
}
@keyframes justVerifiedPulse {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes justVerifiedRing {
  0%   { opacity: 0.9; transform: scale(0.94); }
  70%  { opacity: 0.35; }
  100% { opacity: 0; transform: scale(1.12); }
}

/* Reduced motion: no scale, no expanding ring (both are movement). Keep a
   brief, static success-tint flash on the badge background only — a
   non-vestibular cue that the state changed, per apple-design §14. */
@media (prefers-reduced-motion: reduce) {
  .just-verified { animation: justVerifiedFlash 260ms linear 1; }
  .just-verified::after { display: none; }
  @keyframes justVerifiedFlash {
    0%   { box-shadow: 0 0 0 2px var(--success); }
    100% { box-shadow: 0 0 0 2px transparent; }
  }
}
