/* Global theme + component system for the dashboard UI.
   Scoped under body.app to avoid affecting admin pages. */

:root {
  --app-bg-0: #f6f7ff;
  --app-bg-1: #eff6ff;
  --app-bg-2: #ecfeff;

  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-2: rgba(248, 250, 252, 0.92);

  --text: #0f172a;
  --muted: #475569;
  --muted-2: #64748b;

  --border: rgba(15, 23, 42, 0.10);
  --border-2: rgba(15, 23, 42, 0.14);

  --shadow: 0 12px 30px rgba(2, 6, 23, 0.08);
  --shadow-soft: 0 10px 25px rgba(2, 6, 23, 0.06);

  --radius: 18px;
  --radius-sm: 12px;

  --primary: #2563eb;
  --primary-2: #7c3aed;
  --primary-ink: #0b1d52;

  --good: #16a34a;
  --warn: #f59e0b;
  --bad: #dc2626;
  --info: #0ea5e9;

  --focus: 0 0 0 4px rgba(37, 99, 235, 0.20);
}

body.app {
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(124, 58, 237, 0.20), transparent 60%),
    radial-gradient(900px 600px at 92% 0%, rgba(14, 165, 233, 0.18), transparent 55%),
    radial-gradient(900px 700px at 40% 110%, rgba(34, 197, 94, 0.12), transparent 55%),
    linear-gradient(180deg, var(--app-bg-0), var(--app-bg-1) 45%, var(--app-bg-2));
}

body.app ::selection {
  background: rgba(37, 99, 235, 0.25);
}

/* Layout */
.app-shell {
  min-height: 100vh;
}

.app-main {
  position: relative;
}

/* Header + nav */
.app-header {
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-brand {
  letter-spacing: -0.01em;
}

.app-navlink {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.70rem;
  border-radius: 999px;
  color: rgba(15, 23, 42, 0.72);
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.app-navlink:hover {
  background: rgba(37, 99, 235, 0.08);
  color: rgba(15, 23, 42, 0.92);
}

.app-navlink--active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.16), rgba(124, 58, 237, 0.12));
  color: rgba(15, 23, 42, 0.95);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

/* Cards */
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.app-card--solid {
  background: var(--surface-solid);
}

.app-card--soft {
  background: var(--surface-2);
}

.app-card:hover {
  box-shadow: var(--shadow);
}

.app-card__hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-card__title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.app-card__meta {
  font-size: 12px;
  color: var(--muted-2);
}

/* KPI cards */
.app-kpi {
  position: relative;
  overflow: hidden;
}

.app-kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.75), rgba(124, 58, 237, 0.75));
}

.app-kpi--bad::before { background: linear-gradient(90deg, rgba(220, 38, 38, 0.85), rgba(249, 115, 22, 0.75)); }
.app-kpi--good::before { background: linear-gradient(90deg, rgba(22, 163, 74, 0.85), rgba(14, 165, 233, 0.65)); }
.app-kpi--warn::before { background: linear-gradient(90deg, rgba(245, 158, 11, 0.90), rgba(124, 58, 237, 0.55)); }
.app-kpi--info::before { background: linear-gradient(90deg, rgba(14, 165, 233, 0.90), rgba(37, 99, 235, 0.70)); }

/* Buttons */
.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-2);
  background: rgba(255, 255, 255, 0.75);
  color: rgba(15, 23, 42, 0.86);
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, color 140ms ease;
}

.app-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.08);
  transform: translateY(-1px);
}

.app-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.app-btn--primary {
  border-color: rgba(37, 99, 235, 0.30);
  color: #fff;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.98), rgba(124, 58, 237, 0.92));
}

.app-btn--primary:hover {
  background: linear-gradient(90deg, rgba(37, 99, 235, 1), rgba(124, 58, 237, 0.98));
}

.app-btn--danger {
  border-color: rgba(220, 38, 38, 0.25);
  color: #fff;
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.96), rgba(249, 115, 22, 0.86));
}

.app-btn--ghost {
  background: transparent;
}

.app-btn--sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: 10px;
}

/* Inputs */
.app-input,
.app-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-2);
  background: rgba(255, 255, 255, 0.80);
  padding: 0.55rem 0.8rem;
  font-size: 0.875rem;
  color: rgba(15, 23, 42, 0.9);
  transition: box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.app-input:focus,
.app-select:focus {
  outline: none;
  box-shadow: var(--focus);
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(255, 255, 255, 0.94);
}

.app-help {
  font-size: 12px;
  color: var(--muted-2);
}

/* Chips */
.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: rgba(15, 23, 42, 0.82);
}

.app-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--muted-2);
  margin-bottom: 0.75rem;
}
.app-breadcrumb a { color: var(--muted-2); text-decoration: none; }
.app-breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.app-breadcrumb span:last-child { color: var(--text); font-weight: 500; }

.app-chip:hover {
  background: rgba(37, 99, 235, 0.09);
}

/* Tables */
.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.app-table thead th {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(71, 85, 105, 0.92);
  background: rgba(255, 255, 255, 0.66);
  position: sticky;
  top: 0;
  z-index: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-table tbody tr {
  transition: background-color 140ms ease;
}

.app-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

.app-table td,
.app-table th {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .app-navlink,
  .app-card,
  .app-btn,
  .app-table tbody tr {
    transition: none !important;
  }
  .app-btn:hover {
    transform: none;
  }
}

/* ─── Typography ────────────────────────────────────────────── */
body.app {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Brand mark ─────────────────────────────────────────────── */
.app-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, #dc2626, #b91c1c);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(185, 28, 28, 0.35);
}

.app-brand-wordmark {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  color: var(--text);
  line-height: 1.1;
}

.app-brand-wordmark span {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ─── Nav group + dropdown ────────────────────────────────────── */
.app-nav-group {
  position: relative;
}

.app-nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.42rem 0.70rem;
  border-radius: 999px;
  color: rgba(15, 23, 42, 0.72);
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background-color 160ms ease, color 160ms ease;
  white-space: nowrap;
}

.app-nav-trigger:hover,
.app-nav-trigger[aria-expanded="true"] {
  background: rgba(37, 99, 235, 0.08);
  color: rgba(15, 23, 42, 0.92);
}

.app-nav-trigger--active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.16), rgba(124, 58, 237, 0.12));
  color: rgba(15, 23, 42, 0.95);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.app-nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 196px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(2, 6, 23, 0.12), 0 4px 14px rgba(2, 6, 23, 0.06);
  padding: 6px;
  z-index: 200;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.app-nav-dropdown__label {
  display: block;
  padding: 0.35rem 0.75rem 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.app-nav-dropdown__item {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 9px;
  font-size: 0.8125rem;
  color: rgba(15, 23, 42, 0.80);
  transition: background-color 100ms ease, color 100ms ease;
  white-space: nowrap;
  text-decoration: none;
}

.app-nav-dropdown__item:hover {
  background: rgba(37, 99, 235, 0.07);
  color: rgba(15, 23, 42, 0.95);
}

.app-nav-dropdown__item--active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.08));
  color: #1d4ed8;
  font-weight: 500;
}

.app-nav-dropdown__divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
  margin: 4px 6px;
}

/* ─── Page header ────────────────────────────────────────────── */
.app-page-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.app-page-hd__eyebrow {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.app-page-hd__title {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.028em;
  color: var(--text);
  line-height: 1.15;
}

.app-page-hd__sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.5;
}

.app-page-hd__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  padding-top: 0.125rem;
}

/* ─── Mobile tweaks ──────────────────────────────────────────── */
@media (max-width: 639px) {
  .app-page-hd__title { font-size: 1.25rem; }
  .app-page-hd__actions { width: 100%; }
  .app-kpi .text-3xl { font-size: 1.5rem; }
  .app-kpi .text-2xl { font-size: 1.25rem; }
}

/* ─── Chart containers ───────────────────────────────────────── */
.app-chart {
  position: relative;
  width: 100%;
  overflow: hidden;            /* clip any canvas resize-loop overflow */
}

.app-chart--sm { height: 180px; }
.app-chart--md { height: 260px; }
.app-chart--lg { height: 340px; }
.app-chart--xl { height: 440px; }

/*
 * Chart.js 4 uses ResizeObserver on the canvas parent.
 * absolute positioning caused a resize feedback loop where Chart.js
 * set ever-growing inline dimensions on the canvas.
 * Instead, let the sized container constrain the canvas naturally.
 */
.app-chart canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Skeleton loading pulse — shown until chart.js initialises the canvas */
.app-chart:not(.app-chart--loaded)::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  z-index: 1;
}
.app-chart--loaded::before { display: none; }

/* Save-as-PNG button — top-right corner of chart container */
.app-chart__save {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  z-index: 2;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.app-chart:hover .app-chart__save { opacity: 1; }
.app-chart__save:hover {
  background: #fff;
  border-color: rgba(0,0,0,0.18);
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Card variants ──────────────────────────────────────────── */
.app-card--elevated {
  box-shadow: 0 20px 48px rgba(2, 6, 23, 0.10), 0 4px 14px rgba(2, 6, 23, 0.06);
}

.app-card--accent      { border-left: 3px solid var(--primary); }
.app-card--accent-bad  { border-left: 3px solid var(--bad); }
.app-card--accent-good { border-left: 3px solid var(--good); }
.app-card--accent-warn { border-left: 3px solid var(--warn); }

/* ─── Ghost button fix ───────────────────────────────────────── */
.app-btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.app-btn--ghost:hover {
  background: rgba(15, 23, 42, 0.05);
  box-shadow: none;
  transform: none;
}

/* ─── Skeleton shimmer ───────────────────────────────────────── */
@keyframes app-shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

.app-skeleton {
  background: linear-gradient(
    90deg,
    rgba(241, 245, 249, 0.8) 25%,
    rgba(226, 232, 240, 0.9) 50%,
    rgba(241, 245, 249, 0.8) 75%
  );
  background-size: 200% 100%;
  animation: app-shimmer 1.5s infinite;
  border-radius: 8px;
}

/* ─── Section header ─────────────────────────────────────────── */
.app-section-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.app-section-hd__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.app-section-hd__meta {
  font-size: 0.75rem;
  color: var(--muted-2);
}

/* ─── Table dense mode ───────────────────────────────────────── */
.app-table--dense td,
.app-table--dense th {
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
}

/* ─── Reduce motion additions ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .app-skeleton { animation: none; }
  .app-nav-trigger svg { transition: none; }
}

/* ─── Toast notifications ────────────────────────────────────── */
.app-toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}
.app-toast {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  color: var(--text);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.25s, transform 0.25s;
}
.app-toast--visible { opacity: 1; transform: translateY(0); }
.app-toast--error { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }

/* ─── Modal ──────────────────────────────────────────────────── */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}
.app-modal-backdrop[hidden] { display: none; }
.app-modal {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.app-kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ─── Focus indicators ───────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.app-btn:focus-visible,
.app-input:focus-visible,
.app-navlink:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* ─── Print styles ───────────────────────────────────────────── */
@media print {
  .app-header, .app-perf-footer, .app-toast-container,
  .app-modal-backdrop, .app-chart__save,
  .app-breadcrumb, [data-copy-link],
  button[type="submit"], a.app-btn,
  .htmx-indicator { display: none !important; }

  body.app { background: white; }
  .app-main { padding: 0; max-width: none; }
  .app-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .app-chart { break-inside: avoid; }
  .app-table { font-size: 9pt; }
  .app-table thead th { background: #f3f4f6 !important; color: #111 !important; }

  @page { margin: 1.5cm; }
}

/* ─── Page loading bar ───────────────────────────────────────── */
.app-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  z-index: 100;
  width: 0;
  opacity: 0;
  transition: width 0.3s ease, opacity 0.2s;
}
.app-loading-bar--active {
  opacity: 1;
  animation: loading-bar 1.8s ease-in-out infinite;
}
@keyframes loading-bar {
  0% { width: 0; }
  50% { width: 70%; }
  100% { width: 90%; }
}
.app-loading-bar--done { width: 100% !important; opacity: 0; transition: width 0.15s, opacity 0.4s 0.15s; }

/* ─── Back to top ────────────────────────────────────────────── */
.app-back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 45;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.app-back-to-top--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.app-back-to-top:hover { color: var(--text); box-shadow: var(--shadow); }

/* ─── Staff perf footer ──────────────────────────────────────── */
.app-perf-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  display: flex;
  gap: 1rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.65rem;
  font-family: ui-monospace, monospace;
  color: rgba(100, 116, 139, 0.8);
  background: rgba(248, 250, 252, 0.9);
  border-top-left-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 0;
  border-bottom: 0;
  z-index: 50;
  pointer-events: none;
}

/* ─── Dark mode ──────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --app-bg-0: #0d0f1a;
    --app-bg-1: #0f1220;
    --app-bg-2: #101521;

    --surface: rgba(22, 26, 42, 0.88);
    --surface-solid: #181c2e;
    --surface-2: rgba(20, 24, 38, 0.92);

    --text: #e2e8f0;
    --muted: #94a3b8;
    --muted-2: #64748b;

    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.12);

    --shadow: 0 12px 30px rgba(0, 0, 0, 0.40);
    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.30);

    --primary: #60a5fa;
    --primary-2: #a78bfa;
    --primary-ink: #bfdbfe;

    --good: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    --info: #38bdf8;

    --focus: 0 0 0 4px rgba(96, 165, 250, 0.30);
  }

  body.app {
    background:
      radial-gradient(1100px 700px at 12% -10%, rgba(124, 58, 237, 0.12), transparent 60%),
      radial-gradient(900px 600px at 92% 0%, rgba(14, 165, 233, 0.10), transparent 55%),
      radial-gradient(900px 700px at 40% 110%, rgba(34, 197, 94, 0.07), transparent 55%),
      linear-gradient(180deg, var(--app-bg-0), var(--app-bg-1) 45%, var(--app-bg-2));
  }

  body.app ::selection {
    background: rgba(96, 165, 250, 0.30);
  }

  .app-header {
    background: rgba(15, 18, 32, 0.80);
  }

  .app-navlink {
    color: rgba(226, 232, 240, 0.72);
  }

  .app-navlink:hover {
    background: rgba(96, 165, 250, 0.10);
    color: rgba(226, 232, 240, 0.95);
  }

  .app-navlink--active {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.18), rgba(167, 139, 250, 0.14));
    color: rgba(226, 232, 240, 0.98);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.20);
  }

  .app-nav-trigger {
    color: rgba(226, 232, 240, 0.72);
    background: transparent;
  }

  .app-nav-trigger:hover,
  .app-nav-trigger[aria-expanded="true"] {
    background: rgba(96, 165, 250, 0.10);
    color: rgba(226, 232, 240, 0.95);
  }

  .app-nav-trigger--active {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.18), rgba(167, 139, 250, 0.14));
    color: rgba(226, 232, 240, 0.98);
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.20);
  }

  .app-nav-dropdown {
    background: rgba(22, 26, 42, 0.97);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.50), 0 4px 14px rgba(0, 0, 0, 0.30);
  }

  .app-nav-dropdown__item {
    color: rgba(226, 232, 240, 0.80);
  }

  .app-nav-dropdown__item:hover {
    background: rgba(96, 165, 250, 0.09);
    color: rgba(226, 232, 240, 0.98);
  }

  .app-nav-dropdown__item--active {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.15), rgba(167, 139, 250, 0.10));
    color: #93c5fd;
  }

  .app-nav-dropdown__divider {
    background: rgba(255, 255, 255, 0.08);
  }

  .app-btn {
    background: rgba(30, 36, 56, 0.85);
    color: rgba(226, 232, 240, 0.88);
    border-color: var(--border-2);
  }

  .app-btn:hover {
    background: rgba(40, 48, 72, 0.92);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.30);
  }

  .app-btn--primary {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.95), rgba(124, 58, 237, 0.90));
    color: #fff;
  }

  .app-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .app-input,
  .app-select {
    background: rgba(20, 24, 38, 0.80);
    color: rgba(226, 232, 240, 0.90);
    border-color: var(--border-2);
  }

  .app-input:focus,
  .app-select:focus {
    background: rgba(20, 24, 38, 0.95);
    border-color: rgba(96, 165, 250, 0.40);
  }

  .app-chip {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.09);
    color: rgba(226, 232, 240, 0.82);
  }

  .app-chip:hover {
    background: rgba(96, 165, 250, 0.11);
  }

  .app-table thead th {
    background: rgba(18, 22, 36, 0.80);
    color: rgba(148, 163, 184, 0.92);
  }

  .app-table td,
  .app-table th {
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .app-table tbody tr:hover {
    background: rgba(96, 165, 250, 0.07);
  }

  .app-skeleton {
    background: linear-gradient(
      90deg,
      rgba(30, 36, 56, 0.8) 25%,
      rgba(40, 48, 72, 0.9) 50%,
      rgba(30, 36, 56, 0.8) 75%
    );
  }

  .app-brand-wordmark {
    color: var(--text);
  }

  .app-page-hd__eyebrow {
    color: var(--primary);
  }

  .app-breadcrumb a { color: var(--muted-2); }
  .app-breadcrumb a:hover { color: var(--text); }
  .app-breadcrumb span:last-child { color: var(--text); }

  .app-toast {
    background: var(--surface-solid);
    border-color: var(--border);
    color: var(--text);
  }
  .app-toast--error { background: rgba(127, 29, 29, 0.9); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }

  .app-perf-footer {
    background: rgba(15, 18, 32, 0.9);
    border-color: rgba(255, 255, 255, 0.06);
    color: rgba(148, 163, 184, 0.7);
  }

  .app-back-to-top {
    background: var(--surface-solid);
    border-color: var(--border-2);
    color: var(--muted);
  }
  .app-back-to-top:hover { background: rgba(40, 48, 72, 0.95); color: var(--text); }
}
