:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --ink: #1f1f1f;
  --muted: #5f6368;
  --line: #e0e3e8;
  --line-strong: #c4c7c5;
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --primary-soft: #d3e3fd;
  --primary-text: #041e49;
  --danger: #b3261e;
  --danger-soft: #fce8e6;
  --ok: #0c6e3d;
  --ok-soft: #c4eed0;
  --warn: #8c5000;
  --warn-soft: #feefc3;
  --info: #0842a0;
  --info-soft: #d3e3fd;
  --void: #5f6368;
  --void-soft: #e8eaed;
  --shadow: 0 1px 2px rgba(31, 31, 31, 0.06);
  --font: "Google Sans", "Roboto", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

a { color: var(--primary); }
button, input, select, textarea { font: inherit; }

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.product {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  padding: 8px;
  border-radius: 24px;
}
.product:hover { background: #f1f3f4; }
.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 18px;
}
.product-name { font-size: 22px; font-weight: 400; letter-spacing: 0; }
.account {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #aecbfa;
  color: #041e49;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.account-meta { display: flex; flex-direction: column; line-height: 1.2; }
.account-meta strong { font-size: 13px; font-weight: 500; }
.account-meta em { font-style: normal; font-size: 12px; color: var(--muted); }
.text-btn {
  background: none;
  border: 0;
  color: var(--primary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 20px;
  font-weight: 500;
}
.text-btn:hover { background: var(--primary-soft); }

.workspace { display: flex; min-height: calc(100vh - 64px); }
.rail {
  width: 256px;
  flex-shrink: 0;
  padding: 12px 0 32px;
}
.nav-label {
  margin: 18px 12px 6px 28px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.rail a {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 40px;
  margin: 0 12px 4px 0;
  padding: 0 16px 0 24px;
  border-radius: 0 20px 20px 0;
  text-decoration: none;
  color: #444746;
  font-size: 14px;
}
.rail a:hover { background: #e9eef6; }
.rail a.active {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 500;
}
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; }
.nav-icon svg { width: 20px; height: 20px; fill: currentColor; }

.content { flex: 1; min-width: 0; padding: 24px 32px 72px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 0 0 20px;
}
.page-actions { display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0; }
.page-actions .inline-form { margin: 0; }
.page-actions .detail-summary { min-width: 190px; text-align: right; }

dialog.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 760px;
  width: calc(100% - 32px);
}
dialog.modal::backdrop { background: rgba(32, 33, 36, 0.46); }
.modal-card {
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
  max-height: 90vh;
  overflow: auto;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.modal-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: #f1f3f4; }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.sheet {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 24px 0;
}
.sheet-block {
  background: #f8f9fa;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
}
.sheet-block.money {
  background: #f3f8ff;
  border-color: #c4d7f5;
}
.sheet-block-collapsible { padding: 0; }
.sheet-block-collapsible > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.sheet-block-collapsible > summary::-webkit-details-marker { display: none; }
.sheet-block-collapsible > summary::after { content: "+"; color: var(--muted); font-size: 20px; font-weight: 400; }
.sheet-block-collapsible[open] > summary::after { content: "−"; }
.sheet-block-collapsible > summary small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.sheet-block-collapsible > .sheet-fields { padding: 0 16px 16px; }
.sheet-block-head { margin: 0 0 12px; }
.sheet-block-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.sheet-block-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.sheet-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  grid-column: span 6;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  min-width: 0;
}
.field.w2 { grid-column: span 2; }
.field.w3 { grid-column: span 3; }
.field.w4 { grid-column: span 4; }
.field.w5 { grid-column: span 5; }
.field.w6 { grid-column: span 6; }
.field.w7 { grid-column: span 7; }
.field.w8 { grid-column: span 8; }
.field.wide { grid-column: span 12; }
.field[hidden] { display: none; }
.field.emphasis input {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  background: #fff;
  border-color: #a8c7fa;
}
.field input, .field select {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  height: 40px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.field .locked {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f1f3f4;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 4px -24px 0;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
  position: sticky;
  bottom: 0;
}
.sheet-signs {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 120px));
  gap: 16px;
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}
.sheet-signs span {
  border-bottom: 1px solid var(--line);
  padding: 8px 0 6px;
}
.modal .form {
  grid-template-columns: 1fr 1fr;
  padding: 8px 24px 24px;
}
.douyin-import-body { display: grid; gap: 16px; padding: 8px 24px 24px; }
.douyin-import-note { padding: 14px 16px; border-radius: 12px; background: #f3f8ff; border: 1px solid #d2e3fc; }
.douyin-import-note strong { display: block; margin-bottom: 5px; font-size: 15px; }
.douyin-import-note p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.douyin-import-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; }
.douyin-import-upload label { display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.douyin-import-upload input[type="file"] { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.douyin-import-upload > span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.douyin-import-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.douyin-import-preview .card-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.import-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 12px 16px; gap: 10px; }
.import-summary > div { min-width: 0; padding: 10px 12px; border-radius: 10px; background: #f8f9fa; }
.import-summary dt { color: var(--muted); font-size: 12px; }
.import-summary dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.import-summary .new { background: #f0f9f4; }
.import-summary .changed { background: #fff8e1; }
.import-summary .income { grid-column: span 2; background: #f3f8ff; }
.douyin-import-preview .hint { margin: 0; padding-top: 4px; }
.douyin-import-confirm { display: flex; justify-content: flex-end; padding: 0 16px 16px; }
.reimbursement-sheet { gap: 12px; padding-top: 20px; }
.reimbursement-sheet .sheet-block { padding: 18px; }
.reimbursement-sheet .sheet-block-collapsible { padding: 0; }
.reimbursement-sheet .sheet-block-head { margin-bottom: 16px; }
.reimbursement-sheet .sheet-fields { gap: 16px 12px; }
.reimbursement-sheet .field > span { color: var(--ink); font-size: 13px; }
.reimbursement-sheet .field input,
.reimbursement-sheet .field select { height: 44px; border-radius: 10px; }
.reimbursement-foot p { margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { display: none; }
.page-title { margin: 0; font-size: 28px; font-weight: 400; letter-spacing: 0; }
.lede { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  margin: 0 0 8px;
  padding: 6px 8px 6px 0;
  font-size: 13px;
}
.back svg { width: 18px; height: 18px; fill: currentColor; }
.back:hover { color: var(--primary); }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpis:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 560px;
}
.kpis:has(> :nth-child(5)) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
}
.kpi-rank ol {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.kpi-rank li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
  padding: 1px 0;
  font-size: 12px;
  line-height: 1.35;
}
.kpi-rank .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-rank .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-rank .meta { display: none; }
.kpi-rank strong { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  min-height: 112px;
}
.kpi .period-badge { position: absolute; top: 14px; right: 16px; margin-top: 0; }
.kpi .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.money {
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
td .money { font-size: 15px; }
.frac { font-size: smaller; font-weight: 700; }
.kpi .amt {
  margin-top: auto;
  padding-top: 16px;
}
.kpi .h {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.kpi .v {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.kpi.neg .v { color: var(--danger); }
.kpi.ok .v { color: var(--ok); }
.kpi.muted .v { color: var(--muted); font-size: 20px; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}
.split .card { margin-bottom: 0; }
.card-head { padding: 16px 20px 0; }
.card h2 {
  margin: 0;
  padding: 16px 20px 0;
  font-size: 16px;
  font-weight: 500;
}
.card-head h2 { padding: 0; }
.cost-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cost-range-tools { display: grid; justify-items: end; gap: 8px; }
.cost-range-tools .filter-presets { min-height: 0; }
.cost-range-tools .filter-presets a,
.cost-range-tools .range-custom-toggle {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.cost-range-tools .filter-presets .active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); color: var(--primary); font-weight: 500; }
.cost-range-custom { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: end; gap: 8px; }
.cost-range-custom label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.cost-range-custom input { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 9px; color: var(--ink); background: #fff; }
.cost-range-custom .btn { min-height: 34px; }
.profit-calculator-card { scroll-margin-top: 16px; }
.profit-calculator-card .card-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.profit-calculator-card .card-head h2 { margin-bottom: 6px; }
.profit-calculator-card .card-head .hint { margin: 0; }
.profit-calculator-form { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(360px, 1.6fr); gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.profit-product-field,
.profit-expense-fields { display: grid; align-content: start; gap: 8px; color: var(--muted); font-size: 12px; }
.profit-calculator-form select { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 10px; color: var(--ink); background: #fff; font: inherit; }
.profit-expense-list { display: grid; gap: 8px; }
.profit-expense-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(100px, auto) auto; gap: 18px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.profit-expense-row > div { display: grid; gap: 3px; }
.profit-expense-row > div > span { color: var(--muted); font-size: 11px; }
.profit-expense-allocation { justify-items: end; text-align: right; }
.profit-expense-allocation strong { font-size: 15px; font-weight: 600; }
.profit-expense-row .btn,
.profit-expense-add { min-height: 40px; }
.profit-expense-add { justify-self: start; }
.profit-expense-dialog .modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.profit-dialog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 24px; }
.profit-dialog-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.profit-expense-dialog .modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 20px; }
.profit-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.profit-metric { display: grid; gap: 5px; min-width: 0; padding: 18px 20px; background: var(--surface); }
.profit-metric > span { color: var(--muted); font-size: 12px; }
.profit-metric > strong { color: var(--ink); font-size: 22px; font-weight: 600; }
.profit-metric > small { color: var(--muted); font-size: 11px; }
.profit-formula { margin: 0; padding: 14px 20px; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .cost-card-head { display: grid; }
  .cost-range-tools { justify-items: start; }
  .cost-range-custom { justify-content: flex-start; }
  .profit-calculator-form { grid-template-columns: 1fr; }
  .profit-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profit-dialog-fields { grid-template-columns: 1fr; }
  .profit-expense-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .profit-expense-allocation { grid-column: 1; justify-items: start; text-align: left; }
  .profit-expense-row > .btn { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 560px) { .profit-metrics { grid-template-columns: 1fr; } }
.cat-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; margin-bottom: 16px; }
.cat-groups:has(> .cat-card:only-child) { grid-template-columns: 1fr; }
.cat-column { display: grid; gap: 14px; align-content: start; min-width: 0; }
.cat-groups .card { margin-bottom: 0; }
.cat-tabs { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow-x: auto; }
.cat-tabs .tabs { min-width: max-content; border-bottom: 0; }
.cat-card { border-radius: 12px; }
.cat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px 12px;
}
.cat-head h2 { display: flex; align-items: center; gap: 9px; }
.tag.cat-primary-chip { height: 28px; padding: 0 11px; border-radius: 8px; font-size: 15px; font-weight: 700; }
.cat-flags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.cat-items { border-top: 1px solid var(--line); }
.cat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  min-height: 44px;
  border-top: 1px solid var(--line);
}
.cat-row:first-child { border-top: 0; }
.cat-row-actions { display: flex; align-items: center; flex-wrap: nowrap; }
.cat-row-actions > form { display: flex; align-items: center; margin: 0; }
.cat-row-actions .text-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 33px; padding: 6px 10px; line-height: 1; white-space: nowrap; }
.cat-card > .hint { margin: 0; padding: 0 16px 12px; }
.cat-card .empty { padding: 18px 16px; }
.cat-color-field {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.cat-swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form label.cat-swatch,
.cat-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  box-sizing: border-box;
  display: inline-flex;
  padding: 0;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  position: relative;
}
.form label.cat-swatch input,
.cat-swatch input {
  appearance: none;
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}
.cat-swatch:has(:checked),
.cat-swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.cat-swatch.cat-chartreuse { background: #c0ca33; }
.cat-swatch.cat-lime { background: #7cb342; }
.cat-swatch.cat-green { background: var(--ok); }
.cat-swatch.cat-mint { background: #26a69a; }
.cat-swatch.cat-teal { background: #00897b; }
.cat-swatch.cat-emerald { background: #2e7d32; }
.cat-swatch.cat-forest { background: #1b5e20; }
.cat-swatch.cat-olive { background: #827717; }
.cat-swatch.cat-sage { background: #7d9b76; }
.cat-swatch.cat-moss { background: #4e6b3c; }
.cat-swatch.cat-salmon { background: #e57373; }
.cat-swatch.cat-tomato { background: #e53935; }
.cat-swatch.cat-red { background: var(--danger); }
.cat-swatch.cat-crimson { background: #d32f2f; }
.cat-swatch.cat-rose { background: #c2185b; }
.cat-swatch.cat-pink { background: #ec407a; }
.cat-swatch.cat-maroon { background: #8b1e3f; }
.cat-swatch.cat-rust { background: #bf360c; }
.cat-swatch.cat-burgundy { background: #6a1b2a; }
.cat-swatch.cat-carmine { background: #ad1457; }
.cat-swatch.cat-cream { background: #fff8e1; border-color: #e0d7b8; }
.cat-swatch.cat-lemon { background: #fdd835; }
.cat-swatch.cat-canary { background: #fff176; }
.cat-swatch.cat-yellow { background: #fbc02d; }
.cat-swatch.cat-gold { background: #f9a825; }
.cat-swatch.cat-mustard { background: #c9a227; }
.cat-swatch.cat-honey { background: #ffcc80; }
.cat-swatch.cat-flax { background: #e6d5a5; }
.cat-swatch.cat-khaki { background: #c2b280; }
.cat-swatch.cat-maize { background: #eebc4f; }
.cat-swatch.cat-peach { background: #ffab91; }
.cat-swatch.cat-apricot { background: #ff8a65; }
.cat-swatch.cat-amber { background: #ffb300; }
.cat-swatch.cat-orange { background: #ef6c00; }
.cat-swatch.cat-tangerine { background: #fb8c00; }
.cat-swatch.cat-pumpkin { background: #ef6c00; }
.cat-swatch.cat-copper { background: #d84315; }
.cat-swatch.cat-persimmon { background: #e64a19; }
.cat-swatch.cat-ginger { background: #ef6c00; }
.cat-swatch.cat-sunset { background: #f57c00; }
.cat-swatch.cat-sky { background: #42a5f5; }
.cat-swatch.cat-blue { background: #1976d2; }
.cat-swatch.cat-cobalt { background: #1565c0; }
.cat-swatch.cat-navy { background: #163a6b; }
.cat-swatch.cat-slateblue { background: #607d9f; }
.cat-swatch.cat-lavender { background: #ab8bd4; }
.cat-swatch.cat-violet { background: #8e5cc2; }
.cat-swatch.cat-purple { background: #7b3fb2; }
.cat-swatch.cat-indigo { background: #5b3f9b; }
.cat-swatch.cat-plum { background: #854d82; }
.cat-swatch.cat-aqua { background: #4db6ac; }
.cat-swatch.cat-turquoise { background: #26a69a; }
.cat-swatch.cat-cyan { background: #0097a7; }
.cat-swatch.cat-petrol { background: #006b73; }
.cat-swatch[style] { background: var(--cat-color); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  background: #fff;
}
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { position: relative; }
tbody tr.clickable:hover td { background: #f6f8fc; }
.unpaid-summary { color: #c58a00; font-weight: 650; }
a.cover { position: absolute; inset: 0; z-index: 1; }
tbody tr form, tbody tr button, .thumbs { position: relative; z-index: 2; }
.thumbs {
  display: flex;
  gap: 4px;
  align-items: center;
}
.receipt-stack {
  position: relative;
  display: block;
  width: 46px;
  height: 40px;
}
.receipt-stack a {
  position: absolute;
  inset: 2px auto auto 0;
  z-index: 2;
}
.receipt-stack.is-multiple a:nth-of-type(2) {
  inset: 3px auto auto 8px;
  z-index: 1;
  transform: rotate(4deg);
}
.receipt-stack a:nth-of-type(n + 3) { display: none; }
.receipt-count {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.thumbs a {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fa;
}
.thumbs a:hover { border-color: var(--primary); }
dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
}
dialog.lightbox[open] {
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
}
dialog.lightbox::backdrop { background: rgba(32, 33, 36, 0.72); }
dialog.lightbox img {
  display: block;
  max-width: min(92vw, 1100px);
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
  transform-origin: center center;
  transition: transform 0.15s ease;
}
.lightbox-tools {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 3;
}
.lightbox-tools button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.lightbox-tools button:hover { background: #f1f3f4; }
.lightbox-tools svg { width: 22px; height: 22px; fill: currentColor; }
.lightbox-nav {
  position: fixed;
  top: 50%;
  z-index: 3;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}
.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-nav:hover { background: #fff; }
.lightbox-nav svg { width: 28px; height: 28px; fill: currentColor; }
.lightbox-counter {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 3;
  min-width: 56px;
  padding: 7px 12px;
  border-radius: 16px;
  background: rgba(32, 33, 36, 0.82);
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  transform: translateX(-50%);
  font-variant-numeric: tabular-nums;
}
.lightbox-counter[hidden] { display: none; }
.thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
.doc { color: var(--primary); font-weight: 500; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }

.receipts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 8px 20px 20px;
}
.receipts a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  background: #fff;
}
.receipts a:hover { border-color: var(--primary); }
.receipts img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: #f8f9fa;
}
.receipts span {
  display: block;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.image-upload {
  width: 100%;
  border: 1px solid var(--ledger-line);
  border-radius: var(--ledger-radius);
  background: var(--surface);
  overflow: hidden;
}
.image-upload.upload-wide { grid-column: span 12; }
.image-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.image-upload-row {
  min-height: 72px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.image-upload-row > div { min-width: 0; }
.image-upload-row strong {
  display: block;
  color: var(--ledger-ink);
  font-size: 13px;
  line-height: 1.4;
}
.image-upload-row span {
  display: block;
  margin-top: 4px;
  color: var(--ledger-muted);
  font-size: 11px;
  font-weight: 400;
}
.image-upload-pick { flex: 0 0 auto; }
.image-upload-previews {
  padding: 0 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 10px;
}
.image-upload-previews[hidden] { display: none; }
.image-upload-previews figure {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--ledger-line);
  border-radius: var(--ledger-radius-sm);
  background: #fff;
  overflow: hidden;
}
.image-upload-previews figure > div {
  position: relative;
  height: 88px;
  display: grid;
  place-items: center;
  background: var(--ledger-soft);
  overflow: hidden;
}
.image-upload-previews img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.image-upload-previews b {
  display: none;
  color: var(--ledger-muted);
  font-size: 12px;
}
.image-upload-previews .no-image-preview img { display: none; }
.image-upload-previews .no-image-preview b { display: block; }
.image-upload-previews figcaption {
  padding: 8px 9px;
  display: grid;
  gap: 2px;
}
.image-upload-previews figcaption span {
  overflow: hidden;
  color: var(--ledger-ink);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-upload-previews figcaption small { color: var(--ledger-muted); font-size: 10px; }
.image-upload-error {
  margin: 0 16px 12px;
  color: var(--danger);
  font-size: 12px;
}
.image-upload-progress {
  padding: 0 16px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.image-upload-progress[hidden] { display: none; }
.image-upload-progress > div {
  height: 6px;
  border-radius: 3px;
  background: var(--ledger-line);
  overflow: hidden;
}
.image-upload-progress > div span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--ledger-blue);
  transition: width .15s ease;
}
.image-upload-progress strong {
  min-width: 82px;
  color: var(--ledger-muted);
  font-size: 11px;
  text-align: right;
}

.empty { padding: 32px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 6px; font-weight: 500; }
.empty p { margin: 0; }

.form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 8px 20px 20px;
}
.form label, .filters label, .login label, .void-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.form input, .form select, .login input, .void-form input {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--ink);
  height: 40px;
}
.filters input {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 20px;
  padding: 10px 14px;
  color: var(--ink);
  height: 40px;
}
.filters input[type="date"] {
  position: relative;
  cursor: pointer;
}
.filters input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.form input:focus, .form select:focus, .filters input:focus, .login input:focus, .void-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.form .wide { grid-column: span 2; }
.form .actions { display: flex; align-items: end; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 40px;
}
.filter-presets a {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.filter-presets a:hover { border-color: var(--primary); }
.filter-presets a.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  color: var(--primary);
  font-weight: 500;
}

.btn {
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 20px;
  height: 40px;
  padding: 0 24px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.btn:hover { background: var(--primary-hover); }
.btn.ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--line-strong);
}
.btn.ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn.small { height: 32px; padding: 0 16px; font-size: 13px; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.ghost { background: #fff; color: var(--danger); border-color: #f2b8b5; }
.btn.danger.ghost:hover { background: var(--danger-soft); }

.flash {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
}
.flash.ok { background: var(--ok-soft); color: var(--ok); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-soft);
  color: var(--primary-text);
}
.tag.wait { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.void { background: var(--void-soft); color: var(--void); }
.tag.transit { background: #e8f0fe; color: #1967d2; }
.tag.inbound { background: #e8f0fe; color: #1967d2; }
.tag.writeoff { background: var(--void-soft); color: var(--void); }
.tag.outbound { background: var(--ok-soft); color: var(--ok); }
.tag.daily { background: var(--warn-soft); color: var(--warn); }
.tag.promo { background: #fce8e6; color: #b3261e; }
.tag.expense { background: var(--warn-soft); color: var(--warn); }
.tag.reimbursement { background: #f3e8fd; color: #7627bb; }
.tag.cat { background: var(--danger-soft); color: var(--danger); }
.tag.cat-chartreuse { background: #f0f4c3; color: #827717; }
.tag.cat-lime { background: #dcedc8; color: #33691e; }
.tag.cat-green { background: var(--ok-soft); color: var(--ok); }
.tag.cat-mint { background: #e0f2f1; color: #00695c; }
.tag.cat-teal { background: #b2dfdb; color: #00695c; }
.tag.cat-emerald { background: #c8e6c9; color: #1b5e20; }
.tag.cat-forest { background: #a5d6a7; color: #1b5e20; }
.tag.cat-olive { background: #e6ee9c; color: #5d5d16; }
.tag.cat-sage { background: #dcedc8; color: #4e6b3c; }
.tag.cat-moss { background: #c5d1b8; color: #3e562e; }
.tag.cat-salmon { background: #ffcdd2; color: #c62828; }
.tag.cat-tomato { background: #ffcdd2; color: #b71c1c; }
.tag.cat-red { background: var(--danger-soft); color: var(--danger); }
.tag.cat-crimson { background: #ef9a9a; color: #b71c1c; }
.tag.cat-rose { background: #fce4ec; color: #ad1457; }
.tag.cat-pink { background: #f8bbd0; color: #ad1457; }
.tag.cat-maroon { background: #f3d6de; color: #8b1e3f; }
.tag.cat-rust { background: #ffccbc; color: #bf360c; }
.tag.cat-burgundy { background: #e8c5cc; color: #6a1b2a; }
.tag.cat-carmine { background: #f8bbd0; color: #880e4f; }
.tag.cat-cream { background: #fffde7; color: #8c6d1f; }
.tag.cat-lemon { background: #fff59d; color: #8c6d00; }
.tag.cat-canary { background: #fff9c4; color: #8c6d00; }
.tag.cat-yellow { background: #fff8e1; color: #8c5000; }
.tag.cat-gold { background: #ffecb3; color: #8c5000; }
.tag.cat-mustard { background: #f0e6b8; color: #6d5c16; }
.tag.cat-honey { background: #ffe0b2; color: #8c5000; }
.tag.cat-flax { background: #f3e5ab; color: #6d5c16; }
.tag.cat-khaki { background: #e6dbb8; color: #5d4e16; }
.tag.cat-maize { background: #ffe082; color: #8c5000; }
.tag.cat-peach { background: #ffccbc; color: #bf360c; }
.tag.cat-apricot { background: #ffab91; color: #d84315; }
.tag.cat-amber { background: #ffe082; color: #8c5000; }
.tag.cat-orange { background: var(--warn-soft); color: var(--warn); }
.tag.cat-tangerine { background: #ffe0b2; color: #e65100; }
.tag.cat-pumpkin { background: #ffcc80; color: #e65100; }
.tag.cat-copper { background: #ffab91; color: #bf360c; }
.tag.cat-persimmon { background: #ff8a65; color: #d84315; }
.tag.cat-ginger { background: #ffcc80; color: #e65100; }
.tag.cat-sunset { background: #ffb74d; color: #e65100; }
.tag.cat-sky { background: #e3f2fd; color: #1565c0; }
.tag.cat-blue { background: #e3f2fd; color: #0d47a1; }
.tag.cat-cobalt { background: #bbdefb; color: #0d47a1; }
.tag.cat-navy { background: #dbe6f3; color: #163a6b; }
.tag.cat-slateblue { background: #e5ebf0; color: #455a70; }
.tag.cat-lavender { background: #f0e8f8; color: #65408d; }
.tag.cat-violet { background: #eadcf5; color: #6a359c; }
.tag.cat-purple { background: #eee2f6; color: #652d91; }
.tag.cat-indigo { background: #e8e1f3; color: #49317e; }
.tag.cat-plum { background: #f0e3ed; color: #703b6d; }
.tag.cat-aqua { background: #e0f2f1; color: #00796b; }
.tag.cat-turquoise { background: #d5f0ed; color: #00796b; }
.tag.cat-cyan { background: #e0f7fa; color: #007c91; }
.tag.cat-petrol { background: #d9eeee; color: #00545b; }
.tag.cat[style] { background: var(--cat-color); color: var(--cat-ink); }

.tabs {
  display: flex;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs a {
  text-decoration: none;
  padding: 14px 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-with-help {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.tab-help {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0 10px 0 2px;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  cursor: pointer;
}
.tab-help:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.douyin-sku-map-body { padding: 8px 24px 24px; }
.douyin-sku-map-rules {
  margin: 0 0 12px;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
.douyin-sku-map-body .hint { margin: 0 0 14px; }
.douyin-sku-map-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
  box-sizing: border-box;
}
.pagination-summary { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pagination-controls { display: flex; align-items: center; gap: 4px; }
.pagination-page, .pagination-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-size: 12px;
  box-sizing: border-box;
}
.pagination-page:hover, .pagination-nav:hover { border-color: var(--primary); color: var(--primary); }
.pagination-page.active { border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 700; }
.pagination-nav.disabled { color: var(--muted); background: var(--ledger-soft); cursor: not-allowed; }
.pagination-ellipsis { min-width: 22px; color: var(--muted); text-align: center; }

@media (max-width: 600px) {
  .pagination { align-items: flex-start; flex-direction: column; }
  .pagination-controls { width: 100%; overflow-x: auto; padding-bottom: 2px; }
}

.bar {
  height: 4px;
  background: #e8eaed;
  border-radius: 99px;
  margin-top: 8px;
  overflow: hidden;
}
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

.notices { list-style: none; margin: 0; padding: 4px 0 8px; }
.notices li {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notices li:last-child { border-bottom: 0; }
.notices strong { font-size: 14px; font-weight: 500; }
.notices span { color: var(--muted); font-size: 13px; }
.notices .warn strong { color: var(--warn); }
.notices .todo strong { color: var(--primary); }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; }
.cost-history-grid { align-items: start; }
.cost-history-grid .table-wrap { max-height: 430px; overflow: auto; }

.stats { margin: 0; padding: 4px 0 8px; }
.stats > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.stats > div:last-child { border-bottom: 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.report-stats { margin: 0; padding: 8px 0 14px; }
.report-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 20px;
}
.report-stats dt { color: var(--muted); font-size: 13px; }
.report-stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.report-stats .hl { padding-top: 12px; }
.report-stats .hl dt { color: var(--ink); font-size: 14px; font-weight: 600; }
.report-stats .hl dd,
.report-stats .hl dd .money {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
}
.steps li,
.steps > a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.steps > a { color: inherit; text-decoration: none; }
.steps > a:hover { border-color: #a8c7fa; }
.steps span { color: var(--muted); font-size: 12px; }
.steps strong { font-size: 22px; font-weight: 400; font-variant-numeric: tabular-nums; }
.steps .active { background: #f3f8ff; border-color: #a8c7fa; }
.steps .done { background: #f6fef9; border-color: #addeb4; }

.hint, .formula, .chart-caption {
  padding: 0 20px 16px;
  color: var(--muted);
  font-size: 13px;
}
.content > .formula,
.content > .chart-caption {
  padding: 0 4px 16px;
  margin: -4px 0 4px;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
}
.period-badge {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: #f1f3f4;
  border-radius: 999px;
  padding: 4px 10px;
}
.chart-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}
.chart-hero .card-head { grid-column: 1; }
.chart-hero .trend-chart { display: contents; }
.chart-hero .trend-legend {
  grid-column: 2;
  grid-row: 1;
  padding: 18px 20px 0 0;
}
.chart-hero .trend-chart svg {
  grid-column: 1 / -1;
  padding: 0 12px;
}
.chart-hero .trend-stats {
  grid-column: 1 / -1;
}
.chart-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.45;
  max-width: 46em;
}
.chart-hero { margin-bottom: 16px; }
.report-hero {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}
.report-hero-kpis {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.report-hero-kpis .card,
.report-hero > .card {
  margin-bottom: 0;
}
.report-hero > .chart-hero { min-width: 0; }
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.chart-grid .card { margin-bottom: 0; min-width: 0; }
.pie-chart {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: center;
  gap: 8px 20px;
  padding: 8px 20px 20px;
}
.pie-chart svg {
  width: 320px;
  max-width: 100%;
  height: auto;
  display: block;
  justify-self: start;
}
.pie-center-value { fill: var(--ink); font-size: 13px; font-weight: 600; }
.pie-center-label { fill: var(--muted); font-size: 10px; }
.pie-leader { fill: none; stroke: #9aa0a6; stroke-width: 1; }
.pie-pct { fill: var(--ink); font-size: 11px; font-weight: 600; }
.pie-legend, .trend-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pie-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.pie-legend li:last-child { border-bottom: 0; }
.pie-legend .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-legend strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.pie-legend em { color: var(--muted); font-style: normal; min-width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; }
.pie-legend .dot, .trend-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.trend-chart { padding: 0 8px 8px; }
.trend-chart svg { width: 100%; height: auto; display: block; }
[data-trend-segment] { cursor: pointer; transition: opacity .15s ease; }
[data-trend-segment]:hover,
[data-trend-segment]:focus,
[data-trend-segment].active { opacity: .78; stroke: #fff; stroke-width: 2; outline: none; }
[data-pie-segment] { cursor: pointer; transition: opacity .15s ease, background-color .15s ease; }
.pie-chart svg [data-pie-segment]:hover,
.pie-chart svg [data-pie-segment]:focus,
.pie-chart svg [data-pie-segment].active { opacity: .78; stroke: #fff; stroke-width: 2; outline: none; }
.pie-legend [data-pie-segment]:hover,
.pie-legend [data-pie-segment]:focus,
.pie-legend [data-pie-segment].active { background: #f6f8fc; outline: none; }
.trend-chart .chart-line,
.trend-chart .chart-dot { pointer-events: none; }
.trend-tooltip {
  position: fixed;
  z-index: 80;
  display: grid;
  min-width: 168px;
  gap: 5px;
  padding: 10px 12px;
  color: #fff;
  background: #202124;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  pointer-events: none;
}
.trend-tooltip[hidden] { display: none; }
.trend-tooltip strong { font-size: 12px; font-weight: 650; }
.trend-tooltip > span { font-size: 12px; color: #e8eaed; }
.trend-tooltip-category { display: flex; align-items: center; gap: 7px; }
.trend-tooltip-category i { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.pie-tooltip-details {
  display: grid;
  gap: 5px;
  min-width: 190px;
  max-height: min(260px, 45vh);
  margin-top: 3px;
  padding-top: 7px;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,.18);
}
.trend-tooltip.has-details { pointer-events: auto; }
.pie-tooltip-details[hidden] { display: none; }
.pie-tooltip-details > span,
.pie-tooltip-details > a { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; color: #e8eaed; font-size: 12px; text-decoration: none; }
.pie-tooltip-details > a:hover { color: #fff; text-decoration: underline; }
.pie-tooltip-details > span > span,
.pie-tooltip-details > a > span { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pie-tooltip-details i { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 auto; }
.pie-tooltip-details strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-chart-link] { cursor: pointer; }
[data-chart-link]:focus { outline: none; filter: brightness(.9); }
.trend-legend {
  flex-direction: row;
  gap: 20px;
  width: auto;
  padding: 0 12px 4px;
}
.trend-legend li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.trend-stats {
  list-style: none;
  margin: 8px 8px 8px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.trend-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  text-align: center;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.trend-stats li:last-child { border-right: 0; }
.trend-stats .m { color: var(--muted); font-size: 12px; }
.trend-stats .in,
.trend-stats .out {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trend-stats .in { color: var(--ok); }
.trend-stats .out { color: var(--danger); }
.compare-chart { padding: 0 8px 8px; }
.compare-chart svg { width: 100%; height: auto; display: block; }
.compare-legend {
  list-style: none;
  margin: 4px 12px 4px;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}
.compare-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.compare-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.chart-line { stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: none; }
.chart-hline { stroke: #eceff1; stroke-width: 1; }
.chart-axis { stroke: #c4c7c5; stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; }
.chart-unit { fill: var(--muted); font-size: 10px; }
.chart-bar-label { fill: #3c4043; font-size: 10px; }
.chart-empty { fill: var(--muted); font-size: 11px; }
@media (max-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr; }
  .report-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .chart-hero { grid-template-columns: 1fr; }
  .chart-hero .trend-legend {
    grid-column: 1;
    grid-row: auto;
    padding: 0 16px 4px;
  }
  .pie-chart {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .pie-chart svg { width: min(320px, 100%); }
  .trend-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trend-tooltip { min-width: 150px; }
  .trend-stats li:nth-child(3) { border-right: 0; }
  .trend-stats li:nth-child(n+4) { border-top: 1px solid var(--line); }
}
.meta {
  margin: 0;
  padding: 4px 0 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.meta > div {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.meta dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.meta dd { margin: 0; font-size: 14px; }
.meta dd .money { font-weight: 700; }
.entries td:first-child { color: var(--muted); width: 64px; }
.void-form {
  display: flex;
  gap: 12px;
  align-items: end;
  padding: 0 20px 20px;
}
.void-form label { flex: 1; }
.detail-hero { display: flex; align-items: flex-end; justify-content: flex-end; gap: 28px; min-height: 0; padding: 0 20px; margin: 0 0 26px; }
.detail-hero-label { display: block; color: var(--ledger-muted); font-size: 12px; margin-bottom: 6px; }
.detail-hero strong { display: block; font-size: 40px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-hero strong i { display: inline-block; margin-right: 3px; font-size: .58em; font-style: normal; vertical-align: .12em; }
.detail-hero-status { color: var(--ledger-muted); font-size: 12px; padding-top: 4px; }
.detail-action-bar { position: fixed; right: 24px; bottom: 24px; z-index: 20; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.detail-action-bar .btn { pointer-events: auto; box-shadow: 0 8px 24px rgba(24,36,47,.16); }
.detail-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 190px; }
.detail-summary-head { display: flex; align-items: center; justify-content: flex-end; gap: 12px; color: var(--ledger-muted); font-size: 13px; }
.detail-summary strong { display: block; font-size: 40px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-summary strong i { display: inline-block; margin-right: 3px; font-size: .58em; font-style: normal; vertical-align: .12em; }
.danger-hint { color: var(--danger); font-size: 13px; line-height: 1.6; }
.void-modal .form { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 20px 24px 24px; }
.void-modal { max-width: 480px; }
.void-modal .danger-hint { margin: 0; padding: 12px 14px; border-radius: 10px; background: #fff4f2; }
.payment-modal .payment-hint { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--ledger-blue-soft); color: var(--ledger-muted); font-size: 13px; line-height: 1.6; }
.void-modal .setup-hint { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--ledger-soft); color: var(--ledger-muted); line-height: 1.6; }
.void-modal .setup-hint a { color: var(--ledger-blue); font-weight: 700; text-decoration: none; }
.void-modal .actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.edit-modal { max-width: 760px; }
.edit-modal .edit-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 20px 24px 24px; }
.edit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.edit-attachments { display: grid; gap: 12px; }
.edit-attachments h3 { margin: 0; font-size: 14px; }
.edit-receipts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.edit-form .edit-receipts label { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 6px; margin: 0; font-size: 12px; color: var(--ledger-muted); }
.edit-receipts img { grid-column: 1 / -1; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--ledger-radius); border: 1px solid var(--ledger-line); }
.edit-receipts span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-form .edit-receipts input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; }
.edit-receipts-empty { margin: 0; color: var(--ledger-muted); font-size: 13px; }
.edit-form label { display: flex; flex-direction: column; gap: 6px; color: var(--ledger-muted); font-size: 12px; font-weight: 650; }
.edit-form label.wide { grid-column: 1 / -1; }
.edit-form input, .edit-form select { width: 100%; min-height: 42px; border: 1px solid var(--ledger-line); border-radius: var(--ledger-radius); background: #fff; color: var(--ledger-ink); padding: 9px 12px; }
.edit-form .edit-hint, .edit-form .setup-hint { margin: 0; padding: 12px 14px; border-radius: var(--ledger-radius-sm); background: var(--ledger-soft); color: var(--ledger-muted); font-size: 13px; line-height: 1.6; }
.edit-form .actions { display: flex; justify-content: flex-end; }
.security-form { display: flex; align-items: end; gap: 12px; padding: 0 20px 20px; }
.security-form label { flex: 0 1 260px; }
.statement-accounting-hint { margin: 0; padding-top: 14px; border-top: 1px solid var(--ledger-line); }

.douyin-detail-sheet { overflow: hidden; }
.douyin-order-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 6px 22px 18px;
}
.douyin-order-facts > div { min-width: 0; padding: 12px 18px 8px 0; }
.douyin-order-facts dt { margin-bottom: 5px; color: var(--ledger-muted); font-size: 12px; }
.douyin-order-facts dd { margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.douyin-detail-section { border-top: 1px solid var(--ledger-line); }
.douyin-section-head { display: flex; align-items: end; justify-content: space-between; padding: 20px 22px 14px; }
.douyin-section-head h2 { margin: 0; font-size: 17px; }
.douyin-section-head p { margin: 5px 0 0; color: var(--ledger-muted); font-size: 12px; }
.douyin-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 22px 20px;
}
.douyin-amounts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 18px 10px 0; border-bottom: 1px solid var(--ledger-line); }
.douyin-amounts span { color: var(--ledger-muted); font-size: 12px; }
.douyin-amounts strong { font-size: 14px; font-weight: 700; text-align: right; }
.douyin-detail-more { border-top: 1px solid var(--ledger-line); }
.douyin-detail-more summary { padding: 17px 22px; color: var(--ledger-muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.douyin-detail-more[open] summary { color: var(--ledger-ink); }
.douyin-detail-more .douyin-order-facts { padding-top: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.douyin-detail-more .table-wrap { border-top: 1px solid var(--ledger-line); }

@media (max-width: 860px) {
  .detail-action-bar .btn { min-height: 44px; }
  .detail-action-bar { right: 16px; bottom: 16px; }
  .page-actions .detail-summary { min-width: 0; }
  .detail-summary { min-width: 150px; }
  .void-modal .form { padding: 16px; }
  .void-modal { width: calc(100% - 24px); }
  .edit-modal { width: calc(100% - 24px); }
  .edit-modal .edit-form { padding: 16px; }
  .edit-fields { grid-template-columns: 1fr; }
  .edit-receipts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edit-form label.wide { grid-column: auto; }
  .douyin-order-facts, .douyin-detail-more .douyin-order-facts { grid-template-columns: 1fr 1fr; }
  .douyin-amounts { grid-template-columns: 1fr; }
  .douyin-import-body { padding: 8px 16px 16px; }
  .douyin-import-upload { grid-template-columns: 1fr; }
  .douyin-import-upload > span { grid-column: auto; }
  .import-summary { grid-template-columns: 1fr 1fr; }
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.login {
  width: min(400px, calc(100% - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px 40px 40px;
  box-shadow: var(--shadow);
}
.login-mark { margin-bottom: 16px; }
.login h1 { margin: 0 0 4px; font-size: 32px; font-weight: 400; }
.login p { margin: 0 0 24px; color: var(--muted); }
.login label { margin-bottom: 16px; }
.login input { width: 100%; }
.login .btn { width: 100%; margin-top: 8px; }

@media (max-width: 1100px) {
  .kpis, .kpis:has(> :nth-child(5)), .split, .steps, .meta { grid-template-columns: 1fr 1fr; }
  .kpi-rank { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .workspace { display: block; }
  .rail { width: auto; padding-bottom: 8px; }
  .rail a { border-radius: 20px; margin: 0 8px 4px; }
  .kpis, .kpis:has(> :nth-child(5)), .split, .steps, .form, .meta { grid-template-columns: 1fr; }
  .kpi-rank { grid-column: 1 / -1; }
  .sheet-fields { grid-template-columns: 1fr 1fr; }
  .field, .field.w2, .field.w3, .field.w4, .field.w5, .field.w6, .field.w7, .field.w8 { grid-column: span 1; }
  .field.wide { grid-column: span 2; }
  .sheet-foot { flex-direction: column; align-items: stretch; }
  .sheet-signs { grid-template-columns: 1fr; }
  .content { padding: 16px 16px 48px; }
  .topbar { padding: 0 8px; }
  .product-name { font-size: 18px; }
}

/* Finance workspace DNA: structured, restrained, and optimized for scanning amounts. */
:root {
  --ledger-ink: #18242f;
  --ledger-muted: #6c7a86;
  --ledger-line: #dfe5e9;
  --ledger-soft: #f6f8fa;
  --ledger-blue: #1b5b9e;
  --ledger-blue-soft: #e8f0f8;
  --ledger-green: #1f7a59;
  --ledger-red: #b64b43;
  --ledger-radius: 14px;
  --ledger-radius-sm: 9px;
  --ledger-radius-pill: 999px;
}

body { color: var(--ledger-ink); background: #f3f5f7; }
.topbar { height: 68px; padding: 0 28px 0 24px; border-bottom: 1px solid var(--ledger-line); }
.product { gap: 10px; padding: 6px 0; }
.product-copy { display: flex; flex-direction: column; gap: 0; line-height: 1.1; }
.product-copy small { color: var(--ledger-muted); font-size: 10px; margin-top: 3px; }
.product-name { color: #173e68; font-size: 18px; font-weight: 700; }
.topbar-context { display: flex; align-items: center; gap: 8px; margin-right: auto; margin-left: 32px; color: var(--ledger-muted); font-size: 12px; }
.context-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ledger-green); }
.rail {
  position: sticky;
  top: 68px;
  width: 232px;
  height: calc(100vh - 68px);
  padding: 20px 0 36px;
  border-right: 1px solid var(--ledger-line);
  background: #f8fafb;
  overflow-y: auto;
  align-self: flex-start;
}
.nav-label { margin: 18px 20px 7px; color: #7d8992; font-size: 11px; letter-spacing: .06em; }
.rail a { height: 38px; margin: 0 10px 2px; padding: 0 14px; border-radius: var(--ledger-radius-sm); gap: 11px; font-size: 13px; }
.rail a.active { background: var(--ledger-blue-soft); color: #123f76; box-shadow: inset 3px 0 0 var(--ledger-blue); font-weight: 650; }
.content { max-width: 1680px; padding: 28px 36px 72px; }
.page-head { margin-bottom: 22px; }
.page-title { color: var(--ledger-ink); font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.lede { color: var(--ledger-muted); font-size: 13px; }
.card { border-radius: var(--ledger-radius); border-color: var(--ledger-line); box-shadow: 0 1px 2px rgba(24,36,47,.025); }
.card h2 { font-size: 15px; font-weight: 700; }
.card-head { padding: 16px 18px 0; }
.card-head h2 { padding: 0; }
.kpis { gap: 10px; margin-bottom: 18px; }
.kpi { min-height: 110px; padding: 15px 17px; border-radius: 7px; box-shadow: none; }
.kpi .v { font-size: 23px; letter-spacing: -.025em; }
.kpi .k, .kpi .h { color: var(--ledger-muted); }
.money, .kpi .v, td.num, .stats dd, .report-stats dd { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
th, td { padding: 11px 16px; font-size: 13px; }
th { background: var(--ledger-soft); color: var(--ledger-muted); font-size: 11px; letter-spacing: .03em; }
tbody tr.clickable:hover td { background: #f3f7fb; }
.btn { height: 36px; border-radius: var(--ledger-radius-pill); padding: 0 16px; font-size: 13px; font-weight: 650; }
.btn.ghost { border-color: #bcc7cf; }
.tag { height: 22px; border-radius: var(--ledger-radius-pill); padding: 0 9px; font-size: 11px; font-weight: 650; white-space: nowrap; flex-shrink: 0; }
.page-workspace-table .table-wrap table { min-width: 920px; }
.filters { border-radius: var(--ledger-radius); padding: 12px 14px; border-color: var(--ledger-line); }
.filters input, .filter-presets a, .form input, .form select, .field input, .field select, .void-form input, .login input { border-radius: var(--ledger-radius); }
.filter-search { margin-left: auto; min-width: min(360px, 28vw); }
.filter-search input { width: 100%; }
.filter-export { flex: 0 0 auto; }
.tabs { gap: 2px; }
.tabs a { padding: 11px 10px; font-size: 13px; }

.overview-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: -4px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ledger-line); }
.overview-intro-copy { display: grid; gap: 3px; }
.overview-intro-copy .page-title { margin: 0; }
.overview-intro-copy > span:last-child { color: var(--ledger-muted); font-size: 12px; }
.section-kicker { color: var(--ledger-blue); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.overview-period, .section-note { color: var(--ledger-muted); font-size: 12px; white-space: nowrap; }
.overview-layout { display: grid; grid-template-columns: minmax(0, 2.35fr) minmax(300px, .85fr); gap: 14px; align-items: start; }
.overview-main-column, .overview-side-column { display: grid; gap: 14px; align-content: start; min-width: 0; }
.overview-summary, .overview-tasks, .overview-notifications { margin-bottom: 0; min-width: 0; }
.overview-main-column .overview-ledger, .overview-main-column .overview-charts { width: 100%; margin-top: 0; }
.balance-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 20px 0; color: var(--ledger-muted); font-size: 13px; }
.balance-topline a { color: var(--ledger-blue); font-size: 13px; font-weight: 650; text-decoration: none; }
.balance-topline a:hover { text-decoration: underline; }
.balance-hero { display: grid; gap: 5px; margin: 24px 20px 18px; }
.balance-hero span { color: var(--ledger-muted); font-size: 12px; }
.balance-hero strong { font-size: 40px; line-height: 1.05; font-weight: 800; font-variant-numeric: tabular-nums; }
.balance-hero strong .money { color: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; }
.balance-hero strong.neg, .balance-hero strong.neg .money { color: var(--danger); }
.balance-breakdown { display: flex; flex-wrap: wrap; gap: 18px; margin: 0 20px 18px; color: var(--ledger-muted); font-size: 12px; }
.balance-breakdown strong { color: var(--ledger-ink); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.overview-tasks .card-head { padding: 18px 20px 0; }
.overview-tasks .card-head h2 { padding: 0; font-size: 16px; }
.task-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 14px 20px 0; }
.task-stats > div { display: grid; gap: 3px; padding: 12px 10px; background: transparent; }
.task-stats strong { font-size: 25px; font-weight: 750; font-variant-numeric: tabular-nums; }
.task-stats span { color: var(--ledger-muted); font-size: 11px; }
.overview-notifications .card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.overview-notifications .card-head h2 { padding: 0; }
.overview-notifications .card-head span { color: var(--ledger-muted); font-size: 11px; }
.task-list { max-height: 230px; overflow-y: auto; margin-top: 0; }
.task-list .notices li { padding-left: 20px; padding-right: 20px; }
.notification-empty { padding: 22px 12px 24px; color: var(--ledger-muted); font-size: 13px; text-align: center; }
.overview-kpis .kpis { margin-bottom: 14px; }
.overview-kpis .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-dual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.kpi-dual-grid > div { display: grid; gap: 5px; }
.kpi-dual-grid span { color: var(--ledger-muted); font-size: 11px; }
.kpi-dual-grid strong { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-dual.neg .kpi-dual-grid > div:last-child strong { color: var(--ledger-red); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 14px; align-items: start; }
.overview-primary, .overview-secondary { display: contents; }
.overview-primary > .card, .overview-secondary > .card { height: fit-content; min-height: 0; margin-bottom: 0; align-self: start; }
.overview-secondary > .card { height: 100%; box-sizing: border-box; }
.overview-primary > .card:first-child { grid-column: 1; grid-row: 1; }
.overview-secondary > .card { grid-column: 2; grid-row: 1; }
.overview-alert-columns { display: grid; grid-template-columns: 1fr; gap: 0; align-items: start; }
.overview-alert-columns > div { height: 184px; overflow: hidden; box-sizing: border-box; }
.overview-alert-columns > div + div { border-top: 1px solid var(--ledger-line); }
.subsection-title { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px 5px; color: var(--ledger-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.subsection-title span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ledger-blue-soft); color: var(--ledger-blue); font-variant-numeric: tabular-nums; }
.panel-intro { padding: 10px 18px 0; color: var(--ledger-muted); font-size: 12px; }
.overview-primary .empty, .overview-secondary .empty { min-height: 0; }
.overview-secondary .stats > div { min-height: 0; }
.overview-ledger { margin-top: 14px; border: 1px solid var(--ledger-line); border-radius: var(--ledger-radius); background: var(--surface); overflow: hidden; }
.overview-ledger, .overview-charts { width: 100%; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 16px 18px 12px; border-bottom: 1px solid var(--ledger-line); }
.section-heading h2 { margin: 2px 0 0; font-size: 16px; font-weight: 700; }
.section-heading a { color: var(--ledger-blue); font-size: 12px; text-decoration: none; }
.section-heading a:hover { text-decoration: underline; }
.overview-ledger .table-wrap { border-top: 0; }
.overview-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.chart-panel { min-width: 0; margin-bottom: 0; overflow: hidden; }
.chart-panel .card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.chart-panel .card-head h2 { padding: 0; }
.chart-panel .card-head span { color: var(--ledger-muted); font-size: 11px; }
.overview-charts .pie-chart {
  grid-template-columns: 1fr;
  justify-items: stretch;
  gap: 8px;
  padding: 8px 14px 16px;
}
.overview-charts .pie-chart svg {
  width: min(300px, 100%);
  justify-self: center;
}
.overview-charts .pie-legend {
  width: 100%;
}
.page-workspace { display: grid; gap: 14px; }
.page-workspace > .card { margin-bottom: 0; }
.page-workspace-reimbursement { grid-template-columns: 1fr; }
.page-workspace-reimbursement .steps { margin-bottom: 0; }
.page-workspace-table .card { overflow: hidden; }
.page-workspace-table .filters { border: 0; border-bottom: 1px solid var(--ledger-line); border-radius: var(--ledger-radius) var(--ledger-radius) 0 0; margin: 0; }
.page-workspace-table .tabs { border-bottom-color: var(--ledger-line); }
.steps li, .steps > a, .trend-stats, .modal-card, .sheet-block, .login, .receipts a, .thumbs a, .lightbox-tools button { border-radius: var(--ledger-radius); }
.steps li, .steps > a { overflow: hidden; }
.filter-presets a { border-radius: var(--ledger-radius-pill); }
.icon-btn, .text-btn { border-radius: var(--ledger-radius-pill); }
.flash { border-radius: var(--ledger-radius-sm); }
.detail-page { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 14px; align-items: start; }
.detail-page > .detail-main, .detail-page > .detail-side { display: grid; gap: 14px; min-width: 0; }
.detail-page .card { margin-bottom: 0; }

.report-overview { display: grid; grid-template-columns: minmax(250px, .74fr) minmax(0, 1.8fr); gap: 14px; align-items: stretch; margin-bottom: 8px; }
.report-hero { display: block; margin-bottom: 8px; }
.report-hero-kpis { display: grid; gap: 14px; }
.report-overview .chart-hero { margin-bottom: 0; }
.report-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.report-section > .section-heading { grid-column: 1 / -1; margin-bottom: -4px; padding: 0 2px 8px; border-bottom: 0; }
.report-section > .split { grid-column: 1 / -1; }
.report-section-secondary { margin-top: 20px; }
.report-section-secondary > .card { margin-bottom: 0; }
.chart-caption { margin: 0; padding: 4px 2px 0; color: var(--ledger-muted); font-size: 12px; }
.report-hero-kpis .card, .report-overview .card { height: 100%; }
.trend-stats { border-radius: 5px; }

@media (max-width: 1100px) {
  .overview-layout { grid-template-columns: 1fr; }
  .overview-grid, .overview-charts, .report-overview, .page-workspace-expense, .detail-page { grid-template-columns: 1fr; }
  .overview-ledger, .overview-charts { width: 100%; }
  .overview-primary > .card:first-child, .overview-primary > .card:nth-child(2), .overview-secondary > .card { grid-column: auto; grid-row: auto; }
}
@media (max-width: 860px) {
  .topbar { padding: 0 16px; }
  .topbar-context { display: none; }
  .rail { position: static; top: auto; width: auto; height: auto; padding: 10px 0 8px; border-right: 0; border-bottom: 1px solid var(--ledger-line); overflow-x: auto; overflow-y: visible; white-space: nowrap; }
  .rail a { display: inline-flex; width: auto; margin: 0 3px; padding: 0 12px; }
  .nav-label { display: none; }
  .content { padding: 20px 16px 48px; }
  .meta { grid-template-columns: 1fr 1fr; }
  .detail-hero { margin: 0 0 18px; justify-content: space-between; }
  .overview-intro { align-items: flex-start; flex-direction: column; gap: 8px; }
  .overview-primary > .card:first-child, .overview-primary > .card:nth-child(2), .overview-secondary > .card { grid-column: auto; grid-row: auto; }
  .overview-kpis .kpis { grid-template-columns: 1fr; }
  .overview-alert-columns, .report-section { grid-template-columns: 1fr; }
  .cat-groups { grid-template-columns: 1fr; }
  .report-section > .section-heading { margin-bottom: 0; }
  .filter-search { order: 20; margin-left: 0; min-width: 100%; }
  .filter-export { order: 21; margin-left: auto; }
  .image-upload-row { align-items: flex-start; }
  .image-upload.upload-wide { grid-column: span 2; }
  .image-upload-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
