/* Shared UI shell, tokens and generic controls */

:root {
  --bg: #f5f1ea;
  --bg-deep: #ede6da;
  --bg-highlight: #fff8ef;
  --ink: #1f1d1a;
  --muted: #6a6258;
  --accent: #c95d2d;
  --accent-2: #2b6c7f;
  --accent-ink: #9a4520;
  --accent-2-ink: #163a45;
  --positive: #3f9a72;
  --negative: #b64c21;
  --warning: #b8922a;
  --card: oklch(0.985 0.008 78);
  --ink-rgb: 31, 29, 26;
  --stroke: rgba(var(--ink-rgb), 0.12);
  --shadow: 0 18px 40px rgba(36, 31, 22, 0.12);
  --muted-rgb: 106, 98, 88;
  --accent-rgb: 201, 93, 45;
  --accent-2-rgb: 43, 108, 127;
  --accent-ink-rgb: 154, 69, 32;
  --accent-2-ink-rgb: 22, 58, 69;
  --positive-rgb: 63, 154, 114;
  --negative-rgb: 182, 76, 33;
  --warning-rgb: 184, 146, 42;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 22px;
  --space-xl: 24px;
  --space-section: 28px;
  --z-base: 1;
  --z-raised: 2;
  --z-dropdown: 5;
  --z-tooltip: 6;
  --z-sticky-subheader: 20;
  --z-topbar: 30;
  --z-backdrop: 80;
  --z-panel: 90;
  --font-display: "Fraunces", "Eczar", serif;
  --font-ui: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", monospace;
  /* Target foundation: additive until each legacy page explicitly opts in. */
  --foundation-radius-control: 9px;
  --foundation-radius-surface: 13px;
  --foundation-control-height: 40px;
  --foundation-control-small-height: 28px;
  --foundation-surface-shadow: 0 1px 2px rgba(36, 31, 22, 0.04);
  --foundation-display-size: clamp(24px, 3vw, 36px);
  --foundation-display-weight: 600;
  --foundation-display-leading: 1.2;
  --foundation-title-size: 18px;
  --foundation-title-weight: 600;
  --foundation-title-leading: 1.3;
  --foundation-body-size: 14px;
  --foundation-body-weight: 400;
  --foundation-body-leading: 1.5;
  --foundation-label-size: 12px;
  --foundation-label-weight: 600;
  --foundation-label-leading: 1.5;
  --foundation-label-tracking: 0.02em;
  --foundation-error-ink: var(--negative);
  --foundation-secondary-ink: var(--accent-2-ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: radial-gradient(circle at top, var(--bg-highlight) 0%, var(--bg) 55%, var(--bg-deep) 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--space-sm) clamp(20px, 6vw, 80px) 10px;
  background: var(--bg);
  border-bottom: 1px solid rgba(var(--ink-rgb), 0.1);
}

.topbar-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: 224px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 448 / 80;
}

.brand-teal { fill: var(--accent-2); }
.brand-accent { fill: var(--accent); }
.brand-ink { fill: var(--ink); }

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: var(--space-2xs);
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.topnav-link {
  padding: var(--space-xs) var(--space-sm);
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.topnav-link:hover {
  background: rgba(var(--accent-2-rgb), 0.14);
  border-color: rgba(var(--accent-2-rgb), 0.44);
}

.topnav-link:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.7);
  outline-offset: 2px;
}

.topnav-link.is-active {
  background: rgba(var(--accent-2-rgb), 0.2);
  border-color: rgba(var(--accent-2-rgb), 0.52);
  color: var(--accent-2-ink);
}

.settings-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 7px 10px;
  border: 1px solid rgba(var(--negative-rgb), 0.28);
  border-radius: 999px;
  background: rgba(var(--negative-rgb), 0.08);
  color: var(--negative);
  font-size: 12px;
  line-height: 1;
}

.settings-status[hidden] {
  display: none;
}

.settings-status-retry {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.settings-status-retry:disabled {
  cursor: wait;
  opacity: 0.55;
}

.settings-status-retry:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.7);
  outline-offset: 3px;
}

.theme-select {
  padding: var(--space-xs) var(--space-sm);
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.theme-select:hover {
  background: rgba(var(--accent-2-rgb), 0.14);
  border-color: rgba(var(--accent-2-rgb), 0.44);
}

.theme-select:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.7);
  outline-offset: 2px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid rgba(var(--ink-rgb), 0.08);
  padding-top: var(--space-xs);
}

.breadcrumbs-sep {
  color: rgba(var(--ink-rgb), 0.34);
}

main {
  position: relative;
  z-index: 1;
  padding: 20px clamp(20px, 6vw, 80px) 60px;
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 48px);
}

.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.5vw, 48px);
  margin: 8px 0 12px;
  line-height: 1.1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 11px;
  color: var(--accent-2);
  font-weight: 600;
  margin: 0;
}

.lead {
  font-size: 16px;
  color: var(--muted);
  max-width: 520px;
  line-height: 1.6;
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.action-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.action-card.is-link {
  position: relative;
  padding-right: 46px;
  cursor: pointer;
  border-color: rgba(var(--accent-2-rgb), 0.32);
  background: rgba(var(--accent-2-rgb), 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease,
    background-color 160ms ease;
}

.action-card.is-link::after {
  content: "→";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--accent-2);
}

.action-card.is-link:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-2-rgb), 0.6);
  background: rgba(var(--accent-2-rgb), 0.16);
  box-shadow: 0 12px 24px rgba(var(--accent-2-rgb), 0.16);
}

.action-card.is-link:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.7);
  outline-offset: 3px;
}

.action-title {
  font-weight: 600;
  font-size: 14px;
}

.action-desc {
  font-size: 13px;
  color: var(--muted);
}

.hero-panel {
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.55));
  border: 1px solid var(--stroke);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.metric {
  padding: 14px var(--space-md);
  border-radius: var(--space-md);
  background: var(--card);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
}

.is-positive {
  color: var(--positive);
}

.is-negative {
  color: var(--negative);
}

.metric-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.metric-value {
  font-size: 20px;
  font-weight: 600;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.status.is-ok,
.status.is-warn,
.status.is-loading,
.status.is-error {
  justify-content: flex-start;
  min-height: 34px;
  padding: 7px var(--space-sm);
  border-radius: 999px;
  font-weight: 600;
}

.status.is-ok {
  border: 1px solid rgba(var(--positive-rgb), 0.18);
  background: rgba(var(--positive-rgb), 0.1);
  color: var(--positive);
}

.status.is-warn,
.status.is-loading {
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.status.is-error {
  border: 1px solid rgba(var(--negative-rgb), 0.22);
  background: rgba(var(--negative-rgb), 0.1);
  color: var(--negative);
}

.status.is-ok .status-dot {
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(var(--positive-rgb), 0.15);
}

.status.is-warn .status-dot,
.status.is-loading .status-dot {
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.15);
}

.status.is-error .status-dot {
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(var(--negative-rgb), 0.15);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 6px rgba(var(--positive-rgb), 0.15);
}

.skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(var(--accent-2-rgb), 0.06),
    rgba(var(--accent-2-rgb), 0.15),
    rgba(var(--accent-2-rgb), 0.06)
  );
  background-size: 220% 100%;
  animation: skeleton-shift 1.3s ease-in-out infinite;
}

@keyframes skeleton-shift {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 30px rgba(27, 23, 16, 0.08);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.2;
  min-height: 1.4em;
  margin: 0 0 var(--space-sm);
}

.card ul,
.card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.tags span {
  border-radius: 999px;
  padding: 6px var(--space-sm);
  font-size: 12px;
  border: 1px solid rgba(var(--accent-2-rgb), 0.2);
  background: rgba(var(--accent-2-rgb), 0.08);
}

.note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.card-title-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.activity-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.activity-missing {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.activity-missing>div:first-child {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 11px;
  color: var(--negative);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.activity-missing.is-hidden {
  display: none;
}

.activity-missing-load {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.activity-missing-load-button.button {
  align-self: auto;
  padding: 6px var(--space-sm);
  font-size: 11px;
}

.activity-missing-load-button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.activity-missing-load-error {
  font-size: 12px;
  color: var(--negative);
}

.activity-missing-load-error.is-hidden {
  display: none;
}

.icon-button {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: var(--space-xs);
  background: rgba(255, 255, 255, 0.88);
  color: rgba(var(--ink-rgb), 0.72);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(var(--ink-rgb), 0.28);
  color: rgba(var(--ink-rgb), 0.9);
}

.icon-button:focus-visible {
  outline: 2px solid rgba(var(--accent-rgb), 0.72);
  outline-offset: 2px;
}

.icon-button:active {
  background: rgba(var(--ink-rgb), 0.06);
}

.icon-button.is-copied {
  background: rgba(var(--positive-rgb), 0.12);
  border-color: rgba(var(--positive-rgb), 0.45);
  color: var(--positive);
}

.icon-button.is-lg {
  width: var(--foundation-control-small-height);
  height: var(--foundation-control-small-height);
  padding: 6px;
}

.activity-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--negative);
  animation: pulse-core 1.2s ease-in-out infinite;
}

.activity-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(var(--negative-rgb), 0.35);
  border: 1px solid rgba(var(--negative-rgb), 0.42);
  animation: pulse-halo 1.2s ease-in-out infinite;
}

@keyframes pulse-core {

  0%,
  40% {
    opacity: 1;
    background: rgba(var(--muted-rgb), 0.72);
  }

  55%,
  85% {
    opacity: 1;
    background: var(--negative);
  }

  100% {
    opacity: 1;
    background: rgba(var(--muted-rgb), 0.72);
  }
}

@keyframes pulse-halo {

  0%,
  35% {
    opacity: 0;
    transform: scale(0.8);
  }

  40% {
    opacity: 0.2;
    transform: scale(0.85);
  }

  55% {
    opacity: 0.7;
    transform: scale(1.1);
  }

  85% {
    opacity: 0.7;
    transform: scale(1.1);
  }

  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

.meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inline-metrics {
  margin-top: 12px;
  display: flex;
  gap: var(--space-md);
  font-size: 13px;
  color: var(--muted);
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.check-groups-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.check-groups-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.check-groups-row .check-group {
  flex: 1 1 180px;
}

.check-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: 10px var(--space-sm);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(var(--ink-rgb), 0.08);
}

.check-items {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.check-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px var(--space-sm);
  border-radius: 999px;
  border: 1px solid rgba(var(--ink-rgb), 0.14);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
  cursor: pointer;
}

/* html prefix beats page-scoped `.X .toggle` layout backgrounds */
html .toggle:has(input:checked) {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

.toggle input {
  accent-color: var(--accent);
}

.wide {
  display: flex;
}

.mono {
  margin-top: 14px;
  background: rgba(var(--ink-rgb), 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-block;
}

code {
  font-family: var(--font-mono);
}

.link {
  color: inherit;
  text-decoration: none;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.range {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: 12px;
}

.range label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.select-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.range input {
  border-radius: 12px;
  border: 1px solid var(--stroke);
  padding: var(--space-xs) 10px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  color: var(--ink);
}

.select-field select {
  border-radius: 12px;
  border: 1px solid var(--stroke);
  padding: var(--space-xs) 10px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  color: var(--ink);
}

.range.range-sliders label {
  flex: 1 1 220px;
}

#lineRangeControls.is-hidden {
  display: none;
}

.range.range-sliders input[type="range"] {
  width: 100%;
  accent-color: var(--accent-2);
  padding: 0;
  border: none;
  background: transparent;
}

.icon-button-glyph { display: block; width: var(--space-md); height: var(--space-md); flex-shrink: 0; background-color: currentColor; }
.icon-button-glyph.is-add { width: var(--foundation-label-size); height: var(--foundation-label-size); mask: url("/assets/add-icon-d04e8d611bc41dca.svg") center / contain no-repeat; }
.icon-button-glyph.is-delete { mask: url("/assets/delete-icon-d9df055a6a237792.svg") center / contain no-repeat; }
.icon-button-glyph.is-edit { mask: url("/assets/edit-icon-bea8a632dad2b9e6.svg") center / contain no-repeat; }
.icon-button-tooltip {
  --icon-tooltip-gap: var(--space-xs);
  position: fixed; inset: auto; margin: 0; box-sizing: border-box;
  max-width: min(320px, calc(100vw - 2 * var(--icon-tooltip-gap)));
  padding: var(--space-2xs) var(--space-xs); border: 1px solid var(--stroke);
  border-radius: var(--foundation-radius-control); background: var(--card); color: var(--ink);
  box-shadow: var(--foundation-surface-shadow); font: var(--foundation-label-size)/1.4 var(--font-ui);
  white-space: normal; overflow-wrap: anywhere;
}

.button {
  align-self: flex-end;
  padding: 10px var(--space-md);
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--card);
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.05);
}

.button.ghost {
  background: rgba(var(--accent-2-rgb), 0.12);
  color: var(--ink);
  border: 1px solid rgba(var(--accent-2-rgb), 0.3);
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: 16px;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(var(--ink-rgb), 0.15);
  padding: 6px var(--space-sm);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
}

footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 26px var(--space-sm) 40px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 920px) {
  .topbar {
    padding-top: 10px;
  }

  .topbar-main {
    align-items: flex-start;
  }

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

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

  .wide-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
@media (max-width: 720px) {
  .topnav-link {
    font-size: 11px;
  }

  .breadcrumbs {
    font-size: 11px;
    letter-spacing: 0.06em;
  }
}

.metric-sub {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
}

.data-table th,
.data-table td {
  padding: var(--space-sm) 10px;
  border-bottom: 1px solid var(--data-table-border, var(--stroke));
  text-align: left;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.data-table th {
  color: var(--data-table-muted, var(--muted));
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.data-table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

:root[data-theme="dark"] {
  /* Olive Earth — Gruvbox Dark Medium (soft midtones, no near-black void) */
  --bg: #282828;
  --bg-deep: #1d2021;
  --bg-highlight: #3c3836;
  --ink: #ebdbb2;
  --muted: #a89984;
  --accent: #d65d0e;
  /* blue (not aqua) — keep nav/analytical cool and away from positive green */
  --accent-2: #458588;
  --accent-ink: #fe8019;
  --accent-2-ink: #83a598;
  --positive: #b8bb26;
  --negative: #fb4934;
  --warning: #fabd2f;
  --card: oklch(0.325 0.014 70);
  --ink-rgb: 235, 219, 178;
  --muted-rgb: 168, 153, 132;
  --accent-rgb: 214, 93, 14;
  --accent-2-rgb: 69, 133, 136;
  --accent-ink-rgb: 254, 128, 25;
  --accent-2-ink-rgb: 131, 165, 152;
  --positive-rgb: 184, 187, 38;
  --negative-rgb: 251, 73, 52;
  --warning-rgb: 250, 189, 47;
  --stroke: rgba(var(--ink-rgb), 0.14);
  --shadow: 0 18px 40px rgba(29, 32, 33, 0.45);
  color-scheme: dark;
}

[data-theme="dark"] body {
  background: radial-gradient(circle at top, var(--bg-highlight) 0%, var(--bg) 55%, var(--bg-deep) 100%);
}

[data-theme="dark"] .topbar {
  background: var(--bg);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .topnav-link {
  background: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .topnav-link.is-active {
  background: rgba(var(--accent-2-rgb), 0.22);
  border-color: rgba(var(--accent-2-rgb), 0.5);
  color: var(--accent-2-ink);
}

[data-theme="dark"] .button {
  /* --card is an opaque panel in dark; use ground for ink on orange fill */
  color: var(--bg);
}

[data-theme="dark"] .settings-status {
  border-color: rgba(var(--negative-rgb), 0.36);
  background: rgba(var(--negative-rgb), 0.12);
  color: var(--negative);
}

[data-theme="dark"] .theme-select {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

[data-theme="dark"] .theme-select option {
  background: var(--bg);
  color: var(--ink);
}

[data-theme="dark"] .breadcrumbs {
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .breadcrumbs-sep {
  color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .hero-panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
}

[data-theme="dark"] .metric {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(var(--accent-rgb), 0.2);
}

[data-theme="dark"] .action-card {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .action-card.is-link {
  background: rgba(var(--accent-2-rgb), 0.12);
  border-color: rgba(var(--accent-2-rgb), 0.3);
}

[data-theme="dark"] .action-card.is-link:hover {
  background: rgba(var(--accent-2-rgb), 0.2);
  border-color: rgba(var(--accent-2-rgb), 0.5);
  box-shadow: 0 12px 24px rgba(var(--accent-2-rgb), 0.12);
}

[data-theme="dark"] .check-group {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .toggle {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .status.is-ok {
  border-color: rgba(var(--positive-rgb), 0.38);
  background: rgba(var(--positive-rgb), 0.16);
  color: var(--positive);
}

[data-theme="dark"] .status.is-warn,
[data-theme="dark"] .status.is-loading {
  border-color: rgba(var(--accent-rgb), 0.38);
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
}

[data-theme="dark"] .status.is-error {
  border-color: rgba(var(--negative-rgb), 0.38);
  background: rgba(var(--negative-rgb), 0.16);
  color: var(--negative);
}

[data-theme="dark"] .icon-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(var(--ink-rgb), 0.72);
}

[data-theme="dark"] .icon-button:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--ink);
}

[data-theme="dark"] .icon-button:active {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .icon-button.is-copied {
  background: rgba(var(--positive-rgb), 0.2);
  border-color: rgba(var(--positive-rgb), 0.4);
  color: var(--positive);
}

html[data-theme="dark"] .toggle:has(input:checked) {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

[data-theme="dark"] .range input,
[data-theme="dark"] .select-field select {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

[data-theme="dark"] .chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .mono {
  background: rgba(255, 255, 255, 0.08);
}

/* New session action keeps its ghost text readable in both themes. */
.button.access-logout { color: var(--ink); }

.access-preview-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); padding: var(--space-xs); border-bottom: 1px solid var(--stroke); background: var(--card); color: var(--ink); overflow-wrap: anywhere; }
.access-preview-banner > span { min-width: 0; }

.button.access-preview-action { color: var(--ink); }

/* One shared nav DOM; disclosure is only used at the canonical phone breakpoint. */
.topbar-menu-toggle { display: none; }
.button.topbar-menu-toggle { color: var(--ink); }
[data-topbar-menu-error] { color: var(--negative); font-weight: 700; }
[data-topbar-menu-error][hidden] { display: none; }
@media (max-width: 600px) {
  .topbar { gap: var(--space-xs); padding: var(--space-xs); z-index: var(--z-topbar); }
  .topbar-main { flex-wrap: nowrap; gap: var(--space-xs); }
  .topbar .brand { min-width: 0; }
  .topbar .brand-logo { width: 196px; }
  .topbar-menu-toggle { display: inline-flex; align-items: center; gap: var(--space-2xs); flex: 0 0 auto; min-height: var(--foundation-control-height); padding: var(--space-xs) var(--space-sm); }
  .topbar .breadcrumbs { display: none; }
  .topbar .topnav { display: none; }
  .topbar .topnav.is-open {
    position: fixed; top: var(--topbar-menu-top, 0px); inset-inline: var(--space-xs); z-index: var(--z-dropdown);
    display: flex; align-items: stretch; justify-content: flex-start; flex-direction: column; flex-wrap: nowrap;
    max-height: calc(100dvh - var(--topbar-menu-top, 0px) - var(--space-xs)); overflow-y: auto;
    padding: var(--space-sm); border: 1px solid var(--stroke); border-radius: var(--foundation-radius-surface);
    background: var(--card); box-shadow: var(--foundation-surface-shadow);
  }
  .topbar .topnav-link, .topbar .theme-select { min-height: var(--foundation-control-height); border-radius: var(--foundation-radius-control); }
  .topbar .settings-status { flex-wrap: wrap; line-height: 1.4; border-radius: var(--foundation-radius-control); }
}

/* Compact foundation is explicit and reversible; legacy and existing pilots keep their owners. */
[data-foundation="compact"] {
  font-family: var(--font-ui);
  font-size: var(--foundation-body-size);
  font-weight: var(--foundation-body-weight);
  line-height: var(--foundation-body-leading);
}
[data-foundation="compact"].foundation-surface {
  min-width: 0;
  overflow-wrap: anywhere;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--foundation-radius-surface);
  box-shadow: var(--foundation-surface-shadow);
  padding: var(--space-md);
  gap: var(--space-md);
}
[data-foundation="compact"] .foundation-display {
  font-family: var(--font-ui);
  font-size: var(--foundation-display-size);
  font-weight: var(--foundation-display-weight);
  line-height: var(--foundation-display-leading);
}
[data-foundation="compact"] .foundation-title {
  font-family: var(--font-ui);
  font-size: var(--foundation-title-size);
  font-weight: var(--foundation-title-weight);
  line-height: var(--foundation-title-leading);
}
[data-foundation="compact"] .foundation-body {
  color: var(--ink);
  font-size: var(--foundation-body-size);
  font-weight: var(--foundation-body-weight);
  line-height: var(--foundation-body-leading);
}
[data-foundation="compact"] .foundation-label {
  color: var(--ink);
  font-size: var(--foundation-label-size);
  font-weight: var(--foundation-label-weight);
  line-height: var(--foundation-label-leading);
  letter-spacing: var(--foundation-label-tracking);
}
[data-foundation="compact"] .action-card.foundation-navigation {
  min-height: var(--foundation-control-height);
  padding: var(--space-md);
  border-radius: var(--foundation-radius-control);
  border-color: var(--accent-2);
  background: var(--card);
  color: var(--accent-2-ink);
  box-shadow: none;
  transform: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}
[data-foundation="compact"] .action-card.foundation-navigation:is(:hover, :active) {
  background: var(--bg);
  border-color: var(--accent-2-ink);
  box-shadow: none;
  transform: none;
}
[data-foundation="compact"] .action-card.foundation-navigation:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: var(--space-2xs);
}
@media (prefers-reduced-motion: reduce) {
  [data-foundation="compact"] .action-card.foundation-navigation { transition: none; }
}

[data-foundation="compact"] .foundation-navigation::after { color: var(--accent-2-ink); }

/* Opt-in native controls. Page layout remains with each consumer. */
html [data-foundation="compact"] :is(.button, .foundation-input, .foundation-select, .foundation-choice, .foundation-field, .foundation-link, .toggle) {
  font-family: var(--font-ui);
  font-size: var(--foundation-body-size);
  line-height: var(--foundation-body-leading);
  letter-spacing: normal;
  text-transform: none;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
html [data-foundation="compact"] .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--foundation-control-height);
  border-radius: var(--foundation-radius-control);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid transparent;
  background: var(--accent-ink);
  color: var(--card);
  font-weight: var(--foundation-label-weight);
  text-align: center;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
}
html [data-foundation="compact"] .button.is-sm {
  box-sizing: border-box;
  min-height: var(--foundation-control-small-height);
  padding: var(--space-2xs) var(--space-xs);
  gap: var(--space-2xs);
  font-size: var(--foundation-label-size);
  line-height: 1.5;
}
html [data-foundation="compact"] .icon-button { border-radius: var(--foundation-radius-control); }
html[data-theme="dark"] [data-foundation="compact"] { --foundation-error-ink: color-mix(in srgb, var(--negative), var(--ink) 22%); --foundation-secondary-ink: color-mix(in srgb, var(--accent-2-ink), var(--ink) 22%); }
html[data-theme="dark"] [data-foundation="compact"] .button { background: var(--accent-ink); color: var(--bg); }
html [data-foundation="compact"] .button.ghost {
  background: rgba(var(--accent-2-rgb), .08);
  color: var(--foundation-secondary-ink);
  border-color: rgba(var(--accent-2-rgb), .3);
}
html [data-foundation="compact"] .button.is-text { background: transparent; color: var(--foundation-secondary-ink); border-color: transparent; text-decoration: underline; }
html [data-foundation="compact"] .button:hover:not(:disabled):not([aria-disabled="true"]) { filter: brightness(.94); }
html [data-foundation="compact"] .button:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(1px); }
html [data-foundation="compact"] :is(.button, .icon-button):disabled { opacity: .6; cursor: not-allowed; }
html [data-foundation="compact"] .button[aria-busy="true"] { cursor: progress; }
html [data-foundation="compact"] .foundation-field { display: flex; flex-direction: column; gap: var(--space-2xs); color: var(--ink); font-weight: var(--foundation-label-weight); }
html [data-foundation="compact"].foundation-field { display: flex; flex-direction: column; gap: var(--space-2xs); color: var(--ink); font-size: var(--foundation-body-size); font-weight: var(--foundation-label-weight); letter-spacing: normal; text-transform: none; }
html [data-foundation="compact"].foundation-choice { display: inline-flex; flex-direction: row; align-items: center; gap: var(--space-xs); min-height: var(--foundation-control-height); color: var(--ink); overflow-wrap: anywhere; }
html [data-foundation="compact"] :is(.foundation-input, .foundation-select) {
  width: 100%;
  min-height: var(--foundation-control-height);
  padding: var(--space-xs);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--foundation-radius-control);
  font-weight: var(--foundation-body-weight);
}
html [data-foundation="compact"] :is(.foundation-input, .foundation-select):disabled { opacity: .6; cursor: not-allowed; }
html [data-foundation="compact"] .foundation-input::placeholder {
  color: var(--muted);
  opacity: .75;
  font-weight: var(--foundation-body-weight);
}
html [data-foundation="compact"] .foundation-input[readonly] { background: var(--bg); }
html [data-foundation="compact"] [aria-invalid="true"] { border-color: var(--negative); }
html [data-foundation="compact"] :is(.foundation-help, .foundation-error) { margin: 0; font-size: var(--foundation-label-size); font-weight: var(--foundation-body-weight); }
html [data-foundation="compact"] .foundation-help { color: var(--muted); }
html [data-foundation="compact"] .foundation-error { color: var(--foundation-error-ink); }
html [data-foundation="compact"] .foundation-choice {
  display: inline-flex; flex-direction: row; align-items: center; gap: var(--space-xs);
  min-height: var(--foundation-control-height); color: var(--ink); font-weight: var(--foundation-body-weight);
}
html [data-foundation="compact"] :is(.foundation-choice, .toggle) input { flex: 0 0 auto; width: auto; accent-color: var(--accent-ink); }
html [data-foundation="compact"] :is(.foundation-choice, .toggle):has(input:disabled) { opacity: .6; cursor: not-allowed; }
html [data-foundation="compact"] .foundation-group { border: 0; margin: 0; padding: 0; min-width: 0; }
html [data-foundation="compact"] .toggle { min-height: var(--foundation-control-height); min-width: 0; max-inline-size: 100%; white-space: normal; overflow-wrap: anywhere; border-radius: var(--foundation-radius-control); }
html [data-foundation="compact"] .toggle > span { min-width: 0; }
html [data-foundation="compact"] .foundation-link { display: inline-block; color: var(--foundation-secondary-ink); text-decoration: underline; padding-block: var(--space-2xs); }
html [data-foundation="compact"] :is(button, a, input, select):focus-visible {
  outline: 2px solid var(--accent-ink); outline-offset: var(--space-2xs);
}
html [data-foundation="compact"] :is(.foundation-choice, .toggle):has(input:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: var(--space-2xs); }
@media (prefers-reduced-motion: reduce) {
  html [data-foundation="compact"] :is(.button, .icon-button, .toggle, .foundation-link) { transition: none; animation: none; }
}

/* Opt-in compositions share presentation; callers retain data and interaction owners. */
.foundation-heading, .foundation-toolbar, .foundation-actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-sm); min-width: 0;
}
.foundation-heading > *, .foundation-toolbar > *, .foundation-actions > * { min-width: 0; }
.foundation-heading :is(h1,h2,h3,p) { overflow-wrap: anywhere; }
.foundation-filter-group { min-width: 0; }
.foundation-section { min-width: 0; border-top: 1px solid var(--stroke); padding-block: var(--space-md); }
.foundation-actions { justify-content: flex-start; }
.foundation-feedback { min-block-size: 1.4em; min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.status.foundation-feedback { color: var(--ink); }
.status.foundation-feedback.is-warn { color: var(--foundation-warning-ink); }
.status.foundation-feedback.is-error { color: var(--foundation-negative-ink); }
.status.foundation-feedback.is-ok { color: var(--foundation-positive-ink); }
.foundation-empty { padding: var(--space-lg); color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.foundation-table-scroll { max-inline-size: 100%; min-width: 0; overflow: auto; padding: var(--space-2xs); }
.foundation-table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: var(--space-2xs); }
.data-table.foundation-table :is(th,td) { overflow-wrap: anywhere; }
.data-table.foundation-table th { text-transform: none; letter-spacing: normal; }
.data-table.foundation-table .foundation-number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.foundation-dialog {
  box-sizing: border-box; inline-size: min(35rem, calc(100vw - 2 * var(--space-md)));
  max-inline-size: calc(100vw - 2 * var(--space-md)); max-block-size: calc(100dvh - 2 * var(--space-md));
  overflow: auto; overscroll-behavior: contain; color: var(--ink); background: var(--card);
  border: 1px solid var(--stroke); border-radius: var(--foundation-radius-surface);
  padding: var(--space-md); box-shadow: var(--foundation-surface-shadow); overflow-wrap: anywhere;
}
.foundation-dialog::backdrop { background: rgba(var(--ink-rgb), .42); }
.foundation-dialog > h2 { margin-block: 0 var(--space-sm); font: 600 1.25rem/1.3 var(--font-ui); }
.foundation-dialog .foundation-actions { margin-block-start: var(--space-md); }
.foundation-dialog :is(button,input,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: var(--space-2xs); }
.foundation-dialog .button.ghost { color: var(--ink); }

:root { --foundation-negative-ink: #953b1d; --foundation-warning-ink: #795b12; --foundation-positive-ink: #286345; }
html[data-theme="dark"] { --foundation-negative-ink: #ff957c; --foundation-warning-ink: var(--warning); --foundation-positive-ink: var(--positive); }
.status.foundation-feedback { border-color: var(--stroke); background: transparent; white-space: normal; border-radius: var(--foundation-radius-control); max-inline-size: 100%; }
.status.foundation-feedback.is-warn { border-color: rgba(var(--warning-rgb), .3); background: rgba(var(--warning-rgb), .08); }
.status.foundation-feedback.is-ok { border-color: rgba(var(--positive-rgb), .3); background: rgba(var(--positive-rgb), .08); }
.status.foundation-feedback.is-error { border-color: rgba(var(--negative-rgb), .3); background: rgba(var(--negative-rgb), .08); }
.status.foundation-feedback.is-loading { color: var(--ink); border-color: var(--stroke); background: transparent; }
/* Presence colors identify people; they do not encode financial or access status. */
:root {
  --online-tone-0-bg: #e5d1bd; --online-tone-0-ink: #4b321e;
  --online-tone-1-bg: #c7dddf; --online-tone-1-ink: #244b51;
  --online-tone-2-bg: #ddd3e7; --online-tone-2-ink: #503b63;
  --online-tone-3-bg: #d7dec6; --online-tone-3-ink: #394b28;
  --online-tone-4-bg: #ead0d2; --online-tone-4-ink: #67383e;
  --online-tone-5-bg: #ced9eb; --online-tone-5-ink: #344b6b;
  --online-avatar-size: 28px; --online-avatar-gap: 2px; --online-panel-margin: 8px; --online-anchor-gap: 4px;
  --online-panel-width: 340px;
}
:root[data-theme="dark"] {
  --online-tone-0-bg: #73543b; --online-tone-0-ink: #ffe8c9;
  --online-tone-1-bg: #365b60; --online-tone-1-ink: #d3f0ef;
  --online-tone-2-bg: #5d496e; --online-tone-2-ink: #efe0ff;
  --online-tone-3-bg: #4b6039; --online-tone-3-ink: #e2efc9;
  --online-tone-4-bg: #70484e; --online-tone-4-ink: #ffdee2;
  --online-tone-5-bg: #405576; --online-tone-5-ink: #e0eaff;
}
/* Keep the same row and breadcrumb width even when confirmed presence is empty. */
.topbar-secondary { display: grid; grid-template-columns: minmax(0, 1fr) calc(4 * var(--online-avatar-size) + 3 * var(--online-avatar-gap)); align-items: center; gap: var(--space-sm); min-width: 0; min-height: var(--online-avatar-size); }
.topbar-secondary > .online-users { justify-self: end; }
.topbar-secondary .breadcrumbs { min-width: 0; flex-wrap: wrap; }
.online-users { display: flex; align-items: center; gap: var(--space-2xs); flex: 0 0 auto; font: 12px var(--font-ui); }
.online-users[hidden], .online-users [hidden] { display: none; }
.online-users-row { display: flex; gap: var(--online-avatar-gap); align-items: center; }
.online-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 var(--online-avatar-size); width: var(--online-avatar-size); height: var(--online-avatar-size); border-radius: 50%; padding: 0; border: 1px solid var(--stroke); background: var(--card); color: var(--ink); font: 600 11px var(--font-ui); }
button.online-avatar { cursor: pointer; }
.online-avatar:focus-visible, .online-users-overflow-user:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.online-tone-0 { background: var(--online-tone-0-bg); color: var(--online-tone-0-ink); }
.online-tone-1 { background: var(--online-tone-1-bg); color: var(--online-tone-1-ink); }
.online-tone-2 { background: var(--online-tone-2-bg); color: var(--online-tone-2-ink); }
.online-tone-3 { background: var(--online-tone-3-bg); color: var(--online-tone-3-ink); }
.online-tone-4 { background: var(--online-tone-4-bg); color: var(--online-tone-4-ink); }
.online-tone-5 { background: var(--online-tone-5-bg); color: var(--online-tone-5-ink); }
.online-users-message { max-width: 108px; color: var(--muted); overflow-wrap: anywhere; }
.online-users-message[aria-label] { color: var(--negative); }
.online-users-popover { position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: min(var(--online-panel-width), calc(100vw - 2 * var(--online-panel-margin))); min-height: 44px; max-height: min(60vh, var(--online-panel-space, 60vh)); overflow: auto; padding: var(--space-sm); background: var(--card); color: var(--ink); border: 1px solid var(--stroke); border-radius: var(--foundation-radius-surface); font: 12px var(--font-ui); box-shadow: var(--foundation-surface-shadow); }
.online-users-popover-heading { position: sticky; top: calc(-1 * var(--space-sm)); display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); padding-block: var(--space-2xs); background: var(--card); }
.online-users-popover-content { display: grid; gap: var(--space-sm); padding-top: var(--space-xs); }
.online-user-information { display: grid; min-width: 0; gap: var(--space-2xs); text-align: left; overflow-wrap: anywhere; }
.online-user-information > span, .online-user-information small { color: var(--muted); }
.online-users-overflow-user { display: flex; align-items: center; width: 100%; gap: var(--space-xs); border: 0; padding: var(--space-2xs); background: transparent; color: inherit; font: inherit; cursor: pointer; }
@media (max-width: 600px) {
  .topbar-secondary { display: none; }
  .topbar-main { min-height: var(--foundation-control-height); }
  .topbar-main > .online-users { margin-left: auto; }
  .topbar-main > .brand { flex: 0 1 196px; min-width: 0; }
  .topbar-main > .brand .brand-logo { width: 100%; max-width: 196px; height: auto; }
}

/* Email hover is immediate, noninteractive and independent of the full hint. */
.online-users-hover { position: fixed; inset: auto; margin: 0; width: max-content; max-width: min(var(--online-panel-width), calc(100vw - 2 * var(--online-panel-margin))); box-sizing: border-box; padding: var(--space-xs); border: 1px solid var(--stroke); border-radius: var(--foundation-radius-control); background: var(--card); color: var(--ink); font: 12px var(--font-ui); overflow-wrap: anywhere; pointer-events: none; box-shadow: var(--foundation-surface-shadow); }

/* Shared compact shell. Page workspaces keep their own foundations and density. */
.topbar[data-foundation="compact"] { z-index: var(--z-topbar); gap: var(--space-sm); border-color: var(--stroke); }
.topbar[data-foundation="compact"] .topnav { min-width: 0; }
.topbar[data-foundation="compact"] .topnav-link { display: inline-flex; align-items: center; min-height: var(--foundation-control-height); font-size: var(--foundation-label-size); font-weight: var(--foundation-label-weight); line-height: var(--foundation-label-leading); letter-spacing: var(--foundation-label-tracking); background: var(--card); }
.topbar[data-foundation="compact"] .topnav-link:is(:hover,.is-active) { background: rgba(var(--accent-2-rgb), .12); color: var(--foundation-secondary-ink); border-color: rgba(var(--accent-2-rgb), .4); }
html .topbar[data-foundation="compact"] .theme-select { width: auto; flex: 0 0 auto; font-size: var(--foundation-label-size); }
.topbar[data-foundation="compact"] .breadcrumbs { letter-spacing: normal; text-transform: none; font-size: var(--foundation-label-size); line-height: var(--foundation-label-leading); border-color: var(--stroke); }
.topbar[data-foundation="compact"] .settings-status { flex-wrap: wrap; max-width: 100%; border-radius: var(--foundation-radius-control); color: var(--foundation-negative-ink); line-height: var(--foundation-label-leading); }
.topbar[data-foundation="compact"] .settings-status-retry { min-height: var(--foundation-control-height); padding-inline: var(--space-xs); }
.topbar[data-foundation="compact"] .access-preview-banner { font-size: var(--foundation-label-size); line-height: var(--foundation-label-leading); gap: var(--space-sm); }
@media (max-width: 600px) {
  .topbar[data-foundation="compact"] { gap: var(--space-xs); }
  html .topbar[data-foundation="compact"] .theme-select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .topbar[data-foundation="compact"] .topnav-link { transition: none; } }

html .topbar[data-foundation="compact"] .topbar-menu-toggle { display: none; color: var(--ink); }
@media (max-width: 600px) { html .topbar[data-foundation="compact"] .topbar-menu-toggle { display: inline-flex; } }

/* Terminal preview retains the shared presentation after the application body is cleared. */
.access-preview-ended[data-foundation="compact"] { margin: var(--space-md); max-inline-size: calc(100% - 2 * var(--space-md)); }
.access-preview-ended > .foundation-title { margin: 0; }
.access-preview-ended > .foundation-link { align-self: flex-start; }

/* Shared collapsible section; callers retain native or button disclosure state. */
.foundation-disclosure {
  --disclosure-header-gap: var(--space-md);
  --disclosure-header-padding: var(--space-md);
  min-width: 0;
  margin: 0;
  color: var(--ink);
}
.foundation-disclosure.is-row {
  --disclosure-header-gap: var(--space-sm);
  --disclosure-header-padding: var(--space-sm);
  border-block: 1px solid var(--stroke);
  background: rgba(var(--ink-rgb), 0.025);
}
.foundation-disclosure.is-panel {
  padding-inline: var(--space-md);
  border: 1px solid var(--stroke);
  border-radius: var(--foundation-radius-surface);
  background: var(--card);
  box-shadow: var(--foundation-surface-shadow);
}
.foundation-disclosure.is-panel[open] { padding-bottom: var(--space-md); }
.foundation-disclosure > .foundation-disclosure-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--disclosure-header-gap);
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 0 var(--disclosure-header-padding);
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-align: left;
  list-style: none;
  cursor: pointer;
}
.foundation-disclosure.is-panel > .foundation-disclosure-header {
  width: auto;
  min-height: 52px;
  margin-inline: calc(-1 * var(--space-md));
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.3;
}
.foundation-disclosure > .foundation-disclosure-header::-webkit-details-marker { display: none; }
.foundation-disclosure > .foundation-disclosure-header::before {
  content: "›";
  grid-column: 1;
  grid-row: 1;
  width: 12px;
  color: var(--muted);
  transform-origin: center;
  transition: transform 120ms ease;
}
.foundation-disclosure[open] > .foundation-disclosure-header::before,
.foundation-disclosure > .foundation-disclosure-header[aria-expanded="true"]::before { transform: rotate(90deg); }
.foundation-disclosure > .foundation-disclosure-header:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.foundation-disclosure-title { grid-column: 1; grid-row: 1; min-width: 0; padding-left: var(--space-lg); overflow-wrap: anywhere; }
.foundation-disclosure-meta { grid-column: 2; grid-row: 1; min-width: 0; max-width: 28ch; color: color-mix(in srgb, var(--muted), var(--ink) 12%); font-size: 12px; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.foundation-disclosure-meta.is-error { color: var(--foundation-negative-ink); }
.foundation-disclosure-meta.is-dirty { color: var(--foundation-warning-ink); }
.foundation-disclosure-body { min-width: 0; padding: var(--space-xs) var(--space-sm) var(--space-sm); }
.foundation-disclosure-body[hidden] { display: none; }
@media (max-width: 600px) {
  .foundation-disclosure { --disclosure-header-gap: var(--space-sm); }
  .foundation-disclosure.is-panel { padding-inline: var(--space-sm); --disclosure-header-padding: var(--space-sm); }
  .foundation-disclosure.is-panel > .foundation-disclosure-header { min-height: 56px; margin-inline: calc(-1 * var(--space-sm)); }
  .foundation-disclosure-title { padding-left: var(--space-md); }
  .foundation-disclosure-meta { max-width: min(132px, 36vw); }
}
@media (prefers-reduced-motion: reduce) {
  .foundation-disclosure > .foundation-disclosure-header::before { transition: none; }
}

/* Administrative affiliation, independent of active navigation or theme. */
.admin-icon { display: inline-block; width: 1.25em; height: 1.25em; flex: 0 0 auto; background-color: currentColor; mask: url("/assets/admin-icon-8cc0a352266d2d5b.svg") center / contain no-repeat; }
.admin-function-label { display: inline-flex; align-items: center; gap: var(--space-xs); }
/* Shared section navigation and account disclosures on every authenticated page. */
.topbar { --topbar-section-description-ink: color-mix(in srgb, var(--muted) 85%, var(--ink)); }
html .topbar[data-foundation="compact"] .topbar-menu-toggle { display: inline-flex; align-items: center; gap: var(--space-2xs); flex: 0 0 auto; color: var(--ink); }
.topbar-menu-chevron { width: 1em; height: 1em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar[data-foundation="compact"] .topbar-main { flex-wrap: nowrap; min-width: 0; gap: var(--space-md); }
.topbar[data-foundation="compact"] .brand { flex: 0 1 auto; min-width: 0; }
.topbar-current { flex: 1 1 auto; min-width: 0; font-size: var(--foundation-label-size); font-weight: var(--foundation-label-weight); overflow-wrap: anywhere; }
.topbar[data-foundation="compact"] .topbar-main > .online-users { margin-left: auto; min-width: calc(4 * var(--online-avatar-size) + 3 * var(--online-avatar-gap)); justify-content: flex-end; }
.topbar[data-foundation="compact"] .topbar-panel {
  position: fixed; top: var(--topbar-menu-top, 0px); z-index: var(--z-dropdown);
  right: auto; margin: 0;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; flex-wrap: nowrap;
  width: min(28rem, calc(100vw - 2 * var(--space-md))); box-sizing: border-box;
  max-height: calc(100dvh - var(--topbar-menu-top, 0px) - var(--space-sm)); overflow-y: auto; overscroll-behavior: contain;
  scroll-padding-block: var(--space-xs);
  gap: var(--space-xs); padding: var(--space-sm); border: 1px solid var(--stroke); border-radius: var(--foundation-radius-surface);
  background: var(--card); box-shadow: var(--foundation-surface-shadow);
}
.topbar .topbar-panel[hidden] { display: none; }
.topbar .topnav { left: var(--space-md); }
.topbar .topbar-account { right: var(--space-md); }
/* Компактный список повторяет композицию разделов главной. */
.topbar[data-foundation="compact"] .topnav { padding: var(--space-xs); background: var(--card); box-shadow: var(--shadow); }
.topnav-sections { flex: 0 0 auto; }
.topbar[data-foundation="compact"] .topnav-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: var(--space-xs);
  row-gap: var(--space-2xs);
  overflow-wrap: anywhere;
  flex: 0 0 auto;
  padding: var(--space-sm);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  letter-spacing: normal;
}
.topbar[data-foundation="compact"] .topnav-link + .topnav-link { border-top: 1px solid var(--stroke); }
.topbar[data-foundation="compact"] .topnav-link:first-child { border-start-start-radius: var(--foundation-radius-surface); border-start-end-radius: var(--foundation-radius-surface); }
.topbar[data-foundation="compact"] .topnav-link:last-child { border-end-start-radius: var(--foundation-radius-surface); border-end-end-radius: var(--foundation-radius-surface); }
.topbar[data-foundation="compact"] .topnav-link:hover { background: var(--bg); }
.topbar[data-foundation="compact"] .topnav-link.is-active { background: var(--bg); color: var(--ink); }
.topnav-title { grid-column: 1 / 3; grid-row: 1; font-size: var(--foundation-body-size); }
.topnav-title.admin-function-label { display: contents; }
.topnav-title .admin-icon { grid-column: 1; grid-row: 1; align-self: center; }
.topnav-title.admin-function-label > span:not(.admin-icon) { grid-column: 2; grid-row: 1; min-width: 0; }
.topnav-link .topnav-description { grid-column: 1 / 3; grid-row: 2; font-size: var(--foundation-label-size); font-weight: var(--foundation-body-weight); line-height: var(--foundation-body-leading); color: var(--topbar-section-description-ink); }
.topnav-title.admin-function-label + .topnav-description { grid-column: 2; }
.topnav-link::after { content: "→"; grid-column: 3; grid-row: 1 / 3; align-self: center; color: var(--accent-2-ink); }
.topbar-account-email { overflow-wrap: anywhere; font-weight: var(--foundation-label-weight); padding-bottom: var(--space-sm); border-bottom: 1px solid var(--stroke); }
.topbar-account-label, .topbar-theme-label { color: var(--ink); font-size: var(--foundation-label-size); }
html .topbar[data-foundation="compact"] .topbar-account .theme-select { width: 100%; }
.topbar-account form { margin: 0; }
.topbar-account .access-logout { width: 100%; }
@media (max-width: 600px) {
  .topbar[data-foundation="compact"] .topbar-main { flex-wrap: wrap; gap: var(--space-xs); }
  .topbar[data-foundation="compact"] .topbar-main > .brand { flex: 1 1 auto; max-width: calc(100% - 4 * var(--online-avatar-size) - 3 * var(--online-avatar-gap) - var(--space-xs)); }
  .topbar[data-foundation="compact"] .topbar-main > .brand .brand-logo { max-width: 196px; }
  .topbar-current { display: none; }
  .topbar[data-foundation="compact"] .topbar-main > .online-users { margin-left: auto; }
  .topbar[data-foundation="compact"] .topbar-panel { width: auto; inset-inline: var(--space-xs); }
  .topbar [data-sections-menu] { order: 1; }
  .topbar [data-topbar-menu] { order: 2; margin-left: auto; }
}
/* Presence reserves space beside the brand; the two phone menus share the next row. */
.topbar .online-users[hidden] { display: flex; visibility: hidden; }
@media (max-width: 600px) {
  .topbar[data-foundation="compact"] .topbar-main > .brand { flex: 1 0 50%; max-width: none; }
  .topbar[data-foundation="compact"] .topbar-main > .brand .brand-logo { max-width: 196px; }
  .topbar[data-foundation="compact"] .topbar-main > .online-users { order: 0; flex: 0 0 auto; min-height: var(--online-avatar-size); }
  .topbar [data-topbar-menu] { margin-left: auto; }
}

/* Shared detail actions: optical alignment belongs to SVG, not font metrics. */
html .icon-button:is(.is-navigation, .is-close) { padding: 0; }
html .icon-button:is(.is-navigation, .is-close) svg { display: block; width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
html .icon-button.is-navigation svg { stroke-linecap: butt; stroke-linejoin: miter; }
html .icon-button.is-close svg { width: 12px; height: 12px; stroke-width: 2.75; }
html .icon-button.is-navigation { background: rgba(var(--ink-rgb), .07); color: var(--ink); border-color: transparent; }
html .icon-button.is-close { background: var(--accent-ink); color: var(--card); border-color: transparent; }
html[data-theme="dark"] .icon-button.is-close { color: var(--bg); }
html .icon-button:is(.is-navigation, .is-close):hover:not(:disabled) { filter: brightness(1.05); }
html .icon-button:is(.is-navigation, .is-close):focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
html .icon-button:is(.is-navigation, .is-close):disabled { opacity: .6; cursor: not-allowed; }
html .icon-button.is-navigation:disabled { color: rgba(var(--ink-rgb), .25); }

/* Lightweight icon actions keep the shared button geometry and focus ring. */
html .icon-button.is-plain {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
html .icon-button.is-plain:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(var(--ink-rgb), .06);
  color: var(--ink);
}
html .icon-button.is-plain:active:not(:disabled) { background: rgba(var(--ink-rgb), .1); }
html .icon-button.is-plain.is-copied:not(:disabled) { color: var(--positive); }
html .icon-button.is-plain:disabled { opacity: .45; cursor: default; }
.list-toggle-button .icon-button-glyph { mask: url("/assets/list-closed-icon-550677fc27158339.svg") center / contain no-repeat; }
.list-toggle-button[aria-expanded="true"] .icon-button-glyph { mask-image: url("/assets/list-open-icon-803050dcf8c20045.svg"); }
