/* ═══════════════════════════════════════════════════════════════════════════
   Verified DSM AI Library — Stylesheet
   Design language: APA Pattern Library (Lato, #003A70 navy, institutional)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&family=Lora:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ── Design Tokens (mapped from APA Pattern Library) ────────────────────── */
:root {
  /* Primary palette */
  --apa-navy:       #003A70;
  --apa-navy-deep:  #002B54;
  --apa-navy-light: #004C97;
  --apa-blue:       #316BC8;
  --apa-sky:        #15BEF0;
  --apa-purple:     #39207C;
  --apa-gold:       #FCCB00;

  /* Semantic colors */
  --danger:         #D22730;
  --danger-dark:    #93001C;
  --danger-bg:      #fde9e9;
  --success:        #00866D;
  --success-bg:     #e6f5f0;
  --warning:        #865000;
  --warning-bg:     #fff7ec;
  --info:           #004C97;
  --info-bg:        #D5E8F9;

  /* Neutral palette */
  --text:           #212529;
  --text-secondary: #4A5568;
  --muted:          #706F70;
  --border:         #C7C8C9;
  --border-light:   #E2E8F0;
  --bg:             #F4F4F4;
  --bg-light:       #F9FAFB;
  --surface:        #FFFFFF;

  /* Typography */
  --font-primary:   'Lato', Arial, Helvetica, sans-serif;
  --font-clinical:  'Lora', Georgia, 'Times New Roman', serif;
  --font-mono:      'SF Mono', 'Cascadia Code', 'Consolas', monospace;

  /* Spacing & Shape */
  --radius:         5px;
  --radius-lg:      8px;
  --shadow-sm:      0 1px 2px rgba(0,0,0,0.06);
  --shadow:         0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,0.10), 0 4px 6px rgba(0,0,0,0.05);

  /* Layout */
  --nav-height:     64px;
  --content-max:    1200px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-primary);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--apa-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top Navigation ──────────────────────────────────────────────────────── */
.top-nav {
  background: var(--apa-navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: var(--nav-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-logo {
  font-size: 1.5rem;
  opacity: 0.9;
}
.nav-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.nav-subtitle {
  font-size: 0.75rem;
  opacity: 0.6;
  font-weight: 300;
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255,255,255,0.25);
}
.nav-links {
  display: flex;
  gap: 0.125rem;
  align-items: center;
}
.nav-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover {
  color: white;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}
.nav-links a.active {
  color: white;
  background: rgba(255,255,255,0.18);
}

/* ── Page Layout ─────────────────────────────────────────────────────────── */
#app {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem;
}

/* ── Page Title ──────────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--apa-navy);
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--apa-navy);
  line-height: 1.2;
}
.page-header .subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ── Section Headers ─────────────────────────────────────────────────────── */
.section-header {
  font-size: 24px;
  font-weight: 700;
  color: var(--apa-navy);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--apa-navy);
}
.section-subheader {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 1.25rem 0 0.75rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }
.card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--apa-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}
.card-header-bar {
  background: var(--apa-navy);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: -1.25rem -1.25rem 1rem -1.25rem;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  text-align: center;
  padding: 1.5rem 1rem;
  border-top: 3px solid var(--apa-navy);
}
.stat-value {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--apa-navy);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-approved { background: var(--success-bg); color: var(--success); border: 1px solid #a3dcc8; }
.badge-flagged  { background: var(--warning-bg); color: var(--warning); border: 1px solid #f5d5a0; }
.badge-danger   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #f9baba; }
.badge-info     { background: var(--info-bg);    color: var(--info);    border: 1px solid #b8d4ef; }
.badge-muted    { background: var(--bg);         color: var(--muted);   border: 1px solid var(--border); }
.badge-verified {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a3dcc8;
  font-size: 0.65rem;
  cursor: help;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 58, 112, 0.3);
}
.btn-primary {
  background: var(--apa-navy);
  color: #FFFFFF;
}
.btn-primary:hover { background: #18419a; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #006d59; }
.btn-outline {
  background: transparent;
  color: var(--apa-navy);
  border: 2px solid var(--apa-navy);
}
.btn-outline:hover { background: var(--apa-navy); color: white; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-primary);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--apa-navy);
  box-shadow: 0 0 0 3px rgba(0, 58, 112, 0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.radio-group { display: flex; gap: 1.25rem; margin-top: 0.35rem; }
.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ── Clinical Text (serif for DSM content) ───────────────────────────────── */
.clinical-text {
  font-family: var(--font-clinical);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
}
.dsm-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--info-bg);
  color: var(--apa-navy);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.hash-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--muted);
  background: var(--bg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

/* ── Two-Column Layout ───────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
  max-height: calc(100vh - var(--nav-height) - 2rem);
  overflow-y: auto;
}
.sidebar-list { list-style: none; }
.sidebar-list li {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 0.85rem;
  transition: background 0.1s;
  border-left: 3px solid transparent;
}
.sidebar-list li:hover { background: var(--bg); }
.sidebar-list li.active {
  background: var(--info-bg);
  border-left-color: var(--apa-navy);
  font-weight: 700;
  color: var(--apa-navy);
}
.sidebar-count {
  float: right;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}
.tab {
  padding: 0.65rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--apa-navy);
  border-bottom-color: var(--apa-navy);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Criteria List ───────────────────────────────────────────────────────── */
.criteria-list { list-style: none; }
.criterion {
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--apa-navy);
}
.criterion.exclusion { border-left-color: var(--danger); }
.criterion-id {
  font-weight: 900;
  color: var(--apa-navy);
  font-size: 0.85rem;
  margin-right: 0.5rem;
}
.criterion-text {
  font-family: var(--font-clinical);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* ── Chat Interface ──────────────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - 4rem);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}
.chat-msg {
  margin-bottom: 1.25rem;
  max-width: 85%;
}
.chat-msg.user { margin-left: auto; }
.chat-msg-bubble {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.65;
}
.chat-msg.user .chat-msg-bubble {
  background: var(--apa-navy);
  color: white;
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant .chat-msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  font-family: var(--font-clinical);
}
.chat-msg-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.3rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.chat-sources {
  margin-top: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.75rem;
  border: 1px solid var(--border-light);
}
.chat-sources summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--apa-navy);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 0;
  border-top: 2px solid var(--border);
}
.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input:focus {
  border-color: var(--apa-navy);
  box-shadow: 0 0 0 3px rgba(0, 58, 112, 0.12);
}

/* ── Search Results ──────────────────────────────────────────────────────── */
.search-result {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.search-result:hover { background: var(--bg-light); }
.search-result:last-child { border-bottom: none; }
.search-score {
  display: inline-block;
  width: 52px;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--apa-navy);
}
.search-score-bar {
  display: inline-block;
  height: 6px;
  background: var(--apa-navy);
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
  opacity: 0.7;
}
.search-snippet {
  font-family: var(--font-clinical);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  border-left: 4px solid transparent;
}
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-left-color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); border-left-color: var(--success); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-left-color: var(--info); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left-color: var(--warning); }

/* ── Tamper Demo ─────────────────────────────────────────────────────────── */
.tamper-alert {
  background: var(--danger-bg);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1rem 0;
}
.tamper-alert h3 { color: var(--danger); font-size: 1.1rem; margin-bottom: 0.75rem; }
.tamper-hash-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.tamper-hash-box {
  padding: 0.75rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  word-break: break-all;
}
.tamper-hash-box.original { background: var(--success-bg); border: 1px solid #a3dcc8; }
.tamper-hash-box.tampered  { background: var(--danger-bg);  border: 1px solid #f9baba; }

/* ── Progress Bars ───────────────────────────────────────────────────────── */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.progress-label {
  font-size: 0.8rem;
  width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--apa-navy);
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  width: 40px;
  text-align: right;
}

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 1rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--apa-navy);
  border: 2px solid var(--surface);
}
.timeline-item .card { padding: 1rem; }

/* ── Data Table ──────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 2px solid var(--apa-navy);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--apa-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-light);
}
.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.data-table tr:hover td { background: var(--bg-light); }
.data-table tr { cursor: pointer; transition: background 0.1s; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--apa-navy);
  color: white;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
}
.toast.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }
.toast.error { background: var(--danger); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--apa-navy); font-weight: 700; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 0.4rem; color: var(--border); }

/* ── Condition Header ────────────────────────────────────────────────────── */
.condition-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.condition-name {
  font-family: var(--font-clinical);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--apa-navy);
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--apa-navy);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.app-footer {
  max-width: var(--content-max);
  margin: 2rem auto 0;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* ── Utility Classes ─────────────────────────────────────────────────────── */
.clickable { cursor: pointer; }
.clickable:hover { background: var(--bg-light); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--muted); }
.text-navy { color: var(--apa-navy); }
.fw-bold { font-weight: 700; }

/* ── Nav Dropdown (Admin menu) ────────────────────────────────────────── */
.nav-more {
  position: relative;
}
.nav-more-toggle {
  color: rgba(255,255,255,0.5) !important;
  font-size: 0.7rem !important;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.35rem 0.7rem !important;
}
.nav-more-toggle:hover {
  border-color: rgba(255,255,255,0.4);
}
.nav-more-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
}
.nav-more-menu.open { display: block; }
.nav-more-menu a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text) !important;
  text-transform: none;
  letter-spacing: 0;
  text-decoration: none;
  transition: background 0.1s;
}
.nav-more-menu a:hover {
  background: var(--bg);
  text-decoration: none;
}

/* ── Ask Page (Chat-first landing) ───────────────────────────────────── */
.ask-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.ask-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--apa-navy);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.ask-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}
.ask-suggestions {
  padding: 1.5rem 0;
}
.ask-suggestions-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.ask-suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ask-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-family: var(--font-primary);
  color: var(--apa-navy);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.3;
}
.ask-chip:hover {
  background: var(--info-bg);
  border-color: var(--apa-navy);
  box-shadow: var(--shadow-sm);
}

/* Ask page — landing layout */
.ask-landing {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem;
}
.ask-input-area {
  max-width: 680px;
  margin: 0 auto;
}
.chat-input-bar--hero {
  border-top: none;
  padding: 0;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.35rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input-bar--hero:focus-within {
  border-color: var(--apa-navy);
  box-shadow: 0 0 0 4px rgba(0, 58, 112, 0.1);
}
.chat-input--hero {
  border: none !important;
  box-shadow: none !important;
  font-size: 1rem;
  padding: 0.85rem 1rem;
}
.chat-input--hero:focus {
  box-shadow: none !important;
}
.btn--hero {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  border-radius: var(--radius);
}

/* Ask page — active conversation */
.chat-container--active {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - 4rem);
}

/* ── Review Workflow ─────────────────────────────────────────────────────── */
.review-condition-preview {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.review-condition-preview h3 {
  font-family: var(--font-clinical);
  font-size: 1.2rem;
  color: var(--apa-navy);
  margin-bottom: 0.75rem;
}
.review-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.review-sections-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  transition: background 0.1s;
}
.review-sections-grid label:hover { background: var(--bg-light); }
.review-confirmation {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.review-confirmation .confirmation-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--success);
}
.review-confirmation h2 {
  font-size: 1.3rem;
  color: var(--apa-navy);
  margin-bottom: 0.5rem;
}
.review-confirmation .confirmation-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* ── Crypto Expandable ──────────────────────────────────────────────────── */
.crypto-details {
  margin-top: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-light);
  font-size: 0.8rem;
}
.crypto-details summary {
  cursor: pointer;
  padding: 0.6rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.crypto-details summary:hover { color: var(--text-secondary); }
.crypto-details .crypto-inner {
  padding: 0 0.85rem 0.85rem;
}
.crypto-details .crypto-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
}
.crypto-details .crypto-label {
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 110px;
  flex-shrink: 0;
}
.crypto-details .crypto-value {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  word-break: break-all;
  color: var(--muted);
}

/* ── Review Timeline ────────────────────────────────────────────────────── */
.review-timeline { position: relative; padding-left: 28px; }
.review-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.review-timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}
.review-timeline-item::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.review-timeline-item.outcome-approved::before { background: var(--success); }
.review-timeline-item.outcome-amended::before { background: #D4A017; }
.review-timeline-item.outcome-flagged::before { background: var(--danger); }
.review-timeline-entry {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.review-timeline-entry .reviewer-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}
.review-timeline-entry .reviewer-creds {
  font-size: 0.8rem;
  color: var(--muted);
}
.review-timeline-entry .review-date {
  font-size: 0.8rem;
  color: var(--muted);
  float: right;
}
.review-timeline-entry .review-scope {
  font-family: var(--font-clinical);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ── Verification Badge ─────────────────────────────────────────────────── */
.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
}
.verification-badge.verified {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a3dcc8;
}
.verification-badge.unverified {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #f5d5a0;
}
.verification-badge .badge-icon { font-size: 1.1rem; }
.verification-tooltip {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.5rem;
  cursor: help;
  text-decoration: underline dotted;
}

/* ── Activity Feed ──────────────────────────────────────────────────────── */
.activity-feed { list-style: none; }
.activity-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.activity-feed-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.activity-icon.approved { background: var(--success-bg); color: var(--success); }
.activity-icon.amended { background: var(--warning-bg); color: var(--warning); }
.activity-icon.flagged { background: var(--danger-bg); color: var(--danger); }
.activity-text { flex: 1; }
.activity-time { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

/* ── Tamper Alert (redesigned) ──────────────────────────────────────────── */
.tamper-alert-redesigned {
  border: 2px solid var(--danger);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1rem 0;
}
.tamper-alert-header {
  background: var(--danger);
  color: white;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1rem;
}
.tamper-alert-body {
  padding: 1.25rem;
  background: var(--danger-bg);
}
.tamper-alert-body h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
.tamper-alert-body h4:first-child { margin-top: 0; }
.tamper-alert-body p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

/* ── Review Status on Condition ─────────────────────────────────────────── */
.condition-review-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.condition-review-status.reviewed {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a3dcc8;
}
.condition-review-status.unreviewed {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .nav-links a { font-size: 0.7rem; padding: 0.35rem 0.6rem; }
  .nav-subtitle { display: none; }
  #app { padding: 1rem; }
  .two-col { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tamper-hash-compare { grid-template-columns: 1fr; }
  .section-header { font-size: 20px; }
}
