:root {
  --red: #d71f2b;
  --red-dark: #a90f19;
  --red-soft: #fff0f1;
  --ink: #15181c;
  --muted: #68717d;
  --muted-2: #8e97a2;
  --line: #dde2e7;
  --line-dark: #303842;
  --panel: #ffffff;
  --canvas: #171c22;
  --canvas-2: #20262e;
  --bg: #eef1f4;
  --good: #16805d;
  --good-soft: #e7f6f0;
  --warning: #a66900;
  --warning-soft: #fff4d8;
  --blue: #296ea3;
  --shadow: 0 14px 40px rgba(18, 25, 33, 0.08);
  --radius: 14px;
  --font:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(215, 31, 43, 0.45);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(19, 26, 34, 0.035);
}

.brand-group {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
}

.product-name {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-tabs {
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.view-tab {
  position: relative;
  min-width: 118px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #77808a;
  cursor: pointer;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.05em;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.view-tab::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--red);
  content: "";
  opacity: 0;
  transform: scaleX(0.3);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.view-tab:hover {
  color: var(--ink);
  background: #f8f9fa;
}

.view-tab.is-active {
  color: var(--ink);
}

.view-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.tab-index {
  margin-right: 5px;
  color: var(--red);
  font-size: 9px;
  font-weight: 900;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-pill {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #cfe2da;
  border-radius: 999px;
  background: #f1faf6;
  color: #27735a;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #23a875;
  box-shadow: 0 0 0 4px rgba(35, 168, 117, 0.12);
}

.live-pill.is-running {
  border-color: #f2c8cc;
  background: #fff4f5;
  color: var(--red-dark);
}

.live-pill.is-running .live-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(215, 31, 43, 0.12);
  animation: pulse 1.25s ease infinite;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: #68717b;
  cursor: pointer;
  font-weight: 800;
}

.icon-button:hover {
  border-color: #bbc2ca;
  color: var(--ink);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 292px minmax(620px, 1fr) 292px;
  gap: 10px;
  padding: 10px;
}

.controls-panel,
.metrics-panel,
.stage-column {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls-panel,
.metrics-panel {
  overflow-y: auto;
  scrollbar-color: #c9ced4 transparent;
  scrollbar-width: thin;
}

.panel-heading {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 18px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.panel-heading h1,
.panel-heading h2,
.stage-title h2,
.card-heading h3,
.requirements-heading h3 {
  margin: 3px 0 0;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.eyebrow {
  display: block;
  color: #89929c;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.18em;
  line-height: 1.4;
}

.text-button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

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

.section-toggle {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border: 0;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.section-toggle > span:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #343a41;
  font-size: 11px;
  font-weight: 790;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.section-toggle b {
  color: var(--red);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.chevron {
  color: #9ca4ad;
  font-size: 17px;
  transform: rotate(-90deg);
  transition: transform 180ms ease;
}

.control-section.is-open .chevron {
  transform: rotate(0);
}

.section-body {
  display: none;
  padding: 0 18px 18px;
}

.control-section.is-open .section-body {
  display: block;
  animation: reveal 160ms ease both;
}

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

.field,
.range-field {
  display: grid;
  gap: 6px;
}

.field-wide {
  margin-bottom: 10px;
}

.field > span,
.range-label {
  color: #6b747e;
  font-size: 10px;
  font-weight: 700;
}

.field em {
  color: #a2a9b0;
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d7dce1;
  border-radius: 7px;
  background: #fbfcfd;
  color: #20252b;
  font-size: 12px;
  font-weight: 690;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field input:hover,
.field select:hover {
  border-color: #bdc4cb;
}

.field input:focus,
.field select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215, 31, 43, 0.09);
  outline: 0;
}

.range-field {
  margin-top: 13px;
}

.range-label {
  display: flex;
  justify-content: space-between;
}

.range-label output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 6px 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, var(--red) 0 45%, #dfe3e7 45% 100%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  appearance: none;
  background: var(--red);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.requirement-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 11px;
  padding: 9px 10px;
  border: 1px solid #dcece5;
  border-radius: 7px;
  background: #f3faf7;
  color: #47705f;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.45;
}

.note-icon {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d8f1e6;
  color: #28795a;
  font-size: 9px;
  font-weight: 900;
}

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

.secondary-button {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #d6dce2;
  border-radius: 7px;
  background: #fff;
  color: #3f4851;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.secondary-button:hover {
  border-color: #c9aeb1;
  background: #fff7f7;
  color: var(--red-dark);
}

.control-footer {
  padding: 16px 18px 22px;
}

.control-footer p {
  margin: 0;
  color: #8b949e;
  font-size: 9px;
  line-height: 1.55;
}

.stage-column {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 66px;
  background: #fff;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.stage-title {
  min-width: 0;
}

.stage-title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tool-chip {
  height: 27px;
  padding: 0 9px;
  border: 1px solid #dce1e6;
  border-radius: 6px;
  background: #fff;
  color: #858e98;
  cursor: pointer;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.07em;
}

.tool-chip:hover,
.tool-chip.is-active {
  border-color: #b6bec6;
  background: #f2f4f6;
  color: #2f353c;
}

.stage-frame {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
}

.canvas-view {
  position: absolute;
  inset: 0;
  display: none;
}

.canvas-view.is-active {
  display: block;
  animation: view-in 240ms ease both;
}

#sceneCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#sceneCanvas:active {
  cursor: grabbing;
}

.canvas-hint,
.booth-dimensions {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 13px;
  color: rgba(235, 240, 244, 0.56);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.canvas-hint {
  right: 16px;
  bottom: 14px;
}

.booth-dimensions {
  top: 15px;
  left: 16px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(13, 17, 22, 0.6);
  backdrop-filter: blur(8px);
}

.sequence-overlay {
  position: absolute;
  bottom: 14px;
  left: 16px;
  width: min(420px, calc(100% - 180px));
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(13, 17, 22, 0.75);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.sequence-label {
  color: rgba(255, 255, 255, 0.46);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sequence-overlay ol {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.sequence-overlay li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 8px;
  font-weight: 760;
  text-transform: uppercase;
}

.sequence-overlay li::after {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 12px;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  content: "";
}

.sequence-overlay li:last-child::after {
  display: none;
}

.sequence-overlay b {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  font-size: 7px;
}

.sequence-overlay li.is-active {
  color: #fff;
}

.sequence-overlay li.is-active b {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(215, 31, 43, 0.14);
}

.run-strip {
  display: grid;
  grid-template-columns: 178px 38px minmax(130px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.run-button {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 7px 16px rgba(215, 31, 43, 0.2);
  cursor: pointer;
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.run-button:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.run-button.is-running {
  background: #343b43;
  box-shadow: none;
}

.play-icon {
  font-size: 9px;
}

.stop-button {
  width: 38px;
  height: 38px;
  border: 1px solid #d8dde2;
  border-radius: 8px;
  background: #fff;
  color: #8e969f;
  cursor: pointer;
  font-size: 10px;
}

.stop-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.run-progress {
  min-width: 0;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: #7b848e;
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eaed;
}

.progress-track i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--red);
  transition: width 100ms linear;
}

.side-selector,
.concept-toggle,
.filter-pills {
  display: flex;
  padding: 3px;
  border: 1px solid #dfe3e7;
  border-radius: 7px;
  background: #f5f7f8;
}

.side-selector button,
.concept-toggle button,
.filter-pills button {
  min-width: 54px;
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #868f99;
  cursor: pointer;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.side-selector button.is-active,
.concept-toggle button.is-active,
.filter-pills button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(27, 34, 42, 0.1);
}

.metrics-heading {
  align-items: center;
}

.model-badge {
  padding: 5px 7px;
  border: 1px solid #d9dee3;
  border-radius: 5px;
  color: #8c959f;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.hero-metric {
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0, rgba(215, 31, 43, 0.06), transparent 42%),
    #fff;
}

.hero-metric > span {
  color: #737c86;
  font-size: 10px;
  font-weight: 720;
}

.hero-metric > div:nth-child(2) {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 6px;
}

.hero-metric strong {
  font-size: 42px;
  font-weight: 730;
  letter-spacing: -0.055em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-metric em {
  color: #808994;
  font-size: 14px;
  font-style: normal;
  font-weight: 650;
}

.target-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  margin-top: 17px !important;
  color: #8c949e;
  font-size: 8px;
  font-weight: 740;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.target-row b {
  color: #5e6771;
}

.target-bar {
  position: relative;
  height: 6px;
  margin-top: 7px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #e8c55d 0 24%,
    #75c4a6 24% 76%,
    #e58b87 76% 100%
  );
}

.target-bar i {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 2px;
  height: 12px;
  background: #242a30;
  transform: translateX(-1px);
}

.target-bar span {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 6px;
  height: 6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #242a30;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transform: translate(-3px, -1px);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.metric-grid article {
  min-height: 85px;
  display: grid;
  align-content: center;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-grid article:nth-child(2n) {
  border-right: 0;
}

.metric-grid article:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metric-grid span {
  color: #838c96;
  font-size: 8px;
  font-weight: 720;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metric-grid strong {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 730;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.metric-grid small {
  width: max-content;
  margin-top: 4px;
  color: #969ea6;
  font-size: 7px;
  font-weight: 830;
  letter-spacing: 0.06em;
}

.metric-grid small.good {
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--good-soft);
  color: var(--good);
}

.metric-grid small.warn {
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--warning-soft);
  color: var(--warning);
}

.metric-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.metric-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-section-title span {
  color: #636c76;
  font-size: 10px;
  font-weight: 780;
}

.metric-section-title b {
  color: #7b848e;
  font-size: 8px;
  font-weight: 820;
  text-transform: uppercase;
}

.mini-diagram {
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 13px 0;
  overflow: hidden;
  border: 1px solid #e0e4e8;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(225, 229, 233, 0.25) 1px, transparent 1px)
      0 0 / 14px 14px,
    #fafbfc;
}

.pass-fan {
  width: 42px;
  height: 22px;
  margin: 0 -7px;
  border: 1px solid rgba(215, 31, 43, 0.42);
  border-radius: 50%;
  background: rgba(215, 31, 43, 0.08);
}

.metric-lines {
  display: grid;
  gap: 7px;
}

.metric-lines div {
  display: flex;
  justify-content: space-between;
  color: #7d8690;
  font-size: 9px;
}

.metric-lines b {
  color: #394048;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
}

.pass-badge {
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--good-soft);
  color: var(--good) !important;
}

.pass-badge.fail {
  background: #ffebeb;
  color: #b7222c !important;
}

.production-gauge {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
}

.gauge-dial {
  position: relative;
  width: 90px;
  height: 58px;
  display: grid;
  place-items: center;
  align-content: end;
  padding-bottom: 3px;
  overflow: hidden;
  border-radius: 90px 90px 10px 10px;
  background:
    radial-gradient(circle at 50% 100%, #fff 0 38%, transparent 39%),
    conic-gradient(from 270deg at 50% 100%, #4da982 0 42%, #e1b850 42% 72%, #df6c65 72% 100%);
}

.gauge-dial::after {
  position: absolute;
  right: 7px;
  bottom: 0;
  left: 7px;
  height: 40px;
  border-radius: 70px 70px 0 0;
  background: #fff;
  content: "";
}

.gauge-dial i {
  position: absolute;
  z-index: 2;
  bottom: 3px;
  left: 50%;
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: #2e343a;
  transform: rotate(-40deg);
  transform-origin: left center;
  transition: transform 240ms ease;
}

.gauge-dial strong,
.gauge-dial span {
  position: relative;
  z-index: 3;
}

.gauge-dial strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.gauge-dial span {
  margin-top: 1px;
  color: #929aa3;
  font-size: 7px;
  text-transform: uppercase;
}

.gauge-copy {
  display: grid;
  gap: 7px;
}

.gauge-copy div {
  display: grid;
  gap: 2px;
}

.gauge-copy span {
  color: #9199a2;
  font-size: 8px;
}

.gauge-copy b {
  color: #3f464e;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.recommendation {
  display: flex;
  gap: 10px;
  margin: 14px;
  padding: 12px;
  border: 1px solid #ead2d4;
  border-radius: 8px;
  background: #fff7f7;
}

.recommendation-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.recommendation b {
  color: #562b2e;
  font-size: 9px;
}

.recommendation p {
  margin: 3px 0 0;
  color: #8a6265;
  font-size: 8px;
  line-height: 1.5;
}

.analysis-grid {
  height: calc(100% - 58px);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.75fr);
  gap: 10px;
  padding: 10px;
  background: #eef1f4;
}

.analysis-card,
.concept-canvas-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #d8dde2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(24, 31, 38, 0.045);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid #e2e6ea;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8b949e;
  font-size: 8px;
}

.legend i {
  width: 70px;
  height: 7px;
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, #253b70, #1da3aa, #82cd6f, #ffd056, #e94a37);
}

#heatmapCanvas,
#profileCanvas,
#conceptCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.heatmap-scale {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px 13px;
  color: #8c959e;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.profile-badge {
  padding: 5px 7px;
  border: 1px solid #ead1d4;
  border-radius: 4px;
  background: #fff6f7;
  color: var(--red-dark);
  font-size: 8px;
  font-weight: 800;
}

.profile-summary {
  display: flex;
  gap: 14px;
  padding: 7px 15px 13px;
  color: #747d87;
  font-size: 8px;
}

.profile-summary span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.profile-summary i {
  width: 15px;
  height: 2px;
  display: block;
}

.line-red {
  background: var(--red);
}

.line-grey {
  background: #b9c0c7;
}

.analysis-insight {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 10px 10px;
  padding: 0 13px;
  border: 1px solid #d5e4ee;
  border-radius: 8px;
  background: #f5fafd;
  color: #587287;
}

.analysis-insight p {
  margin: 0;
  font-size: 9px;
  line-height: 1.4;
}

.insight-mark {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #bdd5e4;
  border-radius: 50%;
  color: #35739b;
  font-size: 10px;
  font-weight: 800;
}

.concept-layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(230px, 0.75fr);
  gap: 10px;
  padding: 10px;
  background: #eef1f4;
}

.concept-canvas-card {
  grid-template-rows: auto minmax(0, 1fr);
}

.concept-notes {
  overflow-y: auto;
  border: 1px solid #d8dde2;
  border-radius: 10px;
  background: #fff;
}

.concept-note {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid #e3e7ea;
}

.concept-note:last-child {
  border-bottom: 0;
}

.concept-note > b {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 9px;
}

.concept-note h4 {
  margin: 0;
  font-size: 11px;
}

.concept-note p {
  margin: 5px 0 0;
  color: #747e88;
  font-size: 9px;
  line-height: 1.45;
}

.requirements-wrap {
  height: 100%;
  overflow: auto;
  padding: 18px;
  background: #f1f3f5;
}

.requirements-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.filter-pills button {
  min-width: auto;
}

.requirements-table {
  overflow: hidden;
  border: 1px solid #d8dde2;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(25, 32, 39, 0.05);
}

.requirement-row {
  min-height: 50px;
  display: grid;
  grid-template-columns: 58px minmax(310px, 1fr) 100px 86px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e8eb;
  color: #505962;
  font-size: 9px;
  line-height: 1.4;
}

.requirement-row:last-child {
  border-bottom: 0;
}

.requirement-row > span:first-child {
  color: #9ba2aa;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
}

.requirement-header {
  min-height: 35px;
  background: #f7f8f9;
  color: #929aa3;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.status {
  width: max-content;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status.confirmed {
  background: var(--good-soft);
  color: var(--good);
}

.status.verify {
  background: var(--warning-soft);
  color: var(--warning);
}

.status.derived {
  background: #eaf2f8;
  color: #326f98;
}

.requirement-row.is-hidden {
  display: none;
}

dialog {
  width: min(470px, calc(100vw - 36px));
  padding: 28px;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(19, 26, 34, 0.3);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(12, 16, 20, 0.58);
  backdrop-filter: blur(3px);
}

dialog h2 {
  margin: 5px 0 13px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

dialog p,
dialog li {
  color: #626c76;
  font-size: 12px;
  line-height: 1.55;
}

dialog ul {
  padding-left: 18px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #f0f2f4;
  color: #69727c;
  cursor: pointer;
  font-size: 19px;
}

.dialog-warning {
  margin-bottom: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  color: #7e4c50;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(215, 31, 43, 0.08);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(215, 31, 43, 0.18);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: 270px minmax(560px, 1fr) 270px;
  }

  .view-tab {
    min-width: 105px;
    padding: 0 9px;
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-rows: auto auto;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: 64px 46px;
    padding: 0 15px;
  }

  .view-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
  }

  .view-tab {
    flex: 1 0 120px;
  }

  .workspace {
    min-height: 1000px;
    grid-template-columns: 260px minmax(550px, 1fr);
    grid-template-rows: minmax(700px, 76vh) auto;
  }

  .metrics-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .metrics-panel > .panel-heading {
    grid-column: 1 / -1;
  }

  .hero-metric,
  .metric-grid,
  .metric-section {
    border-right: 1px solid var(--line);
  }

  .recommendation {
    align-self: center;
  }
}

@media (max-width: 760px) {
  .header-actions .live-pill {
    display: none;
  }

  .workspace {
    min-height: auto;
    display: flex;
    flex-direction: column;
    padding: 6px;
  }

  .controls-panel {
    max-height: none;
  }

  .stage-column {
    min-height: 730px;
    grid-template-rows: 62px minmax(0, 1fr) auto;
  }

  .run-strip {
    grid-template-columns: 1fr 40px;
    padding: 10px;
  }

  .run-progress,
  .side-selector {
    grid-column: 1 / -1;
  }

  .metrics-panel {
    display: block;
  }

  .analysis-grid,
  .concept-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .analysis-card,
  .concept-canvas-card {
    min-height: 350px;
  }

  .analysis-insight {
    display: none;
  }

  .requirements-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .requirement-row {
    grid-template-columns: 45px minmax(190px, 1fr) 70px;
  }

  .requirement-row > :last-child {
    grid-column: 2;
  }

  .requirement-header > :last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
