:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dde5;
  --paper: #fbfcfe;
  --surface: #ffffff;
  --teal: #0f766e;
  --blue: #2563eb;
  --gold: #b7791f;
  --rose: #be3455;
  --green: #2f855a;
  --shadow: 0 16px 45px rgba(28, 39, 54, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 330px),
    var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 24px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding: 18px 0 28px;
}

.eyebrow,
.date-line,
.section-note,
.metric span,
.metric small,
.mini-metric span,
.section-head span,
.total-panel span,
.total-panel small,
.legend small,
.bar-meta,
label span,
td:last-child {
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 800;
}

h1 {
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.date-line {
  margin-top: 18px;
  font-size: 16px;
}

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

.total-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
}

.total-panel strong {
  margin: 10px 0 8px;
  color: var(--teal);
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
}

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

.metric,
.mini-metric {
  padding: 20px;
}

.metric span,
.mini-metric span,
.total-panel span,
.section-head span,
label span {
  font-size: 14px;
  font-weight: 800;
}

.metric strong,
.mini-metric strong {
  display: block;
  margin-top: 10px;
  font-size: 27px;
  line-height: 1.15;
}

.metric small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.panel {
  padding: 22px;
}

.table-panel,
.work-panel {
  margin-top: 18px;
}

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

.section-note {
  margin-top: 6px;
  font-size: 14px;
}

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

.donut {
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0deg, var(--teal) 360deg);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(23, 32, 42, 0.08);
}

.donut::after {
  content: "固定";
  position: absolute;
  inset: 23%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--line);
}

.legend,
.bar-list,
.item-stack {
  display: grid;
  gap: 12px;
}

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
}

.legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.bar-track {
  height: 13px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8edf3;
}

.bar-fill {
  height: 100%;
  min-width: 4px;
  border-radius: 4px;
}

.bar-meta {
  font-size: 13px;
}

button {
  min-height: 38px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  background: var(--ink);
  color: white;
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
}

.danger {
  border-color: #b42318;
  color: #b42318;
}

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

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

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

th {
  color: var(--muted);
  background: #f3f6f9;
  font-size: 13px;
}

td {
  font-size: 15px;
  font-weight: 800;
}

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

td:nth-child(3),
td:nth-child(4),
th:nth-child(3),
th:nth-child(4) {
  text-align: right;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

input[type="number"] {
  text-align: right;
}

input:focus,
select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.monthly-table {
  min-width: 980px;
}

.monthly-table th:nth-child(4),
.monthly-table td:nth-child(4) {
  text-align: right;
}

.monthly-table th:nth-child(6),
.monthly-table td:nth-child(6) {
  width: 86px;
  text-align: center;
}

.entry-form {
  display: grid;
  grid-template-columns: 120px minmax(180px, 1fr) 140px 140px;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
}

.wide {
  grid-column: span 2;
}

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

.daily-table {
  min-width: 820px;
}

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

.daily-table th:nth-child(3),
.daily-table td:nth-child(3) {
  width: 150px;
  text-align: right;
}

.day-label {
  display: grid;
  gap: 4px;
  min-width: 78px;
}

.day-label small,
.entry-note {
  color: var(--muted);
  font-size: 12px;
}

.expense-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 34px;
  gap: 10px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 9px;
  background: #fbfcfe;
}

.expense-name {
  display: grid;
  gap: 3px;
}

.expense-amount,
.day-total {
  color: var(--teal);
  font-weight: 900;
}

.icon-button {
  min-height: 32px;
  width: 32px;
  padding: 0;
  border-color: #cbd5e1;
  background: white;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-weight: 800;
}

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

  .entry-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 580px) {
  .page-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .panel,
  .metric,
  .mini-metric,
  .total-panel {
    padding: 16px;
  }

  .section-head,
  .entry-form {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .wide {
    grid-column: auto;
  }

  button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  button,
  .entry-form {
    display: none;
  }

  .total-panel,
  .metric,
  .mini-metric,
  .panel {
    box-shadow: none;
  }
}
