:root {
  --bg: #0d0d0f;
  --panel: #17181d;
  --panel-2: #1f2026;
  --line: rgba(255,255,255,0.09);
  --text: #f7f7f8;
  --muted: #b5bac4;
  --red: #c61f26;
  --red-2: #ff4c4c;
  --accent: #f2aa4c;
  --green: #62d26f;
  --amber: #f4b552;
  --blue: #62b7ff;
  --shadow: 0 22px 44px rgba(0,0,0,0.38);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% 0%, #222633 0%, #0d0d0f 58%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1380px, calc(100% - 32px)); margin: 0 auto; }
.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.022));
  box-shadow: var(--shadow);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(13,13,15,0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 50%; background: rgba(255,255,255,0.05); }
.brand strong { display: block; line-height: 1.1; }
.brand small { display: block; color: var(--muted); margin-top: 4px; }
nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; color: var(--muted); }
nav a:hover { color: #fff; }
nav .site-link { color: #fff; font-weight: 800; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, .82fr);
  gap: 18px;
  padding: 34px 0 28px;
}
.hero-copy { padding: 34px; }
.hero-panel { padding: 18px; display: grid; gap: 12px; }
.hero-panel article { padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,0.035); }
.hero-panel span, .eyebrow, .card-kicker {
  display: inline-flex;
  color: #ff8f8f;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
}
.hero-panel strong { display: block; margin: 8px 0 6px; }
.hero-panel small { color: var(--muted); line-height: 1.5; }
h1 { font-size: clamp(36px, 4.5vw, 64px); line-height: 1.01; margin: 14px 0; letter-spacing: -.045em; }
h2 { font-size: clamp(28px, 3vw, 42px); margin: 10px 0; letter-spacing: -.035em; }
h3 { margin: 8px 0; }
p { color: var(--muted); line-height: 1.7; }
.hero-actions, .action-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-actions { margin-top: 22px; }
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 44px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.035);
  color: white;
  transition: 160ms ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.23); }
.btn.primary { background: linear-gradient(135deg, var(--red), var(--red-2)); border: 0; box-shadow: 0 14px 30px rgba(198,31,38,.22); }
.btn.secondary { background: rgba(242,170,76,.16); border-color: rgba(242,170,76,.36); }
.btn.ghost { background: transparent; }
.section { padding: 34px 0; }
.section-heading { margin-bottom: 18px; }
.section-heading p { max-width: 1050px; margin-bottom: 0; }
.section-heading.slim { margin-bottom: 16px; }
.inline-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; flex-wrap: wrap; }
.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.upload-card, .callout-card { padding: 18px; }
.upload-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.upload-card input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.upload-card small { grid-column: 2 / -1; color: var(--muted); }
.upload-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(198,31,38,.16);
  border: 1px solid rgba(255,76,76,.3);
  color: #fff;
  font-weight: 900;
}
.file-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  color: #fff;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
}
.callout-card { grid-column: 1 / -1; }
textarea {
  width: 100%;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #101217;
  color: #fff;
  padding: 14px;
  line-height: 1.55;
}
.analysis-actions, .review-toolbar {
  margin-top: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.analysis-actions strong, .analysis-actions span { display: block; }
.analysis-actions span { color: var(--muted); margin-top: 5px; }
.review-summary { display: grid; grid-template-columns: repeat(4, minmax(88px, 1fr)); gap: 10px; }
.review-summary article { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); }
.review-summary span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.review-summary strong { display: block; margin-top: 5px; font-size: 20px; }
.inventory-inline span, .inventory-inline strong { display: block; }
.inventory-inline span { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.table-card { padding: 16px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; min-width: 920px; border-collapse: collapse; }
.review-table { min-width: 1320px; }
thead { background: rgba(255,255,255,.045); }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: #d9dde5; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
tbody tr.active-row { background: rgba(198,31,38,.16); }
tbody tr.done-row { background: rgba(98,210,111,.08); }
.empty-cell { text-align: center; color: var(--muted); padding: 28px; }
.feature-select, .length-input {
  min-height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: #fff;
  padding: 6px 8px;
}
.length-input { width: 82px; }
.approval-cell { white-space: nowrap; }
.approval-cell label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.matched { color: #d5ffdb; background: rgba(98,210,111,.15); border-color: rgba(98,210,111,.32); }
.status-pill.review { color: #ffe7bd; background: rgba(244,181,82,.14); border-color: rgba(244,181,82,.32); }
.status-pill.blocked { color: #ffd2d2; background: rgba(255,76,76,.14); border-color: rgba(255,76,76,.34); }
.status-pill.inferred { color: #d9efff; background: rgba(98,183,255,.14); border-color: rgba(98,183,255,.32); }
.sim-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, .55fr); gap: 18px; }
.viewer-card { padding: 16px; overflow: hidden; }
.viewer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.viewer-toolbar small { display: block; color: var(--muted); margin-top: 4px; }
.viewer-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.viewer-badges span { border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; background: rgba(255,255,255,0.05); font-size: 12px; }
#runStateBadge.running { background: rgba(98,210,111,.16); border-color: rgba(98,210,111,.35); color: #ceffd3; }
#sceneCanvas {
  display: block;
  width: 100%;
  height: min(70vh, 650px);
  min-height: 430px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 52% 40%, #263143 0%, #151922 56%, #0e1015 100%);
  touch-action: none;
  cursor: grab;
}
#sceneCanvas:active { cursor: grabbing; }
.viewer-help { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 12px; }
.viewer-help span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.035); }
.controls-card { padding: 16px; display: grid; gap: 14px; align-content: start; }
.control-block { display: grid; gap: 8px; }
.control-block.two-col { grid-template-columns: 1fr 1fr; gap: 12px; }
label { color: var(--muted); font-size: 13px; }
select, input[type="number"] {
  width: 100%;
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: #fff;
}
.check-grid { gap: 10px; }
.check-grid label { display: flex; gap: 10px; align-items: center; }
.button-grid, .export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-row button { min-height: 40px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: #fff; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpis article { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: rgba(255,255,255,.035); }
.kpis span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.kpis strong { font-size: 20px; }
.ops-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .45fr); gap: 18px; }
.table-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 14px; }
.table-head h3 { margin: 5px 0 0; }
.side-panel { display: grid; gap: 18px; align-content: start; }
.tool-rack-list { display: grid; gap: 10px; margin-top: 12px; }
.tool-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); }
.tool-dot { width: 14px; height: 14px; border-radius: 50%; }
.tool-item small { display: block; color: var(--muted); margin-top: 3px; }
.slot-pill { color: #fff; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; font-size: 12px; }
.notes-list { margin: 10px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.65; }
@media (max-width: 1120px) {
  .hero, .sim-grid, .ops-layout { grid-template-columns: 1fr; }
  .review-summary { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 12px 16px; }
  nav { gap: 14px; font-size: 14px; }
  .shell { width: min(100% - 20px, 1380px); }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 24px; }
  .import-grid, .control-block.two-col, .button-grid, .export-row, .kpis { grid-template-columns: 1fr; }
  .upload-card { grid-template-columns: auto 1fr; }
  .file-button { grid-column: 1 / -1; }
  .upload-card small { grid-column: 1 / -1; }
  .review-summary { grid-template-columns: repeat(2, 1fr); width: 100%; }
  #sceneCanvas { min-height: 360px; height: 52vh; }
  h1 { font-size: 34px; }
}
