/* ============================================================
   INVA DESIGN SYSTEM — components.css
   Canonical component library (DESIGN_SYSTEM.md §5).
   Loaded after tokens.css, before page CSS.
   Phase 0: utilities + focus ring + reduced motion + theme picker.
   ============================================================ */

/* ---------- Utilities ---------- */
/* .loading-screen uses .hidden for an opacity fade (dashboard.css/admin.css) — excluded */
.hidden:not(.loading-screen) { display: none !important; }

/* ---------- Focus ring base ---------- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Theme picker ---------- */
.theme-picker {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.theme-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  color: var(--ink-3);
  font: 600 var(--fs-2xs)/16px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.theme-swatch::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
}
.theme-swatch[data-t="midnight-gold"]::before { background: var(--swatch-midnight-gold); }
.theme-swatch[data-t="polaris"]::before       { background: var(--swatch-polaris); }
.theme-swatch[data-t="aurora"]::before        { background: var(--swatch-aurora); }
.theme-swatch[data-t="obsidian-platinum"]::before { background: var(--swatch-obsidian-platinum); }
.theme-swatch[data-t="quantum-gold"]::before  { background: var(--swatch-quantum-gold); }
.theme-swatch[data-t="void-cyan"]::before     { background: var(--swatch-void-cyan); }
.theme-swatch:hover { border-color: var(--border-2); color: var(--ink-2); }
:root[data-theme="midnight-gold"] .theme-swatch[data-t="midnight-gold"],
:root[data-theme="polaris"] .theme-swatch[data-t="polaris"],
:root[data-theme="aurora"] .theme-swatch[data-t="aurora"],
:root[data-theme="obsidian-platinum"] .theme-swatch[data-t="obsidian-platinum"],
:root[data-theme="quantum-gold"] .theme-swatch[data-t="quantum-gold"],
:root[data-theme="void-cyan"] .theme-swatch[data-t="void-cyan"] {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink-1);
}
/* Premium theme button styling */
.theme-swatch--premium {
  position: relative;
  border-color: var(--accent-deep);
  border-width: 2px;
}
.theme-swatch--premium .premium-badge {
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.9;
}
.theme-swatch--premium:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}
/* Compact dots-only variant (admin topbar / tight chrome) */
.theme-picker--dots .theme-swatch .theme-swatch__label { display: none; }
/* Subtle, compact dots (status bar): muted bare dots, no pill/star, ring when active */
.theme-picker--dots { gap: var(--sp-1); }
.theme-picker--dots .theme-swatch {
  padding: 2px;
  border: none;
  background: transparent;
}
.theme-picker--dots .theme-swatch::before {
  width: 9px;
  height: 9px;
  opacity: 0.38;
  box-shadow: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.theme-picker--dots .theme-swatch:hover::before { opacity: 0.85; }
.theme-picker--dots .premium-badge { display: none; }
/* Active theme dot: full color + a quiet selection ring (overrides the pill active state) */
:root[data-theme="midnight-gold"] .theme-picker--dots .theme-swatch[data-t="midnight-gold"],
:root[data-theme="polaris"] .theme-picker--dots .theme-swatch[data-t="polaris"],
:root[data-theme="aurora"] .theme-picker--dots .theme-swatch[data-t="aurora"],
:root[data-theme="obsidian-platinum"] .theme-picker--dots .theme-swatch[data-t="obsidian-platinum"],
:root[data-theme="quantum-gold"] .theme-picker--dots .theme-swatch[data-t="quantum-gold"],
:root[data-theme="void-cyan"] .theme-picker--dots .theme-swatch[data-t="void-cyan"] {
  background: transparent;
  border: none;
  box-shadow: none;
}
:root[data-theme="midnight-gold"] .theme-picker--dots .theme-swatch[data-t="midnight-gold"]::before,
:root[data-theme="polaris"] .theme-picker--dots .theme-swatch[data-t="polaris"]::before,
:root[data-theme="aurora"] .theme-picker--dots .theme-swatch[data-t="aurora"]::before,
:root[data-theme="obsidian-platinum"] .theme-picker--dots .theme-swatch[data-t="obsidian-platinum"]::before,
:root[data-theme="quantum-gold"] .theme-picker--dots .theme-swatch[data-t="quantum-gold"]::before,
:root[data-theme="void-cyan"] .theme-picker--dots .theme-swatch[data-t="void-cyan"]::before {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--surface-0), 0 0 0 3px var(--ink-3);
}
@media (max-width: 900px) {
  .theme-swatch { padding: 4px; }
  .theme-picker:not(.theme-menu-panel) .theme-swatch .theme-swatch__label { display: none; }
}

/* ---------- Theme menu (single dot → expandable labeled list) ---------- */
.theme-menu { position: relative; display: inline-flex; }
.theme-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.theme-menu-trigger:hover { border-color: var(--border-2); }
.theme-menu-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.45);
}
.theme-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  z-index: var(--z-dropdown);
}
.theme-menu.open .theme-menu-panel {
  display: flex;
  animation: themeMenuIn var(--dur-base) var(--ease-out);
}
@keyframes themeMenuIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.theme-menu-panel #premiumThemesContainer { flex-direction: column; gap: 2px; }
.theme-menu-group-label {
  font: 600 var(--fs-2xs)/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 8px 3px;
}
/* Rows: full-width, readable theme names */
.theme-menu-panel .theme-swatch {
  width: 100%;
  justify-content: flex-start;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border-color: transparent;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}
.theme-menu-panel .theme-swatch:hover { background: var(--surface-3); color: var(--ink-1); }
.theme-menu-panel .theme-swatch--premium { border-width: 1px; }
.theme-menu-panel .theme-swatch::before { width: 13px; height: 13px; }

/* ============================================================
   Phase 2 — Canonical component library (DESIGN_SYSTEM.md §5)
   Legacy class names are grouped into the canonical rules so
   JS-generated markup keeps working. Phase 5 audit (2026-06-10):
   every alias (.btn-primary/.btn-secondary/.btn-danger/.btn-success/
   .btn-warning/.btn-small/.submit-btn/.badge-*/.pill.ok|warn|alert|info/
   .card-header) is still emitted by JS templates or live HTML —
   all aliases are KEPT. New code should use the canonical
   .btn--*/.pill--*/.card__head names.
   ============================================================ */

/* ---------- §5.1 Buttons — ONE system ---------- */
/* Base. Bare .btn (no variant) renders the secondary/neutral skin,
   matching legacy semantics across both shells. */
.btn,
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 22px;
  font-weight: 600;
  padding: 10px var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-1);
  background: var(--surface-2);
  color: var(--ink-1);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn:hover:not(:disabled),
.submit-btn:hover:not(:disabled) {
  border-color: var(--border-2);
  background: var(--surface-3);
}
.btn:active:not(:disabled),
.submit-btn:active:not(:disabled) { transform: translateY(1px); }

.btn--primary, .btn-primary, .btn.btn-primary,
.submit-btn {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: var(--accent-ink);
  border-color: var(--accent-deep);
  box-shadow: var(--shadow-1);
}
.btn--primary:hover:not(:disabled), .btn-primary:hover:not(:disabled),
.btn.btn-primary:hover:not(:disabled), .submit-btn:hover:not(:disabled) {
  background: var(--accent-hi);
  border-color: var(--accent-deep);
  color: var(--accent-ink);
}
.btn--primary:active:not(:disabled), .btn-primary:active:not(:disabled),
.btn.btn-primary:active:not(:disabled), .submit-btn:active:not(:disabled) {
  background: var(--accent-deep);
}

.btn--secondary, .btn-secondary {
  background: var(--surface-2);
  color: var(--ink-1);
  border: 1px solid var(--border-1);
  box-shadow: none;
}
.btn--secondary:hover:not(:disabled), .btn-secondary:hover:not(:disabled) {
  border-color: var(--border-2);
  background: var(--surface-3);
  color: var(--ink-1);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
  box-shadow: none;
}
.btn--ghost:hover:not(:disabled) {
  color: var(--ink-1);
  background: var(--surface-2);
  border-color: transparent;
}

.btn--danger, .btn-danger {
  background: var(--negative-soft);
  color: var(--negative);
  border: 1px solid rgba(var(--negative-rgb), 0.3);
  box-shadow: none;
}
.btn--danger:hover:not(:disabled), .btn-danger:hover:not(:disabled) {
  background: var(--negative);
  border-color: var(--negative);
  color: var(--surface-0);
}

.btn--positive, .btn-success {
  background: var(--positive-soft);
  color: var(--positive);
  border: 1px solid rgba(var(--positive-rgb), 0.3);
  box-shadow: none;
}
.btn--positive:hover:not(:disabled), .btn-success:hover:not(:disabled) {
  background: var(--positive);
  border-color: var(--positive);
  color: var(--surface-0);
}

.btn--caution, .btn-warning {
  background: var(--caution-soft);
  color: var(--caution);
  border: 1px solid rgba(var(--caution-rgb), 0.3);
  box-shadow: none;
}
.btn--caution:hover:not(:disabled), .btn-warning:hover:not(:disabled) {
  background: var(--caution);
  border-color: var(--caution);
  color: var(--surface-0);
}

.btn--sm, .btn-small {
  padding: 6px var(--sp-3);
  font-size: var(--fs-sm);
  line-height: 20px;
  border-radius: var(--r-sm);
}
.btn--lg {
  padding: 12px var(--sp-5);
  font-size: var(--fs-lg);
  line-height: 24px;
}

.btn:disabled, .submit-btn:disabled, .btn.is-loading {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  animation: dsSpin 0.7s linear infinite;
}

/* ---------- §5.2 Card / Panel — ONE base ----------
   NOTE: .panel (ofp-viewer) deliberately NOT aliased yet — its inline
   styles assume zero padding on .panel (padding lives on .panel-body).
   Converge in Phase 4 (OFP viewer polish). */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-1);
}
.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
}
.card__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 24px;
  font-weight: 700;
  color: var(--ink-1);
}
.card--compact { padding: var(--sp-4); }
.card--interactive { cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.card--interactive:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.card--accent { border-top: 2px solid var(--accent); }
/* Legacy card header (both shells use .card-header inside .card) */
.card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-1);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border-1);
}

/* ---------- §5.3 Status pills & badges ---------- */
.pill,
.badge-active, .badge-completed, .badge-upcoming {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill--positive, .pill.ok, .badge-completed { color: var(--positive); background: var(--positive-soft); border-color: rgba(var(--positive-rgb), 0.3); }
.pill--caution, .pill.warn { color: var(--caution);  background: var(--caution-soft);  border-color: rgba(var(--caution-rgb), 0.3); }
.pill--negative, .pill.alert { color: var(--negative); background: var(--negative-soft); border-color: rgba(var(--negative-rgb), 0.3); }
.pill--info, .pill.info, .badge-upcoming { color: var(--info); background: var(--info-soft); border-color: rgba(var(--info-rgb), 0.3); }
.pill--accent, .badge-active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.pill--neutral  { color: var(--ink-3); background: var(--surface-2); border-color: var(--border-1); }
.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- §5.4 Form controls ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.input, .select, .textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  color: var(--ink-1);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 22px;
  padding: 10px var(--sp-3);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.input--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.field__hint  { font-size: var(--fs-xs); line-height: 18px; color: var(--ink-3); }
.field__error { font-size: var(--fs-xs); line-height: 18px; color: var(--negative); }
.input[readonly] {
  background: var(--surface-1);
  color: var(--ink-2);
  border-style: dashed;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--sp-7);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23646c79' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
}

/* ---------- §5.5 Tables & grid-lists ---------- */
.dtable {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.dtable__head {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-1);
}
.dtable__head--sticky {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--surface-1) 85%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
}
.dtable__row {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-1);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.dtable__row:last-child { border-bottom: none; }
.dtable__row:hover { background: var(--surface-2); }
.dtable__row.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.dtable__num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- §5.6 Modals — ONE overlay pattern ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  animation: dsFade var(--dur-base) var(--ease-out);
}
.dialog {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  max-width: 560px;
  padding: var(--sp-6);
  animation: dsRise var(--dur-base) var(--ease-out);
}
.dialog__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.dialog__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 28px;
  font-weight: 700;
  color: var(--ink-1);
}
.dialog--full {
  position: fixed;
  inset: var(--sp-4);
  max-width: none;
  width: auto;
  height: auto;
}

/* ---------- §5.7 Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border-1);
}
.tab {
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 22px;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--ink-1); background: var(--surface-2); }
.tab.is-active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------- §5.8 KPI / stat blocks ---------- */
.kpi {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-1);
}
.kpi__label {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  line-height: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.kpi__value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  line-height: 32px;
  font-weight: 800;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.kpi__delta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
.kpi__delta.is-up   { color: var(--positive); }
.kpi__delta.is-up::before   { content: "▲ "; }
.kpi__delta.is-down { color: var(--negative); }
.kpi__delta.is-down::before { content: "▼ "; }
.kpi--hero .kpi__value {
  color: var(--accent);
  text-shadow: none;
}
.kpi--hero { box-shadow: var(--shadow-1), var(--glow-accent); }

/* ---------- §5.10 Toasts, empty states, loaders ---------- */
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--info);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  padding: var(--sp-3) var(--sp-4);
  color: var(--ink-1);
  font-size: var(--fs-md);
  z-index: var(--z-toast);
  animation: dsRise var(--dur-base) var(--ease-out);
}
.toast--positive { border-left-color: var(--positive); }
.toast--caution  { border-left-color: var(--caution); }
.toast--negative { border-left-color: var(--negative); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  text-align: center;
  padding: var(--sp-9) var(--sp-5);
  color: var(--ink-3);
}
.empty__icon { width: 40px; height: 40px; color: var(--ink-3); }
.empty__title { font-size: var(--fs-lg); line-height: 24px; color: var(--ink-2); font-weight: 600; }
.empty__hint  { font-size: var(--fs-sm); line-height: 20px; color: var(--ink-3); }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-1);
  border-top-color: var(--accent);
  animation: dsSpin 0.7s linear infinite;
}
.spinner--lg { width: 24px; height: 24px; }

/* ============================================================
   Phase 3 — inline-style purge utilities (DESIGN_SYSTEM.md §8)
   Small, single-purpose classes replacing repeated inline styles
   in the shell HTML files. Keep this set minimal.
   ============================================================ */
.u-right   { text-align: right; }
.u-center  { text-align: center; }
.u-upper   { text-transform: uppercase; }
.u-pointer { cursor: pointer; }
.u-flex-1  { flex: 1; }
.u-ml-auto { margin-left: auto; }
.u-scroll-x { overflow-x: auto; }

.u-hint    { color: var(--ink-3); font-size: var(--fs-xs); }
.u-muted   { color: var(--ink-2); }
.u-accent  { color: var(--accent); }
.u-accent-strong { color: var(--accent); font-weight: 600; }

/* Flex/layout shorthands */
.u-flex-between { display: flex; justify-content: space-between; align-items: center; }
.u-flex-center  { display: flex; align-items: center; gap: var(--sp-3); }

/* Card section header: title row with bottom rule (dashboard panels) */
.u-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border-1);
  margin-bottom: var(--sp-5);
}

/* Centered empty/loading placeholder inside panels and tables */
.u-empty {
  text-align: center;
  padding: var(--sp-8) 0;
  color: var(--ink-3);
}

/* Accent-tinted callout box (info banners inside modals/panels) */
.u-callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
/* Info-tinted variant (blue left-rule note) */
.u-callout--info {
  background: rgba(var(--info-rgb), 0.10);
  border: none;
  border-left: 4px solid var(--info);
  border-radius: var(--r-sm);
}

/* Big stat value under a label (admin/dashboard stat tiles) */
.u-stat-value {
  color: var(--ink-1);
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-top: var(--sp-1);
}

/* Checkbox/radio row label */
.u-check-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--ink-2);
  cursor: pointer;
}

/* Inset soft tile (subtle raised box inside cards) */
.u-tile {
  background: rgba(var(--ink-rgb), 0.04);
  border-radius: var(--r-sm);
  padding: var(--sp-3);
}

/* Spacing helpers (scale-normalized) */
.u-m-0   { margin: 0; }
.u-mb-5  { margin-bottom: var(--sp-5); }
.u-pad-3 { padding: var(--sp-3); }

/* Plain table header cell (accent label + rule) */
.u-th {
  padding: var(--sp-3);
  text-align: left;
  color: var(--accent);
  border-bottom: 2px solid var(--accent-line);
}

/* Mono micro-label (eyebrow) */
.u-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--surface-3), transparent);
  animation: dsShimmer 1.6s var(--ease-in-out) infinite;
}

/* ---------- Shared keyframes ---------- */
@keyframes dsSpin { to { transform: rotate(360deg); } }
@keyframes dsFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dsRise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   INVA LOADER  (site-wide, theme-reactive)
   One consistent minimal loader: a rotating accent arc over a
   faint track ring. Recolours with the active theme via --accent
   tokens. Two sizes (full/overlay + inline). Reduced-motion safe.
   Markup is produced by INVALoader (assets/js/shell-runtime.js).
   Prefix: inva-l-
   ============================================================ */
.inva-l {
  --inva-l-size: 76px;
  --inva-l-stroke: 2px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--accent);
}
.inva-l-dial {
  position: relative;
  width: var(--inva-l-size);
  height: var(--inva-l-size);
  flex: 0 0 auto;
}
.inva-l-dial svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* static outer ring */
.inva-l-ring {
  fill: none;
  stroke: var(--border-2);
  stroke-width: var(--inva-l-stroke);
}
/* rotating arc segment */
.inva-l-sweep {
  fill: none;
  stroke: var(--accent);
  stroke-width: var(--inva-l-stroke);
  stroke-linecap: round;
  stroke-dasharray: 30 90;
  transform-origin: 50% 50%;
  animation: invaLSweep 0.8s linear infinite;
}

.inva-l-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  animation: invaLPulse 1.8s ease-in-out infinite;
}

@keyframes invaLSweep { to { transform: rotate(360deg); } }
@keyframes invaLPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* --- inline / small variant --- */
.inva-l--sm { gap: 10px; }
.inva-l--sm .inva-l-dial { --inva-l-size: 40px; --inva-l-stroke: 1.6px; }
.inva-l--sm .inva-l-label { font-size: 9px; letter-spacing: 0.14em; }
.inva-l--row { flex-direction: row; gap: 12px; }

/* --- full-page / section overlay wrapper --- */
.inva-l-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 100%;
  padding: 40px 16px;
}
.inva-l-overlay.inva-l-overlay--fixed {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface-0) 82%, transparent);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* Reduced motion: hold a gentle pulse, no spinning */
@media (prefers-reduced-motion: reduce) {
  .inva-l-sweep { animation: invaLPulse 2s ease-in-out infinite; }
  .inva-l-label { animation: none; }
}
@keyframes dsShimmer { to { transform: translateX(100%); } }
