@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700&family=DM+Sans:wght@300;400;500;600&display=swap');
:root {
  --navy: #0f0a2e;
  --navy-mid: #151035;
  --navy-light: #8b5cf6;
  --accent: #06b6d4;
  --accent-bright: #22d3ee;
  --bg: #0f0a2e;
  --surface: #151035;
  --surface2: #1a1540;
  --border: rgba(139, 92, 246, 0.2);
  --text: #e2e8f0;
  --text-muted: #a0abbe;
  --success: #10b981;
  --danger: #ef4444;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --glow-purple: transparent;
  --glow-cyan: transparent;
  --gradient: linear-gradient(135deg, #8b5cf6, #06b6d4);
}

/* Global selection */
::selection { background: rgba(139, 92, 246, 0.4); color: #fff; }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'DM Sans', sans-serif; background: linear-gradient(135deg, #12082e 0%, #0f0a2e 25%, #0d1030 50%, #0a1535 75%, #091428 100%); color: var(--text); min-height: 100vh; overflow-x: clip; max-width: 100vw; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(139, 92, 246, 0.05); }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.5); }

header {
  background: linear-gradient(135deg, #12082e 0%, #0f0a2e 50%, #0d1030 100%);
  padding: 0px 32px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: none;
  position: relative;
  box-shadow: 0 4px 40px rgba(139, 92, 246, 0.15);
}
header::before { display: none; }
header::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: var(--gradient); opacity: 0.5; }
.header-rule {
  height: 0px;
  background: linear-gradient(to bottom, #0a0e1a 0%, #0a0e1a 64%, #8b5cf6 64%, #06b6d4 100%);
  flex-shrink: 0;
}
.header-inner { display: flex; align-items: center; justify-content: center; width: 100%; position: relative; }
.header-logo { display: flex; flex-direction: column; align-items: center; }
.header-logo-img { height: 200px; width: auto; display: block; margin-top: -20px; margin-bottom: -35px; }
.header-subtitle { font-size: 0.88rem; color: var(--text-muted); letter-spacing: 0.18em; font-weight: 400; margin-top: 6px; }
.header-actions { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 10px; }
.header-title { display: none; }
.btn-outline { background: transparent; border: 1.5px solid rgba(139, 92, 246, 0.4); color: var(--text); border-radius: 6px; padding: 7px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: 'Inter', 'DM Sans', sans-serif; transition: all 0.25s; }
.btn-outline:hover { background: rgba(139, 92, 246, 0.15); border-color: #8b5cf6; box-shadow: 0 0 15px var(--glow-purple); }
.btn-sm { font-size: 0.78rem; padding: 5px 12px; }

main { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }
#panel-dashboard main, main.cid-main { max-width: 96vw; padding: 20px 24px 80px; }

.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; margin-bottom: 28px; border: 1px solid var(--border); backdrop-filter: blur(12px); transition: border-color 0.3s, box-shadow 0.3s; }
.card:hover { border-color: rgba(139, 92, 246, 0.35); box-shadow: 0 4px 30px rgba(139, 92, 246, 0.08); }
.card-title { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--surface2); }
.card-title .icon { width: 38px; height: 38px; border-radius: 10px; background: var(--gradient); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: #fff; flex-shrink: 0; box-shadow: 0 0 15px var(--glow-purple); }
.card-title h2 { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--text); font-weight: 600; }

.dropzone { border: 2.5px dashed var(--border); border-radius: 14px; padding: 52px 24px; text-align: center; cursor: pointer; transition: all 0.3s ease; background: var(--surface2); position: relative; }
.dropzone:hover, .dropzone.drag-over { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.08); box-shadow: 0 0 30px var(--glow-purple); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone .dz-icon { font-size: 3rem; margin-bottom: 14px; display: block; }
.dropzone .dz-title, .drop-zone .dz-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.dropzone .dz-sub { font-size: 0.85rem; color: var(--text-muted); }
.dz-logo-img { width: 90px; height: 90px; object-fit: contain; display: block; margin: 0 auto 16px; pointer-events: none; }
.dz-types { display: inline-flex; gap: 8px; margin-top: 14px; }
.dz-tag { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; font-size: 0.75rem; color: #8b5cf6; font-weight: 500; }

#file-list { margin-top: 16px; }
.file-item { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 0.88rem; }
.file-item .fi-name { flex: 1; font-weight: 500; color: var(--text); }
.file-item .fi-size { color: var(--text-muted); font-size: 0.78rem; }
.file-item .fi-remove { cursor: pointer; color: var(--danger); font-size: 1rem; background: none; border: none; padding: 4px; border-radius: 6px; transition: all 0.2s; }
.file-item .fi-remove:hover { background: rgba(239, 68, 68, 0.15); }

.btn-primary { background: var(--gradient); color: #fff; border: none; border-radius: 10px; padding: 12px 28px; font-size: 0.9rem; font-weight: 600; font-family: 'Inter', 'DM Sans', sans-serif; cursor: pointer; transition: all 0.25s; box-shadow: 0 4px 20px var(--glow-purple); display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 30px var(--glow-purple), 0 0 40px var(--glow-cyan); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.btn-full { width: 100%; margin-top: 16px; }

.progress-bar-wrap { background: var(--surface2); border-radius: 99px; height: 8px; margin-top: 14px; overflow: hidden; display: none; }
.progress-bar-fill { height: 100%; background: var(--gradient); border-radius: 99px; width: 0%; transition: width 0.4s ease; box-shadow: 0 0 10px var(--glow-cyan); }
.progress-label { text-align: center; font-size: 0.82rem; color: var(--text-muted); margin-top: 8px; display: none; }

#results-section { display: none; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 4px; }
.info-field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; }
.info-field input { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.95rem; font-family: 'Inter', 'DM Sans', sans-serif; color: var(--text); transition: all 0.25s; outline: none; }
.info-field input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15), 0 0 15px var(--glow-purple); background: rgba(139, 92, 246, 0.05); }

.bp-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { background: linear-gradient(135deg, #1a1040, #0f1629); color: #e2e8f0; padding: 12px 16px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; border-bottom: 2px solid rgba(139, 92, 246, 0.3); }
thead th:first-child { border-radius: 10px 0 0 0; }
thead th:last-child { border-radius: 0 10px 0 0; }
tbody tr:nth-child(even) { background: var(--surface2); }
tbody tr:nth-child(odd) { background: var(--surface); }
tbody tr:hover { background: rgba(139, 92, 246, 0.08); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tbody td input[type=number] { width: 80px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 7px; padding: 7px 10px; font-size: 0.9rem; font-family: 'Inter', 'DM Sans', sans-serif; color: var(--text); text-align: center; outline: none; transition: all 0.25s; }
tbody td input[type=number]:focus { border-color: #8b5cf6; box-shadow: 0 0 10px var(--glow-purple); }
.wpi-pill { display: inline-block; background: var(--gradient); color: #fff; border-radius: 20px; padding: 4px 14px; font-size: 0.85rem; font-weight: 600; min-width: 60px; text-align: center; box-shadow: 0 0 10px var(--glow-purple); }
.remove-bp { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; transition: all 0.2s; }
.remove-bp:hover { background: rgba(239, 68, 68, 0.15); }

.add-bp-row { display: flex; gap: 12px; align-items: flex-end; margin-top: 20px; flex-wrap: wrap; }
.add-bp-row .info-field { flex: 1; min-width: 160px; }
.add-bp-row .info-field input { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.95rem; font-family: 'Inter', 'DM Sans', sans-serif; color: var(--text); outline: none; }
.btn-add { background: var(--success); color: #fff; border: none; border-radius: 10px; padding: 11px 24px; font-size: 0.9rem; font-weight: 600; font-family: 'Inter', 'DM Sans', sans-serif; cursor: pointer; transition: all 0.25s; white-space: nowrap; align-self: flex-end; display: flex; align-items: center; gap: 6px; box-shadow: 0 0 15px rgba(16, 185, 129, 0.3); }
.btn-add:hover { filter: brightness(1.15); transform: translateY(-1px); box-shadow: 0 0 25px rgba(16, 185, 129, 0.4); }

.method-selector { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.method-btn { padding: 10px 20px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface); color: var(--text-muted); font-family: 'Inter', 'DM Sans', sans-serif; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.25s; }
.method-btn.active { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.12); color: #8b5cf6; box-shadow: 0 0 15px var(--glow-purple); }
.method-desc { font-size: 0.82rem; color: var(--text-muted); background: var(--surface2); border-radius: 8px; padding: 10px 14px; margin-bottom: 20px; border-left: 3px solid #8b5cf6; }

.pd-result-box { background: linear-gradient(135deg, #0d1025 0%, #151a30 100%); border-radius: 16px; padding: 36px; text-align: center; color: #fff; position: relative; overflow: hidden; border: 1px solid var(--border); }
.pd-result-box::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 60%); animation: glow-pulse 4s ease-in-out infinite; }
.pd-result-box .pd-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em; color: rgba(255,255,255,0.6); margin-bottom: 8px; position: relative; }
.pd-result-box .pd-value { font-family: 'Playfair Display', serif; font-size: 4rem; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1; margin-bottom: 4px; position: relative; }
.pd-result-box .pd-pct { font-size: 1.5rem; color: rgba(255,255,255,0.7); position: relative; }
.pd-result-box .pd-sub { font-size: 0.82rem; color: rgba(255,255,255,0.5); margin-top: 10px; position: relative; }

.pd-breakdown { margin-top: 20px; background: var(--surface2); border-radius: 12px; padding: 20px; font-size: 0.88rem; border: 1px solid var(--border); }
.pd-breakdown-title { font-weight: 600; color: var(--text); margin-bottom: 12px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }
.breakdown-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.breakdown-item:last-child { border-bottom: none; }
.breakdown-item .bi-name { color: var(--text); font-weight: 500; }

.action-row { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.btn-secondary { background: var(--surface); color: #8b5cf6; border: 2px solid var(--border); border-radius: 10px; padding: 12px 24px; font-size: 0.9rem; font-weight: 600; font-family: 'Inter', 'DM Sans', sans-serif; cursor: pointer; transition: all 0.25s; display: inline-flex; align-items: center; gap: 8px; }
.btn-secondary:hover { border-color: #8b5cf6; color: #a78bfa; background: rgba(139, 92, 246, 0.08); box-shadow: 0 0 15px var(--glow-purple); }

.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.92rem; }
.empty-state .es-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.alert { border-radius: 10px; padding: 12px 16px; font-size: 0.88rem; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-info { background: rgba(6, 182, 212, 0.1); border: 1px solid rgba(6, 182, 212, 0.25); color: var(--accent); }

@media print {
  header { background: #ffffff !important; border-bottom: 1px solid #000 !important; -webkit-print-color-adjust: exact; }
  #upload-section, .method-selector, .add-bp-row, .action-row { display: none !important; }
  #results-section { display: block !important; }
}

/* ===== TAB NAVIGATION ===== */
.tab-nav {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.18) 0%, rgba(139, 92, 246, 0.12) 30%, rgba(6, 182, 212, 0.12) 70%, rgba(6, 182, 212, 0.18) 100%);
  display: flex;
  align-items: flex-end;
  padding: 0 0;
  gap: 2px;
  border-top: 1px solid rgba(139, 92, 246, 0.4);
  border-bottom: 2px solid transparent;
  border-image: var(--gradient) 1;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.3), 0 0 50px rgba(6, 182, 212, 0.15), 0 4px 20px rgba(0,0,0,0.5);
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-nav::before {
  content: '';
  position: absolute;
  bottom: 0; left: -60%; width: 60%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.9), rgba(6, 182, 212, 0.9), transparent);
  animation: tab-shimmer 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.5), 0 0 30px rgba(6, 182, 212, 0.3);
}
@keyframes tab-shimmer {
  0% { left: -60%; }
  100% { left: 120%; }
}
.tab-btn {
  background: rgba(139, 92, 246, 0.08);
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 5px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'Inter', 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  top: 2px;
  z-index: 1;
  min-height: 34px;
  line-height: 1.2;
  flex: 0 0 auto;
  justify-content: center;
  white-space: nowrap;
}
.tab-icon { text-shadow: none !important; }
.tab-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(6, 182, 212, 0.3));
  color: #fff;
  box-shadow:
    0 0 15px rgba(168, 85, 247, 0.6),
    0 0 30px rgba(139, 92, 246, 0.5),
    0 0 60px rgba(139, 92, 246, 0.35),
    0 0 90px rgba(6, 182, 212, 0.25),
    inset 0 0 20px rgba(139, 92, 246, 0.2);
  border-color: rgba(168, 85, 247, 0.8);
  z-index: 2;
}
.tab-btn:hover .tab-label {
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.9),
    0 0 20px rgba(168, 85, 247, 0.9),
    0 0 40px rgba(168, 85, 247, 0.7),
    0 0 60px rgba(6, 182, 212, 0.5);
}
.tab-btn.active {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.25) 0%, var(--bg) 100%);
  color: #fff;
  border-color: rgba(139, 92, 246, 0.5);
  border-bottom: none;
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.4), 0 0 50px rgba(6, 182, 212, 0.15);
}
.tab-btn.active .tab-label {
  text-shadow: 0 0 15px rgba(139, 92, 246, 0.7), 0 0 30px rgba(6, 182, 212, 0.3);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* ═══════ SHARED HERO PANEL LAYOUT (all tabs) ═══════ */
.hero-layout {
  display: flex;
  justify-content: center;
  padding: 12px 30px;
  min-height: calc(100vh - 140px);
  align-items: flex-start;
}
.hero-panel {
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  background: rgba(245, 243, 250, 0.92);
  border: 3px solid rgba(139, 92, 246, 0.6);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  /* glow removed */
}
#panel-dashboard .hero-panel {
  max-width: 96%;
  max-height: none;
}
/* SIBTF report is long (3-prong strip + ~8 detail sections + SOL + red flags
 * + recommendations). Let it grow and use page-level scrolling rather than
 * a tiny inner scroll area that makes the report look truncated. */
#panel-futuremed .hero-panel {
  max-width: 910px;
  max-height: none;
  overflow: visible;
}
#panel-futuremed .hero-panel-body { overflow-y: visible; }
#panel-futuremed .hero-layout { align-items: flex-start; min-height: auto; }

#panel-sibtf .hero-panel {
  max-height: none;
  max-width: 960px;
  overflow: visible;
}
#panel-sibtf .hero-panel-body { overflow-y: visible; }
#panel-sibtf .hero-layout { align-items: flex-start; min-height: auto; }
.hero-panel--wide { max-width: 700px; }
.hero-panel-title {
  padding: 18px 24px 0;
  flex-shrink: 0;
}
.hero-panel-body {
  flex: 1;
  padding: 16px 24px 24px;
  overflow-y: auto;
}
.hero-upload-center {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}
.hero-dz-sm {
  width: 84px;
  height: 84px;
  padding: 6px 5px;
}
.hero-inner-card {
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.hero-inner-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e1b4b;
  margin: 0 0 8px;
}
.hero-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 8px;
}
.hero-empty-icon {
  font-size: 2.5rem;
  opacity: 0.6;
}

#panel-records { min-height: calc(100vh - 90px); }

/* ===== MEDICAL RECORD SCRAPER ===== */
#scraper-results { display: none; }
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.provider-card {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
}
.provider-card:hover { box-shadow: 0 4px 25px var(--glow-purple); border-color: rgba(139, 92, 246, 0.4); }
.provider-card .pc-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.provider-card .pc-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}
.provider-card .pc-address {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}
.provider-card .pc-address svg { flex-shrink: 0; margin-top: 2px; }
.provider-card .pc-specialty {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.provider-type-pill {
  display: inline-block;
  background: #8b5cf6;
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  box-shadow: 0 0 8px var(--glow-purple);
}
.provider-type-pill.facility { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.3); }

/* Case info fields */
.case-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.case-info-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.case-info-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface2);
  transition: all 0.25s;
  outline: none;
}
.case-info-field input:focus { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.05); box-shadow: 0 0 15px var(--glow-purple); }
.case-info-full { grid-column: 1 / -1; }
/* Physician facility tag on card */
.pc-facility {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: #8b5cf6;
  font-weight: 500;
  margin-top: 4px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 6px;
  padding: 3px 8px;
}

.scraper-summary {
  background: linear-gradient(135deg, #0d1025 0%, #151a30 100%);
  color: #fff;
  border-radius: 14px;
  padding: 20px 28px;
  margin-bottom: 24px;
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.08);
}
.scraper-summary .stat { text-align: center; }
.scraper-summary .stat .num { font-size: 2rem; font-weight: 700; font-family: 'Playfair Display', serif; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.scraper-summary .stat .lbl { font-size: 0.78rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.08em; }
.copy-btn-sm {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-family: 'Inter', 'DM Sans', sans-serif;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
.copy-btn-sm:hover { background: var(--surface2); border-color: #8b5cf6; box-shadow: 0 0 12px var(--glow-purple); }

/* ===== RECORDS CHAT ===== */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .chat-layout { grid-template-columns: 1fr; } }

.chat-file-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 5px; font-size: 0.8rem;
}
.chat-file-row .cfr-icon { font-size: 0.85rem; flex-shrink: 0; }
.chat-file-row .cfr-name { flex: 1; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-file-row .cfr-meta { color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; }
.chat-file-row .cfr-rm { cursor: pointer; color: var(--danger); background: none; border: none; padding: 2px 5px; border-radius: 4px; font-size: 0.85rem; }

.chat-stats-bar {
  display: flex; gap: 0; margin-bottom: 14px; margin-top: 12px;
  background: linear-gradient(135deg, #0d1025, #151a30);
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border);
}
.cs-item { flex: 1; text-align: center; padding: 10px 4px; color: #fff; border-right: 1px solid rgba(139, 92, 246, 0.15); }
.cs-item:last-child { border-right: none; }
.cs-num { font-size: 1.4rem; font-weight: 700; font-family: 'Playfair Display', serif; line-height: 1; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.cs-lbl { font-size: 0.65rem; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }

.cf-label { font-size: 0.73rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 7px; margin-top: 14px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.fp {
  padding: 4px 11px; border-radius: 99px; font-size: 0.73rem; font-weight: 500;
  border: 1.5px solid var(--border); background: var(--surface2); color: var(--text);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.fp:hover { border-color: #8b5cf6; color: #8b5cf6; box-shadow: 0 0 10px var(--glow-purple); }
.fp.active { background: var(--gradient); border-color: transparent; color: #fff; box-shadow: 0 0 12px var(--glow-purple); }

/* Chat main panel */
.chat-main-card { display: flex; flex-direction: column; padding: 0 !important; overflow: hidden; border-radius: 16px; min-height: 560px; max-height: 78vh; }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.chat-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 16px; }
.chat-empty-state .ce-icon { font-size: 2.8rem; margin-bottom: 12px; }
.chat-empty-state h3 { font-family: 'Playfair Display', serif; color: var(--text); margin-bottom: 6px; font-size: 1.1rem; }
.chat-empty-state p { color: var(--text-muted); font-size: 0.84rem; margin-bottom: 18px; max-width: 340px; }
.sug-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; width: 100%; max-width: 520px; }
.sug-btn {
  background: var(--surface2); border: 1.5px solid var(--border); border-radius: 9px;
  padding: 9px 12px; text-align: left; font-size: 0.78rem; color: var(--text);
  cursor: pointer; transition: all 0.2s; font-family: 'Inter', 'DM Sans', sans-serif; line-height: 1.3;
}
.sug-btn:hover { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.08); color: #a78bfa; box-shadow: 0 0 12px var(--glow-purple); }

/* Messages */
.cmsg { display: flex; flex-direction: column; max-width: 90%; }
.cmsg.user { align-self: flex-end; }
.cmsg.assistant { align-self: flex-start; max-width: 97%; }
.cmsg-bubble { border-radius: 13px; padding: 11px 15px; font-size: 0.87rem; line-height: 1.65; }
.cmsg.user .cmsg-bubble { background: var(--gradient); color: #fff; border-bottom-right-radius: 3px; box-shadow: 0 3px 15px var(--glow-purple); }
.cmsg.assistant .cmsg-bubble { background: var(--surface2); border: 1.5px solid var(--border); color: var(--text); border-bottom-left-radius: 3px; backdrop-filter: blur(8px); }
.cmsg-text { white-space: pre-wrap; word-break: break-word; }
.cmsg-text strong { color: #a78bfa; font-weight: 600; }
.cmsg-text em { color: var(--text-muted); }
.cmsg-time { font-size: 0.69rem; color: var(--text-muted); margin-top: 4px; padding: 0 3px; }
.cmsg.user .cmsg-time { text-align: right; }

.cite-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.cite-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.25); border-radius: 6px;
  padding: 2px 8px; font-size: 0.7rem; color: #8b5cf6; font-weight: 500;
}
.thinking-msg .cmsg-bubble { background: var(--surface2); border: 1.5px solid var(--border); }
.thinking-dots { display: inline-flex; gap: 3px; align-items: center; }
.thinking-dots span { width: 6px; height: 6px; border-radius: 50%; background: #8b5cf6; display: inline-block; animation: tdot 1.1s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes tdot { 0%,60%,100% { transform: translateY(0); opacity:.6; } 30% { transform: translateY(-5px); opacity:1; } }

/* Input area */
.chat-input-wrap { border-top: 1.5px solid var(--border); padding: 14px 18px; background: var(--surface2); flex-shrink: 0; }
.chat-convo-meta { display: flex; justify-content: flex-end; margin-bottom: 7px; }
.chat-convo-meta button { font-size: 0.72rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0; }
.chat-convo-meta button:hover { color: var(--danger); }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-ta {
  flex: 1; resize: none; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 9px 13px; font-family: 'Inter', 'DM Sans', sans-serif; font-size: 0.88rem;
  background: var(--surface); color: var(--text); outline: none;
  min-height: 42px; max-height: 110px; line-height: 1.5; transition: all 0.25s;
}
.chat-ta:focus { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.05); box-shadow: 0 0 15px var(--glow-purple); }
.chat-ta:disabled { opacity: 0.45; }
.chat-go {
  background: var(--gradient);
  color: #fff; border: none; border-radius: 10px; width: 42px; height: 42px;
  font-size: 1.1rem; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.25s; box-shadow: 0 3px 15px var(--glow-purple);
}
.chat-go:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 25px var(--glow-purple), 0 0 30px var(--glow-cyan); }
.chat-go:disabled { opacity: 0.38; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-hint { font-size: 0.69rem; color: var(--text-muted); margin-top: 6px; }

/* Mode toggle bar */
.chat-mode-bar {
  display: flex; gap: 6px; padding: 10px 18px 0; flex-wrap: wrap;
  border-top: 1.5px solid var(--border); background: var(--surface2);
}
.chat-mode-lbl { font-size: 0.69rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; align-self: center; margin-right: 2px; }
.chat-mode-btn {
  font-size: 0.74rem; font-family: 'Inter', 'DM Sans', sans-serif;
  padding: 5px 11px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  transition: all 0.2s; font-weight: 500; white-space: nowrap;
}
.chat-mode-btn:hover { border-color: #8b5cf6; color: #8b5cf6; background: rgba(139, 92, 246, 0.08); }
.chat-mode-btn.active {
  background: var(--gradient);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 12px var(--glow-purple);
}
.chat-mode-actions { display: flex; gap: 6px; margin-left: auto; align-self: center; }
.chat-mode-action-btn {
  font-size: 0.73rem; font-family: 'Inter', 'DM Sans', sans-serif;
  padding: 5px 11px; border-radius: 20px;
  border: 1.5px solid #8b5cf6; color: #8b5cf6;
  background: transparent; cursor: pointer; transition: all 0.2s; font-weight: 500;
}
.chat-mode-action-btn:hover { background: #8b5cf6; color: #fff; box-shadow: 0 0 15px var(--glow-purple); }
.chat-mode-action-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Structured answer sections */
.ans-direct {
  background: rgba(139, 92, 246, 0.1);
  border-left: 3px solid #8b5cf6;
  border-radius: 0 8px 8px 0; padding: 9px 13px; margin-bottom: 10px;
  font-weight: 500; color: var(--text);
}
.ans-section-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); margin: 10px 0 4px;
}
.ans-ambiguity {
  background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: 7px;
  padding: 7px 11px; margin-top: 9px; font-size: 0.82rem;
  color: #fbbf24; display: flex; gap: 7px; align-items: flex-start;
}
.ans-ambiguity::before { content: '\26A0\FE0F'; flex-shrink: 0; }

/* MTC Tab styles */
.mtc-timeline-entry {
  display: grid;
  grid-template-columns: 120px 130px 140px 1fr 160px 28px;
  gap: 6px;
  align-items: start;
  margin-bottom: 6px;
  padding: 8px;
  background: var(--surface2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.mtc-timeline-entry input, .mtc-timeline-entry select {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}
.mtc-timeline-header {
  display: grid;
  grid-template-columns: 120px 130px 140px 1fr 160px 28px;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mtc-remove-btn {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 6px;
  line-height: 1;
  transition: all 0.2s;
}
.mtc-remove-btn:hover { background: #dc2626; box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
.mtc-doc-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.8rem;
}
.mtc-doc-check-item.present { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.mtc-doc-check-item.missing { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.mtc-warn-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #fbbf24;
  margin-top: 6px;
}
.mtc-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--text);
  border: 1px solid var(--border);
}
.mtc-file-item .mtc-file-type {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mtc-file-item .mtc-file-type.pdf { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.mtc-file-item .mtc-file-type.docx { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.mtc-file-item .mtc-file-type.txt { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.mtc-file-item .mtc-file-remove { margin-left:auto;cursor:pointer;color:var(--danger);font-size:1rem;line-height:1; }
.dropzone.drag-over { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.08); }

/* ===== MEDICAL CHRONOLOGY + QME SHARED STYLES ===== */
.chrono-section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #8b5cf6; margin-bottom: 6px;
}
.chrono-mode-btn {
  padding: 5px 11px; font-size: 0.75rem; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 20px; background: var(--surface);
  color: #8b5cf6; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.chrono-mode-btn.active, .chrono-mode-btn:hover {
  background: var(--gradient); color: white; border-color: transparent; box-shadow: 0 0 12px var(--glow-purple);
}
.chrono-view-btn {
  padding: 5px 14px; font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 6px; background: var(--surface);
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.chrono-view-btn.active { background: var(--gradient); color: white; border-color: transparent; box-shadow: 0 0 12px var(--glow-purple); }
.chrono-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
  min-width: 700px;
}
.chrono-table th {
  background: linear-gradient(135deg, #1a1040, #0f1629); color: #e2e8f0; padding: 8px 10px;
  text-align: left; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}
.chrono-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top; line-height: 1.4; color: var(--text);
}
.chrono-table tr:hover td { background: rgba(139, 92, 246, 0.06); }
.chrono-table tr.important-row td { background: rgba(245, 158, 11, 0.08); }
.chrono-table tr.uncertain-row td { background: rgba(239, 68, 68, 0.06); }
.chrono-table tr.filtered-out { display: none; }
.chrono-cite {
  display: inline-block; font-size: 0.68rem; background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6; border-radius: 3px; padding: 1px 5px;
  font-weight: 600; cursor: default; white-space: nowrap;
}
.chrono-badge {
  display: inline-block; font-size: 0.65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; margin-right: 3px; white-space: nowrap;
}
.badge-ps    { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-surgery { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-imaging { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.badge-med   { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-restrict { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.badge-uncert { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.chrono-edit-btn, .chrono-pin-btn, .chrono-del-btn {
  background: none; border: none; cursor: pointer; font-size: 0.8rem;
  opacity: 0.5; transition: opacity 0.2s; padding: 2px;
}
.chrono-edit-btn:hover, .chrono-pin-btn:hover, .chrono-del-btn:hover { opacity: 1; }
.chrono-row-actions { display: flex; gap: 2px; }

/* QME Sections */
.qme-section-tab {
  padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid var(--border); border-bottom: none; border-radius: 6px 6px 0 0;
  background: var(--surface2); color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  position: relative; top: 2px;
}
.qme-section-tab.active { background: var(--surface); color: #8b5cf6; border-color: rgba(139, 92, 246, 0.4); z-index: 1; }
.qme-section-panel { display: none; }
.qme-section-panel.active { display: block; }
.qme-field-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.83rem;
  align-items: start;
}
.qme-field-label {
  font-weight: 700; color: #8b5cf6; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px;
}
.qme-field-value { color: var(--text); line-height: 1.5; }
.qme-field-value.missing { color: var(--text-muted); font-style: italic; }
.qme-issue-item {
  padding: 8px 12px; margin-bottom: 6px; border-radius: 6px;
  font-size: 0.82rem; line-height: 1.5; border-left: 3px solid;
}
.qme-issue-warn  { background: rgba(245, 158, 11, 0.08); border-color: #f59e0b; color: #fbbf24; }
.qme-issue-alert { background: rgba(239, 68, 68, 0.08); border-color: #ef4444; color: #f87171; }
.qme-issue-info  { background: rgba(59, 130, 246, 0.08); border-color: #3b82f6; color: #60a5fa; }
.qme-issue-sibtf { background: rgba(139, 92, 246, 0.08); border-color: #8b5cf6; color: #a78bfa; }
.qme-wpi-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--surface2); border-radius: 6px;
  margin-bottom: 6px; border: 1px solid var(--border); font-size: 0.82rem;
}
.qme-wpi-pct { font-size: 1.3rem; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.qme-exec-summary {
  background: rgba(139, 92, 246, 0.08); border-left: 4px solid #8b5cf6;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  font-size: 0.87rem; line-height: 1.65; color: var(--text);
  margin-bottom: 16px; white-space: pre-wrap; font-family: 'Inter', 'DM Sans', sans-serif;
}
.qme-atty-summary {
  background: rgba(245, 158, 11, 0.08); border-left: 4px solid #f59e0b;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  font-size: 0.87rem; line-height: 1.65; color: #fbbf24;
  margin-top: 14px; white-space: pre-wrap; font-family: 'Inter', 'DM Sans', sans-serif;
}
.qme-compare-table table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.qme-compare-table th {
  background: linear-gradient(135deg, #1a1040, #0f1629); color: #e2e8f0; padding: 8px 10px; text-align: left;
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}
.qme-compare-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.qme-compare-table tr:hover td { background: rgba(139, 92, 246, 0.06); }
.qme-diff-changed { background: rgba(245, 158, 11, 0.08) !important; }
.quick-action-btn {
  padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
  background: var(--surface); border: 1.5px solid #8b5cf6; color: #8b5cf6;
  border-radius: 20px; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.quick-action-btn:hover { background: #8b5cf6; color: white; box-shadow: 0 0 15px var(--glow-purple); }

/* === GAP FINDER === */
.gap-category { border:1px solid var(--border); border-radius:10px; margin-bottom:14px; overflow:hidden; }
.gap-category-header { background:var(--surface2); padding:12px 18px; font-weight:700; font-size:0.9rem; cursor:pointer; display:flex; justify-content:space-between; align-items:center; color:var(--text); }
.gap-category-header:hover { background:rgba(139, 92, 246, 0.08); }
.gap-category-body { padding:14px 18px; }
.gap-item { padding:10px 14px; border-left:3px solid #06b6d4; background:var(--surface2); border-radius:0 6px 6px 0; margin-bottom:8px; font-size:0.84rem; color:var(--text); }
.gap-item.priority-high { border-left-color:#ef4444; }
.gap-item.priority-medium { border-left-color:#f59e0b; }
.gap-item.priority-low { border-left-color:#10b981; }
.gap-citation { font-size:0.74rem; color:var(--text-muted); margin-top:4px; }
.gap-actions { display:flex; gap:6px; margin-top:6px; }
.gap-pill { display:inline-block; padding:2px 10px; border-radius:12px; font-size:0.72rem; font-weight:600; cursor:pointer; border:1px solid var(--border); background:var(--surface); color:var(--text); }
.gap-pill:hover { background:rgba(139, 92, 246, 0.1); border-color:#8b5cf6; }
.gap-filter-bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.gap-filter-pill { padding:5px 14px; border-radius:20px; font-size:0.78rem; cursor:pointer; border:1px solid var(--border); background:var(--surface); font-weight:500; color:var(--text-muted); }
.gap-filter-pill.active { background:var(--gradient); color:#fff; border-color:transparent; box-shadow:0 0 12px var(--glow-purple); }
.gap-summary-bar { display:flex; gap:20px; flex-wrap:wrap; padding:10px 0 14px; border-bottom:1px solid var(--border); margin-bottom:14px; font-size:0.85rem; color:var(--text); }
.gap-count-badge { background:rgba(139, 92, 246, 0.15); color:#8b5cf6; border-radius:6px; padding:2px 8px; font-weight:700; font-size:0.82rem; margin-left:4px; }

/* === PD AUDIT TRAIL === */
.pd-audit-trail { background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:14px 18px; margin-top:14px; font-size:0.83rem; }
.pd-audit-step { display:flex; justify-content:space-between; align-items:baseline; padding:4px 0; border-bottom:1px solid var(--border); }
.pd-audit-step:last-child { border-bottom:none; }
.pd-audit-label { color:var(--text-muted); font-weight:500; }
.pd-audit-value { font-weight:700; color:var(--text); }
.pd-audit-basis { color:var(--text-muted); font-size:0.75rem; margin-left:8px; }
.pd-audit-title { font-weight:700; color:var(--text); margin-bottom:8px; font-size:0.9rem; border-bottom:2px solid transparent; border-image:var(--gradient) 1; padding-bottom:6px; }
.pd-rebuttal-note { background:rgba(245, 158, 11, 0.1); border:1px solid rgba(245, 158, 11, 0.3); border-radius:6px; padding:8px 12px; margin-top:10px; font-size:0.8rem; color:#fbbf24; }

/* === RECORDS CHAT PRESETS === */
.chat-presets-rail { display:flex; gap:6px; flex-wrap:wrap; padding:8px 0 4px; border-bottom:1px solid var(--border); margin-bottom:8px; }
.chat-preset-pill { padding:4px 12px; border-radius:16px; font-size:0.76rem; cursor:pointer; border:1px solid #8b5cf6; color:#8b5cf6; background:rgba(139, 92, 246, 0.05); font-weight:500; white-space:nowrap; }
.chat-preset-pill:hover { background:#8b5cf6; color:#fff; box-shadow:0 0 12px var(--glow-purple); }

/* === CITATION BADGE === */
.cite-badge { display:inline-block; background:rgba(139, 92, 246, 0.12); color:#8b5cf6; border:1px solid rgba(139, 92, 246, 0.25); border-radius:4px; font-size:0.72rem; padding:0 6px; margin:0 2px; font-weight:500; }

/* === MTC CLASSIFICATION BADGE === */
.mtc-doc-class { display:inline-block; padding:1px 8px; border-radius:4px; font-size:0.71rem; font-weight:700; margin-left:6px; text-transform:uppercase; }
.mtc-doc-class.subpoena { background:rgba(16, 185, 129, 0.15); color:#10b981; }
.mtc-doc-class.declaration { background:rgba(59, 130, 246, 0.15); color:#3b82f6; }
.mtc-doc-class.hipaa-auth { background:rgba(6, 182, 212, 0.15); color:#06b6d4; }
.mtc-doc-class.due-diligence { background:rgba(245, 158, 11, 0.15); color:#f59e0b; }
.mtc-doc-class.proof-of-service { background:rgba(139, 92, 246, 0.15); color:#a78bfa; }
.mtc-doc-class.follow-up { background:rgba(251, 146, 60, 0.15); color:#fb923c; }
.mtc-doc-class.non-compliance { background:rgba(239, 68, 68, 0.15); color:#ef4444; }
.mtc-doc-class.unknown { background:rgba(100, 116, 139, 0.15); color:#94a3b8; }
.mtc-missing-warning { background:rgba(245, 158, 11, 0.1); border:1px solid rgba(245, 158, 11, 0.3); border-radius:6px; padding:10px 14px; font-size:0.82rem; margin-bottom:8px; }
.mtc-missing-warning .miss-label { font-weight:700; color:#fbbf24; }
.mtc-packet-preview { border:1px solid var(--border); border-radius:8px; overflow:hidden; margin-top:12px; }
.mtc-packet-preview summary { padding:10px 16px; font-weight:700; font-size:0.88rem; cursor:pointer; background:var(--surface2); color:var(--text); }
.mtc-packet-preview-body { padding:14px 18px; font-size:0.83rem; color:var(--text); }

/* === TAB HEADER BAR === */
.tab-header-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin-bottom:18px; }
.tab-header-left { display:flex; flex-direction:column; gap:2px; }
.tab-header-title { font-size:1.12rem; font-weight:800; color:var(--text); display:flex; align-items:center; gap:8px; }
.tab-header-desc { font-size:0.8rem; color:var(--text-muted); }

/* === ADVANCED OPTIONS TOGGLE === */
details.adv-options summary { cursor:pointer; font-size:0.78rem; color:#8b5cf6; font-weight:600; padding:4px 0; user-select:none; }
details.adv-options summary:hover { color:#a78bfa; }
details.adv-options > div { margin-top:8px; padding:12px; background:var(--surface2); border-radius:6px; border:1px solid var(--border); }

/* -- Tab Header / Description -- */
.tab-header { margin-bottom: 20px; }
.tab-header h2 { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.tab-desc { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }

/* -- Primary / Secondary Buttons (alias) -- */
.primary-btn { background: var(--gradient); color: #fff; border: none; border-radius: 10px; padding: 10px 24px; font-size: 0.9rem; font-weight: 600; font-family: 'Inter', 'DM Sans', sans-serif; cursor: pointer; transition: all 0.25s; box-shadow: 0 4px 20px var(--glow-purple); display: inline-flex; align-items: center; gap: 8px; }
.primary-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 30px var(--glow-purple), 0 0 40px var(--glow-cyan); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.secondary-btn { background: var(--surface); color: #8b5cf6; border: 2px solid var(--border); border-radius: 10px; padding: 8px 18px; font-size: 0.85rem; font-weight: 600; font-family: 'Inter', 'DM Sans', sans-serif; cursor: pointer; transition: all 0.25s; display: inline-flex; align-items: center; gap: 6px; }
.secondary-btn:hover { border-color: #8b5cf6; color: #a78bfa; background: rgba(139, 92, 246, 0.08); box-shadow: 0 0 15px var(--glow-purple); }

/* -- Upload Hero -- */
/* -- Upload Split Layout -- */
.upload-split {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-bottom: 28px;
}

/* Left: Branding Panel */
.upload-brand-panel {
  flex: 0 0 auto;
  flex: 0 0 320px;
  height: 370px;
  background: rgba(245, 243, 250, 0.92);
  border: 3px solid rgba(139, 92, 246, 0.6);
  border-radius: 14px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  /* glow removed */
  align-self: flex-start;
}
.upload-brand-panel::before {
  display: none;
}
.brand-panel-title {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1.3;
  color: #1e1b4b;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
  text-align: left;
}
.brand-panel-tagline {
  font-size: 0.92rem;
  color: #5b21b6;
  line-height: 1.6;
  text-align: left;
  max-width: 280px;
  margin-bottom: 0;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.brand-panel-bullets {
  list-style: none;
  padding: 0;
  margin: 12px 0 0 0;
  position: relative;
  z-index: 1;
}
.brand-panel-bullets li {
  font-size: 0.82rem;
  color: #5b21b6;
  padding: 4px 0 4px 18px;
  position: relative;
  line-height: 1.5;
}
.brand-panel-bullets li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #8b5cf6;
}
.upload-brand-panel .upload-hero-stats {
  position: relative;
  z-index: 1;
}

/* Upload Hero */
.upload-hero {
  flex: 1;
  background: rgba(245, 243, 250, 0.92);
  border: 3px solid rgba(139, 92, 246, 0.6);
  border-radius: 18px;
  padding: 28px 30px;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  /* glow removed */
  display: flex;
  flex-direction: column;
}
.upload-hero-inner {
  display: flex;
  gap: 24px;
  flex: 1;
  position: relative;
  z-index: 1;
}
.upload-hero-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.upload-hero-right {
  flex: 0 0 300px;
  display: flex;
  align-self: flex-start;
}
.upload-hero::before {
  display: none;
}
.upload-hero-title {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1.3;
  color: #1e1b4b;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.upload-hero-accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.upload-hero-desc {
  font-size: 0.88rem;
  color: #4a4a6a;
  line-height: 1.7;
  margin-bottom: 0;
  margin-top: 22px;
  position: relative;
  z-index: 1;
  max-width: 380px;
}
.upload-hero-stats {
  display: flex;
  gap: 30px;
  margin-top: 40px;
  justify-content: flex-start;
}
.upload-hero-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.upload-hero-stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.upload-hero-stat-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #64748b;
  text-transform: uppercase;
}

/* -- Drop Zone Hero -- */
.drop-zone-hero {
  border: none;
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.35s ease;
  position: relative;
  width: 300px;
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: radial-gradient(circle at center, rgb(35, 28, 68) 0%, rgb(48, 40, 85) 50%, rgb(70, 60, 110) 100%);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4), 0 0 30px rgba(6, 182, 212, 0.3);
}
.drop-zone-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%238b5cf6'/%3E%3Cstop offset='100%25' stop-color='%2306b6d4'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='2' y='2' width='296' height='296' rx='14' ry='14' fill='none' stroke='url(%23g)' stroke-width='4' stroke-dasharray='14 10'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  pointer-events: none;
}
.drop-zone-hero:hover, .drop-zone-hero.drag-over {
  background: rgba(107, 33, 168, 0.35);
  box-shadow:
    0 0 25px rgba(107, 33, 168, 0.5),
    0 0 50px rgba(107, 33, 168, 0.3),
    0 0 100px rgba(107, 33, 168, 0.2),
    inset 0 0 40px rgba(107, 33, 168, 0.15);
}
.drop-zone-hero:hover::after, .drop-zone-hero.drag-over::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Crect x='2' y='2' width='296' height='296' rx='14' ry='14' fill='none' stroke='%239333ea' stroke-width='4' stroke-dasharray='14 10'/%3E%3C/svg%3E");
}
.dz-hero-logo {
  width: 75%;
  height: auto;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
  margin-bottom: 10px;
}
.drop-zone-hero > *:not(.dz-hero-logo) {
  z-index: 1;
}

/* -- Drop Zone (generic, kept for compat) -- */
.drop-zone { border: 2.5px dashed var(--border); border-radius: 14px; padding: 40px 24px; text-align: center; cursor: pointer; transition: all 0.3s ease; background: var(--surface2); position: relative; }
.drop-zone:hover { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.06); box-shadow: 0 0 25px var(--glow-purple); }
.drop-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; }
.drop-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* -- Legacy dashboard (kept for compat) -- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 16px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.dash-card h3 { margin: 0 0 12px; font-size: 0.9rem; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.dash-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); color: var(--text); }
.dash-table td:first-child { color: var(--text-muted); width: 40%; }
.dash-table td:last-child { font-weight: 500; }

/* -- Case Intelligence Dashboard -- */
.cid-main { background: var(--bg); max-width: 100%; padding: 0; }
.cid-wrap { max-width: 95vw; margin: 0 auto; padding: 28px 28px 60px; }
.cid-page-header { margin-bottom: 22px; }
.cid-page-header h2 { font-size: 1.35rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.cid-page-sub { font-size: 0.82rem; color: var(--text-muted); }

/* Empty state */
.cid-empty-state { text-align: center; padding: 64px 24px; }
.cid-empty-icon { font-size: 3rem; margin-bottom: 16px; }
.cid-empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 8px; }
.cid-empty-state p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }

/* Summary tiles */
.cid-summary-bar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 1100px) { .cid-summary-bar { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .cid-summary-bar { grid-template-columns: repeat(2, 1fr); } }
.cid-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 1px 8px rgba(0,0,0,0.2); backdrop-filter: blur(8px); transition: all 0.3s; }
.cid-tile:hover { border-color: rgba(139, 92, 246, 0.4); box-shadow: 0 0 20px var(--glow-purple); }
.cid-tile.highlight { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.08); }
.cid-tile-label { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); }
.cid-tile-value { font-size: 0.97rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cid-tile.highlight .cid-tile-value { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.cid-tile-value.pending { color: var(--text-muted); font-style: italic; font-weight: 400; font-size: 0.78rem; }

/* Two-column rows */
.cid-row { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 0; align-items: start; }
.cid-row.equal { grid-template-columns: 1fr 1fr; }
@media (max-width: 920px) { .cid-row, .cid-row.equal { grid-template-columns: 1fr; } }
.cid-col { display: flex; flex-direction: column; gap: 18px; }

/* Section cards */
.cid-section { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; box-shadow: 0 1px 10px rgba(0,0,0,0.2); backdrop-filter: blur(8px); }
.cid-section-header { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cid-section-icon { font-size: 1.05rem; }
.cid-section-title { font-size: 0.88rem; font-weight: 700; color: var(--text); flex: 1; }
.cid-section-count { font-size: 0.68rem; background: rgba(139, 92, 246, 0.15); color: #8b5cf6; padding: 2px 9px; border-radius: 20px; font-weight: 700; }

/* Case info grid */
.cid-info-grid { display: flex; flex-direction: column; gap: 0; }
.cid-info-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cid-info-row:last-child { border-bottom: none; }
.cid-info-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; min-width: 90px; }
.cid-info-val { font-size: 0.82rem; color: var(--text); font-weight: 500; }
.cid-pending { color: var(--text-muted); font-style: italic; }

/* Insights */
.cid-insights-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.cid-insight-item { display: flex; align-items: flex-start; gap: 10px; font-size: 0.81rem; color: var(--text); line-height: 1.5; }
.cid-insight-dot { width: 8px; height: 8px; border-radius: 50%; background: #8b5cf6; margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 6px var(--glow-purple); }
.cid-insight-dot.amber { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.cid-insight-dot.green { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.cid-insight-dot.red   { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }

/* Body diagram */
.cid-body-diagram-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
/* PNG + SVG overlay container */
.body-diagram-container { position: relative; display: inline-block; max-width: 180px; width: 100%; }
.body-diagram-img { display: block; width: 100%; height: auto; user-select: none; pointer-events: none; }
.body-diagram-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  overflow: visible;
}
.body-hotspot { fill: transparent; cursor: pointer; transition: fill 0.18s; stroke: transparent; }
.body-hotspot.affected  { fill: rgba(239,68,68,0.28); stroke: #ef4444; stroke-width: 2; cursor: pointer; }
.body-hotspot.affected:hover  { fill: rgba(239,68,68,0.50); }
.body-hotspot.mentioned { fill: rgba(245,158,11,0.18); stroke: #f59e0b; stroke-width: 1.5; cursor: pointer; }
.body-hotspot.mentioned:hover { fill: rgba(245,158,11,0.38); }
.cid-diagram-legend { display: flex; gap: 14px; font-size: 0.68rem; color: var(--text-muted); align-items: center; }
.cid-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* Body part cards */
.cid-bp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.cid-bp-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 15px; background: var(--surface2); cursor: pointer; transition: all 0.25s; }
.cid-bp-card:hover { border-color: rgba(139, 92, 246, 0.5); box-shadow: 0 2px 15px var(--glow-purple); }
.cid-bp-card.expanded { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.06); }
.cid-bp-name { font-size: 0.84rem; font-weight: 700; color: var(--text); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.cid-bp-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cid-bp-pill { font-size: 0.66rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.cid-bp-pill.wpi     { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.cid-bp-pill.apport  { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.cid-bp-pill.pending { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.cid-bp-expand { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.77rem; color: var(--text-muted); }
.cid-bp-card.expanded .cid-bp-expand { display: block; }
.cid-bp-expand-row { margin-bottom: 8px; }
.cid-bp-expand-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; display: block; margin-bottom: 3px; }
.cid-bp-chevron { font-size: 0.65rem; color: var(--text-muted); margin-left: auto; transition: transform 0.2s; }
.cid-bp-card.expanded .cid-bp-chevron { transform: rotate(180deg); }

/* Confidence pills */
.conf-pill { display: inline-flex; align-items: center; font-size: 0.61rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.3px; }
.conf-pill.extracted { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.conf-pill.inferred  { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.conf-pill.manual    { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

/* Providers */
.cid-provider-group { margin-bottom: 14px; }
.cid-provider-group:last-child { margin-bottom: 0; }
.cid-provider-group-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.cid-provider-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cid-provider-item:last-child { border-bottom: none; }
.cid-provider-avatar { width: 30px; height: 30px; border-radius: 50%; background: rgba(139, 92, 246, 0.15); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; }
.cid-provider-info { flex: 1; min-width: 0; }
.cid-provider-name { font-size: 0.81rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cid-provider-spec { font-size: 0.7rem; color: var(--text-muted); }

/* Documents */
.cid-doc-list { display: flex; flex-direction: column; gap: 9px; }
.cid-doc-card { border: 1px solid var(--border); border-radius: 8px; padding: 11px 14px; display: flex; align-items: center; gap: 12px; background: var(--surface2); }
.cid-doc-type-badge { font-size: 0.62rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; color: #fff; white-space: nowrap; flex-shrink: 0; }
.cid-doc-info { flex: 1; min-width: 0; }
.cid-doc-name { font-size: 0.81rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cid-doc-meta { font-size: 0.69rem; color: var(--text-muted); margin-top: 2px; }

/* Future medical */
.cid-fm-group { margin-bottom: 14px; }
.cid-fm-group:last-child { margin-bottom: 0; }
.cid-fm-group-title { font-size: 0.72rem; font-weight: 700; color: #8b5cf6; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.cid-fm-group-title::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--gradient); flex-shrink: 0; box-shadow: 0 0 6px var(--glow-purple); }
.cid-fm-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 0.79rem; color: var(--text); border-bottom: 1px solid var(--border); }
.cid-fm-item:last-child { border-bottom: none; }
.cid-fm-type { font-weight: 600; flex: 1; }
.cid-fm-freq { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* Timeline */
.cid-timeline { position: relative; padding-left: 22px; }
.cid-timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--gradient); border-radius: 2px; opacity: 0.5; }
.cid-timeline-item { position: relative; margin-bottom: 18px; }
.cid-timeline-item:last-child { margin-bottom: 0; }
.cid-timeline-item::before { content: ''; position: absolute; left: -18px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #8b5cf6; border: 2px solid var(--surface); box-shadow: 0 0 8px var(--glow-purple); }
.cid-timeline-date { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.cid-timeline-title { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.cid-timeline-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }

/* Warnings */
.cid-warning-list { display: flex; flex-direction: column; gap: 8px; }
.cid-warning-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-radius: 8px; font-size: 0.79rem; }
.cid-warning-item.action { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25); }
.cid-warning-item.info   { background: rgba(59, 130, 246, 0.08); border: 1px solid rgba(59, 130, 246, 0.25); }
.cid-warning-item.ok     { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.25); }
.cid-warning-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.cid-warning-text { color: var(--text); line-height: 1.45; }
.cid-warning-text strong { display: block; font-weight: 700; margin-bottom: 2px; font-size: 0.8rem; }

/* Gap spacer for column stacking */
.cid-gap { height: 18px; }

/* -- Score Meters -- */
.score-meters { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.score-meter { flex: 1; min-width: 160px; }
.score-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.score-bar-wrap { background: var(--surface2); border-radius: 4px; height: 10px; overflow: hidden; }
.score-bar { height: 100%; border-radius: 4px; transition: width 0.4s ease; background: var(--gradient); box-shadow: 0 0 8px var(--glow-cyan); }
.score-value { font-size: 0.85rem; font-weight: 700; margin-top: 4px; color: var(--text); }

/* -- Doc Type Badge -- */
.doc-type-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 4px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* -- View Toggle -- */
.view-toggle { display: flex; gap: 6px; margin-bottom: 16px; }
.view-toggle-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.2s;
}
.view-toggle-btn.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 0 12px var(--glow-purple);
}

/* -- Preset Pills -- */
.preset-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.preset-pill {
  padding: 4px 10px;
  background: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: all 0.2s;
}
.preset-pill:hover { background: rgba(139, 92, 246, 0.2); box-shadow: 0 0 10px var(--glow-purple); }

/* -- Future Medical Table -- */
.fm-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin-top: 12px; }
.fm-table th { background: linear-gradient(135deg, #1a1040, #0f1629); padding: 8px 10px; text-align: left; border-bottom: 2px solid rgba(139, 92, 246, 0.3); font-size: 0.75rem; color: #e2e8f0; }
.fm-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.fm-table tr:hover td { background: rgba(139, 92, 246, 0.06); }
.fm-total-row td { font-weight: 700; background: rgba(16, 185, 129, 0.1); padding: 10px; color: #10b981; }
.fm-low { color: #10b981; }
.fm-mid { color: #f59e0b; font-weight: 600; }
.fm-high { color: #ef4444; }

/* -- Future Medical toolbar (mode toggle, inflation/PV, OMFS banner, pull from PD) -- */
.fm-toolbar { margin-top: 16px; padding: 12px 14px; background: rgba(15, 22, 41, 0.4);
  border: 1px solid var(--border); border-radius: 10px; }
.fm-toolbar-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.fm-toolbar-group { display: inline-flex; align-items: center; gap: 8px; }
.fm-toolbar-right { margin-left: auto; }
.fm-toolbar-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 600; }
.fm-toolbar-hint { font-size: 0.72rem; color: var(--text-muted); font-style: italic; }
.fm-mode-btn { padding: 5px 14px; font-size: 0.78rem; font-weight: 600; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: all 0.15s; }
.fm-mode-btn:hover { color: var(--text); border-color: rgba(139,92,246,0.4); }
.fm-mode-btn.active { background: var(--gradient); color: #fff; border-color: transparent;
  box-shadow: 0 2px 10px rgba(139,92,246,0.4); }
.fm-toolbar-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem;
  color: var(--text); cursor: pointer; }
.fm-toolbar-check input { cursor: pointer; }
.fm-pull-btn { padding: 7px 14px; font-size: 0.8rem; font-weight: 600; border-radius: 8px;
  border: none; background: linear-gradient(135deg, #22c55e, #06b6d4); color: #fff; cursor: pointer;
  box-shadow: 0 2px 12px rgba(34,197,94,0.3); }
.fm-pull-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(34,197,94,0.5); }
.fm-omfs-banner { margin-top: 10px; padding: 8px 12px; font-size: 0.74rem; color: var(--text-muted);
  background: rgba(255,255,255,0.02); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  line-height: 1.5; }
.fm-omfs-banner strong { color: var(--text); }
.fm-omfs-asof { font-style: italic; }

/* -- Per-row CPT, source badge, probability, warning -- */
.fm-cpt { display: inline-block; margin-left: 8px; padding: 1px 6px; font-size: 0.66rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace; background: rgba(139,92,246,0.18);
  color: #c4b5fd; border-radius: 4px; letter-spacing: 0.04em; }
.fm-source-badge { display: inline-block; padding: 2px 8px; font-size: 0.66rem; font-weight: 700;
  border-radius: 4px; letter-spacing: 0.05em; text-transform: uppercase; }
.fm-src-omfs    { background: rgba(34,197,94,0.18);  color: #4ade80; }
.fm-src-dmepos  { background: rgba(6,182,212,0.18);   color: #67e8f9; }
.fm-src-pharmacy{ background: rgba(217,119,6,0.18);   color: #fbbf24; }
.fm-src-est     { background: rgba(100,116,139,0.18); color: #94a3b8; }
.fm-warning-row td { background: rgba(245,158,11,0.06) !important; padding: 6px 14px !important;
  border-top: 0; border-bottom: 1px solid var(--border); }
.fm-warning { font-size: 0.74rem; color: #fbbf24; line-height: 1.4; padding: 2px 0; }

/* -- Document Generator -- */
.dg-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.dg-template-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.25s;
  background: #fff;
}
.dg-template-card:hover { border-color: #8b5cf6; background: #f5f3ff; box-shadow: 0 2px 12px rgba(139, 92, 246, 0.12); }
.dg-template-card.selected { border-color: #8b5cf6; background: #ede9fe; box-shadow: 0 2px 16px rgba(139, 92, 246, 0.18); }
.dg-template-name { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; color: #1e1b4b; }
.dg-template-desc { font-size: 0.74rem; color: #64748b; line-height: 1.4; }

.dg-letter-paper {
  background: #1a2035;
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  padding: 40px 50px;
  min-height: 500px;
  font-family: 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.6;
  margin: 16px 0;
  white-space: pre-wrap;
  max-width: 750px;
  color: var(--text);
}

.firm-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.firm-settings-grid .full-width { grid-column: 1 / -1; }

/* -- Issue Cards -- */
.issue-card {
  border-left: 4px solid var(--border);
  background: var(--surface2);
  border-radius: 4px;
  padding: 10px 12px;
  margin: 6px 0;
}
.issue-card.high { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.06); }
.issue-card.medium { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.06); }
.issue-card.low { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.06); }
.issue-title { font-weight: 600; font-size: 0.82rem; margin-bottom: 4px; color: var(--text); }
.issue-desc { font-size: 0.76rem; color: var(--text-muted); }
.issue-suggestion { font-size: 0.74rem; color: #10b981; font-style: italic; margin-top: 4px; }

/* -- Progress Bar -- */
.progress-wrap { margin: 8px 0; }
.progress-bar-outer { background: var(--surface2); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: var(--gradient); border-radius: 4px; transition: width 0.3s; box-shadow: 0 0 8px var(--glow-cyan); }
.progress-label-text { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; }

/* -- PD Rating 4-Layer Architecture -- */

/* -- Sticky top summary bar -- */
/* Pinned BELOW the tab nav (which is itself sticky at top:0, z-index:100).
   Using top: 60px keeps a visible gap from the tab nav; z-index stays below
   100 so if they ever overlap, the nav wins. */
/* The wrap exists so pdRecalculate can hot-swap the bar's innerHTML on input
   changes. But position:sticky is scoped to the wrap's height — and the wrap
   is exactly bar-height — so the bar never has scroll range to stick. Making
   the wrap display:contents removes it from layout: the sticky bar's effective
   containing block becomes #pd-results (the next real ancestor), giving sticky
   its full results-section scroll range. */
#pd-sticky-bar-wrap { display: contents; }

.pd-sticky-bar {
  position: sticky;
  top: 48px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin: 8px 0 16px;
  /* White card styling matching the Upload-tab window treatment. */
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.pd-sticky-applicant {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  padding-right: 14px;
  margin-right: 4px;
  border-right: 1px solid rgba(139, 92, 246, 0.25);
}
.pd-sticky-item {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.pd-sticky-label {
  font-size: 0.62rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.pd-sticky-val {
  font-size: 0.88rem;
  color: #111827;
  font-weight: 600;
  white-space: nowrap;
}
.pd-sticky-total {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  border-radius: 10px;
  box-shadow: 0 3px 14px rgba(139, 92, 246, 0.35);
}
.pd-sticky-total .pd-sticky-label { color: rgba(255, 255, 255, 0.85); }
.pd-sticky-total-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

/* -- Critical caveats banner (collapsed by default — click to expand for full caveats) -- */
.pd-top-caveats {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.10), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.30);
  border-left: 3px solid #f59e0b;
  border-radius: 10px;
  margin: 0 0 12px;
  overflow: hidden;
}
.pd-top-caveats > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 0.8rem;
}
.pd-top-caveats > summary::-webkit-details-marker { display: none; }
.pd-top-caveats > summary::after {
  content: '▸';
  margin-left: auto;
  color: #fbbf24;
  font-size: 0.78rem;
  transition: transform 0.15s ease;
}
.pd-top-caveats[open] > summary::after { transform: rotate(90deg); }
.pd-top-caveats-icon { font-size: 0.95rem; }
.pd-top-caveats-label {
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.74rem;
}
.pd-top-caveats-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}
.pd-top-caveats-body {
  padding: 0 18px 12px;
  border-top: 1px solid rgba(245, 158, 11, 0.18);
  padding-top: 10px;
}
.pd-top-caveats-body p {
  margin: 6px 0 0;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.55;
  opacity: 0.95;
}
.pd-top-caveats-body p:first-of-type { margin-top: 0; }
.pd-top-caveats-body strong { color: #fbbf24; }

/* -- Read-only field display inside the Case Overview card (Report Summary
   fields absorbed into Claimant card). -- */
.pd-ro-field {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 18px;
}

/* Divider separating the editable claimant grid from the read-only report grid. */
.pd-overview-divider {
  margin: 10px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(139, 92, 246, 0.25);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Badge on Body Parts card header when Kite grouping is active. */
.pd-bp-kite-active {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  margin-left: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Note + disabled state for the method selector when Kite hybrid is active. */
.pd-method-inactive {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-left: 3px solid #a78bfa;
  border-radius: 8px;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.5;
}
.pd-method-inactive strong { color: #a78bfa; }
.method-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* Final Rating wrapper card — visually unifies Combined PD hero + PDRS tables. */
.pd-final-rating { }
.pd-final-rating .pd-final-inner {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  box-shadow: none;
}
.pd-final-rating .pd-final-hero {
  margin-bottom: 10px;
}
.pd-final-details {
  margin-top: 14px;
  border-top: 1px dashed rgba(139, 92, 246, 0.2);
  padding-top: 12px;
}
.pd-final-details > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 6px 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pd-final-details > summary::-webkit-details-marker { display: none; }
.pd-final-details > summary::before {
  content: '▸';
  color: #8b5cf6;
  font-size: 0.78rem;
  transition: transform 0.15s ease;
}
.pd-final-details[open] > summary::before { transform: rotate(90deg); }
.pd-final-details > summary strong { color: var(--text); }
.pd-final-pdr { margin-top: 10px; }

/* -- Kite/Vigil grouping pills on each Body Part card -- */
.pd-kite-pills-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pd-kite-pills-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 2px;
}
.pd-kite-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 3px 10px;
  border: 1.5px solid rgba(139, 92, 246, 0.25);
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.pd-kite-pill:hover { border-color: rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.08); }
.pd-kite-pill.active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}
/* Distinct accent for each additive group letter (A–D) so the pills are
   visually scannable on the Body Part cards and the grouping section. */
.pd-kite-pill-A.active { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.pd-kite-pill-B.active { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.pd-kite-pill-C.active { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.pd-kite-pill-D.active { background: linear-gradient(135deg, #10b981, #34d399); }

/* -- Kite/Vigil grouping section (shown when any part is tagged A–D) -- */
.pd-kite-authority {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}
.pd-kite-authority em { color: #a78bfa; font-style: italic; font-weight: 500; }
.pd-kite-authority strong { color: var(--text); }

.pd-kite-group {
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface2);
}
.pd-kite-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.pd-kite-group-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 12px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pd-kite-group-parts {
  flex: 1;
  font-size: 0.86rem;
  color: var(--text);
  font-weight: 500;
}
/* Parts list moved below the head row when the nickname input is present —
   keeps the head compact and the nickname field wide enough to type in. */
.pd-kite-group-parts-line {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 2px 0 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
/* Optional group name input that replaces the parts list in the head row.
   Attorneys type something like "Spine + Lifting" and it flows into exports. */
.pd-kite-group-name {
  flex: 1;
  min-width: 180px;
  padding: 5px 10px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}
.pd-kite-group-name::placeholder { color: var(--text-muted); font-style: italic; font-weight: 400; }
.pd-kite-group-name:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.pd-kite-group-pd {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}
.pd-kite-group-math {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 6px 0;
}
.pd-kite-group-math strong { color: var(--text); }
.pd-kite-group-justify {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(139, 92, 246, 0.18);
}
.pd-kite-group-justify label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-weight: 600;
}
.pd-kite-group-justify input {
  width: 100%;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
}
.pd-kite-group-justify input::placeholder { color: var(--text-muted); font-style: italic; }

.pd-kite-cvc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 6px 0 10px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px dashed rgba(139, 92, 246, 0.2);
  flex-wrap: wrap;
}
.pd-kite-cvc-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pd-kite-cvc-item {
  font-size: 0.82rem;
  color: var(--text);
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.1);
}
.pd-kite-total {
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(6, 182, 212, 0.14));
  border: 1px solid rgba(139, 92, 246, 0.3);
  font-size: 0.95rem;
  color: var(--text);
}
.pd-kite-total strong {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  color: #a78bfa;
  margin-left: 4px;
}

/* Body Part card collapsed-summary badge showing which Kite group a part is
   tagged to. Lets attorneys scan groupings without expanding every card. */
.pd-bp-kite-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  margin-left: 4px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
}

/* Rating-string tag prefix ([A] / [CVC]) shown in the PDRS Calculations
   card title. Makes rating strings self-describing when copied out. */
.pd-pdr-kite-tag {
  display: inline-block;
  padding: 1px 8px;
  margin-right: 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  letter-spacing: 0.05em;
}
.pd-pdr-kite-a { background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(167, 139, 250, 0.25)); color: #c4b5fd; }
.pd-pdr-kite-b { background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(34, 211, 238, 0.25)); color: #67e8f9; }
.pd-pdr-kite-c { background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(251, 191, 36, 0.25)); color: #fcd34d; }
.pd-pdr-kite-d { background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(52, 211, 153, 0.25)); color: #6ee7b7; }
.pd-pdr-kite-cvc { background: rgba(139, 92, 246, 0.12); color: var(--text-muted); }

/* Warning shown inside a Kite group when same-region parts are bundled. */
.pd-kite-group-warn {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.76rem;
  color: #fbbf24;
  line-height: 1.45;
}

/* "How to use the grouping pills" onboarding help on the Body Parts card.
   Collapsed by default — click to expand. Always visible so first-time users
   see the control's purpose before clicking a letter. */
.pd-kite-help {
  margin: 4px 0 14px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 10px;
  overflow: hidden;
}
.pd-kite-help > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
}
.pd-kite-help > summary::-webkit-details-marker { display: none; }
.pd-kite-help > summary::after {
  content: '▸';
  margin-left: auto;
  color: #a78bfa;
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}
.pd-kite-help[open] > summary::after { transform: rotate(90deg); }
.pd-kite-help-icon { font-size: 1.05rem; }
.pd-kite-help-title { font-weight: 700; color: #a78bfa; }
.pd-kite-help-hint { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.pd-kite-help-body {
  padding: 0 18px 14px;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  padding-top: 12px;
}
.pd-kite-help-body p {
  margin: 0 0 10px;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.55;
}
.pd-kite-help-body em { color: #a78bfa; font-style: italic; }
.pd-kite-help-steps {
  margin: 8px 0 10px 20px;
  padding: 0;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.55;
}
.pd-kite-help-steps li { margin: 6px 0; }
.pd-kite-help-caution {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text);
}
.pd-kite-help-caution strong { color: #fbbf24; }
/* Subtle aside in the help body clarifying that letters have no legal
   meaning and pointing to the optional group-name field. */
.pd-kite-help-labelnote {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(6, 182, 212, 0.06);
  border-left: 3px solid #06b6d4;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.9;
}
.pd-kite-help-labelnote strong { color: #67e8f9; }
/* Inline pill previews used inside the help body so the text matches what
   users see on the actual Body Part cards. */
.pd-kite-chip-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 9px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  margin: 0 2px;
  color: #fff;
  vertical-align: middle;
}
.pd-kite-chip-demo.pd-kite-chip-cvc {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

/* Quick-reference collapsible inside the Kite/Vigil Grouping card. */
.pd-kite-howto {
  margin: 0 0 14px;
  background: rgba(139, 92, 246, 0.04);
  border: 1px dashed rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
}
.pd-kite-howto > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 4px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pd-kite-howto > summary::-webkit-details-marker { display: none; }
.pd-kite-howto > summary::before {
  content: '▸';
  color: #8b5cf6;
  font-size: 0.72rem;
  transition: transform 0.15s ease;
}
.pd-kite-howto[open] > summary::before { transform: rotate(90deg); }
.pd-kite-howto > summary strong { color: var(--text); }
.pd-kite-howto-list {
  margin: 8px 0 6px 22px;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.55;
}
.pd-kite-howto-list li { margin: 4px 0; }
.pd-kite-howto-list strong { color: #a78bfa; }

/* Red-flag shown when a group's justification basis is empty. */
.pd-kite-justify-missing {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #f87171;
  border-radius: 4px;
  font-size: 0.74rem;
  color: #fca5a5;
  line-height: 1.45;
}

/* -- Functional Findings collapsible card + per-list disclosures -- */
.pd-ff-section > summary,
.pd-ff-sublist > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.pd-ff-section > summary::-webkit-details-marker,
.pd-ff-sublist > summary::-webkit-details-marker { display: none; }
.pd-ff-section > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
  padding: 2px 0;
}
.pd-ff-section > summary::before {
  content: '▸';
  color: #8b5cf6;
  font-size: 0.78rem;
  transition: transform 0.15s ease;
  margin-right: -2px;
}
.pd-ff-section[open] > summary::before { transform: rotate(90deg); }
.pd-ff-total {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 2px 10px;
  border-radius: 10px;
}
.pd-ff-sublist {
  margin: 6px 0 0;
  border-top: 1px solid rgba(139, 92, 246, 0.12);
  padding-top: 6px;
}
.pd-ff-sublist > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.78rem;
  color: #8b5cf6;
  font-weight: 500;
}
.pd-ff-sublist > summary::before {
  content: '▸';
  font-size: 0.68rem;
  transition: transform 0.15s ease;
}
.pd-ff-sublist[open] > summary::before { transform: rotate(90deg); }
.pd-ff-sub-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.pd-ff-sublist[open] > summary .pd-ff-sub-label { color: #a78bfa; }
.pd-ff-sub-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 1px 8px;
  border-radius: 10px;
}
.pd-ff-sublist > ul {
  margin: 6px 0 8px 22px;
  padding: 0;
  font-size: 0.84rem;
  color: var(--text);
  list-style: disc;
}
.pd-ff-sublist > ul > li { margin-bottom: 3px; line-height: 1.45; }

/* Mode & Status Banners */
.pd-mode-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 12px;
  font-weight: 600; font-size: 0.9rem;
}
.pd-mode-explicit  { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border: 1.5px solid rgba(59, 130, 246, 0.3); }
.pd-mode-inferred  { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1.5px solid rgba(245, 158, 11, 0.3); }
.pd-mode-mixed     { background: rgba(139, 92, 246, 0.1); color: #a78bfa; border: 1.5px solid rgba(139, 92, 246, 0.3); }
.pd-mode-insufficient { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1.5px solid rgba(239, 68, 68, 0.3); }

.pd-ratable-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 10px; margin-bottom: 16px;
  font-size: 0.85rem; font-weight: 500;
}
.pd-ratable-yes  { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1.5px solid rgba(16, 185, 129, 0.3); }
.pd-ratable-warn { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1.5px solid rgba(245, 158, 11, 0.3); }
.pd-ratable-no   { background: rgba(239, 68, 68, 0.1); color: #f87171; border: 1.5px solid rgba(239, 68, 68, 0.3); }
.pd-rs-icon { font-size: 1.1rem; }

/* Body Part Sections */
.pd-bp-section {
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 10px; overflow: hidden;
}
.pd-bp-summary {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 8px 14px; cursor: pointer; background: var(--surface2);
  transition: all 0.2s; flex-wrap: wrap;
}
.pd-bp-summary:hover { background: rgba(139, 92, 246, 0.06); }
.pd-bp-name { font-weight: 600; font-size: 0.88rem; color: var(--text); flex-shrink: 0; }
.pd-bp-quickinfo { display: inline-flex; gap: 4px; align-items: center; flex-shrink: 0; }
.pd-bp-qi {
  font-size: 0.68rem; padding: 1px 6px; border-radius: 4px;
  background: rgba(99,102,241,0.12); color: #4f46e5; font-weight: 600;
  white-space: nowrap;
}
.pd-wpi-summary-chips {
  font-size: 0.75rem; color: var(--text-muted); font-weight: 400;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-left: 8px;
}
.pd-wpi-details > summary::-webkit-details-marker { display: none; }
.pd-wpi-details > summary { list-style: none; }
.pd-bp-body {
  padding: 12px 16px; border-top: 1px solid var(--border);
  font-size: 0.82rem; line-height: 1.6; color: var(--text);
}
.pd-bp-findings { color: var(--text-muted); margin-top: 4px; }

/* Source Badges */
.pd-source-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
}
.pd-source-explicit { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.pd-source-inferred { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* Confidence Pills */
.pd-conf-pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
}
.pd-conf-high   { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.pd-conf-medium { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.pd-conf-low    { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* WPI Analysis */
.pd-wpi-list { list-style: none; margin: 0; padding: 0; }
.pd-wpi-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.pd-wpi-row:last-child { border-bottom: none; }
.pd-wpi-name { font-weight: 600; min-width: 160px; font-size: 0.88rem; color: var(--text); }
.pd-wpi-detail { flex: 1; font-size: 0.82rem; color: var(--text-muted); }
.pd-wpi-value { font-weight: 700; font-size: 0.95rem; min-width: 60px; text-align: right; color: var(--text); }
.pd-inferred-val { color: #fbbf24; font-style: italic; }
.pd-inferred-note { font-size: 0.75rem; color: #fbbf24; font-style: italic; margin-top: 2px; }
.pd-conv-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.pd-apport-note { font-size: 0.75rem; color: #a78bfa; margin-top: 2px; }
.pd-dup-warn {
  font-size: 0.75rem; color: #f87171; background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25); border-radius: 6px;
  padding: 4px 8px; margin-top: 4px; display: inline-block;
}

/* WPI Override Inputs */
.pd-override-wrap { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.pd-override-wrap input {
  width: 70px; padding: 4px 8px; font-size: 0.82rem;
  border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text);
}
.pd-override-wrap button {
  padding: 4px 10px; font-size: 0.78rem; font-weight: 600;
  background: var(--gradient); color: white;
  border: none; border-radius: 6px; cursor: pointer;
  box-shadow: 0 0 8px var(--glow-purple);
}

/* PDR Adjustment Steps */
.pd-pdr-block { margin-bottom: 14px; }
.pd-pdr-title { font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }
.pd-step-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.pd-step-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.pd-step-table td:first-child { color: var(--text-muted); width: 160px; }
.pd-step-table td:last-child { font-weight: 600; text-align: right; }
.pd-step-warn { color: #fbbf24; font-style: italic; }
.pd-step-warnings { font-size: 0.76rem; color: #fbbf24; margin-top: 6px; }

/* Evidence Cards */
.pd-evidence-card {
  border-left: 4px solid rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.06);
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin-bottom: 8px;
}
.pd-quote {
  font-style: italic; color: #ffffff; font-size: 0.83rem;
  line-height: 1.6; margin-bottom: 4px;
}

/* Warning Items */
.pd-warning-item {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 4px 8px; background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15); border-radius: 6px; margin-bottom: 3px;
  font-size: 0.58rem; color: #fbbf24; line-height: 1.3;
}

/* Field Grid for Claimant / Report Cards */
.pd-field-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 16px; margin-top: 8px;
}
.pd-fld { display: flex; flex-direction: column; gap: 3px; }
.pd-fld-label { font-size: 0.73rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pd-fld-val { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.pd-fld-val input {
  width: 100%; padding: 5px 8px; font-size: 0.85rem;
  border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit;
  background: var(--surface); color: var(--text);
}
.pd-edit-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ── SJDB voucher inline bar — matches sticky-bar styling ─────── */
.pd-voucher-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 8px 0 14px; padding: 8px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.85rem;
}
.pd-voucher-pill {
  font-weight: 700; padding: 3px 12px; border-radius: 99px;
  white-space: nowrap; font-size: 0.78rem; letter-spacing: 0.02em;
}
.pd-voucher-yes     .pd-voucher-pill { background: rgba(34,197,94,0.16);  color: #15803d; }
.pd-voucher-no      .pd-voucher-pill { background: rgba(220,38,38,0.16);  color: #b91c1c; }
.pd-voucher-unknown .pd-voucher-pill { background: rgba(100,116,139,0.16); color: #475569; }
.pd-voucher-cite {
  font-size: 0.78rem; color: #475569; font-style: italic;
  flex: 1 1 auto; min-width: 0; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis;
}

/* ── Compensation card ─────────────────────────── */
.pd-money-card .pd-money-hero {
  text-align: center; padding: 12px 16px;
  background: linear-gradient(135deg, rgba(34,197,94,0.10) 0%, rgba(6,182,212,0.06) 100%);
  border: 1px solid rgba(34,197,94,0.35); border-radius: 12px;
}
.pd-money-card .pd-money-hero-ptd {
  background: linear-gradient(135deg, rgba(245,158,11,0.12) 0%, rgba(217,119,6,0.08) 100%);
  border-color: rgba(245,158,11,0.45);
}
.pd-money-total-label { font-size: 0.78rem; letter-spacing: 0.10em; color: var(--text-muted); font-weight: 600; }
.pd-money-total-val { font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin-top: 4px;
  background: linear-gradient(135deg, #22c55e, #06b6d4); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text; }
.pd-money-hero-ptd .pd-money-total-val { font-size: 1.6rem;
  background: linear-gradient(135deg, #f59e0b, #fbbf24); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text; }
.pd-money-total-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; }
.pd-money-math { margin-top: 14px; padding: 10px 14px; background: var(--surface2);
  border-left: 3px solid #22c55e; border-radius: 6px; }
.pd-money-math-label { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--text-muted);
  text-transform: uppercase; font-weight: 600; }
.pd-money-math-val { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 0.92rem;
  color: var(--text); margin-top: 3px; }
.pd-money-grid { margin-top: 12px; display: grid; gap: 6px; }
.pd-money-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 8px;
  border-radius: 6px; }
.pd-money-row:nth-child(odd) { background: rgba(255,255,255,0.02); }
.pd-money-label { color: var(--text-muted); font-size: 0.85rem; }
.pd-money-val { color: var(--text); font-size: 0.9rem; font-weight: 500; }
.pd-money-mono { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 0.82rem; }
.pd-money-strong { font-weight: 700; color: #22c55e; }
.pd-money-section { margin-top: 18px; padding: 14px; border: 1px dashed var(--border);
  border-radius: 8px; }
.pd-money-section-title { font-weight: 700; color: var(--text); font-size: 0.95rem; margin-bottom: 8px; }
.pd-money-section-sub { font-weight: 400; font-size: 0.78rem; color: var(--text-muted); }
.pd-money-aww-note { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; font-style: italic; }
.pd-money-disclaimer { font-size: 0.7rem; color: var(--text-muted); margin-top: 14px;
  border-top: 1px solid var(--border); padding-top: 8px; line-height: 1.4; }

/* ── Future Medical recommendations (extracted from report) ──── */
.pd-fmrec-card .pd-fmrec-intro { margin: 0 0 10px; font-size: 0.82rem; color: #64748b; line-height: 1.5; }
.pd-fmrec-group { margin-bottom: 10px; padding: 8px 10px; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #f8fafc; }
.pd-fmrec-group-title { font-weight: 700; color: #374151; font-size: 0.8rem; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px; }
.pd-fmrec-group-count { font-size: 0.68rem; padding: 1px 7px; border-radius: 99px;
  background: #ede9fe; color: #6d28d9; font-weight: 700; letter-spacing: 0; }
.pd-fmrec-item { padding: 6px 10px; border-radius: 6px; background: #fff;
  border: 1px solid #e5e7eb; border-left: 3px solid #d1d5db; margin-top: 4px; }
.pd-fmrec-item:first-child { margin-top: 0; }
.pd-fmrec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pd-fmrec-icon { font-size: 0.95rem; }
.pd-fmrec-name { font-weight: 600; color: #111827; font-size: 0.88rem; flex: 1 1 auto; }
.pd-fmrec-cat { font-size: 0.66rem; padding: 1px 7px; border-radius: 99px;
  background: #f1f5f9; color: #475569; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600; border: 1px solid #e2e8f0; }
.pd-fmrec-prob { font-size: 0.68rem; padding: 2px 8px; border-radius: 99px; font-weight: 700;
  white-space: nowrap; }
.pd-fmrec-prob-required    { background: #fee2e2; color: #dc2626; }
.pd-fmrec-prob-recommended { background: #ffedd5; color: #c2410c; }
.pd-fmrec-prob-likely      { background: #fef3c7; color: #b45309; }
.pd-fmrec-prob-possible    { background: #ede9fe; color: #6d28d9; }
.pd-fmrec-prob-maybe       { background: #f1f5f9; color: #475569; }
.pd-fmrec-prob-unknown     { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }
.pd-fmrec-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px;
  font-size: 0.75rem; color: #64748b; }
.pd-fmrec-meta-item { display: inline-flex; gap: 3px; align-items: baseline; }
.pd-fmrec-meta-label { text-transform: uppercase; font-size: 0.62rem; letter-spacing: 0.06em;
  color: #94a3b8; font-weight: 600; }
.pd-fmrec-meta-val { color: #374151; font-weight: 500; font-size: 0.75rem; }
.pd-fmrec-quote { margin-top: 6px; font-size: 0.78rem; }
.pd-fmrec-quote summary { cursor: pointer; color: #64748b; font-weight: 600;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.pd-fmrec-quote summary:hover { color: #374151; }
.pd-fmrec-quote blockquote { margin: 5px 0 0; padding: 6px 10px; border-left: 2px solid #d1d5db;
  background: #f8fafc; border-radius: 0 6px 6px 0; font-style: italic;
  color: #374151; font-size: 0.8rem; line-height: 1.5; }
.pd-fmrec-math { margin-top: 3px; padding: 3px 8px; background: #f0f0ff;
  border-left: 2px solid #818cf8; border-radius: 0 4px 4px 0;
  font-size: 0.71rem; color: #4338ca; font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.01em; line-height: 1.4; }
.pd-fmrec-cite { margin-top: 5px; }
.pd-fmrec-cite summary { cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; border: 1px solid #d1d5db;
  background: #f8fafc; color: #64748b; font-size: 0.69rem;
  font-weight: 600; letter-spacing: 0.04em; list-style: none;
  transition: background 0.15s, color 0.15s; }
.pd-fmrec-cite summary::-webkit-details-marker { display: none; }
.pd-fmrec-cite summary:hover { background: #e2e8f0; color: #374151; }
.pd-fmrec-cite[open] summary { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }
.pd-fmrec-cite-quote { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid #3b82f6;
  background: #eff6ff; border-radius: 0 6px 6px 0; font-style: italic;
  color: #1e3a5f; font-size: 0.8rem; line-height: 1.5; }

/* Future Medical recs — toolbar (mode toggle + totals) */
.pd-fmrec-toolbar {
  padding: 8px 12px; margin-bottom: 10px;
  background: #f8fafc; border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.pd-fmrec-toolbar-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pd-fmrec-totals-row  { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 8px; padding-top: 7px; border-top: 1px solid #e5e7eb; }
.pd-fmrec-cat-breakdown { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-fmrec-cat-chip { font-size: 0.73rem; padding: 2px 9px; border-radius: 20px;
  background: #f1f5f9; border: 1px solid #e2e8f0; color: #374151; }
.pd-fmrec-cat-chip strong { color: #1d4ed8; }
.pd-fmrec-opts { display: inline-flex; align-items: center; gap: 12px; }
.pd-fmrec-check { display: inline-flex; align-items: center; gap: 5px; font-size: 0.73rem;
  color: #374151; cursor: pointer; user-select: none; }
.pd-fmrec-check input { cursor: pointer; }
.pd-fmrec-gotofm-btn { margin-left: auto; padding: 4px 12px; font-size: 0.73rem; font-weight: 600;
  color: #4f46e5; background: #ede9fe; border: 1px solid #c4b5fd; border-radius: 6px;
  cursor: pointer; white-space: nowrap; font-family: inherit; }
.pd-fmrec-gotofm-btn:hover { background: #ddd6fe; }
.pd-fmrec-warns { margin-top: 5px; display: flex; flex-direction: column; gap: 3px; }
.pd-fmrec-warn { font-size: 0.72rem; color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 4px; padding: 3px 8px; line-height: 1.5; }
.pd-fmrec-modes { display: inline-flex; align-items: center; gap: 8px; }
.pd-fmrec-toolbar-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: #94a3b8; font-weight: 600; }
.pd-fmrec-mode-btn { padding: 3px 10px; font-size: 0.73rem; font-weight: 600; border-radius: 6px;
  border: 1px solid #d1d5db; background: #fff; color: #64748b;
  cursor: pointer; transition: all 0.15s; }
.pd-fmrec-mode-btn:hover { color: #374151; border-color: #a78bfa; }
.pd-fmrec-mode-btn.active { background: var(--gradient); color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(139,92,246,0.3); }
.pd-fmrec-totals { display: inline-flex; align-items: baseline; gap: 10px; }
.pd-fmrec-total-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: #94a3b8; font-weight: 600; }
.pd-fmrec-total-vals { font-size: 0.92rem; font-weight: 700; color: #111827; }

/* Future Medical recs — per-row CPT, source badge, cost row */
.pd-fmrec-cpt { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 0.64rem;
  padding: 1px 5px; background: #ede9fe; color: #6d28d9; border-radius: 4px;
  letter-spacing: 0.04em; }
.pd-fmrec-src { font-size: 0.6rem; padding: 1px 6px; font-weight: 700; border-radius: 4px;
  letter-spacing: 0.05em; text-transform: uppercase; }
.pd-fmrec-src-omfs     { background: #dcfce7; color: #16a34a; }
.pd-fmrec-src-dmepos   { background: #cffafe; color: #0891b2; }
.pd-fmrec-src-pharmacy { background: #fef3c7; color: #b45309; }
.pd-fmrec-src-est      { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.pd-fmrec-cost-row { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-top: 4px; padding: 4px 8px; background: #f0fdf4;
  border-left: 3px solid #22c55e; border-radius: 0 5px 5px 0; font-size: 0.79rem; }
.pd-fmrec-cost-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: #6b7280; font-weight: 600; }
.pd-fmrec-cost-vals  { font-weight: 600; }
.pd-fmrec-cost-low   { color: #16a34a; }
.pd-fmrec-cost-mid   { color: #d97706; font-weight: 700; }
.pd-fmrec-cost-high  { color: #dc2626; }
.pd-fmrec-cost-sep   { color: #9ca3af; margin: 0 3px; }
.pd-recalibrate-btn {
  margin-left: auto; padding: 8px 18px; font-size: 0.82rem; font-weight: 600;
  color: #fff; background: var(--gradient); border: none; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 12px var(--glow-purple); transition: transform 0.15s, box-shadow 0.25s;
  font-family: inherit; white-space: nowrap;
}
.pd-recalibrate-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--glow-purple), 0 0 30px var(--glow-cyan); }
.pd-recalibrate-btn:active { transform: translateY(0); }
.pd-recalibrate-flash { animation: pd-recalibrate-pulse 0.6s ease; }
@keyframes pd-recalibrate-pulse {
  0%   { box-shadow: 0 2px 12px var(--glow-purple); }
  50%  { box-shadow: 0 0 0 8px rgba(6,182,212,0.35), 0 4px 24px var(--glow-cyan); }
  100% { box-shadow: 0 2px 12px var(--glow-purple); }
}

/* Combined Result */
.pd-combined-result {
  text-align: center; padding: 24px 16px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(6, 182, 212, 0.06) 100%);
  border-radius: 12px; margin-top: 8px;
  border: 1px solid var(--border);
}
.pd-combined-pct { font-size: 3rem; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1; }
.pd-combined-range { font-size: 1.2rem; color: #fbbf24; font-weight: 600; margin-top: 4px; }
.pd-combined-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }
.pd-combined-method-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.pd-combined-method-btns button {
  padding: 6px 16px; font-size: 0.8rem; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--surface); cursor: pointer; transition: all 0.2s; color: var(--text);
}
.pd-combined-method-btns button.active {
  background: var(--gradient); color: white; border-color: transparent;
  box-shadow: 0 0 12px var(--glow-purple);
}

/* Card header with action button */
.pd-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.pd-card-header .card-title { margin-bottom: 0; }

/* Collapsible toggle */
.pd-toggle-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.85rem; color: var(--text-muted); padding: 2px 6px;
  transition: transform 0.2s;
}
.pd-toggle-btn.open { transform: rotate(90deg); }

/* Action row at bottom of results */
.pd-action-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.pd-action-row button {
  padding: 8px 18px; font-size: 0.83rem; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; transition: all 0.2s; color: var(--text);
}
.pd-action-row button:hover { background: rgba(139, 92, 246, 0.08); border-color: #8b5cf6; }

/* -- Pre-upload Inputs -- */
.pd-input-label {
  display: block; font-size: 0.76rem; font-weight: 600;
  color: var(--text); text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 5px;
}
.pd-pre-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
@media (max-width: 600px) { .pd-pre-row { grid-template-columns: 1fr 1fr; } }
.pd-pre-field { display: flex; flex-direction: column; }
.pd-pre-input {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.88rem; font-family: inherit;
  background: var(--surface); transition: all 0.25s;
  box-sizing: border-box; color: var(--text);
}
.pd-pre-input:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 15px var(--glow-purple); }

/* -- Occupation Dropdown -- */
.pd-occ-wrap { position: relative; }
.pd-occ-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 0.9rem; font-family: inherit; background: var(--surface);
  transition: all 0.25s; box-sizing: border-box; color: var(--text);
}
.pd-occ-input:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 15px var(--glow-purple); }
.pd-occ-selected {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; background: rgba(139, 92, 246, 0.12); border: 1.5px solid rgba(139, 92, 246, 0.35);
  border-radius: 9px; font-size: 0.88rem; font-weight: 600; color: #a78bfa;
  margin-bottom: 4px;
}
.pd-occ-clear-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--text-muted); padding: 0 4px; line-height: 1;
}
.pd-occ-clear-btn:hover { color: var(--danger); }
.pd-occ-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4); z-index: 200;
  max-height: 320px; overflow-y: auto;
}
.pd-occ-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.15s; color: var(--text);
}
.pd-occ-item:last-child { border-bottom: none; }
.pd-occ-item:hover, .pd-occ-item:focus { background: rgba(139, 92, 246, 0.08); }
.pd-occ-item-main { display: flex; justify-content: space-between; align-items: baseline; }
.pd-occ-title { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.pd-occ-grp { font-size: 0.74rem; font-weight: 600; color: #8b5cf6; white-space: nowrap; margin-left: 8px; }
.pd-occ-aliases { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.pd-occ-empty { padding: 12px 14px; color: var(--text-muted); font-size: 0.85rem; font-style: italic; }

/* -- Body Part Badges & Actions -- */
.pd-source-manual   { background: rgba(16, 185, 129, 0.15); color: #10b981; border-radius: 4px; padding: 2px 7px; font-size: 0.72rem; font-weight: 700; }
.pd-source-override { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-radius: 4px; padding: 2px 7px; font-size: 0.72rem; font-weight: 700; }
.pd-bp-badges { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.pd-bp-actions {
  display: flex; gap: 4px; margin-left: auto;
  opacity: 0.4; transition: opacity 0.2s;
}
.pd-bp-summary:hover .pd-bp-actions { opacity: 1; }
.pd-bp-edit-btn, .pd-bp-del-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 8px; cursor: pointer; font-size: 0.82rem; line-height: 1.4;
  transition: all 0.2s; color: var(--text-muted);
}
.pd-bp-edit-btn:hover { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.3); }
.pd-bp-del-btn:hover  { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); }
.pd-bp-empty {
  text-align: center; padding: 24px 0 16px;
  color: var(--text-muted); font-size: 0.88rem;
}
.pd-bp-empty .pd-bp-empty-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.pd-add-bp-btn {
  margin-left: auto; background: var(--gradient); color: white;
  border: none; border-radius: 8px; padding: 6px 14px;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 0 10px var(--glow-purple);
}
.pd-add-bp-btn:hover { box-shadow: 0 0 20px var(--glow-purple); transform: translateY(-1px); }

/* -- Body Part Form -- */
.pd-bp-form {
  border: 1.5px solid rgba(139, 92, 246, 0.4) !important;
  background: rgba(139, 92, 246, 0.04) !important;
}
.pd-bpf-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 600px) { .pd-bpf-grid { grid-template-columns: 1fr; } }
.pd-bpf-field { display: flex; flex-direction: column; gap: 4px; }
.pd-bpf-field label { font-size: 0.76rem; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: 0.04em; }
.pd-bpf-field input, .pd-bpf-field select {
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-size: 0.88rem; font-family: inherit; background: var(--surface);
  transition: all 0.25s; color: var(--text);
}
.pd-bpf-field input:focus, .pd-bpf-field select:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 12px var(--glow-purple); }
.pd-bpf-wide { grid-column: 1 / -1; }
.pd-bpf-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   RECORDS CHAT -- modernized layout
   ============================================================ */
#panel-records main { padding-top: 20px; padding-bottom: 20px; }

/* -- Records layout -- */
.rc-layout {
  display: flex;
  justify-content: center;
  padding: 12px 30px;
  height: calc(100vh - 120px);
  min-height: 400px;
}

/* Records hero — matches Case Upload hero panel */
.rc-hero {
  flex: 0 1 auto;
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  background: rgba(245, 243, 250, 0.92);
  border: 3px solid rgba(139, 92, 246, 0.6);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  /* glow removed */
}

/* Upload box as empty state — centered in messages area */
.rc-upload-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 14px;
  padding: 20px 20px;
}
.rc-hero-title {
  padding: 18px 24px 0;
  flex-shrink: 0;
}

/* Records upload box — same as Case Upload, just slightly smaller */
.rc-drop-hero {
  width: 240px;
  height: 240px;
}

/* -- Dropzone styles removed — now uses .drop-zone-hero from upload tab -- */

/* ════════════════════════════════════════════════════════════
   SCAN DOCUMENT UPLOAD TAB — compact white-row design
   ════════════════════════════════════════════════════════════ */
/* Let the brand panel grow with content — fixes bullet clipping (Scan tab only) */
#panel-scan .upload-brand-panel { height: auto; min-height: 370px; overflow: visible; }
/* Stack dropzone + processing status vertically (instead of side-by-side flex row) */
#panel-scan .upload-hero-right { flex-direction: column; align-items: center; }
#panel-scan #scan-processing-status { width: 300px; }

.scan-table-card {
  background: #fff;
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.scan-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; table-layout: fixed; }
.scan-table thead th {
  background: #f3f1f9;
  color: #4c1d95;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(139,92,246,0.2);
  font-weight: 700;
}
.scan-table tbody tr {
  background: #fff;
  border-bottom: 1px solid #eef0f6;
  transition: background 0.12s;
}
.scan-table tbody tr:hover { background: #faf9ff; }
.scan-table tbody td { padding: 6px 10px; vertical-align: middle; color: #1e1b4b; }
.scan-row-high { border-left: 3px solid #10b981; }
.scan-row-med  { border-left: 3px solid #8b5cf6; }
.scan-row-low  { border-left: 3px solid #f59e0b; background: #fffbeb; }
.scan-row-pending { border-left: 3px solid #cbd5e1; }
.scan-row-done { opacity: 0.55; }

.scan-input {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 4px 6px;
  color: #1e1b4b;
  font-size: 0.8rem;
  font-family: inherit;
  width: 100%;
  height: 28px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scan-input:focus { outline: none; border-color: #8b5cf6; box-shadow: 0 0 0 2px rgba(139,92,246,0.2); }
.scan-input.scan-filename { font-weight: 500; }
select.scan-input { cursor: pointer; }
/* Force native dropdowns to show full text on open */
select.scan-input option { font-size: 0.85rem; padding: 4px; }

.scan-conf-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.scan-conf-high    { background: #d1fae5; color: #047857; }
.scan-conf-med     { background: #ede9fe; color: #5b21b6; }
.scan-conf-low     { background: #fef3c7; color: #92400e; }
.scan-conf-pending { background: #f1f5f9; color: #64748b; }

.scan-status-cell { font-size: 0.76rem; white-space: nowrap; }
.scan-status-classifying  { color: #7c3aed; }
.scan-status-transferring { color: #0891b2; }
.scan-status-done         { color: #047857; font-weight: 600; }
.scan-status-error        { color: #b91c1c; cursor: help; }
.scan-status-warn         { color: #b45309; }
.scan-status-ready        { color: #64748b; }

.scan-actions-cell { white-space: nowrap; text-align: right; }
.scan-btn-mini {
  background: #f3f1f9;
  border: 1px solid #d1c7e8;
  color: #4c1d95;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.72rem;
  cursor: pointer;
  margin-left: 3px;
  transition: all 0.12s;
}
.scan-btn-mini:hover:not(:disabled) { background: #ede9fe; border-color: #8b5cf6; }
.scan-btn-mini:disabled { opacity: 0.35; cursor: not-allowed; }
.scan-btn-mini.scan-transfer {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.scan-btn-mini.scan-transfer:hover:not(:disabled) { box-shadow: 0 0 8px rgba(139,92,246,0.5); }


/* -- File chips -- */
.rc-file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.rc-file-chips:empty { display: none; }
.rc-file-chips .file-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 10px;
  padding: 5px 12px 5px 10px;
  font-size: 0.72rem;
  color: #1e1b4b;
  transition: all 0.2s;
}
.rc-file-chips .file-item:hover { background: rgba(139, 92, 246, 0.08); border-color: rgba(139, 92, 246, 0.35); }
.rc-file-chips .fi-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rc-file-chips .fi-size { color: var(--text-muted); font-size: 0.65rem; }
.rc-file-chips .fi-remove {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 0.78rem; padding: 0 0 0 2px; line-height: 1;
  transition: color 0.2s;
}
.rc-file-chips .fi-remove:hover { color: var(--danger); }

/* -- Chat box container (now inside rc-hero) -- */

/* -- Empty state -- */
.rc-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; gap: 8px; padding: 24px 20px;
}
.rc-empty-icon {
  color: rgba(139, 92, 246, 0.5);
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(139, 92, 246, 0.08);
  border-radius: 50%;
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 8px;
}
.rc-empty-title { font-size: 0.88rem; font-weight: 600; color: #1e1b4b; letter-spacing: 0.3px; }
.rc-empty-sub { font-size: 0.7rem; color: #64748b; text-align: center; max-width: 280px; line-height: 1.5; }

/* -- Message thread -- */
.rc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  background: transparent;
  min-height: 0;
}
.rc-messages::-webkit-scrollbar { width: 4px; }
.rc-messages::-webkit-scrollbar-track { background: transparent; }
.rc-messages::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.25); border-radius: 4px; }
.rc-messages::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.45); }

/* -- Chat bubbles -- */
.cmsg { display: flex; flex-direction: column; max-width: 85%; animation: cmsg-in 0.3s ease-out; }
.cmsg.user { align-self: flex-end; }
.cmsg.assistant { align-self: flex-start; max-width: 94%; }

.cmsg-bubble {
  border-radius: 18px;
  padding: 11px 16px;
  font-size: 0.84rem;
  line-height: 1.65;
}
.cmsg.user .cmsg-bubble {
  background: var(--gradient);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 3px 15px var(--glow-purple);
}
.cmsg.assistant .cmsg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}
.cmsg-text { white-space: pre-wrap; word-break: break-word; }
.cmsg-text strong { color: #a78bfa; font-weight: 600; }
.cmsg-text em { color: var(--text-muted); font-style: italic; }
.cmsg-time {
  font-size: 0.6rem; color: var(--text-muted); margin-top: 3px; padding: 0 6px;
  opacity: 0; transition: opacity 0.2s;
}
.cmsg:hover .cmsg-time { opacity: 1; }
.cmsg.user .cmsg-time { text-align: right; }

.cite-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cite-chip {
  font-size: 0.64rem; padding: 2px 9px;
  background: rgba(139, 92, 246, 0.08); border: 1px solid rgba(139, 92, 246, 0.2); border-radius: 12px;
  color: #8b5cf6; white-space: nowrap;
}
.cite-badge {
  background: rgba(139, 92, 246, 0.1); padding: 1px 6px; border-radius: 4px;
  font-size: 0.76rem; color: #8b5cf6; font-weight: 500;
}

/* Thinking animation */
.thinking-msg .cmsg-bubble {
  background: var(--surface2); border: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}
.thinking-dots { display: inline-flex; gap: 5px; }
.thinking-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: rgba(139, 92, 246, 0.5);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-pulse { 0%,80%,100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1.15); } }
@keyframes cmsg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Glow pulse animation */
@keyframes glow-pulse {
  0%, 100% { opacity: 0.5; transform: rotate(0deg); }
  50% { opacity: 1; transform: rotate(180deg); }
}

/* -- Chat note styling -- */
.rc-note {
  display: block;
  font-size: 0.72rem;
  color: #fbbf24;
  opacity: 0.85;
  margin-top: 8px;
  line-height: 1.5;
}

/* -- Cite chip bar (collapsed by default to save vertical space) -- */
.cite-bar-details { margin-top: 5px; }
.cite-bar-details summary {
  cursor: pointer;
  font-size: 0.66rem;
  color: #8b5cf6;
  font-weight: 500;
  list-style: none;
  padding: 2px 0;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.85;
}
.cite-bar-details summary::-webkit-details-marker { display: none; }
.cite-bar-details summary::before {
  content: '▸';
  font-size: 0.64rem;
  transition: transform 0.15s ease;
}
.cite-bar-details[open] summary::before { transform: rotate(90deg); }
.cite-bar-details summary:hover { opacity: 1; }
.cite-bar-details .cite-bar { margin-top: 5px; }

/* -- Chat details disclosure (reasoning / page refs, hidden by default) -- */
.cmsg-details {
  margin-top: 10px;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  padding-top: 6px;
}
.cmsg-details summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 500;
  color: #8b5cf6;
  list-style: none;
  padding: 4px 0;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cmsg-details summary::-webkit-details-marker { display: none; }
.cmsg-details summary::before {
  content: '▸';
  font-size: 0.68rem;
  transition: transform 0.15s ease;
}
.cmsg-details[open] summary::before { transform: rotate(90deg); }
.cmsg-details summary:hover { color: #a78bfa; }
.cmsg-details-body {
  margin-top: 8px;
  padding-left: 2px;
  font-size: 0.82rem;
  color: var(--text);
  opacity: 0.9;
}

/* -- Preset chips -- */
.rc-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 14px;
  border-top: 1px solid rgba(139, 92, 246, 0.1);
  flex-shrink: 0;
}
.rc-presets:empty { padding: 0; border: none; }
.rc-presets .preset-pill {
  padding: 5px 12px;
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  font-size: 0.66rem;
  color: #8b5cf6;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}
.rc-presets .preset-pill:hover {
  background: #8b5cf6; color: #fff; border-color: #8b5cf6;
  box-shadow: 0 3px 15px var(--glow-purple);
  transform: translateY(-1px);
}

/* -- Input bar -- */
.rc-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  flex-shrink: 0;
  background: transparent;
  border-top: 1px solid rgba(139, 92, 246, 0.12);
}
.rc-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 22px;
  font-size: 0.8rem;
  color: #1e1b4b;
  background: rgba(255, 255, 255, 0.7);
  outline: none;
  transition: all 0.25s;
  font-family: inherit;
}
.rc-input::placeholder { color: var(--text-muted); }
.rc-input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.04);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1), 0 0 15px var(--glow-purple);
}
.rc-input:disabled { opacity: 0.4; cursor: not-allowed; background: var(--surface2); }
.rc-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gradient);
  border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 3px 15px var(--glow-purple);
}
.rc-send-btn:hover:not(:disabled) { transform: scale(1.08); box-shadow: 0 4px 20px var(--glow-purple), 0 0 30px var(--glow-cyan); }
.rc-send-btn:active:not(:disabled) { transform: scale(0.95); }
.rc-send-btn:disabled { background: var(--surface2); box-shadow: none; cursor: default; color: var(--text-muted); }

/* CaseStore notice chip */
#rec-chat-cs-notice {
  margin: 8px 16px 0;
  padding: 7px 14px !important;
  background: rgba(139, 92, 246, 0.06) !important;
  border: 1px solid rgba(139, 92, 246, 0.2) !important;
  border-radius: 10px !important;
  font-size: 0.74rem !important;
  color: #8b5cf6 !important;
}

/* ═══════════════════════════════════════════════════════════
   QME PANEL REQUEST — STYLES
   ═══════════════════════════════════════════════════════════ */

/* White Page Wrapper — matches Upload/Dashboard style */
.qp-page-wrap {
  background: rgba(245, 243, 250, 0.92);
  border: 3px solid rgba(139, 92, 246, 0.6);
  border-radius: 18px;
  padding: 28px 30px 36px;
  position: relative;
}

/* Override dark theme colors inside the QME panel */
.qp-page-wrap,
.qp-page-wrap .card,
.qp-page-wrap .qp-form-section { background: #fff; color: #1a1a2e; }
.qp-page-wrap .card { border-color: rgba(139, 92, 246, 0.15); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.qp-page-wrap .card:hover { border-color: rgba(139, 92, 246, 0.3); box-shadow: 0 4px 20px rgba(139,92,246,0.1); }
.qp-page-wrap h2, .qp-page-wrap h3, .qp-page-wrap .qp-sec-title,
.qp-page-wrap .qp-stat-count, .qp-page-wrap .qp-next-run-detail span,
.qp-page-wrap .qp-profile-name, .qp-page-wrap .qp-activity-msg { color: #1a1a2e; }
.qp-page-wrap .qp-label { color: #555; }
.qp-page-wrap .qp-input {
  background: #f8f7fc; border-color: #d4d0e8; color: #1a1a2e;
}
.qp-page-wrap .qp-input:focus {
  border-color: #8b5cf6; background: #f3f0ff;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}
.qp-page-wrap .qp-checkbox-label, .qp-page-wrap .qp-checkbox-label span { color: #1a1a2e; }
.qp-page-wrap .qp-disclaimer { background: rgba(245,158,11,0.06); color: #666; }
.qp-page-wrap p, .qp-page-wrap span, .qp-page-wrap td { color: #333; }

/* Sub nav in white mode */
.qp-page-wrap .qp-subnav { background: #f3f1fa; border-color: #d4d0e8; }
.qp-page-wrap .qp-subnav-btn { color: #666; }
.qp-page-wrap .qp-subnav-btn:hover { background: #ebe8f5; color: #1a1a2e; }
.qp-page-wrap .qp-subnav-btn.active { background: var(--gradient); color: #fff; }

/* Beta banner in white mode */
.qp-page-wrap .qp-beta-banner { background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.2); color: #666; }

/* Stat cards in white mode */
.qp-page-wrap .qp-stat-card { background: #fff; border-color: #e8e5f0; }
.qp-page-wrap .qp-stat-card:hover { border-color: rgba(139,92,246,0.3); }
.qp-page-wrap .qp-stat-label { color: #888; }

/* Activity items in white mode */
.qp-page-wrap .qp-activity-item { background: #f8f7fc; }
.qp-page-wrap .qp-activity-time { color: #999; }

/* Next run card */
.qp-page-wrap .qp-next-run-card { border-left-color: #06b6d4; }
.qp-page-wrap .qp-next-run-label { color: #888; }

/* Table in white mode */
.qp-page-wrap .qp-queue-table th { background: linear-gradient(135deg, #f3f1fa, #ebe8f5); color: #333; border-bottom-color: rgba(139,92,246,0.2); }
.qp-page-wrap .qp-queue-table td { color: #333; border-bottom-color: #eee; }
.qp-page-wrap .qp-queue-table tr:hover { background: rgba(139,92,246,0.04); }

/* Profile cards in white mode */
.qp-page-wrap .qp-profile-card { background: #f8f7fc; border-color: #e8e5f0; }
.qp-page-wrap .qp-profile-card:hover { border-color: rgba(139,92,246,0.3); }
.qp-page-wrap .qp-profile-detail { color: #666; }

/* Step indicator in white mode */
.qp-page-wrap .qp-step-indicator { background: #f8f7fc; border-color: #e8e5f0; }
.qp-page-wrap .qp-step { background: #fff; border-color: #d4d0e8; color: #999; }
.qp-page-wrap .qp-step-done { border-color: #10b981; color: #10b981; background: rgba(16,185,129,0.08); }
.qp-page-wrap .qp-step-error { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.08); }
.qp-page-wrap .qp-step-line { background: #d4d0e8; }

/* Validation in white mode */
.qp-page-wrap .qp-val-pass { background: rgba(16,185,129,0.08); color: #059669; border-color: rgba(16,185,129,0.2); }
.qp-page-wrap .qp-val-fail { background: rgba(239,68,68,0.08); color: #dc2626; border-color: rgba(239,68,68,0.2); }
.qp-page-wrap .qp-val-err { background: rgba(239,68,68,0.05); color: #dc2626; }
.qp-page-wrap .qp-val-warn { background: rgba(245,158,11,0.05); color: #d97706; }

/* Form footer */
.qp-page-wrap .qp-form-footer { border-top-color: #e8e5f0; }

/* Buttons in white mode */
.qp-page-wrap .btn-secondary { background: #f8f7fc; color: #7c3aed; border-color: #d4d0e8; }
.qp-page-wrap .btn-secondary:hover { background: #ebe8f5; border-color: #8b5cf6; }

/* Upload zone in white mode */
.qp-page-wrap .qp-upload-zone { background: #f8f7fc; border-color: #d4d0e8; }
.qp-page-wrap .qp-upload-zone:hover { background: #f3f0ff; border-color: #8b5cf6; }
.qp-page-wrap .qp-upload-zone p { color: #888; }

/* File badge in white mode */
.qp-page-wrap .qp-file-badge { background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.2); color: #333; }

/* EAMS search in white mode */
.qp-page-wrap .qp-eams-results { background: #fff; border-color: #d4d0e8; }
.qp-page-wrap .qp-eams-result-item { border-bottom-color: #eee; }
.qp-page-wrap .qp-eams-result-item:hover { background: rgba(139,92,246,0.04); }
.qp-page-wrap .qp-eams-result-name { color: #1a1a2e; }
.qp-page-wrap .qp-eams-result-detail { color: #666; }

/* Modal stays dark (overlays everything) */
.qp-modal-overlay .qp-modal { background: #fff; color: #1a1a2e; }
.qp-modal-overlay .qp-modal h3 { color: #1a1a2e; }
.qp-modal-overlay .qp-modal label { color: #555; }
.qp-modal-overlay .qp-modal input { background: #f8f7fc; border-color: #d4d0e8; color: #1a1a2e; }

/* Declaration items in white mode */
.qp-page-wrap .qp-decl-item { background: rgba(139,92,246,0.03); border-color: #e8e5f0; }

/* Settings info in white mode */
.qp-page-wrap .qp-settings-info code { background: #f3f1fa; color: #7c3aed; }

/* Beta Banner */
.qp-beta-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(139,92,246,0.06));
  border: 1px solid rgba(245,158,11,0.25); border-radius: 10px;
  font-size: .82rem; color: var(--text-muted);
}
.qp-beta-tag {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: .08em;
}

/* Sub Navigation */
.qp-subnav {
  display: flex; gap: 4px; margin-bottom: 20px;
  padding: 4px; background: var(--surface);
  border-radius: 12px; border: 1px solid var(--border);
  overflow-x: auto;
}
.qp-subnav-btn {
  padding: 10px 18px; border: none; border-radius: 10px;
  background: transparent; color: var(--text-muted);
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.qp-subnav-btn:hover { background: var(--surface2); color: var(--text); }
.qp-subnav-btn.active {
  background: var(--gradient); color: #fff; font-weight: 600;
  box-shadow: 0 2px 12px var(--glow-purple);
}

/* Status Chips */
.qp-status-chip {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}

/* Dashboard */
.qp-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.qp-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 16px; text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.qp-stat-card:hover { border-color: rgba(139,92,246,0.35); box-shadow: 0 2px 16px rgba(139,92,246,0.08); }
.qp-stat-icon { font-size: 1.4rem; margin-bottom: 6px; }
.qp-stat-count { font-size: 1.8rem; font-weight: 700; }
.qp-stat-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

/* Next Run Card */
.qp-next-run-card { border-left: 4px solid var(--accent); }
.qp-next-run-header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.qp-next-run-icon { font-size: 2rem; }
.qp-next-run-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.qp-next-run-time { font-size: 1.15rem; font-weight: 700; color: var(--accent-bright); }
.qp-next-run-detail { display: flex; align-items: center; gap: 12px; font-size: .85rem; color: var(--text); }

/* Quick Actions */
.qp-quick-actions { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }

/* Activity Feed */
.qp-activity-feed { display: flex; flex-direction: column; gap: 6px; }
.qp-activity-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--surface2); font-size: .82rem;
}
.qp-activity-time { color: var(--text-muted); font-size: .72rem; min-width: 110px; }
.qp-activity-msg { color: var(--text); flex: 1; }

/* Disclaimer */
.qp-disclaimer {
  margin-top: 24px; padding: 12px 16px;
  background: rgba(245,158,11,0.05); border: 1px solid rgba(245,158,11,0.15);
  border-radius: 8px; font-size: .72rem; color: var(--text-muted);
  line-height: 1.5; font-style: italic;
}

/* Form Wrapper */
.qp-form-wrapper { max-width: 960px; }
.qp-form-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.qp-form-actions-top { display: flex; gap: 8px; }
.qp-form-section { margin-bottom: 16px; }
.qp-sec-title { color: var(--text); font-size: 1rem; margin: 0 0 16px; }

/* Step Indicator */
.qp-step-indicator {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 24px; padding: 12px 16px;
  background: var(--surface); border-radius: 12px; border: 1px solid var(--border);
  overflow-x: auto;
}
.qp-step {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 2px solid var(--border);
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: all .2s; flex-shrink: 0;
}
.qp-step-num { pointer-events: none; }
.qp-step-done { border-color: var(--success); color: var(--success); background: rgba(16,185,129,0.1); }
.qp-step-error { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,0.1); }
.qp-step-line { flex: 1; height: 2px; background: var(--border); min-width: 12px; }

/* Field Grid */
.qp-field-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.qp-field-wrap { display: flex; flex-direction: column; gap: 4px; }
.qp-field-full { grid-column: 1 / -1; }
.qp-label {
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.qp-input {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: .9rem;
  outline: none; transition: all .25s;
}
.qp-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15), 0 0 15px var(--glow-purple);
  background: rgba(139,92,246,0.05);
}
.qp-textarea { min-height: 80px; resize: vertical; font-family: inherit; }

/* Checkbox */
.qp-checkbox-label {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .85rem; color: var(--text); cursor: pointer;
  margin-bottom: 6px;
}
.qp-checkbox-label input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: #8b5cf6; cursor: pointer; flex-shrink: 0;
}
.qp-checkbox-group { display: flex; flex-direction: column; gap: 4px; }

/* Upload Zone */
.qp-upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 32px; text-align: center; cursor: pointer;
  transition: all .3s; background: var(--surface2);
}
.qp-upload-zone:hover, .qp-upload-zone.qp-drag-over {
  border-color: #8b5cf6; background: rgba(139,92,246,0.06);
  box-shadow: 0 0 20px var(--glow-purple);
}

/* File Badge */
.qp-file-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25); border-radius: 10px;
}
.qp-file-remove {
  margin-left: auto; background: none; border: none;
  color: var(--danger); font-size: 1rem; cursor: pointer;
}

/* Validation Summary */
.qp-validation-summary { display: flex; flex-direction: column; gap: 10px; }
.qp-val-status {
  padding: 12px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem;
}
.qp-val-pass { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.qp-val-fail { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.qp-val-list { display: flex; flex-direction: column; gap: 4px; }
.qp-val-item { padding: 6px 12px; border-radius: 6px; font-size: .82rem; }
.qp-val-err { background: rgba(239,68,68,0.06); color: #fca5a5; }
.qp-val-warn { background: rgba(245,158,11,0.06); color: #fbbf24; }

/* Form Footer */
.qp-form-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 20px 0; margin-top: 8px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Queue Table */
.qp-queue-table { border-collapse: collapse; }
.qp-queue-table th {
  background: linear-gradient(135deg, #1a1040, #0f1629);
  color: #e2e8f0; padding: 10px 12px; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid rgba(139,92,246,0.3);
  text-align: left; white-space: nowrap;
}
.qp-queue-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.qp-queue-table tr:hover { background: rgba(139,92,246,0.04); }
.qp-queue-actions { display: flex; gap: 4px; }
.qp-action-btn {
  background: none; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; font-size: .82rem; padding: 4px 6px;
  transition: all .15s;
}
.qp-action-btn:hover { background: var(--surface2); border-color: var(--border); }
.qp-action-danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }

/* Profiles */
.qp-profile-list { display: flex; flex-direction: column; gap: 8px; }
.qp-profile-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  transition: border-color .2s;
}
.qp-profile-card:hover { border-color: rgba(139,92,246,0.3); }
.qp-profile-inactive { opacity: .5; }
.qp-profile-name { font-weight: 600; color: var(--text); font-size: .9rem; min-width: 160px; }
.qp-profile-detail { font-size: .78rem; color: var(--text-muted); flex: 1; min-width: 200px; }
.qp-profile-actions { display: flex; gap: 4px; margin-left: auto; }

/* Modal */
.qp-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
}
.qp-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; max-width: 520px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

/* EAMS Search */
.qp-eams-search { margin-bottom: 10px; }
.qp-eams-results {
  max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-top: 6px;
}
.qp-eams-result-item {
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.qp-eams-result-item:hover { background: rgba(139,92,246,0.08); }
.qp-eams-result-item:last-child { border-bottom: none; }
.qp-eams-result-name { font-weight: 600; color: var(--text); font-size: .88rem; }
.qp-eams-result-detail { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.qp-eams-no-result { padding: 12px 14px; color: var(--text-muted); font-size: .82rem; }

/* Declarations */
.qp-decl-item {
  padding: 10px 14px; margin-bottom: 8px;
  background: rgba(139,92,246,0.04); border: 1px solid var(--border);
  border-radius: 8px;
}

/* Settings */
.qp-settings-info code {
  background: var(--surface2); padding: 2px 6px;
  border-radius: 4px; font-size: .8rem; color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════
   LEAD CMS SYNC
   ═══════════════════════════════════════════════════════════ */

/* Main card — reuses .card but narrows max-width */
.lcs-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; margin-bottom: 28px; border: 1px solid var(--border); backdrop-filter: blur(12px); }

/* Header */
.lcs-header h2 { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--text); font-weight: 600; margin: 0 0 4px; }
.lcs-header .lcs-desc { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 20px; }

/* New profile button */
.lcs-new-btn { background: var(--gradient); color: #fff; border: none; border-radius: 10px; padding: 12px 28px; font-size: 0.92rem; font-weight: 600; font-family: 'Inter','DM Sans',sans-serif; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 20px var(--glow-purple); display: inline-flex; align-items: center; gap: 8px; }
.lcs-new-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 30px var(--glow-purple), 0 0 40px var(--glow-cyan); }

/* Profile list */
.lcs-profile-list { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

/* Profile card */
.lcs-profile-card { display: flex; align-items: center; gap: 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; transition: border-color 0.25s, box-shadow 0.25s; }
.lcs-profile-card:hover { border-color: rgba(139,92,246,0.35); box-shadow: 0 2px 16px rgba(139,92,246,0.08); }
.lcs-profile-card.lcs-inactive { opacity: 0.5; }

.lcs-profile-info { flex: 1; min-width: 0; }
.lcs-profile-name { font-weight: 700; font-size: 0.95rem; color: var(--text); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcs-profile-meta { font-size: 0.78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* Status badge */
.lcs-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.lcs-badge-active { background: rgba(16,185,129,0.12); color: #10b981; }
.lcs-badge-paused { background: rgba(251,191,36,0.12); color: #fbbf24; }
.lcs-badge-draft  { background: rgba(107,114,128,0.12); color: #9ca3af; }
.lcs-badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.lcs-badge-active .lcs-badge-dot { background: #10b981; }
.lcs-badge-paused .lcs-badge-dot { background: #fbbf24; }
.lcs-badge-draft  .lcs-badge-dot { background: #9ca3af; }

/* Action buttons */
.lcs-actions { display: flex; gap: 6px; flex-shrink: 0; }
.lcs-action-btn { background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); cursor: pointer; font-family: 'Inter','DM Sans',sans-serif; transition: all 0.2s; }
.lcs-action-btn:hover { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.3); color: var(--text); }
.lcs-action-danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #ef4444; }

/* Empty state */
.lcs-empty { text-align: center; padding: 60px 20px; }
.lcs-empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.6; }
.lcs-empty-title { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--text); margin-bottom: 6px; }
.lcs-empty-sub { font-size: 0.84rem; color: var(--text-muted); max-width: 400px; margin: 0 auto 20px; }

/* Modal overlay — reuses qp pattern */
.lcs-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.lcs-modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lcs-modal h3 { font-family: 'Playfair Display', serif; font-size: 1.15rem; color: var(--text); margin: 0 0 20px; }

/* Modal sections */
.lcs-section { margin-bottom: 22px; }
.lcs-section-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.lcs-section-note { font-size: 0.72rem; color: var(--text-muted); font-style: italic; margin-top: 6px; line-height: 1.4; }

/* Form fields */
.lcs-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lcs-field-grid.lcs-full { grid-template-columns: 1fr; }
.lcs-field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.lcs-field input, .lcs-field select { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 0.88rem; font-family: 'Inter','DM Sans',sans-serif; color: var(--text); transition: all 0.25s; outline: none; box-sizing: border-box; }
.lcs-field input:focus, .lcs-field select:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,0.15); background: rgba(139,92,246,0.05); }
.lcs-field input::placeholder { color: var(--text-muted); opacity: 0.6; }
.lcs-field select { cursor: pointer; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b5cf6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.lcs-field select option { background: var(--surface); color: var(--text); }

/* Modal footer */
.lcs-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.lcs-btn-cancel { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 10px 22px; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); cursor: pointer; font-family: 'Inter','DM Sans',sans-serif; transition: all 0.2s; }
.lcs-btn-cancel:hover { background: rgba(255,255,255,0.05); }
.lcs-btn-save { background: var(--gradient); color: #fff; border: none; border-radius: 8px; padding: 10px 28px; font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: 'Inter','DM Sans',sans-serif; transition: all 0.3s; box-shadow: 0 4px 15px var(--glow-purple); }
.lcs-btn-save:hover { transform: translateY(-1px); box-shadow: 0 6px 25px var(--glow-purple); }

/* Gmail connection status badges */
.lcs-badge-gmail-on { background: rgba(6,182,212,0.12); color: #06b6d4; }
.lcs-badge-gmail-on .lcs-badge-dot { background: #06b6d4; }
.lcs-badge-gmail-off { background: rgba(107,114,128,0.12); color: #9ca3af; }
.lcs-badge-gmail-off .lcs-badge-dot { background: #9ca3af; }

/* Gmail status in modal */
.lcs-gmail-status { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); }
.lcs-gmail-connected { background: rgba(6,182,212,0.06); border-color: rgba(6,182,212,0.2); }
.lcs-gmail-disconnected { background: var(--surface2); }
.lcs-gmail-status-icon { font-size: 1.3rem; flex-shrink: 0; }
.lcs-gmail-status-info { flex: 1; min-width: 0; }
.lcs-gmail-status-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.lcs-gmail-status-email { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Connect Gmail button */
.lcs-btn-connect-gmail { background: linear-gradient(135deg, #4285f4, #06b6d4); color: #fff; border: none; border-radius: 8px; padding: 8px 18px; font-size: 0.8rem; font-weight: 600; cursor: pointer; font-family: 'Inter','DM Sans',sans-serif; transition: all 0.3s; white-space: nowrap; flex-shrink: 0; }
.lcs-btn-connect-gmail:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(66,133,244,0.3); }

/* Check Now button */
.lcs-check-btn { background: rgba(6,182,212,0.1) !important; border-color: rgba(6,182,212,0.3) !important; color: #06b6d4 !important; }
.lcs-check-btn:hover { background: rgba(6,182,212,0.2) !important; }

/* Email results list */
.lcs-email-list { display: flex; flex-direction: column; gap: 8px; }
.lcs-email-item { padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); cursor: pointer; transition: border-color 0.2s; }
.lcs-email-item:hover { border-color: rgba(6,182,212,0.3); }
.lcs-email-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.lcs-email-subject { font-weight: 600; font-size: 0.88rem; color: var(--text); display: flex; align-items: center; flex: 1; min-width: 0; }
.lcs-email-date { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.lcs-email-sender { font-size: 0.78rem; color: var(--accent); margin-bottom: 4px; }
.lcs-email-snippet { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ══════════════════════════════════════════════════════════════════
   PD RATING — Lavender card theme (scoped to #panel-pd only)
   Aligns PD Rating with Upload/Dashboard/Records aesthetic.
   Structure and layout unchanged — color-only override.
   ══════════════════════════════════════════════════════════════════ */

#panel-pd .card,
#panel-pd .pd-card {
  background: rgba(245, 243, 250, 0.96);
  border: 3px solid rgba(139, 92, 246, 0.55);
  color: #1e1b4b;
  box-shadow: 0 10px 32px rgba(10,14,35,0.45);
  backdrop-filter: none;
}
#panel-pd .card .card-title,
#panel-pd .pd-card .card-title { border-bottom: 1px solid rgba(139,92,246,0.25); }
#panel-pd .card .card-title h2,
#panel-pd .pd-card .card-title h2,
#panel-pd .pd-card h2, #panel-pd .pd-card h3, #panel-pd .pd-card h4,
#panel-pd .pd-card strong,
#panel-pd .card strong { color: #1e1b4b; }
#panel-pd .card label,
#panel-pd .pd-card label { color: #4338ca; font-weight: 700; }

/* Inline muted text at card level (e.g. "Required for PDR adjustment" hints) */
#panel-pd .card p,
#panel-pd .pd-card p { color: #475569; }

/* Inputs / readonly fields — covers .info-field, .pd-pre-input, and generic inputs inside any card in #panel-pd */
#panel-pd .card input, #panel-pd .card select, #panel-pd .card textarea,
#panel-pd .info-field input, #panel-pd .info-field select,
#panel-pd .pd-card input, #panel-pd .pd-card select, #panel-pd .pd-card textarea,
#panel-pd .pd-pre-input, #panel-pd .pd-occ-search {
  background: rgba(255,255,255,0.65);
  color: #1e1b4b;
  border: 1.5px solid rgba(139,92,246,0.35);
}
#panel-pd .card input::placeholder,
#panel-pd .pd-pre-input::placeholder,
#panel-pd .pd-occ-search::placeholder { color: #94a3b8; }
#panel-pd .card input:focus, #panel-pd .card select:focus,
#panel-pd .info-field input:focus,
#panel-pd .pd-card input:focus, #panel-pd .pd-card select:focus,
#panel-pd .pd-pre-input:focus, #panel-pd .pd-occ-search:focus {
  background: #fff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

/* Dropzone inside PD Rating cards — matches Upload tab's dark radial aesthetic */
#panel-pd .card .dropzone, #panel-pd .card .drop-zone, #panel-pd .card .drop-zone-hero,
#panel-pd .pd-card .dropzone, #panel-pd .pd-card .drop-zone, #panel-pd .pd-card .drop-zone-hero {
  background: radial-gradient(circle, #231c44 0%, #302855 50%, #463c6e 100%);
  border: none;
  border-radius: 16px;
  box-shadow: 0 0 12px rgba(139,92,246,0.4), 0 0 30px rgba(6,182,212,0.3);
  color: #e2e8f0;
}
#panel-pd .card .dropzone:hover, #panel-pd .card .dropzone.drag-over,
#panel-pd .card .drop-zone:hover, #panel-pd .card .drop-zone.drag-over,
#panel-pd .pd-card .dropzone:hover, #panel-pd .pd-card .dropzone.drag-over {
  background:
    radial-gradient(circle, #231c44 0%, #302855 50%, #463c6e 100%),
    rgba(107, 33, 168, 0.35);
  background-blend-mode: overlay;
  box-shadow:
    0 0 25px rgba(107, 33, 168, 0.5),
    0 0 50px rgba(107, 33, 168, 0.3),
    0 0 100px rgba(107, 33, 168, 0.2),
    inset 0 0 40px rgba(107, 33, 168, 0.15);
}
#panel-pd .card .dropzone .dz-title,
#panel-pd .card .drop-zone .dz-title,
#panel-pd .card .drop-zone-hero .dz-title { color: #e2e8f0; }
#panel-pd .card .dropzone .dz-sub,
#panel-pd .card .drop-zone .dz-sub { color: rgba(226,232,240,0.7); }
#panel-pd .card .dz-tag {
  background: rgba(139,92,246,0.2);
  border: 1px solid rgba(139,92,246,0.4);
  color: #c4b5fd;
}
#panel-pd .pd-ro-field {
  background: rgba(255,255,255,0.6);
  color: #1e1b4b;
  border: 1.5px solid rgba(139,92,246,0.25);
}
#panel-pd .pd-overview-divider {
  color: #4338ca;
  border-color: rgba(139,92,246,0.35);
}
#panel-pd .pd-edit-hint { color: #6366f1; }

/* Body part collapsible cards */
#panel-pd .pd-bp-section {
  background: rgba(255,255,255,0.6);
  border: 1.5px solid rgba(139,92,246,0.25);
  color: #1e1b4b;
}
#panel-pd .pd-bp-summary,
#panel-pd .pd-bp-name { color: #1e1b4b; }
#panel-pd .pd-bp-findings,
#panel-pd .pd-bp-body { color: #1e1b4b; }
#panel-pd .pd-dup-warn { color: #92400e; }
#panel-pd .pd-apport-note { color: #4338ca; }

/* Tables inside pd cards */
#panel-pd .pd-card table { background: rgba(255,255,255,0.6); }
#panel-pd .pd-card thead th {
  background: rgba(139,92,246,0.12);
  color: #4338ca;
  border-bottom: 1px solid rgba(139,92,246,0.3);
}
#panel-pd .pd-card tbody tr:nth-child(odd) { background: rgba(255,255,255,0.55); }
#panel-pd .pd-card tbody tr:nth-child(even) { background: rgba(245,243,250,0.65); }
#panel-pd .pd-card tbody tr:hover { background: rgba(139,92,246,0.08); }
#panel-pd .pd-card tbody td {
  color: #1e1b4b;
  border-bottom: 1px solid rgba(139,92,246,0.15);
}

/* Kite/Vigil section */
#panel-pd .pd-kite-group {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(139,92,246,0.3);
  color: #1e1b4b;
}
#panel-pd .pd-kite-group-name,
#panel-pd .pd-kite-group-head,
#panel-pd .pd-kite-group-parts { color: #1e1b4b; }
#panel-pd .pd-kite-group-justify {
  background: rgba(255,255,255,0.55);
  color: #475569;
  border: 1px dashed rgba(139,92,246,0.3);
}
#panel-pd .pd-kite-cvc { background: rgba(255,255,255,0.55); color: #1e1b4b; }
#panel-pd .pd-kite-help, #panel-pd .pd-kite-howto {
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(139,92,246,0.25);
}
#panel-pd .pd-kite-help-body,
#panel-pd .pd-kite-help-body p,
#panel-pd .pd-kite-help-body ol,
#panel-pd .pd-kite-help-body li { color: #1e1b4b; }
#panel-pd .pd-kite-help-hint { color: #475569; }

/* Audit trail */
#panel-pd .pd-audit-trail {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(139,92,246,0.25);
  color: #1e1b4b;
}
#panel-pd .pd-audit-label { color: #475569; }
#panel-pd .pd-audit-basis { color: #475569; }
#panel-pd .pd-audit-value,
#panel-pd .pd-audit-title { color: #1e1b4b; }

/* Breakdown */
#panel-pd .pd-breakdown {
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(139,92,246,0.2);
  color: #1e1b4b;
}
#panel-pd .pd-breakdown-title { color: #4338ca; }
#panel-pd .breakdown-item { color: #475569; }
#panel-pd .breakdown-item .bi-name { color: #1e1b4b; }

/* Final Rating hero — solid dark value for contrast, gradient only on % sign */
#panel-pd .pd-result-box {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(6,182,212,0.1));
  color: #1e1b4b;
  border: 2px solid rgba(99,102,241,0.35);
}
#panel-pd .pd-result-box .pd-label { color: #4c1d95; }
#panel-pd .pd-result-box .pd-value {
  background: none;
  -webkit-text-fill-color: #1e1b4b;
  color: #1e1b4b;
}
#panel-pd .pd-result-box .pd-pct {
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}
#panel-pd .pd-result-box .pd-sub { color: #4c1d95; }
#panel-pd .pd-result-box::before { display: none; }

/* Sticky bar */
#panel-pd .pd-sticky-bar {
  background: rgba(245,243,250,0.98);
  border: 2px solid rgba(139,92,246,0.45);
  color: #1e1b4b;
}
#panel-pd .pd-sticky-label { color: #475569; }
#panel-pd .pd-sticky-val,
#panel-pd .pd-sticky-total-val { color: #1e1b4b; }

/* Top caveats */
#panel-pd .pd-top-caveats {
  background: rgba(251,191,36,0.12);
  border: 1.5px solid rgba(251,191,36,0.4);
  color: #92400e;
}
#panel-pd .pd-top-caveats-label,
#panel-pd .pd-top-caveats-hint { color: #92400e; }

/* Method buttons */
#panel-pd .method-btn {
  background: rgba(255,255,255,0.55);
  border-color: rgba(139,92,246,0.3);
  color: #64748b;
}
#panel-pd .method-btn.active {
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(6,182,212,0.15));
  border-color: rgba(99,102,241,0.5);
  color: #4338ca;
}
#panel-pd .method-desc {
  background: rgba(255,255,255,0.55);
  color: #475569;
  border-left: 3px solid #6366f1;
}

/* Fallback for inline text colors referring to dark-theme vars */
#panel-pd .pd-card [style*="color:var(--text-muted)"],
#panel-pd .pd-card [style*="color: var(--text-muted)"] { color: #475569 !important; }
#panel-pd .pd-card [style*="color:var(--text)"],
#panel-pd .pd-card [style*="color: var(--text)"] { color: #1e1b4b !important; }
#panel-pd .pd-card [style*="color:var(--accent)"],
#panel-pd .pd-card [style*="color: var(--accent)"] { color: #0891b2 !important; }

/* WPI Analysis rows */
#panel-pd .pd-wpi-row { color: #1e1b4b; border-bottom: 1px solid rgba(139,92,246,0.12); }
#panel-pd .pd-wpi-name { color: #1e1b4b; }
#panel-pd .pd-wpi-detail { color: #475569; }
#panel-pd .pd-wpi-value { color: #1e1b4b; }

/* Source badges on WPI analysis (Explicit/Inferred) — dark-text-on-light versions */
#panel-pd .pd-source-badge.pd-source-explicit {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
#panel-pd .pd-source-badge.pd-source-inferred {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
#panel-pd .pd-source-badge.pd-source-manual {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
#panel-pd .pd-source-badge.pd-source-override {
  background: rgba(139, 92, 246, 0.12);
  color: #6d28d9;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Confidence pills */
#panel-pd .pd-conf-pill { color: #475569; background: rgba(255,255,255,0.5); border: 1px solid rgba(139,92,246,0.2); }

/* Represented field (has inline dark bg in markup) */
#panel-pd input[readonly][style*="surface2"] {
  background: rgba(255,255,255,0.45) !important;
  color: #1e1b4b !important;
}

/* ══════════════════════════════════════════════════════════════════
   PD RATING — Phase 2 coverage (Rating Signals, Body Parts summary,
   PDRS formula rows, hero dropzone, file items, mode buttons, pills,
   status banners, Export PDF button, low-contrast text)
   ══════════════════════════════════════════════════════════════════ */

/* Rating Signals + Injury & Diagnoses field values (were invisible) */
#panel-pd .pd-fld { color: #1e1b4b; }
#panel-pd .pd-fld-val,
#panel-pd .pd-fld > .pd-fld-val { color: #1e1b4b !important; font-weight: 600; }
#panel-pd .pd-fld-key,
#panel-pd .pd-fld-label { color: #6366f1 !important; font-weight: 800; letter-spacing: 0.5px; }

/* Severity term pills (inline style uses var(--surface2)) */
#panel-pd [style*="background:var(--surface2)"],
#panel-pd [style*="background: var(--surface2)"] {
  background: rgba(99,102,241,0.12) !important;
  color: #4338ca !important;
  border: 1px solid rgba(139,92,246,0.25) !important;
}

/* Body-part collapsed summary bars */
#panel-pd .pd-bp-summary {
  background: rgba(255,255,255,0.7) !important;
  color: #1e1b4b !important;
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 10px;
}
#panel-pd .pd-bp-summary:hover { background: rgba(139,92,246,0.08) !important; }
#panel-pd .pd-bp-section[open] .pd-bp-summary {
  background: rgba(245,243,250,0.95) !important;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
#panel-pd .pd-bp-name { color: #1e1b4b !important; font-weight: 700; }
#panel-pd .pd-bp-edit-btn,
#panel-pd .pd-bp-del-btn { color: #6366f1; filter: none; }

/* Hero-panel input form (not covered by .card selectors) */
#panel-pd .hero-panel .hero-panel-body input,
#panel-pd .hero-panel input.pd-pre-input,
#panel-pd .hero-panel input.pd-occ-input,
#panel-pd .pd-occ-input {
  background: rgba(255,255,255,0.65) !important;
  color: #1e1b4b !important;
  border: 1.5px solid rgba(139,92,246,0.35) !important;
}
#panel-pd .pd-occ-input::placeholder { color: #94a3b8 !important; }

/* Hero-panel dropzone — matches Upload tab's dark radial aesthetic */
#panel-pd .hero-panel .dropzone,
#panel-pd .hero-panel .drop-zone,
#panel-pd .hero-panel .drop-zone-hero,
#panel-pd .dropzone.drop-zone-hero {
  background: radial-gradient(circle, #231c44 0%, #302855 50%, #463c6e 100%) !important;
  border: none !important;
  border-radius: 16px !important;
  box-shadow: 0 0 12px rgba(139,92,246,0.4), 0 0 30px rgba(6,182,212,0.3) !important;
  color: #e2e8f0 !important;
}
#panel-pd .hero-panel .dropzone:hover,
#panel-pd .hero-panel .drop-zone-hero:hover,
#panel-pd .hero-panel .drop-zone-hero.drag-over {
  box-shadow: 0 0 20px rgba(139,92,246,0.6), 0 0 40px rgba(6,182,212,0.45) !important;
}
#panel-pd .hero-panel .dz-title,
#panel-pd .hero-panel .drop-zone-hero .dz-title { color: #e2e8f0 !important; }
#panel-pd .hero-panel .dz-sub { color: rgba(226,232,240,0.7) !important; }
#panel-pd .hero-panel .dz-tag {
  background: rgba(139,92,246,0.2) !important;
  border: 1px solid rgba(139,92,246,0.4) !important;
  color: #c4b5fd !important;
}

/* File item in hero panel (uploaded report row) */
#panel-pd .file-item {
  background: rgba(255,255,255,0.65) !important;
  border: 1px solid rgba(139,92,246,0.3) !important;
}
#panel-pd .file-item .fi-name { color: #1e1b4b !important; }
#panel-pd .file-item .fi-size { color: #475569 !important; }

/* Rating Mode toggle buttons (Explicit Only / Include Inferred) */
#panel-pd .pd-mode-btn {
  background: rgba(255,255,255,0.55) !important;
  color: #475569 !important;
  border: 1.5px solid rgba(139,92,246,0.3) !important;
}
#panel-pd .pd-mode-btn.active {
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(6,182,212,0.15)) !important;
  color: #4338ca !important;
  border-color: rgba(99,102,241,0.5) !important;
}

/* PDRS formula rows (the "[CVC] 16.02.01.00 — 7 — [8]10..." bars) */
#panel-pd .pd-pdr-title {
  background: rgba(99,102,241,0.08) !important;
  color: #1e1b4b !important;
  border: 1px solid rgba(139,92,246,0.25) !important;
}
#panel-pd .pd-pdr-title [class*="cvc"],
#panel-pd .pd-pdr-title [style*="color:var(--accent)"] { color: #0891b2 !important; }
#panel-pd .pd-audit-step,
#panel-pd .pd-audit-step > * { color: #1e1b4b !important; }
#panel-pd .pd-audit-step .pd-audit-label,
#panel-pd .pd-audit-step [class*="label"] { color: #475569 !important; }
#panel-pd .pd-audit-step .pd-audit-basis,
#panel-pd .pd-audit-step [class*="basis"] { color: #64748b !important; }
#panel-pd .pd-audit-value { color: #1e1b4b !important; font-weight: 700; }
#panel-pd .pd-rebuttal-note {
  background: rgba(251,191,36,0.12) !important;
  color: #92400e !important;
  border: 1px solid rgba(251,191,36,0.35) !important;
}

/* Export PDF button (.btn-secondary has white text on transparent bg) */
#panel-pd .btn-secondary {
  background: rgba(255,255,255,0.7) !important;
  color: #6366f1 !important;
  border: 1.5px solid rgba(139,92,246,0.4) !important;
}
#panel-pd .btn-secondary:hover {
  background: rgba(99,102,241,0.1) !important;
  color: #4338ca !important;
}

/* Status banners — keep semantic color but brighten for lavender context */
#panel-pd .pd-mode-banner {
  background: rgba(59,130,246,0.1) !important;
  border: 1.5px solid rgba(59,130,246,0.35) !important;
}
#panel-pd .pd-mode-explicit { color: #1d4ed8 !important; }
#panel-pd .pd-mode-explicit *, #panel-pd .pd-mode-banner * { color: inherit; }
#panel-pd .pd-mode-inferred { color: #b45309 !important; background: rgba(245,158,11,0.1) !important; border-color: rgba(245,158,11,0.4) !important; }
#panel-pd .pd-mode-mixed { color: #6d28d9 !important; background: rgba(139,92,246,0.1) !important; border-color: rgba(139,92,246,0.35) !important; }
#panel-pd .pd-ratable-banner {
  border: 1.5px solid currentColor !important;
}
#panel-pd .pd-ratable-yes { color: #047857 !important; background: rgba(16,185,129,0.1) !important; }
#panel-pd .pd-ratable-warn { color: #b45309 !important; background: rgba(245,158,11,0.1) !important; }
#panel-pd .pd-ratable-no { color: #b91c1c !important; background: rgba(239,68,68,0.1) !important; }

/* Evidence excerpt quotes (italic, were pale) */
#panel-pd .pd-evidence-quote,
#panel-pd .pd-ev-quote,
#panel-pd em { color: #475569 !important; }

/* Warnings list items — brighten text */
#panel-pd .pd-warning-item,
#panel-pd .pd-warnings-list li,
#panel-pd .pd-warn-item { color: #78350f !important; }

/* Pain add-on note */
#panel-pd .pd-pain-addon,
#panel-pd .pd-wpi-list .pd-wpi-sub,
#panel-pd .pd-wpi-list [class*="pain"] { color: #4338ca !important; }

/* Functional Findings expandable rows */
#panel-pd .pd-ff-sub,
#panel-pd .pd-ff-sublist li,
#panel-pd .pd-ff-total { color: #1e1b4b !important; }
#panel-pd .pd-ff-sub-label { color: #4338ca !important; }
#panel-pd .pd-ff-sub-count { color: #64748b !important; }

/* Final "pre-combination" rows in PDRS breakdown */
#panel-pd .pd-pdr-pre-combo,
#panel-pd .pd-pdr-final-pre { color: #1e1b4b !important; font-weight: 700; }

/* Evidence excerpt category rows ("Restriction — All", "FutureMedical — All") */
#panel-pd .pd-ev-category,
#panel-pd .pd-ev-cat { color: #1e1b4b !important; font-weight: 700; }
#panel-pd .pd-ev-count { color: #6366f1 !important; }

/* Dark PDRS formula bars with inline navy gradient (used for [CVC]/[A]/[B] rows) */
#panel-pd [style*="linear-gradient(135deg,#1e3a5f"],
#panel-pd [style*="linear-gradient(135deg, #1e3a5f"] {
  background: rgba(99,102,241,0.12) !important;
  color: #1e1b4b !important;
  border: 1px solid rgba(139,92,246,0.3) !important;
}

/* Final PD (pre-combination) footer row in PDRS breakdown tables */
#panel-pd .pd-card tfoot td { color: #1e1b4b !important; font-weight: 700; }
#panel-pd .pd-card tfoot td:first-child { color: #4338ca !important; }

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE  (≤ 640px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Header ── */
  header { padding: 0 12px; }
  .header-logo-img { height: 80px; margin-top: -8px; margin-bottom: -14px; }
  .header-subtitle { font-size: 0.72rem; letter-spacing: 0.1em; }
  .header-actions { position: static; transform: none; }

  /* ── Main panels ── */
  main,
  #panel-dashboard main,
  main.cid-main { padding: 16px 12px 60px; max-width: 100%; }

  /* ── Cards ── */
  .card { padding: 18px 14px; }

  /* ── Hero layout ── */
  .hero-layout { padding: 10px 10px; min-height: unset; }
  .hero-panel {
    max-height: none;
    max-width: 100%;
    overflow: visible;
  }
  .hero-panel-title { padding: 14px 14px 0; }
  .hero-panel-body { overflow-y: visible; max-height: none; }

  /* ── Upload tab: stack brand panel + hero ── */
  .upload-split { flex-direction: column; }
  .upload-brand-panel { display: none; }  /* decorative only — hide on mobile */
  .upload-hero { padding: 18px 14px; }
  .upload-hero-inner { flex-direction: column; gap: 16px; }
  .upload-hero-right { flex: none; width: 100%; display: flex; justify-content: center; }
  .upload-hero-title { font-size: 1.4rem; letter-spacing: 1px; }

  /* ── Drop zone hero ── */
  .drop-zone-hero {
    width: min(240px, 80vw);
    height: min(240px, 80vw);
  }

  /* ── Case info grid ── */
  .case-info-grid { grid-template-columns: 1fr; }

  /* ── Records Chat layout ── */
  .rc-layout { padding: 10px 10px; height: auto; min-height: calc(100dvh - 120px); }
  .rc-hero { max-height: none; max-width: 100%; overflow: visible; }
  .rc-hero-title { padding: 14px 14px 0; }
  .rc-drop-hero { width: min(200px, 70vw); height: min(200px, 70vw); }

  /* ── Dashboard ── */
  .cid-summary-bar { grid-template-columns: repeat(2, 1fr) !important; }
  .cid-row,
  .cid-row.equal { grid-template-columns: 1fr !important; }

  /* ── PD tab ── */
  .pd-pre-row { grid-template-columns: 1fr !important; }
  .pd-bpf-grid { grid-template-columns: 1fr !important; }
  .pd-result-box .pd-value { font-size: 2.8rem; }

  /* ── Tables: horizontal scroll ── */
  .bp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }

  /* ── Action rows ── */
  .action-row { flex-direction: column; }
  .action-row .btn-primary,
  .action-row .btn-secondary { width: 100%; }

  /* ── Info grid ── */
  .info-grid { grid-template-columns: 1fr; }

  /* ── Modals ── */
  .modal-inner,
  .dg-modal-inner { margin: 12px; max-width: calc(100vw - 24px); }
}

/* ═══════════════════════════════════════════════════════════
   TABLET  (641px – 900px)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 641px) and (max-width: 900px) {
  .hero-layout { padding: 12px 16px; }
  .hero-panel { max-width: 100%; }
  .upload-brand-panel { display: none; }
  .upload-hero-inner { flex-direction: column; gap: 16px; }
  .upload-hero-right { flex: none; width: 100%; display: flex; justify-content: center; }
  .rc-hero { max-width: 100%; }
  .cid-row { grid-template-columns: 1fr; }
}

/* ── Cost Log Tab ─────────────────────────────────────────── */
.js-cost-month-tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.js-cost-month-btn { background:var(--surface); border:1px solid var(--border); color:var(--text-muted);
  border-radius:8px; padding:6px 14px; font-size:0.82rem; font-weight:600; cursor:pointer;
  font-family:'Inter',sans-serif; transition:all 0.2s; }
.js-cost-month-btn:hover { border-color:#8b5cf6; color:#e2e8f0; }
.js-cost-month-btn.active { background:rgba(139,92,246,0.15); border-color:#8b5cf6; color:#e2e8f0; }

.js-cost-summary-bar { display:flex; gap:20px; align-items:flex-start; flex-wrap:wrap;
  background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px 28px;
  margin-bottom:4px; }
.js-cost-total-block { min-width:160px; }
.js-cost-total-label { font-size:0.78rem; color:var(--text-muted); text-transform:uppercase;
  letter-spacing:0.06em; margin-bottom:4px; }
.js-cost-total-value { font-size:2rem; font-weight:700; color:#10b981; line-height:1; }
.js-cost-total-sub { font-size:0.78rem; color:var(--text-muted); margin-top:6px; }

.js-cost-tool-grid { display:flex; gap:12px; flex-wrap:wrap; flex:1; }
.js-cost-tool-card { background:var(--surface2); border:1px solid var(--border); border-radius:12px;
  padding:12px 16px; min-width:130px; }
.js-cost-tool-name { font-size:0.78rem; color:var(--text-muted); margin-bottom:4px; }
.js-cost-tool-cost { font-size:1.1rem; font-weight:700; color:#e2e8f0; }
.js-cost-tool-meta { font-size:0.72rem; color:var(--text-muted); margin-top:3px; }

.js-cost-table { width:100%; border-collapse:collapse; font-size:0.85rem; }
.js-cost-table thead th { background:linear-gradient(135deg,#1a1040,#0f1629); color:#e2e8f0;
  padding:10px 14px; text-align:left; font-size:0.73rem; text-transform:uppercase;
  letter-spacing:0.07em; font-weight:600; border-bottom:2px solid rgba(139,92,246,0.3); }
.js-cost-table tbody td { padding:10px 14px; border-bottom:1px solid var(--border); color:var(--text); }
.js-cost-job-row:hover td { background:rgba(139,92,246,0.05); }
.js-cost-job-multi { cursor:pointer; }
.js-cost-job-multi:hover td { background:rgba(139,92,246,0.08); }
.js-cost-arrow { color:#8b5cf6; font-size:0.7rem; margin-right:4px; }
.js-cost-calls-badge { background:rgba(139,92,246,0.18); color:#a78bfa; border-radius:10px;
  padding:1px 8px; font-size:0.72rem; font-weight:600; margin-left:6px; }
.js-cost-time { color:var(--text-muted); font-size:0.78rem; margin-left:6px; }
.js-cost-user { color:#8b5cf6; font-weight:500; font-size:0.82rem; }
.js-cost-model { color:var(--text-muted); font-size:0.78rem; }
.js-cost-cell { text-align:right; font-weight:600; color:#10b981; }
.js-cost-total-row td { padding:10px 14px; font-weight:700; color:#e2e8f0;
  background:linear-gradient(135deg,#1a1040,#0f1629); border-top:2px solid rgba(139,92,246,0.3); }

.js-cost-job-detail td { padding:0; background:rgba(0,0,0,0.2); }
.js-cost-sub-table { width:100%; border-collapse:collapse; font-size:0.8rem; }
.js-cost-sub-table thead th { background:rgba(139,92,246,0.08); color:var(--text-muted);
  padding:7px 14px 7px 28px; font-size:0.7rem; text-transform:uppercase; letter-spacing:0.06em;
  font-weight:600; border-bottom:1px solid var(--border); }
.js-cost-sub-table tbody td { padding:7px 14px 7px 28px; border-bottom:1px solid rgba(139,92,246,0.08);
  color:var(--text-muted); }
