:root {
  color-scheme: light;
  --paper: #f5f2eb;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #17191c;
  --muted: #62686f;
  --line: #d9d2c5;
  --teal: #117b6d;
  --coral: #df6045;
  --gold: #c98c18;
  --blue: #405cc8;
  --shadow: 0 16px 40px rgba(32, 28, 22, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(17, 123, 109, 0.13), transparent 26rem),
    linear-gradient(315deg, rgba(223, 96, 69, 0.12), transparent 24rem),
    radial-gradient(circle at 72% 18%, rgba(242, 199, 102, 0.15), transparent 17rem),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

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

button {
  border: 0;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  min-height: 118px;
  padding: 8px 2px 16px;
}

.identity {
  max-width: 780px;
}

.topbar h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 720px;
  margin: 10px 0 0;
  color: #34393f;
  font-size: 17px;
  line-height: 1.42;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip,
.button-row,
.product-row,
.decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-strip {
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  color: #2c3035;
  font-size: 13px;
  font-weight: 680;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot-live {
  background: var(--teal);
}

.dot-ai {
  background: var(--blue);
}

.dot-kv {
  background: var(--gold);
}

.lane-nav {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.lane-link {
  display: grid;
  align-content: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  text-decoration: none;
}

.lane-link strong,
.lane-name {
  display: block;
  font-size: 14px;
  font-weight: 820;
  line-height: 1.15;
}

.lane-link span,
.lane-intent {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.lane-link.active {
  border-color: rgba(17, 123, 109, 0.55);
  background: #e9f3ef;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.08fr) minmax(360px, 1.1fr);
  gap: 14px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  min-height: 680px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.91);
  box-shadow: var(--shadow);
}

.brief-panel,
.result-panel,
.signal-panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
  letter-spacing: 0;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
}

.primary-button {
  background: var(--ink);
  color: #ffffff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.meaning-block,
.decision-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  padding: 12px;
  margin-bottom: 14px;
}

.parse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  border-bottom: 1px solid rgba(217, 210, 197, 0.72);
}

.parse-row span {
  font-size: 17px;
  font-weight: 840;
}

.parse-row strong {
  color: var(--teal);
  font-size: 12px;
  text-transform: uppercase;
}

.meaning-block p {
  margin: 10px 0 0;
  color: #34393f;
  font-size: 14px;
  line-height: 1.46;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  min-height: 86px;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(17, 123, 109, 0.16);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
}

#edgeCanvas {
  display: block;
  width: 100%;
  height: 320px;
  border: 1px solid #cfc6b6;
  border-radius: 8px;
  background: #11151b;
}

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

.metric-grid div,
.route-item,
.lane-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.metric-grid div {
  min-height: 76px;
  padding: 12px;
}

dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  word-break: break-word;
}

.lane-stack {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.lane-row {
  padding: 10px;
}

.tagline {
  margin: 0 0 10px;
  color: #31363b;
  font-size: 16px;
  line-height: 1.45;
}

.source-line,
.share-status {
  min-height: 22px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.result-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.result-section h3,
.decision-box h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #3b4147;
}

.result-section p,
.result-section li,
.decision-box p {
  color: #252a2f;
  font-size: 14px;
  line-height: 1.52;
}

ul,
ol {
  margin: 0;
  padding-left: 19px;
}

.route-list {
  display: grid;
  gap: 8px;
}

.route-item {
  display: grid;
  grid-template-columns: minmax(86px, 116px) 1fr;
  gap: 10px;
  align-items: start;
  min-height: 58px;
  padding: 10px;
}

.route-item code {
  color: var(--blue);
  font-weight: 800;
  word-break: break-word;
}

.route-item span {
  color: #2b3035;
  font-size: 14px;
  line-height: 1.45;
}

.product-row {
  margin-top: 16px;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e9f3ef;
  color: #095e54;
  font-size: 13px;
  font-weight: 760;
}

.share-status a {
  color: var(--blue);
}

.share-page {
  width: min(840px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.brand-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 820;
  text-decoration: none;
}

.share-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.share-card h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.04;
  letter-spacing: 0;
}

.share-card h2 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.share-card dl {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.share-tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.48;
}

@media (max-width: 1200px) {
  .lane-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .result-panel {
    grid-column: 1 / -1;
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 12px;
  }

  .topbar {
    display: grid;
    align-items: start;
    min-height: 0;
  }

  .topbar h1 {
    font-size: 34px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .lane-nav,
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 0;
  }

  .field-grid,
  .metric-grid,
  .route-item {
    grid-template-columns: 1fr;
  }

  #edgeCanvas {
    height: 260px;
  }
}