/* ============================================================
   BriefPad — Premium Design System
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;
  --brand-950: #1e1b4b;

  /* Semantic */
  --success: #6366f1;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #2563eb;
  --info-light: #eff6ff;

  /* Neutrals — warmer grays */
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-150: #eef0f2;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* Surfaces */
  --surface-primary: #ffffff;
  --surface-secondary: #f9fafb;
  --surface-tertiary: #f3f4f6;
  --bg-page: #f9fafb;

  /* Typography */
  --font-display: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Shadows — layered for depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-card-hover: 0 8px 25px -5px rgba(0,0,0,0.08), 0 4px 10px -4px rgba(0,0,0,0.04);
  --shadow-modal: 0 25px 50px -12px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.03);
  --shadow-brand: 0 4px 14px -3px rgba(99, 102, 241, 0.35);
  --shadow-brand-lg: 0 10px 25px -5px rgba(99, 102, 241, 0.25), 0 8px 10px -6px rgba(99, 102, 241, 0.1);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --radius-2xl: 22px;
  --radius-full: 9999px;

  /* Easing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);

  /* Spacing scale (supplementary to Tailwind) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
}

/* ── Base ──────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  color: var(--gray-900);
  background: var(--bg-page);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* Faster tap response on touch devices */
button, a, [role="button"] {
  touch-action: manipulation;
}

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

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Selection ─────────────────────────────────────────────── */
::selection {
  background: rgba(99, 102, 241, 0.15);
  color: var(--gray-900);
}

/* ── Links ─────────────────────────────────────────────────── */
a { color: inherit; }

/* ── Glass ─────────────────────────────────────────────────── */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-strong {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ── Gradient Text ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 40%, var(--brand-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-brand {
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-600) 50%, var(--brand-700) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Grid Pattern ──────────────────────────────────────────── */
.grid-pattern {
  background-image: radial-gradient(circle, var(--gray-200) 0.8px, transparent 0.8px);
  background-size: 28px 28px;
}

/* ── Focus Ring ────────────────────────────────────────────── */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface-primary), 0 0 0 4px var(--brand-500);
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

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

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

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

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

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

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

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

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.08); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.16); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

@keyframes progress-fill {
  from { width: 0; }
}

.animate-fade-in { animation: fade-in 0.4s var(--ease) forwards; }
.animate-fade-in-up { animation: fade-in-up 0.5s var(--ease-smooth) forwards; }
.animate-fade-in-down { animation: fade-in-down 0.3s var(--ease) forwards; }
.animate-scale-in { animation: scale-in 0.3s var(--ease-spring) forwards; }
.animate-slide-in-right { animation: slide-in-right 0.35s var(--ease-smooth) forwards; }
.animate-slide-in-up { animation: slide-in-up 0.4s var(--ease-smooth) forwards; }
.animate-shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.5) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}
.animate-glow { animation: glow-pulse 3s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-spin-slow { animation: spin-slow 12s linear infinite; }

.animate-delay-75 { animation-delay: 75ms; opacity: 0; }
.animate-delay-100 { animation-delay: 100ms; opacity: 0; }
.animate-delay-150 { animation-delay: 150ms; opacity: 0; }
.animate-delay-200 { animation-delay: 200ms; opacity: 0; }
.animate-delay-300 { animation-delay: 300ms; opacity: 0; }
.animate-delay-400 { animation-delay: 400ms; opacity: 0; }

/* ═══════════════════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* ── Stat Card ─────────────────────────────────────────────── */
.stat-card {
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 20px;
  transition: all 0.25s var(--ease);
  box-shadow: var(--shadow-card);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--gray-150);
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  transition: all 0.25s var(--ease);
}
.card-sm { padding: 12px; }
.card-md { padding: 16px; }
.card-lg { padding: 20px; }
.card-hover:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--brand-200);
}
.card-hover:hover .card-icon {
  transform: scale(1.08);
}

/* ── Button ────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  letter-spacing: -0.01em;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  box-shadow: var(--shadow-brand-lg);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-brand);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: var(--radius-md);
}
.btn-primary.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-primary.btn-lg {
  padding: 14px 32px;
  font-size: 15px;
  border-radius: var(--radius-xl);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
}
.btn-secondary.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: var(--radius-md);
}
.btn-secondary.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-secondary.btn-lg {
  padding: 14px 32px;
  font-size: 15px;
  border-radius: var(--radius-xl);
}
.btn-brand {
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
}
.btn-brand:hover {
  background: var(--brand-100);
  border-color: var(--brand-300);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.btn-ghost:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}
.btn-ghost.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.badge-brand {
  background: var(--brand-50);
  color: var(--brand-700);
}
.badge-sm {
  padding: 1px 6px;
  font-size: 10px;
}
.badge-success {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fef3c7;
}
.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.badge-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ── Input ─────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: all 0.2s var(--ease);
  outline: none;
}
.input::placeholder { color: var(--gray-400); }
.input:hover { border-color: var(--gray-300); }
.input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.input {
  resize: none;
  line-height: 1.6;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.input-tall {
  padding: 12px 14px;
}
.input-search {
  padding-left: 36px;
}
.select-narrow {
  width: 110px;
}
@media (min-width: 640px) {
  .select-narrow { width: 130px; }
}

/* ── Label ─────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.label-hint {
  font-weight: 400;
  color: var(--gray-400);
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */

/* ── Top Nav ───────────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 56px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Hide brand text on very small screens */
@media (max-width: 380px) {
  .topnav .brand-text { display: none; }
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--surface-primary);
  border-right: 1px solid var(--gray-150);
  overflow-y: auto;
  z-index: 40;
}

/* ── Mobile Sidebar (below md breakpoint) ───────────────────── */
@media (max-width: 767px) {
  .sidebar {
    left: -280px;
    width: 260px;
    z-index: 45;
    transition: left 0.3s var(--ease-smooth);
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.1);
  }
}

/* ── Main Content Offset ───────────────────────────────────── */
@media (min-width: 768px) {
  .main-sidebar {
    margin-left: 240px;
  }
}

/* ── Sidebar Links ─────────────────────────────────────────── */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: var(--radius-lg);
  transition: all 0.15s var(--ease);
  text-decoration: none;
  position: relative;
}
.sidebar-link:hover {
  color: var(--gray-700);
  background: var(--gray-50);
}
.sidebar-link.active {
  color: var(--brand-700);
  background: var(--brand-50);
  font-weight: 600;
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--brand-500);
  border-radius: 0 3px 3px 0;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in 0.2s var(--ease) forwards;
}

.modal-content {
  background: var(--surface-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 420px;
  padding: 28px;
  animation: scale-in 0.25s var(--ease-spring) forwards;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: slide-in-up 0.35s var(--ease-spring) forwards;
  max-width: 360px;
}
.toast-success {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
.toast-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.toast-info {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

/* ═══════════════════════════════════════════════════════════
   SPECIALTY
   ═══════════════════════════════════════════════════════════ */

/* ── Prep Score Ring ───────────────────────────────────────── */
.score-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.score-ring svg {
  transform: rotate(-90deg);
}
.score-ring .score-track {
  stroke: var(--gray-150);
}
.score-ring .score-fill {
  transition: stroke-dashoffset 1s var(--ease-smooth);
  stroke-linecap: round;
}

/* ── Feature Card ──────────────────────────────────────────── */
.feature-card {
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-card);
}
.feature-card:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease-spring);
}

/* ── Price Card ────────────────────────────────────────────── */
.price-card {
  position: relative;
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-2xl);
  padding: 32px;
  transition: all 0.3s var(--ease);
  box-shadow: var(--shadow-card);
}
.price-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}
.price-card-featured {
  border: 2px solid var(--brand-500);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--brand-500);
}
.price-card-featured::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-2xl) + 1px);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  z-index: -1;
}

/* ── Step Number ───────────────────────────────────────────── */
.step-number {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  box-shadow: var(--shadow-brand-lg);
  position: relative;
  z-index: 1;
}

/* ── Avatar ────────────────────────────────────────────────── */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ── Activity Row ──────────────────────────────────────────── */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background-color 0.15s var(--ease);
}
.activity-row:last-child { border-bottom: none; }
.activity-row:hover { background: var(--gray-25); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: var(--radius-xl);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
}

/* ── Skeleton ──────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ── Nav Link Underline ────────────────────────────────────── */
.nav-underline {
  position: relative;
}
.nav-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--brand-500);
  border-radius: 1px;
  transition: width 0.25s var(--ease), left 0.25s var(--ease);
}
.nav-underline:hover::after {
  width: 100%;
  left: 0;
}

/* ── Section Divider ───────────────────────────────────────── */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gray-200), transparent);
}

/* ── Brand Gradient BG ─────────────────────────────────────── */
.bg-brand-gradient {
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 40%, var(--brand-800) 100%);
}

/* ── Score Bar ─────────────────────────────────────────────── */
.score-bar {
  height: 6px;
  background: var(--gray-150);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-smooth);
  background: linear-gradient(90deg, var(--brand-400), var(--brand-500));
}
.score-bar-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}
.score-bar-fill.danger {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

/* ── Client Health Radar ───────────────────────────────────── */
.health-radar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.health-axis {
  text-align: center;
}
.health-axis-bar {
  height: 4px;
  background: var(--gray-150);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 6px 0;
}
.health-axis-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s var(--ease-smooth);
}
.health-axis-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: 0.01em;
}
.health-axis-value {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}

/* ── Follow-up Card ────────────────────────────────────────── */
.followup-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-primary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.followup-card:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-sm);
}
.followup-urgency {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}
.followup-urgency-high { background: var(--danger); }
.followup-urgency-medium { background: var(--warning); }
.followup-urgency-low { background: var(--brand-400); }

/* ── Streak Counter ────────────────────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fbbf24;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
}
.streak-badge-fire {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: #f87171;
  color: #991b1b;
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */

/* ── Subtle background tints ───────────────────────────────── */
.tint-brand { background: var(--brand-50); }
.tint-success { background: #eef2ff; }
.tint-warning { background: #fffbeb; }
.tint-danger { background: #fef2f2; }

/* ── Line clamp ────────────────────────────────────────────── */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .topnav, .sidebar, .no-print { display: none !important; }
  body { background: white; }
}

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

/* ── Mobile Refinements ────────────────────────────────────── */
@media (max-width: 640px) {
  .empty-state {
    padding: 32px 16px;
  }
  .stat-card {
    padding: 16px;
  }
  .modal-content {
    padding: 22px;
    border-radius: var(--radius-xl);
  }
  .toast {
    right: 12px;
    left: 12px;
    max-width: none;
  }
  /* Bump touch targets on mobile nav */
  .topnav a, .topnav button {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ── htmx Loading States ─────────────────────────────────── */
.hx-indicator {
  display: none !important;
}
.htmx-request > .hx-indicator,
.htmx-request .hx-indicator {
  display: inline-flex !important;
}
.htmx-settling > .hx-indicator {
  display: none !important;
}
.htmx-request {
  position: relative;
}
.htmx-request.btn-primary,
.htmx-request.btn-brand {
  pointer-events: none;
  opacity: 0.7;
}
@keyframes htmx-spin {
  to { transform: rotate(360deg); }
}

/* ── Modals ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

/* ── Problem Section Animations ─────────────────────────── */
@keyframes problem-card-in {
  from { opacity: 0; transform: translateY(32px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes emoji-wobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(-8deg) scale(1.15); }
  30% { transform: rotate(6deg) scale(1.05); }
  45% { transform: rotate(-4deg) scale(1.1); }
  60% { transform: rotate(2deg) scale(1); }
}
.problem-card.visible {
  animation: problem-card-in 0.6s var(--ease-smooth) forwards;
}
.problem-card.visible .problem-emoji {
  animation: emoji-wobble 0.6s var(--ease-spring) forwards;
  animation-delay: 0.3s;
}
