/* 15h37 — Dark-first design system */

/* Base */

/* Reset */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* CSS View Transitions for page navigation */

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.15s;
  animation-timing-function: ease-out;
}

/* Design Tokens — dark-first, construction-grade · Design System 2.0 */

:root {
  /* Backgrounds — warm charcoal layers (deeper base for better card contrast) */
  --bg: #1a1c1e;
  --surface: #242628;
  --surface-2: #2e3133;
  --surface-3: #383b3e;
  --border: #484c50;
  --glass: rgba(36, 38, 40, 0.82);

  /* Text — softer white for eye comfort (still WCAG AAA) */
  --text: #d8dadc;
  --text-secondary: #b0b4b8;
  --text-muted: #9196a1;
  --text-faint: #686d72;

  /* Primary accent: Soft lavender — refined, elegant */
  --accent: #a78bfa;
  --accent-hover: #9b7af8;
  --accent-muted: rgba(167, 139, 250, 0.10);
  --accent-glow: rgba(167, 139, 250, 0.20);

  /* Secondary accent: muted blue */
  --accent-2: #7ba8d4;
  --accent-2-muted: rgba(123, 168, 212, 0.10);
  --accent-2-subtle: rgba(123, 168, 212, 0.05);

  /* Warm surface variants */
  --surface-raised: var(--surface);
  --surface-warm: #211f28;
  --border-warm: rgba(167, 139, 250, 0.14);
  --text-warm: #a8a0b8;
  --border-subtle: rgba(72, 76, 80, 0.35);
  --surface-hover: rgba(255, 255, 255, 0.06);

  /* Semantic — informational, not alarming */
  --success: #4aca8b;
  --success-bg: rgba(74, 202, 139, 0.25);
  --warning: #e09050;
  --warning-bg: rgba(224, 144, 80, 0.25);
  --danger: #e07c7c;
  --danger-hover: #d06a6a;
  --danger-bg: rgba(217, 114, 114, 0.25);

  /* Chart palette — 10 distinct hues, shared across themes */
  --chart-1: #a080ff;  /* lavender */
  --chart-2: #50b8f0;  /* sky blue */
  --chart-3: #3ccdb8;  /* teal */
  --chart-4: #82c840;  /* lime */
  --chart-5: #f0b830;  /* amber */
  --chart-6: #f08850;  /* tangerine */
  --chart-7: #f06898;  /* pink */
  --chart-8: #cc6ce8;  /* fuchsia */
  --chart-9: #5898f0;  /* blue */
  --chart-10: #a8a098; /* stone */

  /* Brand colors */
  --whatsapp: #25d366;
  --whatsapp-muted: rgba(37, 211, 102, 0.10);

  /* Functional — required white for QR code readability */
  --qr-bg: #ffffff;

  /* Overlays */
  --backdrop: rgba(0, 0, 0, 0.4);
  --glass-border: rgba(255, 255, 255, 0.06);

  /* Spacing — generous for readability */
  --space-2xs: 0.125rem;
  --space-xs: 0.375rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3.5rem;
  --space-4xl: 5rem;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;

  --text-2xs: 0.6563rem;
  --text-xs: 0.7188rem;
  --text-sm: 0.7813rem;
  --text-base: 0.8438rem;
  --text-lg: 1.0313rem;
  --text-xl: 1.2188rem;
  --text-2xl: clamp(1.3438rem, 1.075rem + 1.25vw, 1.5938rem);
  --text-3xl: clamp(1.5938rem, 1.325rem + 1.5vw, 2.0625rem);
  --text-4xl: clamp(2.0625rem, 1.55rem + 2vw, 2.6875rem);

  /* Line heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  /* Font weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Letter spacing — tighter for headlines, wider for uppercase labels */
  --tracking-tightest: -0.03em;
  --tracking-tighter: -0.02em;
  --tracking-tight: -0.011em;
  --tracking-snug: -0.01em;
  --tracking-normal: 0.01em;
  --tracking-wide: 0.02em;
  --tracking-wider: 0.06em;
  --tracking-widest: 0.08em;

  /* Breakpoints (cannot be tokenized in CSS, documented here)
     SM: 640px  — form stacking, compact mobile
     MD: 768px  — tables responsive, general mobile
     LG: 1024px — sidebar toggle, desktop layout
     Also: 480px for 2-col stat grids */

  /* Border radius — sharp geometric aesthetic */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 6px;
  --radius-xl: 8px;
  --radius-full: 9999px;

  /* Shadows — feathered, subtle elevation */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.22), 0 4px 8px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.26), 0 8px 16px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 0 1px rgba(167, 139, 250, 0.06);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.28), 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.20), 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-input: inset 0 1px 3px rgba(0, 0, 0, 0.15);

  /* Gradients — micro-sheen for depth */
  --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
  --gradient-accent-subtle: linear-gradient(135deg, rgba(167, 139, 250, 0.04) 0%, transparent 100%);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Easing — spring-like curves for modern feel */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Z-index scale */
  --z-base: 0;
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-fab: 110;
  --z-sheet: 150;
  --z-overlay: 200;
  --z-modal: 300;
  --z-toast: 400;

  /* Layout */
  --sidebar-width: 220px;
  --sidebar-collapsed: 72px;
  --nav-height: 64px;
  --mobile-header-h: calc(var(--space-sm) * 2 + 3rem + 1px + env(safe-area-inset-top, 0px));
}

/* ═══════════════════════════════════════
   Light theme overrides
   ═══════════════════════════════════════ */

[data-theme="light"] {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e5e7eb;
  --border: #d1d5db;
  --glass: rgba(255, 255, 255, 0.65);

  --text: #1a1a2e;
  --text-secondary: #3d3d5c;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-muted: rgba(139, 92, 246, 0.08);
  --accent-glow: rgba(139, 92, 246, 0.12);

  --accent-2: #3b82f6;
  --accent-2-muted: rgba(59, 130, 246, 0.08);
  --accent-2-subtle: rgba(59, 130, 246, 0.04);

  --surface-raised: var(--surface);
  --surface-warm: #f5f3ff;
  --border-warm: rgba(124, 58, 237, 0.15);
  --text-warm: #6b6280;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --surface-hover: rgba(0, 0, 0, 0.03);
  --backdrop: rgba(0, 0, 0, 0.3);
  --glass-border: rgba(0, 0, 0, 0.06);

  --on-semantic: #ffffff;

  --success: #34c06a;
  --success-bg: rgba(52, 192, 106, 0.12);
  --warning: #e0a030;
  --warning-bg: rgba(224, 160, 48, 0.12);
  --danger: #e06868;
  --danger-hover: #d05454;
  --danger-bg: rgba(224, 104, 104, 0.10);


  /* Shadows: feather-light — let whitespace do the work */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: none;
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-card-hover: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-inset: none;
  --shadow-input: none;

  --gradient-surface: none;
  --gradient-accent-subtle: none;
}

/* ═══════════════════════════════════════
   Outrun theme overrides — neon construction
   ═══════════════════════════════════════ */

[data-theme="outrun"] {
  /* Backgrounds — rich purple layers */
  --bg: #180e28;
  --surface: #22163a;
  --surface-2: #2c1e4e;
  --surface-3: #382a60;
  --border: #443472;
  --glass: rgba(34, 22, 58, 0.85);

  /* Text — ghost white with lavender tint */
  --text: #e0dff0;
  --text-secondary: #a0a0c8;
  --text-muted: #7070a0;
  --text-faint: #505080;

  /* Primary accent: hot amber */
  --accent: #ffaa00;
  --accent-hover: #ffbb33;
  --accent-muted: rgba(255, 170, 0, 0.10);
  --accent-glow: rgba(255, 170, 0, 0.25);

  /* Secondary accent: hot magenta */
  --accent-2: #ff2a6d;
  --accent-2-muted: rgba(255, 42, 109, 0.10);
  --accent-2-subtle: rgba(255, 42, 109, 0.05);

  /* Warm surface variants — deep purple */
  --surface-raised: var(--surface);
  --surface-warm: #241440;
  --border-warm: rgba(255, 170, 0, 0.14);
  --text-warm: #9080b8;
  --border-subtle: rgba(68, 52, 114, 0.40);
  --surface-hover: rgba(255, 170, 0, 0.06);

  /* Semantic — neon variants */
  --success: #05ffa1;
  --success-bg: rgba(5, 255, 161, 0.20);
  --warning: #ffb833;
  --warning-bg: rgba(255, 184, 51, 0.20);
  --danger: #ff3366;
  --danger-hover: #ff1a53;
  --danger-bg: rgba(255, 51, 102, 0.20);

  /* Chart palette — full neon spectrum */
  --chart-1: #ffaa00;  /* amber */
  --chart-2: #ff2a6d;  /* magenta */
  --chart-3: #05ffa1;  /* mint */
  --chart-4: #00f0ff;  /* cyan */
  --chart-5: #ffb833;  /* amber */
  --chart-6: #ff6b35;  /* orange */
  --chart-7: #ff71ce;  /* pink */
  --chart-8: #b967ff;  /* violet */
  --chart-9: #01cdfe;  /* sky */
  --chart-10: #05ffc8; /* teal */

  /* Overlays */
  --backdrop: rgba(0, 0, 0, 0.5);
  --glass-border: rgba(255, 170, 0, 0.08);

  /* Shadows — purple glow */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.30), 0 0 6px rgba(255, 170, 0, 0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.30), 0 0 12px rgba(255, 170, 0, 0.06);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.35), 0 0 20px rgba(255, 170, 0, 0.08);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.40), 0 0 30px rgba(255, 170, 0, 0.10);
  --shadow-glow: 0 0 12px rgba(255, 170, 0, 0.15);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.40), 0 0 8px rgba(255, 170, 0, 0.06);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.30), 0 0 20px rgba(255, 170, 0, 0.12);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-input: inset 0 1px 3px rgba(0, 0, 0, 0.20);

  /* Gradients — purple micro-sheen (stronger) */
  --gradient-surface: linear-gradient(135deg, rgba(0, 229, 255, 0.04) 0%, rgba(255, 42, 109, 0.04) 100%);
  --gradient-accent-subtle: linear-gradient(135deg, rgba(0, 229, 255, 0.07) 0%, transparent 100%);
}

/* Outrun uses dark logo variant */

[data-theme="outrun"] .logo--light { display: none; }

/* Theme-aware logo toggle */

.logo--light { display: none; }

[data-theme="light"] .logo--dark { display: none; }

[data-theme="light"] .logo--light { display: inline; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  letter-spacing: var(--tracking-tight);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--text);
  letter-spacing: var(--tracking-tighter);
}

h1 { font-size: var(--text-2xl); font-weight: var(--font-bold); }

h2 { font-size: var(--text-xl); font-weight: var(--font-bold); }

h3 { font-size: var(--text-lg); }

h4 { font-size: var(--text-base); font-weight: var(--font-semibold); }

/* Display: hero-sized text for dashboards */

.text-display {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tightest);
}

/* Overline: uppercase label pattern */

.overline {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-muted);
}

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-md);
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Tabular nums for all data values */

.text-data {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: var(--tracking-snug);
}

/* Data display: prominent numbers */

.text-data-lg {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
}

/* Semantic text */

.text--success { color: var(--success); }

.text--warning { color: var(--warning); }

.text--danger { color: var(--danger); }

.text--muted { color: var(--text-muted); }

.text--secondary { color: var(--text-secondary); }

.text--faint { color: var(--text-faint); }

.text--accent { color: var(--accent); }

/* Selection */

::selection {
  background: var(--accent-muted);
  color: var(--text);
}

/* Global focus styles */

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

*:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion */

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

  html { scroll-behavior: auto; }
}

/* Animations — Design System 2.0 keyframes library */

/* Fade up: content entrance */

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

/* Fade in: simple opacity */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Scale in: modal/card entrance */

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide up: bottom sheet / drawer */

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Slide down: bottom sheet exit */

@keyframes slide-down-out {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Slide down: dropdown / menu */

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Content entrance (page transition) */

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Flash banner entrance */

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

/* Flash slide up from bottom nav (mobile) */

@keyframes flash-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Flash slide down from header (desktop) */

@keyframes flash-slide-down {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Flash countdown bar */

@keyframes flash-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Shake: form error feedback */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

/* Pulse ring: notification / active state */

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(167, 139, 250, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
  }
}

/* Pulse dot: badge active indicator */

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Skeleton shimmer: loading placeholder */

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

/* Spin: loading spinner */

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Count up helper — JS drives the value, CSS handles the visual transition */

.count-up {
  transition: color 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

/* Staggered children: sequential entrance animation */

.stagger-children > * {
  animation: fade-up 0.4s var(--ease-out) both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }

.stagger-children > *:nth-child(2) { animation-delay: 60ms; }

.stagger-children > *:nth-child(3) { animation-delay: 120ms; }

.stagger-children > *:nth-child(4) { animation-delay: 180ms; }

.stagger-children > *:nth-child(5) { animation-delay: 240ms; }

.stagger-children > *:nth-child(6) { animation-delay: 300ms; }

.stagger-children > *:nth-child(7) { animation-delay: 360ms; }

.stagger-children > *:nth-child(8) { animation-delay: 420ms; }

/* Skeleton loading placeholder */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

.skeleton--text {
  height: 1em;
  width: 60%;
  margin-bottom: var(--space-sm);
}

.skeleton--heading {
  height: 1.5em;
  width: 40%;
  margin-bottom: var(--space-md);
}

.skeleton--card {
  height: 120px;
  width: 100%;
}

.skeleton--circle {
  border-radius: 50%;
}

/* Utility: apply shake on error */

.animate-shake {
  animation: shake 0.5s var(--ease-spring);
}

/* Utility: apply pulse ring */

.animate-pulse-ring {
  animation: pulse-ring 2s ease infinite;
}

/* Utility: apply fade up */

.animate-fade-up {
  animation: fade-up 0.4s var(--ease-out) both;
}

/* Highlight flash: event link target focus */

@keyframes highlight-flash {
  0%, 100% { box-shadow: inset 0 0 0 0 transparent; }
  10%, 35%, 60%, 85% { box-shadow: inset 0 0 0 100vmax var(--border-subtle); }
  22%, 47%, 72%, 95% { box-shadow: inset 0 0 0 0 transparent; }
}

.highlight-flash {
  animation: highlight-flash 2.4s ease-in-out;
}

.highlight-flash td {
  animation: highlight-flash 2.4s ease-in-out;
}

/* Utility: apply scale in */

.animate-scale-in {
  animation: scale-in 0.3s var(--ease-spring) both;
}

/* Components */

/* ========================================
   Activity pills — category selector
   ======================================== */

.activity-pills-wrapper {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  margin-bottom: var(--space-lg);
  min-width: 0;
  transition: grid-template-rows 0.25s ease-out,
              opacity 0.2s ease-out,
              margin 0.25s ease-out;
}

.activity-pills-wrapper[hidden] {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.activity-pills-wrapper__inner {
  overflow: hidden;
  min-width: 0;
}

.activity-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-xs);
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.activity-pills::-webkit-scrollbar {
  display: none;
}

.activity-pill {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: inherit;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.activity-pill svg {
  flex-shrink: 0;
}

.activity-pill:hover {
  color: var(--text);
  background: var(--surface-3);
}

.activity-pill--active {
  color: var(--text);
  background: var(--surface);
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-sm);
}

.activity-pill--discarded {
  opacity: 0.45;
  text-decoration: line-through;
}

@media (max-width: 768px) {
  .activity-pill {
    min-height: 40px;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast),
              color var(--transition-fast),
              border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform var(--transition-fast);
  min-height: 44px;
  white-space: nowrap;
  position: relative;
  letter-spacing: var(--tracking-snug);
}

.btn:active {
  transform: scale(0.97);
  transition-duration: 80ms;
}

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

/* Disabled state */

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Icon support */

.btn__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn__icon > svg {
  width: 16px;
  height: 16px;
}

/* Loading state */

.btn--loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn--loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: var(--space-xs);
}

/* Primary */

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

/* Secondary */

.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Success */

.btn--success { background: var(--success); color: var(--on-semantic, var(--bg)); }

.btn--success:hover { filter: brightness(1.1); }

/* Danger */

.btn--danger { background: var(--danger); color: var(--on-semantic, var(--bg)); }

.btn--danger:hover { background: var(--danger-hover); }

/* Ghost */

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover { color: var(--text); background: var(--surface-2); }

/* Icon-only (table row actions) */

.btn--icon {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.btn--icon:hover { color: var(--text); }

.btn--icon-danger {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.btn--icon-danger:hover { color: var(--danger); }

/* Sizes */

.btn--sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  min-height: 32px;
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-lg);
  min-height: 48px;
}

/* Pill variant */

.btn--pill {
  border-radius: var(--radius-full);
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Block */

.btn--block {
  display: flex;
  width: 100%;
  margin-top: var(--space-lg);
}

@media (max-width: 768px) {
  .btn { min-height: 48px; padding: var(--space-sm) var(--space-lg); }
  .btn--sm { min-height: 40px; padding: var(--space-sm) var(--space-md); font-size: var(--text-xs); }
}

.card {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  box-shadow: var(--shadow-card);
}

.card--clickable {
  cursor: pointer;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              transform 0.2s var(--ease-spring);
  border: 1px solid transparent;
}

.card--clickable:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.card--clickable:active {
  transform: translateY(0);
  transition-duration: 80ms;
}

.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

@media (max-width: 640px) {
  .card__footer .btn-group {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .card__footer .btn-group .btn {
    width: 100%;
    min-height: 48px;
  }
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text);
  letter-spacing: var(--tracking-snug);
}

.card__body {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 65ch;
}

.card__footer {
  margin-top: var(--space-lg);
  padding-top: 0;
  display: flex;
  gap: var(--space-sm);
}

/* Project card footer stats — icon-label pairs */

.card__footer-stats {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  padding-top: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.card__stat {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-variant-numeric: tabular-nums;
}

.card__stat svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* Project card metrics — two-column layout */

.card__metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 768px) {
  .card__metrics {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

.card__metric-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  margin-bottom: var(--space-2xs);
}

.card__metric-value {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

.card__metric-value svg {
  flex-shrink: 0;
  opacity: 0.5;
}

/* Budget bar inside card */

.card__budget {
  margin-top: var(--space-xs);
}

/* ═══════════════════════════════════════
   Stat cards — icon + value
   ═══════════════════════════════════════ */

.stat-card {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  position: relative;
  box-shadow: var(--shadow-card);
}

.stat-card__content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

/* 48px icon circle */

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-muted);
  color: var(--accent);
}

.stat-card__icon > svg {
  width: 22px;
  height: 22px;
}

.stat-card--success .stat-card__icon {
  background: var(--success-bg);
  color: var(--success);
}

.stat-card--warning .stat-card__icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-card--danger .stat-card__icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-card__text {
  min-width: 0;
}

.stat-card__value {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-sm);
  white-space: nowrap;
  letter-spacing: var(--tracking-tighter);
}

.stat-card__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}

.stat-card__detail {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.stat-card__trend--up { color: var(--success); }

.stat-card__trend--down { color: var(--danger); }

.stat-card__trend--neutral { color: var(--text-faint); }

@media (max-width: 768px) {
  .card {
    padding: var(--space-md);
  }

  .card__header {
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
  }

  .card__badges .badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
  }

  .card__footer {
    margin-top: var(--space-md);
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-card__icon {
    width: 40px;
    height: 40px;
  }

  .stat-card__icon > svg {
    width: 20px;
    height: 20px;
  }

  .stat-card__value {
    font-size: var(--text-xl);
  }
}

/* ═══════════════════════════════════════
   Form System — Design System 2.0
   ═══════════════════════════════════════ */

/* Form card — centered, compact layout */

.form-card {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-lg) 0;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Form Group ── */

.form-group {
  margin-bottom: var(--space-lg);
}

/* ── Labels: uppercase micro-label ── */

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.form-label abbr {
  color: var(--accent);
  text-decoration: none;
  margin-left: 2px;
}

/* ── Inputs: borderless, background-driven ── */

.form-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast);
  min-height: 48px;
}

.form-input:hover {
  background: var(--surface-3);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Autofilled value (computed by Stimulus) */

.form-input[data-state="auto"] {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Error state */

.form-input--error {
  border-color: var(--danger);
  animation: shake 0.5s var(--ease-spring);
}

.form-input--error:focus {
  box-shadow: 0 0 0 3px var(--danger-bg);
}

/* Hide number input spinners */

.form-input[type="number"]::-webkit-outer-spin-button,
.form-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-input[type="number"] {
  -moz-appearance: textfield;
}

.form-input::placeholder {
  color: var(--text-faint);
  opacity: 0.7;
}

/* ── Select ── */

.form-select {
  width: 100%;
  padding: var(--space-sm) var(--space-2xl) var(--space-sm) var(--space-md);
  background-color: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  min-height: 48px;
  cursor: pointer;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background-color var(--transition-fast);
  appearance: none;
  /* Arrow color matches --text-muted token */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239196a1' viewBox='0 0 16 16'%3E%3Cpath d='m8 11-5-5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
}

.form-select:hover {
  background-color: var(--surface-3);
}

.form-select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-select option {
  background: var(--surface);
  color: var(--text);
}

/* ── Checkbox: custom styled ── */

.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  min-height: 48px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.form-checkbox:hover {
  background: var(--surface-hover);
}

.form-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color var(--transition-fast),
              background var(--transition-fast),
              box-shadow var(--transition-fast);
}

.form-checkbox input[type="checkbox"]:hover {
  background: var(--surface-3);
}

.form-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.form-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-checkbox input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-checkbox__label {
  font-size: var(--text-base);
  color: var(--text);
  user-select: none;
}

/* ── Error / Hint messages ── */

.form-error {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--danger);
}

.form-error::before {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.75a.75.75 0 011.5 0v3.5a.75.75 0 01-1.5 0v-3.5zM8 11a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath d='M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.75a.75.75 0 011.5 0v3.5a.75.75 0 01-1.5 0v-3.5zM8 11a1 1 0 100 2 1 1 0 000-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.form-hint {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-faint);
  line-height: var(--leading-snug);
}

/* ── Two-column row ── */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

/* Keeps 2 columns on mobile */

.form-row--stay { grid-template-columns: 1fr 1fr; }

.form-row--stay > .form-group { min-width: 0; }

.form-group--center { align-self: end; }

/* ── Hours preview in timesheet form ── */

.hours-preview {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: var(--leading-tight);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  display: inline-block;
  transition: transform 0.12s ease, color 0.12s ease;
}

.hours-preview--updated {
  transform: scale(1.03);
  color: var(--accent);
}

/* ── Time select (dual dropdowns for hour:minute) ── */

.time-select {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.time-select .form-select { flex: 1; }

.time-select__separator {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-faint);
}

/* ── Form actions ── */

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-top: var(--space-lg);
  margin-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

/* ── Responsive time input (mobile stepper / desktop dropdowns) ── */

.time-input--mobile { display: none; }

@media (max-width: 640px) {
  .time-input--mobile { display: block; }
  .time-input--desktop { display: none; }
}

/* ── Desktop: tighter vertical rhythm ── */

@media (min-width: 1024px) {
  .form-group { margin-bottom: var(--space-md); }
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .form-group { margin-bottom: var(--space-md); }
  .form-card { padding-top: var(--space-sm); }
}

@media (max-width: 640px) {
  .form-row:not(.form-row--stay) { grid-template-columns: 1fr; }
  .form-input,
  .form-select { min-height: 52px; }

  .form-actions {
    flex-direction: column;
    position: sticky;
    bottom: 0;
    background: var(--bg);
    margin: 0 calc(-1 * var(--space-md));
    padding: var(--space-md) var(--space-md);
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-subtle);
    z-index: var(--z-sticky);
  }
}

/* ── PIN input: 4 digit cells ── */

.pin-input {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

.pin-input__digit {
  width: 56px;
  height: 64px;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  color: transparent;
  caret-color: transparent;
  font-size: var(--text-xl);
  text-align: center;
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast);
}

.pin-input__digit:hover {
  background-color: var(--surface-3);
}

.pin-input__digit:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Dot indicator when digit is filled */

.pin-input__digit--filled {
  background-image: radial-gradient(circle, var(--text) 7px, transparent 7px);
  background-repeat: no-repeat;
  background-position: center;
  animation: pin-fill 0.15s var(--ease-spring);
}

.pin-input__digit--filled:focus {
  background-image: radial-gradient(circle, var(--accent) 7px, transparent 7px);
  background-repeat: no-repeat;
  background-position: center;
}

@keyframes pin-fill {
  from { transform: scale(0.85); }
  to { transform: scale(1); }
}

.pin-input__digit--loading {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .pin-input__digit {
    width: 52px;
    height: 60px;
  }
}

/* ── Password strength meter ── */

.pwd-strength {
  margin-top: var(--space-sm);
}

.pwd-meter {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.pwd-meter::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--pwd-progress, 0%);
  border-radius: var(--radius-full);
  background: var(--danger);
  transition: width 0.3s var(--ease-spring), background 0.3s var(--ease-out);
}

.pwd-meter[data-strength="medium"]::after { background: var(--warning); }

.pwd-meter[data-strength="strong"]::after { background: var(--success); }

.pwd-rules {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  list-style: none;
  padding: 0;
  margin: 0;
}

.pwd-rule {
  font-size: var(--text-xs);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition-fast);
}

.pwd-rule::before {
  content: '';
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--text-faint);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.pwd-rule--pass {
  color: var(--success);
}

.pwd-rule--pass::before {
  background: var(--success);
  border-color: var(--success);
}

/* ── Permission toggle ── */

.perm-toggle {
  position: relative;
}

.perm-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.perm-toggle__label {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  cursor: pointer;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.perm-toggle__label:hover {
  background: var(--surface-hover);
}

.perm-toggle__track {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: background var(--transition-base);
}

.perm-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform var(--transition-base) var(--ease-spring),
              background var(--transition-base);
}

.perm-toggle__input:checked ~ .perm-toggle__label .perm-toggle__track {
  background: var(--accent);
}

.perm-toggle__input:checked ~ .perm-toggle__label .perm-toggle__thumb {
  transform: translateX(20px);
  background: var(--bg);
}

.perm-toggle__input:focus-visible ~ .perm-toggle__label .perm-toggle__track {
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.perm-toggle__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.perm-toggle__title {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text);
}

.perm-toggle__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
}

.perm-toggle-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* ── Reminder page ── */

.reminder-page {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.reminder-card {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.reminder-card__section {
  margin-bottom: var(--space-lg);
}

.reminder-card__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin: 0 0 var(--space-xs);
}

.reminder-card__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 var(--space-md);
  line-height: var(--leading-relaxed);
}

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

/* ── Time select (desktop) ── */

.reminder-time-select {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.reminder-time-select .form-select {
  flex: 1;
}

.reminder-time-select__separator {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
}

/* ── Stepper (mobile) / Select (desktop) toggle ── */

.reminder-stepper-mobile {
  display: block;
}

.reminder-select-desktop {
  display: none;
}

@media (min-width: 768px) {
  .reminder-stepper-mobile {
    display: none;
  }

  .reminder-select-desktop {
    display: flex;
  }
}

/* ── Reminder stepper ── */

.reminder-stepper {
  display: flex;
  justify-content: center;
}

.reminder-stepper .time-stepper__times {
  flex: 0;
}

/* ── Light theme overrides ── */

[data-theme="light"] .form-select {
  /* Arrow color matches --text-muted token (light) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='m8 11-5-5h10z'/%3E%3C/svg%3E");
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375em;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: var(--font-bold);
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: var(--tracking-normal);
}

/* Pulsing dot for active state */

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge__dot--pulse {
  animation: pulse-dot 2s ease-in-out infinite;
}

/* Size variants */

.badge--sm {
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
}

.badge--lg {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
}

/* Semantic variants */

.badge--success {
  background: var(--success-bg);
  color: var(--success);
}

.badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge--default {
  background: var(--surface-3);
  color: var(--text-secondary);
}

.badge--accent {
  background: var(--accent-muted);
  color: var(--accent);
}

.badge--info {
  background: var(--accent-2-muted);
  color: var(--accent-2);
}

/* Outline variant */

.badge--outline {
  background: transparent;
  border-width: 1px;
  border-style: solid;
}

.badge--outline.badge--success { border-color: var(--success); color: var(--success); }

.badge--outline.badge--warning { border-color: var(--warning); color: var(--warning); }

.badge--outline.badge--danger { border-color: var(--danger); color: var(--danger); }

.badge--outline.badge--accent { border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
  .badge:not(.badge--sm) {
    padding: 0.25rem 0.5625rem;
  }
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 12px var(--space-md);
  padding-bottom: var(--space-md);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th:first-child {
  border-top-left-radius: var(--radius-lg);
}

.table th:last-child {
  border-top-right-radius: var(--radius-lg);
}

.table td {
  padding: var(--space-md) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Subtle row hover */

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

.table tr:last-child td {
  border-bottom: none;
}

/* Today row stripe */

.table__row--today td {
  background: var(--accent-muted);
}

.table__row--today td:first-child {
  border-left: 3px solid var(--accent);
}

/* Action cell (icon buttons row) */

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

/* Mobile responsive table → cards */

@media (max-width: 768px) {
  .table--responsive thead {
    display: none;
  }

  .table--responsive tbody tr {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
  }

  .table--responsive td {
    padding: 0;
    border: none;
    font-size: var(--text-sm);
  }

  .table--responsive td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    display: block;
    margin-bottom: 2px;
  }

  /* Hide empty labels (action cells without data-label) */
  .table--responsive td:not([data-label])::before {
    display: none;
  }

  .table--responsive .text-right {
    text-align: left;
  }

  .table--responsive .text-data,
  .table--responsive strong {
    font-variant-numeric: tabular-nums;
  }

  .table--responsive .td-actions {
    flex-direction: row;
    justify-content: flex-start;
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border-subtle);
  }
}

/* Address autocomplete dropdown */

.autocomplete__list {
  display: none;
  position: absolute;
  z-index: var(--z-dropdown);
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: var(--space-xs);
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.autocomplete__list--visible {
  display: block;
  animation: slide-down 0.15s var(--ease-out);
}

.autocomplete__item {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.autocomplete__item:hover,
.autocomplete__item--active {
  background: var(--surface-2);
}

.autocomplete__item--active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.autocomplete__error {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

.form-input--loading {
  /* Spinner color matches --text-muted token */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239196a1' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  background-size: 18px 18px;
}

[data-theme="light"] .form-input--loading {
  /* Spinner color matches --text-muted token (light) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56' stroke-linecap='round'/%3E%3C/svg%3E");
}

.autocomplete__hint {
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--warning);
}

/* Parent needs relative for dropdown positioning */

[data-controller="address-autocomplete"] {
  position: relative;
}

/* Detail list for show pages */

.detail-list {
  display: grid;
  gap: var(--space-md);
}

.detail-list__item {
  display: flex;
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.detail-list__item:last-child {
  border-bottom: none;
}

.detail-list__term {
  color: var(--text-muted);
  font-size: var(--text-sm);
  flex-shrink: 0;
  width: 140px;
}

.detail-list__value {
  font-weight: var(--font-medium);
  flex: 1;
  text-align: right;
  margin: 0;
}

.detail-list__value turbo-frame {
  display: inline;
}

.card .detail-list {
  max-width: none;
}

.card__body:has(.detail-list) {
  max-width: none;
}

@media (max-width: 768px) {
  .detail-list__item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }
}

/* Section header with title + action */

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

/* ── Form sections: fieldset with accent stripe ── */

.form-fieldset {
  border: none;
  padding: var(--space-2xl) var(--space-lg);
  margin-bottom: var(--space-2xl);
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-card);
  position: relative;
}

.form-fieldset__legend {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: 0;
  margin-bottom: var(--space-lg);
}

/* Remove extra margin on last group inside fieldset */

.form-fieldset > .form-group:last-child,
.form-fieldset > .form-row:last-child .form-group {
  margin-bottom: 0;
}

/* Inputs inside fieldsets: bump bg for contrast */

.form-fieldset .form-input,
.form-fieldset .form-select {
  background-color: var(--surface-3);
}

.form-fieldset .form-input:focus,
.form-fieldset .form-select:focus {
  background-color: var(--surface-2);
}

@media (max-width: 640px) {
  .form-fieldset {
    padding: var(--space-md);
    padding-top: var(--space-sm);
    margin-left: calc(-1 * var(--space-sm));
    margin-right: calc(-1 * var(--space-sm));
    border-radius: var(--radius-md);
  }
}

/* Form details — collapsible advanced section */

.form-details {
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-md);
}

.form-details__summary {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.form-details__summary::-webkit-details-marker {
  display: none;
}

.form-details__summary::before {
  content: "›";
  display: inline-block;
  transition: transform var(--transition-fast);
  font-size: var(--text-base);
  color: var(--text-faint);
}

details[open] .form-details__summary::before {
  transform: rotate(90deg);
}

.form-details__body {
  margin-top: var(--space-md);
}

/* Inline assign form */

.assign-form {
  margin-bottom: var(--space-md);
}

.assign-form__inner {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.assign-form__inner .form-select {
  flex: 1;
}

@media (max-width: 640px) {
  .assign-form__inner {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Cards grid */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

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

/* ========================================
   Filter tabs — shared segmented control
   ======================================== */

.filter-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2xl);
  overflow-x: auto;
}

.filter-tab {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  border-radius: calc(var(--radius-md) - 2px);
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.filter-tab:hover {
  color: var(--text);
  background: var(--surface-3);
}

.filter-tab--active {
  color: var(--text);
  background: var(--surface);
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-sm);
}

.card__meta {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .filter-tabs {
    margin-bottom: var(--space-md);
  }
}

/* ── Filter banner ── */

.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.filter-banner__clear {
  color: var(--accent);
  font-weight: var(--font-medium);
  text-decoration: none;
  white-space: nowrap;
}

.filter-banner__clear:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════
   Budget widget — standalone progress card
   ═══════════════════════════════════════ */

.budget-widgets-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 769px) {
  .budget-widgets-row {
    grid-template-columns: 1fr 1fr;
  }
}

.budget-widget {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.budget-widget__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.budget-widget__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}

.budget-widget__percent {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
}

.budget-widget__percent--success { color: var(--success); }

.budget-widget__percent--warning { color: var(--warning); }

.budget-widget__percent--danger { color: var(--danger); }

.budget-widget .budget-bar {
  margin-bottom: 0;
}

.budget-widget__footer {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
}

.budget-widget__footer strong {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Budget progress bar */

.budget-bar {
  margin-bottom: var(--space-sm);
  height: 40px;
}

.budget-bar--md { height: 28px; }

.budget-bar--sm { height: 24px; }

/* Expand when 100% marker is shown below */

.budget-bar--overflow { height: 56px; }

.budget-bar--overflow.budget-bar--md { height: 42px; }

.budget-bar--overflow.budget-bar--sm { height: 38px; }

.budget-bar__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Dashboard card context */

.card__budget .budget-bar {
  margin-top: var(--space-sm);
  margin-bottom: 0;
}

.budget-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  margin-top: var(--space-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* Filter bar */

.filters {
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-lg);
}

.filters .form-group {
  margin-bottom: 0;
}

.filters .form-row {
  gap: var(--space-md);
}

.filters__form {
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
}

@media (min-width: 641px) {
  .filters .form-label {
    font-size: var(--text-2xs);
    margin-bottom: var(--space-xs);
    color: var(--text-faint);
  }
}

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

@media (max-width: 640px) {
  .filters__form {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Pagy pagination */

.pagy.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
}

.pagy.nav > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-variant-numeric: tabular-nums;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: var(--surface-2);
  border: none;
  transition: background var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast);
}

.pagy.nav > a[href]:hover {
  color: var(--text);
  background: var(--surface-3);
}

.pagy.nav > a[href]:active {
  transform: scale(0.96);
}

.pagy.nav > a[href]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Current page */

.pagy.nav > a.current {
  background: var(--accent);
  color: var(--bg);
  font-weight: var(--font-semibold);
}

/* Disabled prev/next */

.pagy.nav > a[aria-disabled="true"]:not(.current):not(.gap) {
  color: var(--text-faint);
  background: var(--surface);
  opacity: 0.5;
  cursor: default;
}

/* Gap (ellipsis) */

.pagy.nav > a.gap {
  color: var(--text-faint);
  min-width: auto;
  padding: 0 var(--space-xs);
  border: none;
  background: none;
}

@media (max-width: 768px) {
  .pagy.nav {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    margin: 0 calc(-1 * var(--space-lg));
    padding: var(--space-sm) var(--space-lg);
  }

  .pagy.nav > a {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Getting Started checklist card */

.getting-started {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-card);
  animation: fade-up 0.3s var(--ease-out);
  margin-bottom: var(--space-2xl);
}

.getting-started__header {
  margin-bottom: var(--space-md);
}

.getting-started__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.getting-started__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.getting-started__progress {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.getting-started__bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.getting-started__bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-spring);
}

.getting-started__bar-fill[data-percent="25"] { width: 25%; }

.getting-started__bar-fill[data-percent="50"] { width: 50%; }

.getting-started__bar-fill[data-percent="75"] { width: 75%; }

.getting-started__bar-fill[data-percent="100"] { width: 100%; }

/* Steps list */

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

.getting-started__step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xs);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

/* Done step */

.getting-started__step--done {
  opacity: 0.6;
}

.getting-started__check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--success);
  color: var(--bg);
}

.getting-started__step--done .getting-started__label {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Pending step */

.getting-started__step--pending {
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.getting-started__step--pending:hover {
  background: var(--surface-2);
}

.getting-started__dot {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  transition: border-color var(--transition-fast);
}

.getting-started__step--pending:hover .getting-started__dot {
  border-color: var(--text-muted);
}

.getting-started__label {
  flex: 1;
  font-size: var(--text-sm);
}

.getting-started__arrow {
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.getting-started__step--pending:hover .getting-started__arrow {
  transform: translateX(3px);
  color: var(--text);
}

@media (max-width: 768px) {
  .getting-started {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  .getting-started__header {
    margin-bottom: var(--space-sm);
  }

  .getting-started__title {
    font-size: var(--text-base);
  }

  .getting-started__step {
    padding: var(--space-xs) var(--space-2xs);
  }
}

/* ═══════════════════════════════════════
   Invitation — worker credential sharing
   ═══════════════════════════════════════ */

.invitation {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.invitation__share {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Banner — success state */

.invitation__banner {
  text-align: center;
  padding: var(--space-lg) 0;
}

.invitation__icon {
  color: var(--success);
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
}

.invitation__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text);
  letter-spacing: var(--tracking-tighter);
  margin-bottom: var(--space-xs);
}

.invitation__subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Credentials card */

.invitation__credentials {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.invitation__field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
}

.invitation__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex-shrink: 0;
}

.invitation__value {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

.invitation__value--small {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.invitation__pin {
  font-size: var(--text-3xl);
  font-weight: var(--font-extrabold);
  color: var(--accent);
  letter-spacing: 0.15em;
  font-variant-numeric: tabular-nums;
}

/* Warning */

.invitation__warning {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--warning-bg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--warning);
  line-height: var(--leading-snug);
}

.invitation__warning svg {
  flex-shrink: 0;
}

/* Info — neutral variant of warning */

.invitation__info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-snug);
}

.invitation__info svg {
  flex-shrink: 0;
  color: var(--accent);
}

/* Actions — shared */

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

.invitation__actions .btn {
  justify-content: center;
  gap: var(--space-sm);
}

.invitation__actions .btn--whatsapp {
  color: var(--whatsapp);
}

.invitation__actions .btn--whatsapp:hover {
  background: var(--whatsapp-muted);
}

/* ═══ Mobile: SMS + WhatsApp + Copy ═══ */

.invitation__actions--mobile {
  display: flex;
}

/* ═══ Desktop: hidden on mobile ═══ */

.invitation__desktop {
  display: none;
}

/* Choice buttons — 3 options grid */

.invitation__choice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.invitation__choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-fast),
              background var(--transition-fast),
              transform 0.25s var(--ease-spring);
  color: var(--text-secondary);
}

.invitation__choice-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
  transform: translateY(-2px);
}

.invitation__choice-btn:active {
  transform: translateY(0);
}

.invitation__choice-btn svg {
  color: var(--accent);
}

.invitation__choice-btn--whatsapp svg {
  color: var(--whatsapp);
}

.invitation__choice-btn--whatsapp:hover {
  border-color: var(--whatsapp);
  background: var(--whatsapp-muted);
}

.invitation__choice-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.invitation__choice-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  line-height: var(--leading-snug);
}

/* QR code panel */

.invitation__qr {
  text-align: center;
  animation: fade-up 0.3s var(--ease-out);
}

.invitation__qr-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.invitation__qr-code {
  width: 200px;
  height: 200px;
  margin: 0 auto var(--space-sm);
  background: var(--qr-bg);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}

.invitation__qr-code svg {
  width: 100%;
  height: 100%;
}

.invitation__qr-hint {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* Reuses @keyframes fade-up from _animations.css */

@media (max-width: 640px) {
  .invitation__credentials {
    padding: var(--space-md);
  }

  [data-share-credentials-target="secret"] {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .invitation__actions--mobile {
    display: none;
  }

  .invitation__desktop {
    display: block;
  }
}

/* Navigation */

.invitation__nav {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  padding-top: var(--space-sm);
}

/* PWA Install Banner */

.pwa-install {
  position: fixed;
  bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  left: var(--space-md);
  right: var(--space-md);
  z-index: var(--z-toast);
  padding: var(--space-lg);
  background: var(--surface);
  background-image: var(--gradient-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: fade-up 300ms var(--ease-out) both;
}

.pwa-install[hidden] {
  display: none;
}

.pwa-install__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pwa-install__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pwa-install__icon {
  flex-shrink: 0;
  font-size: var(--text-2xl);
  line-height: 1;
}

.pwa-install__title {
  flex: 1;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.pwa-install__close {
  flex-shrink: 0;
  padding: var(--space-xs);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-lg);
  line-height: 1;
}

.pwa-install__close:hover {
  color: var(--text);
}

.pwa-install__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.pwa-install__text strong {
  color: var(--text);
  font-weight: var(--font-semibold);
}

.pwa-install__btn {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  min-height: 48px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.pwa-install__btn:hover {
  background: var(--accent-hover);
}

.pwa-install__btn--copy {
  background: var(--surface-2);
  color: var(--text);
}

.pwa-install__btn--copy:hover {
  background: var(--border);
}

/* Push banner above mobile nav */

@media (max-width: 768px) {
  .pwa-install {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Desktop: limit width */

@media (min-width: 769px) {
  .pwa-install {
    max-width: 400px;
    left: auto;
    right: var(--space-lg);
  }
}

/* ── Nav install button (hidden when standalone) ── */

.pwa-nav-install[hidden] {
  display: none;
}

@media (display-mode: standalone) {
  .pwa-nav-install,
  .pwa-install {
    display: none !important;
  }
}

.pwa-nav-install {
  color: var(--accent);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
}

.pwa-nav-install .nav__label {
  color: var(--accent);
}

.nav-overflow__link.pwa-nav-install {
  color: var(--accent);
  font-weight: var(--font-medium);
}

/* ═══════════════════════════════════════
   Company Logo — ViewComponent
   ═══════════════════════════════════════ */

/* Image logo */

.company-logo {
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

/* Initials fallback */

.company-logo--initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-wide);
  user-select: none;
}

/* Size variants */

.company-logo--sm {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.company-logo--md {
  width: 48px;
  height: 48px;
  font-size: var(--text-sm);
}

.company-logo--lg {
  width: 64px;
  height: 64px;
  font-size: var(--text-lg);
}

.company-logo--xl {
  width: 96px;
  height: 96px;
  font-size: var(--text-2xl);
}

/* ═══════════════════════════════════════
   Company Header — logo + name in settings
   ═══════════════════════════════════════ */

.company-header {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  padding: var(--space-2xl);
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}

.company-header__logo {
  flex-shrink: 0;
}

.company-header__info {
  min-width: 0;
}

.company-header__name {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text);
  margin-bottom: var(--space-2xs);
}

.company-header__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .company-header {
    flex-direction: column;
    text-align: center;
  }
}

/* ═══════════════════════════════════════
   Logo Upload — drag & drop zone
   ═══════════════════════════════════════ */

.logo-upload__zone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  overflow: hidden;
  position: relative;
}

.logo-upload__zone:hover,
.logo-upload--dragover .logo-upload__zone {
  border-color: var(--accent);
  background: var(--accent-muted);
}

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

.logo-upload__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-faint);
}

/* Ensure hidden attribute wins over display: flex */

.logo-upload__preview[hidden],
.logo-upload__placeholder[hidden] {
  display: none;
}

.logo-upload__icon {
  opacity: 0.5;
}

.logo-upload__text {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.logo-upload__preview {
  width: 100%;
  height: 100%;
}

.logo-upload__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 2px);
}

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

.logo-upload__error {
  color: var(--danger);
  font-size: var(--text-xs);
  margin-top: var(--space-xs);
}

/* Payroll pipeline — monthly export workflow */

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

/* Pipeline card — flat children: title, steps, meta, actions */

.pipeline-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--border);
}

.pipeline-card--in-progress { border-left-color: var(--accent-2); }

.pipeline-card--to-lock { border-left-color: var(--warning); }

.pipeline-card--locked { border-left-color: var(--accent); }

.pipeline-card--exported { border-left-color: var(--success); }

/* Title: label + badge */

.pipeline-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.pipeline-card__label {
  font-weight: var(--font-semibold);
  color: var(--text);
  white-space: nowrap;
}

/* Step dots — compact progression indicator */

.pipeline-card__steps {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pipeline-card__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface-2);
  flex-shrink: 0;
}

.pipeline-card__dot--filled {
  background: var(--text-muted);
}

.pipeline-card__dot--current {
  width: 8px;
  height: 8px;
}

/* Current dot glow per status */

.pipeline-card--in-progress .pipeline-card__dot--current {
  background: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-2-bg, rgba(123, 168, 212, 0.15));
}

.pipeline-card--to-lock .pipeline-card__dot--current {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-bg, rgba(224, 144, 80, 0.15));
}

.pipeline-card--locked .pipeline-card__dot--current {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg, rgba(167, 139, 250, 0.15));
}

.pipeline-card--exported .pipeline-card__dot--current {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg, rgba(74, 202, 139, 0.15));
}

.pipeline-card__connector {
  width: 8px;
  height: 2px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.pipeline-card__connector--filled {
  background: var(--text-muted);
}

/* Meta text */

.pipeline-card__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}

/* Actions */

.pipeline-card__actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Year separator */

.pipeline-year-separator {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-sm) var(--space-lg);
}

.pipeline-year-separator::before,
.pipeline-year-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to var(--dir, right), transparent, var(--border));
}

.pipeline-year-separator::after {
  --dir: left;
}

.pipeline-year-separator__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

/* Preview table */

.payroll-preview__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-top: var(--space-lg);
}

.payroll-preview__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.payroll-preview__table th,
.payroll-preview__table td {
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.payroll-preview__table th {
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  position: sticky;
  top: 0;
  background: var(--surface);
}

/* Grouped header row — sticky group labels */

.payroll-preview__group-header th {
  color: var(--accent);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--space-xs);
  text-align: left;
}

.payroll-preview__group-header th:not(:first-child) {
  position: sticky;
  left: var(--sticky-col-width, 0);
  z-index: 1;
  background: var(--surface);
}

/* Sticky first column (employee name) */

.payroll-preview__table th:first-child,
.payroll-preview__table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}

.payroll-preview__table thead th:first-child {
  z-index: 2;
}

.payroll-preview__totals td:first-child {
  background: var(--surface-2);
}

.payroll-preview__table tbody tr:hover td:first-child {
  background: var(--surface-2);
}

/* Employee name + badge cell */

.payroll-preview__cell--employee {
  white-space: nowrap;
  text-align: left;
}

.payroll-preview__table th:first-child {
  text-align: left;
}

.payroll-preview__totals td:first-child {
  text-align: left;
}

.payroll-preview__cell--employee > * {
  display: inline;
  vertical-align: middle;
}

.payroll-preview__cell--employee {
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: max-width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.payroll-preview__cell--employee .badge {
  margin-left: var(--space-sm);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.is-scrolled .payroll-preview__cell--employee {
  max-width: 12ch;
}

.is-scrolled .payroll-preview__cell--employee .badge {
  opacity: 0;
  pointer-events: none;
}

.payroll-preview__name {
  font-weight: var(--font-medium);
}

/* OT highlight colors */

.payroll-preview__cell--warning {
  color: var(--warning);
}

.payroll-preview__cell--danger {
  color: var(--danger);
}

/* Totals row */

.payroll-preview__totals {
  background: var(--surface-2);
}

.payroll-preview__totals td {
  font-weight: var(--font-semibold);
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.payroll-preview__table tbody tr:last-child td {
  border-bottom: none;
}

.payroll-preview__table tbody tr:hover {
  background: var(--surface-2);
}

.payroll-preview__cell--numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.payroll-preview__cell--zone {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-muted);
}

.payroll-preview__cell--meal {
  font-size: var(--text-sm);
  white-space: nowrap;
}

/* Note toggle icon in table */

.payroll-preview__cell--note-header {
  width: 44px;
  text-align: center;
}

.payroll-preview__cell--note-toggle {
  text-align: center;
  width: 44px;
}

.payroll-preview__note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.payroll-preview__note-icon:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.payroll-preview__note-icon--active,
.payroll-preview__note-icon--has-note {
  color: var(--accent);
}

/* Expandable note row */

.payroll-preview__note-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}

.payroll-preview__note-expand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface-2);
}

.payroll-preview__note-expand .btn {
  flex-shrink: 0;
}

.payroll-preview__note-textarea {
  align-self: stretch;
}

.payroll-preview__note-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 120px;
}

.payroll-preview__note-textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  font-size: var(--text-sm);
}

.payroll-preview__note-readonly {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text);
  margin: 0;
  padding: var(--space-xs) 0;
}

/* Attachments preview on send form */

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

.payroll-attachment {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Desktop: flat row — title | steps | meta | actions */

@media (min-width: 641px) {
  .pipeline-card {
    flex-direction: row;
    align-items: center;
    gap: var(--space-2xl);
  }

  .pipeline-card__title {
    width: 200px;
  }
}

@media (max-width: 640px) {
  .pipeline-card {
    position: relative;
  }

  .pipeline-card__title {
    flex: 1;
  }

  .pipeline-card__steps {
    position: absolute;
    top: calc(var(--space-md) + 0.45em);
    right: var(--space-lg);
  }

  .pipeline-card__actions {
    width: 100%;
  }

  .pipeline-card__actions .btn {
    flex: 1;
  }
}

/* ═══════════════════════════════════════
   Time Stepper — futuristic glassmorphic wheels
   ═══════════════════════════════════════ */

/* Glass card container */

.time-stepper {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-md);
}

/* Start + End + Break in a row */

.time-stepper__times {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--space-lg);
}

/* Each field: label → wheels */

.time-stepper__field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

/* Label */

.time-stepper__label {
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

/* Hours : Minutes side by side */

.time-stepper__wheel-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── Wheel container — recessed well ── */

.time-stepper__wheel-container {
  height: 56px;
  overflow: hidden;
  position: relative;
  width: 3.5rem;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.time-stepper .time-stepper__wheel-container--break {
  width: 4.5rem;
}

/* Fade mask: smooth gradient edges */

.time-stepper__wheel-container::before,
.time-stepper__wheel-container::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
}

.time-stepper__wheel-container::before {
  top: 0;
  height: 6px;
  background: linear-gradient(to bottom, var(--surface-2), transparent);
}

.time-stepper__wheel-container::after {
  bottom: 0;
  height: 6px;
  background: linear-gradient(to top, var(--surface-2), transparent);
}

/* Active item highlight — soft glow strip */

.time-stepper__wheel-highlight {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 44px;
  background: linear-gradient(180deg,
    rgba(167, 139, 250, 0.06) 0%,
    rgba(167, 139, 250, 0.10) 50%,
    rgba(167, 139, 250, 0.06) 100%
  );
  z-index: 0;
  pointer-events: none;
}

/* ── Scrollable wheel ── */

.time-stepper__wheel {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
  touch-action: pan-y;
}

.time-stepper__wheel::-webkit-scrollbar {
  display: none;
}

/* Spacer elements */

.time-stepper__wheel-spacer {
  height: 6px;
  flex-shrink: 0;
}

/* Each item — faded ghosts */

.time-stepper__wheel-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  opacity: 0.5;
  transition: all 0.1s ease;
  user-select: none;
  cursor: grab;
}

/* Active item — bright, glowing */

.time-stepper__wheel-item--active {
  color: var(--text);
  opacity: 1;
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  text-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

/* ── Separator : ── */

.time-stepper__separator {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--text-faint);
  opacity: 0.4;
  align-self: center;
}

/* ── Duration badge — next to break wheel ── */

.time-stepper__duration {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}

.time-stepper__duration--danger {
  color: var(--danger);
}

/* ── Break row — label/wheel + duration ── */

.time-stepper__break-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2xl);
  margin-top: var(--space-md);
}

.time-stepper__break-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Hidden selects ── */

.time-stepper__hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════
   Light theme
   ═══════════════════════════════════════ */

[data-theme="light"] .time-stepper {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .time-stepper__wheel-container {
  background: var(--surface);
}

[data-theme="light"] .time-stepper__wheel-container::before {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6) 0%, transparent 100%);
}

[data-theme="light"] .time-stepper__wheel-container::after {
  background: linear-gradient(to top, rgba(255, 255, 255, 0.6) 0%, transparent 100%);
}

[data-theme="light"] .time-stepper__wheel-highlight {
  background: linear-gradient(180deg,
    rgba(139, 92, 246, 0.03) 0%,
    rgba(139, 92, 246, 0.06) 50%,
    rgba(139, 92, 246, 0.03) 100%
  );
}

[data-theme="light"] .time-stepper__wheel-item--active {
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.15);
}

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */

@media (max-width: 380px) {
  .time-stepper__times {
    gap: var(--space-md);
  }

  .time-stepper__wheel-container {
    width: 3rem;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .time-stepper__wheel {
    scroll-behavior: auto;
  }

  .time-stepper__wheel-item {
    transition: none;
  }
}

/* Snake Game — dark-first, design-system tokens */

.snake {
  --snake-bg: var(--bg);
  --snake-grid: rgba(255, 255, 255, 0.07);
  --snake-food: var(--accent);
  --snake-body: var(--text);
  --snake-head: var(--accent);
  --snake-golden: #f5c542;

  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--mobile-header-h) - 68px);
  max-height: 700px;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

@media (min-width: 1024px) {
  .snake {
    height: calc(100dvh - var(--space-xl) * 2);
    max-width: 700px;
    margin: 0 auto;
  }
}

/* Header: score + pause */

.snake__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.snake__scores {
  display: flex;
  gap: var(--space-lg);
}

.snake__score {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.snake__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--font-semibold);
}

.snake__value {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.snake__pause-btn {
  height: 36px;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.snake__pause-btn:hover {
  background: var(--surface-3);
}

/* Arena: canvas + overlays */

.snake__arena {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.snake__arena canvas {
  display: block;
}

/* Overlays */

.snake__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 28, 30, 0.85);
  backdrop-filter: blur(4px);
  z-index: 2;
  animation: snake-fade-in 200ms ease;
}

.snake__overlay--hidden {
  display: none;
}

.snake__overlay-content {
  text-align: center;
  padding: var(--space-xl);
}

.snake__overlay-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.snake__overlay-score {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.snake__overlay-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.snake__overlay-keys {
  display: flex;
  gap: var(--space-xs);
  justify-content: center;
  color: var(--text-faint);
  font-size: var(--text-xs);
}

.snake__overlay-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.snake__overlay-hint--mobile {
  display: none;
}

@media (max-width: 1023px) {
  .snake__overlay-keys--desktop {
    display: none;
  }

  .snake__overlay-hint--mobile {
    display: block;
  }
}

@keyframes snake-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* D-pad — mobile only */

.snake__dpad {
  display: none;
}

@media (max-width: 1023px) {
  .snake__dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-bottom: var(--space-2xs);
  }
}

.snake__dpad-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.snake__dpad-center {
  width: 60px;
  height: 60px;
}

.snake__dpad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.snake__dpad-btn:active {
  background: var(--surface-3);
  color: var(--text);
}

/* Light theme */

[data-theme="light"] .snake {
  --snake-bg: var(--bg);
  --snake-grid: rgba(0, 0, 0, 0.08);
  --snake-food: var(--accent);
  --snake-body: var(--text);
  --snake-head: var(--accent);
  --snake-golden: #e5a800;
}

[data-theme="light"] .snake__overlay {
  background: rgba(248, 249, 250, 0.88);
}

/* Screen shake on death */

@keyframes snake-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-3px, 2px); }
  20% { transform: translate(3px, -2px); }
  30% { transform: translate(-2px, -3px); }
  40% { transform: translate(2px, 3px); }
  50% { transform: translate(-3px, -1px); }
  60% { transform: translate(3px, 1px); }
  70% { transform: translate(-1px, 3px); }
  80% { transform: translate(1px, -3px); }
}

.snake__arena--shake {
  animation: snake-shake 0.4s ease;
}

/* New record celebration */

.snake__overlay-title--record {
  color: var(--accent) !important;
  animation: snake-record-glow 1.5s ease-in-out infinite;
}

@keyframes snake-record-glow {
  0%, 100% { text-shadow: 0 0 10px var(--accent), 0 0 20px rgba(167, 139, 250, 0.3); }
  50% { text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent), 0 0 60px rgba(167, 139, 250, 0.2); }
}

/* ═══════════════════════════════════════
   Events Feed — dashboard event list
   ═══════════════════════════════════════ */

.events-feed__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.events-feed__header::-webkit-details-marker {
  display: none;
}

.events-feed__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.events-feed__chevron {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  transition: transform var(--transition-fast);
}

.events-feed[open] > .events-feed__header .events-feed__chevron {
  transform: rotate(180deg);
}

.events-feed:not([open]) > .events-feed__header {
  margin-bottom: 0;
}

.events-feed__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.events-feed__title h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text);
  margin: 0;
}

.events-feed__settings {
  color: var(--text-muted);
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
}

.events-feed__settings:hover {
  color: var(--text);
}

.events-feed__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.events-feed__category-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.events-feed__overflow {
  text-align: center;
  padding: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Event settings — compact rows ── */

.event-setting {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
}

.event-setting + .event-setting {
  border-top: 1px solid var(--border-subtle);
}

.event-setting__param {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding-left: calc(16px + var(--space-sm));
}

.event-setting__hint {
  font-size: var(--text-xs);
  color: var(--text-faint);
  padding-left: calc(16px + var(--space-sm));
}

@media (min-width: 768px) {
  .event-setting {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2xs) 0;
  }

  .event-setting__param {
    flex-shrink: 0;
    white-space: nowrap;
    padding-left: 0;
  }

  .event-setting__hint {
    flex-shrink: 0;
    padding-left: 0;
  }
}

/* ═══════════════════════════════════════
   Event Row — compact event item
   ═══════════════════════════════════════ */

.event-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.event-row:hover {
  background: var(--surface-2);
}

/* ── Severity dot ── */

.event-row__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  background: var(--text-faint);
}

.event-row--danger .event-row__dot {
  background: var(--danger);
}

.event-row--warning .event-row__dot {
  background: var(--warning);
}

.event-row--success .event-row__dot {
  background: var(--success);
}

.event-row--accent .event-row__dot {
  background: var(--accent);
}

/* ── Content (title + description) ── */

.event-row__content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.event-row__content--link {
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-xs);
  margin: calc(-1 * var(--space-2xs)) calc(-1 * var(--space-xs));
  transition: background var(--transition-fast);
}

.event-row__content--link:hover {
  background: var(--surface-2);
}

.event-row__content--link .event-row__title {
  color: var(--text);
}

.event-row__content--link:hover .event-row__title {
  color: var(--accent);
}

.event-row__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-row__desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Actions (view + dismiss) ── */

.event-row__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-shrink: 0;
}

.event-row__actions form {
  margin: 0;
  padding: 0;
  display: flex;
}

.event-row__action {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.event-row__action:hover {
  color: var(--accent);
  background: var(--surface-hover);
}

/* ── Project links (duplicate refs) ── */

.event-row__project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-2xs);
}

.event-row__project-link {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--accent);
  text-decoration: none;
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  transition: background var(--transition-fast);
}

.event-row__project-link:hover {
  background: var(--accent);
  color: var(--surface);
}

.event-row__action--dismiss:hover {
  color: var(--text);
}

/* ── Grouped event date badges ── */

.event-row__dates {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-2xs);
}

.event-row__date-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: 2px var(--space-xs);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: background var(--transition-fast);
}

.event-row__date-badge:hover {
  background: var(--surface-3);
}

.event-row__date-link {
  color: var(--text-muted);
  text-decoration: none;
}

.event-row__date-link:hover {
  color: var(--accent);
}

.event-row__date-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.event-row__date-dismiss:hover {
  color: var(--danger);
}

.event-row__date-badge form {
  display: flex;
  margin: 0;
  padding: 0;
}

/* ═══════════════════════════════════════
   Number Stepper — inline +/- control
   ═══════════════════════════════════════ */

.number-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
}

.number-stepper__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  line-height: 1;
}

.number-stepper__btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.number-stepper__btn:active {
  background: var(--surface-4);
}

.number-stepper__input {
  width: 2.5em;
  height: 28px;
  padding: 0;
  border: none;
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-family: inherit;
  text-align: center;
  -moz-appearance: textfield;
}

.number-stepper__input::-webkit-outer-spin-button,
.number-stepper__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-stepper__input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ── Full-width variant for standard forms ── */

.number-stepper--full {
  display: flex;
  border-radius: var(--radius-md);
}

.number-stepper--full .number-stepper__btn {
  width: 40px;
  height: 48px;
}

.number-stepper--full .number-stepper__input {
  flex: 1;
  width: auto;
  height: 48px;
  font-size: var(--text-base);
}

/* ═══════════════════════════════════════
   Receipt Upload — drop zone + preview
   ═══════════════════════════════════════ */

.receipt-upload {
  margin-bottom: var(--space-md);
}

/* ── Drop zone ── */

.receipt-upload__zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-fast),
              background var(--transition-fast),
              box-shadow var(--transition-fast);
}

.receipt-upload__zone:hover,
.receipt-upload__zone--dragover {
  border-color: var(--accent);
  background: var(--accent-muted);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

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

.receipt-upload__zone[hidden] {
  display: none;
}

.receipt-upload__zone-icon {
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.receipt-upload__zone:hover .receipt-upload__zone-icon,
.receipt-upload__zone--dragover .receipt-upload__zone-icon {
  opacity: 0.8;
  color: var(--accent);
}

.receipt-upload__zone-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.receipt-upload__zone-hint {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* ── Preview strip (after file selection) ── */

.receipt-upload__preview {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: receipt-fade-in 0.25s var(--ease-spring);
}

.receipt-upload__preview[hidden] {
  display: none;
}

@keyframes receipt-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.receipt-upload__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--surface-2);
}

.receipt-upload__thumb[hidden] {
  display: none;
}

.receipt-upload__pdf-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  flex-shrink: 0;
}

.receipt-upload__pdf-icon[hidden] {
  display: none;
}

.receipt-upload__file-info {
  flex: 1;
  min-width: 0;
}

.receipt-upload__file-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-upload__file-size {
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: 1px;
}

.receipt-upload__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.receipt-upload__remove:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.receipt-upload__error {
  margin-top: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--danger);
  padding: var(--space-xs) var(--space-sm);
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
}

.receipt-upload__error[hidden] {
  display: none;
}

/* ── Existing receipt in edit mode ── */

.receipt-upload__existing {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-sm);
}

.receipt-upload__existing-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.receipt-upload__existing-thumb:hover {
  opacity: 0.8;
}

.receipt-upload__existing-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  flex-shrink: 0;
}

.receipt-upload__existing-link {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.receipt-upload__existing-link:hover {
  color: var(--accent-hover);
}

.receipt-upload__replace-btn {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition-fast);
}

.receipt-upload__replace-btn:hover {
  color: var(--text);
}

/* ── Receipt indicator on card ── */

.receipt-upload__indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-xs);
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-upload__indicator a {
  color: var(--text-faint);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  transition: color var(--transition-fast);
}

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

/* ── OCR status message ── */

.receipt-upload__status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  animation: receipt-fade-in 0.25s var(--ease-spring);
}

.receipt-upload__status[hidden] {
  display: none;
}

.receipt-upload__status--loading {
  color: var(--accent);
  background: var(--accent-muted);
}

.receipt-upload__status--success {
  color: var(--success);
  background: var(--success-bg);
}

.receipt-upload__status--error {
  color: var(--warning);
  background: var(--warning-bg);
}

/* ── Spinner ── */

.receipt-upload__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: receipt-spin 0.6s linear infinite;
  flex-shrink: 0;
}

.receipt-upload__spinner[hidden] {
  display: none;
}

@keyframes receipt-spin {
  to { transform: rotate(360deg); }
}

/* ── OCR field highlight ── */

.receipt-upload__ocr-filled {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px var(--success-bg) !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ── Mobile: larger tap target ── */

@media (max-width: 640px) {
  .receipt-upload__zone {
    padding: var(--space-3xl) var(--space-lg);
  }

  .receipt-upload__zone-icon {
    opacity: 0.6;
  }

  .receipt-upload__zone-label {
    font-size: var(--text-base);
  }
}

/* ── Receipt modal / lightbox ── */

.receipt-modal__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--backdrop);
  backdrop-filter: blur(4px);
  animation: receipt-fade-in 0.2s ease;
}

.receipt-modal__backdrop[hidden] {
  display: none;
}

.receipt-modal__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  background: var(--surface);
}

.receipt-modal__close {
  position: absolute;
  top: calc(-36px - var(--space-sm));
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.receipt-modal__close:hover {
  background: var(--surface-3);
}

.receipt-modal__image {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-xl);
}

.receipt-modal__image[hidden] {
  display: none;
}

.receipt-modal__embed {
  width: 80vw;
  height: 85vh;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--surface-2);
}

.receipt-modal__embed[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .receipt-upload__zone {
    gap: var(--space-xs);
    padding: var(--space-md) var(--space-md);
  }

  .receipt-modal__content {
    max-width: 96vw;
    max-height: 94vh;
  }

  .receipt-modal__image {
    max-width: 96vw;
    max-height: 90vh;
  }

  .receipt-modal__embed {
    width: 96vw;
    height: 90vh;
  }
}

/* ── Light theme ── */

[data-theme="light"] .receipt-upload__zone {
  background: var(--surface);
}

[data-theme="light"] .receipt-upload__zone:hover,
[data-theme="light"] .receipt-upload__zone--dragover {
  background: var(--accent-muted);
}

[data-theme="light"] .receipt-upload__preview,
[data-theme="light"] .receipt-upload__existing {
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════════════
   Week Pulse + Month Heatmap — Premium Calendar Components
   ═══════════════════════════════════════════════════════════════════
   Design philosophy:
   - Today is the hero. It glows, it's elevated, it demands attention.
   - Logged days feel like progress (green fill bars, warm heatmap).
   - Missing days are invitations, not failures (warm dot, not red dash).
   - The total is a badge of accomplishment, not a footnote.
   - Built for construction sites: high contrast, large touch targets,
     glanceable at arm's length in direct sunlight.
   - All colors via tokens — works across dark, light, and outrun themes.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Micro-animations ── */

@keyframes today-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow), 0 0 8px var(--accent-glow); }
  50% { box-shadow: 0 0 0 4px var(--accent-glow), 0 0 14px var(--accent-glow); }
}

@keyframes today-ring-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent-glow); }
  50% { box-shadow: 0 0 0 4px var(--accent-glow), 0 0 10px var(--accent-glow); }
}

/* ══════════════════════════════════
   MONTH HEATMAP
   ══════════════════════════════════ */

.month-grid {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-2xl);
}

/* ── Navigation ── */

.month-grid__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.month-grid__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-lg);
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    transform 0.15s var(--ease-spring);
  flex-shrink: 0;
}

.month-grid__arrow:active {
  transform: scale(0.88);
}

.month-grid__label {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
  text-transform: capitalize;
  text-align: center;
  letter-spacing: var(--tracking-snug);
}

/* ── Day name header row ── */

.month-grid__header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: var(--space-xs);
}

.month-grid__day-name {
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-faint);
  text-align: center;
  padding: var(--space-2xs) 0;
}

/* ── Grid body ── */

.month-grid__body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

/* ── Base cell ── */

.month-grid__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: var(--space-2xs) 0;
  border-radius: var(--radius-sm);
  min-height: 52px;
  position: relative;
  transition:
    background var(--transition-fast),
    transform 0.12s var(--ease-spring);
}

.month-grid__cell--empty {
  min-height: 44px;
}

/* ── Date number ── */

.month-grid__date {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--text-muted);
  transition: color var(--transition-fast), background var(--transition-fast);
}

/* ── Hours text ── */

.month-grid__hours {
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
  min-height: 14px;
  display: flex;
  align-items: center;
  line-height: 1;
  color: var(--text-faint);
  transition: color var(--transition-fast);
}

/* ── Today — ring + glow, instantly visible in sunlight ── */

.month-grid__cell--today {
  background: var(--accent-glow);
  animation: today-ring-pulse 3s ease-in-out infinite;
  z-index: 1;
}

.month-grid__cell--today .month-grid__date {
  background: var(--accent-hover);
  color: var(--text);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

/* ── Logged hours — heatmap intensity ──
   Uses background opacity to create a GitHub-contribution-graph feel.
   Lighter fill for any hours, stronger accent for the cell state. */

.month-grid__cell--logged {
  background: var(--success-bg);
}

.month-grid__cell--logged .month-grid__hours {
  color: var(--success);
}

.month-grid__cell--logged .month-grid__date {
  color: var(--text);
}

/* Today + logged gets heatmap bg blended with accent glow */

.month-grid__cell--today.month-grid__cell--logged {
  background: var(--accent-glow);
}

/* ── Missing past days — warm invitation, NOT alarming ──
   Replaced dashed red outline with a gentle warm background tint.
   The dash becomes a soft dot via border-radius on the span. */

.month-grid__cell--missing {
  background: color-mix(in srgb, var(--warning) 6%, transparent);
}

.month-grid__cell--missing .month-grid__hours {
  color: var(--text-faint);
}

/* Style the dash span into a subtle empty ring */

.month-grid__cell--missing .month-grid__hours > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--text-faint);
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  color: transparent;
}

/* ── Weekend ── */

.month-grid__cell--weekend .month-grid__date {
  opacity: 0.35;
}

/* ── Future ── */

.month-grid__cell--future .month-grid__date {
  opacity: 0.25;
}

/* ── Tappable cells ── */

.month-grid__cell--tappable {
  cursor: pointer;
  transition:
    background var(--transition-fast),
    transform 0.12s var(--ease-spring);
}

.month-grid__cell--tappable:active {
  transform: scale(0.93);
}

/* ── Active (selected) day ── */

.month-grid__cell--active {
  background: var(--accent-muted);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 30%, transparent);
}

.month-grid__cell--active .month-grid__date {
  color: var(--text);
}

/* ── Today dot (shown when today has no entries) ── */

.month-grid__dot {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

/* ── Month total — prominent summary badge ── */

.month-grid__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.month-grid__total strong {
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  letter-spacing: var(--tracking-tight);
}

/* ── Dim today when another day is selected ── */

.month-grid--other-selected .month-grid__cell--today {
  background: transparent;
  animation: none;
  box-shadow: none;
}

/* ── Outrun theme: dark bg on amber accent reads better than white ── */

[data-theme="outrun"] .month-grid__cell--today .month-grid__date,
[data-theme="outrun"] .week-strip__day--today .week-strip__date,
[data-theme="outrun"] .week-strip__day--today.week-strip__day--missing .week-strip__date {
  color: var(--bg);
}

/* ── Day detail panel below grid ── */

.month-grid-detail {
  padding: var(--space-md) 0;
  animation: fade-up 0.15s var(--ease-out);
}

/* ── Hover states (desktop pointer devices only) ── */

@media (hover: hover) {
  .month-grid__arrow:hover {
    color: var(--text);
    background: var(--surface-2);
  }

  .month-grid__cell--tappable:hover {
    background: var(--surface-hover);
  }

  /* Preserve today and active backgrounds on hover */
  .month-grid__cell--today.month-grid__cell--tappable:hover {
    background: var(--accent-glow);
  }

  .month-grid__cell--active.month-grid__cell--tappable:hover {
    background: var(--accent-muted);
  }
}

/* ══════════════════════════════════
   WEEK PULSE
   ══════════════════════════════════ */

.week-strip {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-md);
}

/* ── Navigation ── */

.week-strip__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.week-strip__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-lg);
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    transform 0.15s var(--ease-spring);
  flex-shrink: 0;
}

.week-strip__arrow:active {
  transform: scale(0.88);
}

.week-strip__label {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
  text-transform: capitalize;
  text-align: center;
  letter-spacing: var(--tracking-snug);
}

/* ── 7-day row ── */

.week-strip__days {
  display: flex;
  justify-content: space-around;
}

/* ── Individual day column ── */

.week-strip__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  padding: var(--space-xs) 0;
  border-radius: var(--radius-md);
  min-width: 0;
  position: relative;
  transition:
    background var(--transition-fast),
    transform 0.12s var(--ease-spring);
}

/* ── Day name label ── */

.week-strip__name {
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-faint);
  line-height: 1;
  transition: color var(--transition-fast);
}

/* ── Date circle ── */

.week-strip__date {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-base),
    transform var(--transition-fast);
}

/* ── Status indicator area (hours text or progress) ── */

.week-strip__status {
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color var(--transition-fast);
}

/* ── Tappable day link ── */

a.week-strip__day {
  text-decoration: none;
  cursor: pointer;
}

a.week-strip__day:active {
  transform: scale(0.94);
}

/* ── Active (selected) day in week strip ── */

a.week-strip__day.month-grid__cell--active {
  background: var(--accent-muted);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ── TODAY — the hero ──
   Slightly elevated with glow pulse, accent background,
   date circle filled with accent color. Unmissable. */

.week-strip__day--today {
  background: var(--accent-glow);
  z-index: 1;
}

.week-strip__day--today .week-strip__date {
  background: var(--accent-hover);
  color: var(--text);
  animation: today-glow-pulse 3s ease-in-out infinite;
  transform: scale(1.08);
}

.week-strip__day--today .week-strip__name {
  color: var(--accent);
  font-weight: var(--font-bold);
}

/* ── Dim today when another day is selected ── */

.month-grid--other-selected .week-strip__day--today {
  background: transparent;
}

.month-grid--other-selected .week-strip__day--today .week-strip__date {
  animation: none;
  transform: scale(1);
  box-shadow: none;
}

/* ── Logged hours — green success, mini progress feel ──
   The hours text turns green as a "filled" indicator.
   A subtle bottom bar under the status area reinforces completion. */

.week-strip__day--logged .week-strip__status {
  color: var(--success);
}

.week-strip__day--logged .week-strip__date {
  color: var(--text);
}

/* Mini progress bar under logged days */

.week-strip__day--logged .week-strip__status::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--success);
  opacity: 0.5;
}

/* ── Missing days — warm invitation, not punishment ──
   Replace the dash with a soft empty ring that says "tap to fill".
   Warm background tint, not angry red. */

.week-strip__day--missing .week-strip__status {
  color: transparent;
}

/* Transform the dash span into an empty ring indicator */

.week-strip__day--missing .week-strip__status > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--text-faint);
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  color: transparent;
  opacity: 0.7;
  transition: border-color var(--transition-fast), opacity var(--transition-fast);
}

.week-strip__day--missing .week-strip__date {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Today always wins over missing */

.week-strip__day--today.week-strip__day--missing .week-strip__date {
  color: var(--text);
  opacity: 1;
}

/* ── Weekend — quieted down ── */

.week-strip__day--weekend .week-strip__name,
.week-strip__day--weekend .week-strip__date {
  opacity: 0.35;
}

/* ── Future — barely there ── */

.week-strip__day--future .week-strip__name,
.week-strip__day--future .week-strip__date {
  opacity: 0.25;
}

/* ── Week total — prominent summary badge ── */

.week-strip__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.week-strip__total strong {
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  letter-spacing: var(--tracking-tight);
}

/* ── Hover states (desktop pointer devices only) ── */

@media (hover: hover) {
  .week-strip__arrow:hover {
    color: var(--text);
    background: var(--surface-2);
  }

  a.week-strip__day:hover {
    background: var(--surface-hover);
  }

  /* Preserve today background on hover */
  .week-strip__day--today:hover {
    background: var(--accent-glow);
  }

  /* Missing ring brightens on hover — "go ahead, tap me" */
  a.week-strip__day.week-strip__day--missing:hover .week-strip__status > span {
    border-color: var(--accent);
    opacity: 1;
  }
}

/* ── Light theme: bright text on accent today circle ── */

[data-theme="light"] .month-grid__cell--today .month-grid__date,
[data-theme="light"] .week-strip__day--today .week-strip__date,
[data-theme="light"] .week-strip__day--today.week-strip__day--missing .week-strip__date {
  color: var(--bg);
}

.billing-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-sm);
  font-weight: 500;
  text-align: center;
}

.billing-banner--accent {
  background: var(--accent-muted, rgba(167, 139, 250, 0.10));
  color: var(--accent, #a78bfa);
}

.billing-banner--warning {
  background: var(--warning-bg, rgba(224, 144, 80, 0.12));
  color: var(--warning, #e09050);
}

.billing-banner--danger {
  background: var(--danger-bg, rgba(224, 124, 124, 0.12));
  color: var(--danger, #e07c7c);
}

.billing-banner__message {
  margin: 0;
}

.billing-banner__cta {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: inherit;
  white-space: nowrap;
}

.billing-banner__cta:hover {
  opacity: 0.8;
}

@media (min-width: 769px) {
  .billing-banner {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s var(--ease-out);
  }

  .nav--collapsed ~ .billing-banner,
  html.sidebar-collapsed .billing-banner {
    margin-left: var(--sidebar-collapsed);
  }
}

.billing-page {
  max-width: 600px;
}

.billing-page__card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Plan section */

.billing-page__plan {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
}

.billing-page__plan-detail {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin: 0;
}

/* Stats row */

.billing-page__stats {
  display: flex;
  gap: var(--space-xl);
}

.billing-page__stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.billing-page__stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.billing-page__stat-label {
  font-size: var(--font-sm);
  color: var(--text-muted);
}

/* Actions */

.billing-page__actions {
  display: flex;
  gap: var(--space-sm);
}

/* Info footer */

.billing-page__info {
  margin-top: var(--space-md);
  font-size: var(--font-sm);
  color: var(--text-faint);
  line-height: 1.6;
}

.billing-page__info p {
  margin: 0;
}

@media (max-width: 480px) {
  .billing-page__card {
    padding: var(--space-lg);
  }

  .billing-page__stats {
    flex-direction: column;
    gap: var(--space-md);
  }
}

/* Layouts */

/* Mobile: nav hidden (replaced by mobile-header + bottom sheet) */

.nav:not(.pagy) {
  display: none;
}

.nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: color var(--transition-fast);
  text-decoration: none;
  min-width: 64px;
  min-height: 48px;
  justify-content: center;
  padding: var(--space-xs) var(--space-sm);
  position: relative;
}

.nav__link:hover { color: var(--text); }

.nav__link--active { color: var(--text); }

.nav__link--active .nav__icon {
  background: var(--accent-muted);
  border-radius: var(--radius-full);
  padding: 3px;
}

.nav__link:active { transform: scale(0.95); }

/* Nav divider + disabled — hidden on mobile (nav hidden), shown on desktop */

.nav__divider,
.nav__link--disabled {
  display: none;
}

.nav__links {
  display: contents;
}

.nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav__icon > svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav__label {
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  line-height: 1;
}

/* Notification count badge */

.nav__badge {
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  background: var(--accent);
  color: var(--bg);
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  animation: pulse-ring 2s ease infinite;
}

/* Collapse button — hidden on mobile */

.nav__collapse {
  display: none;
}

/* Footer — hidden on mobile */

.nav__footer {
  display: none;
}

/* Mobile header — company logo bar, hidden on desktop where sidebar has brand */

.mobile-header {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xs) var(--space-sm) var(--space-lg);
  padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
  min-height: var(--mobile-header-h);
  box-sizing: border-box;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.mobile-header__name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-header__app-logo {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.mobile-header__app-logo .app-logo {
  height: 45px;
  width: auto;
}

.mobile-header__menu {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.mobile-header__menu:hover {
  color: var(--text);
}

/* Bottom handle — persistent swipe-up grip to open nav sheet */

.bottom-handle {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  justify-content: center;
  align-items: center;
  min-height: calc(44px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Reset button styles */
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

.bottom-handle__pill {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  transition: background var(--transition-fast), width var(--transition-fast);
}

.bottom-handle:active .bottom-handle__pill {
  background: var(--text);
  width: 44px;
}

@media (max-width: 1023px) {
  .mobile-header {
    display: flex;
  }

  .bottom-handle {
    display: flex;
  }
}

.nav__brand {
  display: none;
}

/* Overflow bottom sheet */

.nav-overflow {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
}

.nav-overflow--open {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.nav-overflow--closing {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.nav-overflow--closing .nav-overflow__backdrop {
  animation: fade-out 0.2s ease-in forwards;
}

.nav-overflow--closing .nav-overflow__panel {
  animation: slide-down-out 0.2s ease-in forwards;
}

.nav-overflow__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  animation: fade-in 0.2s var(--ease-out);
}

.nav-overflow__panel {
  position: relative;
  background: var(--surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: var(--space-sm) 0 0;
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - var(--space-xl));
  overflow-y: auto;
  font-size: var(--text-xs);
  animation: slide-up 0.2s var(--ease-out);
  will-change: transform;
}

/* Drag handle pill */

.nav-overflow__handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: var(--space-xs) auto var(--space-md);
  touch-action: none;
}

.nav-overflow__link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: background var(--transition-fast);
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  font: inherit;
}

.nav-overflow__link:hover,
.nav-overflow__link:active {
  background: var(--surface-2);
}

.nav-overflow__link--active {
  color: var(--accent);
  background: var(--accent-muted);
}

.nav-overflow__link--danger {
  color: var(--danger);
}

.nav-overflow__link--disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.nav-overflow__link svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-overflow__link--danger svg {
  opacity: 1;
}

.nav-overflow__actions {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-lg);
}

.nav-overflow__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-overflow__action-btn:hover,
.nav-overflow__action-btn:active {
  color: var(--text);
  background: var(--surface-2);
}

.nav-overflow__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-xs) var(--space-lg);
}

.nav-overflow__close {
  display: block;
  width: calc(100% - 2 * var(--space-lg));
  margin: var(--space-sm) auto 0;
  padding: var(--space-md);
  background: var(--surface-2);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-overflow__close:hover {
  background: var(--surface-3);
  color: var(--text-secondary);
}

.nav-overflow__close:active {
  background: var(--surface-3);
  color: var(--text);
}

.nav__actions {
  display: none;
}

.nav__logout {
  display: contents;
}

.nav__logout button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  padding: var(--space-xs) var(--space-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  justify-content: center;
}

.nav__logout button:hover {
  color: var(--danger);
}

/* Main content */

.main-content {
  padding: var(--space-lg);
  padding-top: calc(var(--space-lg) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--nav-height) + var(--space-2xl) + env(safe-area-inset-bottom, 0px));
  max-width: 1200px;
  margin: 0 auto;
  animation: content-in 0.2s var(--ease-out);
}

/* Page header */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2xl);
  padding: var(--space-md) var(--space-lg);
  min-height: 80px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.page-header p {
  margin-bottom: 0;
}

.page-header__back {
  flex-basis: 100%;
  margin-bottom: calc(-1 * var(--space-sm));
}

.page-header__actions {
  display: flex;
  gap: var(--space-sm);
}

/* Desktop: all page headers sticky */

@media (min-width: 1024px) {
  .page-header {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    margin: calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)) var(--space-2xl) calc(-1 * var(--space-lg));
    border-radius: 0;
    transition: box-shadow var(--transition-base);
  }
}

/* Mobile: form headers scroll with content (avoid 3 sticky bars) */

@media (max-width: 1023px) {
  .page-header--sticky {
    position: relative;
    margin: 0 calc(-1 * var(--space-lg)) var(--space-md);
    padding-top: var(--space-md);
    border-radius: 0;
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* Glassmorphism header shadow on scroll */

.page-header--scrolled {
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .main-content {
    padding: var(--space-md);
    padding-top: 0;
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  }

  .page-header {
    position: sticky;
    top: var(--mobile-header-h);
    z-index: var(--z-dropdown);
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    margin: 0 calc(-1 * var(--space-md)) var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    min-height: auto;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
    transition: box-shadow var(--transition-base);
  }

  .page-header__back {
    flex-basis: auto;
    margin-bottom: 0;
  }

  .page-header h1 {
    font-size: var(--text-lg);
  }

  .page-header .text--muted {
    font-size: var(--text-xs);
  }

  .stats-grid {
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }

  .dashboard-grid {
    gap: var(--space-md);
    margin-top: var(--space-md);
  }
}

/* Desktop: sidebar nav */

@media (min-width: 1024px) {
  .nav:not(.pagy) {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--sidebar-width);
    flex-direction: column;
    justify-content: flex-start;
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    padding: var(--space-lg);
    padding-bottom: var(--space-lg);
    gap: var(--space-2xs);
    height: auto;
    z-index: calc(var(--z-dropdown) + 1);
    background: var(--surface);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: width 0.25s var(--ease-out);
  }

  .nav-overflow {
    display: none !important;
  }

  .nav__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm) 0;
  }

  .nav__brand-identity {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-width: 0;
  }

  .nav__brand .company-logo {
    width: 100%;
    height: auto;
    max-width: 160px;
    border-radius: var(--radius-lg);
    transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), max-width 0.25s var(--ease-out);
  }

  .nav__brand .company-logo--initials {
    width: 160px;
    height: 160px;
    font-size: var(--text-4xl);
    transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), font-size 0.25s var(--ease-out);
  }

  .nav__app-logo {
    display: flex;
    justify-content: center;
    color: var(--accent);
    margin-bottom: var(--space-lg);
  }

  .nav__app-logo .app-logo {
    height: 45px;
    width: auto;
    transition: height 0.25s var(--ease-out);
  }

  .nav--collapsed .nav__app-logo .app-logo,
  html.sidebar-collapsed .nav__app-logo .app-logo {
    height: 45px;
  }

  .nav__collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-faint);
    cursor: pointer;
    position: fixed;
    top: var(--space-lg);
    left: calc(var(--sidebar-width) - 14px);
    z-index: calc(var(--z-sticky) + 11);
    opacity: 0;
    transition: color var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast), left 0.25s var(--ease-out);
  }

  .nav:not(.pagy):hover .nav__collapse {
    opacity: 1;
  }

  .nav__collapse:hover {
    color: var(--text-muted);
    background: var(--surface-3);
    border-color: var(--border);
  }

  /* Nav divider */
  .nav__divider {
    display: block;
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-xs) var(--space-md);
  }

  /* Disabled nav link */
  .nav__link--disabled {
    display: flex;
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
  }

  .nav__item {
    flex-direction: row;
    width: 100%;
    min-height: auto;
  }

  .nav__link {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    padding: var(--space-sm) var(--space-md) var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    width: 100%;
    min-width: auto;
    min-height: auto;
  }

  .nav__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    width: 100%;
    flex: 1;
    overflow-y: auto;
  }

  .nav__link:hover { background: var(--surface-2); }
  .nav__link--active {
    background: var(--accent-muted);
    color: var(--text);
    border-left: 3px solid var(--accent);
    padding-left: calc(var(--space-lg) - 3px);
  }
  .nav__link--active .nav__icon {
    background: none;
    border-radius: 0;
    padding: 0;
  }

  /* Sidebar footer — user name + plan */
  .nav__footer {
    display: block;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
    margin-top: var(--space-md);
  }

  .nav__footer-actions {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
  }

  .nav__footer-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
  }

  .nav__footer-name {
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }

  .nav__actions {
    display: flex;
    padding-top: var(--space-sm);
  }

  .nav__logout button {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    width: 100%;
    flex-direction: row;
    gap: var(--space-sm);
    font-size: var(--text-sm);
  }

  .nav__logout button:hover {
    background: var(--danger-bg);
  }

  .main-content {
    margin-left: var(--sidebar-width);
    margin-right: 0;
    max-width: none;
    padding-bottom: var(--space-lg);
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
    transition: margin-left 0.25s var(--ease-out);
  }

  /* Collapsed sidebar */
  .nav--collapsed:not(.pagy) {
    width: var(--sidebar-collapsed);
    padding: var(--space-md);
    align-items: center;
  }

  .nav--collapsed .nav__label,
  .nav--collapsed .nav__footer,
  .nav--collapsed .nav__badge,
  .nav--collapsed .nav__divider,
  .nav--collapsed .nav__link--disabled {
    display: none;
  }

  .nav--collapsed .nav__brand {
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-2xl);
  }

  .nav--collapsed .nav__brand-identity {
    justify-content: center;
  }

  .nav--collapsed .nav__brand .company-logo,
  .nav--collapsed .nav__brand .company-logo--initials {
    width: 40px;
    height: 40px;
    max-width: 40px;
    font-size: var(--text-sm);
    transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out);
  }

  .nav--collapsed .nav__link {
    justify-content: center;
    padding: var(--space-sm);
    border-left: none;
  }

  .nav--collapsed .nav__link--active {
    padding-left: var(--space-sm);
    border-left: none;
    border-bottom: 2px solid var(--text-faint);
  }

  .nav--collapsed .nav__collapse {
    left: calc(var(--sidebar-collapsed) - 14px);
  }

  .nav--collapsed .nav__collapse svg {
    transform: rotate(180deg);
  }

  .nav--collapsed + .main-content,
  .nav--collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
  }

  /* Sidebar transition on main content */
  .nav:not(.pagy) {
    transition: width 0.25s var(--ease-out);
  }

  /* Pre-Stimulus collapsed state: applied via html class from sidebar.js
     to prevent FOUC before Stimulus connect() adds .nav--collapsed */
  html.sidebar-collapsed .nav:not(.pagy) {
    width: var(--sidebar-collapsed);
    padding: var(--space-md);
    align-items: center;
    transition: none;
  }

  html.sidebar-collapsed .nav__label,
  html.sidebar-collapsed .nav__footer,
  html.sidebar-collapsed .nav__badge,
  html.sidebar-collapsed .nav__divider,
  html.sidebar-collapsed .nav__link--disabled {
    display: none;
  }

  html.sidebar-collapsed .nav__brand .company-logo,
  html.sidebar-collapsed .nav__brand .company-logo--initials {
    width: 40px;
    height: 40px;
    max-width: 40px;
    font-size: var(--text-sm);
    transition: none;
  }

  html.sidebar-collapsed .nav__link {
    justify-content: center;
    padding: var(--space-sm);
    border-left: none;
  }

  html.sidebar-collapsed .nav__collapse {
    left: calc(var(--sidebar-collapsed) - 14px);
  }

  html.sidebar-collapsed .nav__collapse svg {
    transform: rotate(180deg);
  }

  html.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed);
    transition: none;
  }
}

/* ── Flash popup (matches PWA install card) ── */

.flash {
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  background-image: var(--gradient-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--text-sm);
  position: relative;
  overflow: hidden;
  will-change: transform, opacity;
  animation: flash-slide-up 300ms var(--ease-out) both;
}

.flash__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.flash__message {
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.flash--notice .flash__icon { color: var(--success); }

.flash--alert .flash__icon { color: var(--danger); }

/* Mobile: fixed above bottom nav */

@media (max-width: 1023px) {
  #flash {
    position: fixed;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + var(--space-sm));
    left: var(--space-md);
    right: var(--space-md);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* Desktop: bottom-right popup, like PWA install */

@media (min-width: 1024px) {
  #flash {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    max-width: 400px;
  }
}

.flash__dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  font-size: var(--text-lg);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash__dismiss:hover { color: var(--text); }

/* Auto-dismiss countdown bar */

.flash::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  animation: flash-countdown 5s linear 300ms forwards;
  transform-origin: left;
}

.flash--notice::after { background: var(--success); }

.flash--alert::after {
  background: var(--danger);
  animation-duration: 10s;
}

.flash:hover::after {
  animation-play-state: paused;
}

/* Stat cards grid */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

@media (min-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

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

/* Empty state */

.empty-state {
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

/* Subtle concentric circle texture in the void */

.empty-state::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  border-radius: var(--radius-full);
  background: radial-gradient(
    circle,
    transparent 30%,
    var(--surface-2) 31%,
    var(--surface-2) 32%,
    transparent 33%,
    transparent 50%,
    var(--surface-2) 51%,
    var(--surface-2) 52%,
    transparent 53%,
    transparent 70%,
    var(--surface-2) 71%,
    var(--surface-2) 72%,
    transparent 73%
  );
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.empty-state > * {
  position: relative;
  z-index: 1;
}

.empty-state__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-lg);
  color: var(--text-muted);
  opacity: 0.4;
}

.empty-state__icon > svg {
  width: 100%;
  height: 100%;
}

.empty-state__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.empty-state__text {
  margin-bottom: var(--space-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .empty-state {
    padding: var(--space-2xl) var(--space-md);
  }

  .empty-state__icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
  }

  .empty-state__title {
    font-size: var(--text-lg);
  }
}

/* ═══════════════════════════════════════
   Dashboard grid — 2 column layout
   ═══════════════════════════════════════ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 340px 1fr;
    gap: var(--space-lg);
  }
}

.dashboard-grid__alerts {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ═══════════════════════════════════════
   Dashboard home — split-pane layout
   ═══════════════════════════════════════ */

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

.dashboard-home {
  gap: var(--space-lg);
}

@media (max-width: 1023px) {
  .dashboard-home__projects {
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-sm);
    padding-top: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .main-content:has(.dashboard-home) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-bottom: 0;
  }

  .main-content:has(.dashboard-home) > .page-header {
    margin-bottom: 0;
  }

  .dashboard-home {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .dashboard-home__events {
    flex: 0 1 auto;
    max-height: 40%;
    overflow-y: auto;
    margin: 0 calc(-1 * var(--space-lg));
    padding: 0 var(--space-lg);
    scrollbar-width: thin;
  }

  .dashboard-home__events .events-feed__header {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    margin: 0 calc(-1 * var(--space-lg));
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
  }

  .dashboard-home__events::-webkit-scrollbar { width: 6px; }

  .dashboard-home__events::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
  }

  .dashboard-home__projects {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    margin: 0 calc(-1 * var(--space-lg));
    padding: 0 var(--space-lg) var(--space-2xl);
    scrollbar-width: thin;
  }

  .dashboard-home__projects > .section-header {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    margin: 0 calc(-1 * var(--space-lg));
    padding: var(--space-sm) var(--space-lg);
    border-top: 1px solid var(--border-subtle);
  }

  .dashboard-home__projects > .cards-stack {
    margin-top: var(--space-md);
  }

  .dashboard-home__projects::-webkit-scrollbar { width: 6px; }

  .dashboard-home__projects::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
  }

  .dashboard-home__events:empty {
    display: none;
  }
}

/* ═══════════════════════════════════════
   Dashboard alert sections — grouped alerts
   ═══════════════════════════════════════ */

.dashboard-alert-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.dashboard-alert-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-alert-section__icon {
  color: var(--text-faint);
  flex-shrink: 0;
}

.dashboard-alert-section__title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-faint);
}

/* ═══════════════════════════════════════
   Alert cards — colored left border + icon
   ═══════════════════════════════════════ */

.alert-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--surface);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
  animation: fade-up 0.3s var(--ease-out) both;
}

.alert-card__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-card__content {
  flex: 1;
  min-width: 0;
}

.alert-card__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin-bottom: var(--space-2xs);
}

.alert-card__description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: 0;
}

/* Alert variants */

.alert-card--warning {
  border-left-color: var(--warning);
}

.alert-card--warning .alert-card__icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.alert-card--danger {
  border-left-color: var(--danger);
}

.alert-card--danger .alert-card__icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-card--success {
  border-left-color: var(--success);
}

.alert-card--success .alert-card__icon {
  background: var(--success-bg);
  color: var(--success);
}

.alert-card--accent {
  border-left-color: var(--accent);
}

.alert-card--accent .alert-card__icon {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Muted success — lightweight "all clear" inline text */

.alert-card--muted {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
  font-size: var(--text-sm);
  color: var(--text-faint);
}

.alert-card--muted__icon {
  color: var(--success);
  font-size: var(--text-xs);
}

.alert-card--muted__text {
  font-weight: var(--font-medium);
}

@media (max-width: 768px) {
  .alert-card {
    padding: var(--space-md);
    gap: var(--space-sm);
  }

  .alert-card__icon {
    width: 28px;
    height: 28px;
  }
}

/* ═══════════════════════════════════════
   Validation queue — card-based layout
   ═══════════════════════════════════════ */

.validation-queue {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ═══════════════════════════════════════
   Project tabs — cockpit navigation
   ═══════════════════════════════════════ */

.project-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.project-tabs__tab {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.project-tabs__tab:hover {
  color: var(--text);
}

.project-tabs__tab--active {
  color: var(--text);
  border-bottom-color: var(--text-muted);
  font-weight: var(--font-semibold);
}

.project-tabs__panel {
  animation: fade-up 0.2s var(--ease-out);
}

/* ═══════════════════════════════════════
   Notes log — structured analysis timeline
   ═══════════════════════════════════════ */

.notes-log__compose {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.notes-log__compose-fields {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.notes-log__compose-category {
  flex-shrink: 0;
  width: 130px;
}

.notes-log__compose-content {
  flex: 1;
  min-width: 0;
}

.notes-log__compose-content {
  width: 100%;
}

.notes-log__compose-actions {
  flex-shrink: 0;
}

.notes-log__entries {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.notes-log__entry {
  padding: var(--space-md);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.notes-log__entry-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.notes-log__author {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

.notes-log__time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: auto;
}

.notes-log__delete {
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
  margin-left: var(--space-xs);
}

.notes-log__delete:hover {
  color: var(--danger);
}

.notes-log__entry:hover .notes-log__delete {
  opacity: 1;
}

.notes-log__entry-content {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .notes-log__compose {
    flex-direction: column;
    align-items: stretch;
  }

  .notes-log__compose-fields {
    flex-direction: column;
  }

  .notes-log__compose-category {
    width: 100%;
  }

  .notes-log__compose-actions {
    display: flex;
    justify-content: flex-end;
  }

  .notes-log__delete {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .filters .form-row {
    gap: var(--space-sm);
  }
}

/* ═══════════════════════════════════════
   Timeline — date-grouped timesheet view
   ═══════════════════════════════════════ */

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

@media (max-width: 768px) {
  .timeline {
    gap: var(--space-lg);
  }
}

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

.timeline__date-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-sm);
}

.timeline__date {
  font-weight: var(--font-semibold);
  color: var(--text);
  font-size: var(--text-base);
  text-transform: capitalize;
}

.timeline__day-total {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.timeline__entries {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline__entry {
  display: grid;
  grid-template-columns: 110px 1fr auto auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.timeline__entry:hover {
  background: var(--surface-2);
}

.timeline__entry--today {
  background: var(--surface-2);
  border-left: 3px solid var(--border);
  padding-left: calc(var(--space-md) - 3px);
}

@media (min-width: 768px) {
  .timeline__entry-actions {
    opacity: 0;
    transition: opacity var(--transition-fast);
  }

  .timeline__entry:hover .timeline__entry-actions {
    opacity: 1;
  }
}

.timeline__entry-time {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.timeline__start,
.timeline__end { font-weight: var(--font-medium); }

.timeline__arrow { color: var(--text-faint); font-size: var(--text-2xs); user-select: none; }

.timeline__entry-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.timeline__entry-worker {
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline__entry-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.timeline__entry-hours {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-base);
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.timeline__entry-status {
  text-align: center;
  min-width: 80px;
}

.timeline__entry-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
}

/* Timeline responsive */

@media (max-width: 768px) {
  .timeline__entry {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
    padding: var(--space-sm);
  }

  .timeline__entry-time {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
  }

  .timeline__entry-info {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .timeline__entry-hours {
    text-align: left;
    font-weight: var(--font-semibold);
  }

  .timeline__entry-status { text-align: left; min-width: auto; }

  .timeline__entry-actions {
    min-width: auto;
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border-subtle);
    opacity: 1;
  }

  .timeline__entry:active {
    background: var(--surface-2);
    transition-duration: 50ms;
  }

  .timeline__entry-hours {
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    color: var(--text);
  }
}

/* ═══════════════════════════════════════
   Team grid — project members with contribution bar
   ═══════════════════════════════════════ */

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

.team-member {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.team-member:hover {
  background: var(--surface-2);
}

.team-member__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.team-member__identity {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.team-member__name {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-member__hours {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  white-space: nowrap;
}

.team-member__hours strong {
  color: var(--text);
}

.team-member__bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.team-member__bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
  min-width: 2px;
}

.team-member__footer {
  display: flex;
  justify-content: flex-end;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.team-member:hover .team-member__footer {
  opacity: 1;
}

@media (max-width: 768px) {
  .team-member {
    padding: var(--space-sm) var(--space-md);
  }
}

/* ═══════════════════════════════════════
   Team overview — compact bar chart on project overview tab
   ═══════════════════════════════════════ */

.team-overview {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.team-overview__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.team-overview__title {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.team-overview__chart[hidden] {
  display: none;
}

.team-overview__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.team-overview__toggle:hover {
  color: var(--text);
  background: var(--surface-3);
}

/* ═══════════════════════════════════════
   Worker grid — card-based team view
   ═══════════════════════════════════════ */

.worker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.worker-card {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  border: 1px solid transparent;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-fast),
              background var(--transition-fast),
              transform 0.25s var(--ease-spring),
              box-shadow var(--transition-fast);
}

.worker-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.worker-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.worker-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.worker-card__role-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--surface-alt, var(--accent-muted));
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.worker-card__identity {
  min-width: 0;
  flex: 1;
}

.worker-card__sms-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
  flex-shrink: 0;
}

.worker-card__sms-actions .btn {
  padding: var(--space-xs);
  color: var(--text-muted);
  min-height: auto;
}

.worker-card__sms-actions .btn:hover {
  color: var(--accent);
}

.worker-card__sms-actions form {
  display: flex;
}

.worker-card__name {
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worker-card__phone {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.worker-card__stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.worker-card__stat-label {
  color: var(--text-muted);
}

.worker-card__stat-value {
  font-weight: var(--font-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.worker-card__actions {
  display: flex;
  gap: var(--space-xs);
  margin-top: auto;
}

/* ═══════════════════════════════════════
   Button Dropdown — details/summary
   ═══════════════════════════════════════ */

.btn-dropdown {
  position: relative;
  display: inline-block;
}

.btn-dropdown > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
  cursor: pointer;
}

.btn-dropdown > summary::-webkit-details-marker { display: none; }

.btn-dropdown > summary::marker { display: none; content: ""; }

.btn-dropdown > summary svg:last-child {
  transition: transform 0.2s var(--ease-out);
}

.btn-dropdown[open] > summary svg:last-child {
  transform: rotate(180deg);
}

.btn-dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-xs));
  min-width: 200px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xs);
  z-index: var(--z-dropdown);
}

.btn-dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: background 0.15s var(--ease-out);
}

.btn-dropdown__item:hover {
  background: var(--surface-hover);
}

/* ═══════════════════════════════════════
   FAB — floating action button (worker)
   ═══════════════════════════════════════ */

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-lg) + env(safe-area-inset-bottom, 0px));
  right: var(--space-lg);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-fab);
  transition: transform var(--ease-spring) 0.2s, box-shadow var(--transition-fast);
  text-decoration: none;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}

.fab:active {
  transform: scale(0.95);
}

/* Mobile "Plus" button reset */

.nav__more {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: var(--text-xs);
  min-width: 64px;
  min-height: 48px;
  justify-content: center;
  padding: var(--space-xs) var(--space-sm);
  transition: color var(--transition-fast);
}

.nav__more:hover,
.nav__more:active { color: var(--text); }

/* ═══════════════════════════════════════
   Desktop: constrain text-heavy sections
   ═══════════════════════════════════════ */

@media (min-width: 1024px) {
  .detail-list,
  .notes-log,
  .timeline,
  .validation-queue {
    max-width: 960px;
  }

  .cards-grid,
  .stats-grid,
  .worker-grid {
    gap: 20px;
  }
}

/* ═══════════════════════════════════════
   Wide desktop: better use of space
   ═══════════════════════════════════════ */

@media (min-width: 1440px) {
  .main-content {
    padding-left: var(--space-2xl);
    padding-right: var(--space-2xl);
  }

  .page-header {
    margin-left: calc(-1 * var(--space-2xl));
    margin-right: calc(-1 * var(--space-2xl));
    padding-left: var(--space-2xl);
    padding-right: var(--space-2xl);
  }

  .dashboard-grid {
    grid-template-columns: 380px 1fr;
  }

  .dashboard-home__projects {
    margin-left: calc(-1 * var(--space-2xl));
    margin-right: calc(-1 * var(--space-2xl));
    padding-left: var(--space-2xl);
    padding-right: var(--space-2xl);
  }

  .dashboard-home__projects > .section-header {
    margin-left: calc(-1 * var(--space-2xl));
    margin-right: calc(-1 * var(--space-2xl));
    padding-left: var(--space-2xl);
    padding-right: var(--space-2xl);
  }

  .dashboard-home__events {
    margin-left: calc(-1 * var(--space-2xl));
    margin-right: calc(-1 * var(--space-2xl));
    padding-left: var(--space-2xl);
    padding-right: var(--space-2xl);
  }

  .dashboard-home__events .events-feed__header {
    margin-left: calc(-1 * var(--space-2xl));
    margin-right: calc(-1 * var(--space-2xl));
    padding-left: var(--space-2xl);
    padding-right: var(--space-2xl);
  }
}

/* ═══════════════════════════════════════
   Light theme overrides
   ═══════════════════════════════════════ */

[data-theme="light"] .nav:not(.pagy) {
  border-color: var(--glass-border);
}

@media (min-width: 1024px) {
  [data-theme="light"] .nav:not(.pagy) {
    border-right-color: var(--border);
    background: var(--surface);
    background-image: none;
  }
}

/* Theme toggle & settings buttons in sidebar footer */

.nav__theme-toggle,
.nav__footer-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav__theme-toggle:hover,
.nav__footer-settings:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ═══════════════════════════════════════
   Dashboard day detail — grouped by worker
   ═══════════════════════════════════════ */

.day-detail__worker-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-2xs);
}

.day-detail__worker-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text);
  flex: 1;
}

.day-detail__worker-total {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.day-detail__worker-group {
  margin-bottom: var(--space-lg);
}

.day-detail__worker-group:last-child {
  margin-bottom: 0;
}

/* Turbo progress bar */

.turbo-progress-bar {
  background: var(--accent);
  height: 3px;
}

/* ═══════════════════════════════════════
   Custom confirm dialog
   ═══════════════════════════════════════ */

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.confirm-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  animation: fade-in 0.15s var(--ease-out);
}

.confirm-dialog__panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: scale-in 0.2s var(--ease-out);
}

.confirm-dialog__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.confirm-dialog__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-xl);
}

.confirm-dialog__actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Auth layout — split-screen on desktop, stacked on mobile */

.auth-body {
  background: var(--bg);
  min-height: 100dvh;
}

.auth-split {
  display: flex;
  min-height: 100dvh;
}

/* Left branded panel */

.auth-split__brand {
  display: none;
  flex: 0 0 45%;
  background: var(--surface);
  position: relative;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  padding: 4rem;
  position: relative;
  z-index: 1;
}

.auth-brand__logo {
  margin-bottom: var(--space-lg);
}

.auth-brand__logo-img {
  width: clamp(180px, 25vw, 280px);
  height: auto;
}

.auth-brand__taglines {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-brand__tagline {
  font-size: var(--text-2xl);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  line-height: var(--leading-tight);
  text-align: left;
  min-width: 100%;
}

.auth-brand__tagline-accent {
  color: var(--accent);
  font-weight: var(--font-bold);
}

/* Right form panel */

.auth-split__form {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-wrapper {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-3xl);
  box-shadow: var(--shadow-card);
  animation: fade-up 0.3s var(--ease-out);
}

/* Company branding in auth card */

.auth-card__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.auth-card__brand .auth-card__title {
  font-size: var(--text-xl);
  color: var(--text);
  margin-bottom: 0;
}

.auth-card__title {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-xs);
}

.auth-card__title-img {
  width: clamp(120px, 20vw, 180px);
  height: auto;
}

.auth-card__subtitle {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.auth-card__subtitle-img {
  width: clamp(280px, 40vw, 400px);
  height: auto;
}

.auth-card .form-group {
  margin-bottom: var(--space-md);
}

/* Auth flash: inline within card flow, not fixed */

.auth-wrapper #flash {
  position: static;
  transform: none;
  max-width: none;
  width: auto;
  pointer-events: auto;
  margin-bottom: var(--space-md);
}

.auth-wrapper .flash {
  box-shadow: none;
}

/* Desktop: show split layout */

@media (min-width: 1024px) {
  .auth-split__brand {
    display: block;
  }

  .auth-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: var(--space-2xl) 0;
  }
}

/* Mobile: branded header above form */

@media (max-width: 1023px) {
  .auth-split {
    flex-direction: column;
  }

  .auth-split__form {
    flex: 1;
    padding-top: var(--space-2xl);
  }
}

/* ── Footer link ── */

.auth-card__footer {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-lg);
}

.auth-card__link {
  color: var(--accent);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: text-decoration var(--transition-fast);
}

.auth-card__link:hover {
  text-decoration: underline;
}

/* ── Onboarding step indicator ── */

.onboarding-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-2xl);
}

.onboarding-steps__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.onboarding-steps__dot--done {
  background: var(--success);
  border-color: var(--success);
}

.onboarding-steps__dot--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.onboarding-steps__line {
  width: 48px;
  height: 2px;
  background: var(--border-subtle);
}

/* ═══════════════════════════════════════
   Light theme overrides
   ═══════════════════════════════════════ */

[data-theme="light"] .auth-split__brand {
  background-image: none;
}

/* ═══════════════════════════════════════
   Worker Dashboard — Design System 2.0
   ═══════════════════════════════════════ */

/* ── Worker layout — no bottom nav, no content-in (breaks fixed FAB) ── */

.worker-layout .main-content {
  padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 0px));
  animation: none;
  overflow-x: clip;
}

.worker-layout .nav-overflow__panel {
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
}

/* Flash: override dashboard positioning (no sidebar, above FAB) */

.worker-layout #flash {
  position: fixed;
  top: auto;
  left: var(--space-md);
  right: var(--space-md);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 56px + var(--space-lg) + var(--space-sm));
  transform: none;
  max-width: none;
  z-index: calc(var(--z-sticky) + 5);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: auto;
}

/* ── Worker header — company branding bar + menu ── */

.worker-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xs) var(--space-sm) var(--space-lg);
  padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
  min-height: var(--mobile-header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.worker-header__name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.worker-header__menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast);
  animation: menu-shimmer 4s ease-in-out infinite;
}

[data-theme="light"] .worker-header__menu {
  animation-name: menu-shimmer-light;
}

.worker-header__menu:hover,
.worker-header__menu:active {
  background: var(--surface-2);
  color: var(--text);
}

/* ── Expandable FAB menu ── */

/* ── FAB backdrop ── */

.fab-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-fab) - 1);
  background: rgba(0, 0, 0, 0);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  pointer-events: none;
  transition:
    background 0.3s ease,
    backdrop-filter 0.3s ease,
    -webkit-backdrop-filter 0.3s ease;
}

.fab-menu--open .fab-menu__backdrop {
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

/* ── FAB container ── */

.fab-menu {
  position: fixed;
  bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  right: var(--space-lg);
  z-index: var(--z-fab);
  width: 60px;
  height: 60px;
  overflow: visible;
}

/* ── Trigger button ── */

.fab-menu__trigger {
  position: relative;
  z-index: 1;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(124, 58, 237, 0.5);
  border: none;
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-spring),
    box-shadow 0.2s ease;
}

.fab-menu--open .fab-menu__trigger {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(124, 58, 237, 0.7);
}

.fab-menu--locked .fab-menu__trigger {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ── Action list — absolute, radiates around trigger ── */

.fab-menu__actions {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fab-menu--open .fab-menu__actions {
  pointer-events: auto;
}

/* Each action: btn only is absolutely positioned, label floats separately */

.fab-menu__action {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 0.3s ease,
    transform 0.3s var(--ease-spring);
  pointer-events: none;
}

/* R=90px circle — action 1 at 90° (straight up), action 2 at 150° (upper-left) */

.fab-menu--open .fab-menu__action:nth-child(1) {
  opacity: 1;
  transform: translate(0px, -100px) scale(1);
  transition-delay: 0.05s;
  pointer-events: auto;
}

.fab-menu--open .fab-menu__action:nth-child(2) {
  opacity: 1;
  transform: translate(-78px, -45px) scale(1);
  transition-delay: 0.0s;
  pointer-events: auto;
}

/* ── Action button — purple, white icon ── */

.fab-menu__action-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
  flex-shrink: 0;
  transition: transform 0.15s var(--ease-spring);
}

.fab-menu__action:active .fab-menu__action-btn {
  transform: scale(0.9);
}

/* ── Label pill ── */

.fab-menu__label {
  order: -1;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: white;
  background: rgba(30, 20, 50, 0.85);
  border: 1px solid rgba(167, 139, 250, 0.25);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* ── FAB icon rotation on expand ── */

.fab__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease-spring);
}

.fab__icon--open {
  transform: rotate(45deg);
}

/* ── Worker tabs — week / month toggle ── */

.worker-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.worker-tabs__tab {
  flex: 1;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-align: center;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.worker-tabs__tab:hover {
  color: var(--text);
}

.worker-tabs__tab--active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: var(--font-semibold);
}

.worker-tabs__panel {
  animation: fade-up 0.2s var(--ease-out);
}

/* ── Section header ── */

.worker-section {
  margin-bottom: var(--space-2xl);
}

.worker-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.worker-section__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.worker-section__count {
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  background: var(--surface-3);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Timesheet row — compact inline card ── */

.worker-ts {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  border-left: 3px solid var(--border);
  transition: background var(--transition-fast);
}

.worker-ts__left {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.worker-ts__project {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin-bottom: var(--space-2xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worker-ts__time {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.worker-ts__icon {
  flex-shrink: 0;
  opacity: 0.5;
}

.worker-ts__sep {
  opacity: 0.4;
}

.worker-ts__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  max-width: calc(100% - 3rem);
}

.worker-ts__badges:empty {
  display: none;
}

.worker-ts__comment {
  margin-top: var(--space-2xs, 2px);
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  line-height: var(--leading-snug);
}

.worker-ts__right {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.worker-ts__hours {
  font-size: var(--text-xl);
  font-weight: var(--font-extrabold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tighter);
}

/* Actions row */

.worker-ts__actions {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  margin-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}

.worker-ts__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.worker-ts__action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.worker-ts__action--danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* button_to wraps in a form — reset it */

.worker-ts__actions form {
  display: contents;
}

/* ── Empty state ── */

.worker-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
}

.worker-empty__icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
  color: var(--text-faint);
}

.worker-empty__text {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

/* ── Compact greeting page-header for "mes heures" index views ── */

.worker-layout .page-header,
.my-hours .page-header {
  min-height: auto;
  padding: var(--space-xs) var(--space-lg) var(--space-sm);
  margin: 0 calc(-1 * var(--space-md));
  border-bottom: 1px solid var(--border-subtle);
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  top: 0;
}

.worker-layout .page-header:has(.page-header__back),
.my-hours .page-header:has(.page-header__back) {
  justify-content: flex-end;
}

.worker-layout .page-header__back,
.my-hours .page-header__back {
  position: absolute;
  left: var(--space-md);
}

.worker-layout .page-header h1,
.my-hours .page-header h1 {
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-snug);
}

.worker-layout .page-header .text--muted,
.my-hours .page-header .text--muted {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* ── Worker page-header sticky on mobile (form pages: new/edit) ── */

@media (max-width: 768px) {
  .worker-layout .page-header--sticky {
    position: sticky;
    top: var(--mobile-header-h);
    z-index: var(--z-dropdown);
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    margin: 0 calc(-1 * var(--space-md)) var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    transition: box-shadow var(--transition-base);
  }

  .worker-layout .main-content {
    padding: var(--space-md);
    padding-top: 0;
    padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .worker-hero__greeting {
    font-size: var(--text-xl);
  }

  .worker-ts,
  .purchase-doc-card {
    padding: var(--space-sm) var(--space-md);
  }

  .worker-ts__hours {
    font-size: var(--text-lg);
  }

  /* ── Compact form for mobile (worker + boss/staff "mes heures" forms) ── */
  .my-hours-form .page-header {
    min-height: auto;
    padding: var(--space-sm) var(--space-lg);
    margin-bottom: var(--space-sm);
    align-items: center;
  }

  .my-hours-form .page-header__back {
    flex-basis: auto;
    margin-bottom: 0;
  }

  .my-hours-form .page-header h1 {
    font-size: var(--text-base);
    line-height: var(--leading-tight);
  }

  .my-hours-form .page-header .text--muted {
    font-size: var(--text-xs);
  }

  .worker-layout .form-card,
  .my-hours-form .form-card {
    padding-top: var(--space-sm);
  }

  .worker-layout .form-group,
  .my-hours-form .form-group {
    margin-bottom: var(--space-md);
  }

  /* Time fields stack vertically on mobile (default 1fr from _forms.css) */

  .worker-layout .hours-preview,
  .my-hours-form .hours-preview {
    font-size: var(--text-xl);
    padding: var(--space-xs) var(--space-sm);
  }

  /* Hide redundant date text and cancel button */
  .worker-layout .form-card > form > .text--muted.mb-md,
  .my-hours-form .form-card > form > .text--muted.mb-md {
    display: none;
  }

  .worker-layout .form-actions .btn--ghost,
  .my-hours-form .form-actions .btn--ghost {
    display: none;
  }

  .worker-layout .form-actions,
  .my-hours-form .form-actions {
    padding: var(--space-sm) var(--space-lg);
    padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    margin-top: var(--space-sm);
  }

  .worker-layout .form-select,
  .my-hours-form .form-select {
    min-height: 44px;
  }

  .worker-layout .time-select .form-select,
  .my-hours-form .time-select .form-select {
    padding-right: var(--space-lg);
    background-position: right var(--space-xs) center;
  }
}

/* ── Day detail tabs ── */

.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.detail-tabs__tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.detail-tabs__tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.detail-tabs__count {
  font-size: var(--text-2xs);
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
}

.detail-tabs__tab--active .detail-tabs__count {
  background: var(--accent-muted);
  color: var(--accent);
}

/* ── Purchase document cards ── */

.purchase-docs-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ── Purchase document row — mirrors worker-ts card ── */

.purchase-doc-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  border-left: 3px solid var(--border);
  transition: background var(--transition-fast);
}

.purchase-doc-card__row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.purchase-doc-card__row + .purchase-doc-card__row {
  margin-top: 2px;
}

.purchase-doc-card__supplier {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-doc-card__badge {
  margin-left: auto;
  flex-shrink: 0;
}

.purchase-doc-card__reference {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.purchase-doc-card__project {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-doc-card__icon {
  flex-shrink: 0;
  opacity: 0.5;
}

.purchase-doc-card__amount {
  margin-left: auto;
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.purchase-doc-card__comment {
  font-size: var(--text-sm);
  color: var(--text-faint);
  margin-top: var(--space-2xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions row */

.purchase-doc-card__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.purchase-doc-card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.purchase-doc-card__action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.purchase-doc-card__action--danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* button_to wraps in a form — reset it */

.purchase-doc-card__actions form {
  display: contents;
}

/* ── "Mes heures" — boss/staff personal timesheet view ── */

.main-content:has(.my-hours) {
  animation: none;
}

.my-hours .fab-menu {
  bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}

/* ── Light theme overrides ── */

[data-theme="light"] .worker-ts,
[data-theme="light"] .purchase-doc-card {
  border-left-color: var(--border);
}

/* Admin layout — uses shared .nav + .main-content from _dashboard.css
   This file only adds admin-specific overrides */

/* Reset dashboard-specific sidebar tweaks that don't apply to admin nav */

@media (min-width: 1024px) {
  .nav--admin {
    z-index: auto;
  }

  .nav--admin .nav__brand {
    justify-content: flex-start;
  }

  .nav--admin .nav__more {
    display: none;
  }
}

/* Admin page-header nav toggle — visible only on mobile */

.admin-nav-toggle {
  display: none;
  padding: var(--space-xs);
  line-height: 0;
}

@media (max-width: 1023px) {
  .admin-nav-toggle {
    display: flex;
  }
}

/* Hide columns on mobile */

@media (max-width: 768px) {
  .admin-content .hide-mobile {
    display: none;
  }
}

/* Admin alert banner */

.admin-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-lg);
}

.admin-banner--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.admin-banner__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

.admin-banner p {
  margin: 0;
}

/* Admin content max-width constraint */

.admin-content {
  max-width: calc(1000px + var(--space-3xl) * 2);
  overflow-x: clip;
}

/* Admin has no mobile-header, so page-header sticks to top: 0 at all sizes */

@media (max-width: 1023px) {
  .admin-content .page-header {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    margin: 0 calc(-1 * var(--space-lg)) var(--space-2xl);
    border-radius: 0;
    transition: box-shadow var(--transition-base);
  }
}

@media (max-width: 768px) {
  .admin-content .page-header {
    margin: 0 calc(-1 * var(--space-md)) var(--space-sm);
    padding: var(--space-md) var(--space-md);
    min-height: auto;
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
  }

  .admin-show-header {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    background: var(--bg);
    margin: 0 calc(-1 * var(--space-lg)) var(--space-3xl);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* ========================================
   Admin sections — visual grouping
   ======================================== */

.admin-section {
  margin-bottom: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border-subtle);
}

.admin-section:first-child,
.page-header + .admin-section,
.admin-show-header + .admin-section,
.admin-show-overview + .admin-section,
.admin-grid .admin-section {
  border-top: none;
  padding-top: 0;
}

.admin-section__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-faint);
  margin-bottom: var(--space-md);
}

/* ========================================
   Admin dashboard grid (side-by-side tables)
   ======================================== */

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-3xl);
}

@media (min-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
  }

  .admin-grid .admin-section {
    margin-bottom: 0;
  }
}

/* 2-column stats grid variant */

.stats-grid--2 {
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .stats-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Compact table for dashboard widgets */

.table--compact thead th {
  font-size: var(--text-2xs);
  padding: var(--space-sm) var(--space-md);
}

.table--compact tbody td {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
}

/* Prevent compact tables from scrolling on mobile */

@media (max-width: 768px) {
  .table--compact {
    table-layout: fixed;
  }

  .table--compact td {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .table--compact .badge:not(.badge--sm) {
    font-size: var(--text-xs);
    padding: 0.25em 0.75em;
  }
}

/* Empty state inside admin sections */

.admin-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--text-faint);
  font-size: var(--text-sm);
}

/* ========================================
   OTP setup QR code
   ======================================== */

.otp-setup__qr {
  display: flex;
  justify-content: center;
  margin: var(--space-lg) 0;
  padding: var(--space-lg);
  background: var(--qr-bg);
  border-radius: var(--radius-md);
  overflow: visible;
}

.otp-setup__qr svg {
  width: 100%;
  max-width: 220px;
  height: auto;
}

/* ========================================
   Admin show page — header
   ======================================== */

.admin-show-header {
  margin-bottom: var(--space-3xl);
}

.admin-show-header__top {
  margin-bottom: var(--space-md);
}

.admin-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.admin-back:hover {
  color: var(--accent);
}

.admin-back svg {
  flex-shrink: 0;
}

.admin-show-header__main {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}

.admin-show-header__name {
  font-size: var(--text-2xl);
  font-weight: var(--font-extrabold);
  color: var(--text);
  margin: 0;
}

.admin-show-header__badges {
  display: flex;
  gap: var(--space-xs);
}

.admin-show-header__meta {
  font-size: var(--text-sm);
  color: var(--text-faint);
}

.admin-show-header__sep::before {
  content: "·";
  margin: 0 var(--space-sm);
}

/* ========================================
   Admin show page — overview cards
   ======================================== */

.admin-show-overview {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-3xl);
}

@media (min-width: 480px) {
  .admin-show-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

@media (min-width: 768px) {
  .admin-show-overview {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .admin-show-overview {
    grid-template-columns: repeat(4, 1fr);
  }
}

.admin-show-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.admin-show-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-muted);
  color: var(--accent);
  flex-shrink: 0;
}

.admin-show-card__icon--success {
  background: var(--success-bg);
  color: var(--success);
}

.admin-show-card__icon--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.admin-show-card__icon--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.admin-show-card__value {
  font-size: var(--text-xl);
  font-weight: var(--font-extrabold);
  color: var(--text);
  line-height: 1;
}

.admin-show-card__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================================
   Admin show page — description list
   ======================================== */

.admin-dl {
  display: grid;
  gap: 1px;
  background: var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.admin-dl__row {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
}

@media (min-width: 480px) {
  .admin-dl__row {
    grid-template-columns: 160px 1fr;
  }
}

.admin-dl__row dt {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: var(--surface-2);
}

.admin-dl__row dd {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text);
  margin: 0;
}

/* ========================================
   Admin show page — role breakdown
   ======================================== */

.admin-show-roles {
  display: flex;
  gap: var(--space-lg);
}

.admin-show-roles__item {
  text-align: center;
}

.admin-show-roles__count {
  font-size: var(--text-xl);
  font-weight: var(--font-extrabold);
  color: var(--text);
  line-height: 1;
}

.admin-show-roles__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Muted text helper — use .text--muted from _typography.css instead */

.text-muted {
  color: var(--text-muted);
}

.otp-setup__hint {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

/* ========================================
   Plan breakdown bar — horizontal stacked
   ======================================== */

.plan-bar {
  display: flex;
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: var(--space-md);
}

.plan-bar__segment {
  min-width: 4px;
  transition: width 0.6s var(--ease-out);
}

.plan-bar__segment:first-child {
  border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.plan-bar__segment:last-child {
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.plan-bar__segment:only-child {
  border-radius: var(--radius-full);
}

.plan-bar__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: var(--text-sm);
}

.plan-bar__legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-muted);
}

.plan-bar__legend-item strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.plan-bar__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ========================================
   Maintenance page
   ======================================== */

/* Status card */

.maintenance-status {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--success);
}

.maintenance-status--active {
  border-left-color: var(--warning);
}

.maintenance-status__indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--success-bg);
  flex-shrink: 0;
}

.maintenance-status--active .maintenance-status__indicator {
  background: var(--warning-bg);
}

.maintenance-status__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
}

.maintenance-status--active .maintenance-status__dot {
  background: var(--warning);
  animation: pulse-dot 2s ease-in-out infinite;
}

.maintenance-status__label {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.maintenance-status__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-2xs);
}

/* Toggle switch */

.maintenance-toggle {
  position: relative;
}

.maintenance-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.maintenance-toggle__label {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  cursor: pointer;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-lg);
  transition: background var(--transition-fast);
}

.maintenance-toggle__label:hover {
  background: var(--surface-2);
}

.maintenance-toggle__track {
  position: relative;
  width: 60px;
  height: 32px;
  background: var(--success);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: background var(--transition-base);
}

.maintenance-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  transition: transform var(--transition-base) var(--ease-spring),
              background var(--transition-base);
}

.maintenance-toggle__input:checked ~ .maintenance-toggle__label .maintenance-toggle__track {
  background: var(--danger);
}

.maintenance-toggle__input:checked ~ .maintenance-toggle__label .maintenance-toggle__thumb {
  transform: translateX(28px);
}

.maintenance-toggle__input:focus-visible ~ .maintenance-toggle__label .maintenance-toggle__track {
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.maintenance-toggle__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.maintenance-toggle__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text);
}

.maintenance-toggle__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
}

/* Info card */

.maintenance-info {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.maintenance-info__icon {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  color: var(--accent-2);
  flex-shrink: 0;
}

.maintenance-info__content {
  min-width: 0;
}

.maintenance-info__content strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.maintenance-info__content p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-md);
}

.maintenance-info__code {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-2);
}

/* ========================================
   Server metrics page
   ======================================== */

.admin-show-card__body {
  min-width: 0;
}

.admin-show-card__detail {
  font-size: var(--text-xs);
  margin-top: 2px;
}

/* Server chart group (fieldset-like grouped card) */

.server-group {
  background: var(--surface);
  background-image: var(--gradient-surface);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-2xl);
}

.server-group--cpu    { border-left-color: var(--accent); }

.server-group--net    { border-left-color: var(--accent-2); }

.server-group--disk   { border-left-color: var(--success); }

.server-group__header {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-lg) var(--space-lg) 0;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.server-group--cpu  .server-group__header { color: var(--accent); }

.server-group--net  .server-group__header { color: var(--accent-2); }

.server-group--disk .server-group__header { color: var(--success); }

.server-group__items {
  display: flex;
  flex-direction: column;
}

.server-group__items > .server-chart + .server-chart {
  border-top: 1px solid var(--border);
}

.server-chart {
  padding: var(--space-lg);
}

.server-chart__title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text);
  margin: 0 0 var(--space-2xs);
}

.server-chart__value {
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-md);
}

/* Chartkick chart container */

.server-chart .server-chart__canvas {
  height: 200px;
}

/* Server hint tooltips */

.server-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-xs);
  color: var(--text-faint);
  cursor: help;
  vertical-align: middle;
}

.server-hint::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(280px, 90vw);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-normal);
  text-transform: none;
  letter-spacing: 0;
  line-height: var(--leading-snug);
  color: var(--text-muted);
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: var(--z-overlay);
}

.server-hint:hover::after {
  opacity: 1;
}

@media (max-width: 640px) {
  .server-group__header,
  .server-chart__title {
    position: relative;
  }

  .server-hint {
    position: static;
  }
}

.server-footer {
  text-align: center;
  padding-top: var(--space-lg);
}

.server-footer__text {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* Utilities */

/* Spacing */

.mt-sm { margin-top: var(--space-sm); }

.mt-md { margin-top: var(--space-md); }

.mt-lg { margin-top: var(--space-lg); }

.mb-sm { margin-bottom: var(--space-sm); }

.mb-md { margin-bottom: var(--space-md); }

.mb-lg { margin-bottom: var(--space-lg); }

.mb-xl { margin-bottom: var(--space-2xl); }

.mb-2xl { margin-bottom: var(--space-3xl); }

/* Flexbox */

.flex { display: flex; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }

.flex-center { display: flex; align-items: center; justify-content: center; }

.flex-gap-sm { gap: var(--space-sm); }

.flex-gap-md { gap: var(--space-md); }

.flex-wrap { flex-wrap: wrap; }

/* Grid */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }

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

/* Text */

.text-right { text-align: right; }

.text-center { text-align: center; }

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

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Visibility */

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

.hidden { display: none !important; }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* Action button groups (tables, cards) */

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

/* Skip to content */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: var(--z-overlay);
  padding: var(--space-sm) var(--space-md);
  background: var(--accent);
  color: var(--bg);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
}

.skip-link:focus {
  top: var(--space-md);
}
