

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── BLOCKQUOTE ── */
blockquote {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 3px solid var(--cyan);
	border-radius: 0 var(--r2) var(--r2) 0;
	padding: 20px 24px;
	margin: 2.5rem 0;
	position: relative;
	overflow: hidden;
}

blockquote::before {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0; height: 1px;
	background: linear-gradient(90deg, var(--cyan2), transparent);
}

blockquote > :is(h1, h2, h3, h4, h5, h6):first-child {
	padding-top: 0;
	margin-top: 0;
}

blockquote p, blockquote li {
	color: var(--text-muted);
	font-size: 0.95rem;
	line-height: 1.7;
	margin: 0.3rem 0;
}



body[data-theme="light"] {
  --bg: #f3f7fc;
  --surface: #ffffff;
  --surface2: #edf3fa;
  --surface3: #dfe8f2;
  --border: #d5e1ee;
  --border2: #c1d3e4;
  --text: #000000;
  --text-muted: #222222;
  --text-dim: #333333;
  --cyan3: #cfeefe;
}

body[data-theme="light"]::before {
  background-image:
    linear-gradient(rgba(0, 120, 160, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 120, 160, 0.04) 1px, transparent 1px);
}

body[data-theme="light"] .header-text h1 {
  color: #0c1b2f;
}

body[data-theme="light"] .drop-btn:hover {
  color: #0c1b2f;
}

/* ─── INTRO ─── */
.intro-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.intro-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan2), transparent);
}


.intro-section h2::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--cyan);
}

.intro-section p {
  color: var(--text);
  font-size: 16px;
  line-height: 2.2;
  max-width: 900px;
}

.intro-section p + p { margin-top: 10px; }

.intro-section strong { color: var(--cyan); font-weight: 600; }

.intro-terms {
  display: flex;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.intro-term {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 16px;
}

.intro-term strong { font-family: var(--font-mono); color: var(--cyan); font-weight: 500; display: block; }
.intro-term span { color: var(--text-muted); }

/* ─── UPLOAD ZONE ─── */
.upload-section { margin-bottom: 28px; }


#dropZone {
  border: 2px dashed var(--border2);
  border-radius: var(--r);
  background: var(--surface);
  padding: 52px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#dropZone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,216,255,0.03) 0%, transparent 70%);
  transition: opacity 0.3s;
}

#dropZone:hover, #dropZone.drag-over {
  border-color: var(--cyan2);
  background: var(--surface2);
}

#dropZone:hover::before, #dropZone.drag-over::before {
  background: radial-gradient(ellipse at center, rgba(0,216,255,0.08) 0%, transparent 70%);
}

#dropZone.drag-over { border-color: var(--cyan); }

.drop-icon {
  width: 56px; height: 56px;
  margin: 0 auto 20px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}

#dropZone:hover .drop-icon { background: var(--cyan3); border-color: var(--cyan2); }
.drop-icon svg { width: 26px; height: 26px; color: var(--cyan); }

.drop-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.drop-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.drop-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--cyan3), rgba(0,130,180,0.4));
  border: 1px solid var(--cyan2);
  color: var(--cyan);
  padding: 10px 22px;
  border-radius: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.drop-btn:hover { background: linear-gradient(135deg, var(--cyan2), var(--cyan3)); color: #fff; }

#fileInput { display: none; }

/* File chips */
.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.file-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 6px 12px 6px 10px;
  font-size: 12px;
  color: var(--text);
  animation: fadeIn 0.3s ease;
}

.file-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.file-chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; line-height: 1;
  padding: 0 2px; transition: color 0.2s;
}
.file-chip-remove:hover { color: var(--red); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ─── RESULTS ─── */
#results { display: none; }
#results.visible { display: block; animation: fadeIn 0.5s ease; }

/* Study tabs */
.study-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.study-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: var(--font-body);
  font-weight: 500;
}

.study-tab:hover { border-color: var(--border2); color: var(--text); }

.study-tab.active {
  border-color: var(--cyan2);
  color: var(--cyan);
  background: var(--surface2);
}

.study-tab-dot { width: 8px; height: 8px; border-radius: 50%; }

.compare-btn {
  margin-left: auto;
  padding: 8px 18px;
  background: var(--surface2);
  border: 1px solid var(--orange2);
  color: var(--orange);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.5px;
  transition: all 0.2s;
}

.compare-btn:hover { background: rgba(255,124,53,0.15); }
.compare-btn.active { background: rgba(255,124,53,0.2); border-color: var(--orange); }

/* Info cards row */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.card:hover { border-color: var(--border2); }

.card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}

.card-label-dot {
  width: 6px; height: 6px; border-radius: 50%;
}

.card-rows { display: flex; flex-direction: column; gap: 6px; }

.card-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
}

.card-row-key { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

.card-row-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* Dose summary bar */
.dose-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dose-summary::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--cyan2), transparent);
}

.dose-summary-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.dose-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}

.dose-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dose-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.dose-metric-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.1;
}

.dose-metric-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.dose-cyan { color: var(--cyan); }
.dose-orange { color: var(--orange); }
.dose-green { color: var(--green); }
.dose-purple { color: var(--purple); }
.dose-yellow { color: var(--yellow); }

.dose-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

/* Charts grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}

.chart-card-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}

.chart-card-title-accent {
  width: 3px; height: 14px;
  background: var(--cyan);
  border-radius: 2px;
}

.chart-card-title-accent.orange { background: var(--orange); }
.chart-card-title-accent.green { background: var(--green); }

.chart-wrap { position: relative; width: 100%; }

.chart-full { grid-column: 1 / -1; }

/* Events table */
.events-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 24px;
}

.events-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.events-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.events-count {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--yellow);
}

.events-table-wrap { overflow-x: auto; }

.events-table {
  width: 100%;
  border-collapse: collapse;
}

.events-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--green);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.events-table td {
  padding: 10px 16px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}

.events-table tbody tr:hover { background: var(--surface2); }
.events-table tbody tr:last-child td { border-bottom: none; }

.ev-type-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.ev-fluoro { background: rgba(0,216,255,0.1); color: var(--cyan); border: 1px solid var(--cyan3); }
.ev-acq { background: rgba(255,124,53,0.1); color: var(--orange); border: 1px solid var(--orange2); }

.dose-bar-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.dose-bar-bg { flex: 1; height: 4px; background: var(--surface3); border-radius: 2px; min-width: 60px; }
.dose-bar-fill { height: 100%; border-radius: 2px; transition: width 0.8s ease; }
.dose-bar-fluoro { background: linear-gradient(90deg, var(--cyan3), var(--cyan)); }
.dose-bar-acq { background: linear-gradient(90deg, var(--orange2), var(--orange)); }

/* Tags table */
.tags-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 24px;
}

.tags-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

.tags-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tags-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 7px 14px;
  width: 280px;
}

.tags-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.tags-search input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; font-family: var(--font-body); width: 100%;
}

.tags-search input::placeholder { color: var(--text-muted); }

.tags-table-wrap { overflow-y: auto; max-height: 400px; }

.tags-table {
  width: 100%;
  border-collapse: collapse;
}

.tags-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  /* color: var(--green); */
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}

.tags-table td {
  padding: 8px 16px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tags-table td:first-child { font-family: var(--font-mono); color: var(--cyan); font-size: 11px; }
.tags-table td:nth-child(2) { color: var(--text-muted); }
.tags-table td:nth-child(3) { font-family: var(--font-mono); color: var(--yellow); font-size: 11px; }
.tags-table td:last-child { color: var(--text); word-break: break-all; max-width: 400px; }

.tags-table tbody tr:hover { background: var(--surface2); }
.tags-table tbody tr:last-child td { border-bottom: none; }

/* Comparison view */
#compareView { display: none; }
#compareView.visible { display: block; animation: fadeIn 0.4s ease; }

.compare-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 24px;
}

.compare-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.compare-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.compare-chart-wrap { padding: 24px; }

/* Download bar */
.download-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dl-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  text-decoration: none;
}

.dl-btn-pdf {
  background: rgba(176,128,255,0.1);
  border: 1px solid rgba(176,128,255,0.4);
  color: var(--purple);
}

.dl-btn-pdf:hover { background: rgba(176,128,255,0.2); border-color: var(--purple); }

.dl-btn-txt {
  background: rgba(0,216,255,0.05);
  border: 1px solid var(--border2);
  color: var(--cyan);
}

.dl-btn-txt:hover { background: rgba(0,216,255,0.12); border-color: var(--cyan2); }

.dl-btn svg { width: 16px; height: 16px; }

/* Empty state / loading */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

.loading-spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Tooltip */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 5px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
[data-tip]:hover::after { opacity: 1; }

/* Risk badge */
.risk-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.risk-low { background: rgba(61,255,184,0.1); color: var(--green); border: 1px solid rgba(61,255,184,0.3); }
.risk-med { background: rgba(255,223,80,0.1); color: var(--yellow); border: 1px solid rgba(255,223,80,0.3); }
.risk-high { background: rgba(255,69,96,0.1); color: var(--red); border: 1px solid rgba(255,69,96,0.3); }

/* Section divider */
.section-divider {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
}

.section-divider h2 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.section-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan3); }

/* Responsive */
@media (max-width: 640px) {
  .charts-grid { grid-template-columns: 1fr; }
  .dose-metrics { grid-template-columns: repeat(2, 1fr); }
  .tags-search { width: 100%; }
}