/*
 * Result components shared by index.html (dark Instrument theme) and report.html.
 * Uses the theme variables from brand.css. Tones are the one place token colours become CSS:
 * js/ui/tokens.js maps overall.colorToken -> .tone-* / .score-* classes.
 */
:root {
  --tone-pass: #10B981;
  --tone-good: #60A5FA;
  --tone-warn: #F59E0B;
  --tone-fail: #F87171;
  --tone-muted: #94A3B8;
}
.report-page {
  --tone-pass: #15803d;
  --tone-good: #1d4ed8;
  --tone-warn: #b45309;
  --tone-fail: #b91c1c;
  --tone-muted: #475569;
}

.tone-pass { --tone: var(--tone-pass); }
.tone-good { --tone: var(--tone-good); }
.tone-warn { --tone: var(--tone-warn); }
.tone-fail { --tone: var(--tone-fail); }
.tone-muted { --tone: var(--tone-muted); }
.tone-pass, .tone-good, .tone-warn, .tone-fail, .tone-muted { color: var(--tone); }

.score-muted { background: linear-gradient(135deg, #475569, #334155); box-shadow: 0 0 48px rgba(100, 116, 139, 0.3); }

/* Chips: icon + text, so status is never colour-only */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono, monospace); font-size: 0.75rem; font-weight: 500;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--tone, currentColor);
  background: color-mix(in srgb, var(--tone, currentColor) 12%, transparent);
}
.chip-icon { font-weight: 700; }
.grade-chip { margin-left: 10px; font-family: var(--mono, monospace); font-weight: 500; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--tone); font-size: 0.85rem; }
.verdict-label { font-size: 1.1rem; }

.scope-note { font-size: 0.9rem; color: var(--text-2, #94A3B8); margin: 4px 0 16px; overflow-wrap: anywhere; }

/* Cap banner */
.cap-banner {
  display: flex; gap: 14px; align-items: flex-start; text-align: left;
  max-width: 760px; margin: 16px auto; padding: 14px 18px;
  border: 1px solid var(--tone-warn); border-left-width: 5px; border-radius: var(--radius-md, 12px);
  background: color-mix(in srgb, var(--tone-warn) 12%, transparent);
  color: var(--text, #EEF2FF);
}
.cap-icon { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--tone-warn); color: #080F1E; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.cap-help { margin: 4px 0 0; font-size: 0.875rem; opacity: 0.85; }
.cap-extra { margin: 6px 0 0; padding-left: 18px; font-size: 0.875rem; }
.report-page .cap-banner { color: #1f2937; }

/* v2 notice */
.v2-notice { max-width: 760px; margin: 12px auto; text-align: left; border: 1px solid var(--accent-border-2, rgba(59,130,246,.35)); background: var(--accent-dim, rgba(59,130,246,.1)); border-radius: var(--radius-md, 12px); padding: 12px 16px; }
.v2-notice-inner { display: flex; gap: 12px; align-items: flex-start; }
.v2-notice p { margin: 0; font-size: 0.9rem; color: var(--text, #EEF2FF); }
.notice-dismiss { background: transparent; border: 1px solid var(--accent-border-2, rgba(59,130,246,.35)); color: var(--text, #EEF2FF); border-radius: 8px; width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; flex: none; }
.notice-dismiss:focus-visible, .rule-details summary:focus-visible { outline: 2px solid var(--accent, #3B82F6); outline-offset: 2px; }

/* History compare */
.history-compare { max-width: 760px; margin: 12px auto; text-align: left; }
.compare-panel { margin-top: 12px; padding: 14px 18px; background: var(--surface, #0D1F3C); border: 1px solid var(--border, rgba(255,255,255,.06)); border-radius: var(--radius-md, 12px); }
.compare-panel h4 { margin: 0 0 8px; }
.compare-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.9rem; }
.compare-table th, .compare-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); }
.compare-note { font-size: 0.875rem; color: var(--text-2, #94A3B8); }

/* Category cards (extends .category in index.css) */
.category-card h3 { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.category-unmeasured { opacity: 0.9; }
.category-note, .category-moved { font-size: 0.85rem; color: var(--text-2, #94A3B8); margin: 8px 0 0; }
.cat-bar { height: 6px; background: var(--surface-3, #112347); border-radius: 3px; overflow: hidden; margin: 8px 0 12px; }
.cat-bar-fill { height: 100%; background: var(--accent, #3B82F6); }
.rule-details { margin-top: 12px; }
.rule-details summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; padding: 6px 0; }
.rule-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rule-item { padding: 10px 12px; border-radius: 8px; background: var(--surface-2, #0A1628); border: 1px solid var(--border, rgba(255,255,255,.06)); }
.rule-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rule-title { font-weight: 600; }
.rule-points { font-family: var(--mono, monospace); font-size: 0.75rem; color: var(--text-2, #94A3B8); }
.rule-evidence, .rule-fix { margin: 6px 0 0; font-size: 0.875rem; color: var(--text-2, #94A3B8); overflow-wrap: anywhere; }
.rule-fix { color: var(--text, #EEF2FF); }
.info-only-chip { --tone: var(--tone-muted); }

/* Extra sections */
.result-section { max-width: 1200px; margin: 0 auto 30px; }
.ai-access, .healthcare-group { background: var(--surface, #0D1F3C); border: 1px solid var(--accent-border, rgba(59,130,246,.18)); border-radius: var(--radius-md, 12px); padding: 24px; text-align: left; }
.ai-access h3, .healthcare-group h3 { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ai-access h4 { margin: 18px 0 4px; }
.ai-access-note, .ai-access-summary { font-size: 0.875rem; color: var(--text-2, #94A3B8); margin: 0 0 10px; }
.bot-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.bot-table th, .bot-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); vertical-align: top; }
.bot-table thead th { font-family: var(--mono, monospace); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2, #94A3B8); }
.bot-evidence { color: var(--text-2, #94A3B8); overflow-wrap: anywhere; }
@media (max-width: 640px) { .bot-table thead { display: none; } .bot-table tr { display: block; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); padding: 6px 0; } .bot-table th, .bot-table td { display: block; border: 0; padding: 2px 10px; } }

.rec-rule { display: block; font-weight: 600; font-size: 0.85rem; color: var(--text-2, #94A3B8); }
.check-item.limited { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); }

/* Progress: indeterminate (no fake percentage) */
.progress-bar-fill.indeterminate { width: 40%; animation: eaeo-indeterminate 1.4s ease-in-out infinite; }
@keyframes eaeo-indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.progress-elapsed, .progress-checklist { font-size: 0.8rem; color: var(--text-3, #475569); margin: 6px 0 0; }
.progress-checklist { color: var(--text-2, #94A3B8); }
@media (prefers-reduced-motion: reduce) { .progress-bar-fill.indeterminate { animation: none; margin-left: 30%; } }

/* Error overlay */
.error-overlay { position: fixed; inset: 0; z-index: 9999; background: var(--bg, #080F1E); display: flex; align-items: center; justify-content: center; padding: 40px; }
.error-overlay.hidden { display: none; }
.error-box { text-align: center; max-width: 520px; }
.error-box h3 { color: var(--tone-fail); margin: 0 0 12px; }
.error-box p { color: var(--text-2, #94A3B8); margin: 0 0 20px; }
.error-box button { background: var(--accent, #3B82F6); color: #fff; border: 0; padding: 12px 24px; border-radius: 8px; cursor: pointer; font-weight: 600; font-family: var(--display, sans-serif); }
.lead-thanks-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
