/* ── Reset & Tokens ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --teal: #1a6b63;
  --teal-light: #2a8a80;
  --teal-pale: #e8f5f4;
  --teal-rule: #b2d8d4;
  --navy: #0f2a38;
  --amber: #c8783a;
  --amber-pale: #fdf3eb;
  --red-pale: #fef2f2;
  --red: #c0392b;
  --green-pale: #f0faf5;
  --green: #1e7a4a;
  --mid: #64748b;
  --light: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafb;
  --white: #ffffff;
  --text: #1e293b;
  --text-2: #475569;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .07), 0 1px 4px rgba(0, 0, 0, .05);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .10);
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 15px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────── */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-img {
  height: 48px;
  width: auto;
}

.logo-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

.logo-label {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.logo-label span {
  color: var(--teal);
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--mid);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-link.active {
  background: var(--teal-pale);
  color: var(--teal);
  font-weight: 600;
}

.nav-link.highlight {
  background: var(--teal);
  color: var(--white);
  font-weight: 700;
  border-radius: 20px;
  padding: 6px 16px;
  box-shadow: 0 2px 8px rgba(26, 107, 99, .30);
}

.nav-link.highlight:hover {
  background: var(--teal-light);
  color: var(--white);
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid #a7f3d0;
  background: var(--green-pale);
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: 8px;
}

.server-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .4;
  }
}

/* ── Breadcrumb ──────────────────────────────────────────────────────── */
.breadcrumb {
  padding: 18px 0 4px;
  font-size: 0.78rem;
  color: var(--light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a {
  color: var(--teal);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  color: var(--border);
}

/* ── Page layout ─────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1.5rem 4rem;
}

.page-head {
  padding: 8px 0 24px;
}

.page-head h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 6px;
}

.page-head p {
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 300;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  overflow-x: auto;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.2rem;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-num.done {
  background: var(--green);
}

.step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem;
}

.tab {
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--mid);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.tab:hover:not(.active) {
  color: var(--text);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Form elements ───────────────────────────────────────────────────── */
label.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 6px;
}

input[type=text],
input[type=url],
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input[type=text]:focus,
input[type=url]:focus,
select:focus {
  border-color: var(--teal-light);
  box-shadow: 0 0 0 3px rgba(26, 107, 99, .1);
}

input::placeholder {
  color: var(--light);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--light);
  margin-top: 5px;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
  line-height: 1;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--mid);
}

.drop-zone strong {
  color: var(--teal);
}

.file-chosen {
  display: none;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--teal-pale);
  border: 1px solid var(--teal-rule);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--teal);
  font-family: 'DM Mono', monospace;
  word-break: break-all;
}

.file-chosen.visible {
  display: block;
}

/* option pills */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1rem;
}

.option-pill {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  user-select: none;
}

.option-pill input[type=checkbox] {
  display: none;
}

.option-pill.checked {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.pill-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.pill-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.pill-desc {
  font-size: 0.75rem;
  color: var(--mid);
  margin-top: 2px;
}

.sub-option {
  display: none;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sub-option.visible {
  display: block;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--teal-light);
}

.btn-secondary {
  background: var(--white);
  color: var(--teal);
  border: 1.5px solid var(--teal-rule);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--teal-pale);
}

.btn-amber {
  background: var(--amber-pale);
  color: var(--amber);
  border: 1.5px solid #f0c49a;
}

.btn-amber:hover:not(:disabled) {
  background: #fde8d4;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Status banner ───────────────────────────────────────────────────── */
.status-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-banner.visible {
  display: flex;
}

.status-banner.uploading {
  background: var(--teal-pale);
  color: var(--teal);
  border: 1px solid var(--teal-rule);
}

.status-banner.success {
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid #a7f3d0;
}

.status-banner.error {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid #fca5a5;
}

.status-banner.running {
  background: var(--amber-pale);
  color: var(--amber);
  border: 1px solid #f0c49a;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Terminal ────────────────────────────────────────────────────────── */
.terminal-wrap {
  display: none;
  margin-top: 0;
}

.terminal-wrap.visible {
  display: block;
}

.terminal-header {
  background: var(--navy);
  border-radius: 8px 8px 0 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dots span:nth-child(1) {
  background: #ff5f57;
}

.terminal-dots span:nth-child(2) {
  background: #febc2e;
}

.terminal-dots span:nth-child(3) {
  background: #28c840;
}

.terminal-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, .4);
}

.terminal-body {
  background: #0f1923;
  border-radius: 0 0 8px 8px;
  padding: 14px 16px;
  height: 340px;
  overflow-y: auto;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  color: #c9d1d9;
  scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: #2d3f50;
  border-radius: 3px;
}

.log-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line.info {
  color: #c9d1d9;
}

.log-line.ok {
  color: #56d364;
}

.log-line.warn {
  color: #e3b341;
}

.log-line.err {
  color: #f85149;
}

.log-line.dim {
  color: #4d6474;
}

.log-line.cmd {
  color: #79c0ff;
}

.log-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: #c9d1d9;
  animation: blink 1.1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 1px;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* ── Result badge ────────────────────────────────────────────────────── */
.result-badge {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.result-badge.visible {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-badge.success {
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid #a7f3d0;
}

.result-badge.error {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid #fca5a5;
}

.result-badge .icon {
  font-size: 1.1rem;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 14px 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--light);
  background: var(--white);
}

/* ── Divider ─────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

/* ── Home page ───────────────────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 4rem 1rem 3rem;
}

.home-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.home-hero h1 span {
  color: var(--teal);
}

.home-hero p {
  font-size: 1rem;
  color: var(--text-2);
  font-weight: 300;
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-hero {
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-hero:active {
  transform: scale(0.98);
}

.btn-hero.primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 4px 14px rgba(26, 107, 99, .35);
}

.btn-hero.primary:hover {
  background: var(--teal-light);
  box-shadow: 0 6px 20px rgba(26, 107, 99, .45);
  transform: translateY(-1px);
}

.btn-hero.secondary {
  background: var(--white);
  color: var(--teal);
  border: 2px solid var(--teal-rule);
}

.btn-hero.secondary:hover {
  background: var(--teal-pale);
  transform: translateY(-1px);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  padding-bottom: 3rem;
}

.feature-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.feature-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--teal-pale);
  display: block;
}

.feature-card-img-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, var(--teal-pale) 0%, #d0eeeb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.feature-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.feature-card-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 6px;
}

.feature-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.3;
}

.feature-card-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.6;
  flex: 1;
}

.feature-card-cta {
  margin-top: 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Scans & Reports shared table ────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: fixed;
}

.data-table th {
  text-align: left;
  padding: 10px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mid);
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow: hidden;
  word-break: break-word;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg);
}

.case-id {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--navy);
}

.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  margin-top: 5px;
  line-height: 1.6;
}

.source-tag.tag-3ddx {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.source-tag.tag-external {
  background: #fff7ed;
  color: #d47a0c;
  border: 1px solid #fdba74;
}

.scan-meta-line {
  font-size: 0.79rem;
  color: var(--light);
  margin-top: 3px;
  line-height: 1.6;
}

.scan-meta-line b {
  font-weight: 500;
  color: var(--mid);
}

.artifact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.artifact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  white-space: normal;
}

.artifact-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--teal-pale);
  color: var(--teal);
  border: 1px solid var(--teal-rule);
}

.artifact-chip.report {
  background: #fdf3eb;
  color: var(--amber);
  border-color: #f0c49a;
}

.artifact-chip.volume {
  background: #f0f4ff;
  color: #3b5bdb;
  border-color: #bac8ff;
}

.artifact-chip.seg {
  background: #f3f0ff;
  color: #6741d9;
  border-color: #c5b8f8;
}

.artifact-chip.anatomy {
  background: #fff0f6;
  color: #c2255c;
  border-color: #f9a8d4;
}

.artifact-chip.registration {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

.artifact-chip.file {
  background: var(--bg);
  color: var(--mid);
  border-color: var(--border);
}

.artifact-chip.word {
  background: #fdf3eb;
  color: var(--amber);
  border-color: #f0c49a;
}

.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--teal);
  color: #fff;
  white-space: nowrap;
  transition: background var(--transition);
  text-decoration: none;
}

.btn-dl:hover {
  background: var(--teal-light);
}

.btn-dl.secondary {
  background: var(--white);
  color: var(--teal);
  border: 1.5px solid var(--teal-rule);
}

.btn-dl.secondary:hover {
  background: var(--teal-pale);
}

.btn-dl.amber {
  background: var(--amber-pale);
  color: var(--amber);
  border: 1.5px solid #f0c49a;
}

.btn-dl.amber:hover {
  background: #fde8d4;
}

.word-preview-table-wrap {
  margin-top: 1rem;
}

.word-preview-table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1rem;
}

.word-preview-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--text);
}

.word-preview-table td:first-child {
  font-weight: 600;
  background: var(--bg);
}

.word-preview-content p,
.word-preview-content h1,
.word-preview-content h2,
.word-preview-content h3 {
  margin: 0 0 0.9rem;
  line-height: 1.5;
}

.size-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--light);
  margin-left: 3px;
}

.no-scan {
  color: var(--light);
  font-size: 0.8rem;
  font-style: italic;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--mid);
}

.empty-state .icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stat-chip {
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.stat-chip span {
  color: var(--teal);
  font-family: 'DM Mono', monospace;
}

.page-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0 24px;
}

.page-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Run modal (scans page) ──────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 56, .55);
  backdrop-filter: blur(3px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 2rem;
  width: 560px;
  max-width: 95vw;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--mid);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── DWV viewer ─────────────────────────────────────────────────────── */
#dwv-root {
  color-scheme: dark;
}

#dwv-root canvas {
  position: absolute;
  top: 0;
  left: 0;
}

#dwv-root .layerGroup {
  width: 100% !important;
  height: 100% !important;
}

/* ── Cornerstone viewport ───────────────────────────────────────── */
#cs-viewport {
  display: block;
}

#cs-viewport canvas {
  position: absolute;
  top: 0;
  left: 0;
}

#cs-toolbar .btn-primary {
  background: var(--teal);
  color: #fff;
}

/* ── Pathology Report Viewer ─────────────────────────────────────────── */
.pathology-finding {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.finding-header {
  padding: 10px 16px;
  background: var(--amber-pale);
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #f0c49a;
}

.finding-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.finding-images img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  background: #000;
  cursor: zoom-in;
  transition: opacity var(--transition);
}

.finding-images img:hover {
  opacity: 0.85;
}

.finding-images img+img {
  border-left: 1px solid var(--border);
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  header {
    padding: 0 1rem;
  }

  nav .nav-link {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
}


/* ── Login Page ──────────────────────────────────────────────────────── */
body.login-page {
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-split {
  display: flex;
  width: 100%;
  max-width: 1100px;
  min-height: 620px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .45);
}

/* ── Left image panel ─────────────────────────────────────────────────── */
.login-panel-left {
  flex: 1.1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.login-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.4) saturate(1.2);
}

.login-panel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(15, 42, 56, .6) 0%, rgba(26, 107, 99, .55) 100%);
}

.login-panel-content {
  position: relative;
  z-index: 1;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.login-panel-logo-img {
  height: 52px;
  width: auto;
  filter: brightness(0) invert(1);
}

.login-panel-tagline {
  margin-top: auto;
  padding-bottom: 1.5rem;
}

.login-panel-tagline h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2.6rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.login-panel-tagline p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, .7);
  line-height: 1.7;
  max-width: 380px;
}

.login-panel-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 2rem;
}

.login-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(4px);
}

/* ── Right form panel ─────────────────────────────────────────────────── */
.login-panel-right {
  width: 460px;
  flex-shrink: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 3rem;
  position: relative;
}

/* subtle teal glow top-right corner */
.login-panel-right::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(26, 107, 99, .12) 0%, transparent 70%);
  pointer-events: none;
}

.login-form-wrap {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* logo + wordmark row */
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2.75rem;
}

.login-brand .logo-img {
  height: 40px;
  width: auto;
}

.login-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.login-brand-name span {
  color: var(--teal);
}

/* heading block */
.login-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 8px;
}

.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 10px;
}

.login-subtitle {
  font-size: 0.84rem;
  color: var(--mid);
  line-height: 1.65;
  margin-bottom: 2.25rem;
}

/* error */
.login-error {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
}

/* google button wrapper */
#google-btn-container {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 2rem;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .08));
}

/* divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  color: var(--light);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* footer note */
.login-footer-note {
  font-size: 0.72rem;
  color: var(--light);
  text-align: center;
  line-height: 1.6;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  body.login-page {
    padding: 0;
  }

  .login-split {
    border-radius: 0;
    min-height: 100vh;
  }

  .login-panel-left {
    display: none;
  }

  .login-panel-right {
    width: 100%;
    padding: 2.5rem 1.5rem;
  }
}


/* ── Home page animations ────────────────────────────────────────────── */
.welcome-splash {
  text-align: center;
  padding: 3.5rem 1rem 1rem;
  opacity: 0;
  transform: translateY(18px);
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

.welcome-greeting {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 10px;
  opacity: 0;
  /* ── SPEED: greeting fade-in → (duration) (delay) ── */
  animation: fadeUp 0.5s ease 0.35s forwards;
}

.welcome-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 14px;
}

.welcome-name .typed-name {
  color: var(--teal);
}

@keyframes blink-caret {

  0%,
  100% {
    border-color: var(--teal);
  }

  50% {
    border-color: transparent;
  }
}

.welcome-sub {
  font-size: 0.95rem;
  color: var(--text-2);
  font-weight: 300;
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.7;
  opacity: 0;
  /* ── SPEED: subtitle fade-in → (duration) (delay) ── */
  animation: fadeUp 0.5s ease 0.9s forwards;
}

.hero-actions {
  opacity: 0;
  /* ── SPEED: CTA buttons fade-in → (duration) (delay) ── */
  animation: fadeUp 0.5s ease 1.1s forwards;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.explore-label {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--light);
  margin: 2.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  /* ── SPEED: explore label fade-in → (duration) (delay) ── */
  animation: fadeUp 0.5s ease 1.3s forwards;
}

.explore-label::before,
.explore-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Feature cards staggered entrance ───────────────────────────── */
.feature-grid .feature-card {
  opacity: 0;
  transform: translateY(20px);
}

/* ── SPEED: feature cards stagger → adjust delay gap between each ── */
.feature-grid .feature-card:nth-child(1) {
  animation: fadeUp 0.55s ease 1.4s forwards;
}

.feature-grid .feature-card:nth-child(2) {
  animation: fadeUp 0.55s ease 1.55s forwards;
}

.feature-grid .feature-card:nth-child(3) {
  animation: fadeUp 0.55s ease 1.7s forwards;
}


/* ── Page transitions ────────────────────────────────────────────────── */
body {
  animation: pageFadeIn 0.15s ease forwards;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.page-leaving {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.1s ease, transform 0.1s ease;
  pointer-events: none;
}