:root {
  --bg: #071019;
  --bg-elevated: #09131d;
  --panel: #0b1621;
  --panel-soft: #0f1b27;
  --line: #1b2b3d;
  --line-strong: #24384f;
  --text: #f4f7fb;
  --muted: #91a3b7;
  --muted-soft: #71859b;
  --signal: #2e7dff;
  --signal-soft: rgba(46, 125, 255, 0.16);
  --copper: #c77743;
  --copper-soft: rgba(199, 119, 67, 0.18);
  --success: #79d790;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
}

[data-theme="emerald"] {
  --signal: #2bb673;
  --signal-soft: rgba(43, 182, 115, 0.16);
  --copper: #3ecf8e;
  --copper-soft: rgba(62, 207, 142, 0.16);
  --line-strong: #1f4d3a;
}

[data-theme="sunset"] {
  --signal: #c77743;
  --signal-soft: rgba(199, 119, 67, 0.16);
  --copper: #e39a62;
  --copper-soft: rgba(227, 154, 98, 0.18);
  --line-strong: #4b2d20;
}

[data-theme="ice"] {
  --signal: #70c4ff;
  --signal-soft: rgba(112, 196, 255, 0.16);
  --copper: #9cc9ff;
  --copper-soft: rgba(156, 201, 255, 0.16);
  --line-strong: #28445a;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(46, 125, 255, 0.08), transparent 22%),
    radial-gradient(circle at bottom right, rgba(199, 119, 67, 0.07), transparent 18%),
    linear-gradient(180deg, #060d14 0%, #071019 100%);
}

a,
button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.app-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 16px auto;
}

.topbar,
.workspace,
.panel,
.panel-head,
.brand-cluster,
.topbar-actions,
.module-tabs,
.task-grid,
.copilot-grid,
.action-row,
.beta-grid,
.result-stack,
.job-summary-grid,
.detail-list,
.detail-row,
.rail-note,
.stage-item,
.pipeline-track,
.pipeline-item,
.judge-list,
.resource-group,
.upload-zone,
.compact-stack {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(10, 18, 28, 0.88);
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.brand-cluster,
.topbar-actions,
.module-tabs,
.theme-switcher {
  align-items: center;
}

.brand-cluster,
.topbar-actions {
  grid-auto-flow: column;
  justify-content: start;
}

.theme-switcher {
  grid-auto-flow: column;
  gap: 10px;
}

.theme-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.theme-dot {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--theme-color, var(--signal));
  box-shadow: inset 0 0 0 2px rgba(7, 16, 25, 0.75);
}

.theme-dot[data-theme-option="cobalt"] {
  --theme-color: #2e7dff;
}

.theme-dot[data-theme-option="emerald"] {
  --theme-color: #2bb673;
}

.theme-dot[data-theme-option="sunset"] {
  --theme-color: #c77743;
}

.theme-dot[data-theme-option="ice"] {
  --theme-color: #70c4ff;
}

.theme-dot.is-active {
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.08);
}

.brand-mark {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.beta-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.beta-pill {
  background: var(--signal-soft);
  color: var(--signal);
}

.status-badge {
  background: rgba(121, 215, 144, 0.14);
  color: var(--success);
}

.module-tabs {
  grid-auto-flow: column;
  justify-content: center;
}

.module-tab {
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.module-tab.is-active {
  color: var(--signal);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 -2px 0 var(--signal);
}

.topbar-actions {
  grid-auto-flow: column;
  gap: 18px;
  color: var(--muted);
}

.workspace {
  grid-template-columns: 250px minmax(0, 1fr) 320px;
  align-items: start;
  margin-top: 18px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(11, 22, 33, 0.97), rgba(9, 19, 29, 0.95));
  box-shadow: var(--shadow);
}

.flow-rail,
.summary-rail,
.main-column {
  position: sticky;
  top: 104px;
}

.summary-rail,
.main-column {
  align-self: start;
}

.summary-rail,
.main-column {
  display: grid;
  gap: 18px;
}

.section-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 800;
}

.panel-head {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.panel-head.compact {
  align-items: end;
}

.panel-head h1,
.panel-head h2,
.panel-head h3 {
  margin: 8px 0 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: -0.03em;
}

.panel-head h1 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  max-width: 14ch;
}

.panel-head h2 {
  font-size: 1.35rem;
}

.panel-copy,
.rail-note p:last-child,
.placeholder,
.status-line,
.job-subcopy,
.upload-copy,
.upload-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.stage-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.stage-item {
  grid-template-columns: 42px 1fr;
  align-items: start;
  padding: 14px 0;
  position: relative;
}

.stage-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 54px;
  width: 2px;
  height: calc(100% - 22px);
  background: linear-gradient(180deg, rgba(126, 149, 176, 0.8), rgba(126, 149, 176, 0.08));
}

.stage-item strong {
  display: block;
  font-size: 0.98rem;
}

.stage-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stage-item.is-active strong {
  color: var(--text);
}

.stage-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--signal) 34%, transparent);
  color: var(--signal);
  background: color-mix(in srgb, var(--signal) 10%, transparent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

.rail-note {
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.job-summary {
  min-height: 96px;
}

.job-summary-grid {
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
}

.job-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.job-card strong,
.stat-card strong,
.result-stack h3 {
  display: block;
}

.job-card strong {
  font-size: 1.05rem;
}

.job-card span,
.stat-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.job-card .metric-value,
.summary-table strong,
.score-value {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.9rem;
  color: var(--text);
}

.task-grid,
.copilot-grid,
.beta-grid {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: start;
}

.upload-zone {
  align-content: center;
  min-height: 260px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--signal) 16%, transparent), transparent 24%),
    rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.upload-zone input {
  display: none;
}

.upload-title {
  font-size: 1.12rem;
  font-weight: 700;
}

.compact-stack {
  align-content: start;
}

.field {
  gap: 10px;
}

.field span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.field-inline input {
  max-width: 180px;
}

.action-row {
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: white;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--signal) 100%, white 6%),
    color-mix(in srgb, var(--signal) 82%, black 18%)
  );
  box-shadow: 0 12px 28px color-mix(in srgb, var(--signal) 28%, transparent);
}

.button-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.button-copper {
  color: white;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--copper) 100%, white 8%),
    color-mix(in srgb, var(--copper) 84%, black 16%)
  );
  box-shadow: 0 12px 28px color-mix(in srgb, var(--copper) 24%, transparent);
}

.pipeline-track {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.pipeline-item {
  gap: 8px;
}

.pipeline-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.pipeline-item.is-done .pipeline-node {
  color: var(--bg);
  background: var(--success);
  border-color: var(--success);
}

.pipeline-item.is-live .pipeline-node {
  color: var(--copper);
  border-color: color-mix(in srgb, var(--copper) 72%, black 28%);
  background: color-mix(in srgb, var(--copper) 14%, transparent);
}

.pipeline-item strong {
  font-size: 0.92rem;
}

.pipeline-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.copilot-bubble {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: #d2dbe4;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.02);
  line-height: 1.6;
}

.beta-grid {
  gap: 18px;
}

.demo-script {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  white-space: pre-wrap;
  line-height: 1.58;
  font-size: 0.82rem;
}

.summary-panel,
.roi-panel,
.result-panel,
.judge-panel {
  gap: 18px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}

.summary-table th,
.summary-table td {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-size: 0.92rem;
}

.summary-table th {
  color: var(--muted);
  font-weight: 700;
}

.summary-table td:last-child {
  color: color-mix(in srgb, var(--copper) 56%, white 44%);
}

.detail-list {
  gap: 10px;
}

.detail-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-row strong {
  font-size: 0.92rem;
}

.metric-cluster {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.metric-cluster .score-value {
  margin-top: 4px;
  font-size: 2.2rem;
}

.metric-caption {
  color: var(--success);
  font-weight: 700;
}

.pill-row,
.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  font-weight: 700;
}

.pill.warning {
  color: #f0a469;
  background: var(--copper-soft);
}

.result-stack {
  gap: 20px;
}

.result-stack section {
  display: grid;
  gap: 12px;
}

.result-stack h3 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.judge-list {
  gap: 16px;
}

.resource-group h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.resource-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.resource-group a {
  color: #b6d0ff;
}

.placeholder {
  font-size: 0.94rem;
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .flow-rail,
  .summary-rail,
  .main-column {
    position: static;
  }

  .flow-rail {
    order: 1;
  }

  .main-column {
    order: 2;
  }

  .summary-rail {
    order: 3;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .module-tabs,
  .topbar-actions,
  .action-row {
    grid-auto-flow: row;
    justify-content: start;
  }

  .task-grid,
  .copilot-grid,
  .beta-grid,
  .job-summary-grid,
  .pipeline-track {
    grid-template-columns: 1fr;
  }

  .field-inline input {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100%, calc(100% - 20px));
    margin: 10px auto 20px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .topbar {
    padding: 16px 18px;
  }

  .brand-mark {
    font-size: 1.55rem;
  }

  .panel-head h1 {
    font-size: 1.6rem;
  }

  .upload-zone {
    min-height: 200px;
  }
}
