/* ============================================
   ADHD Assessment Tool — Styles
   ADHD-friendly: calm colors, clear hierarchy,
   large tap targets, minimal visual noise
   ============================================ */

/* --- Design Tokens --- */
:root {
  --bg: #f8f7f4;
  --bg-card: #ffffff;
  --bg-hover: #f0eeeb;
  --bg-input: #ffffff;
  --text: #2d2a26;
  --text-secondary: #6b6560;
  --text-muted: #9b9590;
  --border: #e0ddd8;
  --border-focus: #7c6f64;
  --accent: #5b7a5e;
  --accent-hover: #4a6a4d;
  --accent-soft: #e8f0e8;
  --danger: #c25550;
  --danger-soft: #fce8e7;
  --warning: #c28a35;
  --warning-soft: #fdf3e0;
  --success: #5b7a5e;
  --success-soft: #e8f0e8;
  --severity-low: #5b7a5e;
  --severity-med: #c28a35;
  --severity-high: #c25550;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #1a1a1d;
  --bg-card: #242428;
  --bg-hover: #2e2e33;
  --bg-input: #2e2e33;
  --text: #e8e6e1;
  --text-secondary: #a8a4a0;
  --text-muted: #706c68;
  --border: #3a3a3f;
  --border-focus: #a89880;
  --accent: #7da07f;
  --accent-hover: #6d906f;
  --accent-soft: #2a3a2a;
  --danger: #e07070;
  --danger-soft: #3a2020;
  --warning: #d4a050;
  --warning-soft: #3a3020;
  --success: #7da07f;
  --success-soft: #2a3a2a;
  --severity-low: #7da07f;
  --severity-med: #d4a050;
  --severity-high: #e07070;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Header --- */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

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

/* Theme toggle icon visibility */
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* --- Views --- */
.view {
  display: none;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.view.active {
  display: block;
}

.view h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.view h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  white-space: nowrap;
}

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

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

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

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

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

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

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  min-height: 36px;
}

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

.btn-danger:hover {
  opacity: 0.9;
}

/* --- Home --- */
.home-hero {
  text-align: center;
  padding: 48px 0 32px;
}

.home-hero h2 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.home-hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto 28px;
}

.home-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-section {
  margin-top: 40px;
}

.home-section h3 {
  margin-bottom: 16px;
}

/* --- History List --- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.history-item:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item-date {
  font-weight: 600;
  font-size: 0.95rem;
}

.history-item-mode {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-item-score {
  font-size: 1.3rem;
  font-weight: 700;
}

.history-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.history-delete-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.history-delete-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --- Mode Selection --- */
#view-mode-select h2 {
  text-align: center;
  padding-top: 24px;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  color: var(--text);
}

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

.mode-icon {
  color: var(--accent);
  margin-bottom: 16px;
}

.mode-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.mode-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.mode-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 100px;
}

/* --- Assessment --- */
.assessment-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.domain-container {
  min-height: 300px;
}

.domain-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}

.domain-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.domain-emoji {
  font-size: 1.8rem;
  line-height: 1;
}

.domain-card-header h3 {
  font-size: 1.25rem;
  margin-bottom: 0;
}

/* --- Slider --- */
.slider-group {
  margin-bottom: 24px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.slider-label-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.slider-value {
  font-size: 1.2rem;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.slider-track {
  position: relative;
  width: 100%;
  padding: 10px 0;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-card);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-card);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.slider-labels-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Detailed mode question */
.question-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.question-item:last-child {
  border-bottom: none;
}

.question-text {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 10px;
}

.importance-section {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 2px dashed var(--border);
}

.importance-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

/* --- Assessment Nav --- */
.assessment-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 12px;
}

/* --- Wins & Triggers --- */
.wt-section {
  margin-bottom: 32px;
}

.wt-hint {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.tag-remove:hover {
  opacity: 1;
}

.tag.trigger-tag {
  background: var(--danger-soft);
  color: var(--danger);
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input[type="text"] {
  flex: 1;
}

input[type="text"],
textarea,
select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  min-height: 44px;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
}

textarea {
  resize: vertical;
  width: 100%;
}

.triggers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.trigger-checkbox {
  display: none;
}

.trigger-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.trigger-label:hover {
  border-color: var(--border-focus);
}

.trigger-checkbox:checked + .trigger-label {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 500;
}

/* --- Results --- */
.results-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab-btn {
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.results-section {
  margin-bottom: 32px;
}

.results-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

/* Ranked List */
.ranked-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranked-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.ranked-rank {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
}

.ranked-bar-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.ranked-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}

.ranked-bar-fill.severity-low { background: var(--severity-low); }
.ranked-bar-fill.severity-med { background: var(--severity-med); }
.ranked-bar-fill.severity-high { background: var(--severity-high); }

.ranked-name {
  font-weight: 500;
  min-width: 120px;
}

.ranked-scores {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ranked-ips {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 36px;
  text-align: right;
}

/* Domain Details */
.domain-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  transition: background var(--transition);
}

.detail-card-header:hover {
  background: var(--bg-hover);
}

.detail-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.detail-card-body {
  display: none;
  padding: 0 18px 18px;
}

.detail-card.open .detail-card-body {
  display: block;
}

.detail-question-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

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

.detail-q-score {
  font-weight: 600;
  min-width: 30px;
  text-align: right;
}

/* Interventions */
.interventions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.intervention-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.intervention-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.intervention-header h4 {
  font-size: 1.05rem;
  font-weight: 600;
}

.intervention-severity {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.intervention-severity.sev-low {
  background: var(--success-soft);
  color: var(--success);
}

.intervention-severity.sev-med {
  background: var(--warning-soft);
  color: var(--warning);
}

.intervention-severity.sev-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.intervention-card ul {
  padding-left: 20px;
}

.intervention-card li {
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Wins / Triggers Summary */
.wins-summary,
.triggers-summary {
  margin-bottom: 28px;
}

.wins-summary h3,
.triggers-summary h3 {
  margin-bottom: 12px;
}

.wins-list-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.win-item-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--success-soft);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--success);
  font-weight: 500;
}

.trigger-item-summary {
  display: inline-flex;
  padding: 6px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* --- Results Actions --- */
.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* --- Progress --- */
.progress-section {
  margin-bottom: 36px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.chart-controls label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.chart-controls select {
  min-width: 180px;
}

.comparison-selectors {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.comparison-selectors > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comparison-selectors label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.comparison-table th,
.comparison-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.comparison-table th {
  background: var(--bg-hover);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

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

.trend-up {
  color: var(--success);
  font-weight: 600;
}

.trend-down {
  color: var(--danger);
  font-weight: 600;
}

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

/* --- Responsive --- */
@media (max-width: 600px) {
  .view {
    padding: 16px 14px 48px;
  }

  .home-hero {
    padding: 28px 0 20px;
  }

  .home-hero h2 {
    font-size: 1.4rem;
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }

  .mode-card {
    padding: 24px 16px;
  }

  .domain-card {
    padding: 20px 16px;
  }

  .assessment-nav {
    flex-wrap: wrap;
  }

  .assessment-nav .btn {
    flex: 1;
    min-width: 100px;
  }

  .ranked-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ranked-scores {
    width: 100%;
    justify-content: flex-end;
  }

  .results-tabs {
    gap: 0;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 0.82rem;
  }

  .comparison-selectors {
    flex-direction: column;
    gap: 10px;
  }
}

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

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.empty-state p {
  margin-bottom: 8px;
}

/* Score color utility */
.score-color-low { color: var(--severity-low); }
.score-color-med { color: var(--severity-med); }
.score-color-high { color: var(--severity-high); }

/* Chevron for expandable cards */
.chevron {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.detail-card.open .chevron {
  transform: rotate(180deg);
}

/* --- Assessment Type Selection --- */
.assessment-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.assessment-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  color: var(--text);
}

.assessment-type-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.assessment-type-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.assessment-type-card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.assessment-type-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

.assessment-type-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 100px;
}

.home-resume-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-hint {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
  text-align: center;
}

/* --- Sleep Tools Grid --- */
.sleep-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  color: var(--text);
}

.tool-card:hover {
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
  transform: translateY(-2px);
}

.tool-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.tool-card h4 {
  font-size: 1rem;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}

.tool-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* --- Sleep Phenotype Assessment --- */
.sleep-phenotype-container {
  max-width: 600px;
  margin: 0 auto;
}

.sleep-question-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.sleep-question-card h3 {
  margin-bottom: 16px;
  color: var(--text);
}

.sleep-question-card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.sleep-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sleep-option {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.sleep-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sleep-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.sleep-option input[type="radio"] {
  margin-right: 12px;
}

.sleep-option label {
  flex: 1;
  cursor: pointer;
  font-size: 0.95rem;
}

.sleep-phenotype-result {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.sleep-phenotype-result h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: white;
}

.sleep-phenotype-result p {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
}

/* --- Sleep Diary --- */
.sleep-diary-header {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.sleep-diary-entries {
  max-width: 800px;
  margin: 0 auto;
}

.sleep-entry-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.sleep-entry-date {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.sleep-entry-times {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sleep-entry-quality {
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sleep-diary-analysis {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 32px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.sleep-diary-analysis h3 {
  color: var(--accent);
  margin-bottom: 16px;
}

.sleep-pattern-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sleep-pattern-item:last-child {
  border-bottom: none;
}

.sleep-pattern-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.sleep-pattern-value {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* --- Sleep Intervention Plan --- */
.sleep-intervention-plan {
  max-width: 800px;
  margin: 0 auto;
}

.intervention-section {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.intervention-section h3 {
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.intervention-step {
  background: var(--bg);
  border-left: 4px solid var(--accent);
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
}

.intervention-step h4 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.intervention-step p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.intervention-step ul {
  margin-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.intervention-step li {
  margin-bottom: 4px;
}

.intervention-evidence {
  background: var(--accent-soft);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
}

/* --- Screening Introduction --- */
.screening-intro {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 0;
}

.intro-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.intro-section {
  margin-bottom: 28px;
}

.intro-section h3 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.intro-list, .disclaimer-list {
  padding-left: 24px;
}

.intro-list li, .disclaimer-list li {
  margin-bottom: 10px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.disclaimer-section {
  background: var(--warning-soft);
  border-left: 4px solid var(--warning);
  padding: 20px;
  border-radius: var(--radius-sm);
}

.disclaimer-section h3 {
  color: var(--warning);
}

.disclaimer-list li {
  color: var(--text);
}

.intro-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

/* --- ASRS Instruction Banner (Prominent & Eye-Catching) --- */
.asrs-instruction-banner {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: 3px solid #4f46e5;
  padding: 24px 28px;
  margin-bottom: 32px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  animation: subtle-pulse 2s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5); }
}

.asrs-instruction-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.asrs-instruction-content {
  flex: 1;
  text-align: left;
}

.asrs-instruction-title {
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.asrs-instruction-text {
  color: #ffffff;
  font-size: 1.15rem;
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
}

.asrs-instruction-text strong {
  color: #fef08a;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

[data-theme="dark"] .asrs-instruction-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-color: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Mobile responsive */
@media (max-width: 640px) {
  .asrs-instruction-banner {
    flex-direction: column;
    text-align: center;
    padding: 20px;
    gap: 12px;
  }

  .asrs-instruction-content {
    text-align: center;
  }

  .asrs-instruction-icon {
    font-size: 2rem;
  }

  .asrs-instruction-title {
    font-size: 1.1rem;
  }

  .asrs-instruction-text {
    font-size: 1rem;
  }
}

/* --- ASRS Question Cards --- */
.asrs-question-container {
  min-height: 400px;
}

.asrs-question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
}

.asrs-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.asrs-question-number {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.asrs-screening-item {
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.asrs-extended-item {
  font-size: 0.75rem;
  background: #f0ebff;
  color: #7c3aed;
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

[data-theme="dark"] .asrs-extended-item {
  background: rgba(124, 58, 237, 0.2);
  color: #c4b5fd;
}

.asrs-question-text {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 28px;
  color: var(--text);
}

.asrs-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.asrs-option {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.asrs-option:hover {
  border-color: var(--border-focus);
  background: var(--bg-hover);
}

.asrs-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Fade out unselected answers */
.asrs-option.fade-out {
  opacity: 0.25;
  transform: scale(0.97);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Highlight confirmed answer */
.asrs-option.confirmed {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
}

[data-theme="dark"] .asrs-option.confirmed {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.asrs-option input[type="radio"] {
  margin-right: 14px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.asrs-option-label {
  font-size: 0.95rem;
  font-weight: 500;
  flex: 1;
}

.asrs-hint {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

.asrs-dsm5-note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 20px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.asrs-dsm5-note h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.asrs-dsm5-note p {
  margin-bottom: 12px;
  line-height: 1.6;
}

.asrs-dsm5-note p:last-child {
  margin-bottom: 0;
}

/* --- ASRS Results --- */
.asrs-results-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  margin-bottom: 24px;
}

.positive-screen {
  border-left: 5px solid var(--danger);
}

.negative-screen {
  border-left: 5px solid var(--success);
}

.asrs-results-header {
  margin-bottom: 28px;
}

.asrs-results-header h2 {
  margin-bottom: 8px;
}

.asrs-results-date {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.asrs-scores-breakdown,
.asrs-impairment-breakdown {
  margin-bottom: 28px;
}

.asrs-scores-breakdown h3,
.asrs-impairment-breakdown h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.asrs-score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.asrs-score-item:last-child {
  border-bottom: none;
}

.asrs-score-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asrs-score-label span:first-child {
  font-weight: 500;
  font-size: 0.95rem;
}

.asrs-score-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.asrs-score-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.asrs-score-value.above-threshold {
  color: var(--danger);
}

.asrs-impairment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.asrs-impairment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.asrs-impairment-item.severe {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  font-weight: 600;
}

.asrs-recommendation {
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 28px;
}

.asrs-recommendation.positive {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
}

.asrs-recommendation.negative {
  background: var(--success-soft);
  border: 1px solid var(--success);
}

.asrs-recommendation h3 {
  margin-bottom: 12px;
  font-size: 1.15rem;
}

.asrs-recommendation h4 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.asrs-recommendation ul {
  padding-left: 24px;
  margin-bottom: 20px;
}

.asrs-recommendation li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.asrs-disclaimer {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--text);
}

.asrs-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.asrs-crisis-note {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-card);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
}

.asrs-disclaimer-box {
  background: var(--warning-soft);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 28px;
}

.asrs-disclaimer-box h4 {
  margin-bottom: 12px;
  color: var(--warning);
  font-size: 1rem;
}

.asrs-disclaimer-box ul {
  padding-left: 24px;
}

.asrs-disclaimer-box li {
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 0.9rem;
}

/* --- Screening Summary (Home) --- */
.screening-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.screening-summary.positive {
  border-left: 4px solid var(--danger);
}

.screening-summary.negative {
  border-left: 4px solid var(--success);
}

.screening-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.screening-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.screening-result {
  font-size: 0.9rem;
  font-weight: 600;
}

.screening-summary-scores {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* --- Responsive Updates --- */
@media (max-width: 600px) {
  .assessment-type-grid {
    grid-template-columns: 1fr;
  }

  .asrs-impairment-grid {
    grid-template-columns: 1fr;
  }

  .asrs-options {
    gap: 10px;
  }

  .asrs-option {
    padding: 12px 14px;
  }

  .asrs-results-card {
    padding: 24px 20px;
  }

  .asrs-recommendation {
    padding: 20px 16px;
  }

  .asrs-disclaimer-box {
    padding: 16px;
  }
}

/* --- Admin Page --- */
.admin-controls {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-controls label {
  font-weight: 600;
  color: var(--text);
}

.admin-controls select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
}

.admin-interventions-container {
  max-width: 1000px;
  margin: 0 auto 40px;
}

.admin-domain-section {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.admin-domain-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.admin-domain-emoji {
  font-size: 1.8rem;
}

.admin-domain-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.admin-severity-group {
  margin-bottom: 20px;
}

.admin-severity-group:last-child {
  margin-bottom: 0;
}

.admin-severity-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 8px;
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  border-radius: 100px;
}

.admin-severity-label.low {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.admin-severity-label.med {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.admin-severity-label.high {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.admin-intervention-list {
  list-style: none;
  padding-left: 0;
  margin-top: 12px;
}

.admin-intervention-list li {
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text-secondary);
  line-height: 1.6;
}

.admin-intervention-list li strong {
  color: var(--text);
}

.admin-sleep-phenotypes {
  max-width: 1000px;
  margin: 40px auto;
  padding: 24px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
}

.admin-sleep-phenotypes h3 {
  color: var(--accent);
  margin-bottom: 20px;
  text-align: center;
}

.admin-phenotype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.admin-phenotype-btn {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.admin-phenotype-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.admin-phenotype-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.admin-phenotype-display {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 200px;
}

.admin-phenotype-display h4 {
  color: var(--accent);
  margin-bottom: 12px;
}

.admin-phenotype-display .intervention-section,
.admin-phenotype-display .intervention-step {
  margin-bottom: 16px;
}

footer a:hover {
  text-decoration: underline;
}
