:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #d8dee6;
  --text: #17202a;
  --muted: #66717f;
  --soft: #8b98a8;
  --green: #0f8a5f;
  --green-soft: #e5f5ef;
  --amber: #b56a00;
  --amber-soft: #fff2d6;
  --red: #c43d3d;
  --red-soft: #fde8e7;
  --blue: #246b9f;
  --blue-soft: #e7f1f8;
  --ink: #111827;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #17202a;
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f1b84b;
  color: #17202a;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 10px 10px;
  border-radius: 8px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #f1b84b;
}

.nav-count {
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
}

.main-panel {
  min-width: 0;
  padding: 22px;
}

.topbar {
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.top-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.workspace,
.inspector {
  min-width: 0;
}

.inspector {
  position: sticky;
  top: 18px;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.section-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 94px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
  line-height: 1;
}

.metric em {
  display: block;
  margin-top: 8px;
  color: var(--soft);
  font-style: normal;
  font-size: 12px;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.node-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 13px;
  text-align: left;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.node-card:hover,
.node-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.node-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.node-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
  flex: 0 0 auto;
}

.node-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.node-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.done {
  color: var(--green);
  background: var(--green-soft);
}

.status.review {
  color: var(--amber);
  background: var(--amber-soft);
}

.status.blocked {
  color: var(--red);
  background: var(--red-soft);
}

.status.todo {
  color: var(--blue);
  background: var(--blue-soft);
}

.progress {
  height: 8px;
  background: #e9edf2;
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
}

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

.panel {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-width: 0;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

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

.list li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  gap: 8px;
}

.list li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--soft);
  flex: 0 0 auto;
}

.danger-list li::before {
  background: var(--red);
}

.ok-list li::before {
  background: var(--green);
}

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

.path-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #edf0f4;
  border: 1px solid #d9dfe7;
  border-radius: 6px;
  padding: 8px 9px;
  color: #27313d;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  border-radius: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.primary-button {
  padding: 0 14px;
  border-color: #1d6f50;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.secondary-button,
.text-button {
  padding: 0 12px;
}

.text-button {
  border-color: transparent;
  background: transparent;
  color: var(--blue);
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
}

.primary-button:hover,
.secondary-button:hover,
.text-button:hover,
.icon-button:hover {
  filter: brightness(0.96);
}

.split-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
}

tr:last-child td {
  border-bottom: 0;
}

.qa-list {
  display: grid;
  gap: 10px;
}

.qa-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.qa-item input {
  width: 18px;
  height: 18px;
}

.qa-title {
  font-size: 13px;
  font-weight: 700;
}

.qa-desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.hero-section {
  padding: 24px;
}

.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
}

.entry-card {
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text);
}

.entry-card.primary-entry {
  background: linear-gradient(135deg, #103f36, #1b6a56 58%, #dca849);
  color: #fff;
  border-color: transparent;
}

.entry-card span {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.15;
}

.entry-card p {
  max-width: 520px;
  color: inherit;
  opacity: 0.78;
  line-height: 1.55;
}

.entry-card strong {
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.16);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #e9eef3;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
}

.mode-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 800;
}

.mode-switch button.active {
  background: var(--surface);
  color: var(--green);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.1);
}

.note-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 12px;
  line-height: 1.55;
  font-size: 13px;
}

.script-editor {
  display: grid;
  gap: 12px;
}

.script-editor .field textarea {
  min-height: 120px;
}

.journey {
  display: grid;
  gap: 10px;
}

.journey-step {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.journey-step.review {
  border-color: #efcf90;
  background: #fffaf0;
}

.journey-step.auto {
  border-color: #bad4e6;
  background: #f2f8fc;
}

.journey-step.blocked {
  border-color: #efb2aa;
  background: #fff5f4;
}

.step-index {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 900;
}

.journey-step h3 {
  margin: 0;
  font-size: 16px;
}

.journey-step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.journey-step span {
  display: inline-block;
  margin-top: 6px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.journey-step strong {
  justify-self: end;
  font-size: 13px;
  color: var(--green);
}

.review-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.review-tabs button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 0 11px;
  color: var(--muted);
  font-weight: 800;
}

.review-tabs button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.review-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
}

.review-main,
.review-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.review-main h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.review-main p,
.review-status p {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cover-tile {
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.32)),
    linear-gradient(135deg, #d6e5dc, #e8d9b5 45%, #cfd9e9);
  color: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 260px;
  overflow: hidden;
}

.cover-tile:nth-child(2) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.34)),
    linear-gradient(135deg, #d8e2ee, #bdd6cf 48%, #e9cfb9);
}

.cover-tile:nth-child(3) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.34)),
    linear-gradient(135deg, #dfe3d8, #d0d8e8 46%, #efd6ad);
}

.cover-platform {
  font-size: 12px;
  font-weight: 800;
  opacity: 0.86;
}

.cover-title {
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.12;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-time {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

.timeline-content {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.timeline-content strong {
  display: block;
  font-size: 13px;
}

.timeline-content span {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #17202a;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

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

  .inspector {
    position: static;
  }

  .board {
    grid-template-columns: repeat(3, minmax(190px, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px;
  }

  .brand {
    padding-bottom: 10px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    min-width: 142px;
    grid-template-columns: 24px 1fr;
  }

  .nav-count {
    display: none;
  }

  .main-panel {
    padding: 14px;
  }

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

  .metric-grid,
  .detail-grid,
  .split-row,
  .field-grid,
  .entry-grid,
  .review-panel,
  .cover-grid {
    grid-template-columns: 1fr;
  }

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

  .section {
    padding: 14px;
  }

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

  .journey-step strong {
    grid-column: 2;
    justify-self: start;
  }

  .entry-card {
    min-height: 180px;
  }

  .entry-card span {
    font-size: 21px;
  }

  .mode-switch {
    width: 100%;
  }
}
