:root {
  color-scheme: light;
  --page: #f2f5f1;
  --surface: #ffffff;
  --surface-soft: #edf2ed;
  --surface-warm: #faf7f1;
  --ink: #17231c;
  --ink-soft: #344439;
  --muted: #6f7d73;
  --muted-strong: #536258;
  --line: #dce4dd;
  --line-strong: #c7d2ca;
  --brand: #267554;
  --brand-dark: #183a2d;
  --brand-deep: #142a21;
  --brand-soft: #e2f0e8;
  --orange: #df7955;
  --orange-soft: #fae9e2;
  --blue: #4b7faa;
  --blue-soft: #e6eef5;
  --gold: #c79531;
  --gold-soft: #f7eed9;
  --danger: #be5656;
  --danger-soft: #f8e8e8;
  --shadow: 0 20px 55px rgba(27, 50, 38, 0.1);
  --shadow-soft: 0 8px 24px rgba(27, 50, 38, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 15px 18px;
  overflow: auto;
  color: #edf5ef;
  background: var(--brand-deep);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0 7px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  color: #f7d7a9;
  background: #213b30;
}

.brand-mark .icon {
  width: 19px;
  height: 19px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.2;
}

.brand-copy span {
  display: block;
  margin-top: 3px;
  color: #9eb5a7;
  font-size: 10px;
}

.sidebar-section {
  margin-top: 36px;
}

.sidebar-label {
  margin: 0 10px 9px;
  color: #819d8c;
  font-size: 10px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #aabeb1;
  font-size: 13px;
  font-weight: 650;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.nav-item:hover {
  color: #f4fbf6;
  background: rgba(255, 255, 255, 0.055);
}

.nav-item.is-active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
  background: #25483a;
}

.nav-item.is-active .icon {
  color: #f2c98f;
}

.nav-item .icon {
  color: #91aa9b;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--brand-deep);
  background: #f0cf9a;
  font-size: 13px;
  font-weight: 800;
}

.account-copy {
  min-width: 0;
}

.account-copy strong {
  display: block;
  overflow: hidden;
  color: #f1f7f3;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy span {
  display: block;
  margin-top: 3px;
  color: #829c8c;
  font-size: 10px;
}

.sidebar-signout {
  display: grid;
  width: 30px;
  height: 30px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: #89a091;
  background: transparent;
}

.sidebar-signout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 77px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 245, 241, 0.92);
  backdrop-filter: blur(14px);
}

.topbar-heading {
  min-width: 0;
}

.topbar-heading h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 760;
  line-height: 1.28;
}

.topbar-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

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

.button-primary {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand);
}

.button-primary:hover {
  border-color: #1f684a;
  background: #1f684a;
}

.button-secondary {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: var(--surface);
}

.button-secondary:hover {
  border-color: #aebdb2;
  background: #f8faf8;
}

.button-soft {
  color: #255f48;
  border-color: #cfe2d6;
  background: var(--brand-soft);
}

.button-soft:hover {
  border-color: #b8d5c4;
  background: #d9ebe1;
}

.button-ghost {
  color: var(--muted-strong);
  border-color: transparent;
  background: transparent;
}

.button-ghost:hover {
  border-color: var(--line);
  background: var(--surface);
}

.button-danger {
  color: var(--danger);
  border-color: #edcccc;
  background: var(--danger-soft);
}

.button-icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.button-sm {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 11px;
}

.topbar .button-secondary .icon,
.topbar .button-ghost .icon {
  color: var(--muted-strong);
}

.content {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 24px 28px 42px;
}

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

.toolbar-groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.record-type-switch {
  width: 100%;
  margin-bottom: 15px;
  background: #f5f8f5;
}

.record-type-switch .segment {
  flex: 1;
}

.amount-income {
  color: var(--brand);
}

.metric-value.is-negative {
  color: var(--danger);
}

.page-intro-copy h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 730;
  line-height: 1.35;
}

.page-intro-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-item {
  min-width: 0;
  padding: 17px 18px;
  border-right: 1px solid var(--line);
}

.metric-item:last-child {
  border-right: 0;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
}

.metric-label .icon {
  width: 14px;
  height: 14px;
}

.metric-value {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 24px;
  font-weight: 760;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value small {
  margin-right: 2px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 650;
}

.metric-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.delta-up {
  color: var(--orange);
  font-weight: 750;
}

.delta-down {
  color: var(--brand);
  font-weight: 750;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 0;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 740;
  line-height: 1.35;
}

.panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.panel-body {
  padding: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) minmax(130px, 0.65fr) minmax(130px, 0.65fr) auto;
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.field > span,
.field-label {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 720;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fbfcfb;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.input,
.select {
  height: 38px;
  padding: 0 11px;
}

.select {
  cursor: pointer;
}

.textarea {
  min-height: 88px;
  padding: 10px 11px;
  line-height: 1.55;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: #9aa69d;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(38, 117, 84, 0.1);
}

.search-field {
  position: relative;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 15px;
  height: 15px;
  color: #88968c;
  pointer-events: none;
  transform: translateY(-50%);
}

.search-field .input {
  padding-left: 34px;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.segment {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 720;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(27, 50, 38, 0.06);
}

.records-panel {
  overflow: hidden;
}

.records-toolbar {
  grid-template-columns: minmax(230px, 1.35fr) minmax(120px, 0.6fr) minmax(120px, 0.6fr) auto;
}

.records-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 13px;
  border-bottom: 1px solid #e8ede9;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: #f8faf8;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.data-table td {
  color: var(--ink-soft);
  font-size: 12px;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: #f9fbf9;
}

.data-table tbody tr.is-selected {
  background: #f1f8f4;
}

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

.checkbox {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.record-date {
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.record-summary {
  min-width: 150px;
}

.record-summary strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-summary span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: #fbfcfb;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.category-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--category-color, var(--brand));
}

.store-name {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount::before {
  content: "¥";
  margin-right: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.row-action {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
}

.row-action:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.row-action.is-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-button {
  min-width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  padding-inline: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-strong);
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
}

.page-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.page-button.is-active {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand);
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state .icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 10px;
  color: #9aac9f;
}

.empty-state strong {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
}

.empty-state p {
  margin: 5px 0 0;
  font-size: 11px;
}

.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.report-toolbar .segmented {
  background: var(--surface);
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(300px, 0.82fr);
  gap: 16px;
  margin-bottom: 16px;
}

.chart-panel {
  min-height: 318px;
}

.chart-wrap {
  position: relative;
  height: 248px;
  padding: 4px 16px 16px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-caption {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px 15px;
  color: var(--muted);
  font-size: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--legend-color, var(--brand));
}

.donut-panel {
  display: flex;
  flex-direction: column;
}

.donut-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(145px, 0.95fr) minmax(135px, 1.05fr);
  align-items: center;
  gap: 8px;
  padding: 6px 18px 18px;
}

.donut-wrap {
  position: relative;
  height: 190px;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.donut-center strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.donut-center span {
  margin-top: 5px;
  font-size: 9px;
}

.donut-legend {
  display: grid;
  gap: 9px;
}

.donut-legend-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 10px;
}

.donut-legend-row strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.report-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.breakdown-list {
  display: grid;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.95fr) minmax(120px, 1.35fr) 80px 64px;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid #edf1ed;
}

.breakdown-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.breakdown-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2ee;
}

.progress-bar {
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color, var(--brand));
}

.breakdown-amount {
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.breakdown-share {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.budget-panel .panel-body {
  display: grid;
  gap: 18px;
}

.budget-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.budget-value {
  font-size: 27px;
  font-weight: 760;
  line-height: 1;
}

.budget-value small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.budget-remain {
  color: var(--brand);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
}

.budget-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.budget-progress {
  width: 87.5%;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.budget-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.budget-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.budget-note {
  padding: 11px 12px;
  background: #fbfcfb;
}

.budget-note span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.budget-note strong {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 750;
}

.category-workspace {
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  gap: 16px;
}

.category-list-panel {
  align-self: start;
  overflow: hidden;
}

.category-list-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.category-list-head .panel-head {
  padding: 0;
}

.category-search {
  margin-top: 12px;
}

.category-list {
  display: grid;
  max-height: 650px;
  overflow: auto;
  padding: 7px;
}

.category-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted-strong);
  background: transparent;
  text-align: left;
}

.category-list-item:hover {
  background: var(--surface-soft);
}

.category-list-item.is-active {
  color: var(--ink);
  border-color: #cde0d3;
  background: var(--brand-soft);
}

.category-list-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--category-color, var(--brand));
}

.category-list-copy {
  min-width: 0;
}

.category-list-copy strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-list-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.category-list-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.category-editor {
  min-width: 0;
}

.category-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 17px;
  border-bottom: 1px solid var(--line);
}

.category-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-color-large {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: var(--category-color, var(--brand));
  box-shadow: 0 0 0 4px var(--category-soft, var(--brand-soft));
}

.category-title-row h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 760;
}

.category-meta {
  margin: 7px 0 0 22px;
  color: var(--muted);
  font-size: 10px;
}

.category-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.editor-body {
  padding: 20px;
}

.editor-section + .editor-section {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

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

.section-title-row h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 740;
}

.section-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.count-chip {
  min-width: 28px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  padding-inline: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: var(--surface-soft);
  font-size: 9px;
  font-weight: 750;
}

.inline-add {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.subcategory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.subcategory-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.subcategory-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subcategory-copy span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subcategory-index {
  width: 20px;
  height: 20px;
  display: grid;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 8px;
  font-weight: 750;
}

.subcategory-actions {
  display: flex;
  gap: 2px;
}

.subcategory-actions .row-action {
  width: 25px;
  height: 25px;
}

.subcategory-actions .icon {
  width: 13px;
  height: 13px;
}

.store-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.store-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-strong);
  background: #fbfcfb;
  font-size: 10px;
}

.store-tag button {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: #94a197;
  background: transparent;
}

.store-tag button:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.store-tag .icon {
  width: 11px;
  height: 11px;
}

.category-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  padding: 11px 12px;
  border-left: 2px solid var(--gold);
  color: var(--muted-strong);
  background: var(--surface-warm);
  font-size: 10px;
  line-height: 1.55;
}

.category-footnote .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--gold);
}

.dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(11, 25, 18, 0.55);
  backdrop-filter: blur(3px);
}

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 760;
}

.dialog-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.dialog-close {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}

.dialog-close:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.dialog-body {
  padding: 20px;
}

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

.field-span-2 {
  grid-column: span 2;
}

.amount-input {
  position: relative;
}

.amount-input span {
  position: absolute;
  top: 50%;
  left: 11px;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.amount-input .input {
  padding-left: 25px;
  font-size: 18px;
  font-weight: 750;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.dialog-actions .button {
  min-width: 84px;
}

.drop-zone {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #b9c8bd;
  border-radius: 7px;
  color: var(--muted);
  background: #f8faf8;
  text-align: center;
  cursor: pointer;
}

.drop-zone:hover {
  border-color: var(--brand);
  background: #f1f8f4;
}

.drop-zone .icon {
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  color: var(--brand);
}

.drop-zone strong {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
}

.drop-zone span {
  display: block;
  margin-top: 5px;
  font-size: 10px;
}

.drop-zone.is-ready {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.import-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted-strong);
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid #bcd4c4;
  border-radius: 7px;
  color: #1e533d;
  background: #eff8f2;
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  color: #7c3333;
  border-color: #e8c7c7;
  background: #fbefef;
}

.toast .icon {
  width: 16px;
  height: 16px;
}

.form-message {
  min-height: 17px;
  margin: 2px 0 0;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.5;
}

.form-message.is-success {
  color: var(--brand);
}

.import-result {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.6;
}

.import-result strong {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
}

.import-result ul {
  max-height: 150px;
  margin: 8px 0 0;
  padding-left: 18px;
  overflow: auto;
  color: var(--danger);
}

.import-preview {
  width: 100%;
  margin-top: 9px;
  border-collapse: collapse;
}

.import-preview th,
.import-preview td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.import-preview th {
  color: var(--muted);
  font-size: 9px;
}

.loading-state {
  opacity: 0.65;
  pointer-events: none;
}

.login-body {
  min-height: 100vh;
  background: #f4f6f2;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(430px, 0.88fr);
}

.login-showcase {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 34px clamp(34px, 5vw, 70px) 40px;
  color: #eff7f2;
  background: #17352a;
}

.login-brand {
  position: relative;
  z-index: 1;
}

.login-brand .brand {
  padding: 0;
}

.login-brand .brand-mark {
  color: #17352a;
  background: #f1cf9c;
}

.login-brand .brand-copy span {
  color: #99b4a3;
}

.showcase-copy {
  position: relative;
  z-index: 1;
  width: min(510px, 100%);
  margin: 11vh 0 auto;
}

.showcase-copy .eyebrow {
  color: #eac58f;
}

.showcase-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(36px, 4.5vw, 60px);
  font-weight: 760;
  line-height: 1.16;
}

.showcase-copy p {
  width: min(430px, 100%);
  margin: 18px 0 0;
  color: #b4c8bb;
  font-size: 14px;
  line-height: 1.8;
}

.login-visual {
  position: relative;
  z-index: 1;
  width: min(610px, 100%);
  margin-top: 52px;
  padding: 18px 20px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #1f4234;
  box-shadow: 0 28px 70px rgba(5, 20, 13, 0.24);
}

.visual-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.visual-head span {
  color: #98b4a3;
  font-size: 10px;
  font-weight: 700;
}

.visual-head strong {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  font-size: 25px;
  font-weight: 750;
}

.visual-chip {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #e8c188;
  font-size: 9px;
  font-weight: 750;
}

.visual-chart {
  position: relative;
  height: 158px;
  margin-top: 21px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.visual-chart svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.visual-grid-line {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.065);
}

.visual-grid-line:nth-child(1) {
  top: 25%;
}

.visual-grid-line:nth-child(2) {
  top: 50%;
}

.visual-grid-line:nth-child(3) {
  top: 75%;
}

.visual-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 13px;
  color: #92ad9c;
  font-size: 9px;
}

.visual-foot strong {
  color: #e8c58e;
  font-weight: 700;
}

.login-quote {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  color: #89a594;
  font-size: 10px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 38px clamp(28px, 5vw, 76px);
  background: #f8faf7;
}

.login-card {
  width: min(390px, 100%);
}

.login-card .brand {
  display: none;
}

.login-title {
  margin: 0;
  font-size: 30px;
  font-weight: 760;
  line-height: 1.24;
}

.login-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 15px;
  margin-top: 34px;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field > span {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 720;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap > .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: #8a998e;
  pointer-events: none;
  transform: translateY(-50%);
}

.login-input-wrap .input {
  height: 44px;
  padding-left: 37px;
  background: #ffffff;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted-strong);
  font-size: 10px;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 3px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 23px 0;
  color: #98a49b;
  font-size: 9px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.login-alt {
  width: 100%;
  min-height: 42px;
}

.login-foot {
  margin: 32px 0 0;
  color: #9aa79e;
  font-size: 9px;
  line-height: 1.6;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .content {
    padding-inline: 22px;
  }

  .topbar {
    padding-inline: 22px;
  }

  .report-grid,
  .report-bottom-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .donut-body {
    grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 1.2fr);
  }

  .category-workspace {
    grid-template-columns: 230px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
    padding-bottom: 74px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    width: 100%;
    height: 72px;
    display: block;
    padding: 7px max(12px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    overflow: visible;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
    border-right: 0;
    background: rgba(20, 42, 33, 0.98);
    backdrop-filter: blur(14px);
  }

  .sidebar > .brand,
  .sidebar-section > .sidebar-label,
  .sidebar-foot {
    display: none;
  }

  .sidebar-section {
    margin: 0;
  }

  .side-nav {
    height: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .nav-item {
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px 8px;
    font-size: 9px;
  }

  .nav-item .icon {
    width: 19px;
    height: 19px;
  }

  .topbar {
    min-height: 70px;
    padding: 10px 18px;
  }

  .topbar-heading h1 {
    font-size: 21px;
  }

  .content {
    padding: 18px 18px 28px;
  }

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

  .metric-item:nth-child(2) {
    border-right: 0;
  }

  .metric-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .records-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(135px, 0.45fr);
  }

  .records-toolbar .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .category-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-list {
    display: flex;
    max-height: none;
    overflow-x: auto;
    padding: 8px;
  }

  .category-list-item {
    min-width: 164px;
  }

  .login-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-showcase {
    min-height: auto;
    padding: 26px 24px 30px;
  }

  .showcase-copy {
    margin-top: 44px;
  }

  .showcase-copy h1 {
    font-size: 36px;
  }

  .showcase-copy p {
    display: none;
  }

  .login-visual {
    margin-top: 30px;
  }

  .login-quote {
    display: none;
  }

  .login-panel {
    padding: 38px 24px 48px;
  }

  .login-card .brand {
    display: flex;
    margin-bottom: 34px;
    color: var(--ink);
  }

  .login-card .brand-mark {
    color: #f6e0bd;
    background: var(--brand-dark);
  }

  .login-card .brand-copy span {
    color: var(--muted);
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-heading p {
    display: none;
  }

  .topbar-actions .button {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .topbar-actions .button-label {
    display: none;
  }

  .topbar-actions .button-primary {
    width: auto;
    padding-inline: 11px;
  }

  .topbar-actions .button-primary .button-label {
    display: inline;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .page-intro .segmented {
    width: 100%;
  }

  .page-intro .segment {
    flex: 1;
  }

  .toolbar-groups {
    width: 100%;
    flex-direction: column;
  }

  .toolbar-groups .segmented {
    width: 100%;
  }

  .toolbar-groups .segment {
    flex: 1;
  }

  .metric-item {
    padding: 15px 14px;
  }

  .metric-value {
    font-size: 21px;
  }

  .toolbar,
  .records-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .records-toolbar .toolbar-actions {
    grid-column: auto;
    justify-content: stretch;
  }

  .records-toolbar .toolbar-actions .button {
    flex: 1;
  }

  .table-wrap {
    overflow: visible;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tbody {
    padding: 8px;
  }

  .data-table tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    margin-bottom: 8px;
    padding: 13px 42px 13px 13px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfb;
  }

  .data-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .data-table td {
    padding: 0;
    border: 0;
  }

  .data-table td:first-child {
    position: absolute;
    top: 14px;
    right: 14px;
    width: auto;
  }

  .data-table td[data-label="日期"] {
    grid-column: 1;
    grid-row: 1;
  }

  .data-table td[data-label="摘要"] {
    grid-column: 1;
    grid-row: 2;
  }

  .data-table td[data-label="类别"] {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
  }

  .data-table td[data-label="店铺"] {
    grid-column: 1;
    grid-row: 4;
    color: var(--muted);
    font-size: 10px;
  }

  .data-table td[data-label="金额"] {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    text-align: right;
  }

  .data-table td[data-label="操作"] {
    grid-column: 2;
    grid-row: 3 / span 2;
    align-self: end;
  }

  .data-table .record-summary span {
    max-width: 210px;
  }

  .data-table .store-name {
    max-width: 210px;
  }

  .row-actions {
    flex-direction: column;
  }

  .table-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination {
    width: 100%;
    justify-content: space-between;
  }

  .report-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-toolbar .segmented {
    width: 100%;
  }

  .report-toolbar .segment {
    flex: 1;
  }

  .report-toolbar .button {
    width: 100%;
  }

  .chart-wrap {
    height: 230px;
    padding-inline: 8px;
  }

  .donut-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .donut-wrap {
    height: 205px;
  }

  .breakdown-row {
    grid-template-columns: minmax(95px, 0.9fr) minmax(90px, 1.1fr) 70px;
    gap: 8px;
    padding-inline: 14px;
  }

  .breakdown-share {
    display: none;
  }

  .category-editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-actions {
    width: 100%;
  }

  .category-actions .button {
    flex: 1;
  }

  .editor-body,
  .category-editor-head {
    padding: 16px;
  }

  .subcategory-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-span-2 {
    grid-column: auto;
  }

  .dialog-body {
    padding: 16px;
  }

  .login-showcase {
    padding: 22px 18px 26px;
  }

  .showcase-copy {
    margin-top: 32px;
  }

  .showcase-copy h1 {
    font-size: 31px;
  }

  .login-visual {
    padding: 15px 14px 12px;
  }

  .visual-chart {
    height: 120px;
  }

  .login-panel {
    padding: 30px 20px 42px;
  }
}

@media (max-width: 440px) {
  .topbar {
    padding-inline: 14px;
  }

  .topbar-heading h1 {
    font-size: 19px;
  }

  .content {
    padding-inline: 14px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button-ghost {
    display: none;
  }

  .topbar-actions .button-ghost#changePasswordButton {
    display: inline-flex;
  }

  .metric-value {
    font-size: 22px;
  }

  .panel-head {
    padding-inline: 15px;
  }

  .inline-add {
    grid-template-columns: minmax(0, 1fr);
  }

  .inline-add .button {
    width: 100%;
  }

  .login-title {
    font-size: 26px;
  }
}

@media (max-width: 340px) {
  .metric-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-item:nth-child(2) {
    border-right: 0;
  }

  .metric-item:last-child {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
