:root {
  --bg: #f5f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657282;
  --line: #dce3ea;
  --brand: #2364aa;
  --green: #15835b;
  --red: #bd3f32;
  --amber: #a46a16;
  --teal: #0f766e;
  --shadow: 0 14px 34px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  background: #111827;
  color: #f8fafc;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f2b84b;
  color: #111827;
  font-weight: 800;
}

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

.brand span,
.rule-card small,
.eyebrow {
  color: #94a3b8;
}

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

.nav-item {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #d8e1ea;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #233044;
  border-color: #34465f;
  color: #ffffff;
}

.rule-card {
  margin-top: auto;
  border: 1px solid #34465f;
  border-radius: 8px;
  padding: 14px;
  background: #182234;
}

.rule-card p {
  margin: 8px 0;
  line-height: 1.5;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stage-badge,
.primary-action {
  border-radius: 6px;
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.stage-badge {
  background: #eaf2fb;
  color: var(--brand);
  border: 1px solid #c8dbee;
}

.primary-action {
  background: var(--brand);
  color: #ffffff;
  border: 0;
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.content-view,
.delivery-card,
.owner-panel,
.workflow article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 126px;
  padding: 18px;
  border-top: 4px solid var(--brand);
}

.metric-green {
  border-top-color: var(--green);
}

.metric-blue {
  border-top-color: var(--brand);
}

.metric-red {
  border-top-color: var(--red);
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 32px;
}

.content-view {
  display: none;
  padding: 20px;
}

.content-view.active {
  display: block;
}

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

.section-head h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

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

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f0f4f8;
  color: #4b5968;
  font-size: 13px;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.ok {
  background: #e8f6ef;
  color: var(--green);
}

.status.warn {
  background: #fff3df;
  color: var(--amber);
}

.matrix-grid {
  display: grid;
  gap: 10px;
}

.matrix-row {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 8px;
  align-items: stretch;
}

.matrix-row span,
.matrix-row strong,
.matrix-row em {
  min-height: 44px;
  border-radius: 6px;
  padding: 12px;
  background: #f6f8fb;
  border: 1px solid var(--line);
  font-style: normal;
}

.matrix-row strong {
  background: #e8f6ef;
  color: var(--green);
}

.matrix-row em {
  color: var(--muted);
}

.matrix-header span {
  background: #263344;
  color: #ffffff;
  font-weight: 700;
}

.matrix-note {
  color: var(--muted);
  padding-top: 4px;
}

.delivery-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

code {
  display: block;
  margin-top: 8px;
  overflow-x: auto;
  padding: 12px;
  border-radius: 6px;
  background: #101827;
  color: #f8fafc;
}

.delivery-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
}

.delivery-fields span {
  min-height: 48px;
  padding: 10px;
  border-radius: 6px;
  background: #f2f6fa;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.chain {
  display: grid;
  grid-template-columns: 1fr 36px 1fr 36px 1fr 36px 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.chain span {
  min-height: 54px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.chain b {
  height: 2px;
  background: var(--teal);
  position: relative;
}

.chain b::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -4px;
  width: 0;
  height: 0;
  border-left: 8px solid var(--teal);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

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

.owner-panel,
.workflow article {
  padding: 18px;
}

.owner-panel h3,
.workflow h3 {
  margin: 8px 0;
}

.owner-panel p {
  margin: 8px 0;
  color: var(--muted);
}

.owner-panel ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

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

.step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.workflow p {
  color: var(--muted);
  line-height: 1.55;
}

.site-map,
.product-strip,
.plans,
.checkout-layout {
  display: grid;
  gap: 14px;
}

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

.site-map article,
.product-strip article,
.plans article,
.form-panel,
.order-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.site-map h3,
.product-strip h3,
.plans h3 {
  margin: 8px 0 14px;
}

.site-map button,
.front-actions button,
.plans button {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f7fafc;
  color: var(--ink);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.site-map button:hover,
.front-actions button:hover,
.plans button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: #eef6ff;
}

.front-hero {
  min-height: 330px;
  border-radius: 8px;
  padding: 34px;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.94), rgba(17, 24, 39, 0.72)),
    radial-gradient(circle at 75% 25%, rgba(21, 131, 91, 0.7), transparent 34%),
    linear-gradient(135deg, #1d3557, #0f766e);
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 14px;
}

.front-hero h2 {
  max-width: 720px;
  margin: 10px 0;
  font-size: 42px;
  line-height: 1.15;
}

.front-hero p {
  max-width: 620px;
  color: #d8e1ea;
  line-height: 1.65;
}

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

.front-actions button,
.plans button {
  width: auto;
  min-width: 132px;
  text-align: center;
  background: #ffffff;
}

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

.product-strip p,
.plans p,
.order-panel p {
  color: var(--muted);
  line-height: 1.6;
}

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

.plans strong {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: #e8f6ef;
  color: var(--green);
  padding: 0 10px;
}

.checkout-layout {
  grid-template-columns: 1.1fr 0.9fr;
}

.form-panel {
  display: grid;
  gap: 12px;
}

.form-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.form-panel select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.stack-form,
.replacement-form {
  display: grid;
  gap: 12px;
}

.replacement-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.stack-form label,
.replacement-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.stack-form input,
.stack-form select,
.replacement-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #ffffff;
}

.api-status,
.result-box {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #f7fafc;
  color: var(--muted);
}

.result-box:empty {
  display: none;
}

.api-status.ok,
.result-box.ok {
  background: #e8f6ef;
  color: var(--green);
  border-color: #bfe7d2;
}

.api-status.warn,
.result-box.warn {
  background: #fff3df;
  color: var(--amber);
  border-color: #f0d19a;
}

.spaced {
  margin-top: 14px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list,
  .summary-grid,
  .delivery-fields,
  .ownership-layout,
  .workflow,
  .site-map,
  .product-strip,
  .plans,
  .checkout-layout,
  .replacement-form {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    flex-direction: column;
  }

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

  .chain b {
    width: 2px;
    height: 24px;
    justify-self: center;
  }

  .chain b::after {
    right: -4px;
    top: 20px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid var(--teal);
    border-bottom: 0;
  }

  .matrix-row {
    grid-template-columns: 1fr;
  }

  .front-hero {
    min-height: 280px;
    padding: 24px;
  }

  .front-hero h2 {
    font-size: 32px;
  }
}

@media (max-width: 560px) {
  .main,
  .sidebar {
    padding: 16px;
  }

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

  .metric strong {
    font-size: 28px;
  }

  .front-actions {
    flex-direction: column;
  }

  .front-actions button,
  .plans button {
    width: 100%;
  }
}
