:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1a1f25;
  --border: #232a32;
  --text: #d6dde5;
  --muted: #7d8894;
  --accent: #4aa3ff;
  --warn: #f0b429;
  --danger: #ef4444;
  --ok: #22c55e;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: 46px;
}
.brand { font-weight: 600; color: var(--accent); letter-spacing: 0.04em; }
.study-meta { color: var(--muted); flex: 1; }
.actions { display: flex; gap: 8px; }

.layout {
  display: grid;
  grid-template-columns: 240px 1fr 380px;
  height: calc(100vh - 46px);
}

.sidebar, .report-pane {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.report-pane { border-right: none; border-left: 1px solid var(--border); }

.pane-title {
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}

.series-list { padding: 6px; }
.series-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; margin-bottom: 4px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}
.series-item:hover { background: var(--panel-2); }
.series-item.active { background: var(--panel-2); border-color: var(--accent); }
.series-item .desc { font-weight: 500; }
.series-item .sub { color: var(--muted); font-size: 11px; }

.viewer {
  display: flex; flex-direction: column;
  background: #000;
  min-width: 0;
}
.viewer-header {
  display: flex; align-items: center;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.viewer-header .spacer { flex: 1; }
.slice-label { color: var(--muted); font-variant-numeric: tabular-nums; }

.canvas-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}
#slice {
  max-width: 100%; max-height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
  background: #000;
}
.hud {
  position: absolute; bottom: 8px; left: 12px;
  font-family: ui-monospace, monospace;
  font-size: 11px; color: var(--muted);
  background: rgba(0,0,0,0.5);
  padding: 4px 8px; border-radius: 3px;
  pointer-events: none;
}

.viewer-controls {
  padding: 8px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.viewer-controls input[type=range] { width: 100%; }
.hint { font-size: 11px; color: var(--muted); text-align: center; }

.disclaimer {
  margin: 10px 12px;
  padding: 8px 10px;
  background: rgba(240, 180, 41, 0.1);
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 4px;
  font-size: 11px;
  color: var(--warn);
}
.report-toolbar {
  display: flex; gap: 6px;
  padding: 0 12px 8px;
}
.report-toolbar button { padding: 4px 10px; font-size: 12px; }

.report-status {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}
.report-body {
  padding: 0 14px 20px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.report-body h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 18px 0 6px;
  letter-spacing: 0.06em;
}
