:root {
  --bg: #f2ede4;
  --bg-deep: #e9dfd1;
  --surface: rgba(255, 252, 247, 0.86);
  --surface-strong: #fffcf6;
  --text: #2e261f;
  --muted: #6c5c4f;
  --line: rgba(99, 80, 59, 0.14);
  --primary: #a8452f;
  --primary-deep: #7d2f1f;
  --secondary: #365f57;
  --accent: #d1a14a;
  --positive: #bd4437;
  --negative: #1f8a63;
  --warning: #af7b17;
  --shadow: 0 24px 60px rgba(72, 47, 24, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(209, 161, 74, 0.26), transparent 18%),
    radial-gradient(circle at 85% 8%, rgba(54, 95, 87, 0.17), transparent 16%),
    linear-gradient(180deg, #fcf8f2 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 96, 73, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 96, 73, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 88%);
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(99, 80, 59, 0.1);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.6);
  box-shadow: 0 10px 30px rgba(72, 47, 24, 0.06);
  backdrop-filter: blur(10px);
}

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

.brand-mark,
.meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
}

.brand-mark {
  min-width: 58px;
  height: 36px;
  color: #fffaf5;
  background: linear-gradient(135deg, var(--primary), #c26d41);
  box-shadow: 0 10px 20px rgba(168, 69, 47, 0.2);
}

.brand-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-pill {
  padding: 8px 14px;
  color: var(--secondary);
  border: 1px solid rgba(54, 95, 87, 0.14);
  background: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.hero,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero::after,
.panel::after {
  content: "";
  position: absolute;
  right: -56px;
  bottom: -72px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 69, 47, 0.12) 0%, transparent 72%);
  pointer-events: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 20px;
  padding: 34px 32px;
  margin-bottom: 18px;
  background:
    linear-gradient(140deg, rgba(255, 252, 247, 0.92), rgba(244, 236, 224, 0.86)),
    radial-gradient(circle at top right, rgba(209, 161, 74, 0.18), transparent 34%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 18px 18px auto auto;
  width: 190px;
  height: 190px;
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(54, 95, 87, 0.18), rgba(54, 95, 87, 0.02)),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.1) 0,
      rgba(255, 255, 255, 0.1) 10px,
      transparent 10px,
      transparent 20px
    );
  transform: rotate(10deg);
  opacity: 0.9;
  pointer-events: none;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--secondary);
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
}

.section-kicker {
  margin-bottom: 10px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "STZhongsong", "Songti SC", "SimSun", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
}

h2 {
  font-size: clamp(24px, 2.6vw, 32px);
}

h3 {
  font-size: 20px;
}

.hero-text,
.panel-caption,
.summary-note,
.candidate-card p,
.recommendation-card p,
.status-card span,
.field span,
.subtle,
.timeline-card span,
.summary-meta {
  color: var(--muted);
}

.hero-text {
  margin: 14px 0 0;
  max-width: 68ch;
  line-height: 1.82;
  font-size: 16px;
}

.hero-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.hero-tags span,
.signal-chip,
.badge,
.recommendation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.hero-tags span {
  padding: 8px 14px;
  border: 1px solid rgba(54, 95, 87, 0.16);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.hero-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.hero-stat-card,
.summary-card,
.chart-card,
.timeline-card,
.field,
.status-card,
.candidate-card,
.recommendation-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.hero-stat-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 249, 242, 0.96), rgba(241, 233, 221, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hero-stat-card.wide {
  grid-column: span 2;
}

.hero-stat-card .label {
  color: var(--muted);
  font-size: 13px;
}

.hero-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.hero-stat-card p {
  margin: 8px 0 0;
  line-height: 1.7;
  color: var(--muted);
}

.panel {
  padding: 28px;
  margin-bottom: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.panel-caption {
  margin: 0;
  line-height: 1.65;
  max-width: 44ch;
}

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

.summary-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 239, 229, 0.9));
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.summary-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(72, 47, 24, 0.08);
  border-color: rgba(168, 69, 47, 0.2);
}

.summary-card.positive {
  background: linear-gradient(180deg, rgba(189, 68, 55, 0.12), rgba(209, 161, 74, 0.16));
}

.summary-card.negative {
  background: linear-gradient(180deg, rgba(31, 138, 99, 0.12), rgba(144, 199, 177, 0.16));
}

.summary-card.warning {
  background: linear-gradient(180deg, rgba(209, 161, 74, 0.16), rgba(255, 245, 224, 0.32));
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-value {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  line-height: 1.1;
}

.summary-meta,
.summary-note {
  display: block;
  margin-top: 10px;
  line-height: 1.6;
  font-size: 13px;
}

.summary-note {
  margin-bottom: 0;
}

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

.band-item {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(54, 95, 87, 0.08), rgba(255, 255, 255, 0.7));
}

.band-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.band-item strong {
  font-size: 17px;
  line-height: 1.5;
}

.signal-chip {
  padding: 10px 16px;
  border: 1px solid transparent;
}

.signal-good {
  color: var(--positive);
  background: rgba(189, 68, 55, 0.12);
  border-color: rgba(189, 68, 55, 0.22);
}

.signal-warn {
  color: var(--warning);
  background: rgba(209, 161, 74, 0.16);
  border-color: rgba(209, 161, 74, 0.26);
}

.signal-alert {
  color: var(--negative);
  background: rgba(31, 138, 99, 0.12);
  border-color: rgba(31, 138, 99, 0.22);
}

.table-shell {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

table {
  width: 100%;
  min-width: 1140px;
  border-collapse: collapse;
}

.snapshot-table,
.replacement-table {
  min-width: 1180px;
}

thead {
  background: rgba(231, 219, 201, 0.82);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(8px);
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

tbody tr:nth-child(odd) td,
tbody tr:nth-child(odd) th {
  background: rgba(255, 252, 246, 0.62);
}

tbody tr:hover td,
tbody tr:hover th {
  background: rgba(255, 247, 237, 0.86);
}

th:nth-child(n + 2),
td:nth-child(n + 2) {
  text-align: right;
}

th:first-child,
td:first-child,
th:last-child,
td:last-child {
  text-align: left;
}

.product-name {
  max-width: 300px;
  line-height: 1.55;
  font-weight: 700;
}

.subtle {
  margin-top: 6px;
  font-size: 12px;
}

.value-positive {
  color: var(--positive);
  font-weight: 700;
}

.value-negative {
  color: var(--negative);
  font-weight: 700;
}

.value-warning {
  color: var(--warning);
  font-weight: 700;
}

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

.badge {
  padding: 6px 12px;
}

.badge-positive {
  color: var(--positive);
  background: rgba(189, 68, 55, 0.1);
}

.badge-negative {
  color: var(--negative);
  background: rgba(31, 138, 99, 0.12);
}

.badge-warning {
  color: var(--warning);
  background: rgba(209, 161, 74, 0.16);
}

.badge-muted {
  color: var(--muted);
  background: rgba(137, 120, 103, 0.12);
}

.panel-split {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 18px;
}

.trend-panel,
.entry-panel {
  min-width: 0;
}

.chart-card {
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.9), rgba(242, 234, 221, 0.88));
  position: relative;
}

.chart-card::after {
  content: "";
  position: absolute;
  inset: auto 16px 16px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(209, 161, 74, 0.18), transparent 72%);
  pointer-events: none;
}

#trendChart {
  width: 100%;
  height: 320px;
  display: block;
}

.grid-line {
  stroke: rgba(104, 87, 69, 0.12);
  stroke-width: 1;
}

.zero-line {
  stroke: rgba(54, 95, 87, 0.35);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}

.axis-label,
.value-label {
  fill: #78685a;
  font-size: 12px;
  font-family: "Microsoft YaHei", sans-serif;
}

.value-label {
  font-size: 11px;
}

.trend-line {
  fill: none;
  stroke: #a8452f;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.area-fill {
  fill: url(#areaGradient);
}

.line-marker {
  fill: #fff8ef;
  stroke: #a8452f;
  stroke-width: 3;
}

.bar-positive {
  fill: rgba(189, 68, 55, 0.18);
}

.bar-negative {
  fill: rgba(31, 138, 99, 0.22);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.timeline-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.7);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(72, 47, 24, 0.08);
}

.timeline-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 22px;
}

.timeline-positive {
  background: rgba(189, 68, 55, 0.08);
}

.timeline-negative {
  background: rgba(31, 138, 99, 0.08);
}

.timeline-date {
  font-size: 13px;
  letter-spacing: 0.08em;
}

.snapshot-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.94), rgba(244, 238, 229, 0.9));
}

.field.compact span {
  line-height: 1.55;
  font-size: 13px;
}

.field input {
  width: 100%;
  border: 1px solid rgba(99, 80, 59, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: rgba(168, 69, 47, 0.42);
  box-shadow: 0 0 0 4px rgba(168, 69, 47, 0.08);
}

.input-table-shell {
  border-radius: 18px;
}

.snapshot-table th,
.snapshot-table td {
  min-width: 180px;
  text-align: left;
}

.snapshot-table th:first-child,
.snapshot-table td:first-child {
  min-width: 120px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f8f1e6;
  box-shadow: 10px 0 18px rgba(72, 47, 24, 0.04);
}

.snapshot-table tbody th {
  background: #fbf6ef;
}

.snapshot-table input {
  width: 100%;
  min-width: 140px;
  border: 1px solid rgba(99, 80, 59, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
}

.snapshot-table input:focus {
  outline: none;
  border-color: rgba(168, 69, 47, 0.42);
  box-shadow: 0 0 0 4px rgba(168, 69, 47, 0.08);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #fffaf5;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 16px 30px rgba(168, 69, 47, 0.24);
}

.ghost-button {
  color: var(--secondary);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(54, 95, 87, 0.16);
}

.danger-button {
  color: #fffaf5;
  background: linear-gradient(135deg, #6a6a6a, #4d4d4d);
}

.status-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.78);
}

.status-idle strong {
  color: var(--secondary);
}

.replacement-table td:nth-child(6) {
  min-width: 360px;
}

.status-success {
  background: rgba(189, 68, 55, 0.1);
  border-color: rgba(189, 68, 55, 0.24);
}

.status-success strong {
  color: var(--positive);
}

.status-error {
  background: rgba(31, 138, 99, 0.1);
  border-color: rgba(31, 138, 99, 0.24);
}

.status-error strong {
  color: var(--negative);
}

.replacement-table-shell {
  border-radius: 20px;
}

.replacement-table td:last-child,
.replacement-table th:last-child {
  text-align: center;
}

@media (max-width: 1120px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .panel-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hero,
  .hero-side,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    border-radius: 24px;
    align-items: flex-start;
  }

  .hero-stat-card.wide {
    grid-column: auto;
  }

  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 18px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

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