:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e8e2d7;
  --accent: #0d7a6f;
  --accent-soft: #e4f3ef;
  --danger: #b91c1c;
  --amber: #b45309;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 12px 28px -14px rgba(28, 25, 23, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 88% -12%, #e6f2ee 0%, transparent 58%),
    radial-gradient(900px 520px at -8% 2%, #f6ecdf 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.page {
  padding: 18px 14px 96px;
}

/* ---------- 顶栏 ---------- */

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

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

.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #12a08f, #0b6158);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 8px 18px -8px rgba(13, 122, 111, 0.65);
}

h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.sub code {
  padding: 1px 5px;
  border-radius: 5px;
  background: #ede7db;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  color: #6b6156;
}

.today {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 布局 ---------- */

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.side {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  min-width: 0;
}

.main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #37312b;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-head .card-title {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

/* ---------- 表单 ---------- */

.field {
  display: block;
  margin-bottom: 12px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

input[type="date"],
input[type="month"],
input[type="number"],
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder {
  color: #b8b0a3;
}

input:focus {
  outline: none;
  border-color: #4fb3a7;
  box-shadow: 0 0 0 3px rgba(13, 122, 111, 0.12);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.amount-input {
  position: relative;
}

.amount-input .prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13.5px;
  color: #a8a29e;
}

.amount-input input {
  padding-left: 30px;
  font-size: 16px;
  font-weight: 600;
}

/* ---------- 备注常用标签 ---------- */

.note-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.note-label-row > span {
  font-size: 12.5px;
  color: var(--muted);
}

.voice-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.voice-btn.recording {
  background: #fdeaea;
  border-color: var(--danger);
  color: var(--danger);
}

.note-tags {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.note-tags::-webkit-scrollbar {
  display: none;
}

#note-field.focused .note-tags {
  display: flex;
}

.note-tag {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf7f1;
  font: inherit;
  font-size: 13px;
  color: #57534e;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.note-tag:active {
  background: var(--accent-soft);
}

.note-tag.active {
  border-color: #4fb3a7;
  background: var(--accent-soft);
  color: #0b6b60;
}

.note-tag.add {
  border-style: dashed;
  background: #fff;
  color: var(--accent);
}

/* ---------- 按钮 ---------- */

.btn {
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn.primary {
  width: 100%;
  margin-top: 4px;
  background: linear-gradient(180deg, #12968a, #0c6f64);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(12, 111, 100, 0.9);
}

.btn.primary:active {
  transform: translateY(1px);
}

.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: #57534e;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.form-hint {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--danger);
}

.budget-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}

.budget-edit .amount-input {
  flex: 1;
  min-width: 0;
}

#budget-hint {
  margin: 10px 0 0;
  line-height: 1.5;
}

.budget-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.budget-error {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  color: var(--danger);
  min-height: 18px;
}

/* ---------- KPI ---------- */

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

.kpi {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow);
  min-width: 0;
}

.kpi-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.kpi strong {
  display: block;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi.accent {
  border-color: transparent;
  background: linear-gradient(140deg, #12968a, #0a6157);
  color: #fff;
}

.kpi.accent .kpi-label {
  color: rgba(255, 255, 255, 0.78);
}

.kpi.accent strong {
  font-size: 21px;
}

.kpi strong.over {
  color: var(--danger);
}

/* ---------- 预算进度 ---------- */

.progress {
  height: 10px;
  border-radius: 999px;
  background: #f1ece2;
  overflow: hidden;
  margin: 4px 0 10px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #14a08f, #0b6b60);
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s;
}

.progress-fill.warn {
  background: linear-gradient(90deg, #f0a83e, #d97706);
}

.progress-fill.over {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: #f5f0e6;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pill.ok {
  background: var(--accent-soft);
  color: #0b6b60;
}

.pill.warn {
  background: #fdf0dc;
  color: var(--amber);
}

.pill.over {
  background: #fdeaea;
  color: var(--danger);
}

#budget-progress-text {
  margin: 0;
}

/* ---------- 图表 ---------- */

.chart {
  margin-top: 4px;
}

.bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 150px;
  padding-top: 10px;
  background-image: linear-gradient(to top, rgba(28, 25, 23, 0.07) 1px, transparent 1px);
  background-size: 100% 25%;
}

.bar {
  flex: 1;
  min-width: 0;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #35b7a7, #0f8a7d);
  transition: height 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bar.zero {
  height: 3px;
  background: #e6dfd4;
  border-radius: 2px;
}

.chart-tip {
  position: absolute;
  z-index: 3;
  padding: 5px 9px;
  border-radius: 8px;
  background: #1c1917;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.15s;
}

.chart-tip.show {
  opacity: 1;
}

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.insights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.insight.up {
  color: var(--danger);
}

.insight.down {
  color: var(--accent);
}

/* ---------- 记录列表 ---------- */

.month-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: #57534e;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.month-label {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.list-head {
  align-items: flex-start;
}

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

.list-tools input[type="search"] {
  width: 120px;
  height: 34px;
  font-size: 13px;
  border-radius: 9px;
  background: #fbf9f4;
}

.record-list {
  margin-top: 4px;
}

.day-group {
  margin-top: 14px;
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f2ede4;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.day-head .day {
  font-size: 13px;
  font-weight: 600;
  color: #57534e;
}

.day-sum {
  margin-left: auto;
}

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

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px dashed #f4efe7;
}

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

.row-note {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-note.empty {
  color: #b8b0a3;
}

.row-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #3f3a34;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-del {
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #a8a29e;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.row-del.danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.row-edit {
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #a8a29e;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.form-hint.clickable {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 12px 40px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.empty-badge {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #f6f1e7;
  color: #c3b9a8;
  font-size: 18px;
  font-weight: 700;
}

.empty p {
  margin: 0;
}

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 9px 18px;
  border-radius: 999px;
  background: #1c1917;
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: #991b1b;
}

:focus-visible {
  outline: 2px solid rgba(13, 122, 111, 0.45);
  outline-offset: 2px;
}

/* ---------- 分类 ---------- */

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: #57534e;
  cursor: pointer;
}

.chip.active {
  background: var(--accent-soft);
  border-color: #79beb3;
  color: #0b6158;
  font-weight: 600;
}

.chip-icon {
  font-size: 14px;
  line-height: 1;
}

.cat-list {
  margin-bottom: 12px;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 2px;
  border-bottom: 1px dashed #f4efe7;
}

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

.cat-icon {
  font-size: 16px;
  line-height: 1;
}

.cat-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

.cat-tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: #f5f0e6;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.cat-add {
  display: flex;
  gap: 8px;
}

.cat-add input {
  flex: 1;
  min-width: 0;
}

.cat-add + .muted {
  margin: 10px 0 0;
}

/* ---------- 两栏统计区 ---------- */

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* ---------- 分类汇总 ---------- */

.cat-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  margin: 0 -6px;
  border-bottom: 1px dashed #f4efe7;
  border-radius: 8px;
  flex-wrap: wrap;
  row-gap: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.cat-stat-row:active {
  background: #f8f5ee;
}

.cat-stat-row.active {
  background: var(--accent-soft);
}

.cat-stat-row.active .cat-stat-name {
  color: #0b6b60;
  font-weight: 600;
}

.cat-detail {
  margin: 2px 0 6px;
  padding: 2px 6px 2px 26px;
  border-bottom: 1px dashed #f4efe7;
}

.cat-detail:last-child {
  border-bottom: 0;
}

.cat-detail-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  font-size: 12.5px;
}

.cat-detail-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}

.cat-detail-note {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #57534e;
}

.cat-detail-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex-shrink: 0;
}

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

.cat-stat-row:last-child {
  border-bottom: 0;
}

.cat-stat-icon {
  font-size: 16px;
  line-height: 1;
}

.cat-stat-name {
  width: auto;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #57534e;
}

.cat-stat-track {
  flex: 1 1 100%;
  order: 3;
  height: 8px;
  border-radius: 999px;
  background: #f1ece2;
  overflow: hidden;
}

.cat-stat-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #35b7a7, #0f8a7d);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cat-stat-amt {
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-stat-pct {
  width: auto;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-cat {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

/* ---------- 周期记账 ---------- */

.title-note {
  margin-left: 8px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
}

.recur-form {
  display: grid;
  gap: 8px;
}

.recur-day {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
}

.recur-day input {
  width: 76px;
  text-align: center;
}

.recur-meta {
  flex: 1;
  min-width: 0;
}

.recur-meta .recur-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

.recur-meta .recur-sub {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.recur-empty {
  padding: 6px 2px 12px;
}

/* ---------- 分类预算 ---------- */

.budget-list {
  margin-bottom: 12px;
}

.budget-row input {
  width: 110px;
  flex-shrink: 0;
  height: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cat-stat-fill.over {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.cat-stat-pct.over {
  color: var(--danger);
  font-weight: 600;
  width: auto;
  min-width: 42px;
}

.recur-end-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.row-edit {
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #a8a29e;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.cat-row input[type="month"] {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 34px;
  font-size: 13px;
}

.small-btn {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

/* ---------- 提醒弹窗 ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 25, 23, 0.45);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px -20px rgba(28, 25, 23, 0.45);
}

.modal-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 650;
}

.modal-body p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #44403c;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal .btn {
  margin-top: 14px;
}

/* ---------- 登录页 ---------- */

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-wrap[hidden] {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 34px 26px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  margin: 0 auto 14px;
  width: 52px;
  height: 52px;
  font-size: 25px;
  border-radius: 16px;
}

.auth-title {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}

.auth-sub {
  margin: 6px 0 22px;
  font-size: 13px;
  color: var(--muted);
}

#auth-form {
  display: grid;
  gap: 10px;
}

#auth-form input {
  text-align: center;
}

.auth-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-hint.ok {
  color: var(--accent);
}

.auth-hint.error {
  color: var(--danger);
}

/* ---------- 顶栏右侧：日期 + 用户 ---------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-between;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.user-email {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: #57534e;
}

input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: #4fb3a7;
  box-shadow: 0 0 0 3px rgba(13, 122, 111, 0.12);
}

/* 登录卡与应用图标 */

.auth-icon {
  display: block;
  margin: 0 auto 14px;
  border-radius: 18px;
  box-shadow: 0 8px 18px -8px rgba(28, 25, 23, 0.45);
}

.logo-img {
  border-radius: 13px;
  box-shadow: 0 8px 18px -8px rgba(28, 25, 23, 0.4);
}

/* ---------- 底部标签页 ---------- */

/* 只显示当前标签对应的区块 */
body[data-tab] .tab-page {
  display: none;
}

body[data-tab="jizhang"] section.tab-jizhang,
body[data-tab="tongji"] section.tab-tongji,
body[data-tab="yusuan"] section.tab-yusuan,
body[data-tab="guanli"] section.tab-guanli {
  display: block;
}

body[data-tab="jizhang"] .month-bar.tab-jizhang,
body[data-tab="tongji"] .month-bar.tab-tongji {
  display: flex;
}

body[data-tab="tongji"] .kpis.tab-tongji,
body[data-tab="tongji"] .two-col.tab-tongji {
  display: grid;
}

.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  transition: transform 0.12s ease;
}

/* 键盘弹出时底部标签栏下滑隐藏，键盘收起后恢复 */
body.keyboard-open .tab-bar {
  transform: translateY(120%);
}

.toast {
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

.tab-btn {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  border: none;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn .tab-icon {
  font-size: 19px;
  line-height: 1;
}

.tab-btn.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

/* 预算摘要：大金额时允许换行，避免撑破标题行 */
#budget-percent {
  flex-shrink: 1;
  min-width: 0;
  max-width: 60%;
  white-space: normal;
  text-align: right;
  line-height: 1.3;
}

/* 未登录时不显示标签栏 */
.tab-bar[hidden] {
  display: none;
}
