:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #17201d;
  --muted: #65726d;
  --line: #d8e0dc;
  --accent: #0f7a5b;
  --accent-dark: #085d45;
  --warn: #b45309;
  --shadow: 0 12px 30px rgba(18, 35, 30, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 14px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

.quote-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--accent-dark);
  background: #eef8f4;
  font-weight: 700;
}

.product-tabs,
.system-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0;
  background: var(--bg);
}

.tab {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.panel {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.field input,
.field select {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdfc;
  color: var(--ink);
}

.readonly-field input {
  background: #f1f6f4;
  color: var(--accent-dark);
  font-weight: 800;
}

.layer-list {
  display: grid;
  gap: 1px;
  padding: 0 14px 14px;
}

.layer-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.7fr) minmax(150px, 1.3fr) minmax(86px, 0.7fr) minmax(104px, 0.8fr) minmax(90px, 0.75fr);
  gap: 8px;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid #edf1ef;
}

.layer-row:last-child {
  border-bottom: 0;
}

.layer-label {
  align-self: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
}

.metric {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

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

.metric strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.detail-list {
  padding: 0 14px 14px;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid #edf1ef;
}

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

.detail-row strong {
  font-size: 14px;
}

.detail-row span {
  color: var(--muted);
  font-size: 12px;
}

.detail-row b {
  align-self: center;
  color: var(--accent-dark);
  font-size: 15px;
}

.summary-spacer {
  height: 98px;
}

.total-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 760px);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 30px rgba(18, 35, 30, 0.12);
}

.total-bar div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.total-label,
.total-bar small {
  color: var(--muted);
  font-size: 12px;
}

.total-bar strong {
  color: var(--accent-dark);
  font-size: 25px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.primary-action {
  flex: 0 0 auto;
  height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.primary-action:active,
.tab:active {
  transform: translateY(1px);
}

@media (max-width: 560px) {
  .field-grid {
    grid-template-columns: 1fr;
  }

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

  .layer-label {
    grid-column: 1 / -1;
  }

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