:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-soft: #eef3f2;
  --text: #17201b;
  --muted: #66736d;
  --line: #d8dfdb;
  --accent: #0d7c66;
  --accent-strong: #095c4b;
  --gold: #bc7a2f;
  --shadow: 0 18px 50px rgba(30, 48, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(13, 124, 102, 0.12), transparent 34%),
    linear-gradient(215deg, rgba(188, 122, 47, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

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

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

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

h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
}

h2 {
  font-size: 22px;
}

.as-of {
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.as-of span,
.metric span,
.progress-block span,
dt,
.table-note {
  color: var(--muted);
  font-size: 13px;
}

.as-of strong {
  font-size: 18px;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 9px;
  min-height: 134px;
  padding: 20px;
}

.metric-primary {
  background: var(--accent);
  color: #fff;
}

.metric-primary span,
.metric-primary small {
  color: rgba(255, 255, 255, 0.9);
}

.metric strong {
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metric small {
  color: var(--muted);
  font-size: 13px;
}

.metric-primary small {
  color: rgba(255, 255, 255, 0.9);
}

.panel {
  margin-top: 14px;
  padding: 22px;
}

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

.status-pill {
  min-width: 62px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.next-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  align-items: center;
}

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

.next-details div {
  min-height: 98px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.next-details dd {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.progress-block {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 126px;
  padding: 18px;
  border-radius: 8px;
  background: #fff8ee;
}

.progress-block strong {
  display: block;
  margin: 4px 0;
  font-size: 28px;
}

.progress-block small {
  color: var(--muted);
}

.progress-ring {
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff8ee 58%, transparent 59%),
    conic-gradient(var(--gold) var(--progress, 0%), #ead8bf 0);
}

.payment-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(44px, 1fr));
  gap: 10px;
  height: 230px;
  align-items: end;
  overflow-x: auto;
  padding: 8px 2px 0;
}

.chart-item {
  display: grid;
  grid-template-rows: 34px 1fr 20px;
  min-width: 44px;
  height: 100%;
  justify-items: center;
  gap: 7px;
}

.chart-value {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  writing-mode: vertical-rl;
}

.chart-bar {
  width: 100%;
  max-width: 34px;
  align-self: end;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

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

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

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

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

tbody tr:hover {
  background: #f8fbfa;
}

.empty-state,
.empty-cell {
  color: var(--muted);
  text-align: center;
}

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

  .next-layout,
  .next-details {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .topbar,
  .section-title {
    display: grid;
    justify-items: start;
  }

  .summary-grid,
  .next-details {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 112px;
  }

  .panel {
    padding: 16px;
  }

  .payment-chart {
    grid-template-columns: repeat(12, 48px);
  }
}
