:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --canvas: #f4f7fb;
  --panel: #ffffff;
  --deep: #101a2d;
  --blue: #1d5bd6;
  --blue-dark: #154cbb;
  --blue-soft: #e8f0ff;
  --green: #147a5a;
  --green-soft: #def7ed;
  --amber: #9a5a00;
  --amber-soft: #fff0cc;
  --red: #b42318;
  --red-soft: #fee4e2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 26, 45, .04), 0 2px 7px rgba(16, 26, 45, .04);
  --shadow-md: 0 12px 30px rgba(19, 41, 79, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(900px 360px at 82% -100px, #e2ebff 0%, transparent 66%), var(--canvas);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, .module-card:focus-visible, .back-link:focus-visible {
  outline: 3px solid rgba(29, 91, 214, .22);
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 21px; letter-spacing: -.015em; }
h2 { font-size: 18px; letter-spacing: -.015em; }
h3 { font-size: 14px; }

.topbar {
  position: relative;
  z-index: 1;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px max(28px, calc((100vw - 1360px) / 2));
  color: #fff;
  background: linear-gradient(112deg, #101a2d 0%, #132442 65%, #162d52 100%);
  box-shadow: 0 2px 12px rgba(8, 19, 38, .18);
}
.topbar::after { position: absolute; right: 8%; bottom: 0; left: 8%; height: 1px; content: ""; background: linear-gradient(90deg, transparent, rgba(155, 187, 255, .4), transparent); }
.eyebrow { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 760; letter-spacing: .14em; }
.topbar .eyebrow { color: #a9b9d9; }
main { width: min(1360px, calc(100% - 56px)); margin: 28px auto 54px; }

.hero-grid {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 26px 28px;
  border: 1px solid #d6e0ef;
  border-radius: var(--radius);
  background: linear-gradient(112deg, #fff 0%, #f9fbff 75%, #f2f6ff 100%);
  box-shadow: var(--shadow-sm);
}
.hero-grid::after { position: absolute; top: -78px; right: -34px; width: 250px; height: 250px; border: 1px solid #d5e2ff; border-radius: 50%; content: ""; box-shadow: 0 0 0 28px rgba(213, 226, 255, .4), 0 0 0 56px rgba(213, 226, 255, .18); pointer-events: none; }
.hero-copy { position: relative; z-index: 1; padding: 2px 0; }
.hero-copy h2 { max-width: 670px; font-size: clamp(27px, 3vw, 34px); line-height: 1.13; letter-spacing: -.035em; }
.hero-copy > p:not(.muted) { max-width: 680px; margin-top: 12px; color: #4e5d75; font-size: 15px; }
.muted { color: var(--muted); }
.hero-copy .muted { margin-top: 16px; font-size: 12px; }

.module-section, .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.module-section { margin-bottom: 20px; padding: 20px; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.module-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: inherit;
  text-align: left;
  background: #fff;
  box-shadow: 0 1px 1px rgba(16, 26, 45, .015);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
  animation: rise-in .32s both;
}
.module-card:nth-child(2) { animation-delay: .035s; }
.module-card:nth-child(3) { animation-delay: .07s; }
.module-card:nth-child(4) { animation-delay: .105s; }
.module-card:nth-child(5) { animation-delay: .14s; }
.module-card:nth-child(6) { animation-delay: .175s; }
.module-card:nth-child(7) { animation-delay: .21s; }
.module-card:hover:not(:disabled) { transform: translateY(-2px); border-color: #90afe7; background: #f9fbff; box-shadow: 0 8px 18px rgba(29, 91, 214, .09); }
.module-card:active:not(:disabled) { transform: translateY(0); }
.module-card:disabled { cursor: not-allowed; opacity: .62; }
.module-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #b8c9e8; border-radius: 10px; color: var(--blue); background: linear-gradient(145deg, #f4f8ff, var(--blue-soft)); font-size: 11px; font-weight: 800; }
.module-card-copy { display: grid; min-width: 0; gap: 3px; }
.module-name { font-size: 14px; }
.module-description { color: #5f6e85; font-size: 11px; line-height: 1.38; }
.module-count { grid-column: 2; color: var(--muted); font-size: 11px; font-weight: 700; }

.workspace-grid { display: grid; grid-template-columns: minmax(540px, 1.5fr) minmax(390px, .85fr); align-items: start; gap: 20px; animation: rise-in .28s both; }
.workspace-grid[hidden] { display: none; }
.side-column { display: grid; gap: 20px; }
.panel { padding: 20px; }
.side-column .panel:first-child { position: sticky; top: 16px; }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading.compact { margin-bottom: 14px; }
.selection-actions { display: flex; align-items: center; gap: 6px; }
.section-description { max-width: 600px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 7px; padding: 0; border: 0; color: var(--blue); font-size: 12px; font-weight: 700; background: transparent; }
.back-link::before { content: "←"; transition: transform .16s ease; }
.back-link:hover { text-decoration: underline; }
.back-link:hover::before { transform: translateX(-2px); }

.upload-zone { display: grid; min-height: 132px; place-content: center; gap: 4px; padding: 22px; border: 1.5px dashed #92a9d7; border-radius: 10px; color: #445570; text-align: center; background: linear-gradient(135deg, #fbfdff, #f5f9ff); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px rgba(29, 91, 214, .08); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-zone strong { color: var(--ink); }
.upload-zone span { font-size: 12px; }
.upload-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.button { border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 680; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button:not(:disabled):active { transform: translateY(1px); }
.button-primary { color: #fff; background: linear-gradient(145deg, #2868e6, var(--blue)); box-shadow: 0 4px 10px rgba(29, 91, 214, .2); }
.button-primary:hover:not(:disabled) { background: var(--blue-dark); box-shadow: 0 6px 14px rgba(29, 91, 214, .28); transform: translateY(-1px); }
.button-secondary { border-color: var(--line); color: #26354d; background: #fff; }
.button-secondary:hover { border-color: #b6c6df; background: #f7f9fc; }
.button-quiet { padding: 6px 9px; color: var(--blue); background: transparent; }
.button-quiet:hover { background: var(--blue-soft); }
.preview-empty, .results-empty { display: grid; min-height: 110px; place-items: center; margin-top: 14px; padding: 18px; border: 1px dashed #dce4ef; border-radius: 10px; color: var(--muted); text-align: center; background: #f9fbfd; }
.image-preview { width: 100%; max-height: 260px; object-fit: contain; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; background: #111; box-shadow: 0 5px 14px rgba(16, 26, 45, .09); }

.model-toolbar { display: flex; align-items: center; gap: 12px; margin: 20px 0 10px; }
.model-toolbar input[type="search"] { flex: 1; min-width: 180px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); outline: none; background: #fcfdff; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.model-toolbar input[type="search"]:hover { border-color: #b7c7e0; }
.model-toolbar input[type="search"]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); background: #fff; }
.toggle { display: flex; align-items: center; gap: 6px; color: #51627d; font-size: 12px; white-space: nowrap; }
.toggle input { accent-color: var(--blue); }
.model-list { display: grid; gap: 8px; max-height: 430px; overflow: auto; padding: 2px 4px 2px 1px; scrollbar-color: #bac9df transparent; }
.model-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease; }
.model-card:hover { border-color: #aabde2; box-shadow: 0 3px 10px rgba(16, 26, 45, .045); }
.model-card:has(input:checked) { border-color: var(--blue); background: #f7faff; box-shadow: inset 3px 0 0 var(--blue); }
.model-card.recommended { border-color: #79ba95; background: #f4fbf6; box-shadow: inset 3px 0 0 var(--green); }
.model-card.recommended:has(input:checked) { border-color: var(--green); background: #eaf8ef; }
.model-card input { margin-top: 4px; accent-color: var(--blue); }
.model-card-body { min-width: 0; flex: 1; }
.model-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-title { display: flex; align-items: center; min-width: 0; gap: 6px; }
.model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-run-status { display: inline-grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; border-radius: 50%; color: #64748b; background: #eef2f6; font-size: 10px; font-weight: 800; line-height: 1; }
.model-run-status.queued, .model-run-status.running { color: var(--amber); background: var(--amber-soft); }
.model-run-status.running { animation: status-pulse 1.1s ease-in-out infinite; }
.model-run-status.succeeded { color: var(--green); background: var(--green-soft); }
.model-run-status.partial, .model-run-status.failed, .model-run-status.needs_setup, .model-run-status.environment_required, .model-run-status.input_incompatible, .model-run-status.adapter_required { color: var(--red); background: var(--red-soft); }
.model-badges { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.best-model-badge[hidden] { display: none; }
.best-model-badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 8px; color: #17653c; background: #dff3e6; font-size: 11px; font-weight: 700; white-space: nowrap; }
.model-meta { margin-top: 4px; color: #55657d; font-size: 12px; }
.model-reason { margin-top: 5px; color: var(--muted); font-size: 11px; }
.readiness-badge, .status-pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 99px; padding: 4px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.readiness-badge.runnable, .status-pill.good { color: var(--green); background: var(--green-soft); }
.readiness-badge.adapter_required, .status-pill.warn { color: var(--amber); background: var(--amber-soft); }
.readiness-badge.unknown, .status-pill.bad { color: var(--red); background: var(--red-soft); }
.status-pill { color: #d8e4ff; background: #283957; }
.status-pill.subdued { color: #5e6f89; background: #eff3f8; }
.run-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #edf1f6; }

.result-card { padding: 15px 0; border-top: 1px solid var(--line); animation: rise-in .24s both; }
.result-card:first-child { border-top: 0; padding-top: 0; }
.result-heading { display: flex; justify-content: space-between; gap: 12px; }
.result-message { margin-top: 7px; color: var(--muted); font-size: 12px; }
.draft-report { overflow: auto; margin: 12px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); white-space: pre-wrap; background: #f8fafc; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.report-insights { display: grid; gap: 12px; margin-top: 12px; }
.report-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.report-summary-item { display: grid; gap: 2px; padding: 10px 12px; border-right: 1px solid var(--line); background: #f8fafc; }
.report-summary-item:last-child { border-right: 0; }
.report-summary-item small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.report-summary-item strong { font-size: 13px; text-transform: capitalize; }
.study-quality, .report-findings { display: grid; gap: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.report-findings ul, .report-detail ul { display: grid; gap: 8px; margin: 4px 0 0; padding-left: 18px; }
.report-detail, .cnn-scores { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.report-detail summary, .cnn-scores summary { cursor: pointer; color: #334766; font-weight: 700; }
.review-decision { display: inline-flex; border-radius: 99px; padding: 1px 6px; font-size: 10px; font-weight: 700; text-transform: capitalize; }
.review-decision.confirmed { color: var(--green); background: var(--green-soft); }
.review-decision.rejected { color: var(--red); background: var(--red-soft); }
.review-decision.uncertain { color: var(--amber); background: var(--amber-soft); }
.prediction-summary { margin-top: 10px; color: var(--muted); font-size: 12px; }
.prediction-list { display: grid; gap: 6px; margin-top: 6px; }
.prediction-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; border-radius: 7px; background: #f7f9fc; font-size: 12px; }
.prediction-row.positive { background: var(--green-soft); }
.artifact-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.artifact-list a { color: var(--blue); font-size: 12px; }
.empty-list { padding: 14px 0; color: var(--muted); font-size: 13px; }
.error-banner { margin-top: 12px; padding: 10px 12px; border-radius: 8px; color: var(--red); background: var(--red-soft); }

@keyframes rise-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes status-pulse { 50% { transform: scale(1.13); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (max-width: 980px) { .hero-grid, .workspace-grid { grid-template-columns: 1fr; } .module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .side-column { grid-template-columns: 1fr 1fr; } .side-column .panel:first-child { position: static; } }
@media (max-width: 650px) { .topbar { min-height: 74px; padding: 15px 18px; } main { width: min(100% - 28px, 1360px); margin-top: 18px; } .topbar .status-pill { display: none; } .hero-grid { padding: 22px 18px; } .hero-copy h2 { font-size: 26px; } .hero-grid::after { display: none; } .module-section, .panel { padding: 15px; } .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .module-card { grid-template-columns: 36px minmax(0, 1fr); min-height: 104px; padding: 10px; } .module-icon { width: 36px; height: 36px; font-size: 10px; } .side-column { grid-template-columns: 1fr; } .section-heading { align-items: flex-start; } .selection-actions { align-items: flex-end; flex-direction: column; } .model-toolbar { align-items: stretch; flex-direction: column; } .run-footer { align-items: stretch; flex-direction: column; } .run-footer .button { width: 100%; } .report-summary { grid-template-columns: 1fr; } .report-summary-item { border-right: 0; border-bottom: 1px solid var(--line); } .report-summary-item:last-child { border-bottom: 0; } }
