:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-alt: #f9fafb;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #175cd3;
  --accent-hover: #1249a8;
  --accent-soft: #eff4ff;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --error: #b42318;
  --error-bg: #fef3f2;
  --code-bg: #101828;
  --code-text: #e4e7ec;
  --sidebar-width: 248px;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.spacer { flex: 1; }
.inline { display: inline; }
.spacer,
.toolbar-spacer { flex: 1; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  position: relative;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.brand-logo {
  width: 42px;
  height: 42px;
  overflow: visible;
  animation: logo-float 7s ease-in-out infinite;
}
.logo-cube {
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.2px); }
}
@media (prefers-reduced-motion: reduce) {
  .brand-logo { animation: none; }
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 15px; letter-spacing: -.01em; }
.brand-copy small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.side-nav { flex: 1; overflow: auto; padding: 16px 12px; }
.nav-label {
  margin: 16px 10px 6px;
  color: #98a2b3;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav-label:first-child { margin-top: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  margin: 1px 0;
  border-radius: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 500;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-external { margin-left: auto; font-size: 11px; color: #98a2b3; }
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.sidebar-meta { display: flex; align-items: center; gap: 6px; }
.sidebar-meta + .sidebar-meta { margin-top: 5px; }

.app-main { min-width: 0; margin-left: var(--sidebar-width); }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-spacer { flex: 1; }
.breadcrumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; min-width: 0; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); text-decoration: none; }
.crumb-sep { color: #98a2b3; }
.topbar-note { color: var(--muted); font-size: 12px; }
.topbar-link { color: #475467; font-size: 12.5px; font-weight: 500; }
.topbar-link:hover { color: var(--text); text-decoration: none; }

/* ---------- Topbar account menu ---------- */
.account-menu { position: relative; }
.account-menu > summary { list-style: none; cursor: pointer; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 9px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.account-chip:hover,
.account-menu[open] .account-chip {
  border-color: #b8c6dc;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .07);
}
.account-avatar {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  flex: none;
}
.account-copy { display: grid; line-height: 1.2; text-align: left; }
.account-copy strong { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.account-copy small { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10.5px; }
.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: 240px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(16, 24, 40, .16);
}
.account-popover-head {
  display: grid;
  gap: 2px;
  padding: 9px 10px 11px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}
.account-popover-head strong { font-size: 12.5px; }
.account-popover-head span { color: var(--muted); font-size: 11px; word-break: break-all; }
.account-popover a,
.account-popover button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.account-popover a:hover,
.account-popover button:hover { background: var(--surface-alt); text-decoration: none; }
.account-popover form { margin: 0; }
.account-popover button { color: var(--error); }

.app-content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 28px 32px 64px; }

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.eyebrow {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -.025em;
  font-weight: 650;
}
h2 { margin: 0; font-size: 15px; line-height: 1.35; letter-spacing: -.01em; font-weight: 650; }
h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 650; }
h3:first-child { margin-top: 0; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.detail-heading { min-width: 0; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row h1 { margin: 0; }
.detail-id { margin-top: 5px; }
.detail-header .page-subtitle { margin-top: 10px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.panel-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-subsection { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.panel-subsection h3 { margin: 0 0 3px; font-size: 14px; }

/* 运行进度（按历史成功运行估计） */
.run-progress-panel { margin-bottom: 16px; }
.run-progress-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.run-progress-head h2 { margin: 0; font-size: 15px; }
.run-progress-value { font-size: 20px; font-variant-numeric: tabular-nums; }
.run-progress-track {
  margin-top: 10px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef4;
}
.run-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f9e96, #3aa8a0);
  transition: width 0.6s ease;
}
.run-progress-bar.is-failed { background: #c0392b; }
.run-progress-bar.is-cancelled { background: #8a94a6; }
.run-progress-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.run-progress-note:empty { display: none; }
.text-link { font-size: 12px; font-weight: 600; white-space: nowrap; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease;
}
a.metric-card:hover { border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); text-decoration: none; }
.metric-card-iconic {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 20px 18px 16px;
  border-top: 2px solid var(--metric-accent, var(--line));
}
a.metric-card-iconic:hover { border-top-color: var(--metric-accent, var(--line-strong)); }
.metric-body { min-width: 0; flex: 1; }
.metric-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--metric-icon-bg, var(--surface-alt));
  color: var(--metric-accent, var(--muted));
}
.metric-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.metric-card-models { --metric-accent: #175cd3; --metric-icon-bg: #eff4ff; }
.metric-card-datasets { --metric-accent: #0e9384; --metric-icon-bg: #ecfdf5; }
.metric-card-runs { --metric-accent: #6938ef; --metric-icon-bg: #f4f3ff; }
.metric-card-executor { --metric-accent: #475467; --metric-icon-bg: #f2f4f7; }
.metric-label { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.metric-value { margin: 6px 0 2px; font-size: 30px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.metric-value-sm { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.metric-foot { color: var(--muted); font-size: 11.5px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.run-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 20px; align-items: start; }
.quick-links { display: flex; flex-direction: column; }
.quick-links a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  color: var(--text);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.quick-links a:last-child { border-bottom: 0; padding-bottom: 0; }
.quick-links a:hover { text-decoration: none; color: var(--accent); }
.quick-links a span:last-child { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover, button:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn.secondary, button.secondary { background: var(--surface); border-color: var(--line-strong); color: #344054; }
.btn.secondary:hover, button.secondary:hover { background: var(--surface-alt); border-color: var(--line-strong); }
.btn.danger, button.danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn.danger:hover, button.danger:hover { background: #912018; border-color: #912018; }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12px; }
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.icon-button:hover { background: var(--surface-alt); color: var(--text); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sidebar-toggle { display: none; }

/* ---------- Badges / status ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.error { background: var(--error-bg); color: var(--error); }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.ok { background: var(--ok-bg); color: var(--ok); }
.status-pill.warn { background: var(--warn-bg); color: var(--warn); }
.status-pill.error { background: var(--error-bg); color: var(--error); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.error { background: var(--error); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table, table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td, th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th, th {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  background: var(--surface-alt);
  white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 12px; }
.data-table tbody tr:hover { background: #fcfcfd; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .badge-row { margin-top: 0; }
.data-table td .mono { overflow-wrap: anywhere; }
.model-table td { vertical-align: middle; }
.model-cell { min-width: 300px; }
.model-glyph {
  float: left;
  width: 36px;
  height: 36px;
  margin-right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}
.model-cell > div { overflow: hidden; }
.model-name { color: var(--text); font-weight: 600; font-size: 13.5px; }
.model-name:hover { color: var(--accent); }
.model-description {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-action { text-align: right; white-space: nowrap; font-weight: 600; }
.row-action a { font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-form { display: flex; align-items: center; gap: 8px; }
.toolbar-label { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.search-field { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-field svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #98a2b3;
  stroke-width: 1.8;
}
.search-field input { padding-left: 34px; }
.compact-select { width: auto; min-width: 132px; }

/* ---------- Model catalog themes / filters ---------- */
.badge.external-badge { background: #eef4ff; color: #3538cd; border: 1px solid #c7d7fe; }
.external-panel { display: grid; gap: 10px; }
.external-panel .external-links { display: flex; flex-wrap: wrap; gap: 8px; }
.external-meta { color: var(--muted, #667085); font-size: 13px; }
.theme-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.theme-chip {
  height: auto;
  padding: 5px 9px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #344054;
  font-size: 12px;
  font-weight: 600;
}
.theme-chip:hover {
  background: var(--surface-alt);
  border-color: var(--line-strong);
  color: var(--text);
}
.theme-chip.is-active {
  background: var(--accent-soft);
  border-color: #b2ccff;
  color: var(--accent);
}
.theme-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}
.theme-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.theme-chip.is-active .theme-count { background: #dbe7ff; color: var(--accent); }
.theme-dot.theme-snow-glacier { background: #0ea5e9; }
.theme-dot.theme-permafrost { background: #7f56d9; }
.theme-dot.theme-land-surface { background: #8b5e3c; }
.theme-dot.theme-hydro-flood { background: #0e9384; }
.theme-dot.theme-geohazard { background: #f79009; }
.theme-dot.theme-remote-sensing { background: #12b76a; }
.theme-dot.theme-general { background: #98a2b3; }
.theme-dot.theme-other { background: #98a2b3; }

.theme-badge.theme-snow-glacier { background: #e0f2fe; color: #026aa2; }
.theme-badge.theme-permafrost { background: #f4ebff; color: #5925dc; }
.theme-badge.theme-land-surface { background: #fdf2e9; color: #8b5e3c; }
.theme-badge.theme-hydro-flood { background: #ccfbf1; color: #0f766e; }
.theme-badge.theme-geohazard { background: #fffaeb; color: #b54708; }
.theme-badge.theme-remote-sensing { background: #dcfae6; color: #067647; }
.theme-badge.theme-general { background: #f2f4f7; color: #475467; }
.theme-badge.theme-other { background: #f2f4f7; color: #475467; }
.badge.more { background: var(--surface-alt); color: var(--muted); }

.filter-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}
.filter-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 24, 40, .38);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.filter-scrim.show { opacity: 1; visibility: visible; }
.filter-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 41;
  width: min(390px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(16, 24, 40, .16);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform .24s ease, visibility .24s ease;
}
.filter-drawer.open { transform: translateX(0); visibility: visible; }
.filter-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.filter-drawer-header h2 { font-size: 17px; }
.filter-drawer-header .muted { margin: 4px 0 0; font-size: 12px; }
.filter-drawer-body {
  flex: 1;
  min-height: 0;
  padding: 16px 20px;
  overflow: auto;
}
.filter-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}
body.filter-open { overflow: hidden; }
.filter-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.filter-group-head .muted { font-size: 11.5px; }
.filter-search input { width: 100%; max-width: 320px; }
.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}
.tag-option {
  height: auto;
  padding: 2px 7px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #475467;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.tag-option:hover {
  background: var(--surface-alt);
  border-color: var(--line-strong);
  color: var(--text);
}
.tag-option.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tag-option.is-selected:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}
.tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.tag-option.is-selected .tag-count {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}
.active-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -4px 0 14px;
}
.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-height: 26px;
}
.active-filter {
  height: auto;
  padding: 3px 9px;
  gap: 7px;
  border: 1px solid #b2ccff;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.active-filter:hover {
  background: #dbe7ff;
  border-color: #84adff;
}
.active-filter-x { font-size: 14px; line-height: 1; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 20px;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0 11px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ---------- Forms ---------- */
label { display: block; margin: 0 0 5px; font-size: 12.5px; font-weight: 600; color: #344054; }
.label-note { color: var(--muted); font-weight: 500; margin-left: 4px; }
input, select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 92, 211, .12);
}
textarea { min-height: 84px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; resize: vertical; }
.field { margin-bottom: 14px; }
.field-help { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; }
.input-check[hidden] { display: none; }
.input-check {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-check[data-level="ok"] { border-color: #abefc6; background: var(--ok-bg); }
.input-check[data-level="warning"] { border-color: #fedf89; background: var(--warn-bg); }
.input-check[data-level="error"] { border-color: #fecdca; background: var(--error-bg); }
.check-line { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.45; }
.check-icon {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.check-ok .check-icon { background: var(--ok); }
.check-warning .check-icon { background: #dc6803; }
.check-error .check-icon { background: var(--error); }
.check-hint { margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.form-section-title .btn {
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
  padding: 4px 9px;
  min-height: 0;
}
.form-section-title {
  margin: 20px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.form-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
.checkbox-row input { width: 16px; min-height: 16px; height: 16px; margin: 0; }
.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 26px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fcfcfd;
  text-align: center;
  cursor: pointer;
  margin-bottom: 16px;
}
.file-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.file-drop-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  margin-bottom: 2px;
}
.file-drop strong { font-size: 13px; }
.file-drop .muted { font-size: 12px; }

/* ---------- Lists / key-value ---------- */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 7px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13px; }
.kv.compact { grid-template-columns: 105px minmax(0, 1fr); gap: 6px 12px; }
.kv.compact dt, .kv.compact dd { font-size: 12.5px; }
.clean-list { margin: 0; padding-left: 18px; }
.clean-list li { margin: 4px 0; }

/* ---------- Output cards ---------- */
.output-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.output-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}
.output-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .03em;
}
.output-card p { margin: 4px 0 6px; font-size: 12px; }

/* ---------- Empty / callouts ---------- */
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state.compact { padding: 22px 16px; }
.empty-state h3 { color: var(--text); margin: 10px 0 4px; }
.empty-state p { margin: 0 0 14px; font-size: 12.5px; }
.empty-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: #98a2b3;
  font-size: 16px;
  font-weight: 700;
}
.callout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12.5px;
}
.callout strong { flex: none; }
.callout.error { border-color: #fecdca; background: var(--error-bg); color: #912018; }
.callout.success { border-color: #abefc6; background: var(--ok-bg); color: #05603a; }
.callout.info { border-color: #b2ddff; background: var(--accent-soft); color: #1849a9; }

/* ---------- Code / logs ---------- */
pre, .code-block, .log {
  margin: 0;
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  overflow: auto;
  max-height: 480px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-block.compact { max-height: 260px; }
.log { white-space: pre-wrap; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
summary:hover { color: var(--text); }
details[open] summary { margin-bottom: 10px; }
.artifact-image { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; }
.dataset-image {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, var(--surface-alt) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-alt) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-alt) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-alt) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.dataset-image img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  margin: 0 auto;
  border-radius: 6px;
  object-fit: contain;
}
.artifact-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.artifact-figure {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.artifact-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: zoom-in;
}
.artifact-figure img:hover { border-color: var(--line-strong); }
.artifact-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 8px;
  font-size: 12px;
}
.artifact-figure figcaption .mono { overflow-wrap: anywhere; }
.artifact-title {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.artifact-title:hover {
  background: transparent;
  border-color: transparent;
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.artifact-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.artifact-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(16, 24, 40, .36);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.artifact-drawer-backdrop.open { opacity: 1; visibility: visible; }
.artifact-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 60;
  width: clamp(360px, 45vw, 100vw);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(16, 24, 40, .16);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform .22s ease, visibility .22s ease;
}
.artifact-drawer.open { transform: translateX(0); visibility: visible; }
.artifact-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.artifact-drawer-heading { min-width: 0; }
.artifact-drawer-heading h2 {
  margin: 4px 0 2px;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.artifact-drawer-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.artifact-drawer-body {
  flex: 1;
  min-height: 0;
  padding: 18px 20px;
  overflow: auto;
}
.artifact-drawer-body .preview-table { font-size: 12px; }
.artifact-drawer-body .preview-text { max-height: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.artifact-drawer-body .artifact-image { display: block; margin: 0 auto; }
.artifact-pdf {
  width: 100%;
  min-height: calc(100vh - 150px);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.artifact-note { margin: 0 0 12px; }
body.artifact-drawer-open { overflow: hidden; }
.event-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-timeline li {
  padding-left: 10px;
  border-left: 2px solid var(--line);
  font-size: 12px;
  line-height: 1.5;
}
.event-timeline li.event-level-error { border-left-color: var(--error); }
.event-timeline li.event-level-warning { border-left-color: #d97706; }
.event-timeline li.event-level-info { border-left-color: var(--accent); }
.event-message { display: block; color: var(--text); overflow-wrap: anywhere; }
.event-time { display: block; margin-top: 2px; font-size: 11px; }
.event-timeline--scroll {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.event-head { display: flex; gap: 6px; align-items: flex-start; }
.event-badge {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  line-height: 17px;
  letter-spacing: .02em;
}
.event-badge-callback { background: var(--surface-alt); color: var(--muted); }
.event-level-warning .event-badge { background: #fef0c7; color: #b54708; }
.event-level-error .event-badge { background: #fee4e2; color: var(--error); }
.event-data { margin-top: 4px; }
.event-data summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  user-select: none;
}
.event-data summary:hover { color: var(--text); }
.event-data pre { margin-top: 6px; }
.event-count-warn { color: #b54708; font-weight: 600; }
.event-count-error { color: var(--error); font-weight: 600; }
.event-progress {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.event-progress summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}
.event-progress summary .muted { font-weight: 400; text-align: right; }
.event-progress-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 4px 0 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  scrollbar-width: thin;
}
.event-progress-list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  overflow-wrap: anywhere;
}
.event-progress-time {
  flex: 0 0 82px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Modals ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 45px rgba(16, 24, 40, .22);
}
dialog.modal-lg { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
dialog.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { font-size: 17px; }
.modal-header .muted { margin: 4px 0 0; font-size: 12px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 12px 12px;
}
.run-estimate { margin-right: auto; max-width: 62%; font-size: 12px; line-height: 1.5; }
@media (max-width: 640px) {
  .run-estimate { width: 100%; max-width: 100%; margin-right: 0; }
}
body.modal-open { overflow: hidden; }
.sidebar-scrim { display: none; }

/* ---------- Model principle / documentation ---------- */
.doc-hero {
  display: grid;
  grid-template-columns: minmax(250px, .78fr) minmax(0, 1.65fr);
  align-items: center;
  gap: 24px;
}
.doc-hero-single { grid-template-columns: minmax(0, 1fr); }
.doc-hero-single .doc-lead { max-width: 78ch; }
.doc-hero-copy .eyebrow { margin-bottom: 6px; }
.doc-hero-copy h2 { font-size: 19px; letter-spacing: -.015em; }
.doc-lead {
  margin: 9px 0 18px;
  color: #344054;
  font-size: 14px;
  line-height: 1.8;
}
.doc-facts { border-top: 1px solid var(--line); padding-top: 14px; }
.doc-figure {
  margin: 0;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfcfd;
  min-width: 0;
}
.doc-svg { display: block; width: 100%; height: auto; }
.doc-svg text { font-family: inherit; }
.doc-caption {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.doc-scroll-hint { display: none; }
.doc-no-figure {
  padding: 34px 18px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.doc-flow-scroll { overflow-x: auto; margin: 0 -3px; padding: 0 3px; }
.doc-flow { display: flex; align-items: stretch; gap: 8px; padding: 2px 1px 8px; }
.flow-step {
  flex: 1 1 150px;
  min-width: 150px;
  max-width: 230px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--flow-color, var(--accent));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.flow-input { --flow-color: #175cd3; --flow-soft: #eff4ff; }
.flow-data { --flow-color: #0e7090; --flow-soft: #ecfdff; }
.flow-check { --flow-color: #b54708; --flow-soft: #fffaeb; }
.flow-process { --flow-color: #6941c6; --flow-soft: #f4f3ff; }
.flow-decision { --flow-color: #b54708; --flow-soft: #fffaeb; }
.flow-output { --flow-color: #067647; --flow-soft: #ecfdf3; }
.flow-kind {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--flow-soft, var(--accent-soft));
  color: var(--flow-color, var(--accent));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}
.flow-step strong { display: block; margin: 6px 0 3px; font-size: 12.5px; line-height: 1.4; }
.flow-step p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.flow-note { display: block; margin-top: 6px; color: var(--flow-color, var(--accent)); font-size: 11px; }
.flow-arrow { align-self: center; flex: none; color: #98a2b3; font-size: 15px; }
.doc-fallback-note { margin: 10px 0 0; }
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}
.concept-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fcfcfd;
}
.concept-index {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
}
.concept-card h3 { margin: 9px 0 6px; font-size: 14px; }
.concept-card p { margin: 0; color: #475467; font-size: 12.5px; line-height: 1.7; }
.formula {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.doc-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-notes li {
  position: relative;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  color: #475467;
  font-size: 12.5px;
  line-height: 1.6;
}
.doc-notes li::before {
  content: "!";
  position: absolute;
  left: 11px;
  top: 10px;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 10.5px;
  font-weight: 800;
}

/* ---------- Model documentation layout ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.doc-toc {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfcfd;
}
.doc-toc-title {
  margin: 1px 8px 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.doc-toc a {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 8px;
  border-radius: 6px;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
}
.doc-toc a span {
  color: #98a2b3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9.5px;
}
.doc-toc a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.doc-anchor { scroll-margin-top: 78px; }
.doc-subheading {
  margin: 20px 0 9px;
  color: #344054;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .01em;
}
.doc-subheading:first-of-type { margin-top: 4px; }
.doc-compact-table td, .doc-compact-table th { padding-top: 8px; padding-bottom: 8px; }
.doc-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 4px;
}
.doc-two-col h3 { margin-top: 0; }
.doc-citation {
  margin: 0;
  padding: 11px 13px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--surface-alt);
  color: #475467;
  font-size: 12.5px;
  line-height: 1.7;
}
.doc-faq { display: grid; gap: 8px; }
.doc-faq details {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}
.doc-faq summary {
  cursor: pointer;
  color: #344054;
  font-size: 12.5px;
  font-weight: 600;
}
.doc-faq summary:hover { color: var(--accent); }
.doc-faq p { margin: 8px 0 0; color: #475467; font-size: 12.5px; line-height: 1.7; }
.doc-steps {
  margin: 0;
  padding-left: 22px;
  counter-reset: doc-step;
  list-style: none;
}
.doc-steps li {
  position: relative;
  margin: 0 0 10px;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
  color: #475467;
  font-size: 12.5px;
  line-height: 1.7;
  counter-increment: doc-step;
}
.doc-steps li::before {
  content: counter(doc-step);
  position: absolute;
  left: 11px;
  top: 11px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}
.doc-page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.doc-page-hero h1 { margin: 3px 0 5px; font-size: 25px; letter-spacing: -.022em; }
.doc-page-hero .page-subtitle { max-width: 720px; }
.doc-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.doc-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.doc-link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}
.doc-link-card:hover { border-color: #b2ddff; background: var(--accent-soft); text-decoration: none; }
.doc-link-card strong { color: var(--text); font-size: 12.5px; }
.doc-link-card span { color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* ---------- Data requirements ---------- */
.data-req-summary {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}
.data-req-summary li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.data-req-summary li:first-child { border-top: 0; padding-top: 2px; }
.data-req-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.data-req-dot-base { background: #7c3aed; }
.data-req-dot-thematic { background: var(--accent); }
.data-req-dot-auxiliary { background: #94a3b8; }
.data-req-summary-copy { min-width: 0; }
.data-req-summary-copy strong { display: block; font-size: 12.5px; line-height: 1.45; }
.data-req-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.req-role {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.req-role-base { color: #6d28d9; background: #f1eafe; }
.req-role-thematic { color: #1d4ed8; background: #e8f0ff; }
.req-role-auxiliary { color: #475569; background: #eef2f6; }
.data-req-intro { max-width: 760px; margin: -2px 0 12px; }
.data-req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.data-req-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}
.data-req-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.data-req-card h4 { margin: 0 0 5px; font-size: 13px; color: var(--text); }
.data-req-card p { margin: 0 0 8px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.req-required { font-size: 10.5px; font-weight: 600; }
.req-required.is-required { color: #b42318; }
.req-required.is-optional { color: var(--muted); }
.data-req-kv { margin: 0; }
.data-req-kv dt { font-size: 10.5px; }
.data-req-kv dd { font-size: 11.5px; }

/* ---------- Responsive ---------- */
/* ---------- Credits & citations ---------- */
.credit-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 2px 0 16px;
}
.credit-stat {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}
.credit-stat strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}
.credit-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}
.credit-principles li { line-height: 1.7; }
.credit-table td { vertical-align: top; line-height: 1.6; }
.credit-table td:nth-child(4) { min-width: 180px; color: #475467; }
.credit-kind { white-space: nowrap; }
.credit-kind-model { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }
.credit-kind-algorithm { background: #f0fdf4; color: #067647; border-color: #abefc6; }
.credit-kind-literature { background: #fdf4ff; color: #9d174d; border-color: #fbcfe8; }
.credit-kind-data { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.credit-kind-software { background: #f2f4f7; color: #344054; border-color: #d0d5dd; }
.credit-model-list { display: grid; gap: 10px; }
.credit-model {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fcfcfd;
  overflow: hidden;
}
.credit-model > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.credit-model > summary::-webkit-details-marker { display: none; }
.credit-model > summary:hover { background: var(--surface-alt); }
.credit-model[open] > summary { border-bottom: 1px solid var(--line); }
.credit-model-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.credit-model-title strong { font-size: 13px; }
.credit-model-title .mono { font-size: 11px; }
.credit-model-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.credit-model .table-wrap { padding: 0 6px; }
.credit-model-footer { padding: 6px 14px 12px; text-align: right; }
.credit-intro { overflow: hidden; }

@media (max-width: 1180px) {
  .doc-hero { grid-template-columns: minmax(0, 1fr); }
  .doc-layout { grid-template-columns: 160px minmax(0, 1fr); gap: 16px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid, .detail-layout, .run-layout { grid-template-columns: minmax(0, 1fr); }
  .app-content { padding: 24px 24px 56px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; width: 264px; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); }
  .app-main { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-scrim.show {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16, 24, 40, .35);
  }
  .app-topbar { padding: 0 16px; }
  .app-content { padding: 20px 16px 48px; }
  .page-header { flex-direction: column; gap: 14px; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .model-cell { min-width: 240px; }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .doc-toc-title { width: 100%; margin: 0 4px 3px; }
  .doc-toc a { padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .model-table th:nth-child(2), .model-table td:nth-child(2),
  .model-table th:nth-child(3), .model-table td:nth-child(3),
  .model-table th:nth-child(4), .model-table td:nth-child(4),
  .model-table th:nth-child(5), .model-table td:nth-child(5) { display: none; }
  .model-cell { min-width: 0; }
  .model-glyph { width: 30px; height: 30px; margin-right: 9px; font-size: 13px; }
  .theme-filter { gap: 6px; }
  .theme-chip { padding: 5px 9px; font-size: 12px; }
  .filter-drawer { width: 100%; }
  .filter-drawer-body { padding: 14px 16px; }
  .filter-search input { max-width: none; }
}
@media (max-width: 620px) {
  .runs-table thead { display: none; }
  .runs-table, .runs-table tbody { display: block; }
  .runs-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px;
    padding: 12px 1px;
    border-bottom: 1px solid var(--line);
  }
  .runs-table tbody tr:last-child { border-bottom: 0; }
  .runs-table td { display: block; border: 0; padding: 0; min-width: 0; }
  .runs-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .runs-table td:nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  .runs-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .runs-table td:nth-child(5) { grid-column: 1; grid-row: 3; font-size: 12px; }
  .runs-table td:nth-child(4) { grid-column: 2; grid-row: 3; justify-self: end; font-size: 12px; }
  .runs-table td:nth-child(6), .runs-table td:nth-child(7) { display: none; }
  .overview-runs-table thead, .model-runs-table thead { display: none; }
  .overview-runs-table, .overview-runs-table tbody,
  .model-runs-table, .model-runs-table tbody { display: block; }
  .overview-runs-table tbody tr, .model-runs-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px;
    padding: 12px 1px;
    border-bottom: 1px solid var(--line);
  }
  .overview-runs-table tbody tr:last-child,
  .model-runs-table tbody tr:last-child { border-bottom: 0; }
  .overview-runs-table td, .model-runs-table td { display: block; border: 0; padding: 0; min-width: 0; }
  .overview-runs-table td:nth-child(1), .model-runs-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .overview-runs-table td:nth-child(2), .model-runs-table td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
  .overview-runs-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 2; font-size: 12px; }
  .overview-runs-table td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12px; }
  .overview-runs-table td:nth-child(5) { display: none; }
  .model-runs-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 2; font-size: 12px; }
  .model-runs-table td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12px; }
  .model-runs-table td:nth-child(4) { grid-column: 2; grid-row: 3; justify-self: end; font-size: 12px; }
  .model-runs-table td:nth-child(6), .model-runs-table td:nth-child(7) { display: none; }
  .datasets-table thead { display: none; }
  .datasets-table, .datasets-table tbody { display: block; }
  .datasets-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px;
    padding: 12px 1px;
    border-bottom: 1px solid var(--line);
  }
  .datasets-table tbody tr:last-child { border-bottom: 0; }
  .datasets-table td { display: block; border: 0; padding: 0; min-width: 0; }
  .datasets-table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .datasets-table td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
  .datasets-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 2; font-size: 12px; }
  .datasets-table td:nth-child(3) { grid-column: 1; grid-row: 3; font-size: 12px; }
  .datasets-table td:nth-child(5) { grid-column: 2; grid-row: 3; justify-self: end; font-size: 12px; }
  h1 { font-size: 24px; }
  .metrics-grid { grid-template-columns: minmax(0, 1fr); }
  .output-grid { grid-template-columns: minmax(0, 1fr); }
  .concept-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-hero { gap: 18px; }
  .doc-lead { font-size: 13.5px; }
  .doc-two-col { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .credit-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credit-model > summary { flex-direction: column; align-items: flex-start; gap: 7px; }
  .credit-model-meta { justify-content: flex-start; }
  .doc-page-hero { flex-direction: column; gap: 10px; }
  .doc-figure { overflow-x: auto; }
  .doc-figure .doc-svg { min-width: 640px; }
  .doc-scroll-hint {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    white-space: nowrap;
  }
  .doc-flow { flex-direction: column; align-items: stretch; gap: 6px; }
  .flow-step { flex: 1 1 auto; min-width: 0; max-width: none; }
  .flow-arrow { align-self: center; transform: rotate(90deg); margin: 1px 0; }
  .topbar-note { display: none; }
  .model-description { display: none; }
  .panel { padding: 15px 14px; }
  .data-table th, .data-table td, th, td { padding: 9px 8px; }
  .tabs { gap: 18px; }
}

/* Alpine3D result charts */
.viz-panel .panel-subtitle { max-width: 920px; }
.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.viz-card {
  margin: 0;
  padding: 14px 14px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}
.viz-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.viz-head h3 { margin: 0; font-size: 14px; }
.viz-sub { margin: 2px 0 0; color: #52514e; font-size: 12px; }
.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  color: #52514e;
  font-size: 12px;
}
.viz-key {
  display: inline-block;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  vertical-align: middle;
  margin-right: 5px;
}
.viz-plot { position: relative; }
.viz-svg, .viz-heat, .viz-heatmap { display: block; width: 100%; height: auto; }
.viz-heatmap-cell { transition: opacity 0.12s ease; }
.viz-heatmap-cell:hover { opacity: 0.82; }
.viz-heatmap-value {
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.sweep-heat-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #52514e;
}
.sweep-heat-bar {
  flex: 0 1 160px;
  height: 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.viz-axis-label { fill: #52514e; font-size: 11px; }
.viz-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.viz-gridline { stroke: #e1e0d9; stroke-width: 1; shape-rendering: crispEdges; }
.viz-axis { stroke: #c3c2b7; stroke-width: 1; shape-rendering: crispEdges; }
.viz-tick {
  fill: #898781;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-endpoint { stroke: #ffffff; stroke-width: 2; }
.viz-crosshair { stroke: #52514e; stroke-width: 1; pointer-events: none; }
.viz-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 120px;
  max-width: 220px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .12);
  pointer-events: none;
}
.viz-tooltip-head {
  margin-bottom: 3px;
  color: #52514e;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.viz-tooltip-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: #52514e;
  font-size: 12px;
}
.viz-tip-key { flex: none; width: 10px; height: 2px; border-radius: 1px; }
.viz-tip-label { margin-left: auto; padding-left: 6px; }
.viz-tooltip-row strong {
  color: #101828;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.viz-cell { cursor: crosshair; }
.viz-cell:hover { opacity: .82; stroke: #ffffff; stroke-width: 1.5; }
.viz-scale { display: flex; align-items: center; gap: 2px; margin-top: 8px; }
.viz-scale-step { width: 24px; height: 8px; }
.viz-scale-nodata { width: 12px; height: 8px; margin-left: 8px; border-radius: 1px; }
.viz-scale .viz-scale-label { margin-left: 7px; }
.viz-scale .viz-scale-label + .viz-scale-label { margin-left: auto; }
.viz-note { margin: 6px 0 0; color: var(--muted); font-size: 11.5px; }
.viz-table { margin-top: 8px; }
.viz-table summary { cursor: pointer; color: #52514e; font-size: 12px; }
.viz-table .table-wrap { max-height: 260px; overflow: auto; margin-top: 8px; }
.viz-table .data-table { font-size: 11.5px; }
.viz-grid-table td, .viz-grid-table th { padding: 4px 6px; }
.sweep-table td, .sweep-table th { white-space: nowrap; }
.sweep-table td { font-variant-numeric: tabular-nums; }
.viz-section-title { margin: 20px 0 2px; font-size: 14px; }
.viz-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.viz-section-head .viz-section-title { margin: 0 0 2px; }
.viz-section-head .small { margin: 0; }
.viz-time-form { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.viz-time-form label { color: #52514e; font-size: 12px; }
.viz-time-form select {
  min-width: 160px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.viz-time-form select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.viz-time-form button {
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.viz-time-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.viz-time-btn { min-width: 30px; line-height: 1; }
.viz-time-btn:hover:not(:disabled) { background: #f2f4f7; }
.viz-time-btn:disabled { opacity: .45; cursor: not-allowed; }
.viz-time-play { min-width: 52px; }
.viz-time-play.is-playing { background: #eef4ff; border-color: var(--accent); color: var(--accent); }
.viz-time-status { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.viz-range-form { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.viz-range-form label { color: #52514e; font-size: 12px; }
.viz-range-form input[type="text"] {
  width: 132px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.viz-range-form input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.viz-range-form button {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.viz-range-form button:hover { background: #f2f4f7; }
.viz-range-form button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.viz-range-reset { color: var(--accent); font-size: 12px; }
.viz-range-warn { color: #9a3412; }
.viz-empty { margin: 10px 0 0; }
.viz-actions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.viz-export { color: var(--accent); font-size: 12px; }
@media (max-width: 1100px) {
  .viz-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .viz-section-head { align-items: flex-start; }
  .viz-time-form { margin-left: 0; flex-wrap: wrap; }
  .viz-range-form { margin-left: 0; }
  .viz-range-form input[type="text"] { width: 116px; }
}

/* Multi-run comparison */
.compare-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted, #f7f8fa);
}
.compare-col {
  width: 48px;
  text-align: center;
}
.compare-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.compare-warn {
  color: var(--danger, #b42318);
}
.compare-params td,
.compare-params th {
  vertical-align: top;
}
.compare-shared {
  margin-top: 12px;
}
