: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;
}

body {
  margin: 0;
  min-height: 100vh;
  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 {
  max-width: 1160px;
  margin: 0 auto;
  padding: 26px 22px 64px;
}

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

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

.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: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.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);
}

.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"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  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:hover {
  border-color: #d8d0c2;
}

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;
}

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

.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:hover {
  background: linear-gradient(180deg, #0f8a7d, #0a6157);
}

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

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

.btn.ghost:hover {
  border-color: #cfc6b7;
  background: #fbf8f2;
}

.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;
}

.link-btn:hover {
  text-decoration: underline;
}

.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;
}

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

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

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

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

.kpi strong {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.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: 23px;
}

.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), filter 0.15s;
}

.bar:hover {
  filter: brightness(1.09);
}

.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);
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: #fbf8f2;
  border-color: #d5ccbd;
}

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

.list-head {
  align-items: center;
}

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

.list-tools input[type="search"] {
  width: 150px;
  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;
}

.row-del {
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #a8a29e;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.row:hover .row-del {
  opacity: 1;
}

.row-del:hover {
  background: #fbf5ee;
  border-color: #ecdfd0;
  color: var(--danger);
}

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

.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: 10;
  padding: 9px 18px;
  border-radius: 999px;
  background: #1c1917;
  color: #fff;
  font-size: 13px;
  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;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 18px 14px 56px;
  }

  .side {
    grid-template-columns: 1fr;
  }

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

  .kpi strong {
    font-size: 19px;
  }

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

  .topbar {
    margin-bottom: 16px;
  }

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

  .list-tools input[type="search"] {
    width: 120px;
  }
}

: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;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  background: #fbf8f2;
  border-color: #cfc6b7;
}

.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: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

@media (max-width: 1000px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

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

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

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

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

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

.cat-stat-track {
  flex: 1;
  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: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cat-stat-pct {
  width: 42px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.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;
  opacity: 0.5;
  white-space: nowrap;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.cat-row:hover .row-edit {
  opacity: 1;
}

.row-edit:hover {
  background: #eef7f5;
  border-color: #cfe7e2;
  color: var(--accent);
}

.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;
}

.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: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: #57534e;
}

/* ---------- 导入卡片 ---------- */

#import-card .btn {
  width: 100%;
  margin-top: 10px;
}

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

/* ---------- 移动端补充打磨 ---------- */

@media (max-width: 700px) {
  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-email {
    max-width: 150px;
  }

  input[type="date"],
  input[type="month"],
  input[type="number"],
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px; /* 防止 iOS 聚焦时自动放大页面 */
  }
}

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: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

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);
}

/* ---------- 移动端底部标签页 ---------- */

.tab-bar {
  display: none;
}

@media (max-width: 1000px) {
  /* 只显示当前标签对应的区块 */
  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="tongji"] .month-bar.tab-tongji {
    display: flex;
  }

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

  .page {
    padding-bottom: 96px; /* 给底部标签栏让位 */
  }

  .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);
  }

  .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);
  }
}

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