:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-muted: #f1f5f9;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --blue: #1d4ed8;
  --blue-hover: #1e40af;
  --blue-soft: #eff6ff;
  --blue-border: #bfdbfe;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --teal: #0f766e;
  --teal-soft: #f0fdfa;

  --crimson: #be123c;
  --crimson-soft: #fff1f2;
  --crimson-border: #fecdd3;

  --emerald: #047857;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 6px 16px -4px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 16px 36px -8px rgba(15, 23, 42, 0.06);

  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Cascadia Mono", "Liberation Mono", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.65 var(--sans);
  position: relative;
  overflow-x: hidden;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

button, input, summary {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

svg {
  display: block;
  flex-shrink: 0;
}

code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-secondary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 20px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Subtle Engineering Grid Backdrop */
.hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 360px;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(29, 78, 216, 0.055), transparent 72%),
    linear-gradient(to right, rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 15%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 15%, transparent 100%);
}

/* Header */
.site-header {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.header-inner,
main,
.footer-inner {
  width: min(1260px, calc(100% - 48px));
  margin: 0 auto;
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand strong {
  font: 700 18px/1 var(--sans);
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
  white-space: nowrap;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13px;
}

.site-header nav a {
  color: var(--ink-secondary);
  font-weight: 500;
}

.site-header nav a:hover {
  color: var(--blue);
  text-decoration: none;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.service-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.service-state.online {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.service-state.online::before {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.service-state.offline {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.service-state.offline::before {
  background: #f59e0b;
}

/* Main & Hero */
main {
  position: relative;
  z-index: 1;
}

.intro {
  padding: 32px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font: 600 11px/1.4 var(--mono);
  letter-spacing: 0.08em;
  color: var(--blue);
}

h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--ink);
}

.intro-lead {
  margin: 0;
  max-width: 780px;
  color: var(--ink-secondary);
  font-size: 14px;
  line-height: 1.7;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin: 2px 0 0;
  color: var(--ink);
}

h3 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.section-tag {
  display: block;
  font: 600 10.5px/1.3 var(--mono);
  letter-spacing: 0.07em;
  color: var(--muted);
  text-transform: uppercase;
}

/* 4-Step Workflow Stepper */
.workflow-steps {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  min-width: 0;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 600 11px/1 var(--mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.step-body {
  min-width: 0;
}

.step-body strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  line-height: 1.35;
}

.step-body span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-item.is-current {
  border-color: var(--blue-border);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.06), var(--shadow-xs);
}

.step-item.is-current .step-num {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.step-item.is-current .step-body strong {
  color: var(--ink);
}

.step-item.is-done {
  border-color: var(--emerald-border);
  background: #fcfffd;
}

.step-item.is-done .step-num {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

/* Primary Workspace Shell */
.workspace {
  display: grid;
  grid-template-columns: 356px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  align-items: stretch;
  overflow: hidden;
}

/* Left Input Panel */
.input-panel {
  padding: 24px 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mode-badge,
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-secondary);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill-blue {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue-border);
}

/* Segmented Control */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  margin: 16px 0 18px;
}

.mode-tabs button {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.mode-tabs button:hover:not(:disabled) {
  color: var(--ink);
}

.mode-tabs [aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

/* Demo Info Card */
.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 15px;
  box-shadow: var(--shadow-xs);
}

.info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dataset-description {
  color: var(--ink-secondary);
  font-size: 12.5px;
  line-height: 1.7;
  margin: 0 0 14px;
}

.dataset-details {
  margin: 0;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.dataset-details > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.dataset-details dt {
  color: var(--muted);
}

.dataset-details dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.scenario-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  font-variant-numeric: tabular-nums;
}

.scenario-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.scenario-chip.is-brake i {
  background: var(--amber);
}

.scenario-chip.is-drop {
  background: var(--crimson-soft);
  border-color: var(--crimson-border);
  color: var(--crimson);
}

.scenario-chip.is-drop i {
  background: var(--crimson);
}

.helper {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
  margin: 12px 0;
}

.compact-helper {
  margin: 10px 0 0;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--blue);
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.secondary-link:hover {
  background: #dbeafe;
  text-decoration: none;
}

/* Upload Dropzone & Inspection Card */
.drop-zone {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 168px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 22px 14px;
  text-align: center;
  position: relative;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.drop-zone:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.drop-zone.dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
}

.drop-zone.has-file {
  min-height: 136px;
  border-style: solid;
  border-color: var(--blue-border);
  background: #f8fbff;
}

.drop-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.drop-zone strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.drop-formats {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.drop-zone .file-name {
  margin-top: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
  max-width: 100%;
}

.drop-zone.has-file .file-name {
  background: var(--blue-soft);
  border-color: var(--blue-border);
  color: var(--blue);
}

.native-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-zone:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* File Readiness & Header Pre-Check */
.file-inspect-card {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.file-inspect-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.file-inspect-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.ext-badge {
  font: 700 10.5px/1 var(--mono);
  padding: 5px 7px;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--blue-border);
  flex-shrink: 0;
}

.file-inspect-meta strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.file-inspect-meta span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ghost-button:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.channel-check {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.channel-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
}

.channel-chip.is-found {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: var(--emerald);
  font-weight: 500;
}

.channel-chip.is-warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.field-quick-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.field-quick-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.55;
}

.req-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--ink-secondary);
  border: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.req-tag.is-required {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue-border);
}

.privacy-note {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
  margin: 12px 0 0;
}

/* Advanced Model Accordion */
.advanced {
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.advanced summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary:hover {
  background: var(--surface-subtle);
}

.summary-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.advanced-body {
  padding: 4px 13px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin: 12px 0 5px;
}

.text-input {
  width: 100%;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.file-picker-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
}

input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 11.5px;
  color: var(--ink-secondary);
}

input[type="file"]::file-selector-button {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface-subtle);
  border-radius: 5px;
  padding: 5px 9px;
  margin-right: 8px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

input[type="file"]::file-selector-button:hover {
  background: var(--surface-muted);
}

.picker-hint {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  margin: 13px 0 0;
  cursor: pointer;
}

.check-label input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

/* Primary CTA & Progress Box */
.action-area {
  margin-top: 18px;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  color: #ffffff;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #1e40af;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  transition: background 0.16s ease, transform 0.1s ease, box-shadow 0.16s ease;
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  box-shadow: 0 3px 8px rgba(29, 78, 216, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0.5px);
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.status-box {
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.status-box.is-error {
  background: var(--crimson-soft);
  border-color: var(--crimson-border);
}

.status-box.is-done {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.progress-track {
  height: 4px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  width: 38%;
  border-radius: 999px;
  background: var(--blue);
  animation: progress-slide 1.4s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

.request-status {
  color: var(--ink-secondary);
  min-height: 20px;
  font-size: 12px;
  font-weight: 500;
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.request-status.error {
  color: var(--crimson);
}

.status-box.is-done .request-status {
  color: var(--emerald);
}

.run-stages {
  list-style: none;
  padding: 8px 0 0;
  margin: 8px 0 0;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 11px;
}

.run-stages li {
  text-align: center;
  padding: 3px 4px;
  border-radius: 4px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
}

.run-stages li.is-active {
  color: var(--blue);
  border-color: var(--blue-border);
  background: var(--blue-soft);
  font-weight: 600;
}

.retry-button {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--crimson);
  background: #ffffff;
  border: 1px solid var(--crimson-border);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

.retry-button:hover {
  background: #ffe4e6;
}

.input-note {
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin: auto 0 0;
  padding-top: 16px;
  line-height: 1.75;
}

/* Right Analysis Column */
.analysis-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.signal-section,
.result-section {
  padding: 24px 28px;
}

.signal-section {
  border-bottom: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.source-chip,
.result-source {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
}

.result-source.is-populated {
  background: var(--blue-soft);
  border-color: var(--blue-border);
  color: var(--blue);
}

/* Signal Toolbar & Chart */
.signal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0 12px;
}

.segment-tabs {
  display: inline-flex;
  gap: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}

.segment-tabs button {
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border: 0;
  border-radius: 5px;
  padding: 5px 11px;
  transition: all 0.15s ease;
}

.segment-tabs button:hover {
  color: var(--ink);
}

.segment-tabs [aria-pressed="true"] {
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.speed-color {
  background: var(--blue);
}

.pressure-color {
  background: var(--amber);
}

.accel-color {
  background: var(--teal);
}

.abs-color {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--crimson);
}

.chart-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  padding: 12px 10px 8px;
}

#signal-chart {
  width: 100%;
  height: auto;
  overflow: visible;
  cursor: crosshair;
}

.playback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 120px;
}

.slider-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.playback input[type="range"] {
  width: 100%;
  flex: 1;
  height: 4px;
  accent-color: var(--blue);
  cursor: pointer;
}

.playback output {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font: 500 11.5px/1.4 var(--mono);
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.playback output span {
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.playback output span:first-child {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  font-weight: 600;
}

.playback output span.is-alert {
  background: var(--crimson-soft);
  border-color: var(--crimson-border);
  color: var(--crimson);
  font-weight: 600;
}

.chart-caption {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
  margin: 12px 0 0;
}

/* Upload Mode Guide Matrix (Right Panel) */
.upload-guide-panel {
  margin-top: 16px;
}

.upload-guide-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
}

.upload-guide-banner.is-ready {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
}

.banner-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--blue-border);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upload-guide-banner.is-ready .banner-icon {
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.upload-guide-banner h3 {
  font-size: 13.5px;
  margin-bottom: 3px;
}

.upload-guide-banner p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.65;
}

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.spec-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  background: var(--surface-subtle);
}

.spec-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.spec-card-head strong {
  font-size: 13px;
}

.spec-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.spec-list li {
  display: grid;
  gap: 4px;
}

.spec-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.spec-list code {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.spec-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.upload-tips-bar {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.upload-tips-bar a {
  font-weight: 600;
  white-space: nowrap;
}

/* Result Stats Grid */
.result-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 20px;
}

.stat-card {
  padding: 12px 13px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  min-width: 0;
}

.stat-card span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card strong {
  display: block;
  color: var(--ink);
  font: 700 20px/1.4 var(--sans);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-card .stat-text.is-populated {
  font-size: 13px;
  font-weight: 700;
  line-height: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Result Empty & Populated */
.result-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: var(--surface-subtle);
}

.empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-empty strong {
  display: block;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

.result-empty p {
  color: var(--muted);
  font-size: 12.5px;
  margin: 4px 0 0;
  line-height: 1.65;
}

.result-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.result-notice {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.outline-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.outline-button:hover {
  background: var(--surface-muted);
  border-color: #94a3b8;
}

/* Candidate Event Cards */
.event-list {
  display: grid;
  gap: 12px;
}

.event-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-md);
  padding: 15px 17px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.event-card.is-high {
  border-left-color: var(--crimson);
}

.event-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.event-title-group {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.event-card header strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.conf-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

.conf-badge.is-high {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: var(--crimson-border);
}

.event-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.event-time {
  font: 500 12px/1.6 var(--mono);
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
  margin: 0;
}

.locate-btn {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 5px;
  padding: 3px 9px;
}

.locate-btn:hover {
  background: #dbeafe;
}

.event-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.fact-item {
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  min-width: 0;
}

.fact-item small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}

.fact-item b {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Artifacts & Diagnostic Gallery */
.artifact-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 24px 0 11px;
}

.sub-hint {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.artifact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.artifact-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.artifact-link:hover {
  border-color: var(--blue-border);
  background: #f8fbff;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}

.artifact-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fmt-pill {
  font: 700 10px/1 var(--mono);
  padding: 5px 6px;
  border-radius: 5px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.artifact-link strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.artifact-link > span {
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.report-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-gallery figure {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  padding: 10px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.report-gallery a.img-frame {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #ffffff;
}

.report-gallery img {
  width: 100%;
  height: auto;
  display: block;
}

.report-gallery figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--ink-secondary);
  font-size: 12px;
  padding: 0 2px;
}

.zoom-trigger {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 5px;
  padding: 3px 9px;
}

.zoom-trigger:hover {
  background: #dbeafe;
}

.calibration-note {
  margin: 18px 0 0;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

/* Guide Section */
.guide {
  padding: 36px 0 40px;
}

.guide-header {
  margin-bottom: 16px;
}

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

.guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.guide-index {
  display: inline-block;
  font: 700 11px/1 var(--mono);
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: 5px;
  padding: 4px 7px;
  margin-bottom: 10px;
}

.guide-card h3 {
  font-size: 14px;
  margin-bottom: 7px;
}

.guide-card p {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-secondary);
  margin: 0;
}

/* Footer */
footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.footer-inner {
  padding: 18px 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-brand {
  font-weight: 500;
  color: var(--ink-secondary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 11.5px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--ink);
}

/* Lightbox Dialog */
.lightbox {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.lightbox::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.lightbox-stage {
  padding: 16px;
  overflow: auto;
  max-height: calc(100vh - 104px);
  background: var(--surface-subtle);
}

.lightbox-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.noscript {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 12px;
}

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .result-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .event-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .report-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .header-inner,
  main,
  .footer-inner {
    width: calc(100% - 32px);
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .spec-grid {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .playback {
    flex-direction: column;
    align-items: stretch;
  }
  .playback output {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .header-inner,
  main,
  .footer-inner {
    width: calc(100% - 24px);
  }
  .header-inner {
    height: 58px;
  }
  .brand-sub {
    display: none;
  }
  .site-header nav a {
    display: none;
  }
  .intro {
    padding: 22px 0 18px;
  }
  h1 {
    font-size: 22px;
  }
  .intro-lead {
    font-size: 13px;
  }
  .workflow-steps {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .input-panel,
  .signal-section,
  .result-section {
    padding: 18px 15px;
  }
  .dataset-details {
    grid-template-columns: 1fr;
  }
  .result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .event-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .artifact-list {
    grid-template-columns: 1fr;
  }
  .source-chip,
  .result-source {
    font-size: 10.5px;
    padding: 3px 8px;
    white-space: normal;
  }
  .panel-heading {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
