/* ============================================
   GLOBAL CSS — The Scaling Team Dashboard
   Dual-theme system (dark default, light toggle)
   Premium aesthetic — Vercel/Linear polish
   Inter + JetBrains Mono, refined tokens
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── Dark Theme (default) ────────────────── */
:root {
  color-scheme: dark;

  /* Fonts */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Type scale — 8 steps */
  --text-display: 2.25rem;
  --text-h1: 1.5rem;
  --text-h2: 1.125rem;
  --text-h3: 0.9375rem;
  --text-body: 0.875rem;
  --text-sm: 0.8125rem;
  --text-caption: 0.75rem;
  --text-overline: 0.6875rem;

  /* Spacing — 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;

  /* Surfaces */
  --bg-page: #09090B;
  --bg-card: #1C1C20;
  --bg-card-solid: #1C1C20;
  --bg-card-subtle: #161619;
  --bg-card-hover: #242428;
  --bg-elevated: #2A2A2E;
  --bg-sunken: #0F0F12;
  --bg-input: #111114;
  --bg-sidebar: #0D0D11;
  --bg-sidebar-rgb: 13, 13, 17;
  --bg-card-rgb: 28, 28, 32;
  --bg-page-rgb: 9, 9, 11;

  /* Text */
  --text-primary: #F0F0F3;
  --text-secondary: #9494A0;
  --text-muted: #7E7E8A;
  --text-inverse: #0B0B0F;

  /* Borders */
  --border: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 255, 255, 0.15);
  --border-focus: #818CF8;

  /* Accent */
  --accent: #818CF8;
  --accent-hover: #6366F1;
  --accent-muted: rgba(129, 140, 248, 0.10);
  --accent-glow: rgba(129, 140, 248, 0.12);
  --accent-strong: #A5B4FC;
  --accent-rgb: 129, 140, 248;

  /* Semantic */
  --success: #34D399;
  --success-muted: rgba(52, 211, 153, 0.10);
  --danger: #F87171;
  --danger-muted: rgba(248, 113, 113, 0.10);
  --warning: #FBBF24;
  --warning-muted: rgba(251, 191, 36, 0.10);
  --info: #60A5FA;
  --info-muted: rgba(96, 165, 250, 0.10);

  /* Aliases */
  --positive: var(--success);
  --negative: var(--danger);
  --positive-bg: var(--success-muted);
  --negative-bg: var(--danger-muted);
  --warning-bg: var(--warning-muted);
  --info-bg: var(--info-muted);

  /* Shadows — multi-layered, soft */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.07), 0 4px 10px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.10), 0 8px 20px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(var(--accent-rgb), 0.10);
  --ring-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 2px 4px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
  --ring-shadow-hover: 0 0 0 1px rgba(255,255,255,0.18), 0 4px 8px rgba(0,0,0,0.16), 0 8px 24px rgba(0,0,0,0.10);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;
  --duration-enter: 400ms;

  /* Layout */
  --sidebar-w: 260px;
  --sidebar-w-sm: 68px;
  --content-max: 1280px;

  /* Glass (only for overlays) */
  --glass-bg: rgba(17, 17, 21, 0.65);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-blur: 16px;
}

/* ── Light Theme ─────────────────────────── */
[data-theme="light"] {
  color-scheme: light;

  --bg-page: #F8F7F5;
  --bg-card: #FFFFFF;
  --bg-card-solid: #FFFFFF;
  --bg-card-subtle: #FAFAF8;
  --bg-card-hover: #F2F1EF;
  --bg-elevated: #F0EFED;
  --bg-sunken: #E5E3E0;
  --bg-input: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-sidebar-rgb: 255, 255, 255;
  --bg-card-rgb: 255, 255, 255;
  --bg-page-rgb: 248, 247, 245;

  --text-primary: #111115;
  --text-secondary: #555566;
  --text-muted: #8E8E9D;
  --text-inverse: #F0F0F3;

  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --border-focus: #6366F1;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-muted: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.06);
  --accent-strong: #4338CA;
  --accent-rgb: 99, 102, 241;

  --success: #10B981;
  --success-muted: rgba(16, 185, 129, 0.08);
  --danger: #EF4444;
  --danger-muted: rgba(239, 68, 68, 0.07);
  --warning: #F59E0B;
  --warning-muted: rgba(245, 158, 11, 0.08);
  --info: #3B82F6;
  --info-muted: rgba(59, 130, 246, 0.07);

  --positive: var(--success);
  --negative: var(--danger);
  --positive-bg: var(--success-muted);
  --negative-bg: var(--danger-muted);
  --warning-bg: var(--warning-muted);
  --info-bg: var(--info-muted);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.05), 0 4px 10px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.07), 0 8px 20px rgba(0, 0, 0, 0.04);
  --shadow-glow: none;
  --ring-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --ring-shadow-hover: 0 0 0 1px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);

  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-blur: 0px;
}

/* ── Theme transition ────────────────────── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color var(--duration-slow) var(--ease-in-out),
              border-color var(--duration-normal) var(--ease-in-out),
              color var(--duration-normal) var(--ease-in-out),
              box-shadow var(--duration-slow) var(--ease-in-out) !important;
}

/* ── Reset ───────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: rgba(129, 140, 248, 0.06);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  background: var(--bg-page);
  min-height: 100vh;
  overflow-x: hidden;
  animation: pageEnter 0.3s ease-out;
}

@keyframes pageEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Subtle gradient mesh background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(129, 140, 248, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(96, 165, 250, 0.035) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(168, 85, 247, 0.025) 0%, transparent 60%);
  pointer-events: none;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99, 102, 241, 0.02) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(59, 130, 246, 0.015) 0%, transparent 60%);
}

/* ── Selection ───────────────────────────── */
::selection {
  background: rgba(var(--accent-rgb), 0.25);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(var(--accent-rgb), 0.25);
  color: var(--text-primary);
}

/* ── Base element resets ─────────────────── */
img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-in-out);
}

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

input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ── Global button active state ─────────── */
button:active,
[role="button"]:active,
.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-danger:active,
.btn-sm:active,
.btn-lg:active {
  transform: scale(0.97);
}

/* ── Focus ───────────────────────────────── */
:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-page), 0 0 0 4px var(--accent);
}

/* ── Form input focus glow ring ─────────── */
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
  outline: none;
}

/* ── Typography ──────────────────────────── */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3 {
  font-family: var(--font-display);
}

h1, .h1 {
  font-weight: 700;
  font-size: var(--text-h1);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h2, .h2 {
  font-weight: 600;
  font-size: var(--text-h2);
  line-height: 1.35;
  letter-spacing: -0.02em;
}

h3, .h3 {
  font-weight: 600;
  font-size: var(--text-h3);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* KPI numbers use mono font */
.kpi-value,
.kpi-trend,
.call-card-duration,
.pagination-info {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Text size utilities */
.text-display { font-size: var(--text-display); }
.text-h1      { font-size: var(--text-h1); }
.text-h2      { font-size: var(--text-h2); }
.text-h3      { font-size: var(--text-h3); }
.text-body    { font-size: var(--text-body); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-caption); }
.text-caption { font-size: var(--text-caption); }
.text-overline {
  font-size: var(--text-overline);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Text color utilities */
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-positive  { color: var(--positive); }
.text-success   { color: var(--success); }
.text-negative  { color: var(--negative); }
.text-warning   { color: var(--warning); }
.text-info      { color: var(--info); }

/* Font weight utilities */
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.tabular { font-variant-numeric: tabular-nums; }

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

/* ── Layout ──────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

#content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: var(--space-8);
  max-width: calc(var(--content-max) + var(--sidebar-w));
  min-height: 100vh;
  animation: fadeUp var(--duration-enter) var(--ease-out);
}

/* Center content on wide screens */
@media (min-width: 1600px) {
  #content {
    max-width: calc(var(--content-max) + var(--space-8) * 2);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }

  .app-layout {
    position: relative;
  }
}

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

/* ── Page Header ─────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ── Section ─────────────────────────────── */
.section {
  margin-top: var(--space-9);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-h3);
  letter-spacing: -0.01em;
}

.section-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: color var(--duration-fast) var(--ease-in-out);
}

.section-link:hover {
  color: var(--text-primary);
}

.section-link i {
  width: 14px;
  height: 14px;
}

/* ── Grid utilities ──────────────────────── */
.grid {
  display: grid;
  gap: var(--space-5);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Flex utilities ──────────────────────── */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-xs  { gap: var(--space-1); }
.gap-sm  { gap: var(--space-2); }
.gap-md  { gap: var(--space-4); }
.gap-lg  { gap: var(--space-6); }
.flex-wrap { flex-wrap: wrap; }
.flex-1    { flex: 1; min-width: 0; }

/* ── Spacing utilities ───────────────────── */
.mt-xs { margin-top: var(--space-1); }
.mt-sm { margin-top: var(--space-2); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }
.mt-xl { margin-top: var(--space-7); }
.mb-xs { margin-bottom: var(--space-1); }
.mb-sm { margin-bottom: var(--space-2); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }
.mb-xl { margin-bottom: var(--space-7); }

/* ── Card clickable hover lift ──────────── */
.card-clickable,
.card-hover {
  transition: transform var(--duration-fast) var(--ease-in-out),
              box-shadow var(--duration-fast) var(--ease-in-out);
}

.card-clickable:hover,
.card-hover:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.card-clickable:active,
.card-hover:active {
  transform: translateY(0) scale(0.97);
}

/* ── Skeletons ───────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card-solid) 25%, var(--bg-elevated) 50%, var(--bg-card-solid) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-md);
}

.skeleton-text       { height: 14px; width: 100%; margin-bottom: var(--space-2); }
.skeleton-text.short { width: 60%; }
.skeleton-title      { height: 28px; width: 40%; margin-bottom: var(--space-3); }
.skeleton-card       { height: 120px; width: 100%; }
.skeleton-chart      { height: 280px; width: 100%; }
.skeleton-row        { height: 48px; width: 100%; margin-bottom: 2px; }

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

/* ── Staggered card entrance ─────────────── */
@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-grid > * {
  animation: cardEnter 0.45s var(--ease-out) backwards;
}
.kpi-grid > :nth-child(1) { animation-delay: 0ms; }
.kpi-grid > :nth-child(2) { animation-delay: 60ms; }
.kpi-grid > :nth-child(3) { animation-delay: 120ms; }
.kpi-grid > :nth-child(4) { animation-delay: 180ms; }
.kpi-grid > :nth-child(5) { animation-delay: 240ms; }
.kpi-grid > :nth-child(6) { animation-delay: 300ms; }

.chart-grid > * {
  animation: cardEnter 0.45s var(--ease-out) backwards;
}
.chart-grid > :nth-child(1) { animation-delay: 0ms; }
.chart-grid > :nth-child(2) { animation-delay: 60ms; }
.chart-grid > :nth-child(3) { animation-delay: 120ms; }
.chart-grid > :nth-child(4) { animation-delay: 180ms; }
.chart-grid > :nth-child(5) { animation-delay: 240ms; }
.chart-grid > :nth-child(6) { animation-delay: 300ms; }
.chart-grid > :nth-child(7) { animation-delay: 360ms; }
.chart-grid > :nth-child(8) { animation-delay: 420ms; }

/* ── Toast notifications ─────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: rgba(var(--bg-sidebar-rgb), 0.82);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 360px;
  transform: translateX(calc(100% + 16px));
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  color: var(--text-primary);
  pointer-events: auto;
}

[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.82);
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
  to { transform: translateX(0); }
}

/* ── Offline banner ──────────────────────── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: #000;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  text-align: center;
  z-index: 10000;
  animation: fadeUp var(--duration-normal) var(--ease-out);
}

/* ── Session expiry modal ────────────────── */
.session-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.session-modal {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-7);
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s var(--ease-out);
}

.session-modal h3 {
  margin-bottom: var(--space-2);
}

.session-modal p {
  font-size: var(--text-body);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── Floating Theme Toggle (FAB) ─────────── */
.theme-toggle-float {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 90;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-in-out);
  opacity: 0.7;
}

.theme-toggle-float:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  opacity: 1;
  transform: scale(1.05);
}

.theme-toggle-float:active {
  transform: scale(0.95);
  opacity: 1;
}

.theme-toggle-float i {
  width: 15px;
  height: 15px;
}

/* Show FAB only below desktop breakpoint */
@media (max-width: 1023px) {
  .theme-toggle-float {
    display: flex;
  }
}

/* ── Mobile Bottom Nav ──────────────────── */
.mobile-nav {
  height: 68px;
}

.mobile-nav-item {
  font-size: var(--text-overline);
  text-transform: none;
}

/* ── Utility ─────────────────────────────── */
.hidden {
  display: none !important;
}

.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;
}

/* ── Scrollbar — Webkit ─────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--accent-rgb), 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--accent-rgb), 0.25);
}

/* ── Scrollbar — Firefox ─────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}

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

  body::before {
    display: none;
  }

  .mobile-nav,
  #sidebar,
  .seg-control,
  .segmented,
  .segmented-control,
  .toast,
  .panel-overlay,
  .modal-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* ============================================
   RESPONSIVE
   Mobile: <768px
   Tablet: 768-1023px
   Desktop: >=1024px
   ============================================ */

/* ── Mobile ──────────────────────────────── */
@media (max-width: 767px) {
  #content {
    margin-left: 0;
    padding: 20px 16px 100px 16px;
  }

  /* Larger, more readable text on mobile */
  h1, .h1, .page-title {
    font-size: 1.375rem;
    line-height: 1.3;
  }

  h2, .h2, .section-title {
    font-size: 1.0625rem;
  }

  /* Bump small text for legibility on mobile */
  :root {
    --text-body: 0.9375rem;
    --text-sm: 0.875rem;
    --text-caption: 0.8125rem;
    --text-overline: 0.75rem;
  }

  /* Page header stacks cleanly */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  /* Sections need less gap on mobile */
  .section {
    margin-top: var(--space-6);
  }

  .section-header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* 2-col grids stay 2-col only when appropriate */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  /* But 2-col-mobile forces 2 columns */
  .grid-2-mobile {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-3);
  }

  /* Floating toggle sits above mobile nav */
  .theme-toggle-float {
    bottom: 76px;
    right: var(--space-4);
  }
}

/* ── Tablet ──────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  #content {
    margin-left: var(--sidebar-w-sm);
    padding: var(--space-6) var(--space-5);
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Desktop ─────────────────────────────── */
@media (min-width: 1024px) {
  .grid-2-desktop {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Print ───────────────────────────────── */
@media print {
  #sidebar, .mobile-nav, .theme-toggle-float { display: none !important; }
  #content { margin-left: 0; padding: 16px; max-width: 100%; }
  body { background: #fff; color: #111; }
  body::before { display: none; }
  .card, .kpi-card, .chart-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .btn, .segmented, .seg-control { display: none; }
  @page { margin: 1cm; }
}
