/* AI-Ophtha Expert — Green Deck adapted */
:root {
  --bg: #0A0F0D;
  --surface-0: #0F1411;
  --surface-1: #151A17;
  --surface-2: #1E2521;
  --surface-3: #2A322D;
  --border: #232A26;
  --border-strong: #2F3833;
  --text: #FFFFFF;
  --text-2: #A7B0AB;
  --text-3: #6B736E;
  --text-4: #4A5250;
  --primary: #14E07A;
  --primary-hover: #2BEA89;
  --primary-soft: rgba(20, 224, 122, 0.12);
  --primary-glow: rgba(20, 224, 122, 0.25);
  --warning: #F5B324;
  --error: #F2495C;
  --info: #4FB7F0;
}

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

input, textarea {
  font-family: inherit;
  color: inherit;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4540; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: 240px 320px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg);
}

/* ============ SIDEBAR ============ */
.sidebar {
  background: #000;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #0AA85B);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 18%, #0A0F0D 19% 55%, transparent 56%);
  opacity: 0.92;
}
.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--primary);
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 24px;
}
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 8px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-2);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, background .15s;
  width: 100%;
  text-align: left;
}
.nav-item:hover { color: var(--text); }
.nav-item.active {
  color: var(--text);
  background: var(--surface-1);
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { width: 18px; height: 18px; flex: none; }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2A322D, #1E2521);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--primary);
  border: 1px solid var(--border-strong);
}
.user-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-3); }
.status-dot {
  margin-left: auto;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* ============ MIDDLE COLUMN — PATIENT LIST ============ */
.patient-col {
  background: var(--surface-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.col-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.col-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-title .badge {
  background: var(--surface-2);
  color: var(--text);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 0;
}

.search-input {
  width: 100%;
  height: 36px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0 14px 0 36px;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border .15s;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: var(--border-strong); }
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--text-3);
  width: 14px; height: 14px;
}

.add-btn {
  width: 100%;
  margin-top: 10px;
  height: 36px;
  border-radius: 6px;
  background: var(--primary);
  color: #062813;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .15s;
}
.add-btn:hover { background: var(--primary-hover); }

.patients-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 20px;
}

.patient-card {
  padding: 14px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
  border: 1px solid transparent;
}
.patient-card:hover { background: var(--surface-1); }
.patient-card.active {
  background: var(--surface-1);
  border-color: var(--border-strong);
}
.patient-card.active::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.pc-row1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.pc-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.pc-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.pc-meta span:not(:last-child)::after {
  content: '·';
  margin-left: 6px;
  color: var(--text-4);
}

.pc-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.pc-status.ready { background: var(--primary-soft); color: var(--primary); }
.pc-status.pending { background: rgba(245, 179, 36, 0.12); color: var(--warning); }
.pc-status.draft { background: var(--surface-2); color: var(--text-2); }

.pc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
}
.pc-tags {
  display: flex;
  gap: 4px;
}
.pc-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
}

/* ============ MAIN WORKSPACE ============ */
.workspace {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ws-header {
  flex: none;
  padding: 18px 32px 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-0) 0%, var(--bg) 100%);
}
.ws-breadcrumb {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.ws-breadcrumb b { color: var(--text-2); }
.ws-title-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.ws-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ws-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface-1);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 400;
}
.ws-title-meta {
  display: flex;
  gap: 24px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.ws-title-meta span b {
  color: var(--text);
  font-weight: 700;
  margin-left: 4px;
}
.ws-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #062813;
}
.btn-primary:hover { background: var(--primary-hover); transform: scale(1.02); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { border-color: #4a5550; }
.btn-ghost { color: var(--text-2); padding: 0 12px; }
.btn-ghost:hover { color: var(--text); }
.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--text-2);
  display: grid; place-items: center;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

.ws-tabs {
  display: flex;
  gap: 32px;
}
.ws-tab {
  padding: 10px 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ws-tab:hover { color: var(--text-2); }
.ws-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}
.ws-tab .count {
  font-size: 10px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text-2);
  font-weight: 700;
}
.ws-tab.active .count { background: var(--primary-soft); color: var(--primary); }

.ws-body {
  flex: 1;
  overflow: hidden;
  display: flex;
}

/* ============ INDEX SIDEBAR (within workspace) ============ */
.index-panel {
  width: 260px;
  flex: none;
  border-right: 1px solid var(--border);
  background: var(--surface-0);
  overflow-y: auto;
  padding: 20px 16px;
}
.index-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.index-head .live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-size: 10px;
}
.index-head .live::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--primary);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.index-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
  cursor: pointer;
}
.index-tree-item:hover { background: var(--surface-1); color: var(--text); }
.index-tree-item.active { background: var(--surface-1); color: var(--primary); }
.index-tree-item .tree-icon { width: 14px; color: var(--text-3); }
.index-tree-section {
  padding: 12px 0 4px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-4);
}

.dropzone {
  margin-top: 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  padding: 18px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  transition: border-color .15s, background .15s;
}
.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.dropzone svg { display: block; margin: 0 auto 6px; }

/* ============ VIEWER (Tab 1) ============ */
.viewer {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}
.viewer-pane {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.viewer-pane-head {
  flex: none;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-0);
}
.viewer-pane-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.viewer-pane-title .dot { color: var(--primary); }
.viewer-tools {
  display: flex;
  gap: 4px;
}
.tool-btn {
  width: 28px; height: 28px;
  border-radius: 4px;
  display: grid; place-items: center;
  color: var(--text-3);
  font-size: 12px;
}
.tool-btn:hover { background: var(--surface-2); color: var(--text); }

.image-stage {
  flex: 1;
  background:
    radial-gradient(circle at 50% 50%, #1a201d 0%, #0A0F0D 70%);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

/* Stylized eye fundus / MRI placeholder */
.fundus {
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  background:
    radial-gradient(circle at 48% 52%, #c95c1f 0%, #8a3210 22%, #4d1c08 45%, #1d0d05 75%, #0A0F0D 100%);
  box-shadow: inset 0 0 80px rgba(0,0,0,0.6), 0 0 60px rgba(201,92,31,0.08);
}
.fundus::before {
  content: '';
  position: absolute;
  inset: 38% 30% auto auto;
  width: 14%; height: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, #2a1408 0%, #0d0703 70%);
  box-shadow: 0 0 18px rgba(0,0,0,0.6);
}
.fundus::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 38%, transparent 30%, rgba(255,180,80,0.06) 31%, transparent 32%),
    radial-gradient(circle at 70% 60%, transparent 35%, rgba(255,140,40,0.05) 36%, transparent 37%);
}

/* AI annotation overlay */
.ai-annotation {
  position: absolute;
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 0 16px var(--primary-glow);
  animation: ann-pulse 2.4s infinite;
}
@keyframes ann-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 0 16px var(--primary-glow); }
  50% { box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 0 24px rgba(20,224,122,0.5); }
}
.ann-label {
  position: absolute;
  background: var(--primary);
  color: #062813;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

.image-overlay-info {
  position: absolute;
  top: 16px; left: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-2);
  background: rgba(10,15,13,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 4px;
  line-height: 1.6;
}
.image-overlay-info b { color: var(--text); font-weight: 500; }

.image-thumbs {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-0);
  overflow-x: auto;
}
.thumb {
  width: 56px; height: 56px;
  border-radius: 4px;
  flex: none;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.thumb.active { border-color: var(--primary); }
.thumb-mini-fundus {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 48% 52%, #c95c1f 0%, #8a3210 25%, #4d1c08 50%, #0A0F0D 100%);
}
.thumb-ct {
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.04) 3px 4px),
    radial-gradient(circle at 50% 50%, #4a5550 0%, #1a201d 60%, #0A0F0D 100%);
}
.thumb-rx {
  background: #f5efe2;
  position: relative;
}
.thumb-rx::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px; top: 10px;
  height: 1px; background: #888;
  box-shadow: 0 6px 0 #888, 0 12px 0 #888, 0 18px 0 #aaa, 0 24px 0 #888, 0 30px 0 #aaa, 0 36px 0 #888;
}

/* OCR pane */
.ocr-pane {
  background: var(--bg);
  overflow-y: auto;
}
.ocr-content {
  padding: 24px 28px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.ocr-content h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 24px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ocr-content h3:first-child { padding-top: 0; border-top: none; margin-top: 0; }
.ocr-content .field {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--surface-1);
}
.ocr-content .field-key {
  color: var(--text-3);
  font-size: 12px;
}
.ocr-content .field-val {
  color: var(--text);
  font-weight: 500;
}
.ocr-content .field-val.highlight {
  color: var(--primary);
  font-weight: 700;
}
.ocr-content .field-val.flag {
  color: var(--warning);
}
.confidence-bar {
  margin-top: 4px;
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.confidence-bar-fill {
  height: 100%;
  background: var(--primary);
}

.ocr-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.meta-chip {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-1);
  padding: 4px 10px;
  border-radius: 4px;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.meta-chip b { color: var(--text); font-weight: 500; }
.meta-chip.ok { color: var(--primary); border-color: rgba(20,224,122,0.2); }

/* ============ AI REPORT (Tab 2) ============ */
.report {
  flex: 1;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at top, rgba(20,224,122,0.04), transparent 60%),
    var(--bg);
}
.report-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 48px 64px;
}

.report-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.report-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--primary-soft), transparent 50%);
  pointer-events: none;
}
.report-hero-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #0AA85B);
  display: grid; place-items: center;
  color: #062813;
  flex: none;
  position: relative;
  z-index: 1;
}
.report-hero-text { flex: 1; position: relative; z-index: 1; }
.report-hero-text h2 {
  font-size: 18px; font-weight: 800; letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.report-hero-text p { margin: 0; color: var(--text-2); font-size: 13px; }
.report-hero-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  position: relative; z-index: 1;
}
.report-hero-meta b { color: var(--primary); font-weight: 500; }

.section {
  margin-bottom: 36px;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--primary);
  letter-spacing: 0.05em;
}
.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.section-sub {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.report-body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
}
.report-body p { margin: 0 0 14px; color: #d4dad7; }
.report-body strong { color: var(--text); font-weight: 700; }
.report-body em {
  font-style: normal;
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-soft);
  padding: 1px 6px;
  border-radius: 3px;
}

.diag-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.diag-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.diag-card.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(20,224,122,0.06), var(--surface-1));
}
.diag-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.diag-card.primary .diag-card-label { color: var(--primary); }
.diag-card-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.diag-card-detail {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}
.diag-card-conf {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}
.conf-bar {
  flex: 1;
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  margin: 0 10px;
  overflow: hidden;
}
.conf-bar-fill {
  height: 100%;
  background: var(--primary);
}

.tx-step {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.tx-step:last-child { border-bottom: none; }
.tx-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
  font-family: 'JetBrains Mono', monospace;
}
.tx-step.priority .tx-num { background: var(--primary); color: #062813; }
.tx-content { flex: 1; }
.tx-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tx-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--primary-soft);
  color: var(--primary);
}
.tx-tag.warn { background: rgba(245,179,36,0.12); color: var(--warning); }
.tx-detail { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.tx-meta {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}

.exam-list { display: grid; gap: 8px; }
.exam-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background .15s;
}
.exam-item:hover { background: var(--surface-2); }
.exam-priority {
  width: 4px;
  height: 32px;
  border-radius: 2px;
  background: var(--text-4);
  flex: none;
}
.exam-priority.high { background: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }
.exam-priority.med { background: var(--warning); }
.exam-name {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}
.exam-purpose {
  font-size: 12px;
  color: var(--text-2);
  flex: 1;
}
.exam-tag {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.review-col h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-col h4::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
}
.review-col.pos h4::before { background: var(--primary); }
.review-col.neg h4::before { background: var(--warning); }
.review-item {
  padding: 10px 12px;
  border-left: 2px solid var(--border-strong);
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}
.review-col.pos .review-item { border-left-color: var(--primary); }
.review-col.neg .review-item { border-left-color: var(--warning); }
.review-item b { color: var(--text); font-weight: 700; }

/* Report footer / export */
.report-export {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 32px;
}
.export-text { flex: 1; }
.export-text h3 {
  font-size: 14px; font-weight: 700; margin: 0 0 4px;
}
.export-text p {
  font-size: 12px; color: var(--text-2); margin: 0;
}

/* Skeleton / typing effect */
.cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--primary);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Sources / cite chips inline in report */
.cite {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-2);
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: 2px;
  cursor: pointer;
  border: 1px solid var(--border);
}
.cite:hover { color: var(--primary); border-color: var(--primary); }

/* upload progress modal indicator */
.upload-progress {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-1);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.upload-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  margin-bottom: 8px;
}
.upload-row:last-child { margin-bottom: 0; }
.upload-row .name { flex: 1; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.upload-row .pct { color: var(--primary); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.up-bar {
  height: 2px; background: var(--surface-2); border-radius: 1px; overflow: hidden;
}
.up-bar-fill { height: 100%; background: var(--primary); transition: width .3s; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 8, 6, 0.72);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: grid;
  place-items: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: slideUp .2s ease;
}
.modal.lg { width: 880px; }
.modal.xl { width: 1140px; height: 720px; }

.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title .badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-3);
  background: var(--surface-2);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-0);
  flex: none;
}
.modal-foot .spacer { flex: 1; }

/* ============ FORM ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field-block label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.field-input {
  width: 100%;
  height: 38px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.field-input:focus { border-color: var(--primary); }
.field-input::placeholder { color: var(--text-3); }
.field-textarea {
  min-height: 80px;
  padding: 10px 12px;
  height: auto;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.field-radio {
  display: flex; gap: 8px;
}
.field-radio button {
  flex: 1;
  height: 38px;
  background: var(--surface-2);
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-2);
  border: 1px solid transparent;
  transition: all .15s;
}
.field-radio button.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

/* ============ DROPZONE LARGE ============ */
.dropzone-lg {
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 16px;
  transition: all .15s;
  cursor: pointer;
}
.dropzone-lg.over,
.dropzone-lg:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.dropzone-lg svg { display: block; margin: 0 auto 10px; }
.dropzone-lg .hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-4);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.upload-list { display: grid; gap: 8px; }
.upload-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 12px;
}
.upload-list-icon {
  width: 32px; height: 32px;
  border-radius: 4px;
  flex: none;
  display: grid; place-items: center;
  font-size: 9px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}
.upload-list-icon.img { background: linear-gradient(135deg, #4a5550, #1a201d); color: var(--text-2); }
.upload-list-icon.pdf { background: rgba(242,73,92,0.12); color: var(--error); }
.upload-list-icon.doc { background: rgba(79,183,240,0.12); color: var(--info); }
.upload-list-name { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); }
.upload-list-size { color: var(--text-3); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.upload-list-status { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.upload-list-status.uploading { background: var(--surface-3); color: var(--text-2); }
.upload-list-status.ocr { background: rgba(245,179,36,0.12); color: var(--warning); }
.upload-list-status.done { background: var(--primary-soft); color: var(--primary); }

/* ============ SKELETON / GENERATING ============ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 0%, var(--surface-2) 50%, var(--surface-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton.line { height: 14px; margin-bottom: 8px; }
.skeleton.line.w90 { width: 90%; }
.skeleton.line.w70 { width: 70%; }
.skeleton.line.w50 { width: 50%; }

.gen-status {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(90deg, var(--primary-soft), transparent 80%);
  border: 1px solid var(--primary);
  border-radius: 8px;
  margin-bottom: 24px;
}
.gen-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(20,224,122,0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-text { flex: 1; }
.gen-text-main { font-size: 13px; font-weight: 700; color: var(--primary); }
.gen-text-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.gen-progress {
  width: 120px; height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.gen-progress-fill { height: 100%; background: var(--primary); transition: width .3s; }

/* ============ SLIDE DECK ============ */
.slide-stage {
  flex: 1;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.slide-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-0);
  flex: none;
}
.slide-toolbar .pager {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
}
.slide-stage-canvas {
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}
.slide {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.slide-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}
.slide h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 20px;
}
.slide h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.slide-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.slide-cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.slide-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}
.slide-card.primary { border-color: var(--primary); background: linear-gradient(135deg, rgba(20,224,122,0.08), var(--surface-2)); }
.slide-card-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.slide-card.primary .slide-card-num { color: var(--primary); }
.slide-card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.slide-card-detail { font-size: 12px; color: var(--text-2); line-height: 1.6; }

.slide-bullets {
  list-style: none;
  padding: 0; margin: 0;
  display: grid; gap: 12px;
}
.slide-bullets li {
  display: flex; gap: 12px;
  font-size: 15px;
  line-height: 1.5;
}
.slide-bullets li::before {
  content: '';
  width: 8px; height: 8px; flex: none;
  background: var(--primary);
  border-radius: 50%;
  margin-top: 8px;
}
.slide-bullets li b { font-weight: 700; }

/* ============ PDF PREVIEW ============ */
.pdf-preview {
  background: #f5f3ee;
  color: #1a1a1a;
  padding: 56px 64px;
  font-family: 'DM Sans', serif;
  border-radius: 4px;
  width: 100%;
  min-height: 100%;
  font-size: 12px;
  line-height: 1.6;
}
.pdf-preview h1 {
  font-size: 22px; margin: 0 0 8px;
  font-weight: 800; letter-spacing: -0.01em;
}
.pdf-preview .pdf-sub {
  font-size: 11px; color: #666; margin-bottom: 24px;
  border-bottom: 2px solid #1DB954; padding-bottom: 12px;
  display: flex; justify-content: space-between;
}
.pdf-preview h2 {
  font-size: 14px; font-weight: 700; margin: 20px 0 8px;
  background: #0A0F0D; color: #fff; padding: 6px 10px;
  display: inline-block; letter-spacing: 0.04em;
}
.pdf-preview p { margin: 6px 0; }
.pdf-preview .pdf-table {
  width: 100%; border-collapse: collapse; margin: 8px 0 16px;
  font-size: 11px;
}
.pdf-preview .pdf-table th,
.pdf-preview .pdf-table td {
  border: 1px solid #d0cdc6;
  padding: 6px 10px;
  text-align: left;
}
.pdf-preview .pdf-table th { background: #ebe7de; font-weight: 700; }
.pdf-preview .pdf-foot {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid #d0cdc6;
  display: flex; justify-content: space-between;
  font-size: 10px; color: #666;
}

/* ============ COMMAND PALETTE ============ */
.cmdk {
  width: 540px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: slideUp .15s ease;
}
.cmdk-input {
  width: 100%;
  height: 48px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.cmdk-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0;
}
.cmdk-section {
  padding: 8px 18px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.cmdk-item {
  padding: 8px 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  cursor: pointer;
}
.cmdk-item:hover, .cmdk-item.sel { background: var(--surface-2); }
.cmdk-item .desc { color: var(--text-3); margin-left: auto; font-size: 11px; }
.cmdk-foot {
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-3);
  display: flex; gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface-0);
}
.kbd {
  display: inline-block;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
  margin: 0 2px;
}

/* ============ TOAST ============ */
.toast-stack {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideUp .2s ease;
  pointer-events: auto;
}
.toast b { color: var(--primary); }
.toast .toast-sub { color: var(--text-3); font-size: 11px; margin-top: 2px; }
