:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f5;
  --ink: #18252f;
  --muted: #667680;
  --line: #d8e0e5;
  --line-strong: #b6c4cc;
  --blue: #2f6f95;
  --blue-soft: #dcecf5;
  --coral: #bd5d4e;
  --coral-soft: #f7e5e1;
  --gold: #a47725;
  --gold-soft: #f3ead5;
  --green: #4e806a;
  --green-soft: #e3f0e9;
  --shadow: 0 12px 30px rgb(25 45 58 / 7%);
  --radius: 7px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--surface);
  background: var(--ink);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 12px;
  letter-spacing: 0.12em;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.topbar-status {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
}

main {
  padding-block: 30px 42px;
}

.workspace-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 36px;
  align-items: end;
  padding-bottom: 27px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.intro-status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.intro-status strong {
  color: var(--ink);
  font-weight: 600;
}

.divider {
  margin-inline: 8px;
  color: var(--line-strong);
}

.goal-form {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  gap: 13px;
}

.goal-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.goal-form input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
}

.goal-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(47 111 149 / 15%);
}

.support-systems {
  display: grid;
  grid-template-columns: 114px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 62px;
  padding-block: 11px;
  border-block: 1px solid var(--line);
}

.system-track {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.system-node {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border-top: 3px solid var(--line-strong);
  border-radius: 4px;
  font-size: 12px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.system-node-core,
.system-node.is-relevant {
  color: var(--ink);
  background: var(--blue-soft);
  border-color: var(--blue);
}

.track-line {
  width: 28px;
  height: 1px;
  flex: 0 0 28px;
  background: var(--line-strong);
}

.mode-section,
.workflow-section,
.evidence-section,
.guardrail-section {
  padding-block: 27px;
  border-bottom: 1px solid var(--line);
}

.section-header {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
}

.section-header-compact {
  align-items: center;
}

.section-kicker + h2 {
  margin-top: 5px;
}

.mode-meta {
  display: grid;
  gap: 2px;
  justify-items: end;
  color: var(--muted);
  font-size: 12px;
}

.mode-meta strong {
  color: var(--blue);
  font-size: 15px;
}

.mode-tabs {
  display: flex;
  gap: 5px;
  margin-top: 20px;
  padding: 4px;
  width: fit-content;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mode-tab {
  min-width: 78px;
  padding: 8px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.mode-tab:hover {
  color: var(--ink);
  background: var(--surface);
}

.mode-tab.is-active {
  color: var(--surface);
  background: var(--ink);
}

.progress-track {
  height: 4px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 180ms ease;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.72fr);
  gap: 30px;
  border-bottom: 1px solid var(--line);
}

.workflow-section {
  border-bottom: 0;
}

.workflow-output,
.section-note {
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  text-align: end;
}

.step-list {
  display: grid;
  gap: 9px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.step-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  min-height: 70px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 2px 5px rgb(25 45 58 / 2%);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.step-item.is-selected {
  border-left-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateX(3px);
}

.step-item.is-complete .step-index {
  color: var(--green);
  background: var(--green-soft);
}

.step-index {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.step-title {
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-align: start;
}

.step-title:hover {
  color: var(--blue);
}

.step-detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.step-check {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

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

.detail-panel {
  align-self: start;
  margin-top: 27px;
  padding: 19px;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.detail-panel .section-kicker {
  color: #aebdc4;
}

.detail-panel h2 {
  margin-top: 9px;
  color: var(--surface);
  font-size: 22px;
}

.detail-panel p {
  margin: 11px 0 0;
  color: #d5dee2;
  font-size: 13px;
}

.detail-rule {
  height: 1px;
  margin-block: 18px;
  background: #42535c;
}

.detail-facts {
  display: grid;
  gap: 13px;
  margin: 0;
}

.detail-facts div {
  display: grid;
  gap: 3px;
}

.detail-facts dt {
  color: #9bb7c4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.detail-facts dd {
  margin: 0;
  color: #f0f5f6;
  font-size: 12px;
}

.evidence-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}

.evidence-item {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.evidence-item:hover,
.evidence-item.is-relevant {
  color: var(--ink);
  background: var(--blue-soft);
  border-color: #a8ccdf;
}

.evidence-item.is-relevant::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  background: var(--blue);
  border-radius: 50%;
  content: "";
}

.evidence-item code {
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guardrail-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}

.guardrail-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
  padding: 12px;
  background: var(--coral-soft);
  border: 1px solid #edcbc4;
  border-radius: var(--radius);
}

.guardrail-item::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  margin-top: 6px;
  background: var(--coral);
  border-radius: 50%;
  content: "";
}

.guardrail-item span {
  color: #744137;
  font-size: 12px;
}

.text-button {
  padding: 5px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
}

.text-button:hover {
  color: var(--coral);
}

.footer-bar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-block: 18px 25px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.03em;
}

@media (max-width: 880px) {
  .workspace-intro {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .workbench-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .detail-panel {
    margin: 0 0 27px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 24px, 560px);
  }

  .topbar {
    min-height: 64px;
  }

  main {
    padding-top: 22px;
  }

  .support-systems {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .system-track {
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .system-node {
    flex: 0 0 auto;
  }

  .track-line {
    display: none;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .mode-meta {
    justify-items: start;
  }

  .workflow-output,
  .section-note {
    max-width: none;
    text-align: start;
  }

  .evidence-list,
  .guardrail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .goal-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .brand small,
  .topbar-status {
    display: none;
  }

  .step-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .step-check {
    grid-column: 2;
  }

  .evidence-list,
  .guardrail-list {
    grid-template-columns: 1fr;
  }

  .footer-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

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