/* ═══════════════════════════════════════════════════════
   Long COVID Worker Toolkit — Feedback Platform
   Accessible, clean design for users with brain fog/fatigue
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
  --purple: #5A2D8A;
  --purple-light: #EDE5F7;
  --purple-dark: #3D1D5E;
  --gold: #C8860A;
  --gold-light: #FFF8E7;
  --dark: #1C2B3A;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --bg: #FFFFFF;
  --bg-light: #F8F7FC;
  --bg-card: #FFFFFF;
  --border: #E0DDE5;
  --border-light: #F0EDF5;
  --success: #2E7D32;
  --success-light: #E8F5E9;
  --error: #C62828;
  --error-light: #FFEBEE;
  --danger: #B71C1C;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(28, 43, 58, 0.08);
  --shadow-hover: 0 4px 16px rgba(28, 43, 58, 0.12);
  --transition: 0.2s ease;
  --font-base: 18px;
  --line-height: 1.65;
  --max-width: 780px;
}

/* ─── Font Size Variants ─── */
.font-size-small { --font-base: 16px; }
.font-size-medium { --font-base: 18px; }
.font-size-large { --font-base: 21px; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-base);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg-light);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--dark);
  line-height: 1.3;
  margin-top: 0;
}
h1 { font-size: 1.75em; margin-bottom: 0.5em; }
h2 { font-size: 1.4em; margin-bottom: 0.4em; }
h3 { font-size: 1.15em; margin-bottom: 0.35em; }
h4 { font-size: 1.05em; margin-bottom: 0.3em; }

a { color: var(--purple); text-decoration: underline; }
a:hover { color: var(--purple-dark); }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.5em; }
li { margin-bottom: 0.35em; }

/* ─── Skip Link ─── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--purple);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ─── Focus Styles ─── */
:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ─── Header ─── */
.site-header {
  background: var(--bg);
  border-bottom: 3px solid var(--purple);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.header-brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.brand-text {
  font-weight: 700;
  font-size: 1.05em;
  color: var(--purple);
}
.brand-sub {
  font-size: 0.75em;
  color: var(--text-muted);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.font-controls {
  display: flex;
  gap: 4px;
}
.font-btn {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-light);
  font-weight: 600;
  min-width: 32px;
  min-height: 32px;
}
.font-btn.active {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
}
.font-btn-sm { font-size: 0.75em; }
.font-btn-md { font-size: 0.9em; }
.font-btn-lg { font-size: 1.1em; }
.user-badge {
  background: var(--purple-light);
  color: var(--purple);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
}

/* ─── Footer ─── */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 24px 20px;
  margin-top: 48px;
  font-size: 0.85em;
}
.site-footer p { margin: 0 0 4px; }
.footer-note { font-size: 0.9em; }
.site-footer a { color: rgba(255,255,255,0.9); }

/* ─── Main Content ─── */
.main-content { min-height: 60vh; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px;
}

.lead {
  font-size: 1.05em;
  color: var(--text-light);
  margin-bottom: 1.5em;
}

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.95em;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  min-height: 44px;
  min-width: 44px;
}
.btn-primary {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
}
.btn-primary:hover { background: var(--purple-dark); border-color: var(--purple-dark); color: white; }
.btn-outline {
  background: transparent;
  color: var(--purple);
  border-color: var(--purple);
}
.btn-outline:hover { background: var(--purple-light); }
.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger-outline:hover { background: var(--error-light); }
.btn-sm { padding: 6px 14px; font-size: 0.85em; min-height: 36px; }
.btn-lg { padding: 14px 28px; font-size: 1.05em; }
.btn-full { width: 100%; }
.btn-icon {
  padding: 6px 10px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-icon:hover { background: var(--purple-light); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--dark);
}
.form-input, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 1em;
  font-family: inherit;
  line-height: var(--line-height);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--purple);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-textarea-sm { min-height: 80px; }
.form-input-sm { padding: 8px 10px; font-size: 0.9em; }
.field-hint {
  font-size: 0.85em;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 150px; }

/* ─── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 500;
}
.alert-error { background: var(--error-light); color: var(--error); border: 1px solid var(--error); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }

/* ─── Auth Pages ─── */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
  padding: 32px 20px;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-header h1 {
  color: var(--purple);
  margin-bottom: 4px;
}
.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}
.auth-form { text-align: left; }
.auth-footer {
  margin-top: 24px;
  font-size: 0.85em;
  color: var(--text-muted);
}
.auth-instructions {
  font-size: 0.95em;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ─── Admin: Reset Password ─── */
.actions-cell { display: flex; gap: 6px; align-items: center; }
.inline-reset-form { display: inline; margin: 0; }
.btn-warning-outline {
  color: #b45309;
  border: 1px solid #b45309;
  background: transparent;
  font-size: 0.8em;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-warning-outline:hover { background: #fef3c7; }

/* ─── Consent Page ─── */
.consent-page h1 { color: var(--purple); }
.consent-download-bar {
  margin-bottom: 20px;
  padding: 14px 20px;
  background: var(--purple-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}
.consent-download-bar .btn { white-space: nowrap; }
.consent-info {
  margin-bottom: 24px;
  padding: 28px;
}
.consent-info h2 { color: var(--purple); margin-top: 0; }
.consent-info h3 {
  color: var(--dark);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 4px;
  margin-top: 20px;
}
.consent-checks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}
.check-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95em;
}
.check-label input { margin-top: 3px; min-width: 20px; min-height: 20px; }
.consent-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ─── Dashboard ─── */
.dashboard-header {
  margin-bottom: 24px;
}
.dashboard-header h1 { margin-bottom: 8px; }
.text-purple { color: var(--purple); }

/* Progress bar */
.progress-section { margin-bottom: 32px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9em;
  color: var(--text-light);
  margin-bottom: 8px;
}
.progress-bar {
  height: 12px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 2%;
}

/* Group cards */
.group-list { display: flex; flex-direction: column; gap: 12px; }
.group-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.group-card:hover { box-shadow: var(--shadow-hover); border-color: var(--purple); }
.group-card-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.group-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  font-weight: 700;
  font-size: 1.1em;
  flex-shrink: 0;
}
.group-card-completed .group-number { background: var(--success); }
.group-info { flex: 1; }
.group-info h2 { margin-bottom: 4px; font-size: 1.15em; }
.group-info p { font-size: 0.9em; color: var(--text-light); margin: 0; }
.group-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
}
.status-completed { background: var(--success-light); color: var(--success); }
.status-progress { background: var(--gold-light); color: var(--gold); }
.status-new { background: var(--bg-light); color: var(--text-muted); }
.status-active { background: var(--success-light); color: var(--success); }
.status-withdrawn { background: var(--error-light); color: var(--error); }
.status-zoom { background: #FFF3E0; color: #E65100; }
.status-toolkit { background: var(--purple-light); color: var(--purple); }
.flag-yes { color: var(--success); font-weight: 600; }
.flag-no { color: var(--text-muted); }
.feedback-count { font-size: 0.8em; color: var(--text-muted); }
.group-card-actions { margin-top: 12px; text-align: right; }

.campaign-story-card { margin-top: 40px; border-left: 4px solid var(--gold); }
.campaign-story-card h2 { color: var(--purple-dark); margin-bottom: 8px; }
.campaign-story-card .lead { margin-bottom: 16px; }
.campaign-story-textarea { width: 100%; font-size: 1em; }
.campaign-story-card .save-status { margin-top: 8px; font-size: 0.85em; }

/* ─── Next Steps / Opt-In Cards ─── */
.next-steps-card {
  margin-top: 40px;
  border-left: 4px solid var(--purple);
}
.next-steps-card h2 { color: var(--purple-dark); margin-bottom: 8px; }
.next-steps-card .lead { margin-bottom: 20px; }
.optin-options { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.optin-card {
  display: block;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  position: relative;
}
.optin-card:hover { border-color: var(--purple); box-shadow: var(--shadow-hover); }
.optin-card.optin-active {
  border-color: var(--purple);
  background: var(--purple-light);
}
.optin-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.optin-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.optin-icon {
  font-size: 2em;
  flex-shrink: 0;
  line-height: 1;
}
.optin-content strong {
  display: block;
  font-size: 1.05em;
  color: var(--purple-dark);
  margin-bottom: 6px;
}
.optin-content p {
  margin: 0;
  font-size: 0.95em;
  line-height: 1.55;
  color: var(--text);
}
.optin-card.optin-active .optin-content strong::after {
  content: ' ✓';
  color: var(--success);
}

/* Disclaimer banner */
.optin-disclaimer-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--gold-light);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 0.92em;
  line-height: 1.6;
}
.optin-disclaimer-icon {
  font-size: 1.8em;
  flex-shrink: 0;
  line-height: 1;
  color: var(--gold);
}
.optin-disclaimer-banner strong {
  display: block;
  color: var(--dark);
  margin-bottom: 4px;
  font-size: 1.02em;
}
.optin-disclaimer-banner p {
  margin: 0;
  color: var(--text);
}

/* ─── Assent Questions (Yes/No radios) ─── */
.assent-questions { display: flex; flex-direction: column; gap: 28px; margin-bottom: 24px; }
.assent-question {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.assent-question h3 { color: var(--purple); margin-top: 0; margin-bottom: 8px; font-size: 1.1em; }
.assent-question > p { margin-bottom: 16px; color: var(--text); }
.assent-radios { display: flex; flex-direction: column; gap: 10px; }
.assent-radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.assent-radio:hover { border-color: var(--purple); }
.assent-radio input[type="radio"] { min-width: 20px; min-height: 20px; accent-color: var(--purple); }
.assent-radio-label { font-weight: 500; }
.assent-radio input[type="radio"]:checked ~ .assent-yes { color: var(--success); }
.assent-radio input[type="radio"]:checked ~ .assent-no { color: var(--text-muted); }
.assent-radio:has(input:checked) { border-color: var(--purple); background: var(--purple-light); }
.assent-save-status { font-size: 0.85em; margin-top: 8px; min-height: 20px; }
.assent-save-status.saving { color: var(--text-muted); }
.assent-save-status.error { color: var(--error); }

/* ─── Participation Preferences Page ─── */
.preferences-page h1 { color: var(--purple); }
.preferences-form { margin-top: 20px; }
.preference-options { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.preference-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.preference-card:hover { border-color: var(--purple); box-shadow: var(--shadow-hover); }
.preference-card-selected {
  border-color: var(--purple);
  background: var(--purple-light);
  box-shadow: var(--shadow-hover);
}
.preference-card input[type="radio"] { margin-top: 4px; min-width: 20px; min-height: 20px; accent-color: var(--purple); }
.preference-content { display: flex; gap: 14px; align-items: flex-start; }
.preference-icon { font-size: 2em; line-height: 1; flex-shrink: 0; }
.preference-content strong { display: block; font-size: 1.1em; color: var(--purple); margin-bottom: 6px; }
.preference-content p { margin: 0; color: var(--text); font-size: 0.95em; }
.preference-note { margin-bottom: 24px; }
.preference-actions { margin-top: 20px; }

.dashboard-footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ─── Withdraw Confirmation Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  max-width: 520px;
  width: 100%;
  padding: 32px;
}
.modal-title {
  color: var(--danger);
  margin: 0 0 16px 0;
  font-size: 1.3em;
}
.modal-warning {
  background: var(--error-light);
  border: 1px solid #f5c6cb;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
  font-size: 0.95em;
  line-height: 1.6;
}
.modal-warning strong { color: var(--danger); }
.modal-warning ul {
  margin: 8px 0;
  padding-left: 20px;
}
.modal-warning li { margin-bottom: 4px; }
.modal-confirm-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95em;
}
#withdraw-confirm-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 1em;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-family: monospace;
  letter-spacing: 0.05em;
}
#withdraw-confirm-input:focus {
  border-color: var(--danger);
  outline: none;
  box-shadow: 0 0 0 3px rgba(183, 28, 28, 0.15);
}
.modal-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.btn-danger {
  background: var(--danger);
  color: white;
  border: 2px solid var(--danger);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95em;
  cursor: pointer;
  min-height: 44px;
}
.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-danger:not(:disabled):hover {
  background: #8B0000;
  border-color: #8B0000;
}

/* ─── Breadcrumb ─── */
.breadcrumb {
  font-size: 0.9em;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--purple); }
.breadcrumb-sep { margin: 0 6px; }

/* ─── Save Status ─── */
.save-status {
  position: sticky;
  top: 70px;
  z-index: 50;
  text-align: right;
  font-size: 0.85em;
  color: var(--success);
  padding: 6px 12px;
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.save-status.saving { color: var(--gold); }
.save-status.error { color: var(--error); }

/* ─── Section Blocks / Accordions ─── */
.section-block {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.accordion-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border: none;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  font-size: 1.15em;
  font-weight: 700;
  color: var(--purple);
  transition: background var(--transition);
}
.accordion-toggle:hover { background: var(--purple-light); }
.accordion-toggle.open { border-bottom: 2px solid var(--gold); }
.accordion-icon { font-size: 0.8em; }
.accordion-body {
  display: none;
  padding: 24px;
}
.accordion-body.open { display: block; }

/* Smaller accordion for prompts */
.accordion-toggle-sm {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--purple);
}
.accordion-body-sm {
  display: none;
  padding-top: 12px;
}
.accordion-body-sm.open { display: block; }

/* ─── Toolkit Content ─── */
.toolkit-content {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.toolkit-content-actions {
  margin-bottom: 12px;
  text-align: right;
}
.read-aloud-btn { font-size: 0.85em; }

/* Toolkit content styling */
.toolkit-text h3 {
  color: var(--purple);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 4px;
  margin-top: 24px;
}
.toolkit-text h4 {
  color: var(--dark);
  margin-top: 16px;
}
.toolkit-text .stats-box {
  background: var(--purple-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}
.toolkit-text .callout-box {
  background: var(--gold-light);
  border-left: 4px solid var(--gold);
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.toolkit-text .key-takeaway {
  background: var(--purple-light);
  border-left: 4px solid var(--purple);
  padding: 14px 18px;
  margin: 20px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.toolkit-text .resources-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 16px 0;
}
.toolkit-text .script-box {
  background: var(--bg);
  border: 2px solid var(--purple);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 16px 0;
  font-style: italic;
}
.toolkit-text .template-box {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 16px 0;
}

/* Symptom grid */
.symptom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.symptom-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.symptom-card h4 { margin-bottom: 4px; color: var(--purple); }
.prevalence { color: var(--gold); font-weight: 400; font-size: 0.9em; }

/* Log table */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
.log-table th, .log-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.log-table th { background: var(--purple-light); color: var(--purple); }

/* ─── Feedback Area ─── */
.feedback-area {
  border-top: 2px solid var(--gold);
  padding-top: 20px;
}
.feedback-heading {
  color: var(--gold);
  font-size: 1.2em;
  margin-bottom: 16px;
}
.feedback-card {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.feedback-card h4 {
  color: var(--dark);
  margin-bottom: 12px;
}

/* Likert scale */
.likert-scale {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.likert-option {
  flex: 1;
  min-width: 110px;
}
.likert-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.likert-label {
  display: block;
  text-align: center;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 500;
  transition: all var(--transition);
  background: var(--bg);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.likert-option input[type="radio"]:checked + .likert-label {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
}
.likert-option input[type="radio"]:focus-visible + .likert-label {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}
.likert-label:hover {
  border-color: var(--purple);
  background: var(--purple-light);
}

/* Input mode toggle */
.input-mode-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.mode-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-light);
  transition: all var(--transition);
  min-height: 44px;
}
.mode-btn.active {
  background: var(--purple);
  color: white;
}
.mode-btn:hover:not(.active) { background: var(--purple-light); }

/* Input panels */
.input-panel { margin-top: 8px; }
.hidden { display: none !important; }

/* Audio controls */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.btn-record {
  background: var(--error);
  color: white;
  border: 2px solid var(--error);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-record:hover { background: var(--danger); }
.record-dot {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.btn-stop {
  background: var(--dark);
  color: white;
  border: 2px solid var(--dark);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.recording-timer {
  font-family: monospace;
  font-size: 1.1em;
  color: var(--error);
  font-weight: 700;
}
.audio-playback { margin: 12px 0; }
.audio-playback audio { width: 100%; margin-bottom: 8px; }
.audio-actions { display: flex; gap: 8px; }

.existing-recordings { margin-top: 16px; }
.recording-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.recording-item audio { flex: 1; min-width: 200px; }
.recording-meta { font-size: 0.8em; color: var(--text-muted); }

/* Speech-to-text */
.speech-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.speech-status {
  color: var(--success);
  font-weight: 600;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Question blocks (per-widget layout) */
.question-block {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}
.question-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.question-label {
  display: block;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 10px;
  font-size: 1em;
  line-height: 1.5;
}
.share-thoughts-card .field-hint {
  margin-bottom: 20px;
}

/* Input widget (reusable per-question audio/text/speech) */
.input-widget { margin-top: 6px; }
.input-widget .input-mode-toggle {
  margin-bottom: 10px;
}
.input-widget .input-panel {
  margin-top: 0;
}

/* ─── Complete Section ─── */
.complete-section {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 32px 0;
  flex-wrap: wrap;
}

/* Group navigation */
.group-nav {
  display: flex;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ─── Admin ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-number { font-size: 2em; font-weight: 700; color: var(--purple); }
.stat-label { font-size: 0.85em; color: var(--text-muted); margin-top: 4px; }

.admin-section { margin-bottom: 24px; }
.admin-section h2 { color: var(--purple); }
.export-buttons { display: flex; gap: 12px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
.admin-table th {
  background: var(--purple-light);
  color: var(--purple);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}
.admin-table tr:hover td { background: var(--bg-light); }
.table-wrap { overflow-x: auto; }

.inline-form { }
.prompt-admin-item {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.prompt-admin-item .form-input { flex: 1; min-width: 200px; }
.prompt-inactive { opacity: 0.5; }
.prompt-edit-form { display: flex; gap: 8px; flex: 1; align-items: center; }
.prompt-toggle-form { flex-shrink: 0; }

/* Admin participant view */
.participant-meta { margin-bottom: 24px; }
.participant-meta p { margin: 4px 0; }
.section-feedback-block {
  border-left: 3px solid var(--purple-light);
  padding-left: 16px;
  margin-bottom: 20px;
}
.feedback-display {
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
}
.feedback-display-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.feedback-type-badge {
  background: var(--purple);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
}
.feedback-question { font-size: 0.85em; color: var(--text-muted); font-style: italic; }
.feedback-content-block {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 8px 0;
  white-space: pre-wrap;
}
.feedback-timestamp { font-size: 0.8em; color: var(--text-muted); margin: 4px 0 0; }
.transcript-block {
  background: var(--gold-light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  font-size: 0.9em;
}
.text-muted { color: var(--text-muted); }
.status-text { font-size: 0.9em; color: var(--text-light); margin-bottom: 12px; }

/* ─── Sidebar Popups (Expandable Info Cards) ─── */
.sidebar-popups-container {
  margin: 24px 0;
}
.sidebar-popup {
  background: var(--bg-card);
  border: 2px solid var(--purple-light);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sidebar-popup-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border: none;
  background: var(--purple-light);
  cursor: pointer;
  text-align: left;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--purple);
  transition: background var(--transition);
  min-height: 44px;
}
.sidebar-popup-toggle:hover { background: #ddd2f0; }
.sidebar-popup-toggle.open { border-bottom: 2px solid var(--gold); }
.sidebar-popup-icon { font-size: 0.8em; transition: transform var(--transition); }
.sidebar-popup-toggle.open .sidebar-popup-icon { transform: rotate(180deg); }
.sidebar-popup-body {
  display: none;
  padding: 20px;
}
.sidebar-popup-body.open { display: block; }
.sidebar-popup-body p:last-child { margin-bottom: 0; }

/* ─── Key Takeaway Card ─── */
.key-takeaway-card {
  background: var(--purple-light);
  border: 2px solid var(--purple);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  position: relative;
}
.key-takeaway-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.key-takeaway-icon { font-size: 1.5em; }
.key-takeaway-header h3 {
  color: var(--purple);
  margin: 0;
  font-size: 1.1em;
}
.key-takeaway-card p {
  color: var(--dark);
  margin: 0;
  line-height: 1.6;
}

/* ─── Script Boxes (Section 7) ─── */
.script-box {
  background: var(--bg);
  border: 2px solid var(--purple);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 16px 0;
}
.script-heading {
  color: var(--purple);
  font-weight: 700;
  font-size: 1em;
  margin-bottom: 10px;
}
.script-line {
  font-style: italic;
  color: var(--dark);
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--gold);
}
.script-note {
  font-size: 0.85em;
  color: var(--text-muted);
  font-style: normal;
  margin-top: 8px;
}

/* ─── Section Divider ─── */
.section-divider {
  border: none;
  border-top: 2px solid var(--gold);
  margin: 32px 0;
}

/* ─── Presentation Grid ─── */
.presentation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.presentation-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.presentation-item h4 {
  color: var(--purple);
  margin-bottom: 8px;
}
.presentation-item p:last-child { margin-bottom: 0; }

/* ─── Template Box (Section 8) ─── */
.template-box {
  background: var(--bg);
  border: 2px dashed var(--purple);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
}
.template-content {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.8;
}
.template-content p { margin: 0.8em 0; }
.template-content .template-field {
  background: var(--gold-light);
  border-bottom: 2px solid var(--gold);
  padding: 2px 6px;
  font-style: italic;
  color: var(--gold);
}

/* ─── Log Template Table ─── */
.log-template {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  margin: 16px 0;
}
.log-template th, .log-template td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
.log-template th {
  background: var(--purple-light);
  color: var(--purple);
  font-weight: 600;
}
.log-template td {
  background: var(--bg);
}

/* ─── Sidebar Quote ─── */
.sidebar-quote {
  border-left: 4px solid var(--gold);
  padding: 12px 18px;
  margin: 16px 0;
  background: var(--gold-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-light);
}
.sidebar-quote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-weight: 600;
  font-size: 0.85em;
  color: var(--text-muted);
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .likert-scale { flex-direction: column; }
  .likert-option { min-width: 100%; }
  .auth-card { padding: 24px 20px; }
  .group-card-header { flex-direction: column; }
  .group-status { align-items: flex-start; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .input-mode-toggle { flex-direction: column; }
  .consent-actions { flex-direction: column; }
  .complete-section { flex-direction: column; }
  .group-nav { flex-direction: column; gap: 8px; }
}
