/*!
 * 预算记账 · 样式（移动端优先 H5）
 */

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #101828;
  --text-soft: #475467;
  --muted: #8a94a6;
  --line: #e9edf3;
  --line-soft: #f1f4f9;
  --primary: #4f7cff;
  --primary-dark: #3b66e6;
  --danger: #ff4d4f;
  --ok: #00b894;
  --warn: #ff9f43;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --card: #171b23;
    --text: #eef1f6;
    --text-soft: #c3cad6;
    --muted: #8b95a7;
    --line: #242a35;
    --line-soft: #1d222b;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}

button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
b, .hero__amount, .stat__value, .rec__amount, .bcard__remain-value, .daygroup__total { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------------ 骨架 */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  padding-bottom: calc(var(--tabbar-h) + 18px + var(--safe-b));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-t);
  background: var(--bg); /* 旧内核回退 */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
}

.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; letter-spacing: .2px; }

.brand__mark {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7a5cff);
  color: #fff; font-size: 14px; font-weight: 800;
}

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: var(--card); color: var(--text-soft);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.icon-btn:active { transform: scale(.94); }

.view { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------------- 通用卡片 */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card--tight { padding: 14px 16px; }
.card--flush { padding: 4px 14px; }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card__title { font-size: 15px; font-weight: 700; }
.card__hint { font-size: 12px; color: var(--muted); }

.link {
  border: 0; background: none; color: var(--primary);
  font-size: 13px; font-weight: 600; padding: 4px 0; cursor: pointer;
}

/* ---------------------------------------------------------------- 概览 */

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #4f7cff 0%, #6a5cff 55%, #8a5cf6 100%);
  box-shadow: 0 10px 30px rgba(79, 124, 255, 0.28);
  padding: 20px 18px 16px;
}
.hero--over { background: linear-gradient(135deg, #ff6b6b, #ff4d4f 60%, #e5353b); box-shadow: 0 10px 30px rgba(255, 77, 79, .3); }
.hero::after {
  content: ""; position: absolute; right: -40px; top: -60px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero__label { font-size: 13px; opacity: .85; }
.hero__amount { font-size: 34px; font-weight: 800; letter-spacing: -.5px; margin: 2px 0 14px; }
.hero .bar { background: rgba(255, 255, 255, .26); }
.hero__row {
  display: flex; justify-content: space-between; gap: 6px;
  margin-top: 10px; font-size: 12px; opacity: .92;
}
.hero__row b { font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 12px 13px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px;
}
.stat__label { font-size: 12px; color: var(--muted); }
.stat__value { font-size: 16px; font-weight: 700; }

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; transition: width .65s cubic-bezier(.22, .9, .3, 1); }
.bar.is-over i { background: var(--danger) !important; }

/* 迷你柱状图 */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 104px; }
.chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.chart__track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.chart__bar {
  display: block; width: 100%; border-radius: 7px;
  background: linear-gradient(180deg, #9fb6ff, #4f7cff);
  min-height: 3px; transition: height .5s cubic-bezier(.22, .9, .3, 1);
}
.chart__col.is-today .chart__bar { background: linear-gradient(180deg, #ffc078, #ff9f43); }
.chart__label { font-size: 11px; color: var(--muted); }
.chart__col.is-today .chart__label { color: var(--warn); font-weight: 700; }

/* -------------------------------------------------------------- 预算行 */

.brow-list { display: flex; flex-direction: column; gap: 16px; }
.brow { display: flex; flex-direction: column; gap: 7px; }
.brow__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.brow__name { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
.brow__remain { font-size: 14px; font-weight: 700; white-space: nowrap; }
.brow__remain.is-over { color: var(--danger); }
.brow__foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.brow__actions { display: flex; gap: 8px; margin-top: 2px; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* -------------------------------------------------------------- 记账项 */

.rec-list { display: flex; flex-direction: column; }
.rec {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 0;
  background: none; border: 0; border-bottom: 1px solid var(--line-soft);
  text-align: left; cursor: pointer;
}
.rec-list .rec:last-child { border-bottom: 0; }
.rec:active { opacity: .6; }
.rec__icon {
  width: 36px; height: 36px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.rec__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rec__title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec__meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec__amount { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }

.daygroup { display: flex; flex-direction: column; gap: 8px; }
.daygroup__head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; }
.daygroup__date { font-size: 13px; font-weight: 700; display: inline-flex; align-items: baseline; gap: 7px; }
.daygroup__date em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--muted); }
.daygroup__total { font-size: 13px; font-weight: 700; color: var(--text-soft); }

.list-summary { font-size: 13px; color: var(--muted); padding: 0 4px; }
.list-summary b { color: var(--text); }

/* -------------------------------------------------------------- 筛选条 */

.filters { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chips--seg { background: var(--line-soft); border-radius: 12px; padding: 3px; gap: 3px; }
.chips--seg .chip { flex: 1; justify-content: center; background: transparent; box-shadow: none; border: 0; }
.chips--seg .chip.is-active { background: var(--card); box-shadow: var(--shadow); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 99px;
  border: 1px solid transparent; background: var(--card);
  color: var(--text-soft); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background .18s ease, color .18s ease;
}
.chip:active { transform: scale(.96); }
.chip.is-active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79, 124, 255, .3); }
.chip__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip__extra { font-style: normal; font-size: 11px; opacity: .75; font-weight: 500; }
.chips--colors { gap: 12px; }
.chips--colors .chip { padding: 0; width: 30px; height: 30px; border-radius: 50%; box-shadow: none; border: 2px solid transparent; position: relative; }
.chips--colors .chip .chip__dot { width: 22px; height: 22px; }
.chips--colors .chip.is-active { outline: 2px solid var(--primary); outline-offset: 2px; background: transparent; }

/* ------------------------------------------------------------ 预算卡片 */

.summary-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

.bcard { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.bcard__head { width: 100%; }
.bcard__name { font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.bcard__note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bcard__period { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bcard__foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.bcard__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 2px; }

.btn--new { margin-top: -2px; }

.tools { display: flex; flex-direction: column; gap: 8px; }
.tools__row { display: flex; flex-wrap: wrap; gap: 8px; }

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

.btn {
  border: 0; border-radius: 12px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--line-soft); color: var(--text);
  transition: transform .12s ease, opacity .18s ease, background .18s ease;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .5; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(79, 124, 255, .28); }
.btn--primary:active { background: var(--primary-dark); }
.btn--danger-solid { background: var(--danger) !important; color: #fff !important; box-shadow: 0 8px 20px rgba(255, 77, 79, .26) !important; }
.btn--ghost { background: var(--line-soft); color: var(--text-soft); box-shadow: none; }
.btn--danger { color: var(--danger); }
.btn--block { width: 100%; }
.btn--mini { padding: 8px 13px; font-size: 13px; border-radius: 10px; }

/* ------------------------------------------------------------ 空状态 */

.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 20px; }
.empty--slim { padding: 22px 18px; gap: 12px; }
.empty__emoji { font-size: 34px; }
.empty__title { font-size: 17px; font-weight: 700; }
.empty__text { font-size: 13px; color: var(--muted); line-height: 1.7; }
.empty__actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 6px; }

/* ---------------------------------------------------------------- 底栏 */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding-bottom: var(--safe-b);
  background: var(--card); /* 旧内核回退 */
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar__item {
  flex: 1; max-width: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar-h);
  border: 0; background: none; color: var(--muted);
  font-size: 11px; font-weight: 600; cursor: pointer;
}
.tabbar__item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tabbar__item.is-active { color: var(--primary); }
.tabbar__item:active { opacity: .7; }

/* 悬浮「＋」已移除：首页靠点圆圈扣款，明细页有自己的记一笔入口 */

/* ---------------------------------------------------------------- 弹层 */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(16, 24, 40, .45);
  opacity: 0; transition: opacity .22s ease;
}
.sheet-backdrop.is-open { opacity: 1; }

.sheet {
  width: 100%; max-width: 560px; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(101%);
  transition: transform .3s cubic-bezier(.22, .9, .3, 1);
  padding-bottom: var(--safe-b);
  will-change: transform;
}
.sheet.is-open { transform: translateY(0); }
.sheet.is-dragging { transition: none; }

.sheet__head {
  flex: none; position: relative;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
  touch-action: none;
}
.sheet__grip {
  width: 40px; height: 4px; border-radius: 99px;
  background: var(--line); margin: 0 auto 10px;
}
.sheet__titles { padding-right: 32px; }
.sheet__title { font-size: 17px; font-weight: 700; }
.sheet__subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sheet__close {
  position: absolute; right: 12px; top: 24px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: var(--line-soft); color: var(--muted);
  font-size: 13px; cursor: pointer;
}
.sheet__body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet__foot {
  flex: none; display: flex; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--card);
}
/* 次要按钮并排一行（各占一半），主按钮单独占满一行 */
.sheet__foot .btn { flex: 1 1 0; min-width: 0; }
.sheet__foot .btn--block { flex-basis: 100%; }

.dialog { display: flex; flex-direction: column; gap: 8px; }
.dialog__text { font-size: 14px; line-height: 1.7; }
.dialog__detail { font-size: 12px; color: var(--muted); line-height: 1.7; }

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

.form { display: flex; flex-direction: column; gap: 14px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form__group { display: flex; flex-direction: column; gap: 8px; }
.form__label { font-size: 12px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; color: var(--muted); }
.field__hint { font-size: 11px; color: var(--muted); }

.input, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--line-soft);
  padding: 12px 13px; font-size: 16px; /* 16px 避免 iOS 自动放大 */
  outline: none; transition: border-color .18s ease, background .18s ease;
}
.input:focus, .textarea:focus { border-color: var(--primary); background: var(--card); }
.textarea { resize: vertical; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* 金额输入统一走计算器弹层，见 .amount-btn */

.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.hint--over { color: var(--danger); font-weight: 600; }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 2px; text-align: left;
  border: 0; border-bottom: 1px solid var(--line-soft); background: none; cursor: pointer;
}
.rows .row:last-child { border-bottom: 0; }
.row:active { opacity: .6; }
.row__main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row__label { font-size: 14px; font-weight: 600; }
.row__desc { font-size: 12px; color: var(--muted); }
.row__arrow { color: var(--muted); font-size: 18px; }
.row--danger .row__label { color: var(--danger); }

/* ------------------------------------------------------- 存储状态提示 */

.notice-root { padding: 0 16px; }
.notice-root:empty { display: none; }
.notice {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: 14px;
  background: #fff4e5; color: #7a4a00;
  font-size: 12.5px; line-height: 1.65;
  box-shadow: var(--shadow);
}
.notice__icon { flex: none; }
.notice__text { flex: 1; min-width: 0; }
.notice__btn {
  flex: none; border: 0; cursor: pointer;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(122, 74, 0, .12); color: inherit;
  font-size: 12px; font-weight: 700;
}

.status-card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 12px 14px; margin-bottom: 12px;
  border-radius: 14px; background: var(--line-soft);
}
.status-card__title { font-size: 13px; font-weight: 700; color: var(--ok); }
.status-card__title.is-bad { color: var(--danger); }
.status-card__text { font-size: 12px; color: var(--muted); line-height: 1.65; white-space: pre-line; }

@media (prefers-color-scheme: dark) {
  .notice { background: rgba(255, 159, 67, .14); color: #ffc98a; }
  .notice__btn { background: rgba(255, 201, 138, .16); }
}

/* -------------------------------------------------------------- 轻提示 */

.toast-root {
  position: fixed; left: 0; right: 0; z-index: 90;
  bottom: calc(var(--tabbar-h) + 90px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  max-width: 100%;
  padding: 10px 16px; border-radius: 14px;
  background: rgba(16, 24, 40, .92); color: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.4;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px) scale(.97);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: auto;
}
.toast.is-in { opacity: 1; transform: none; }
.toast--ok { background: rgba(0, 132, 106, .95); }
.toast--warn { background: rgba(196, 118, 0, .95); }
.toast--error { background: rgba(200, 40, 44, .95); }

.clipboard-proxy { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* ------------------------------------------------------- 大圆圈（环形进度） */

.ring { position: relative; display: inline-block; flex: none; transition: transform .15s ease; }
.ring__svg { width: 100%; height: 100%; display: block; }
.ring__track { fill: none; stroke: var(--line); stroke-width: 9; }
.ring__fill {
  fill: none; stroke-width: 9; stroke-linecap: round;
  transition: stroke-dashoffset .8s cubic-bezier(.22, .9, .3, 1);
}
.ring__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  text-align: center; padding: 0 8px;
}
.ring__label { font-size: 11px; color: var(--muted); line-height: 1.2; }
.ring__value {
  font-size: var(--ring-value, 22px); font-weight: 800; letter-spacing: -.6px;
  line-height: 1.15; font-variant-numeric: tabular-nums; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ring__value[data-len="2"] { font-size: calc(var(--ring-value, 22px) * .82); }
.ring__value[data-len="3"] { font-size: calc(var(--ring-value, 22px) * .66); }
.ring__value.is-over { color: var(--danger); }
.ring__meta { font-size: 11px; color: var(--muted); line-height: 1.2; }
.ring--lg { --ring-value: 24px; }
.ring--sm { --ring-value: 14px; }
.ring--sm .ring__label { font-size: 9px; }
.ring--sm .ring__meta { display: none; }
.ring--sm .ring__value { letter-spacing: -.2px; }
.ring.is-over .ring__label { color: var(--danger); }

/* 点圆圈直接扣一笔 */
.ring-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; padding: 4px 0 8px;
  border: 0; background: none; cursor: pointer;
}
.ring-btn:active .ring { transform: scale(.965); }
/* 首页唯一的扣款入口就是圆圈，这行提示做成小药丸，看着能点 */
.ring-btn__tip {
  font-size: 12.5px; font-weight: 700; color: var(--primary);
  background: rgba(79, 124, 255, .12);
  padding: 5px 13px; border-radius: 999px;
}
.ring.is-over + .ring-btn__tip { color: var(--danger); background: rgba(255, 77, 79, .12); }

/* 总览页：大圆圈预算卡片横滑（一格一个预算） */
.ring-row {
  display: flex; gap: 12px; align-items: stretch;
  overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 2px 16px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.ring-row::-webkit-scrollbar { display: none; }
/* 首页只有这一行圆圈：一屏一张卡，卡片撑满可用高度，圆圈在卡片中间垂直居中 */
.ring-row--main {
  gap: 16px;
  padding-top: 8px; padding-bottom: 2px;
  min-height: min(620px, calc(100vh - 208px));
}
.ring-row--main .bcard--slide {
  flex: 0 0 100%; max-width: none;
  padding: 20px 18px 18px;
  gap: 12px;
}
.ring-row--main .ring-btn { flex: 1 1 auto; justify-content: center; }
.ring-row--main .bcard__foot { margin-top: auto; }
.ring-row--main .bcard__actions { margin-top: 0; }

/* 页点：一屏一张卡时用它表示「还有几个预算 / 现在在第几个」 */
.ring-dots { display: flex; justify-content: center; align-items: center; gap: 7px; margin: 12px 0 2px; }
.ring-dots > button {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
  background: var(--line); cursor: pointer; transition: all .18s ease;
}
.ring-dots > button.is-active { width: 20px; border-radius: 999px; background: var(--primary); }

/* 卡片上只留「加减额度」一个动作，居中且够大好点 */
.bcard__actions--single .btn {
  min-width: 168px; padding: 10px 22px; font-size: 14px; border-radius: 999px;
}
.ring-row__tip { font-size: 12px; color: var(--muted); text-align: center; margin: -4px 0 12px; }
.page-hint { font-size: 12px; color: var(--muted); margin: 0 2px 12px; }
/* 明细页顶部：标题 + 记一笔 */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-head__title { font-size: 15px; font-weight: 700; }

/* ------------------------------------------------------------ 金额按钮 */

.amount-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--line-soft); cursor: pointer;
  transition: border-color .18s ease, transform .1s ease;
}
.amount-btn:active { transform: scale(.99); border-color: var(--primary); }
.amount-btn__head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.amount-btn__label { font-size: 12px; color: var(--muted); }
.amount-btn__hint { font-size: 11px; color: var(--muted); opacity: .75; }
.amount-btn__value {
  font-size: 24px; font-weight: 800; letter-spacing: -.6px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.amount-btn.is-empty .amount-btn__value { color: var(--muted); font-weight: 700; }
.amount-btn__icon { font-size: 17px; opacity: .45; }

/* ------------------------------------------- 计算器（浅色，与应用同一套风格） */

.sheet--calc .sheet__body { padding: 12px 16px 6px; }
.sheet--calc .sheet__foot { padding-top: 12px; }

.calc { display: flex; flex-direction: column; gap: 10px; }
/* 分类：小标题在上、chips 横滑在下，跟表单里的 .field 一个排法 */
.calc__cats { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.calc__cats-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.calc__cats .chips--scroll { margin: 0; padding-left: 0; padding-right: 0; }

/* 显示区：和 .amount-btn 同一种卡片质感 */
.calc__display {
  text-align: right; font-size: 40px; font-weight: 800; line-height: 1.16;
  letter-spacing: -1.4px; color: var(--text);
  font-variant-numeric: tabular-nums;
  padding: 13px 16px; border-radius: 14px;
  background: var(--line-soft); border: 1px solid var(--line);
  overflow: hidden; white-space: nowrap;
}
.calc__display[data-len="md"] { font-size: 33px; }
.calc__display[data-len="sm"] { font-size: 27px; }
.calc__display[data-len="xs"] { font-size: 22px; }

.calc__hint {
  min-height: 17px; font-size: 12px; text-align: right;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.calc__hint.is-warn { color: var(--danger); font-weight: 700; }

.calc__keys {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px;
  width: 100%; max-width: 336px; margin: 4px auto 0;
}
.ck {
  height: 60px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--line-soft); color: var(--text);
  font-size: 20px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: grid; place-items: center;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .1s ease;
  -webkit-user-select: none; user-select: none;
}
.ck:active { transform: scale(.96); border-color: var(--primary); }
.ck--fn { background: var(--card); color: var(--muted); font-size: 17px; }
.ck--op {
  background: rgba(79, 124, 255, .1); border-color: rgba(79, 124, 255, .18);
  color: var(--primary); font-size: 22px; font-weight: 700;
}
.ck--op.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ck--zero { grid-column: span 2; }

.calc__actions { display: flex; gap: 10px; width: 100%; }
.calc__actions .btn { flex: 1 1 0; min-width: 0; }
.calc__actions .calc__submit { flex: 2 1 0; }

.bcard__title-wrap { min-width: 0; }

/* ----------------------------------------------------------- 大屏微调 */

@media (min-width: 600px) {
  .view { padding: 8px 20px; }
  .stats { gap: 12px; }
  .hero__amount { font-size: 38px; }
  .sheet { border-radius: 22px; margin-bottom: 24px; }
  .sheet-backdrop { align-items: flex-end; }
}

/* 矮屏（iPhone SE 之类）让计算器整体缩一点，避免键盘被裁掉 */
@media (max-height: 720px) {
  .calc__keys { max-width: 272px; gap: 7px; }
  .calc__display { font-size: 42px; }
  .calc__display[data-len="sm"] { font-size: 30px; }
  .ck { font-size: 19px; }
  .ck--op { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}