:root {
  --bg: #f5f7fb;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --text: #0f172a;
  --muted: #667085;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --primary: #2f6fed;
  --primary-soft: rgba(47, 111, 237, 0.1);
  --income: #0f9f6e;
  --income-soft: rgba(15, 159, 110, 0.12);
  --expense: #d95050;
  --expense-soft: rgba(217, 80, 80, 0.12);
  --interest: #c69214;
  --interest-soft: rgba(198, 146, 20, 0.12);
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.05);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-collapsed: 84px;
  --sidebar-expanded: 272px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(47, 111, 237, 0.09), transparent 26%),
    linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

svg {
  display: block;
}

.app {
  min-height: 100vh;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease;
  z-index: 35;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-expanded);
  background: rgba(248, 250, 252, 0.94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 40;
  transform-origin: left center;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, width 0.24s ease;
}

.sidebar__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 14px 18px;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2f6fed 0%, #6ba2ff 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(47, 111, 237, 0.28);
  flex-shrink: 0;
}

.brand__mark svg {
  width: 22px;
  height: 22px;
}

.brand__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 1;
  transition: opacity 0.2s ease, max-width 0.2s ease;
}

.brand__title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.brand__sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav__label {
  padding: 0 12px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 18px;
  color: #475467;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-item:hover {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.nav-item.active {
  background: linear-gradient(135deg, #2f6fed 0%, #5389f4 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(47, 111, 237, 0.28);
}

.nav-item__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item__text,
.nav-item__arrow,
.sidebar__mini-title,
.sidebar__mini-row span,
.user-card__meta,
.user-card__mail {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item__text,
.nav-item__arrow,
.sidebar__mini,
.user-card__text,
.brand__text,
.nav__label {
  max-width: 180px;
}

.nav-item__text {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.nav-item__arrow {
  opacity: 0.65;
}

.sidebar__spacer {
  flex: 1;
}

.sidebar__footer {
  display: grid;
  gap: 10px;
}

.sidebar__mini {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(47, 111, 237, 0.06);
  border-radius: 18px;
  padding: 14px;
  box-shadow: none;
}

.sidebar__mini-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.sidebar__mini-amount {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sidebar__mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.sidebar__mini-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 159, 110, 0.1);
  color: var(--income);
  font-weight: 700;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px 2px;
  border-top: 1px solid rgba(15, 23, 42, 0.05);
}

.user-card__avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, #c69214 0%, #e3b646 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.user-card__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-card__name {
  font-size: 14px;
  font-weight: 600;
}

.user-card__mail {
  font-size: 12px;
  color: var(--muted);
}

.main {
  min-height: 100vh;
  transition: padding-left 0.24s ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 16px 16px 0;
  background: linear-gradient(180deg, rgba(245, 247, 251, 0.95) 68%, rgba(245, 247, 251, 0));
  backdrop-filter: blur(10px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
  border-radius: 22px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar__title {
  min-width: 0;
}

.topbar__title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.topbar__title p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #fff;
  color: #344054;
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: #475467;
}

.pill.primary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}

.page {
  padding: 16px 16px 28px;
}

.page > section + section {
  margin-top: 14px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: #475467;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}

.notice svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex-shrink: 0;
}

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

.card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card--soft {
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.95) 100%);
}

.card__body {
  padding: 18px;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.card__desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.stat-card {
  padding: 18px;
}

.stat-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

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

.stat-card__value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon svg {
  width: 20px;
  height: 20px;
}

.stat-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.stat-card__change {
  font-weight: 700;
}

.tone-primary {
  color: var(--primary);
}

.tone-income {
  color: var(--income);
}

.tone-expense {
  color: var(--expense);
}

.tone-interest {
  color: var(--interest);
}

.bg-primary { background: var(--primary-soft); }
.bg-income { background: var(--income-soft); }
.bg-expense { background: var(--expense-soft); }
.bg-interest { background: var(--interest-soft); }

.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.trend-line {
  display: grid;
  gap: 10px;
}

.trend-line__svg {
  width: 100%;
  height: 180px;
  display: block;
}

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

.trend-line__labels small {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 224px;
  padding-top: 8px;
}

.trend-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.trend-bar__col {
  width: 100%;
  height: 184px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.trend-bar__fill {
  width: min(24px, 100%);
  border-radius: 16px 16px 6px 6px;
  background: linear-gradient(180deg, rgba(47,111,237,0.96) 0%, rgba(47,111,237,0.62) 100%);
  box-shadow: 0 12px 28px rgba(47, 111, 237, 0.24);
}

.trend-bar--income .trend-bar__fill {
  background: linear-gradient(180deg, rgba(15,159,110,0.92) 0%, rgba(15,159,110,0.56) 100%);
  box-shadow: 0 12px 28px rgba(15, 159, 110, 0.2);
}

.trend-bar--expense .trend-bar__fill {
  background: linear-gradient(180deg, rgba(217,80,80,0.92) 0%, rgba(217,80,80,0.54) 100%);
  box-shadow: 0 12px 28px rgba(217, 80, 80, 0.18);
}

.trend-bar small {
  font-size: 11px;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item__swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.amount {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.amount.income { color: var(--income); }
.amount.expense { color: var(--expense); }
.amount.interest { color: var(--interest); }
.amount.balance { color: var(--text); }

.card--list-shell {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.card--list-shell .card__body {
  padding-bottom: 18px;
}

.deferred-section {
  content-visibility: auto;
  contain-intrinsic-size: 520px;
}

body[data-page="admin"].admin-auth-locked .page > :not(#adminAuthCard) {
  display: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.record-item,
.manage-item,
.month-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.95) 100%);
  box-shadow: var(--shadow-soft);
}

.record-item--dense {
  padding: 14px 16px;
}

.record-item__top,
.manage-item__top,
.month-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.record-item__type,
.badge,
.chip,
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge,
.chip {
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.badge.deposit,
.chip.deposit { background: var(--income-soft); color: var(--income); }
.badge.withdraw,
.chip.withdraw { background: var(--expense-soft); color: var(--expense); }
.badge.interest,
.chip.interest { background: var(--interest-soft); color: var(--interest); }
.badge.adjustment,
.chip.adjustment { background: rgba(102,112,133,0.12); color: #667085; }

.record-item__note,
.helper,
.meta,
.muted {
  color: var(--muted);
}

.record-item__meta,
.manage-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
}

.segmented,
.filter-row,
.quick-actions,
.year-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card__head--year {
  align-items: center;
  gap: 8px;
}

.year-switch--nav {
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.year-current {
  min-width: 56px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 28px;
}

.year-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(47, 111, 237, 0.08);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.year-nav-btn:hover,
.year-nav-btn:active {
  background: rgba(47, 111, 237, 0.14);
}

.chip {
  min-height: 32px;
  padding: 0 10px;
  background: rgba(255,255,255,0.92);
  border-color: var(--line);
  color: #475467;
  border-radius: 12px;
  font-size: 12px;
}

.chip:hover,
.chip:active {
  background: rgba(255,255,255,0.98);
}

.chip.active {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

.chip.ghost {
  background: transparent;
}

.filters {
  display: grid;
  gap: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #344054;
}

.control,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(248, 250, 252, 0.92);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.control:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(47, 111, 237, 0.26);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.08);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3.25 5.25L7 9L10.75 5.25' stroke='%238397AA' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  cursor: pointer;
}

.control[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  position: relative;
}

.control[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.22;
}

.textarea {
  min-height: 96px;
  resize: vertical;
  padding: 12px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn.primary {
  background: linear-gradient(135deg, #2f6fed 0%, #5389f4 100%);
  color: #fff;
  box-shadow: 0 8px 16px rgba(47, 111, 237, 0.16);
}

.btn.secondary {
  background: #fff;
  color: #344054;
  border: 1px solid var(--line);
}

.btn.soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.link-action {
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: color 0.18s ease, opacity 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.link-action:hover,
.link-action:active {
  opacity: 0.72;
}

.table-like {
  display: none;
}

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

.kpi-box {
  padding: 14px;
  border-radius: 18px;
  background: rgba(47,111,237,0.06);
}

.kpi-box:nth-child(2) { background: rgba(15,159,110,0.09); }
.kpi-box:nth-child(3) { background: rgba(217,80,80,0.08); }
.kpi-box:nth-child(4) { background: rgba(198,146,20,0.12); }

.kpi-box__label {
  font-size: 12px;
  color: var(--muted);
}

.kpi-box__value {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 800;
}

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

.month-item__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.month-item--dense {
  gap: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(249,250,252,0.96) 100%);
}

.month-item--dense .month-item__top {
  align-items: center;
  gap: 10px;
}

.month-item--dense .month-item__top strong {
  font-size: 14px;
  line-height: 1.1;
}

.month-item__line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.month-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.month-chip--income {
  background: rgba(15, 159, 110, 0.08);
  border-color: rgba(15, 159, 110, 0.10);
  color: var(--income);
}

.month-chip--expense {
  background: rgba(217, 80, 80, 0.08);
  border-color: rgba(217, 80, 80, 0.10);
  color: var(--expense);
}

.month-chip--interest {
  background: rgba(198, 146, 20, 0.10);
  border-color: rgba(198, 146, 20, 0.12);
  color: var(--interest);
}

.month-stat {
  display: grid;
  gap: 4px;
}

.month-stat span {
  font-size: 11px;
  color: var(--muted);
}

.month-stat strong {
  font-size: 14px;
}

.inline-spark {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 66px;
}

.inline-spark span {
  flex: 1;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, rgba(47,111,237,0.9) 0%, rgba(47,111,237,0.45) 100%);
}

.assist-list {
  display: grid;
  gap: 10px;
}

.assist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.assist-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.assist-row strong {
  font-size: 14px;
  font-weight: 700;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 14px;
}

.pagination::-webkit-scrollbar {
  display: none;
}

.page-btn {
  min-width: 58px;
  height: 32px;
  padding: 0 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  flex: 0 0 auto;
}

.page-summary {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.page-btn:disabled {
  opacity: 0.42;
}

.page-btn:hover,
.page-btn:active {
  background: #f8fbff;
}

.page-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.manage-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tool-btn {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn.edit {
  background: var(--primary-soft);
  color: var(--primary);
}

.tool-btn.delete {
  background: var(--expense-soft);
  color: var(--expense);
}

.tool-btn.view {
  background: rgba(102,112,133,0.12);
  color: #475467;
}

.audit-box {
  display: grid;
  gap: 10px;
}

.audit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.audit-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.audit-line strong {
  font-weight: 700;
}

.card-grid--tight {
  gap: 10px;
}

.segmented--compact,
.chart-legend--compact,
.inline-spark--compact,
.kpi-strip--compact,
.month-grid--compact,
.list--compact,
.filter-row--compact,
.field-grid--compact,
.list-header--compact {
  gap: 8px;
}

.trend-chart--compact {
  height: 164px;
}

.trend-line--compact .trend-line__svg {
  height: 156px;
}

.trend-line--compact .trend-line__labels small {
  font-size: 10px;
}

@media (max-width: 679px) {
  .sidebar {
    width: 64vw;
    max-width: 228px;
    transform: translateX(calc(-100% - 14px));
    opacity: 0;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  }

  body.sidebar-expanded .sidebar {
    transform: translateX(0);
    opacity: 1;
  }

  body.sidebar-expanded .backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-expanded {
    overflow: hidden;
  }

  .main {
    padding-left: 0 !important;
  }

  .topbar {
    padding: 0;
    background: linear-gradient(180deg, #f7fbfb 0%, #edf7f7 100%);
    backdrop-filter: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  }

  .topbar__inner {
    padding: 12px 14px 8px;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    border: 0;
    min-height: 78px;
  }

  .topbar__left {
    width: 100%;
    align-items: center;
    gap: 12px;
  }

  .icon-btn.icon-btn--menu {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.42);
    color: #4b5565;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.38);
  }

  .icon-btn.icon-btn--menu svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
  }

  .topbar__title h1 {
    font-size: 18px;
    line-height: 1.12;
  }

  .topbar__title p {
    margin-top: 4px;
    font-size: 10px;
    color: #667085;
    line-height: 1.35;
  }

  .brand {
    gap: 10px;
    min-height: 44px;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand__mark svg {
    width: 19px;
    height: 19px;
  }

  .brand__title {
    font-size: 15px;
  }

  .brand__sub {
    font-size: 11px;
  }

  .brand__text,
  .nav__label,
  .sidebar__mini,
  .user-card__text {
    opacity: 1;
    max-width: none;
    pointer-events: auto;
  }

  .nav {
    gap: 6px;
  }

  .nav__label {
    padding: 0 8px;
    font-size: 10px;
  }

  .nav-item {
    padding: 10px 12px;
    border-radius: 14px;
    gap: 10px;
    width: 100%;
    justify-content: flex-start;
  }

  .nav-item__icon {
    width: 18px;
    height: 18px;
  }

  .nav-item__text {
    font-size: 13px;
    flex: 1;
  }

  .sidebar__footer {
    gap: 8px;
  }

  .sidebar__mini {
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.45);
  }

  .sidebar__mini-title {
    font-size: 10px;
    margin-bottom: 6px;
  }

  .sidebar__mini-amount {
    font-size: 18px;
    margin-bottom: 6px;
  }

  .sidebar__mini-row {
    font-size: 10px;
  }

  .sidebar__mini-badge {
    padding: 3px 7px;
    font-size: 10px;
  }

  .user-card {
    gap: 8px;
    padding: 8px 2px 0;
  }

  .user-card__avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .user-card__name {
    font-size: 13px;
  }

  .user-card__mail {
    font-size: 10px;
  }

  .topbar {
    padding: 12px 12px 0;
  }

  .topbar__inner {
    padding: 12px;
    border-radius: 18px;
  }

  .topbar__title h1 { font-size: 18px; }
  .topbar__title p { font-size: 11px; }
  .page { padding: 14px 12px 24px; }
  .notice { padding: 12px 13px; border-radius: 18px; margin-bottom: 12px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { border-radius: 18px; }
  .card__body, .stat-card { padding: 14px; }
  .card__head { margin-bottom: 10px; }
  .card__title { font-size: 15px; }
  .card__desc { margin-top: 4px; line-height: 1.35; }
  .card--soft { min-height: 112px; }
  .stat-card__top { margin-bottom: 10px; gap: 10px; }
  .stat-card__label { font-size: 12px; }
  .stat-card__value { margin-top: 6px; font-size: 21px; }
  .stat-card__icon { width: 38px; height: 38px; border-radius: 13px; }
  .trend-chart--compact { gap: 4px; height: 146px; }
  .trend-chart--compact .trend-bar__col { height: 112px; }
  .month-grid--compact { grid-template-columns: 1fr; }
  .kpi-strip--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi-strip--compact .kpi-box { padding: 10px; }
  .kpi-strip--compact .kpi-box__value { font-size: 16px; }
  .list--compact .record-item, .list--compact .manage-item { padding: 10px 12px; }
  .list--compact .record-item__top, .list--compact .manage-item__top, .list--compact .month-item__top { gap: 8px; }
  .list--compact .record-item__note, .list--compact .manage-item__meta, .list--compact .month-item__stats { font-size: 11px; }
  .topbar__right .pill:not(.primary) { display: none; }
}
@media (min-width: 680px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-grid {
    grid-template-columns: 1.3fr 1fr;
  }

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

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

  .field-grid .field--full {
    grid-column: 1 / -1;
  }
}

@media (min-width: 980px) {
  .sidebar {
    width: var(--sidebar-collapsed);
    transform: none;
  }

  .main {
    padding-left: var(--sidebar-collapsed);
  }

  body.sidebar-expanded .sidebar {
    width: var(--sidebar-expanded);
  }

  body.sidebar-expanded .main {
    padding-left: var(--sidebar-expanded);
  }

  body:not(.sidebar-expanded) .sidebar__mini,
  body:not(.sidebar-expanded) .user-card__text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
  }

  body.sidebar-expanded .sidebar {
    width: var(--sidebar-expanded);
  }

  body.sidebar-expanded .main {
    padding-left: var(--sidebar-expanded);
  }

  body.sidebar-expanded .brand__text,
  body.sidebar-expanded .nav-item__text,
  body.sidebar-expanded .nav-item__arrow,
  body.sidebar-expanded .nav__label,
  body.sidebar-expanded .sidebar__mini,
  body.sidebar-expanded .user-card__text {
    opacity: 1;
    max-width: 180px;
    overflow: visible;
    pointer-events: auto;
  }


  .notice {
    padding: 12px 14px;
    gap: 8px;
    margin-bottom: 12px;
    border-radius: 16px;
  }

  .card-grid {
    gap: 10px;
  }

  .card__body {
    padding: 14px;
  }

  .card__head {
    margin-bottom: 10px;
  }

  .card__title {
    font-size: 15px;
  }

  .card__desc {
    margin-top: 4px;
    line-height: 1.35;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card__top {
    margin-bottom: 10px;
    gap: 10px;
  }

  .stat-card__label {
    font-size: 12px;
  }

  .stat-card__value {
    margin-top: 6px;
    font-size: 24px;
  }

  .stat-card__icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .stat-card__icon svg {
    width: 18px;
    height: 18px;
  }

  .stat-card__foot {
    font-size: 11px;
  }

  .section-grid,
  .section-grid.section-grid--wide {
    gap: 10px;
    margin-top: 10px;
  }

  .trend-chart {
    gap: 5px;
    height: 164px;
    padding-top: 4px;
  }

  .trend-bar__col {
    height: 128px;
  }

  .trend-bar__fill {
    width: min(16px, 100%);
    border-radius: 12px 12px 4px 4px;
  }

  .trend-bar small {
    font-size: 10px;
  }

  .chart-legend {
    gap: 8px;
    margin-top: 10px;
  }

  .legend-item {
    font-size: 11px;
  }

  .record-item,
  .manage-item,
  .month-item {
    padding: 12px 13px;
    gap: 6px;
    border-radius: 16px;
  }

  .record-item__meta,
  .manage-item__meta {
    gap: 6px 10px;
  }

  .record-item__note,
  .helper,
  .meta,
  .muted {
    font-size: 12px;
  }

  .badge,
  .chip,
  .status,
  .pill {
    min-height: 26px;
    padding: 0 10px;
    font-size: 11px;
  }

  .field-grid,
  .kpi-strip,
  .month-item__stats {
    gap: 8px;
  }

  .kpi-box {
    padding: 12px;
    border-radius: 14px;
  }

  .kpi-box__value {
    font-size: 17px;
  }

  .list,
  .audit-box {
    gap: 8px;
  }

  .pagination {
    gap: 6px;
    margin-top: 12px;
  }

  .page-btn,
  .tool-btn {
    height: 36px;
    min-height: 36px;
  }

  .topbar {
    padding: 12px 12px 0;
  }

  .topbar__inner {
    padding: 10px 12px;
    border-radius: 18px;
  }

  .topbar__title h1 {
    font-size: 17px;
  }

  .topbar__title p {
    font-size: 11px;
  }

  .page {
    padding: 12px 12px 22px;
  }

  .topbar__right .pill.primary {
    padding: 0 12px;
  }

  .topbar__right .pill:not(.primary) {
    display: none;
  }
}
