/* ==========================================================================
   AI HABIT TRACKER - PRODUCTION DESIGN SYSTEM & STYLE ARCHITECTURE
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS & CSS VARIABLES (LIGHT / DARK THEMES)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Light Theme (Sophisticated Warm Neutral) */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-subtle: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-subtle: #e0f2fe;
  --accent-border: #bae6fd;
  
  --success: #10b981;
  --success-subtle: #ecfdf5;
  --success-border: #a7f3d0;
  --success-dark: #047857;
  
  --warning: #f59e0b;
  --warning-subtle: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-subtle: #fef2f2;
  --danger-border: #fecaca;
  
  --purple: #8b5cf6;
  --purple-subtle: #f5f3ff;
  
  --border-color: #e2e8f0;
  --border-focus: #0284c7;
  
  /* Heatmap Shades */
  --heat-0: #e2e8f0;
  --heat-1: #bae6fd;
  --heat-2: #38bdf8;
  --heat-3: #0284c7;
  --heat-4: #0369a1;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Charter", "Georgia", Cambria, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Spacing Scale */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-width: 1200px;
  --header-height: 72px;
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-elevated: #1e293b;
  --bg-muted: #1e293b;
  --bg-subtle: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --accent-primary: #38bdf8;
  --accent-primary-hover: #7dd3fc;
  --accent-subtle: rgba(56, 189, 248, 0.12);
  --accent-border: rgba(56, 189, 248, 0.3);
  
  --success: #34d399;
  --success-subtle: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.3);
  --success-dark: #059669;
  
  --warning: #fbbf24;
  --warning-subtle: rgba(251, 191, 36, 0.12);
  --warning-border: rgba(251, 191, 36, 0.3);
  
  --danger: #f87171;
  --danger-subtle: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.3);
  
  --purple: #a78bfa;
  --purple-subtle: rgba(167, 139, 250, 0.12);
  
  --border-color: #1e293b;
  --border-focus: #38bdf8;
  
  --heat-0: #1e293b;
  --heat-1: #0369a1;
  --heat-2: #0284c7;
  --heat-3: #38bdf8;
  --heat-4: #7dd3fc;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.6;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: var(--space-md); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: var(--space-md); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); margin-bottom: var(--space-sm); }
h4 { font-size: 1.15rem; margin-bottom: var(--space-xs); }

p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
  max-width: 75ch;
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
  color: var(--text-secondary);
}

li {
  margin-bottom: var(--space-xs);
  line-height: 1.6;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-muted);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   3. LAYOUT & CONTAINERS
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

.main-content {
  flex: 1 0 auto;
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-3xl);
}

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

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

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

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

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

/* --------------------------------------------------------------------------
   4. NAVIGATION & HEADER
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-badge {
  background: var(--accent-subtle);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-border);
}

.main-nav {
  display: none;
}

@media (min-width: 1024px) {
  .main-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
  }
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-sm);
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-primary);
  background-color: var(--bg-muted);
}

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

.theme-toggle-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  min-width: 38px;
  height: 38px;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.theme-toggle-btn:hover {
  background: var(--bg-subtle);
}

.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
}

@media (min-width: 1024px) {
  .mobile-menu-toggle {
    display: none;
  }
}

.mobile-menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Mobile Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: var(--space-lg);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  z-index: 999;
}

.mobile-nav-drawer.open {
  display: flex;
}

.mobile-nav-links {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.mobile-nav-links .nav-link {
  font-size: 1.125rem;
  padding: var(--space-sm) var(--space-md);
  display: block;
}

/* --------------------------------------------------------------------------
   5. BUTTONS & INTERACTIVE CONTROLS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
  line-height: 1.25;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

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

.btn-success {
  background-color: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.btn-success:hover {
  background-color: var(--success-dark);
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger-subtle);
  color: var(--danger);
  border-color: var(--danger-border);
}

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

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  font-size: 1.0625rem;
  padding: 0.875rem 1.75rem;
}

/* --------------------------------------------------------------------------
   6. CARDS, PANELS & CONTAINERS
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-blue { background: var(--accent-subtle); color: var(--accent-primary); border: 1px solid var(--accent-border); }
.badge-green { background: var(--success-subtle); color: var(--success-dark); border: 1px solid var(--success-border); }
.badge-amber { background: var(--warning-subtle); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-purple { background: var(--purple-subtle); color: var(--purple); border: 1px solid rgba(167, 139, 250, 0.3); }

/* --------------------------------------------------------------------------
   7. HABIT DASHBOARD, HEATMAP & STREAKS
   -------------------------------------------------------------------------- */
.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Habit List Item */
.habit-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  align-items: center;
  transition: all var(--transition-fast);
}

@media (min-width: 768px) {
  .habit-row {
    grid-template-columns: 2fr 1.5fr auto auto;
  }
}

.habit-row:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

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

.habit-checkbox {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.habit-checkbox.completed {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.habit-title-box {
  display: flex;
  flex-direction: column;
}

.habit-title-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.habit-cue-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Recent Days Quick Toggle Matrix */
.days-matrix {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.day-pill {
  width: 28px;
  height: 32px;
  border-radius: 4px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  font-size: 0.6875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.day-pill.done {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.day-pill.today {
  border-color: var(--warning);
  font-weight: bold;
}

/* 365 Days Heatmap Visualizer */
.heatmap-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 12px);
  grid-auto-flow: column;
  grid-auto-columns: 12px;
  gap: 3px;
  padding: var(--space-sm) 0;
  min-width: 680px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background-color: var(--heat-0);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast);
}

.heatmap-cell:hover {
  transform: scale(1.3);
  z-index: 10;
}

.heatmap-cell[data-count="1"] { background-color: var(--heat-1); }
.heatmap-cell[data-count="2"] { background-color: var(--heat-2); }
.heatmap-cell[data-count="3"] { background-color: var(--heat-3); }
.heatmap-cell[data-count="4"], .heatmap-cell[data-count="5"] { background-color: var(--heat-4); }

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

.heatmap-legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   8. FORMS & INPUTS
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* --------------------------------------------------------------------------
   9. ROUTINE BUILDER & CALCULATOR WIDGETS
   -------------------------------------------------------------------------- */
.step-wizard {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
  overflow-x: auto;
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-item.active {
  color: var(--accent-primary);
}

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.step-item.active .step-number {
  background: var(--accent-primary);
  color: #ffffff;
}

/* Result Blueprint Card */
.blueprint-card {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-muted));
  border: 2px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-top: var(--space-lg);
}

.blueprint-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.formula-box {
  background: var(--bg-surface);
  border: 1px dashed var(--accent-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin: var(--space-md) 0;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   10. FAQ ACCORDION
   -------------------------------------------------------------------------- */
.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--accent-border);
}

.faq-question {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  background: none;
  border: none;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.faq-icon {
  font-size: 1.25rem;
  transition: transform var(--transition-fast);
  color: var(--accent-primary);
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 var(--space-lg) var(--space-md) var(--space-lg);
  display: none;
  color: var(--text-secondary);
}

.faq-item.open .faq-answer {
  display: block;
}

/* --------------------------------------------------------------------------
   11. EDITORIAL & BLOG TYPOGRAPHY
   -------------------------------------------------------------------------- */
.article-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.article-content h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

.article-content h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.callout-box {
  background: var(--bg-muted);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
}

.callout-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.data-table-wrapper {
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}

.data-table th, .data-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-muted);
  font-weight: 700;
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: var(--bg-subtle);
}

/* --------------------------------------------------------------------------
   12. TOAST NOTIFICATIONS & MODALS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  min-width: 260px;
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-danger { border-left: 4px solid var(--danger); }
.toast.toast-info { border-left: 4px solid var(--accent-primary); }

@keyframes slideInUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

/* --------------------------------------------------------------------------
   13. FOOTER & FOOTER DIRECTORY
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-xl);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

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

.footer-heading {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-link {
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
  }
}

/* --------------------------------------------------------------------------
   14. UTILITY CLASSES
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mb-0 { margin-bottom: 0 !important; }
.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-xl); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.w-full { width: 100%; }

/* --------------------------------------------------------------------------
   15. PRINTABLE HABIT TRACKER STYLES & PRINT MEDIA
   -------------------------------------------------------------------------- */
.printable-sheet-wrapper {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--space-2xl);
}

[data-theme="dark"] .printable-sheet-wrapper {
  background: #ffffff;
  color: #0f172a;
}

.print-sheet-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.print-title {
  font-size: 1.625rem;
  font-weight: 800;
  margin: 0 0 0.25rem 0;
  color: #0f172a;
}

.print-subtitle {
  font-size: 0.9375rem;
  color: #475569;
  margin: 0;
}

.print-brand {
  text-align: right;
  font-size: 0.8125rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
}

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

.print-table th, 
.print-table td {
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.25rem;
  text-align: center;
  color: #0f172a;
}

.print-table th {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 0.75rem;
}

.print-table th.milestone-col {
  background: #e2e8f0;
  border-right: 2px solid #64748b;
}

.print-table td.milestone-cell {
  background: #f8fafc;
  border-right: 2px solid #64748b;
}

.print-table td.habit-cell {
  text-align: left;
  padding-left: 0.5rem;
  font-size: 0.8125rem;
}

.print-table td.habit-cell small {
  color: #64748b;
}

/* 66-Day Lally Bubble Grid */
.lally-print-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.lally-phase-block {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #f8fafc;
}

.lally-phase-block h5 {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.bubble-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.5rem;
}

.lally-bubble {
  height: 36px;
  width: 36px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  background: #ffffff;
}

.lally-bubble.milestone {
  border-color: #0284c7;
  background: #e0f2fe;
  color: #0369a1;
}

.print-sheet-footer {
  border-top: 1px solid #cbd5e1;
  padding-top: 1rem;
}

.print-notes-box {
  border: 1px dashed #94a3b8;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  min-height: 80px;
  font-size: 0.8125rem;
  color: #334155;
}

.print-lined-area {
  margin-top: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  height: 24px;
}

/* Comprehensive Print Media Rules */
@media print {
  *, *::before, *::after {
    background: transparent !important;
    color: #000000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  @page {
    margin: 0.5in;
    size: landscape;
  }

  body {
    background: #ffffff !important;
    font-size: 10pt;
    line-height: 1.3;
  }

  .site-header, 
  .site-footer, 
  .theme-toggle-btn, 
  .mobile-menu-toggle, 
  .mobile-nav-drawer,
  .no-print,
  .btn,
  .toast-container {
    display: none !important;
  }

  .printable-sheet-wrapper {
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  .print-table th, 
  .print-table td {
    border: 1px solid #000000 !important;
    padding: 3px 2px !important;
  }

  .print-table th {
    background: #e5e7eb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lally-bubble {
    border: 1.5px solid #000000 !important;
  }
}

