/* Carlsmed spine segmentation POC
   Palette derived from the Carlsmed mark; capsules (the mark's building block)
   encode vertebral levels and pipeline stages. */

@font-face { font-family: "Bricolage Grotesque"; font-weight: 600; font-display: swap; src: url(../assets/fonts/bricolage-grotesque-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap; src: url(../assets/fonts/bricolage-grotesque-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(../assets/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(../assets/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(../assets/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(../assets/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(../assets/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  /* brand (sampled from the Carlsmed mark) */
  --blue: #1175AA;
  --blue-deep: #0B5A85;
  --blue-tint: #E7F1F8;
  --orange: #D04D1C;
  --orange-tint: #FBEDE6;
  --sage: #B0B27B;
  --sky: #88CFE7;
  --slate: #598BA7;
  --steel: #8B8D91;

  /* neutrals */
  --ink: #1D2B36;
  --ink-2: #4A5866;
  --ink-3: #7A8692;
  --paper: #F3F5F7;
  --card: #FFFFFF;
  --line: #DCE2E7;
  --line-soft: #E9EDF0;

  /* imaging stage */
  --stage: #0D1A24;
  --stage-2: #13263A;
  --stage-line: #22394C;
  --stage-text: #C6D3DD;
  --stage-dim: #7F93A3;

  --ok: #3E8E5A;
  --warn: #B7791F;
  --err: #B83A1A;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .05), 0 6px 24px -12px rgba(16, 32, 48, .18);
  --shadow-lg: 0 2px 4px rgba(16, 32, 48, .05), 0 24px 60px -24px rgba(16, 32, 48, .35);
  --wrap: 1520px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-deep); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(20px, 3vw, 48px); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.022em; margin: 0; line-height: 1.08; }
h1 { font-size: clamp(2.3rem, 4.4vw, 4rem); line-height: 1.02; letter-spacing: -.03em; }
h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); }
h3 { font-size: 1.12rem; letter-spacing: -.01em; }
p { margin: 0; }
.eyebrow {
  font: 500 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 10px;
}
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 36em; }
.muted { color: var(--ink-3); }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: 66px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); flex-shrink: 0; }
.brand img { height: 26px; width: auto; }
.brand-tag { font: 500 11px/1.2 var(--font-mono); color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; border-left: 1px solid var(--line); padding-left: 14px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { position: relative; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: 14px; transition: background .2s, color .2s; }
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--blue-tint); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.engine-badge { display: inline-flex; align-items: center; gap: 8px; font: 500 12px/1 var(--font-mono); color: var(--ink-2); padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; white-space: nowrap; }
.engine-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--orange-tint); }
.engine-badge.live i { background: var(--ok); box-shadow: 0 0 0 3px #E3F1E8; }
.engine-badge[hidden] { display: none; }
.topbar .menu-btn { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 42px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s, color .2s, transform .15s var(--ease), box-shadow .2s;
  text-decoration: none; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -8px rgba(17, 117, 170, .7); }
.btn-primary:hover { background: var(--blue-deep); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn-danger { background: #fff; border-color: #EBC9BD; color: var(--err); }
.btn-danger:hover { background: var(--orange-tint); border-color: var(--err); color: var(--err); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; transition: background .2s, border-color .2s; }
.icon-btn:hover { background: rgba(127, 147, 163, .14); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- capsules (signature) ---------- */
.capsule-row { display: flex; flex-wrap: wrap; gap: 6px; }
.capsule {
  --c: var(--steel);
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px 0 9px; border-radius: 999px;
  font: 500 12px/1 var(--font-mono); background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--c) 35%, #fff);
}
.capsule::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.capsule.solid { background: var(--c); color: #fff; border-color: transparent; }
.capsule.solid::before { background: rgba(255, 255, 255, .85); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font: 500 12px/1 var(--font-body); background: var(--line-soft); color: var(--ink-2); white-space: nowrap; }
.chip.sim { background: var(--orange-tint); color: #9A3A15; }
.chip.ref { background: var(--blue-tint); color: var(--blue-deep); }
.chip.ok { background: #E4F1E8; color: #2B6A41; }
.chip.run { background: #FFF3DE; color: #8A5A10; }
.chip.err { background: #F8E3DC; color: var(--err); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.run .dot { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* level picker (toggle capsules) */
.level-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.level-toggle {
  --c: var(--steel);
  height: 40px; min-width: 64px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; font: 600 14px/1 var(--font-mono); color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s var(--ease);
}
.level-toggle::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); transition: all .2s; }
.level-toggle[aria-pressed="true"] { border-color: var(--c); color: var(--ink); background: color-mix(in srgb, var(--c) 12%, #fff); }
.level-toggle[aria-pressed="true"]::before { background: var(--c); border-color: var(--c); }

/* ---------- layout pieces ---------- */
main { flex: 1; }
.page { padding-top: 40px; padding-bottom: 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .eyebrow { margin-bottom: 12px; }
.section { margin-top: 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--r-md); padding: 40px 28px; text-align: center; background: rgba(255, 255, 255, .6);
  display: grid; justify-items: center; gap: 14px; color: var(--ink-2);
}
.empty h3 { color: var(--ink); }

/* ---------- hero ---------- */
.hero { padding: 48px 0 8px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 4vw, 64px); align-items: center; }
.hero h1.hero-title { font-size: clamp(1.75rem, 2.35vw, 2.45rem); line-height: 1.12; letter-spacing: -.025em; max-width: 17em; }
.hero h1 em { font-style: normal; color: var(--blue); }
.hero .lede { margin-top: 22px; }
.hero-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.hero-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 28px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.hero-facts dt { font: 500 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.hero-facts dd { margin: 8px 0 0; font: 600 1.5rem/1 var(--font-display); letter-spacing: -.02em; }
.hero-facts dd small { font: 400 13px var(--font-body); color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }

/* ---------- imaging stage (dark) ---------- */
.stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden; color: var(--stage-text);
  background:
    radial-gradient(120% 90% at 70% 20%, #18324A 0%, rgba(24, 50, 74, 0) 60%),
    radial-gradient(80% 70% at 10% 100%, #102434 0%, rgba(16, 36, 52, 0) 70%),
    var(--stage);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.stage::after { /* faint scan grid */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: linear-gradient(rgba(136, 207, 231, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(136, 207, 231, .05) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.stage canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; }
.stage-hero { aspect-ratio: 7 / 6; min-height: 420px; }
.stage-overlay { position: absolute; z-index: 2; pointer-events: none; }
.stage-corner { font: 500 11px/1.5 var(--font-mono); color: var(--stage-dim); letter-spacing: .04em; }
.stage-corner.tl { top: 18px; left: 20px; }
.stage-corner.tr { top: 18px; right: 20px; text-align: right; }
.stage-corner b { color: var(--stage-text); font-weight: 500; }
.stage-labels { inset: 0; }
.stage-label {
  position: absolute; transform: translate(-50%, -50%); font: 600 12px/1 var(--font-mono); color: #fff; padding: 5px 9px 5px 7px;
  border-radius: 999px; background: rgba(13, 26, 36, .72); border: 1px solid rgba(255, 255, 255, .14); display: inline-flex; gap: 6px; align-items: center;
  opacity: 0; transition: opacity .35s; white-space: nowrap;
}
.stage-label i { width: 8px; height: 8px; border-radius: 50%; }
.stage-label.on { opacity: 1; }
/* sub-structure callouts (overview animation) */
.callout-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.callout-lines polyline { fill: none; stroke: rgba(220, 236, 247, .7); stroke-width: 1; }
.callout {
  position: absolute; transform: translate(0, -50%); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font: 500 11px/1 var(--font-mono); color: #fff; padding: 3px 4px 3px 6px; opacity: 0;
  text-shadow: 0 1px 3px rgba(8, 18, 26, .9);
}
.callout.left { transform: translate(-100%, -50%); flex-direction: row-reverse; padding: 3px 6px 3px 4px; }
.callout i { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px rgba(8, 18, 26, .6); }

/* phase track under the hero animation */
.phase-track { position: absolute; z-index: 2; left: 20px; right: 20px; bottom: 18px; display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 8px; }
.phase { display: grid; gap: 8px; font: 500 11px/1.2 var(--font-mono); color: var(--stage-dim); letter-spacing: .02em; transition: color .3s; }
.phase-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.phase-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c, var(--sky)); }
.phase.active { color: #fff; }
.stage-loading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; font: 500 12px var(--font-mono); color: var(--stage-dim); transition: opacity .5s; }
.stage-loading.done { opacity: 0; pointer-events: none; }

/* ---------- case cards ---------- */
.case-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s; color: var(--ink); }
.case-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--ink); }
.case-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--stage); display: grid; grid-template-columns: 1fr 1fr; gap: 2px; overflow: hidden; }
.case-thumb img { width: 100%; height: 100%; object-fit: cover; }
.case-thumb.single { grid-template-columns: 1fr; }
.case-thumb .thumb-render { width: 100%; height: 100%; display: grid; place-items: center; }
.case-thumb .levels { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 4px; }
.case-thumb .levels span { width: 22px; height: 8px; border-radius: 999px; background: var(--c); box-shadow: 0 0 0 1.5px rgba(13, 26, 36, .6); }
.case-body { padding: 18px 20px 20px; display: grid; gap: 10px; flex: 1; }
.case-body .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.case-stats { display: flex; gap: 18px; font: 400 12.5px/1.3 var(--font-mono); color: var(--ink-3); margin-top: auto; padding-top: 8px; }
.case-stats b { color: var(--ink); font-weight: 500; }

/* user case list */
.case-list { display: grid; gap: 10px; }
.case-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 12px 14px 12px 12px; }
.case-row .mini { width: 88px; height: 60px; border-radius: 10px; overflow: hidden; background: var(--stage); }
.case-row .mini img { width: 100%; height: 100%; object-fit: cover; }
.case-row h3 { font-size: 1rem; }
.case-row h3 a { color: var(--ink); }
.case-row h3 a:hover { color: var(--blue); }
.case-row .meta { font: 400 12.5px var(--font-mono); color: var(--ink-3); margin-top: 4px; }
.case-row .actions { display: flex; gap: 6px; }
.progress-inline { width: 120px; height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-inline span { display: block; height: 100%; background: var(--orange); border-radius: inherit; transition: width .4s; }

/* ---------- sub-structure class cards (home) ---------- */
.class-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.class-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.class-shot {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background:
    radial-gradient(70% 70% at 50% 45%, color-mix(in srgb, var(--c) 22%, transparent) 0%, transparent 70%),
    radial-gradient(120% 90% at 70% 15%, #18324A 0%, rgba(24, 50, 74, 0) 60%), var(--stage);
}
.class-shot::after { /* faint scan grid, like the 3D stages */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background-image: linear-gradient(rgba(136, 207, 231, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(136, 207, 231, .05) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: radial-gradient(ellipse at center, #000 25%, transparent 80%);
}
.class-shot img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.class-card:hover .class-shot img { transform: scale(1.05); }
.class-body { padding: 14px 16px 18px; border-top: 3px solid var(--c); flex: 1; }
.class-top { display: flex; align-items: center; gap: 8px; font: 500 11px var(--font-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.class-id { color: var(--ink); }
.class-code { margin-left: auto; padding: 2px 8px; border-radius: 999px; color: var(--ink); background: color-mix(in srgb, var(--c) 22%, #fff); }
.class-body h3 { margin: 10px 0 6px; font-size: 19px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
.class-body p { margin: 0; color: var(--ink-3); font-size: 13.5px; line-height: 1.5; }

/* ---------- structures legend ---------- */
.anatomy { display: grid; grid-template-columns: 1.1fr 2fr 1fr; gap: 20px; }
.anatomy .group { padding: 22px; }
.anatomy .group h3 { margin-bottom: 4px; }
.anatomy .group p { color: var(--ink-3); font-size: 13.5px; margin-bottom: 16px; }
.pairs { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px 14px; align-items: center; font-size: 14px; }
.pairs .hdr { font: 500 11px var(--font-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.swatch { display: inline-flex; align-items: center; gap: 9px; }
.swatch i { width: 26px; height: 10px; border-radius: 999px; background: var(--c); flex-shrink: 0; }
.stack { display: grid; gap: 10px; font-size: 14px; }

/* ---------- upload flow ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-3); font-weight: 500; font-size: 14px; }
.step b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--font-mono); background: var(--line-soft); color: var(--ink-3); }
.step.active { color: var(--ink); border-color: var(--blue); }
.step.active b { background: var(--blue); color: #fff; }
.step.done { color: var(--ink-2); }
.step.done b { background: var(--blue-tint); color: var(--blue); }

.dropzone {
  position: relative; display: grid; place-items: center; text-align: center; gap: 14px; padding: 64px 28px; cursor: pointer;
  border: 2px dashed #C6D1DA; border-radius: var(--r-lg); background: #fff; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: #F7FBFD; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--blue-tint); color: var(--blue); }
.dropzone .dz-icon svg { width: 30px; height: 30px; }
.dropzone h3 { font-size: 1.3rem; }
.dropzone p { color: var(--ink-3); }
.upload-progress { padding: 28px; display: grid; gap: 16px; }
.bar { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: inherit; transition: width .25s; }
.error-box { padding: 16px 18px; border-radius: var(--r-sm); background: #FBECE6; color: #8C2E12; border: 1px solid #F0CDBF; display: flex; gap: 12px; align-items: flex-start; }

.scan-review { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.slices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; background: var(--stage); border-radius: var(--r-md); overflow: hidden; }
.slices figure { margin: 0; position: relative; aspect-ratio: 1; display: grid; place-items: center; background: #000; }
.slices img { width: 100%; height: 100%; object-fit: contain; }
.slices figcaption { position: absolute; left: 10px; top: 9px; font: 500 10.5px var(--font-mono); color: var(--stage-dim); letter-spacing: .06em; text-transform: uppercase; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: 13.5px; text-align: right; }
.panel { padding: 24px; display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field label, .field .label { font-weight: 600; font-size: 13.5px; }
.field .hint { color: var(--ink-3); font-size: 13px; }
.input { height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }

/* ---------- processing ---------- */
.processing { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: stretch; }
.proc-panel { padding: 26px; display: grid; gap: 22px; align-content: start; }
.proc-overall { display: flex; align-items: baseline; justify-content: space-between; }
.proc-overall .pct { font: 600 2.6rem/1 var(--font-display); letter-spacing: -.03em; }
.proc-overall .pct small { font-size: 1.2rem; color: var(--ink-3); }
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stage-item { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--ink-3); transition: background .3s, color .3s; }
.stage-item .st-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); justify-self: center; transition: all .3s; }
.stage-item .st-name { font-weight: 500; font-size: 14px; }
.stage-item .st-msg { display: block; font: 400 12px var(--font-mono); color: var(--ink-3); margin-top: 3px; min-height: 1em; }
.stage-item .st-bar { width: 84px; height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.stage-item .st-bar span { display: block; height: 100%; width: 0; background: var(--orange); border-radius: inherit; transition: width .3s; }
.stage-item.active { background: var(--orange-tint); color: var(--ink); }
.stage-item.active .st-dot { border-color: var(--orange); background: radial-gradient(circle, var(--orange) 40%, transparent 45%); animation: pulse 1.2s infinite; }
.stage-item.done { color: var(--ink-2); }
.stage-item.done .st-dot { background: var(--blue); border-color: var(--blue); }
.stage-item.done .st-bar span { background: var(--blue); }
.log { background: var(--stage); color: var(--stage-text); border-radius: var(--r-sm); padding: 14px 16px; font: 400 12px/1.7 var(--font-mono); max-height: 150px; overflow: auto; }
.log div { white-space: pre-wrap; }
.log time { color: var(--stage-dim); margin-right: 10px; }
.stage-proc { min-height: 520px; height: 100%; }

/* ---------- workspace (results) ---------- */
.ws-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.ws-head h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.ws-head .meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.ws-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--ink-3); margin-bottom: 14px; font-weight: 500; }
.back:hover { color: var(--ink); }
.back svg { width: 15px; height: 15px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-sm); background: var(--orange-tint); color: #7C2F12; font-size: 13.5px; margin-bottom: 18px; border: 1px solid #F1D3C5; }
.notice.info { background: var(--blue-tint); color: var(--blue-deep); border-color: #CFE2EF; }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { display: grid; gap: 14px; position: sticky; top: 86px; max-height: calc(100vh - 106px); overflow: auto; padding-bottom: 2px; }
.side .card { padding: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.side-head h3 { font-size: .98rem; }
.level-block { border-bottom: 1px solid var(--line-soft); }
.level-block:last-child { border-bottom: 0; }
.level-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; cursor: pointer; user-select: none; }
.level-row .lv { font: 600 13px var(--font-mono); display: inline-flex; align-items: center; gap: 8px; }
.level-row .lv i { width: 22px; height: 9px; border-radius: 999px; background: var(--c); }
.level-row .count { font: 400 12px var(--font-mono); color: var(--ink-3); }
.level-row .chev { margin-left: auto; transition: transform .2s; color: var(--ink-3); }
.level-block.open .chev { transform: rotate(90deg); }
.struct-list { display: none; padding: 0 8px 8px; }
.level-block.open .struct-list { display: block; }
.struct { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.struct:hover, .struct.hover { background: var(--paper); }
.struct.selected { background: var(--blue-tint); }
.struct .sw { width: 12px; height: 12px; border-radius: 4px; background: var(--c); justify-self: center; }
.struct.hidden .sw { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.struct.hidden .nm { color: var(--ink-3); }
.struct .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.struct .icon-btn { width: 28px; height: 28px; color: var(--ink-3); border-radius: 8px; }
.struct .icon-btn:hover { color: var(--ink); }
.struct .icon-btn svg { width: 15px; height: 15px; }
.toggle { appearance: none; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; }
.toggle:checked { background: var(--blue); border-color: var(--blue); }
.toggle:checked::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

.viewer-shell { display: grid; gap: 14px; }
.viewer { height: min(72vh, 760px); min-height: 460px; }
.viewer-toolbar { position: absolute; z-index: 4; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; flex-wrap: wrap; }
.viewer-toolbar > * { pointer-events: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(13, 26, 36, .78); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(8px); }
.seg button { height: 32px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; color: var(--stage-dim); font: 500 13px var(--font-body); cursor: pointer; transition: background .2s, color .2s; }
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); }
.tool-group { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(13, 26, 36, .78); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(8px); color: var(--stage-text); }
.tool-group .icon-btn { width: 32px; height: 32px; border-radius: 9px; }
.tool-group .icon-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .16); color: #fff; }
.view-presets { position: absolute; z-index: 4; left: 14px; bottom: 14px; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(13, 26, 36, .78); border: 1px solid rgba(255, 255, 255, .1); }
.view-presets button { height: 30px; padding: 0 10px; border: 0; background: transparent; color: var(--stage-dim); font: 500 11.5px var(--font-mono); border-radius: 8px; cursor: pointer; }
.view-presets button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.compare-labels { position: absolute; z-index: 3; inset: 0; pointer-events: none; display: none; }
.compare-labels.on { display: block; }
.compare-labels::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(255, 255, 255, .22); }
.compare-labels span { position: absolute; top: 64px; font: 500 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--stage-text); padding: 5px 10px; border-radius: 999px; background: rgba(13, 26, 36, .7); }
.compare-labels .l { left: 25%; transform: translateX(-50%); }
.compare-labels .r { left: 75%; transform: translateX(-50%); }
.tooltip { position: absolute; z-index: 5; pointer-events: none; padding: 7px 11px; border-radius: 10px; background: rgba(255, 255, 255, .96); color: var(--ink); font-size: 12.5px; box-shadow: var(--shadow); transform: translate(12px, 12px); display: none; white-space: nowrap; }
.tooltip b { font-weight: 600; }
.tooltip .mono { color: var(--ink-3); margin-left: 6px; }
.viewer-status { position: absolute; z-index: 4; right: 16px; bottom: 16px; font: 400 11.5px var(--font-mono); color: var(--stage-dim); text-align: right; }
.viewer-status .hint { display: block; opacity: .75; margin-bottom: 3px; }

.controls-card { padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 26px; align-items: end; }
.slider { display: grid; gap: 10px; }
.slider .top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; font-weight: 600; }
.slider .top output { font: 500 12.5px var(--font-mono); color: var(--ink-2); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--blue) var(--p, 0%), var(--line-soft) var(--p, 0%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line-soft); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--blue); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); margin-top: -6px; box-shadow: 0 2px 6px rgba(16, 32, 48, .2); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); }

.slices-strip { padding: 18px 20px; }
.slices-strip .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.slices-strip .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 3px; border-radius: var(--r-sm); overflow: hidden; background: #000; }
.slices-strip .pair img { width: 100%; height: 100%; object-fit: contain; background: #000; max-height: 340px; }

/* ---------- pipeline page ---------- */
.flow { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.flow-lane { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; font: 500 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 18px; }
.flow-lane::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.node { position: relative; padding: 18px 18px 16px; display: grid; gap: 8px; align-content: start; border-top: 4px solid var(--c, var(--line)); }
.node .k { font: 500 11px var(--font-mono); color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; display: flex; justify-content: space-between; }
.node h3 { font-size: 1.05rem; }
.node p { font-size: 13.5px; color: var(--ink-2); }
.node .io { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); font: 400 12px/1.5 var(--font-mono); color: var(--ink-3); }
.node .io b { color: var(--ink-2); font-weight: 500; }
.node.model { background: var(--stage); color: var(--stage-text); border-color: transparent; border-top-color: var(--c); box-shadow: var(--shadow-lg); }
.node.model h3 { color: #fff; }
.node.model p, .node.model .k { color: var(--stage-dim); }
.node.model .io { border-color: var(--stage-line); color: var(--stage-dim); }
.node.model .io b { color: var(--stage-text); }
.node:not(:last-child)::after { content: ""; position: absolute; right: -14px; top: 30px; width: 10px; height: 10px; border-top: 2px solid var(--ink-3); border-right: 2px solid var(--ink-3); transform: rotate(45deg); opacity: .5; }
.flow .node.end::after { display: none; }
.spec { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.spec .card { padding: 20px; }
.spec dl { margin: 12px 0 0; display: grid; gap: 8px; font-size: 13.5px; }
.spec dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); padding-bottom: 7px; }
.spec dt { color: var(--ink-3); }
.spec dd { margin: 0; font-family: var(--font-mono); font-size: 12.5px; text-align: right; }
.label-table { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 18px; font-size: 13.5px; }
.label-table div { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.label-table .v { font: 500 12px var(--font-mono); color: var(--ink-3); width: 22px; }
.label-table i { width: 22px; height: 9px; border-radius: 999px; background: var(--c); }
.code { background: var(--stage); color: var(--stage-text); padding: 18px 20px; border-radius: var(--r-md); font: 400 12.5px/1.7 var(--font-mono); overflow: auto; white-space: pre; }
.code .c { color: var(--stage-dim); }

/* ---------- footer, dialogs, toasts ---------- */
.footer { border-top: 1px solid var(--line); background: #fff; }
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 22px; padding-bottom: 22px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.footer .wrap > div { display: flex; align-items: center; gap: 12px; }
.footer img { height: 18px; }

dialog { border: 0; border-radius: var(--r-md); padding: 0; box-shadow: var(--shadow-lg); max-width: 440px; width: calc(100% - 32px); color: var(--ink); }
dialog::backdrop { background: rgba(13, 26, 36, .5); backdrop-filter: blur(2px); }
.dialog-body { padding: 26px 26px 20px; display: grid; gap: 10px; }
.dialog-body p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; background: var(--paper); border-top: 1px solid var(--line); }

.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .3s var(--ease); max-width: 380px; }
.toast.err { background: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.skeleton { background: linear-gradient(90deg, var(--line-soft), #f7f9fa, var(--line-soft)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }
.fade-in { animation: fade-in .45s var(--ease) both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero-grid, .processing, .scan-review { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .grid-3, .anatomy { grid-template-columns: 1fr 1fr; }
  .class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow, .spec { grid-template-columns: 1fr 1fr; }
  .node:nth-child(2n)::after { display: none; }
  .label-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls-card { grid-template-columns: 1fr 1fr; }
  .controls-card > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 18px; }
  .brand-tag, .engine-badge span { display: none; }
  .nav { position: fixed; top: 66px; left: 0; right: 0; flex-direction: column; background: #fff; padding: 10px 14px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); display: none; margin: 0; }
  .nav.open { display: flex; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar-end .btn { display: none; }
  .grid-3, .anatomy, .flow, .spec, .label-table, .controls-card { grid-template-columns: 1fr; }
  .node::after { display: none; }
  .hero-facts { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .case-row { grid-template-columns: 64px minmax(0, 1fr); }
  .case-row .mini { width: 64px; height: 48px; }
  .case-row .status, .case-row .actions { grid-column: 2; }
  .slices { grid-template-columns: 1fr 1fr; }
  .phase { font-size: 10px; }
  .stage-hero { min-height: 340px; aspect-ratio: 1; }
  .viewer { height: 64vh; min-height: 380px; }
  .viewer-status .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- two-stage pipeline tracker ---------- */
.proc-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.proc-side { display: grid; gap: 20px; align-content: start; }
.proc-side .stage-proc { min-height: 340px; height: 380px; }
.tracker { padding: 24px; display: grid; gap: 18px; }
.tr-summary { display: grid; gap: 14px; }
.tr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.tr-head .pct { font: 600 2.6rem/1 var(--font-display); letter-spacing: -.03em; }
.tr-head .pct small { font-size: 1.2rem; color: var(--ink-3); }
.tr-op { margin-top: 8px; font-size: 14px; color: var(--ink-2); min-height: 1.4em; }
.tracker .bar { height: 10px; }
.tracker .bar span { background: linear-gradient(90deg, var(--blue), var(--slate)); transition: width .5s var(--ease); }
.tracker .bar span[data-state="failed"] { background: var(--err); }
.tracker .bar span[data-state="completed"] { background: var(--ok); }
.tracker.live .bar span[data-state="running"] { background-image: linear-gradient(90deg, var(--blue), var(--slate)), repeating-linear-gradient(45deg, transparent 0 8px, rgba(255,255,255,.25) 8px 16px); }
.tr-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; }
.tr-facts div { background: var(--paper); border-radius: var(--r-sm); padding: 10px 12px; }
.tr-facts dt { font: 500 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tr-facts dd { margin: 6px 0 0; font: 600 17px/1.1 var(--font-mono); color: var(--ink); }

.tr-stage { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.tr-stage header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--paper); border-bottom: 1px solid var(--line); }
.tr-stage h4 { font-size: 14.5px; font-weight: 600; flex: 1; margin: 0; }
.tr-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--font-mono); background: var(--ink); color: #fff; }
.tr-chip { font: 500 11.5px/1 var(--font-mono); padding: 5px 9px; border-radius: 999px; background: var(--line-soft); color: var(--ink-3); }
.tr-chip[data-status="running"] { background: #FFF3DE; color: #8A5A10; }
.tr-chip[data-status="completed"] { background: #E4F1E8; color: #2B6A41; }
.tr-chip[data-status="failed"] { background: #F8E3DC; color: var(--err); }
.tr-stage ol { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.tr-step { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 9px 10px; border-radius: 10px; color: var(--ink-3); transition: background .3s, color .3s; }
.tr-icon { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; position: relative; transition: all .3s; }
.tr-body { min-width: 0; display: grid; gap: 3px; }
.tr-name { font-weight: 500; font-size: 14px; }
.tr-msg { font: 400 12px/1.45 var(--font-mono); color: var(--ink-3); overflow-wrap: anywhere; }
.tr-msg:empty { display: none; }
.tr-mini { height: 4px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.tr-mini span { display: block; height: 100%; background: var(--blue); border-radius: inherit; transition: width .4s; }
.tr-side { display: grid; justify-items: end; gap: 3px; }
.tr-status { font: 500 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; }
.tr-time { font: 400 12px var(--font-mono); color: var(--ink-3); }
.tr-step[data-status="running"] { background: var(--blue-tint); color: var(--ink); }
.tr-step[data-status="running"] .tr-status { color: var(--blue-deep); }
.tr-step[data-status="running"] .tr-icon { border-color: var(--blue); border-right-color: transparent; animation: spin .9s linear infinite; }
.tr-step[data-status="completed"] { color: var(--ink-2); }
.tr-step[data-status="completed"] .tr-status { color: var(--ok); }
.tr-step[data-status="completed"] .tr-icon { background: var(--ok); border-color: var(--ok); }
.tr-step[data-status="completed"] .tr-icon::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.tr-step[data-status="failed"] { background: #FBECE6; color: var(--ink); }
.tr-step[data-status="failed"] .tr-status, .tr-step[data-status="failed"] .tr-msg { color: var(--err); }
.tr-step[data-status="failed"] .tr-icon { background: var(--err); border-color: var(--err); }
.tr-step[data-status="failed"] .tr-icon::after { content: "×"; color: #fff; font: 700 14px/1 var(--font-body); margin-top: -1px; }
.tr-step[data-status="skipped"] { opacity: .55; }
.tr-step[data-status="skipped"] .tr-icon { border-style: dashed; }
@keyframes spin { to { transform: rotate(360deg); } }

.vt { padding: 20px; display: grid; gap: 12px; }
.vt-head { display: flex; justify-content: space-between; align-items: baseline; }
.vt-head h4 { margin: 0; font-size: 15px; }
.vt-list { display: grid; gap: 6px; }
.vt-empty { font-size: 13px; margin: 0; }
.vt-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-soft); background: #fff; }
.vt-lv { font: 600 13px/1 var(--font-mono); padding: 6px 0; text-align: center; border-radius: 8px; background: color-mix(in srgb, var(--c) 16%, #fff); border: 1.5px solid var(--c); }
.vt-msg { font: 400 12.5px var(--font-mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-st { font: 500 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.vt-item[data-status="running"] { background: var(--blue-tint); border-color: #CFE2EF; }
.vt-item[data-status="running"] .vt-st { color: var(--blue-deep); }
.vt-item[data-status="completed"] .vt-st { color: var(--ok); }
.vt-item[data-status="failed"] { background: #FBECE6; }
.vt-item[data-status="failed"] .vt-st, .vt-item[data-status="failed"] .vt-msg { color: var(--err); }
.proc-side .log { max-height: 220px; }

/* ---------- downloads + report ---------- */
.downloads { padding: 22px; display: grid; gap: 16px; }
.downloads h3 { margin: 0; }
.dl-group h5 { margin: 0 0 8px; font: 500 11px/1 var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); display: flex; justify-content: space-between; align-items: center; }
.dl-group h5 a { text-transform: none; letter-spacing: 0; font: 500 12px var(--font-body); }
.dl-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--ink); border: 1px solid var(--line-soft); margin-bottom: 6px; transition: border-color .2s, background .2s; }
.dl-row:hover { border-color: var(--blue); background: var(--blue-tint); color: var(--ink); }
.dl-row .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--paper); color: var(--blue); }
.dl-row .ic svg { width: 16px; height: 16px; }
.dl-row .nm { min-width: 0; display: grid; }
.dl-row .nm b { font: 500 13px var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-row .nm span { font-size: 12px; color: var(--ink-3); }
.dl-row .sz { font: 400 12px var(--font-mono); color: var(--ink-3); }
.dl-row svg.go { width: 16px; height: 16px; color: var(--ink-3); }
.report-card > summary { list-style: none; cursor: pointer; padding: 16px 22px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.report-card > summary::-webkit-details-marker { display: none; }
.report-card > summary .muted { font-weight: 400; font-size: 13px; }
.report-card[open] > summary { border-bottom: 1px solid var(--line); }
.results-extra { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; margin-top: 24px; align-items: start; }
.lv-solo { font: 500 11px/1 var(--font-mono); padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink-3); cursor: pointer; }
.lv-solo:hover, .lv-solo[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); }
@media (max-width: 1100px) {
  .proc-grid, .results-extra { grid-template-columns: 1fr; }
  .tr-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- end-to-end pipeline graphic ---------- */
.run { padding: 26px 26px 22px; margin-top: 8px; }
.run-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.run-head p { margin: 0; max-width: 460px; color: var(--ink-3); font-size: 14px; }
.run-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 26px; row-gap: 12px; }
.run-stage { position: relative; height: 22px; font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }
.run-stage.s1 { grid-column: 1 / span 3; --c: var(--blue); }
.run-stage.s2 { grid-column: 4 / span 4; --c: var(--orange); }
.run-stage::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9px; border: 2px solid var(--c); border-bottom: 0; border-radius: 8px 8px 0 0; opacity: .55; }
.run-stage span { position: relative; z-index: 1; display: inline-block; margin-left: 14px; padding: 0 8px; background: var(--card); color: var(--c); }
.run-step { position: relative; margin: 0; min-width: 0; }
.run-step:not(:last-of-type)::after { /* connector arrow into the next step */
  content: ""; position: absolute; right: -22px; width: 18px; height: 18px;
  top: 33%; transform: translateY(-50%);
  background: no-repeat center / 18px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A8692' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h13M13 6l6 6-6 6'/%3E%3C/svg%3E");
}
.run-shot {
  position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--stage);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, var(--shadow); transition: transform .25s ease, box-shadow .25s ease;
}
.run-shot img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.run-step:hover .run-shot { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.run-step:hover .run-shot img { transform: scale(1.06); }
.run-step.model .run-shot { outline: 2px solid var(--orange); outline-offset: 2px; }
.run-num { position: absolute; top: 8px; left: 8px; font: 500 10.5px var(--font-mono); color: #fff; background: rgba(13, 26, 36, .72); padding: 2px 7px; border-radius: 999px; backdrop-filter: blur(4px); }
.run-model { position: absolute; top: 8px; right: 8px; font: 500 10px var(--font-mono); color: #fff; background: var(--orange); padding: 2px 7px; border-radius: 999px; }
.run-step figcaption { display: grid; gap: 3px; margin-top: 10px; font-size: 12.5px; line-height: 1.4; }
.run-step figcaption b { font-size: 14px; color: var(--ink); }
.run-step figcaption span { color: var(--ink-3); }
.run-step figcaption code { font: 400 11px var(--font-mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-step figcaption em { font: 500 11px var(--font-mono); font-style: normal; color: var(--blue); }
@media (max-width: 1100px) {
  .run-head { flex-direction: column; align-items: start; }
  .run-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 22px; }
  .run-stage { display: none; }
  .run-step:nth-of-type(4n)::after { display: none; }
}
@media (max-width: 760px) {
  .run-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-step::after { display: none; }
}
