/* ============ 组件层：登录、图表、预算、账户、弹层 ============ */

/* ---------- 登录层 ---------- */
.auth-layer {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #e8f2ee 0%, transparent 65%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-brand strong { display: block; font-size: 17px; letter-spacing: .3px; }
.auth-brand small { color: var(--muted); }
.auth-switch { display: flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; border: 0; background: transparent; padding: 8px;
  border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer;
  font-family: inherit;
}
.auth-tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ---------- 图表 ---------- */
canvas { max-width: 100%; height: auto; display: block; }
.donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.donut-wrap canvas { flex: 0 0 220px; width: 220px; height: 220px; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 210px; display: flex; flex-direction: column; gap: 9px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: block; }
.legend .lg-val { color: #5b564f; font-variant-numeric: tabular-nums; }
.legend .lg-pct { color: var(--muted); font-size: 12px; width: 42px; text-align: right; }
.donut-sm { width: 200px; height: 200px; margin: 0 auto 12px; }

.c0 { background: #2f8f7b; } .c1 { background: #d98b3a; } .c2 { background: #6b8fd0; }
.c3 { background: #c4554a; } .c4 { background: #8a7bb8; } .c5 { background: #4aa3a0; }
.c6 { background: #b5a35a; } .c7 { background: #8a857c; }

/* ---------- 预算 ---------- */
.budget-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.budget-mini-item .bm-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.bm-num { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bm-num.over { color: var(--expense); font-weight: 600; }
.bar { height: 8px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.bar-fill.warn { background: var(--warn); }
.bar-fill.over { background: var(--expense); }
.budget-list { display: flex; flex-direction: column; gap: 16px; margin-top: 6px; }
.budget-item { border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; }
.bi-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; gap: 10px; }
.bi-head b { font-weight: 600; }
.bi-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }

/* ---------- 账户 ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.acc-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: linear-gradient(160deg, #fff 0%, #fbfaf8 100%);
}
.acc-top { display: flex; gap: 10px; align-items: center; }
.acc-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 18px; flex: 0 0 36px;
}
.acc-name { font-weight: 600; font-size: 14px; }
.acc-type { font-size: 11.5px; color: var(--muted); }
.acc-bal { font-size: 21px; font-weight: 650; margin: 12px 0 8px; font-variant-numeric: tabular-nums; }
.acc-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; gap: 8px; }
.acc-icon .ico-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }

/* ---------- 图标选择（上传图片 / emoji） ---------- */
.ico-field { display: flex; flex-direction: column; gap: 7px; }
.ico-field-label { font-size: 13px; color: #55504a; }
.ico-pick { display: flex; gap: 14px; align-items: center; }
.ico-preview {
  width: 52px; height: 52px; flex: 0 0 52px;
  border: 1px solid var(--line); border-radius: 13px;
  background: #fdfcfa; overflow: hidden;
  display: grid; place-items: center; font-size: 26px; line-height: 1;
}
.ico-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ico-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ico-actions .hint { margin: 0; }

/* ---------- 月份切换 ---------- */
.month-switch { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.month-switch input[type=month] {
  font: inherit; font-size: 13px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fdfcfa; color: var(--ink);
}

/* ---------- 弹层 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 28, 24, .38);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-card {
  width: 100%; max-width: 460px; background: var(--surface);
  border-radius: 16px; padding: 22px 24px 24px;
  box-shadow: 0 20px 60px rgba(20,18,14,.22);
  max-height: 92vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }

@media (max-width: 820px) {
  .donut-wrap canvas { flex: 0 0 100%; width: 100%; max-width: 240px; margin: 0 auto; }
  .budget-mini { grid-template-columns: 1fr; }
}
