:root {
  color-scheme: light;

  /* ── Brand palette — "Trust Blue" cobalt (matches the apps) ── */
  /* Primary brand = confident cobalt #175DDC (Bitwarden/1Password class). */
  --blue-50: #eef3fc; /* lightest cobalt wash (disconnected empty bg) */
  --blue-100: #e4ecfb; /* brandSoft — cobalt tile/badge container */
  --blue-200: #c3d5f5; /* cobalt hairline for tinted empties */
  --blue-500: #2f6fe0; /* mid cobalt */
  --blue-600: #175ddc; /* primary action — Trust Blue cobalt */
  --blue-700: #124cb6; /* hover — deeper cobalt */
  --blue-900: #0b1f4a; /* deepest cobalt navy */

  /* ── Semantic aliases ───────────────────────────────────── */
  --blue: var(--blue-600);
  --blue-strong: var(--blue-700);
  --blue-soft: var(--blue-100);

  /* ── On-brand text — white on the cobalt fill (one hue; no separate accent). ─ */
  /* Live/online signal is GREEN (status colours below); the brand cobalt is the accent. */
  --on-brand: #ffffff; /* text/glyph on a cobalt fill */

  /* ── Status colours — coordinated family (matches the apps) ── */
  /* -600 hues clear WCAG AA (>=4.5:1) as small bold badge text on their -100 tints. */
  --green-600: #0f6b45; /* online/live/synced/success */
  --green-100: #e2f1ea;
  --green: var(--green-600);
  --green-soft: var(--green-100);

  --red-600: #a8392f; /* destructive/critical */
  --red-100: #f7e2de;
  --red: var(--red-600);
  --red-soft: var(--red-100);

  --amber-600: #8a5a0c; /* warning / cloud-off / "Fair" */
  --amber-100: #f4ecd5;
  --amber: var(--amber-600);
  --amber-soft: var(--amber-100);

  /* ── Neutral surface scale (clean cool-grey, matches the apps) ─ */
  --bg: #f5f7fa; /* cool-grey canvas (app background) */
  --surface: #ffffff;
  --surface-soft: #edf0f5; /* cool-grey soft container (app surfaceSoft) */
  --surface-hover: #f1f4f9;

  /* ── Typography ink (cool slate, matches the apps) ──────── */
  --ink: #18212e; /* primary text (app ink) */
  --ink-2: #2c3645; /* secondary labels — cool slate */
  --muted: #5b6675; /* secondary text — AA on white (app muted) */
  --muted-light: #98a3b2; /* decorative only */

  /* ── Border (cool-grey hairline, matches the apps) ──────── */
  --border: #dce1e9;
  --border-strong: #c7d0dc;

  /* ── Sidebar — deep cool charcoal-navy "studio" surface ──── */
  --sidebar: #111722; /* deep cool charcoal-navy (app dark family) */
  --sidebar-active: #1c2740; /* cobalt-tinted active nav */
  --sidebar-muted: #98a3b2; /* cool muted (app dark muted) */
  --sidebar-accent: #7db4ff; /* cobalt read on dark (brand on dark) */
  --sidebar-live: #54ce90; /* green — live/online spark on ink */

  /* ── Status strip tints ─────────────────────────────────── */
  --tint-ok: #e2f1ea; /* green-tinted ok */
  --tint-error: #f7e2de; /* red-tinted error */

  /* ── Elevation — Linear-modern: restrained two-cue depth ── */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);

  /* ── Focus ring (cobalt) ─────────────────────────────────── */
  --focus: 0 0 0 3px rgba(23, 93, 220, 0.28);

  /* ── Radii — Trust Blue × Linear-modern (mirror app 8/12/16) ─ */
  --radius-sm: 8px;
  --radius: 10px; /* buttons/chips/inputs */
  --radius-md: 16px; /* cards/tiles/panels */
  --radius-pill: 999px;

  /* ── Type scale ─────────────────────────────────────────── */
  /* System font stack only — no external font dependency, works offline. */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, monospace;

  --text-xs: 0.75rem; /* 12px */
  --text-sm: 0.8125rem; /* 13px */
  --text-base: 0.875rem; /* 14px */
  --text-md: 1rem; /* 16px */
  --text-lg: 1.125rem; /* 18px */
  --text-xl: 1.375rem; /* 22px */
  --text-2xl: 1.75rem; /* 28px — metric value */
  --text-3xl: 1.875rem; /* 30px — h1 */

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;

  /* ── Spacing scale ───────────────────────────────────────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  padding: 0 16px;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

button:hover:not(:disabled) {
  background: var(--blue-strong);
  border-color: var(--blue-strong);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink-2);
}

button.secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

button.danger {
  border-color: var(--red-600);
  color: var(--red-600);
  background: var(--surface);
}

button.danger:hover:not(:disabled) {
  background: var(--red-100);
  border-color: var(--red-600);
}

/* Primary CTAs keep a larger touch target. */
#connectButton,
#createHouseholdForm button[type="submit"],
#inviteMemberForm button[type="submit"] {
  min-height: 44px;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-color: var(--blue);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: #ffffff;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 28px;
}

/* Aperture-Shield mark (§8.4.1): indigo squircle shield with a
   Signal-Lime "live" pupil. Top corners rounder than bottom →
   a soft shield silhouette. Lime-on-ink is the signature pairing. */
.brandMark {
  width: 36px;
  height: 36px;
  border: 2px solid var(--sidebar-accent);
  border-radius: 11px 11px 7px 7px; /* shield: rounder top, tapered base */
  position: relative;
  background: rgba(159, 178, 255, 0.12); /* faint periwinkle iris fill */
  flex: 0 0 auto;
}

/* Live spark — the guardian's eye, a single lime pupil. */
.brandMark::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sidebar-live); /* Signal Lime dot on ink */
  box-shadow: 0 0 0 2px rgba(12, 20, 48, 0.55); /* ink halo for contrast */
  left: 11.5px;
  top: 11.5px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: #ffffff;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}

.brand span {
  color: var(--sidebar-muted);
  font-size: var(--text-xs);
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 6px;
}

.navItem {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--sidebar-muted);
  text-decoration: none;
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  position: relative;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.navItem.active {
  background: var(--sidebar-active);
  color: #ffffff;
}

.navItem:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

/* Active nav = a "live" state → the single lime spark (§8.2). */
.navItem.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 10px;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: var(--sidebar-live);
}

.navItem:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--sidebar-accent);
}

.navIcon {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(159, 178, 255, 0.13); /* periwinkle tint */
  text-align: center;
  color: var(--sidebar-accent);
  flex: 0 0 auto;
}

.navIcon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 32px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding-bottom: 4px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: var(--text-xs);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-extrabold);
  color: var(--ink);
}

h2 {
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  font-weight: var(--weight-bold);
  color: var(--ink);
}

h3 {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--ink);
}

p {
  color: var(--muted);
  line-height: var(--leading-snug);
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#connectionFields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#connectionFields[hidden] {
  display: none;
}

.connectedChip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connectedChip[hidden] {
  display: none;
}

/* "Connected" = a live state → solid Signal-Lime pill with
   ink-on-lime text (never lime text on white, §8.2.2). */
/* Persistent "connected" chip: calm success-green tonal (it is shown at rest on
   every screen). Signal Lime is reserved for live/active, so here it appears only
   as the small live dot — not a full lime fill — per the §8.2 discipline rule. */
.connectedChip .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 26%, transparent);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.connectedChip .chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green); /* the single live spark — green online dot */
  flex: 0 0 auto;
}

.connectedChip .chip-edit {
  background: none;
  border: none;
  min-height: auto;
  padding: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  cursor: pointer;
}

.connectedChip .chip-edit:hover:not(:disabled) {
  background: none;
  color: var(--ink-2);
}

.connectedChip .chip-edit:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.field input {
  width: 230px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.field select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.field input:hover,
.field select:hover {
  border-color: var(--border-strong);
}

.field.full input {
  width: 100%;
}

.field.compact select {
  width: 120px;
}

#languageToggle {
  min-height: 36px;
  font-size: var(--text-xs);
  padding: 0 12px;
}

.statusStrip {
  margin-top: 20px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-sm);
  transition:
    border-left-color 200ms ease,
    background 200ms ease;
}

.statusStrip.idle {
  border-left-color: var(--border-strong);
  background: var(--surface);
}

.statusStrip.ok {
  border-left-color: var(--green-600);
  background: var(--tint-ok);
}

.statusStrip.error {
  border-left-color: var(--red-600);
  background: var(--tint-error);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-light);
  flex: 0 0 auto;
}

.dot.idle {
  background: var(--muted-light);
}

.dot.ok {
  background: var(--green-600);
}

.dot.error {
  background: var(--red-600);
}

.view {
  display: none;
  margin-top: 28px;
}

.view.active {
  display: block;
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.sectionHeader > button {
  margin-top: auto;
  align-self: flex-end;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.metric,
.panel,
.tableWrap,
.timelineTable,
.policyItem {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); /* cards = 14 (§8.4.2) */
  box-shadow: var(--shadow-sm); /* flat/calm — no heavy shadow (§8.5) */
}

.metric {
  padding: 18px 16px 16px;
  min-height: 112px;
  position: relative;
  border-top: 3px solid var(--blue);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: var(--text-2xl);
  line-height: 1;
  font-weight: var(--weight-extrabold);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--text-xs);
}

.metric.metric--unknown strong {
  font-size: var(--text-base);
  color: var(--muted);
  font-weight: var(--weight-medium);
}

.split {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
}

.panel {
  padding: 18px;
  border-radius: var(--radius-md);
}

.panel.spaced {
  margin-top: 16px;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.badge.green {
  background: var(--green-100);
  color: var(--green-600);
}

.badge.red {
  background: var(--red-100);
  color: var(--red-600);
}

.badge.amber {
  background: var(--amber-100);
  color: var(--amber-600);
}

.readiness {
  display: grid;
  gap: 0;
}

.readinessRow {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.readinessRow:last-child {
  border-bottom: 0;
}

.readinessRow strong {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-2);
}

.readinessBadge {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-align: left;
  background: var(--blue-100);
  color: var(--blue-700);
}

.readinessBadge.green {
  background: var(--green-100);
  color: var(--green-600);
}

.readinessBadge.amber {
  background: var(--amber-100);
  color: var(--amber-600);
}

.readinessBadge.red {
  background: var(--red-100);
  color: var(--red-600);
}

.eventList {
  display: grid;
  gap: 10px;
}

.eventRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 12px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

.eventRow:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.eventTitle {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

.eventMeta {
  color: var(--muted);
  font-size: var(--text-xs);
}

.empty {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  padding: 24px;
  text-align: center;
}

.empty--disconnected {
  border-color: var(--blue-200);
  background: var(--blue-50);
  color: var(--blue-700);
}

.empty--disconnected strong {
  display: block;
  font-weight: var(--weight-bold);
}

.empty__icon {
  font-size: var(--text-lg);
  line-height: 1;
}

.tableWrap {
  overflow-x: auto;
}

.tableWrap.inner {
  margin-top: 14px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
}

td {
  font-size: var(--text-sm);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: var(--surface-hover);
}

td .muted {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  margin-top: 3px;
}

.timelineTable {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.timelineTable .eventRow {
  grid-template-columns: 170px minmax(180px, 1fr) 140px 110px;
  align-items: center;
}

.policyGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.policyItem {
  padding: 16px;
  border-radius: var(--radius-md);
}

.policyItem strong {
  display: block;
  margin-top: 6px;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--ink);
}

.policyItem p {
  margin-top: 6px;
  font-size: var(--text-sm);
}

.formGrid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  align-items: end;
  gap: 10px;
}

.inlineForm {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) 120px auto;
  align-items: end;
  gap: 10px;
}

.formGrid .field input,
.inlineForm .field input,
.inlineForm .field select {
  width: 100%;
}

.buttonRow {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.staffNotice {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid var(--red-600);
  background: var(--red-100);
  border-radius: var(--radius);
  color: var(--ink);
  display: grid;
  gap: 6px;
}

.staffNotice[hidden] {
  display: none;
}

.staffNotice strong {
  font-size: var(--text-md);
}

.staffNotice p {
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.staffNotice code {
  justify-self: start;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: var(--text-xs);
  color: var(--ink);
}

.searchForm {
  margin-top: 8px;
  margin-bottom: 16px;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.loadMoreRow {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.clickableRow {
  cursor: pointer;
}

.clickableRow:hover {
  background: var(--surface-hover);
}

.clickableRow.selected {
  background: var(--surface-soft);
  box-shadow: inset 3px 0 0 var(--ink);
}

.subheading {
  margin-top: 20px;
  margin-bottom: 8px;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--ink-2);
}

.dangerZone {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--red-600);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  gap: 12px;
}

.dangerZone > div strong {
  color: var(--red-600);
}

.dangerZone > div p {
  margin-top: 4px;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.dangerZone > button {
  justify-self: start;
}

.inlineConfirm {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.inlineConfirm input {
  min-height: 40px;
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 14px;
  }

  .main {
    padding-inline: 24px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .field input {
    width: 210px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }

  .formGrid,
  .inlineForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .policyGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    min-width: 0;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .brand {
    padding-bottom: 16px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .navItem {
    min-width: 132px;
    flex: 0 0 auto;
  }

  .navItem.active::before {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 3px;
    width: auto;
    height: 3px;
    border-radius: 3px;
  }

  .main {
    padding: 20px 16px 32px;
  }

  .toolbar,
  #connectionFields,
  .sectionHeader {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar .field,
  .field input,
  .field select,
  .toolbar button,
  .sectionHeader button {
    width: 100%;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
  }

  .metrics,
  .policyGrid,
  .formGrid,
  .inlineForm {
    grid-template-columns: 1fr;
  }

  .timelineTable .eventRow,
  .eventRow {
    grid-template-columns: 1fr;
  }
}

/* Signed-out (locked) state: show ONLY the login form. Hide the nav and every data
   view so the console's structure/data isn't exposed before a staff logs in. */
body.locked .sidebar {
  display: none;
}
body.locked .shell {
  display: block;
}
body.locked .view {
  display: none !important;
}
