:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #18211f;
  --muted: #65716d;
  --line: #d9e2df;
  --teal: #117d73;
  --teal-dark: #075b54;
  --amber: #c77b16;
  --green: #1c8a4d;
  --red: #be3d3d;
  --blue: #3864a6;
  --shadow: 0 18px 45px rgba(22, 35, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
a {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #fbfdfc;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

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

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

nav p {
  margin: 26px 4px 9px;
  color: var(--muted);
  font-size: 13px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
}

nav a span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  background: var(--surface-2);
}

nav a.active span {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary {
  padding: 0 16px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.ghost {
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.compact {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.status-strip,
.metric-grid,
.wallet-summary,
.risk-grid,
.process-grid,
.mock-grid,
.listed-grid {
  display: grid;
  gap: 12px;
}

.status-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 26px;
}

.status-strip div,
.metric,
.wallet-summary article,
.risk-grid article,
.process-card,
.mock-grid button,
.listed-grid article {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip span,
.metric span,
.wallet-summary span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.status-strip strong,
.metric strong,
.wallet-summary strong {
  font-size: 20px;
}

.page-section {
  margin-bottom: 28px;
  padding-top: 4px;
}

.compact-section {
  margin-bottom: 18px;
}

.section-head {
  margin-bottom: 14px;
}

.segmented,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button,
.tabs button {
  min-height: 30px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segmented .selected,
.tabs .selected {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

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

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

.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.panel,
.wallet-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.tree-panel {
  min-height: 458px;
}

canvas {
  display: block;
  width: 100%;
  height: 390px;
  margin-top: 12px;
  background:
    linear-gradient(rgba(17, 125, 115, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 125, 115, 0.08) 1px, transparent 1px),
    #fbfdfc;
  background-size: 28px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.badge {
  padding: 4px 8px;
  color: #fff;
  background: var(--green);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.ranking {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.ranking li button,
.ledger article button,
.token-grid article,
.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.ranking li:last-child button,
.ledger article:last-child button,
.token-grid article:last-child,
.project-row:last-child {
  border-bottom: 0;
}

.ranking li,
.ledger article {
  padding: 0;
}

.ranking button,
.ledger button,
.project-row,
.process-card,
.mock-grid button {
  width: 100%;
  color: inherit;
  background: transparent;
  text-align: left;
}

.ranking button:hover,
.ledger button:hover,
.project-row:hover,
.process-card:hover,
.mock-grid button:hover {
  background: #f8fbfa;
}

.ranking span,
.ledger span,
.token-grid span,
.project-row span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.process-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.process-card {
  min-height: 128px;
  display: block;
}

.process-card b,
.mock-grid b {
  display: block;
  margin-bottom: 9px;
  font-size: 15px;
}

.process-card span,
.mock-grid span {
  display: block;
  color: var(--muted);
  line-height: 1.55;
}

.process-card.done {
  border-color: #bfe4ce;
  background: #edf8f1;
}

.process-card.active {
  border-color: #efd0a5;
  background: #fff5e7;
}

.stage-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.stage {
  min-height: 74px;
  padding: 10px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  text-align: left;
}

.stage span {
  display: block;
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: #dfe8e5;
  color: var(--muted);
  text-align: center;
  line-height: 24px;
  font-weight: 800;
}

.stage.done {
  color: var(--green);
  background: #edf8f1;
  border-color: #bfe4ce;
}

.stage.active {
  color: var(--amber);
  background: #fff5e7;
  border-color: #efd0a5;
}

.wallet-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.tabs {
  width: fit-content;
  margin-bottom: 12px;
}

.wallet-panel {
  padding: 16px;
}

.hidden {
  display: none;
}

.ledger em {
  min-width: 78px;
  color: var(--blue);
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

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

.token-grid article {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.token-grid button {
  margin-top: 12px;
  color: #fff;
  background: var(--blue);
}

progress {
  width: 180px;
  accent-color: var(--teal);
}

.disclosure {
  display: grid;
  gap: 10px;
  max-width: 820px;
}

.disclosure p {
  color: var(--muted);
  line-height: 1.65;
}

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

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

.listed-grid article {
  box-shadow: var(--shadow);
}

.listed-grid p,
.listed-grid li {
  color: var(--muted);
  line-height: 1.65;
}

.listed-grid ul {
  padding-left: 18px;
}

.ticker {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 9px;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.detail-drawer {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  max-width: min(720px, calc(100vw - 44px));
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(20, 31, 29, 0.2);
}

.detail-drawer.open {
  display: grid;
}

.detail-drawer p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.risk-section {
  padding-bottom: 20px;
}

.risk-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.risk-grid article {
  color: #394541;
  line-height: 1.55;
  box-shadow: none;
}

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

  .status-strip,
  .metric-grid,
  .wallet-summary,
  .risk-grid,
  .process-grid,
  .mock-grid,
  .listed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-layout,
  .token-grid {
    grid-template-columns: 1fr;
  }

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

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

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    padding: 16px;
  }

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

  nav p {
    grid-column: 1 / -1;
    margin-top: 14px;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .section-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .segmented,
  .tabs {
    width: 100%;
  }

  .top-actions button,
  .segmented button,
  .tabs button {
    flex: 1;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 19px;
  }

  .status-strip,
  .metric-grid,
  .wallet-summary,
  .risk-grid,
  .process-grid,
  .mock-grid,
  .listed-grid,
  .stage-track {
    grid-template-columns: 1fr;
  }

  .ranking li button,
  .ledger article button,
  .project-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .ranking span,
  .ledger span,
  .project-row span {
    text-align: left;
  }

  progress {
    width: 100%;
  }

  .detail-drawer {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    grid-template-columns: 1fr;
  }
}
