/* ============================================================================
   雙人記帳本 Couple Ledger — 輕量 CSS 變數雙面板樣式表 (Tech / Cozy)
   零外部字體與圖片依賴，行動優先 (375px~430px) 並兼顧桌面瀏覽
   ============================================================================ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-num: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.16);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --nav-height: 66px;
}

/* -------------------- 主題一：Tech 深色科技風 -------------------- */
body[data-theme="tech"] {
  --bg: #0b1120;
  --bg-elevated: #151f32;
  --bg-soft: #1b2840;
  --bg-input: #0e1729;
  --bg-header: rgba(11, 17, 32, 0.88);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --accent-text: #06131f;
  --accent-soft: rgba(56, 189, 248, 0.16);
  --border: rgba(56, 189, 248, 0.18);
  --border-strong: rgba(56, 189, 248, 0.36);
  --shadow: 0 8px 28px rgba(2, 6, 23, 0.55);
  --glow: 0 0 12px rgba(56, 189, 248, 0.35);
  --bar-glow-ok: 0 0 10px rgba(34, 197, 94, 0.45);
  --bar-glow-warn: 0 0 10px rgba(245, 158, 11, 0.45);
  --bar-glow-danger: 0 0 10px rgba(239, 68, 68, 0.5);
  --radius: 12px;
  --radius-btn: 10px;
  --num-font: var(--font-num);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cpath d='M36 0H0v36' fill='none' stroke='%2338bdf8' stroke-opacity='0.06' stroke-width='1'/%3E%3Ccircle cx='0' cy='0' r='1.2' fill='%2322d3ee' fill-opacity='0.12'/%3E%3C/svg%3E");
}

/* -------------------- 主題二：Cozy 文青可愛質感風 -------------------- */
body[data-theme="cozy"] {
  --bg: #faf7f2;
  --bg-elevated: #ffffff;
  --bg-soft: #f3ede4;
  --bg-input: #fbf9f5;
  --bg-header: rgba(250, 247, 242, 0.92);
  --text: #3d352e;
  --text-muted: #7b6f64;
  --text-subtle: #a3978b;
  --accent: #7c9a82;
  --accent-2: #c49a6c;
  --accent-text: #ffffff;
  --accent-soft: rgba(124, 154, 130, 0.16);
  --border: rgba(145, 125, 102, 0.18);
  --border-strong: rgba(124, 154, 130, 0.42);
  --shadow: 0 6px 22px rgba(96, 78, 56, 0.08);
  --glow: 0 4px 14px rgba(124, 154, 130, 0.28);
  --bar-glow-ok: none;
  --bar-glow-warn: none;
  --bar-glow-danger: none;
  --ok: #5e9b71;
  --ok-soft: rgba(94, 155, 113, 0.16);
  --warn: #d8963e;
  --warn-soft: rgba(216, 150, 62, 0.16);
  --danger: #d96b63;
  --danger-soft: rgba(217, 107, 99, 0.15);
  --radius: 18px;
  --radius-btn: 14px;
  --num-font: var(--font-sans);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%237c9a82' stroke-opacity='0.11' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M16 26c0-8 7-13 13-13 0 8-5 13-13 13z'/%3E%3Cpath d='M16 26l10-10'/%3E%3Cpath d='M48 52c-6-2-9-8-7-13 6 2 9 7 7 13z'/%3E%3C/g%3E%3C/svg%3E");
}

/* -------------------- 主題三：Princess 夢幻公主風 -------------------- */
body[data-theme="princess"] {
  --bg: #fff5f9;
  --bg-elevated: #ffffff;
  --bg-soft: #fdeef4;
  --bg-input: #fffafd;
  --bg-header: rgba(255, 245, 249, 0.92);
  --text: #4a2c3a;
  --text-muted: #936b7e;
  --text-subtle: #b895a5;
  --accent: #e56b9f;
  --accent-2: #d4a853;
  --accent-text: #ffffff;
  --accent-soft: rgba(229, 107, 159, 0.14);
  --border: rgba(229, 107, 159, 0.24);
  --border-strong: rgba(212, 168, 83, 0.55);
  --shadow: 0 8px 24px rgba(229, 107, 159, 0.12);
  --glow: 0 4px 14px rgba(229, 107, 159, 0.3);
  --bar-glow-ok: none;
  --bar-glow-warn: none;
  --bar-glow-danger: none;
  --ok: #5bb08a;
  --ok-soft: rgba(91, 176, 138, 0.16);
  --warn: #e09a42;
  --warn-soft: rgba(224, 154, 66, 0.16);
  --danger: #e05270;
  --danger-soft: rgba(224, 82, 112, 0.15);
  --radius: 20px;
  --radius-btn: 16px;
  --num-font: var(--font-sans);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M12 24l3-9 6 5 5-7 5 7 6-5 3 9z' fill='none' stroke='%23d4a853' stroke-opacity='0.14' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M54 44l2 5 5 2-5 2-2 5-2-5-5-2 5-2z' fill='%23e56b9f' fill-opacity='0.11'/%3E%3C/svg%3E"),
    radial-gradient(circle at 15% 10%, rgba(244, 169, 200, 0.22), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(236, 201, 130, 0.18), transparent 45%);
}

/* -------------------- 主題四：Cute 軟萌可愛風 -------------------- */
body[data-theme="cute"] {
  --bg: #fffaf0;
  --bg-elevated: #ffffff;
  --bg-soft: #fff0f5;
  --bg-input: #fffdf9;
  --bg-header: rgba(255, 250, 240, 0.94);
  --text: #4b3545;
  --text-muted: #8f6e84;
  --text-subtle: #b59ab0;
  --accent: #ff7aa2;
  --accent-2: #6ec6ff;
  --accent-text: #ffffff;
  --accent-soft: rgba(255, 122, 162, 0.16);
  --border: rgba(255, 122, 162, 0.30);
  --border-strong: rgba(255, 122, 162, 0.55);
  --shadow: 0 6px 0 rgba(255, 122, 162, 0.14), 0 8px 20px rgba(255, 122, 162, 0.10);
  --glow: 0 4px 14px rgba(255, 122, 162, 0.34);
  --bar-glow-ok: none;
  --bar-glow-warn: none;
  --bar-glow-danger: none;
  --ok: #4cc38a;
  --ok-soft: rgba(76, 195, 138, 0.16);
  --warn: #ffaa33;
  --warn-soft: rgba(255, 170, 51, 0.16);
  --danger: #ff5c77;
  --danger-soft: rgba(255, 92, 119, 0.16);
  --radius: 24px;
  --radius-btn: 18px;
  --num-font: var(--font-sans);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='68' height='68' viewBox='0 0 68 68'%3E%3Cpath d='M20 26c-3-4-9-3-9 2 0 4 9 10 9 10s9-6 9-10c0-5-6-6-9-2z' fill='%23ff7aa2' fill-opacity='0.12'/%3E%3Cpath d='M50 48l1.6 3.5 3.8.5-2.8 2.6.7 3.8-3.3-1.8-3.3 1.8.7-3.8-2.8-2.6 3.8-.5z' fill='%236ec6ff' fill-opacity='0.16'/%3E%3C/svg%3E");
}

/* -------------------- 主題五：Dog 柴柴狗狗風 -------------------- */
body[data-theme="dog"] {
  --bg: #f7f1e3;
  --bg-elevated: #fffdf7;
  --bg-soft: #efe6d5;
  --bg-input: #fcf9f2;
  --bg-header: rgba(247, 241, 227, 0.93);
  --text: #463325;
  --text-muted: #7f6652;
  --text-subtle: #a7917e;
  --accent: #d9823b;
  --accent-2: #6b9b6e;
  --accent-text: #ffffff;
  --accent-soft: rgba(217, 130, 59, 0.16);
  --border: rgba(150, 108, 68, 0.22);
  --border-strong: rgba(217, 130, 59, 0.48);
  --shadow: 0 6px 18px rgba(102, 72, 42, 0.10);
  --glow: 0 4px 14px rgba(217, 130, 59, 0.30);
  --bar-glow-ok: none;
  --bar-glow-warn: none;
  --bar-glow-danger: none;
  --ok: #5e9b68;
  --ok-soft: rgba(94, 155, 104, 0.16);
  --warn: #d99126;
  --warn-soft: rgba(217, 145, 38, 0.16);
  --danger: #d45b4e;
  --danger-soft: rgba(212, 91, 78, 0.16);
  --radius: 20px;
  --radius-btn: 14px;
  --num-font: var(--font-sans);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23b86b2d' stroke-opacity='0.12' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 24l4-10 6 6h10l6-6 4 10c2 6-3 12-15 12s-17-6-15-12z'/%3E%3Ccircle cx='26' cy='25' r='1' fill='%23b86b2d' fill-opacity='0.16'/%3E%3Ccircle cx='36' cy='25' r='1' fill='%23b86b2d' fill-opacity='0.16'/%3E%3Cellipse cx='31' cy='29' rx='2.2' ry='1.5' fill='%23b86b2d' fill-opacity='0.16'/%3E%3Cpath d='M58 58c-2-2-5 0-4 3-3 1-3 5 0 5h12c3 0 3-4 0-5 1-3-2-5-4-3z'/%3E%3C/g%3E%3Cg fill='%236b9b6e' fill-opacity='0.10'%3E%3Ccircle cx='66' cy='20' r='2'/%3E%3Ccircle cx='71' cy='17' r='2'/%3E%3Ccircle cx='76' cy='20' r='2'/%3E%3Cellipse cx='71' cy='25' rx='4.5' ry='3.5'/%3E%3C/g%3E%3C/svg%3E");
}

/* -------------------- 主題六：Cat 軟萌橘貓風 -------------------- */
body[data-theme="cat"] {
  --bg: #fff6eb;
  --bg-elevated: #ffffff;
  --bg-soft: #ffebd6;
  --bg-input: #fffaf3;
  --bg-header: rgba(255, 246, 235, 0.94);
  --text: #4a301d;
  --text-muted: #8c6548;
  --text-subtle: #b58d70;
  --accent: #f08c3a;
  --accent-2: #e6a94b;
  --accent-text: #ffffff;
  --accent-soft: rgba(240, 140, 58, 0.16);
  --border: rgba(240, 140, 58, 0.24);
  --border-strong: rgba(240, 140, 58, 0.50);
  --shadow: 0 7px 20px rgba(186, 102, 34, 0.10);
  --glow: 0 4px 14px rgba(240, 140, 58, 0.32);
  --bar-glow-ok: none;
  --bar-glow-warn: none;
  --bar-glow-danger: none;
  --ok: #59a675;
  --ok-soft: rgba(89, 166, 117, 0.16);
  --warn: #e0922b;
  --warn-soft: rgba(224, 146, 43, 0.16);
  --danger: #df5b4f;
  --danger-soft: rgba(223, 91, 79, 0.16);
  --radius: 22px;
  --radius-btn: 16px;
  --num-font: var(--font-sans);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cg fill='none' stroke='%23e67e22' stroke-opacity='0.14' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 24l3-10 7 6h10l7-6 3 10c2 7-4 13-15 13s-17-6-15-13z'/%3E%3Cpath d='M33 20v3M30 20.5v2.5M36 20.5v2.5'/%3E%3Cpath d='M16 28l-5-1M16 31l-5 1M50 28l5-1M50 31l5 1'/%3E%3Ccircle cx='28' cy='27' r='1' fill='%23e67e22' fill-opacity='0.18'/%3E%3Ccircle cx='38' cy='27' r='1' fill='%23e67e22' fill-opacity='0.18'/%3E%3Cpath d='M58 64c4-4 10-4 14 0-4 4-10 4-14 0zm14 0l5-4v8z'/%3E%3C/g%3E%3Cg fill='%23f08c3a' fill-opacity='0.11'%3E%3Ccircle cx='66' cy='22' r='2'/%3E%3Ccircle cx='71' cy='19' r='2'/%3E%3Ccircle cx='76' cy='22' r='2'/%3E%3Cellipse cx='71' cy='27' rx='4' ry='3'/%3E%3C/g%3E%3C/svg%3E");
}

/* -------------------- 主題七：Lavender 薰衣草夢境風 -------------------- */
body[data-theme="lavender"] {
  --bg: #f5f3ff;
  --bg-elevated: #ffffff;
  --bg-soft: #ede9fe;
  --bg-input: #faf8ff;
  --bg-header: rgba(245, 243, 255, 0.93);
  --text: #35284c;
  --text-muted: #726191;
  --text-subtle: #9e8fba;
  --accent: #8b5cf6;
  --accent-2: #d946ef;
  --accent-text: #ffffff;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --border: rgba(139, 92, 246, 0.20);
  --border-strong: rgba(139, 92, 246, 0.45);
  --shadow: 0 8px 24px rgba(109, 40, 217, 0.10);
  --glow: 0 4px 14px rgba(139, 92, 246, 0.32);
  --bar-glow-ok: none;
  --bar-glow-warn: none;
  --bar-glow-danger: none;
  --ok: #34b37e;
  --ok-soft: rgba(52, 179, 126, 0.16);
  --warn: #e59934;
  --warn-soft: rgba(229, 153, 52, 0.16);
  --danger: #e1517a;
  --danger-soft: rgba(225, 81, 122, 0.15);
  --radius: 20px;
  --radius-btn: 14px;
  --num-font: var(--font-sans);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='76' viewBox='0 0 76 76'%3E%3Cpath d='M26 16a10 10 0 1 0 11 13 8 8 0 1 1-11-13z' fill='%238b5cf6' fill-opacity='0.11'/%3E%3Cpath d='M56 48l1.5 3.5 3.5 1.5-3.5 1.5-1.5 3.5-1.5-3.5-3.5-1.5 3.5-1.5z' fill='%23d946ef' fill-opacity='0.12'/%3E%3C/svg%3E"),
    radial-gradient(circle at 80% 10%, rgba(192, 132, 252, 0.20), transparent 45%);
}

/* -------------------- 基礎 Reset -------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  transition: background-color 0.22s ease, color 0.22s ease;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.num,
.num-input {
  font-family: var(--num-font);
  font-variant-numeric: tabular-nums;
}

/* -------------------- 通用元件 -------------------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

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

.card-head-row h2,
.settings-card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 2px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.section-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hint-text {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.error-text {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--danger);
  text-align: center;
}

.center-text {
  text-align: center;
}

/* 表單控制項：16px 防止 iOS 自動放大 */
.form-group {
  margin-bottom: 12px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.label-with-action .field-label {
  margin-bottom: 0;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-lg {
  font-size: 20px;
  font-weight: 700;
  min-height: 50px;
}

.input-sm {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 14px;
}

.input-action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-action-row .input {
  flex: 1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
  font-size: 0.88rem;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--glow);
}

.btn-secondary {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 48px;
  font-size: 1rem;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.84rem;
}

.btn-link {
  background: none;
  border: none;
  padding: 4px 6px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-chip {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
}

.icon-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 標籤與膠囊 */
.pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.info-pill {
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.82rem;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}

/* 進度條 */
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.35s ease;
}

.progress-fill.status-ok {
  background: var(--ok);
  box-shadow: var(--bar-glow-ok);
}

.progress-fill.status-warn {
  background: var(--warn);
  box-shadow: var(--bar-glow-warn);
}

.progress-fill.status-danger {
  background: var(--danger);
  box-shadow: var(--bar-glow-danger);
}

/* 分段控制項 */
.segmented-control {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.seg-btn {
  min-height: 38px;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.seg-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--glow);
}

/* ==================== 登入頁面 ==================== */
.login-view {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}

.login-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand {
  text-align: center;
  margin-bottom: 4px;
}

.brand-emblem {
  position: relative;
  width: 68px;
  height: 44px;
  margin: 0 auto 10px;
}

.brand-emblem .ring {
  position: absolute;
  top: 2px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3.5px solid var(--accent);
}

.brand-emblem .ring-a {
  left: 4px;
}

.brand-emblem .ring-b {
  right: 4px;
  border-color: var(--accent-2);
}

.login-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.login-subtitle {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.api-setup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
}

.api-setup-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.user-pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.user-pick-btn:hover,
.user-pick-btn:active {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
}

.user-pick-name {
  font-size: 1rem;
  font-weight: 700;
}

.user-pick-theme {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.pin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.selected-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.selected-user-pill .user-avatar {
  width: 34px;
  height: 34px;
  font-size: 0.9rem;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 10px 0 14px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  transition: background-color 0.12s ease, transform 0.12s ease;
}

.pin-dots span.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.pin-hidden-input {
  width: 100%;
  text-align: center;
  letter-spacing: 0.35em;
  min-height: 40px;
  margin-bottom: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-size: 16px;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.key-btn {
  min-height: 48px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--num-font);
  cursor: pointer;
}

.key-btn:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.key-btn.key-fn {
  font-size: 0.88rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
}

.loading-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==================== 主程式外框與 Header ==================== */
.app-view {
  min-height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
}

.header-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.sync-pill.syncing {
  color: var(--accent);
  border-color: var(--accent);
}

.sync-pill.error {
  color: var(--danger);
  border-color: var(--danger);
}

.app-main {
  flex: 1;
  padding: 14px 14px calc(var(--nav-height) + 28px + var(--safe-bottom));
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ==================== 頁籤一：預算總表 ==================== */
.inbox-alert-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.inbox-alert-banner .alert-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--danger);
}

.inbox-alert-banner #overview-inbox-banner-text {
  flex: 1;
}

.inbox-alert-banner .alert-arrow {
  font-size: 1.2rem;
  line-height: 1;
}

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

.month-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.month-center {
  flex: 1;
}

.month-picker {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--num-font);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-box {
  background: var(--bg-soft);
  border-radius: calc(var(--radius) - 4px);
  padding: 10px 12px;
}

.metric-box-progress {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.metric-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.metric-rate {
  font-size: 0.96rem;
  font-weight: 800;
}

.metric-rate.ok { color: var(--ok); }
.metric-rate.warn { color: var(--warn); }
.metric-rate.danger { color: var(--danger); }

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.metric-value {
  margin-top: 2px;
  font-size: 1.15rem;
  font-weight: 800;
}

.metric-value.ok { color: var(--ok); }
.metric-value.warn { color: var(--warn); }
.metric-value.danger { color: var(--danger); }

/* 預算進度 Accordion */
.budget-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.budget-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.budget-trigger {
  width: 100%;
  background: none;
  border: none;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.budget-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.budget-cat-name {
  font-size: 0.98rem;
  font-weight: 700;
}

.budget-rate-badge {
  font-size: 0.86rem;
  font-weight: 800;
}

.budget-figures-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 0.8rem;
}

.budget-fig-cell span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.budget-fig-cell strong {
  font-size: 0.88rem;
}

.budget-penalty-note {
  font-size: 0.76rem;
  color: var(--danger);
  font-weight: 600;
}

.budget-sub-panel {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 10px 14px;
  display: none;
}

.budget-item.open .budget-sub-panel {
  display: block;
}

.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 0.84rem;
  border-bottom: 1px dashed var(--border);
}

.sub-row:last-child {
  border-bottom: none;
}

/* 專款儲蓄桶 */
.buckets-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.bucket-card {
  flex: 0 0 190px;
  scroll-snap-align: start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bucket-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bucket-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.bucket-name {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bucket-balance {
  font-size: 1.15rem;
  font-weight: 800;
}

.bucket-balance.negative {
  color: var(--danger);
}

.bucket-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.rollover-cta-card {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rollover-cta-info h3 {
  margin: 0 0 4px;
  font-size: 0.96rem;
}

.rollover-cta-info p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==================== 頁籤二：快速記帳 ==================== */
.shared-split-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 12px;
  margin-bottom: 12px;
}

.payer-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.payer-btn {
  min-height: 44px;
  border-radius: var(--radius-btn);
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}

.payer-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: var(--glow);
}

/* ==================== 頁籤三：共同收件匣 & 雙人結算 ==================== */
.settlement-card {
  margin-bottom: 10px;
}

.settlement-conclusion {
  padding: 12px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
}

.settlement-conclusion.settled {
  background: var(--ok-soft);
  border-color: var(--ok);
}

.settled-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.settled-toggle-row.is-settled {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.settled-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settled-toggle-left input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ok);
  cursor: pointer;
}

.settlement-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inbox-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.inbox-card-title {
  font-size: 1rem;
  font-weight: 700;
}

.inbox-card-amount {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.inbox-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.inbox-mode-switch {
  display: flex;
  gap: 8px;
}

.inbox-mode-btn {
  flex: 1;
  min-height: 34px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.inbox-mode-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ==================== 頁籤四：明細 & 固定支出 ==================== */
.filter-bar {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tx-color-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: calc(var(--radius) - 4px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.tx-date-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2px 4px 5px;
}

.tx-date-group-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--num-font);
}

.tx-date-group-sum {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-subtle);
}

.tx-group-card {
  padding: 2px 12px;
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.tx-row:last-child {
  border-bottom: none;
}

.tx-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.tx-cat-chip {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-muted);
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-mini-tag {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  line-height: 1.3;
}

.tx-mini-tag.tag-shared {
  background: var(--accent-soft);
  color: var(--accent);
}

.tx-mini-tag.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.tx-mini-tag.tag-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.tx-row-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tx-row-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tx-row-amount {
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.tx-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.tx-icon-del {
  color: var(--danger);
}

.tx-note {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tx-actions {
  display: flex;
  gap: 6px;
}

.fixed-action-card {
  margin-bottom: 12px;
}

.fixed-sub-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.fixed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fixed-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.fixed-card.disabled {
  opacity: 0.6;
}

.fixed-info {
  min-width: 0;
  flex: 1;
}

.fixed-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.fixed-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* ==================== 頁籤五：設定與自訂規則 ==================== */
.settings-card {
  margin-bottom: 14px;
}

.settings-card h2 {
  margin-bottom: 12px;
}

.theme-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-btn);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
}

.swatch-tech {
  background: linear-gradient(135deg, #0b1120 50%, #38bdf8 50%);
}

.swatch-cozy {
  background: linear-gradient(135deg, #faf7f2 50%, #7c9a82 50%);
}

.swatch-princess {
  background: linear-gradient(135deg, #fff5f9 45%, #e56b9f 45%, #d4a853 100%);
}

.swatch-cute {
  background: linear-gradient(135deg, #fffaf0 45%, #ff7aa2 45%, #6ec6ff 100%);
}

.swatch-dog {
  background: linear-gradient(135deg, #f7f1e3 45%, #d9823b 45%, #6b9b6e 100%);
}

.swatch-cat {
  background: linear-gradient(135deg, #fff6eb 45%, #f08c3a 45%, #e6a94b 100%);
}

.swatch-lavender {
  background: linear-gradient(135deg, #f5f3ff 45%, #8b5cf6 45%, #d946ef 100%);
}

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

.payment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  font-weight: 600;
}

.payment-chip-del {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.settings-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.settings-btn-row .btn {
  flex: 1;
}

.api-override-details {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 0.84rem;
}

.api-override-details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
}

.api-override-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-editor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.budget-edit-row {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 12px;
}

.budget-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.bucket-manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bucket-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
}

/* ==================== 底部導覽列 ==================== */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 640px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 30;
}

.nav-item {
  position: relative;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.nav-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-fab-wrap {
  overflow: visible;
}

.nav-fab {
  width: 48px;
  height: 48px;
  margin-top: -22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  border: 3px solid var(--bg);
}

.nav-fab-label {
  font-size: 0.72rem;
}

/* ==================== Modal 彈窗 & Toast ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  animation: slideUp 0.18s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.rollover-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.86rem;
}

.rollover-preview-row:last-child {
  border-bottom: none;
}

.import-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  margin-bottom: 8px;
}

.empty-state {
  text-align: center;
  padding: 28px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.toast-container {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: calc(100% - 28px);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  animation: fadeDown 0.18s ease-out;
}

.toast.toast-ok { border-color: var(--ok); }
.toast.toast-error { border-color: var(--danger); color: var(--danger); }

@keyframes fadeDown {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==================== 平板與電腦版響應式微調 ==================== */
@media (min-width: 768px) {
  .buckets-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow-x: visible;
  }

  .bucket-card {
    flex: initial;
  }

  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal-sheet {
    border-radius: var(--radius);
  }
}
