/* Azraq Theme v4.0 — Probability Wave design system */
/* Source: DESIGN.md v2. Direction C. Tokens + components + layout. */

/* ────────────────────────────── 1. ROOT TOKENS ────────────────────────────── */

:root {
  /* Navy family — structure (dark default) */
  --azrq-900: #001528;
  --azrq-800: #002147;
  --azrq-700: #002E63;
  --azrq-600: #0A3D6B;

  /* Accent */
  --azrq-blue: #117ACA;
  --azrq-blue-hover: #2B8DD6;

  /* Light theme helpers */
  --white: #FFFFFF;
  --off-white: #F7F8FA;
  --border-light: #E8EAEE;
  --text-muted-orig: #7A8493; /* kept for reference; prefer --text-muted-dark */
  --text-body-light: #1F2937;

  /* Signal colors (semantic only) */
  --critical: #EF4444;
  --critical-dark: #B91C1C;
  --high: #F59E0B;
  --high-dark: #B45309;
  --moderate: #06B6D4;
  --moderate-dark: #0E7490;
  --low: #10B981;
  --low-dark: #047857;
  /* Legacy color aliases (used in submission_detail inline styles) */
  --color-accent: var(--accent);
  --color-moderate: var(--moderate);
  --color-low: var(--low);
  --color-high: var(--high);
  --color-critical: var(--critical);

  /* Theme-mapped tokens (dark default) */
  --bg: var(--azrq-900);
  --surface: var(--azrq-800);
  --surface-hover: var(--azrq-700);
  --surface-soft: var(--azrq-600);
  --accent: var(--azrq-blue);
  --accent-hover: var(--azrq-blue-hover);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.72);
  --text-muted-dark: #8A95A5;
  --text-muted: var(--text-muted-dark);
  --bg-card: var(--surface);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);
  --table-hover: rgba(17,122,202,0.04);
  --overlay-bg: rgba(0,21,40,0.92);

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Motion */
  --transition-fast: 150ms;
  --transition-base: 200ms;
  --transition-slow: 300ms;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-width: 1200px;
  --gutter: 32px;
  --section-py: 96px;
  --nav-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Legacy aliases for backward compatibility */
  --azrq-bg: var(--bg);
  --azrq-surface: var(--surface);
  --azrq-accent: var(--accent);
  --azrq-accent-hover: var(--accent-hover);
  --azrq-muted: var(--text-muted-dark);
}

/* ────────────────────────────── 2. LIGHT THEME ────────────────────────────── */

[data-theme="light"] {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-hover: #F7F8FA;
  --surface-soft: #EEF1F5;
  --accent: #117ACA;
  --accent-hover: #0E69AF;
  --text-primary: #1F2937;
  --text-secondary: #4B5563;
  --text-muted-dark: #7A8493; /* light-theme large/label only */
  --border: #E8EAEE;
  --border-hover: #D1D5DB;
  --table-hover: rgba(17,122,202,0.04);
  --overlay-bg: rgba(247,248,250,0.95);
}

/* ────────────────────────────── 3. BASE RESET ────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
}

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

/* ────────────────────────────── 4. TYPOGRAPHY ────────────────────────────── */

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }
.tabular      { font-variant-numeric: tabular-nums; }

.display-1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.28px;
}

.display-2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.28px;
}

.h1-v2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.h2-v2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  line-height: 1.2;
}

.h3-v2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.3;
}

.body-1 { font-size: 1rem; line-height: 1.55; }
.body-2 { font-size: 0.875rem; line-height: 1.5; }
.caption {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
  margin-bottom: 0.75rem;
}

.section-number {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--accent);
  margin-right: 0.5rem;
  opacity: 0.6;
}

/* ────────────────────────────── 5. LAYOUT ────────────────────────────── */

.container-v2 {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section-v2 {
  padding-block: var(--section-py);
  border-bottom: 1px solid var(--border);
}

.section-v2:first-of-type { border-top: none; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}
@media (min-width: 768px) {
  .split-layout { grid-template-columns: 1fr 1fr; }
}

/* ────────────────────────────── 6. NAVIGATION (PUBLIC) ────────────────────────────── */

.nav-v2 {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  background: rgba(var(--bg), 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--gutter);
}

.nav-brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-brand span { color: var(--text-muted-dark); font-weight: 500; font-size: 0.875rem; }

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast) var(--ease-default);
}

.nav-links a:hover { color: var(--text-primary); }

.nav-cta { display: flex; gap: 0.75rem; align-items: center; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.nav-toggle:hover { border-color: var(--border-hover); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 45;
  opacity: 0;
  transition: opacity var(--transition-base) var(--ease-default);
}
.nav-overlay.is-visible { display: block; opacity: 1; }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem var(--gutter);
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
    z-index: 50;
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.3);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { font-size: 1rem; padding: 0.5rem 0; }
  .nav-links .btn-primary-v2 { width: 100%; justify-content: center; }
}

/* ────────────────────────────── 7. BUTTONS ────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default),
              color var(--transition-fast) var(--ease-default);
  line-height: 1.2;
}

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

.btn:disabled, .btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary-v2 {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.btn-primary-v2:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary-v2 {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.btn-secondary-v2:hover:not(:disabled) { border-color: var(--accent); background: rgba(17,122,202,0.08); }

.btn-ghost-v2 {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 0.5rem 0.75rem;
}
.btn-ghost-v2:hover:not(:disabled) { color: var(--text-primary); background: var(--surface-hover); }

.btn-pill { border-radius: 980px; padding: 0.6875rem 1.3125rem; }

/* Legacy button aliases */
.btn-primary   { composes: btn-primary-v2; }
.btn-secondary { composes: btn-secondary-v2; }

/* ────────────────────────────── 8. CARDS ────────────────────────────── */

.card-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: background var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default);
}

.card-v2.is-interactive:hover {
  background: var(--surface-hover);
  border-color: rgba(17,122,202,0.4);
}

.instrument-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.instrument-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

/* ────────────────────────────── 9. BADGES ────────────────────────────── */

.badge-v2 {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
}

.badge-green  { background: rgba(16,185,129,0.14); color: var(--low); border-color: rgba(16,185,129,0.3); }
[data-theme="light"] .badge-green { color: var(--low-dark); }

.badge-red    { background: rgba(239,68,68,0.14); color: var(--critical); border-color: rgba(239,68,68,0.3); }
[data-theme="light"] .badge-red { color: var(--critical-dark); }

.badge-orange { background: rgba(245,158,11,0.14); color: var(--high); border-color: rgba(245,158,11,0.3); }
[data-theme="light"] .badge-orange { color: var(--high-dark); }

.badge-blue   { background: rgba(17,122,202,0.14); color: var(--accent); border-color: rgba(17,122,202,0.3); }
[data-theme="light"] .badge-blue { color: #0E69AF; }

.badge-gray   { background: var(--surface-soft); color: var(--text-muted-dark); border-color: var(--border); }

.badge-purple { background: rgba(139, 92, 246, 0.14); color: #A78BFA; border-color: rgba(139, 92, 246, 0.3); }
[data-theme="light"] .badge-purple { color: #7C3AED; }

/* Semantic confidence badges (spec: operational = high/green, planned = medium/amber).
   Full definitions (not composes) — composes is CSS-Modules-only and a no-op here. */
.badge-operational { background: rgba(16,185,129,0.14); color: var(--low); border-color: rgba(16,185,129,0.3); }
[data-theme="light"] .badge-operational { color: var(--low-dark); }

.badge-planned { background: rgba(245,158,11,0.14); color: var(--high); border-color: rgba(245,158,11,0.3); }
[data-theme="light"] .badge-planned { color: var(--high-dark); }

/* Legacy badge aliases */
.badge-new       { composes: badge-blue; }
.badge-approved  { composes: badge-green; }
.badge-rejected  { composes: badge-red; }
.badge-followup, .badge-needsfollowup { composes: badge-orange; }

/* ────────────────────────────── 10. STAT BLOCKS ────────────────────────────── */

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-block .stat-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.stat-block .stat-unit {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ────────────────────────────── 11. FORMS ────────────────────────────── */

.form-control-v2 {
  width: 100%;
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color var(--transition-fast) var(--ease-default),
              box-shadow var(--transition-fast) var(--ease-default);
}

.form-control-v2:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17,122,202,0.25);
}

.form-control-v2::placeholder { color: var(--text-muted-dark); }

.form-label-v2 {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
  margin-bottom: 0.375rem;
}

.form-group-v2 { margin-bottom: 1.25rem; }

/* ────────────────────────────── 12. TABLES ────────────────────────────── */

.table-v2 {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.table-v2 th {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-muted-dark);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.table-v2 td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-primary);
}

.table-v2 tbody tr:hover { background: var(--table-hover); }

/* ────────────────────────────── 13. BROWSER CHROME ────────────────────────────── */

.browser-chrome {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.browser-dots {
  display: flex;
  gap: 0.375rem;
}

.browser-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-hover);
}

.browser-url {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted-dark);
  text-align: center;
  padding: 0.25rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.browser-body { padding: 1.5rem; }

/* ────────────────────────────── 14. LOGO WALL ────────────────────────────── */

.logo-wall {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  opacity: 0.5;
  filter: grayscale(100%);
  transition: opacity var(--transition-base) var(--ease-default);
}

.logo-wall:hover { opacity: 0.8; }

.logo-item {
  height: 24px;
  width: auto;
  object-fit: contain;
}

/* ────────────────────────────── 15. FOOTER ────────────────────────────── */

.footer-v2 {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-col h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-col a {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: color var(--transition-fast) var(--ease-default);
}

.footer-col a:hover { color: var(--accent); }

.footer-legal {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted-dark);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ────────────────────────────── 16. TOASTS ────────────────────────────── */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  max-width: 400px;
  animation: toastIn var(--transition-slow) var(--ease-default);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-success { border-color: rgba(16,185,129,0.3); color: var(--low); }
.toast-error   { border-color: rgba(239,68,68,0.3); color: var(--critical); }
.toast-info    { border-color: rgba(17,122,202,0.3); color: var(--accent); }

[data-theme="light"] .toast-success { color: var(--low-dark); }
[data-theme="light"] .toast-error   { color: var(--critical-dark); }
[data-theme="light"] .toast-info    { color: #0E69AF; }

/* ────────────────────────────── 17. REVEAL ANIMATIONS ────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-slow) var(--ease-default),
              transform var(--transition-slow) var(--ease-default);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 60ms; }
.reveal-delay-2 { transition-delay: 120ms; }
.reveal-delay-3 { transition-delay: 180ms; }
.reveal-delay-4 { transition-delay: 240ms; }
.reveal-delay-5 { transition-delay: 300ms; }

/* ────────────────────────────── 18. ADMIN LAYOUT ────────────────────────────── */
/* (Migrated from admin/base.html inline styles) */

/* Sidebar — instrument-panel aesthetic */
.sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar header — brand lockup */
.sidebar-header-v2 {
  padding: 2.5rem 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 0.625rem;
}

.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand .brand-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted-dark);
  letter-spacing: 0.02em;
}

.sidebar-tagline {
  font-size: 0.6875rem;
  color: var(--text-muted-dark);
  letter-spacing: 0.06em;
  margin: 0;
  line-height: 1.4;
}

/* Nav sections — numbered, hairline divided */
.nav-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted-dark);
  font-weight: 600;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.nav-section:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 1rem;
}

/* Nav items — icon + label, precise hover */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1.25rem;
  margin: 0 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast) var(--ease-default),
              background var(--transition-fast) var(--ease-default);
  border-left: none;
  position: relative;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--transition-fast) var(--ease-default);
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}
.nav-item:hover .nav-icon { opacity: 1; }

.nav-item.active {
  color: var(--accent);
  background: rgba(17,122,202,0.08);
}
.nav-item.active .nav-icon {
  opacity: 1;
  color: var(--accent);
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.625rem;
  padding: 0.125rem 0.5rem;
  border-radius: 100px;
  background: rgba(245,158,11,0.14);
  color: var(--high);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Sidebar footer — theme + logout */
.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar-footer-row:last-child { margin-bottom: 0; }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sidebar-toggle:hover { border-color: var(--border-hover); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 35;
  opacity: 0;
  transition: opacity var(--transition-base) var(--ease-default);
}
.sidebar-overlay.is-visible { display: block; opacity: 1; }

/* Main content area */
.main {
  margin-left: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 2.5rem;
  background: var(--bg);
  position: relative;
}

/* Page header — eyebrow + title + actions */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.page-header .header-text { flex: 1; min-width: 0; }

.page-header .header-eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted-dark);
  margin-bottom: 0.5rem;
}

.page-header h1,
.page-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.625rem;
  line-height: 1.2;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Legacy aliases */
.azraq-brand {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.azraq-logo { height: 28px; width: auto; }
.azraq-wordmark-fallback {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

/* User badge */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.user-badge .role {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-muted-dark);
  padding: 0.125rem 0.375rem;
  background: var(--surface-soft);
  border-radius: 4px;
}

/* Theme toggles */
.theme-toggle {
  width: 100%;
  padding: 0.625rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted-dark);
  cursor: pointer;
  font-size: 1rem;
  transition: border-color var(--transition-fast) var(--ease-default),
              color var(--transition-fast) var(--ease-default);
}
.theme-toggle:hover { border-color: var(--border-hover); color: var(--text-primary); }

.theme-toggle-floating {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: border-color var(--transition-fast) var(--ease-default),
              color var(--transition-fast) var(--ease-default);
}
.theme-toggle-floating:hover { border-color: var(--border-hover); color: var(--text-primary); }

.theme-toggle-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: border-color var(--transition-fast) var(--ease-default),
              color var(--transition-fast) var(--ease-default),
              background var(--transition-fast) var(--ease-default);
}
.theme-toggle-nav:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--surface-hover); }

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.filter-group label {
  font-size: 0.625rem;
  text-transform: uppercase;
  color: var(--text-muted-dark);
  font-weight: 600;
  letter-spacing: 0.1em;
}
.filter-group select, .filter-group input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  background: var(--surface);
  color: var(--text-primary);
  min-width: 160px;
  font-family: var(--font-body);
  transition: border-color var(--transition-fast) var(--ease-default),
              box-shadow var(--transition-fast) var(--ease-default);
}
.filter-group select:focus, .filter-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17,122,202,0.25);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.pagination a, .pagination span {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  transition: background var(--transition-fast) var(--ease-default),
              color var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default);
}
.pagination a { background: var(--surface); color: var(--text-secondary); }
.pagination a:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border-hover); }
.pagination span { background: rgba(17,122,202,0.1); color: var(--accent); border-color: var(--accent); }

/* ────────────────────────────── 18a. ADMIN STAT CARDS ────────────────────────────── */

.stat-card-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.stat-card-v2::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.25;
}

.stat-card-v2 .stat-eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
}

.stat-card-v2 .stat-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.stat-card-v2 .stat-number.sm { font-size: 1.5rem; }

/* ────────────────────────────── 18b. ADMIN CARDS ────────────────────────────── */

.card-admin {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-admin-header h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-admin-body { padding: 1.25rem 1.5rem; }
.card-admin-body.flush { padding: 0; }

/* Alert / callout */
.alert-admin {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.alert-admin .alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alert-admin .alert-text { flex: 1; min-width: 0; }
.alert-admin .alert-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin: 0 0 0.125rem;
}
.alert-admin .alert-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Toolbar row */
.toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar-right { margin-left: auto; justify-content: flex-end; }

/* Legacy stat-card support */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.stat-card .stat-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
  margin-bottom: 0.5rem;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--text-primary);
}

/* Dashboard split layout */
.dashboard-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

/* Admin grid utilities */
.grid-admin-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.grid-admin-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem; }
.grid-admin-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

@media (max-width: 768px) {
  .grid-admin-2-1,
  .grid-admin-1-2,
  .grid-admin-1-1 { grid-template-columns: 1fr; }
}

/* ────────────────────────────── 19. GRID OVERLAY ────────────────────────────── */

.grid-overlay {
  position: relative;
}

.grid-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.15;
  z-index: 0;
}

/* ────────────────────────────── 20. WAVE UTILITY ────────────────────────────── */

.wave-container {
  position: relative;
  overflow: hidden;
}

.wave-container svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ────────────────────────────── 21. SOURCE BLOCKS ────────────────────────────── */

.source-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.source-block .source-url {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--accent);
  word-break: break-all;
}

/* ────────────────────────────── 22. STEP INDICATOR ────────────────────────────── */

.step-indicator {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.step-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  color: var(--text-muted-dark);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default),
              color var(--transition-fast) var(--ease-default);
}

.step-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-dot.completed {
  background: rgba(16,185,129,0.12);
  border-color: var(--low);
  color: var(--low);
}

/* ────────────────────────────── 23. UTILITY ────────────────────────────── */

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted-dark); }
.text-accent    { color: var(--accent); }

.bg-surface     { background: var(--surface); }
.bg-soft        { background: var(--surface-soft); }

.border-subtle  { border: 1px solid var(--border); }

.flex-center    { display: flex; align-items: center; justify-content: center; }
.gap-1          { gap: 0.25rem; }
.gap-2          { gap: 0.5rem; }
.gap-3          { gap: 0.75rem; }
.gap-4          { gap: 1rem; }

.w-full         { width: 100%; }
.h-full         { height: 100%; }

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; } .mt-12 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; } .mb-12 { margin-bottom: 3rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ────────────────────────────── 25. SIDEBAR HEADER ────────────────────────────── */

.sidebar-header {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.sidebar-header h1 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.sidebar-header p {
  font-size: 0.6875rem;
  margin-top: 0.25rem;
  color: var(--text-muted-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ────────────────────────────── 26. FLASH MESSAGES ────────────────────────────── */

.flash-messages { margin-bottom: 1.5rem; }

.flash {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
}

.flash-success { border-color: rgba(16,185,129,0.3); color: var(--low); background: rgba(16,185,129,0.06); }
.flash-error   { border-color: rgba(239,68,68,0.3); color: var(--critical); background: rgba(239,68,68,0.06); }
.flash-info    { border-color: rgba(17,122,202,0.3); color: var(--accent); background: rgba(17,122,202,0.06); }

[data-theme="light"] .flash-success { color: var(--low-dark); }
[data-theme="light"] .flash-error   { color: var(--critical-dark); }
[data-theme="light"] .flash-info    { color: #0E69AF; }

/* ────────────────────────────── 27. BADGE / TABLE / CARD HEADER (legacy compat) ────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 1rem;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.table th {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-muted-dark);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-primary);
}

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

.table-responsive { overflow-x: auto; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0;
}

/* ────────────────────────────── 28. EXTRA ADMIN COMPAT ────────────────────────────── */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  margin: 0;
  color: var(--text-primary);
}

.btn-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  line-height: 1.2;
  background: var(--high);
  color: #FFFFFF;
  border-color: var(--high);
  transition: background var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default);
}

.btn-warning:hover:not(:disabled) { background: var(--high-dark); border-color: var(--high-dark); }

.btn-cancel-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.75rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-secondary);
}

.confidence-high { color: var(--low); }
.confidence-mid  { color: var(--high); }
.confidence-low   { color: var(--critical); }

.data-figure {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-primary);
}

.data-unit {
  font-size: 0.75rem;
  color: var(--text-muted-dark);
  margin-left: 0.25rem;
}

.field-cell { min-width: 0; position: relative; }

.field-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.btn-edit-field {
  background: none;
  border: none;
  color: var(--text-muted-dark);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
}

.btn-edit-field:hover { color: var(--accent); }

@keyframes wave-drift {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-20px); }
}

.wave-drift { animation: wave-drift 20s linear infinite; }

/* ────────────────────────────── 29. LOGIN PAGE ────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.login-card {
  width: 100%;
  max-width: 420px;
  z-index: 2;
  padding: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-tagline {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-dark);
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* ────────────────────────────── 30. BUTTON VARIANTS ────────────────────────────── */

.btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  line-height: 1.2;
  background: var(--low);
  color: #FFFFFF;
  border-color: var(--low);
  transition: background var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default);
}
.btn-success:hover:not(:disabled) { background: var(--low-dark); border-color: var(--low-dark); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  line-height: 1.2;
  background: var(--critical);
  color: #FFFFFF;
  border-color: var(--critical);
  transition: background var(--transition-fast) var(--ease-default),
              border-color var(--transition-fast) var(--ease-default);
}
.btn-danger:hover:not(:disabled) { background: var(--critical-dark); border-color: var(--critical-dark); }

/* ────────────────────────────── 31. BACKWARD COMPAT ALIASES ────────────────────────────── */
/* (Used by collector/submit wizard and legacy templates during migration) */

.card          { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 1rem; }
.form-group    { margin-bottom: 1.25rem; }
.form-label    { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted-dark); margin-bottom: 0.375rem; }
.form-control  { width: 100%; background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.625rem 0.875rem; font-family: var(--font-body); font-size: 1rem; line-height: 1.4; transition: border-color var(--transition-fast) var(--ease-default), box-shadow var(--transition-fast) var(--ease-default); }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17,122,202,0.25); }
.btn-primary   { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--font-body); font-weight: 500; font-size: 0.875rem; text-decoration: none; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0.75rem 1.5rem; cursor: pointer; line-height: 1.2; background: var(--accent); color: #FFFFFF; border-color: var(--accent); transition: background var(--transition-fast) var(--ease-default), border-color var(--transition-fast) var(--ease-default), color var(--transition-fast) var(--ease-default); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--font-body); font-weight: 500; font-size: 0.875rem; text-decoration: none; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0.75rem 1.5rem; cursor: pointer; line-height: 1.2; background: transparent; color: var(--text-primary); border-color: var(--border-hover); transition: background var(--transition-fast) var(--ease-default), border-color var(--transition-fast) var(--ease-default), color var(--transition-fast) var(--ease-default); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); background: rgba(17,122,202,0.08); }
.btn-success   { background: var(--low); color: #fff; border-color: var(--low); }
.btn-success:hover:not(:disabled) { background: var(--low-dark); border-color: var(--low-dark); }
.btn-sm        { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

.form-helper {
  font-size: 0.75rem;
  color: var(--text-muted-dark);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.required { color: var(--critical); margin-left: 0.25rem; }

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text-muted-dark);
  font-size: 10px;
  cursor: help;
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* Step indicator extras */
.step-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-dark);
  margin-top: 0.5rem;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-top: 14px;
  transition: background var(--transition-fast) var(--ease-default);
}
.step-line.completed { background: var(--low); }

/* Review section */
.review-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
}

.review-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.review-section-header h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--text-primary);
}

.review-edit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
}

.review-label {
  color: var(--text-muted-dark);
  flex-shrink: 0;
}

.review-value {
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
}

/* Source block internals */
.source-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-dark);
  margin-bottom: 0.75rem;
}

.source-remove {
  font-size: 0.75rem;
  color: var(--critical);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Conditional label */
.conditional-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Geo marker */
.geo-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
}

/* ────────────────────────────── 26. RESPONSIVE ────────────────────────────── */

@media (max-width: 1024px) {
  .main { padding: 1.5rem; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow) var(--ease-default);
    width: 260px;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    border-right: 1px solid var(--border);
    border-bottom: none;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay.is-visible { display: block; }
  .main { margin-left: 0; padding: 1.5rem; padding-top: 4rem; }
  .section-v2 { padding-block: 64px; }
  .page-header { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .header-actions { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .review-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .filters { flex-direction: column; gap: 0.75rem; }
  .filter-group select, .filter-group input { width: 100%; min-width: 0; }
  .toolbar { gap: 0.5rem; }
  .toolbar-right { margin-left: 0; justify-content: flex-start; }
  .card-admin-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-responsive table { min-width: 0; }
  .alert-admin { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .alert-admin .btn-sm { width: 100%; }
  .dashboard-split { grid-template-columns: 1fr; }
  .login-card { padding: 1.5rem; }
  .card > div[style*="display: flex; justify-content: space-between"],
  .card > div[style*="display:flex; justify-content: space-between"],
  .card > div[style*="display:flex;justify-content: space-between"],
  .card > div[style*="display:flex;justify-content:space-between"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
    align-items: flex-start !important;
  }
  div[style*="display: grid; grid-template-columns: 1fr 2fr"],
  div[style*="display:grid; grid-template-columns: 1fr 2fr"],
  div[style*="display:grid;grid-template-columns: 1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="display: grid; grid-template-columns: 1fr 1fr"],
  div[style*="display:grid; grid-template-columns: 1fr 1fr"],
  div[style*="display:grid;grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="display: grid; grid-template-columns: 2fr 1fr"],
  div[style*="display:grid; grid-template-columns: 2fr 1fr"],
  div[style*="display:grid;grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="display: flex; justify-content: space-between; align-items: center"],
  div[style*="display:flex; justify-content: space-between; align-items: center"],
  div[style*="display:flex;justify-content: space-between; align-items: center"],
  div[style*="display:flex;justify-content:space-between;align-items:center"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  div[style*="display: flex; gap: 0.5rem; align-items: center"],
  div[style*="display:flex; gap: 0.5rem; align-items: center"],
  div[style*="display:flex;gap: 0.5rem; align-items: center"],
  div[style*="display:flex;gap:0.5rem;align-items:center"] {
    flex-wrap: wrap !important;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main { padding: 1rem; padding-top: 3.5rem; }
  .card-v2, .instrument-card, .stat-card-v2, .card-admin, .card { padding: 1rem; }
  .card-admin-header, .card-admin-body { padding: 1rem; }
  input, select, textarea { font-size: 16px; }
  .page-header { padding-bottom: 1rem; margin-bottom: 1.5rem; }
  .filter-group select, .filter-group input { font-size: 16px; } /* prevent iOS zoom */
  .card-v2, .instrument-card, .stat-card-v2 { padding: 1rem; }
  .card-admin-header, .card-admin-body { padding: 1rem; }
  .nav-links a, .nav-item, .sidebar .nav-item { min-height: 44px; }
  .btn-sm { min-height: 36px; min-width: 44px; }
  .nav-icon { min-width: 20px; min-height: 20px; }
}
