/* ==========================================================================
   DAYBREAK — Variant C ("Morning Ticker") Design System
   Source of Truth: docs/DESIGN.md & docs/CONTRACT.md
   Buildless hand-crafted CSS adhering to nomad homelab frontend constraints.
   ========================================================================== */

:root, [data-theme="light"] {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Font scaling multiplier */
  --font-scale: 1;

  /* Light Mode Palette */
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-node: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-hover: #e2e8f0;
  --text: #090d16;
  --text-muted: #334155;
  --text-faint: #475569;
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --timeline-rail: #cbd5e1;

  --accent: #0369a1;
  --accent-soft: #e0f2fe;
  --accent-text: #075985;
  --btn-accent-text: #ffffff;

  --alert-bg: #fff7ed;
  --alert-border: #ea580c;
  --alert-text: #7c2d12;

  --badge-unverified-bg: #fef3c7;
  --badge-unverified-text: #78350f;
  --badge-unverified-border: #f59e0b;

  --success-text: #14532d;
  --success-bg: #dcfce7;
  --fail-text: #7f1d1d;
  --fail-bg: #fee2e2;

  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  --tap-min: 44px;
}

[data-theme="dark"] {
  --bg: #090d16;
  --surface: #111827;
  --surface-node: #161f30;
  --surface-subtle: #1e293b;
  --surface-hover: #293548;
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-faint: #94a3b8;
  --border: #1f2937;
  --border-subtle: #192231;
  --timeline-rail: #334155;

  --accent: #38bdf8;
  --accent-soft: #082f49;
  --accent-text: #bae6fd;
  --btn-accent-text: #090d16;

  --alert-bg: #351405;
  --alert-border: #ea580c;
  --alert-text: #ffedd5;

  --badge-unverified-bg: #3a220a;
  --badge-unverified-text: #fef3c7;
  --badge-unverified-border: #d97706;

  --success-text: #86efac;
  --success-bg: #052e16;
  --fail-text: #fca5a5;
  --fail-bg: #450a0a;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Navigation Tabs & Header Controls */
.view-nav {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 10px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.view-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  min-height: var(--tap-min);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-tab-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.nav-tab-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.nav-tab-theme-btn {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text);
  font-weight: 700;
}
.nav-tab-theme-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.badge-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  color: var(--text);
}
.nav-tab-btn.active .badge-count {
  background: var(--bg);
  color: var(--text);
}

/* Ticker Masthead */
.ticker-masthead {
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.ticker-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.ticker-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.ticker-title {
  font-size: calc(24px * var(--font-scale));
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.ticker-ready-tag {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Timeline Stream Layout */
.timeline-container {
  position: relative;
  padding-left: 20px;
  margin-bottom: 30px;
}
.timeline-container::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  bottom: 0;
  width: 2px;
  background-color: var(--timeline-rail);
}

.timeline-section-marker {
  margin-top: 18px;
  margin-bottom: 10px;
}
.section-headline-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}
.section-name {
  font-size: calc(17px * var(--font-scale));
  font-weight: 800;
  color: var(--text);
}
.section-tally {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Timeline Story Node Card */
.timeline-story {
  position: relative;
  background: var(--surface-node);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.timeline-story::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--timeline-rail);
}

.story-body {
  min-width: 0;
}
.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: calc(11.5px * var(--font-scale));
  color: var(--text-muted);
  margin-bottom: 4px;
}
.outlet-tag {
  font-weight: 700;
  color: var(--text);
}

/* Pills & Badges */
.pill-coverage {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.pill-fallback {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.pill-fill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-subtle);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}
.pill-media {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-subtle);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Story Typography */
.story-headline {
  font-size: calc(15.5px * var(--font-scale));
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
  color: var(--text);
}
.story-headline a {
  color: inherit;
}
.story-headline a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.story-summary-text {
  font-size: calc(13.5px * var(--font-scale));
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 6px;
}
.story-summary-text.summary-pending {
  color: var(--text-faint);
  font-style: italic;
}

/* "Matters to you?" Callout (Models) */
.matters-ticker {
  background: var(--surface-subtle);
  border-left: 2px solid var(--accent);
  padding: 6px 10px;
  font-size: calc(12.5px * var(--font-scale));
  line-height: 1.4;
  margin-top: 6px;
  color: var(--text);
}
.matters-ticker strong {
  color: var(--accent);
  font-weight: 700;
}

/* Related Links ("Also today") */
.related-links-box {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border);
  font-size: calc(12.5px * var(--font-scale));
}
.related-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: block;
}
.related-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.related-list li a {
  color: var(--text);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.related-list li a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.related-outlet {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Repo Section Signals & Popularity Unverified Flag */
.repo-metric-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: calc(11.5px * var(--font-scale));
  margin-bottom: 6px;
}
.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
}
.metric-badge.velocity {
  color: var(--success-text);
}
.unverified-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--badge-unverified-bg);
  color: var(--badge-unverified-text);
  border: 1px solid var(--badge-unverified-border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.unverified-box {
  font-size: 12px;
  color: var(--badge-unverified-text);
  background: var(--badge-unverified-bg);
  border: 1px dashed var(--badge-unverified-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 6px;
}
.unverified-box strong {
  display: block;
  margin-bottom: 3px;
}
.unverified-box ul {
  margin-left: 18px;
  margin-top: 4px;
}

/* Travel Section Node Differentiation */
.timeline-story.alert-node {
  background: var(--alert-bg);
  border-color: var(--alert-border);
}
.timeline-story.alert-node::before {
  background: var(--alert-border);
}
.timeline-story.critical-alert-node {
  background: var(--alert-bg);
  border: 2px solid var(--alert-border);
}
.timeline-story.critical-alert-node::before {
  background: var(--alert-border);
  width: 8px;
  height: 8px;
  left: -25px;
}
.pill-alert {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--alert-bg);
  color: var(--alert-text);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--alert-border);
}
.pill-critical {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--alert-bg);
  color: var(--alert-text);
  border: 1px solid var(--alert-border);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}
.pill-inspiration {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.advisory-change-card {
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: calc(12.5px * var(--font-scale));
  color: var(--alert-text);
}
.advisory-change-title {
  font-weight: 800;
  margin-bottom: 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.advisory-level-pill {
  background: var(--alert-bg);
  color: var(--alert-text);
  border: 1px solid var(--alert-border);
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}
.destination-divider {
  font-size: calc(13px * var(--font-scale));
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.empty-slot-node {
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: calc(12px * var(--font-scale));
  color: var(--text-muted);
  font-style: italic;
}
.empty-dest-node {
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: calc(12.5px * var(--font-scale));
  color: var(--text-muted);
}
.quiet-timeline-node {
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Story Action Bar */
.story-actions-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}
.actions-left, .actions-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.action-btn {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.action-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.action-btn.voted-up {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-text);
}
.action-btn.voted-down {
  background: var(--fail-bg);
  color: var(--fail-text);
  border-color: var(--fail-text);
}
.action-btn.bookmarked {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* Thumbs Down Reason Chips */
.thumb-reasons-strip {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px dashed var(--border-subtle);
  width: 100%;
}
.thumb-reasons-strip.open {
  display: flex;
}
.reasons-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-right: 2px;
}
.reason-chip {
  min-height: var(--tap-min);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.reason-chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.reason-chip.selected {
  background: var(--fail-bg);
  color: var(--fail-text);
  border-color: var(--fail-text);
  font-weight: 700;
}

/* "Show more" per section */
.more-section-wrapper {
  margin-top: 10px;
  margin-bottom: 16px;
}
.btn-more-toggle {
  min-height: var(--tap-min);
  width: 100%;
  background: var(--surface-node);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-more-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.more-loading-bar {
  display: none;
  min-height: var(--tap-min);
  padding: 10px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.more-loading-bar.active {
  display: flex;
}
.more-expanded-stories {
  display: none;
}
.more-expanded-stories.open {
  display: block;
}

/* Loading Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Screen Panels */
.screen-panel {
  display: none;
}
.screen-panel.active {
  display: block;
}

/* Archive View */
.archive-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.archive-entry-title {
  font-size: 14px;
  font-weight: 700;
}
.archive-entry-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.btn-action {
  min-height: var(--tap-min);
  padding: 0 14px;
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.btn-action:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

/* Settings View */
.ticker-setting-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}
.ticker-setting-header {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ticker-setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--tap-min);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}
.ticker-setting-item:last-child {
  border-bottom: none;
}
.setting-item-label {
  font-size: 13.5px;
  font-weight: 600;
}
.setting-item-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Text Scale Switcher */
.scale-group {
  display: inline-flex;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.scale-btn {
  min-height: var(--tap-min);
  min-width: 44px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.scale-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.scale-btn.active {
  background: var(--text);
  color: var(--bg);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: var(--tap-min);
  cursor: pointer;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.slider {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  cursor: pointer;
  background-color: var(--border);
  transition: 0.2s;
  border-radius: 28px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(20px);
}
[data-theme="dark"] input:checked + .slider:before {
  background-color: #090d16;
}

/* Forms & Inputs */
.form-input {
  min-height: var(--tap-min);
  padding: 8px 12px;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 100%;
  margin-bottom: 8px;
}
.btn-submit {
  min-height: var(--tap-min);
  padding: 0 16px;
  background: var(--accent);
  color: var(--btn-accent-text);
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-submit:hover {
  opacity: 0.9;
}
.btn-del {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 0 10px;
  background: var(--fail-bg);
  color: var(--fail-text);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Destination Keywords & Review Notice */
.dest-keywords-wrap {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}
.keywords-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}
.keywords-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.keyword-pill {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.keyword-review-box {
  background: var(--badge-unverified-bg);
  color: var(--badge-unverified-text);
  border: 1px solid var(--badge-unverified-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.btn-suggest {
  min-height: var(--tap-min);
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

/* Login Page Components */
.login-box {
  max-width: 400px;
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
}
.pwd-wrapper {
  position: relative;
  margin-bottom: 12px;
}
.pwd-wrapper input {
  padding-right: 48px;
  margin-bottom: 0;
}
.pwd-toggle-btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap-min);
  margin-bottom: 16px;
  cursor: pointer;
}
.checkbox-wrap input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.login-error-msg {
  background: var(--fail-bg);
  color: var(--fail-text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 12px;
  display: none;
}
.login-error-msg.show {
  display: block;
}

/* Run Report & Pipeline Diagnostics */
.ticker-run-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 14px;
}
.ticker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.ticker-metric {
  background: var(--surface-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.ticker-val {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.ticker-lbl {
  font-size: 11px;
  color: var(--text-muted);
}
.ticker-err-box {
  background: var(--fail-bg);
  color: var(--fail-text);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 12px;
  margin-top: 10px;
}
.ticker-err-box ul {
  margin-left: 18px;
  margin-top: 4px;
}

/* Feed Incident Items */
.feed-incident-item {
  background: var(--fail-bg);
  color: var(--fail-text);
  border-left: 3px solid var(--fail-text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 6px;
  font-size: 12px;
}
.feed-resolved-item {
  background: var(--success-bg);
  color: var(--success-text);
  border-left: 3px solid var(--success-text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 6px;
  font-size: 12px;
}

/* Compact Usage Line (Stage 6a) */
.usage-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 12.5px;
}
.usage-bar-track {
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  margin-top: 6px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  background: var(--accent);
  width: var(--usage-pct, 0%);
  transition: width 0.3s ease;
}
.usage-bar-fill.warning {
  background: var(--alert-border);
}

/* "Why?" Inspector Dialog Modal */
dialog.why-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-node);
  color: var(--text);
  max-width: 520px;
  width: calc(100% - 32px);
  margin: auto;
  padding: 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
dialog.why-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}
.modal-close-btn {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.modal-close-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.eval-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}
.eval-row:last-child {
  border-bottom: none;
}
.eval-score {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Toast Notifications */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 100;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Accessibility & Mobile Responsive Tuning */
@media (max-width: 480px) {
  .app-shell {
    padding: 0 12px;
  }
  .ticker-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Helper & Strict CSP Classes (Zero Inline Styles)
   ========================================================================== */
.hidden, [hidden] {
  display: none !important;
}

.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

.margin-top-xs {
  margin-top: 4px;
}

.margin-top-md {
  margin-top: 14px;
}

.margin-bottom-xs {
  margin-bottom: 4px;
}

.space-between-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-row-gap-sm {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Login Layout */
.login-shell {
  padding-top: 40px;
}

.login-top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 20px;
}

.login-field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.checkbox-desc {
  font-size: 13px;
}

/* Archive & Offline Banners */
.archive-notice-banner {
  background: var(--accent-soft);
  border-color: var(--accent);
  margin-bottom: 14px;
}

.archive-notice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.archive-notice-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-text);
}

.offline-notice-banner {
  background: var(--surface-subtle);
  border-style: dashed;
  margin-bottom: 14px;
}

.offline-notice-text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Settings & Form Elements */
.meta-endpoint-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.add-dest-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form-section-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 8px;
}

.form-label-bold {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

.form-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.btn-submit-auto {
  width: auto;
  padding: 0 18px;
}

.dest-setting-item {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.btn-action-compact {
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

/* Usage Card & Metric Elements */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.card-header-title {
  font-size: 13px;
}

.usage-summary-text {
  color: var(--text-muted);
  font-size: 12px;
}

.usage-pool-metrics {
  font-size: 11.5px;
  margin-top: 6px;
  color: var(--text-faint);
}

.run-card-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ticker-val-accent {
  color: var(--accent);
}

/* Feed Health Incidents */
.feed-incident-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.section-heading-sm {
  font-size: 15px;
  font-weight: 800;
}

.feed-incident-clean {
  font-size: 12.5px;
  color: var(--success-text);
  font-weight: 700;
}

.feed-incident-open-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--fail-text);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.incident-detail-text {
  font-size: 11.5px;
  margin-top: 2px;
}

.incident-resolved-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 10px;
  text-transform: uppercase;
}

/* Modal & Dynamic States */
.modal-section-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.modal-dest-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

.modal-loading-row {
  padding: 14px 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.jev-answers-box {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.jev-answers-title {
  font-size: 12px;
  display: block;
  margin-bottom: 4px;
}

.eval-score-accent {
  color: var(--accent);
  font-size: 14px;
}

.eval-score-pass {
  color: var(--success-text);
}

.eval-score-fail {
  color: var(--alert-text);
}

.empty-state-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
}

.loading-state-row {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

.error-state-row {
  color: var(--fail-text);
  font-size: 12px;
  padding: 4px 0;
}

.empty-state-row {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 8px 0;
}

.candidate-story {
  background: var(--surface-subtle);
}

/* Calibration Run Diagnostics Card */
.calibration-summary-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 6px;
}

.calibration-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.calibration-badge {
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.05em;
}

.calibration-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.calibration-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

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

.calibration-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  text-align: center;
}

.calibration-stat .stat-num {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.calibration-stat .stat-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

