/* ============================================================
   表單、選色器、固定收支摘要、藍圖拖曳
   ============================================================ */

/* ── 快速記帳 ── */
.qe-header { display: flex; align-items: center; gap: 8px; }
.qe-kind { flex: 1; display: flex; justify-content: center; gap: 4px; background: var(--bg-surface2); border-radius: 22px; padding: 3px; max-width: 200px; margin: 0 auto; }
.qe-kind-btn { flex: 1; border: none; background: none; border-radius: 18px; padding: 7px 0; font-size: 0.875rem; font-weight: 600; font-family: inherit; color: var(--text2-on-bg-surface2); cursor: pointer; transition: background .15s, color .15s; }
.qe-kind-btn.active { background: var(--bg-surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.qe-amount-wrap { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid var(--accent); padding: 4px 2px 6px; margin-top: 4px; }
.qe-currency { font-size: 1.375rem; font-weight: 700; color: var(--text3-on-bg-surface); }
.qe-amount { flex: 1; min-width: 0; border: none; outline: none; background: none; font-size: 2.125rem; font-weight: 800; font-family: inherit; color: var(--title-on-bg-surface); font-variant-numeric: tabular-nums; }
.qe-amount::placeholder { color: var(--text3-on-bg-surface); opacity: .55; }
.qe-amount-hint { font-size: 0.6875rem; color: var(--text3-on-bg-surface); margin: 4px 0 14px; }
.qe-dates { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qe-date-input { flex: 1; min-width: 130px; padding: 7px 10px; font-size: 0.875rem; }
.qe-chip { border: 0.5px solid var(--border2); background: var(--bg-surface3); color: var(--text2-on-bg-surface3); border-radius: 16px; padding: 6px 12px; font-size: 0.8125rem; font-family: inherit; cursor: pointer; white-space: nowrap; }
.qe-chip.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.qe-more { margin: 4px 0 14px; }
.qe-more[open] > summary { margin-bottom: 10px; }
.qe-inst-row { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text2-on-bg-surface); }
.qe-inst-row[hidden] { display: none; }
.qe-inst-input { width: 72px; padding: 6px 10px; text-align: center; }
.qe-inst-row .qe-inst-hint { flex: 1; min-width: 0; margin: 0; }
.qe-inst-hint { font-size: 0.6875rem; color: var(--text3-on-bg-surface); margin-top: 4px; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qe-inst-hint:empty { display: none; }

/* ── 分類（一次全部列出） ── */
.cat-pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-height: 168px; overflow-y: auto; }
.cat-pick .cat-btn { padding: 8px 2px 6px; gap: 3px; }
.cat-pick-icon { width: 20px; height: 20px; display: block; }
.cat-pick-name { font-size: 0.6875rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 標示顏色（一列） ── */
.hl-hint { font-size: 0.625rem; color: var(--text3-on-bg-surface); font-weight: 400; }
.hl-line { display: flex; align-items: center; gap: 10px; }
.hl-label { flex: none; font-size: 0.8125rem; color: var(--text2-on-bg-surface); }
.hl-row { flex: 1; min-width: 0; display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.hl-chip { flex: 0 1 26px; min-width: 0; aspect-ratio: 1; height: auto; border-radius: 50%; border: 0.5px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; transition: transform .12s; }
.hl-chip.selected { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--accent); transform: scale(1.06); }
.hl-chip.hl-none { flex: none; aspect-ratio: auto; height: 26px; width: auto; padding: 0 9px; border-radius: 13px; background: var(--bg-surface3); color: var(--text2-on-bg-surface3); font-size: 0.75rem; font-family: inherit; border-color: var(--border2); }

/* ── 兩選一大按鈕（餘存／必存）、頻率 ── */
.seg2 { display: flex; gap: 8px; }
.seg2-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border-radius: var(--r-md); border: 0.5px solid var(--border2); background: var(--bg-surface3); color: var(--text2-on-bg-surface3); font-family: inherit; cursor: pointer; }
.seg2-btn b { font-size: 0.875rem; }
.seg2-btn small { font-size: 0.6875rem; opacity: .75; }
.seg2-btn.selected { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.seg2-btn small { white-space: nowrap; }
.bucket-mode-note { margin-top: 8px; font-size: 0.6875rem; line-height: 1.6; color: var(--text3-on-bg-surface); }
.bucket-mode-note[hidden] { display: none; }
/* 有空才存：沒有每月存入，「每月幾號存入」不用填 */
#new-bucket-day-wrap.is-manual, #edit-bucket-day-wrap.is-manual { visibility: hidden !important; }
.freq-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── 選色器：色系＋色階 ── */
.cp-fams { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.cp-fam { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; padding: 2px 0; cursor: pointer; font-family: inherit; color: var(--text3-on-bg-surface); }
.cp-fam::before { content: ""; width: 24px; height: 24px; border-radius: 50%; background: var(--c); border: 0.5px solid rgba(0,0,0,.12); }
.cp-fam span { font-size: 0.625rem; }
.cp-fam.active { color: var(--title-on-bg-surface); font-weight: 600; }
.cp-fam.active::before { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3.5px var(--title-on-bg-surface); }
.cp-fam.has-sel::after { content: ""; position: absolute; top: 0; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cp-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.cp-sw { aspect-ratio: 1; border-radius: 6px; border: 0.5px solid rgba(0,0,0,.1); cursor: pointer; padding: 0; }
.cp-sw.selected { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3.5px var(--title-on-bg-surface); transform: scale(1.08); }

/* ── 設定：一色配色 ── */
/* 一色配色：色票、色相拉桿縮小、細邊，跟 App 其他元件（細框、強調色選取）同一套語言，也不搶下方精選主題的風頭 */
.seed-dots { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; justify-items: center; margin: 2px 0 12px; }
.seed-dot { width: 100%; max-width: 26px; aspect-ratio: 1; height: auto; border-radius: 50%; background: var(--c); border: 0.5px solid var(--border2); cursor: pointer; transition: transform .12s; padding: 0; }
.seed-dot:active { transform: scale(.9); }
.seed-dot.selected { box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 3.5px var(--accent); }
.seed-hue { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; outline: none; margin: 6px 0; border: 0.5px solid var(--border); }
.seed-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0.5px solid var(--border2); box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer; }
.seed-hue::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0.5px solid var(--border2); box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer; }
.seed-hint { font-size: 0.6875rem; color: var(--text3-on-bg-base); margin-top: 8px; }
.settings-adv > summary { list-style: none; cursor: pointer; user-select: none; }
.settings-adv > summary::-webkit-details-marker { display: none; }
.settings-adv[open] > summary { margin-bottom: 10px; }

/* ── 固定收支：摘要 ── */
.items-summary { background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 16px; padding: 14px 16px; margin: 4px 0 16px; }
.is-label { font-size: 0.75rem; font-weight: 600; color: var(--text2-on-bg-surface); }
.is-big { font-size: 1.875rem; font-weight: 800; color: var(--green-pos-mid); font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.is-big.neg { color: var(--red-mid); }
.is-bar { height: 8px; border-radius: 5px; background: var(--green-pos-mid); overflow: hidden; }
.is-bar span { display: block; height: 100%; background: var(--chart-fixed); transform-origin: left; animation: grow-x .6s cubic-bezier(.2,.8,.2,1) both; }
.is-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.75rem; color: var(--text-on-bg-surface); margin-top: 8px; flex-wrap: wrap; }
.is-row span { display: inline-flex; align-items: center; }
.is-note { font-size: 0.625rem; color: var(--text3-on-bg-surface); margin-top: 6px; }

/* ── 藍圖拖曳 ── */
.drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 28px; margin: -4px 2px -4px -6px; color: var(--text3-on-bg-surface); cursor: grab; touch-action: pan-y; -webkit-touch-callout: none; flex-shrink: 0; opacity: .6; transition: opacity .2s, color .2s; }
.drag-handle:active { cursor: grabbing; opacity: 1; }
/* 觸控長按拿起（ui.js pressToDrag）：按住時整列慢慢往下壓一點、握把亮起主色（蓄力），時間到就彈起來跟著手指走。
 * 長按前手指移動＝捲動頁面（握把用 pan-y，不擋捲動）。帳本列沿用同一個效果。 */
.bucket-card.pressing, .cat-mgr-row.pressing, .ledger-item.pressing { transform: scale(.97); transition: transform .35s linear; }
.pressing .drag-handle, .pressing .ledger-item-grip { color: var(--accent); opacity: 1; }
.bucket-top { display: flex; align-items: center; }
.bucket-top .bucket-name { flex: 1; min-width: 0; }
.bucket-card.dragging { opacity: .92; box-shadow: 0 10px 24px rgba(0,0,0,.18); position: relative; z-index: 5; }

/* ── 月份標記：時間軸圖示＋主頁細節區選擇器 ── */
.tl-sticker { color: var(--accent); fill: none; animation: rise .4s .3s cubic-bezier(.2,.8,.2,1) both; }
.tl-sticker circle { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.2; }
.tl-sticker svg[fill="currentColor"] { fill: currentColor; }
.tld-mark { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 3px 8px; border-radius: 14px; border: 0.5px dashed var(--border2); background: none; color: var(--text3-on-bg-surface); font-size: 0.6875rem; font-family: inherit; cursor: pointer; }
.tld-mark svg { width: 14px; height: 14px; }
.tld-mark.has { border-style: solid; border-color: var(--accent); background: var(--accent-bg); color: var(--accent); padding: 3px 6px; }
.tld-mark.open { border-color: var(--accent); color: var(--accent); }
.tld-picker { background: var(--bg-surface3); border-radius: var(--r-md); padding: 10px; margin-bottom: 12px; animation: rise .2s ease-out; }
.tld-picker-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.6875rem; color: var(--text3-on-bg-surface3); margin-bottom: 8px; }
.tld-picker-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; max-height: 150px; overflow-y: auto; }
.tld-picker-grid button { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: none; border-radius: 8px; background: none; color: var(--text2-on-bg-surface3); cursor: pointer; padding: 6px; }
.tld-picker-grid button svg { width: 100%; height: 100%; }
.tld-picker-grid button.active { background: var(--accent-bg); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* ── 藍圖：目標金額「無上限」切換 ── */
.nocap-chip {
  border: 0.5px solid var(--border2); background: none; color: var(--text2-on-bg-surface);
  border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.nocap-chip.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.form-input:disabled { opacity: .55; }

/* ── 行事曆：日期總覽 ── */
.day-head { display: flex; align-items: center; gap: 8px; }
.day-sub { font-size: 0.75rem; color: var(--accent); font-weight: 600; margin-top: 2px; min-height: 0; }
.day-sub:empty { display: none; }
.day-item { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.day-item .form-input { flex: 1; }
.day-item-del {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; border: none; cursor: pointer;
  background: var(--bg-surface2); color: var(--text2-on-bg-surface2); font-size: 1.125rem; line-height: 1;
}
.day-add-item {
  width: 100%; padding: 9px; border-radius: var(--r-sm); border: 1px dashed var(--border2); background: none;
  color: var(--accent); font-family: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.day-add-item:hover { background: var(--accent-bg); }
.day-exp-row { display: flex; align-items: center; padding: 7px 0; border-bottom: 0.5px solid var(--border); font-size: 0.8125rem; }
.day-exp-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-on-bg-surface); }
.day-exp-row + .day-add-item, .day-empty + .day-add-item { margin-top: 8px; }
.day-empty { font-size: 0.75rem; color: var(--text3-on-bg-surface); padding: 2px 0; }

/* ── 快速記帳：編輯模式 ── */
.qe-edit-tag { font-size: 0.6875rem; font-weight: 700; color: var(--accent); background: var(--accent-bg); padding: 2px 8px; border-radius: 8px; }
.day-exp-row { cursor: pointer; }
.day-exp-row:hover { background: var(--bg-surface2); }

/* ── 只改這個月 ── */
.fixed-sub { font-size: 0.75rem; color: var(--text3-on-bg-surface); margin-top: 2px; }
.fixed-banner { background: var(--bg-surface2); color: var(--text2-on-bg-surface2); border-radius: var(--r-sm); padding: 8px 12px; font-size: 0.8125rem; margin-bottom: 12px; }

/* ── 固定收支：卡片標題兩行（名稱／頻率・下次・排定變動） ── */
.card-header .item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-main .item-name { flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.item-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
.item-sub .badge { padding: 0 7px; font-size: 0.625rem; }
.card-header .item-amount { flex-shrink: 0; font-weight: 600; }

/* ── 金額紀錄（固定收支、存款藍圖共用） ── */
.hist-section-label span { margin-left: 8px; font-weight: 400; opacity: .8; }
.seg-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 9px 10px; margin-bottom: 4px; border: 0.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-surface); color: var(--text-on-bg-surface); font-family: inherit; font-size: 0.8125rem; cursor: pointer; text-align: left;
}
.seg-row:hover { border-color: var(--accent); }
.seg-row.is-current { border-color: var(--accent); }
.seg-range { display: inline-flex; align-items: center; gap: 6px; color: var(--text2-on-bg-surface); }
.seg-now, .seg-future { font-size: 0.625rem; font-weight: 700; padding: 0 6px; border-radius: 8px; }
.seg-now { background: var(--accent-bg); color: var(--accent); }
.seg-future { background: var(--label-future-bg); color: var(--title-on-label-future-bg); }
.seg-amt { font-weight: 600; }
.seg-note { font-size: 0.625rem; font-weight: 600; padding: 0 6px; border-radius: 8px; background: var(--bg-surface3); color: var(--text2-on-bg-surface3); } /* 重新起算、改入帳扣款日 */
.seg-stop { color: var(--red); font-weight: 600; }
.seg-row.is-past .seg-range { opacity: .75; }
.seg-older > summary { font-size: 0.6875rem; color: var(--text3-on-bg-surface2); cursor: pointer; margin: 8px 0 4px; }
.item-edit-note { font-size: 0.75rem; color: var(--text3-on-bg-surface); text-align: center; margin-bottom: 10px; }

/* ── 從藍圖領出 ── */
.wd-check { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-on-bg-surface); cursor: pointer; }
.wd-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.wd-check small { flex-basis: 100%; padding-left: 26px; font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
/* 藍圖卡片動作：四個按鈕排兩行 */
.bucket-actions { flex-wrap: wrap; }
.bucket-actions .action-btn { flex: 1 1 calc(50% - 4px); }

/* ── 設定：雲端同步狀態 ── */
.sync-status { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text-on-bg-base); }
.sync-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text3-on-bg-base); }
.sync-status.ok::before { background: var(--green-pos-mid); }
.sync-status.wait::before { background: var(--chart-exp); animation: sync-pulse 1.2s ease-in-out infinite; }
.sync-status.err::before { background: var(--red); }
/* 同步時間：淡底小區塊（不縮排），標籤靠左、時間靠右用等寬數字方便比對 */
.sync-times { margin: 8px 0 0; padding: 6px 10px; border-radius: 8px; background: var(--bg-surface); display: flex; flex-direction: column; gap: 3px; font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
.sync-times[hidden] { display: none; }
.sync-times div { display: flex; justify-content: space-between; gap: 8px; }
.sync-times div span:last-child { font-variant-numeric: tabular-nums; color: var(--text2-on-bg-surface); }
@keyframes sync-pulse { 50% { opacity: .3; } }

/* ── 設定：尚未開通時的開通代碼 ── */
.sync-access { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg-surface2); color: var(--text2-on-bg-surface2); font-size: 0.75rem; line-height: 1.7; }
.sync-uid { display: block; margin-top: 4px; padding: 6px 8px; border-radius: 6px; background: var(--bg-surface); color: var(--text-on-bg-surface); font-size: 0.75rem; word-break: break-all; -webkit-user-select: all; user-select: all; -webkit-touch-callout: default; }

/* ── App 鎖：鎖定畫面 ── */
.lock-screen { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--bg-base); align-items: center; justify-content: center; }
.lock-screen.show { display: flex; }
.lock-box { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 320px; padding: 24px; }
.lock-title { font-size: 1.25rem; font-weight: 700; color: var(--title-on-bg-base); }
.lock-sub { font-size: 0.8125rem; color: var(--text2-on-bg-base); }
.lock-dots { display: flex; gap: 14px; margin: 18px 0 4px; }
.lock-dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--text2-on-bg-base); }
.lock-dots i.on { background: var(--accent); border-color: var(--accent); }
.lock-msg { min-height: 1.4em; font-size: 0.8125rem; color: var(--red); }
.lock-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; margin-top: 6px; }
.lock-key { width: 72px; height: 72px; border-radius: 50%; border: none; background: var(--bg-surface); color: var(--title-on-bg-surface); font-size: 1.5rem; font-family: inherit; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.lock-key:active { background: var(--accent-bg); }
.lock-forgot { margin-top: 14px; font-size: 0.8125rem; }

/* ── 設定：安全 ── */
.sec-row { display: flex; align-items: center; gap: 12px; }
.sec-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.875rem; color: var(--title-on-bg-base); }
.sec-row-text small { font-size: 0.6875rem; color: var(--text3-on-bg-base); line-height: 1.5; }
.sec-btn { flex: none; padding: 8px 14px; font-size: 0.8125rem; }
.sec-sub-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 0.8125rem; color: var(--text2-on-bg-base); }
.sec-select { width: auto; padding: 6px 10px; font-size: 0.8125rem; }
.sec-pin { letter-spacing: .4em; font-size: 1.125rem; }
.sec-msg { min-height: 1.2em; margin-top: 6px; font-size: 0.75rem; color: var(--red); }

/* ── 外部日曆 ── */
.feed-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 0.5px solid var(--border); }
.feed-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.feed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: none; border: none; padding: 0; font-family: inherit; text-align: left; cursor: pointer; color: var(--title-on-bg-base); }
.feed-main b { font-size: 0.875rem; font-weight: 600; }
.feed-main small { font-size: 0.6875rem; color: var(--text3-on-bg-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.feed-switch { position: relative; width: 40px; height: 24px; flex-shrink: 0; cursor: pointer; }
.feed-switch input { opacity: 0; width: 0; height: 0; }
.feed-switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--border2); transition: background .15s; }
.feed-switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.feed-switch input:checked + span { background: var(--accent); }
.feed-switch input:checked + span::after { transform: translateX(16px); }
.feed-url { resize: vertical; font-size: 0.8125rem; word-break: break-all; }
.feed-help { font-size: 0.75rem; line-height: 1.8; color: var(--text2-on-bg-surface); padding: 8px 2px; }
.feed-warn { display: block; margin-top: 6px; color: var(--text3-on-bg-surface); }
/* 行事曆：外部行程用日曆顏色的小圓點 */
.cal-hol-label.is-ext::before, .cal-ev-ext::before, .day-ext-row::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ext); margin-right: 3px; vertical-align: 1px; flex-shrink: 0; }
.cal-ev-ext { display: inline-flex; align-items: center; margin-right: 8px; color: var(--text2-on-bg-base); }
.day-ext-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 0.5px solid var(--border); font-size: 0.8125rem; color: var(--text-on-bg-surface); }
.day-ext-row::before { width: 8px; height: 8px; margin: 0; }
.day-ext-time { width: 40px; flex-shrink: 0; font-size: 0.75rem; color: var(--text3-on-bg-surface); }
.day-ext-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-ext-feed { font-size: 0.6875rem; color: var(--text3-on-bg-surface); }

/* PIN 欄位：用文字欄位加遮罩（密碼管理工具不會想存）；畫面上看不到但輔助工具／密碼管理工具讀得到的欄位 */
.sec-pin { -webkit-text-security: disc; text-security: disc; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 外部日曆：從其他帳本加入 */
.feed-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 0.75rem; color: var(--text3-on-bg-base); }
.feed-copy > span { flex-basis: 100%; }
.feed-copy-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; border: 0.5px solid var(--border2); background: var(--bg-surface); color: var(--text-on-bg-surface); font-family: inherit; font-size: 0.75rem; cursor: pointer; }
.feed-copy-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ext); }
.feed-copy-chip small { color: var(--text3-on-bg-surface); }

/* 行程：每年重複 */
.day-item-yearly { flex-shrink: 0; height: 32px; padding: 0 10px; border-radius: 16px; border: 0.5px solid var(--border2); background: none; color: var(--text3-on-bg-surface); font-family: inherit; font-size: 0.75rem; cursor: pointer; white-space: nowrap; }
.day-item-yearly.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); font-weight: 700; }
.cal-hol-label.is-yearly::before { content: '↻'; margin-right: 2px; }
/* 外部日曆：移除 */
.feed-remove { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; border: none; background: none; color: var(--text3-on-bg-base); font-size: 1.125rem; cursor: pointer; }
.feed-remove:hover { background: var(--bg-surface2); color: var(--red); }

/* 手機金額欄位下方的運算鍵（js/ui.js _calcKeys） */
.calc-keys { display: flex; gap: 6px; margin: 6px 0 2px; }
.calc-keys[hidden] { display: none; }
.calc-keys button {
  flex: 1; min-width: 0; height: 34px; border-radius: var(--r-sm);
  border: 0.5px solid var(--border2); background: var(--bg-surface2); color: var(--title-on-bg-surface);
  font-size: 1.0625rem; font-weight: 600; font-family: inherit; cursor: pointer; touch-action: manipulation;
}
.calc-keys button:active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

/* 滑鼠：不用長按，但動畫跟手機統一——游標移到拉桿上圓鈕微微放大＋淡光暈，按下拖曳時彈起放大＋主色外圈。 */
@media (pointer: fine) {
  .seed-hue::-webkit-slider-thumb { transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; }
  .seed-hue::-moz-range-thumb { transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; }
  .seed-hue:hover::-webkit-slider-thumb, .seed-hue:focus-visible::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 5px var(--accent-bg), 0 1px 3px rgba(0,0,0,.25); }
  .seed-hue:hover::-moz-range-thumb, .seed-hue:focus-visible::-moz-range-thumb { transform: scale(1.15); box-shadow: 0 0 0 5px var(--accent-bg), 0 1px 3px rgba(0,0,0,.25); }
  .seed-hue:active::-webkit-slider-thumb { transform: scale(1.4); box-shadow: 0 0 0 3px var(--accent), 0 3px 10px rgba(0,0,0,.3); cursor: grabbing; }
  .seed-hue:active::-moz-range-thumb { transform: scale(1.4); box-shadow: 0 0 0 3px var(--accent), 0 3px 10px rgba(0,0,0,.3); cursor: grabbing; }
}

/* 觸控螢幕：色相拉桿要「長按圓鈕」才會開始移動（js/ui.js 處理觸控），上下捲動設定頁時滑過去不會動到。
 * 拉桿本身不接觸控；按住時圓鈕慢慢長出一圈光暈（蓄力），時間到就放大彈起來＝抓住了，可以左右拖。 */
@media (pointer: coarse) {
  .seed-hue-wrap { padding: 4px 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .seed-hue { pointer-events: none; height: 8px; margin: 14px 0; }
  .seed-hue::-webkit-slider-thumb { width: 28px; height: 28px; transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; }
  .seed-hue::-moz-range-thumb { width: 28px; height: 28px; transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s; }
  .seed-hue-wrap.pressing .seed-hue::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 7px var(--accent-bg), 0 1px 3px rgba(0,0,0,.25); transition: transform .35s linear, box-shadow .35s linear; }
  .seed-hue-wrap.pressing .seed-hue::-moz-range-thumb { transform: scale(1.12); box-shadow: 0 0 0 7px var(--accent-bg), 0 1px 3px rgba(0,0,0,.25); transition: transform .35s linear, box-shadow .35s linear; }
  .seed-hue-wrap.grabbing .seed-hue::-webkit-slider-thumb { transform: scale(1.35); box-shadow: 0 0 0 4px var(--accent), 0 4px 12px rgba(0,0,0,.3); }
  .seed-hue-wrap.grabbing .seed-hue::-moz-range-thumb { transform: scale(1.35); box-shadow: 0 0 0 4px var(--accent), 0 4px 12px rgba(0,0,0,.3); }
}

/* ── 藍圖規劃：三張大卡片（圓餅＋重點數字＋清單預覽＋快捷新增＋詳細設定） ── */
.plan-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 16px; }
.plan-card {
  display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 0.5px solid var(--border); border-radius: 18px;
  background: var(--bg-surface); color: var(--text-on-bg-surface); animation: rise .45s cubic-bezier(.2,.8,.2,1) both;
}
.plan-card:nth-child(2) { animation-delay: .05s; }
.plan-card:nth-child(3) { animation-delay: .1s; }
.plan-head { display: flex; align-items: center; gap: 10px; }
.plan-icon { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-bg); color: var(--accent); }
.plan-icon svg { width: 18px; height: 18px; }
.plan-title { font-size: 1rem; font-weight: 700; color: var(--title-on-bg-surface); }
.plan-content { display: flex; flex-direction: column; gap: 10px; flex: 1; }

/* 主圓餅＋右邊的數字與圖例 */
.plan-hero { display: flex; align-items: center; gap: 16px; }
.plan-ring { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.plan-ring svg { width: 100%; height: 100%; display: block; }
.pr-track { fill: none; stroke: var(--bg-surface3); stroke-width: 4; }
.pr-seg { fill: none; stroke-width: 4; transition: stroke-dasharray .5s; }
.plan-ring-c { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; font-weight: 800; color: var(--title-on-bg-surface); font-variant-numeric: tabular-nums; }
.plan-ring-c span { display: flex; align-items: baseline; gap: 1px; }
.plan-ring-c small { font-size: 0.6875rem; font-weight: 600; color: var(--text3-on-bg-surface); }
/* 小圓環線比較粗（6），外緣會超出 viewBox 0~36：不裁切，尺寸縮一點讓整體大小跟原本差不多 */
.plan-ring.sm { width: 28px; height: 28px; }
.plan-ring.sm svg { overflow: visible; }
.plan-ring.sm .pr-track, .plan-ring.sm .pr-seg { stroke-width: 6; }
.plan-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.plan-k { font-size: 0.75rem; font-weight: 600; color: var(--text2-on-bg-surface); }
.plan-big { font-size: 1.625rem; font-weight: 800; line-height: 1.15; color: var(--title-on-bg-surface); font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.plan-big.neg { color: var(--red-mid); }
.plan-lg { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text2-on-bg-surface); }
.plan-lg i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.plan-lg span { flex: 1; min-width: 0; }
.plan-lg b { font-weight: 600; color: var(--text-on-bg-surface); font-variant-numeric: tabular-nums; }

/* 清單：不畫分隔線，用間距與小圖示區分 */
.plan-list-title { font-size: 0.6875rem; font-weight: 600; color: var(--text3-on-bg-surface); }
.plan-list { display: flex; flex-direction: column; gap: 4px; }
.plan-item { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.plan-item.is-done { opacity: .55; } /* 這個月已入帳／已扣款的 */
.plan-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-item-text span { font-size: 0.8125rem; color: var(--text-on-bg-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-item-text small { font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
.plan-item-val { font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-on-bg-surface); white-space: nowrap; }
.plan-item-val small { font-weight: 400; color: var(--text3-on-bg-surface); }
.plan-item-val.pos { color: var(--green-pos); }
.plan-item-val.neg { color: var(--red); }
/* 固定收支的日期小方塊 */
.plan-date { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; background: var(--bg-surface3); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; color: var(--text2-on-bg-surface3); }
.plan-date b { font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.plan-date small { font-size: 0.5rem; margin-top: 1px; opacity: .8; }
.plan-date.inc { background: var(--accent-bg); color: var(--accent); }
.plan-row-icon { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-bg); color: var(--accent); }
.plan-row-icon svg { width: 15px; height: 15px; }
.plan-row-icon.t-card { background: var(--bg-surface2); color: var(--primary); } /* 信用卡：跟分類圖示同一組（次層填充＋主視覺色），跟其他帳戶的強調色區分 */
.plan-alert { font-size: 0.75rem; font-weight: 600; color: var(--red); background: var(--bg-surface3); border-radius: 8px; padding: 6px 10px; }
.plan-list-rest { display: none; flex-direction: column; gap: 4px; }
.plan-list.open .plan-list-rest { display: flex; }
.plan-more {
  align-self: flex-start; border: 0; background: none; padding: 2px 0; font-family: inherit;
  font-size: 0.75rem; font-weight: 600; color: var(--accent); cursor: pointer;
}
.plan-empty { font-size: 0.8125rem; line-height: 1.7; color: var(--text2-on-bg-surface); }
.plan-empty-sm { font-size: 0.75rem; color: var(--text3-on-bg-surface); padding: 4px 0; }
.plan-detail-btn {
  margin-left: auto; flex-shrink: 0; border: 0.5px solid var(--accent); background: var(--accent-bg); color: var(--accent); border-radius: 999px;
  padding: 8px 16px; font-size: 0.875rem; font-weight: 600; font-family: inherit; cursor: pointer;
}
.plan-detail-btn:hover { filter: brightness(0.96); }

/* 子頁面左上角的返回 */
.topbar.has-back .topbar-title { margin-right: auto; }
.topbar-back { background: none; border: none; cursor: pointer; padding: 0 8px 0 0; margin-left: -4px; font-size: 1.5rem; line-height: 1; color: var(--text2-on-bg-base); font-family: inherit; }
/* 「點進去看」之後的返回：‹ 原頁名稱 */
.peek-back { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; margin: 0 auto 0 10px; padding: 7px 11px 7px 8px; border: none; border-radius: 999px; background: var(--bg-surface2); color: var(--text2-on-bg-surface2); font-family: inherit; line-height: 1; cursor: pointer; }
.peek-back svg { display: block; flex-shrink: 0; }
.peek-back span { font-size: 0.75rem; font-weight: 600; line-height: 1; text-box: trim-both cap alphabetic; } /* 裁掉字形上下多餘的行高，跟左邊箭頭真正垂直置中 */
.peek-back:hover { color: var(--accent); }
/* 子頁面的標題分頁：存款藍圖｜固定收支｜財務流向 */
.plan-tabs { display: flex; gap: 2px; margin-right: auto; margin-left: 4px; transform: translateY(2px); /* 藥丸比標題文字高：往下 2px 讓視覺中心跟返回鈕、一般頁標題對齊 */ min-width: 0; padding: 3px; border-radius: 999px; background: var(--bg-surface2); overflow-x: auto; scrollbar-width: none; }
.plan-tabs::-webkit-scrollbar { display: none; }
.plan-tab {
  flex-shrink: 0; padding: 6px 12px; border: none; border-radius: 999px; background: none; cursor: pointer;
  font-family: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--text2-on-bg-surface2); white-space: nowrap; transition: background .15s, color .15s;
}
.plan-tab:hover { color: var(--title-on-bg-surface2, var(--text-on-bg-surface2)); }
.plan-tab.active { background: var(--bg-surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (max-width: 359px) { .plan-tab { padding: 6px 9px; font-size: 0.75rem; } }

/* ── 財務流向 ── */
.acct-empty { text-align: center; padding: 28px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-on-bg-base); }
.acct-empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-bg); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.acct-empty-icon svg { width: 28px; height: 28px; }
.acct-empty b { font-size: 1rem; color: var(--title-on-bg-base); }
.acct-empty p { font-size: 0.8125rem; line-height: 1.7; margin: 0; max-width: 420px; color: var(--text2-on-bg-base); }
.acct-safe { font-size: 0.6875rem; color: var(--text3-on-bg-surface); line-height: 1.6; }
.acct-empty .acct-safe { color: var(--text3-on-bg-base); }
.acct-hint { font-size: 0.6875rem; color: var(--text3-on-bg-surface); line-height: 1.6; margin-top: 6px; }
.is-label-sub { font-weight: 400; color: var(--text3-on-bg-surface); margin-left: 6px; font-size: 0.625rem; }
.acct-kv { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.75rem; color: var(--text2-on-bg-surface); }
.acct-kv div { display: flex; gap: 6px; align-items: baseline; }
.acct-kv b { color: var(--text-on-bg-surface); font-variant-numeric: tabular-nums; }
.acct-kv b.neg { color: var(--red); }
.acct-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.acct-actions .action-btn { flex: 1; padding: 10px 0; }
.acct-actions .action-btn[disabled] { opacity: .4; cursor: default; }
.acct-group-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; margin-top: 4px; }
.acct-group-sum { font-size: 0.75rem; color: var(--text3-on-bg-base); font-variant-numeric: tabular-nums; }
.acct-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.acct-row:hover { border-color: var(--accent); }
.acct-row.is-archived { opacity: .55; }
/* 藍圖規劃三個子頁：已停用（已停止、封存）的照常列出但變淡；上方可勾「隱藏已停用項目」 */
.card.is-inactive, .bucket-card.is-inactive { opacity: .55; transition: opacity .15s; }
.card.is-inactive:hover, .bucket-card.is-inactive:hover, .acct-row.is-archived:hover { opacity: .8; }
.inactive-bar:empty { display: none; }
.inactive-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.inactive-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text2-on-bg-base); cursor: pointer; user-select: none; }
.inactive-toggle input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; cursor: pointer; }
/* 固定收支：上方左邊排序鈕、右邊隱藏勾選 */
#items-inactive { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
#items-inactive .inactive-toggle { margin-left: auto; }

/* ── 清單分組與排序（ui.js listSortBarHtml）：固定收支、每月帳目；按目前那顆排序鈕再按一次換方向 ── */
/* 一排：分組（下拉）＋排序（鈕） */
.sort-bar { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.sort-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text3-on-bg-base); }
.sort-label + .sort-label { margin-left: 4px; }
.sort-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.sort-group-sel {
  font-family: inherit; font-size: 0.75rem; padding: 3px 6px 3px 10px; border-radius: 12px;
  border: 0.5px solid var(--border2); background: var(--bg-surface3); color: var(--text-on-bg-surface3); cursor: pointer;
}
.sort-group-sel:focus { outline: none; border-color: var(--accent); }
.sort-chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 10px; border-radius: 12px;
  border: 0.5px solid var(--border2); background: none; font-family: inherit; font-size: 0.75rem;
  color: var(--text2-on-bg-base); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.sort-chip.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.sort-dir { font-size: 0.6875rem; }
/* 每月帳目：hero 下面一排，收入、固定支出、消費都照它排（存入藍圖照拖曳順序） */
.ledger-sort-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 12px; }
.ledger-sort-bar:empty { display: none; }
.ledger-sort-note { font-size: 0.6875rem; color: var(--text3-on-bg-base); margin-left: auto; }

/* ── 可收合的分組（ui.js listGroupHtml）：依分類（消費還有日期）分組時，組標題點了收合／展開 ── */
.list-group.folded > .list-group-body { display: none; }
.is-fold { cursor: pointer; user-select: none; }
.lgh-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.lgh-label small { font-weight: 400; color: inherit; opacity: .75; }
.lgh-icon { display: inline-flex; width: 16px; height: 16px; color: var(--accent); }
.lgh-icon svg { width: 100%; height: 100%; }
.ledger-date-head.is-fold { align-items: center; padding-left: 8px; }
.ledger-date-head.is-fold .lgh-label small { margin-left: 0; }
.list-group-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 2px; margin: 0 0 6px; font-size: 0.8125rem; font-weight: 600; color: var(--text2-on-bg-base);
}
.list-group-head .number-mask { font-size: 0.75rem; font-weight: 500; color: var(--text3-on-bg-base); white-space: nowrap; }
.list-group + .list-group { margin-top: 4px; }
/* 藍圖的封存區：預設收起，旁邊 ? 說明停止存入／封存／刪除 */
.arch-section { margin-top: 10px; }
.arch-section[hidden] { display: none; }
.arch-head { display: flex; align-items: center; gap: 8px; }
.arch-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: none; background: none; font-family: inherit; font-size: 0.75rem; color: var(--text3-on-bg-base); cursor: pointer; }
.arch-head .info-tip-body { width: 280px; }
.acct-icon { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-bg); color: var(--accent); }
.acct-icon svg { width: 18px; height: 18px; }
.acct-icon.t-card { background: var(--bg-surface2); color: var(--primary); }
.acct-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.acct-main b { font-size: 0.875rem; color: var(--title-on-bg-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-main small { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
.acct-def { color: var(--accent); font-weight: 600; }
.acct-warn { color: var(--red); font-weight: 600; }
.acct-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.acct-bal { font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-on-bg-surface); }
.acct-bal.neg { color: var(--red); }
.acct-pay { white-space: nowrap; }
.acct-settings { background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 16px; padding: 4px 14px 12px; margin-bottom: 14px; }
.acct-set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.acct-set-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-set-row b { font-size: 0.8125rem; color: var(--text-on-bg-surface); font-weight: 600; }
.acct-set-row small { font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
.acct-settings .acct-safe { padding-top: 10px; }
.acct-def-sel { width: auto; max-width: 45%; padding: 6px 10px; font-size: 0.8125rem; }
.acct-copy { margin-top: 16px; }
.acct-copy .feed-copy-chip::before { display: none; }
.acct-form-more { display: flex; gap: 8px; }

/* 記一筆的帳戶選擇 */
.qe-acct { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.qe-acct::-webkit-scrollbar { display: none; }
.acct-chip { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; }
.acct-chip-icon { display: inline-flex; }
.acct-chip-icon svg { width: 14px; height: 14px; }
.acct-tag { font-size: 0.625rem; color: var(--text3-on-bg-surface); margin-left: 6px; font-weight: 400; }

/* 帳戶明細 */
.acct-d-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.acct-d-bal { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.acct-d-bal .is-big { margin-bottom: 4px; }
.acct-d-bal .is-big.is-debt { color: var(--title-on-bg-surface); }
.acct-main-col > .acct-settings { margin-top: 16px; }
.acct-d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.acct-d-actions .action-btn { flex: 1 1 auto; padding: 9px 12px; }
.acct-d-actions .action-btn[disabled] { opacity: .4; cursor: default; }
.acct-d-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.acct-d-month { flex: 1; text-align: center; font-weight: 600; font-size: 0.875rem; color: var(--title-on-bg-surface); }
.acct-d-sum { display: flex; justify-content: center; gap: 16px; font-size: 0.75rem; color: var(--text3-on-bg-surface); margin-bottom: 6px; }
.acct-flow-date { width: 40px; flex-shrink: 0; font-size: 0.6875rem; color: var(--text3-on-bg-surface); font-variant-numeric: tabular-nums; }

/* 轉帳：從／到 並排，中間對調 */
.xfer-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: end; margin-bottom: 12px; }
.xfer-swap { width: 36px; height: 38px; border-radius: var(--r-sm); border: 0.5px solid var(--border2); background: var(--bg-surface3); color: var(--accent); font-size: 1rem; cursor: pointer; font-family: inherit; }

/* 財務分析：各帳戶收支 */
.an-acct-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.an-acct-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; border: none; background: none; border-radius: var(--r-sm); text-align: left; font-family: inherit; color: var(--text-on-bg-surface); cursor: pointer; }
.an-acct-row:hover { background: var(--bg-surface2); }
.an-acct-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.an-acct-main b { font-size: 0.8125rem; }
.an-acct-main small { font-size: 0.6875rem; color: var(--text3-on-bg-surface); }
.an-acct-bars { display: flex; flex-direction: column; gap: 2px; }
.an-acct-bars i { display: block; height: 5px; border-radius: 3px; min-width: 2px; transform-origin: left; animation: grow-x .6s cubic-bezier(.2,.8,.2,1) both; }
.an-acct-bars i.in { background: var(--green-pos-mid); }
.an-acct-bars i.out { background: var(--chart-exp); }

/* 這些容器本身有設 display，hidden 屬性要另外蓋過去 */
.form-row[hidden], .form-row-2[hidden], #new-item-acct-wrap[hidden], #acct-card-fields[hidden] { display: none; }

/* 平板／電腦：藍圖規劃三張卡片並排；財務流向總覽在左、帳戶清單在右 */
@media (min-width: 760px) {
  .plan-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
  /* 每張卡片各佔一欄、空間夠：清單直接全部列出，不用「還有 N 筆」 */
  .plan-list-rest { display: flex; }
  .plan-more { display: none; }
  .acct-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .acct-side { position: sticky; top: 72px; }
  .acct-main-col > .acct-group-head:first-child { margin-top: 0; }
}
/* 分類管理：拖曳排序 */
.cat-mgr-hint { font-size: 0.6875rem; color: var(--text3-on-bg-surface); padding: 0 2px; }
.cat-mgr-row.dragging { position: relative; z-index: 2; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.cat-mgr-row .drag-handle { margin: -4px 4px -4px 0; }
.action-btn:disabled { opacity: .45; cursor: not-allowed; }
/* 登出與刪除：設定頁的各列（依影響由輕到重，重的用紅字），點了打開該情境的說明與確認 */
.acct-act-list { display: flex; flex-direction: column; }
.acct-act-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; background: none; border: none; border-top: 0.5px solid var(--border); text-align: left; cursor: pointer; font: inherit; color: var(--title-on-bg-base); }
.acct-act-row:first-child { border-top: none; padding-top: 2px; }
.acct-act-row .sec-row-text b { font-weight: 500; }
.acct-act-row.danger .sec-row-text b { color: var(--red); }
.acct-act-row > svg { flex-shrink: 0; color: var(--text3-on-bg-base); }
.del-acct-detail { margin-bottom: 14px; line-height: 1.7; }
.acct-act-warn { color: var(--red); }
.acct-act-block { margin: -4px 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: 0.8125rem; line-height: 1.7; }
.acct-act-block[hidden], #acct-act-confirm[hidden], #acct-act-go[hidden] { display: none; }
/* 用這台裝置的資料重設加密：確認勾選 */
.sec-ack { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 10px; font-size: 0.8125rem; color: var(--text-on-bg-surface); cursor: pointer; line-height: 1.5; }
.sec-ack input { width: 16px; height: 16px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--red-mid); }

/* 藍圖卡片上的收合清單（手動調整紀錄、實際存入明細，buckets.js _bucketFold）：箭頭在標題左邊，跟按鈕區拉開距離 */
.bucket-fold-wrap { margin: 14px 0 18px; }
.bucket-fold > summary { list-style: none; display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 4px 0;
  font-size: 0.75rem; font-weight: 600; color: var(--text2-on-bg-surface2); }
.bucket-fold > summary::-webkit-details-marker { display: none; }
.bucket-fold[open] > summary { margin-bottom: 6px; }
.rec-row { cursor: default; }
.rec-row:hover { border-color: var(--border); }
.rec-right { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.rec-note { font-size: 0.6875rem; color: var(--text3-on-bg-surface); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.rec-btn { font-family: inherit; font-size: 0.6875rem; font-weight: 600; color: var(--accent); background: var(--accent-bg); border: none; border-radius: 12px; padding: 4px 9px; cursor: pointer; white-space: nowrap; }
.rec-btn.rec-edit { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 24px; padding: 0; }
.rec-btn.rec-edit svg { width: 12px; height: 12px; }
/* 確認視窗的附加勾選項（例如刪除過去月份的存入時，要不要讓餘存藍圖重算） */
.confirm-opt[hidden] { display: none; }
.confirm-opt { font-size: 0.75rem; color: var(--text2-on-bg-surface); margin: 2px 0 14px; }
.confirm-opt input { accent-color: var(--accent); }
.confirm-list { margin-top: 8px; font-size: 0.75rem; font-weight: 400; line-height: 1.7; color: var(--text2-on-bg-surface); }
/* 摺疊清單沒有內容時的說明（不讓摺疊行消失，免得以為是壞掉） */
.fold-empty { font-size: 0.75rem; color: var(--text3-on-bg-surface2); padding: 4px 2px 6px; line-height: 1.6; }

/* 固定收支的節日週期（items.js _renderItemFests）：下面一行提示下一次是哪天 */
.fest-hint { margin-top: 6px; font-size: 0.6875rem; line-height: 1.5; color: var(--text3-on-bg-surface); }
