/* ============================================================
   設計系統｜繳費提醒 App
   風格：參考現代金融 App 的視覺語言——飽和靛藍主色、大圓角卡片、柔和陰影。
   固定用淺色主題，不跟著手機的深色模式切換（之前跟著系統切換會變成
   使用者手機是深色模式時看到跟參考圖不一樣的深藍紫色背景，改成固定亮色好掌控）。
   數字（金額）沿用系統字體（San Francisco / PingFang），
   靠 font-variant-numeric: tabular-nums 對齊，不額外載入網路字體。
   ============================================================ */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
  --font-number: var(--font-sans);
  --swipe-delete-w: 64px; /* 左滑刪除鈕寬度：照 Figma swipe-delete 元件 64；首頁與設定頁共用這一個數字 */

  /* 8px 間距節奏 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  /* 彈窗動效 token（2026-11-19 Amber 要求統一彈窗速度感；數字照她給的兩支範例影片逐格量到的，跟新增帳單 Sheet 一致）：
     進場很陡的先快後慢（expo ease-out）、離場加速離開（ease-in）；想整體調快慢只要改這幾個數字 */
  --motion-in: 220ms;      /* 底部彈窗進場（遮罩淡入）；彈窗本體進場見 --motion-sheet-in */
  --motion-out: 160ms;     /* 置中彈窗等離場 */
  --motion-sheet-in: 420ms;   /* 底部彈窗本體進場：滑上來＋衝過頭 10px＋落回（2026-11-23，同 sheetMotion.js SHEET_IN_MS） */
  --motion-sheet-out: 300ms;  /* 底部彈窗離場（同 SHEET_OUT_MS），遮罩淡出用 */
  --motion-dialog-in: 180ms;   /* 置中確認彈窗進場 */
  --motion-dialog-out: 120ms;  /* 置中確認彈窗離場 */
  --motion-toast-in: 180ms;
  --motion-toast-out: 140ms;
  --motion-fade: 150ms;    /* 下拉選單、日期面板 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* 字級系統：2026-10-22 同步 Figma Design > Style 的字體規格表。
     第一版同步時用的是說明表格 Frame 上的舊文字（後來發現那份文件本身跟
     Design > Style 實際存的樣式定義對不起來），這版改成直接讀實際樣式數值校正過。
     weight 統一只用 Regular/Medium/Semi Bold 三階（原本畫面上的 700 都歸進 Semi Bold）；
     letter-spacing 大部分樣式其實不是 0，B/C 系列字體實際存的是 1.5%／2% 的字距，
     換算成 CSS 的 em（1.5% ≒ 0.015em）；H5／S1 系列實際存的才是真的 0。
     --text-c3 維持 11px 沒有照 Figma 四捨五入，因為 Figma 字級表最小只到 10px（C3），
     11px 是裝飾用的小標籤字，介於 C3(10)和 C1(12)之間，保留現值不強行套用數字，
     line-height 則比照 C3 實際的 1.5 倍行高比例換算 */
  --text-c3: 11px;   /* 比照 Figma C3，用在最小的介面裝飾字：狀態小標籤、星期縮寫、底部導覽文字 */
  --line-c3: 17px;
  --text-c1: 12px;   /* 對應 Figma C1 12/18/1.5%：次要說明文字、表單 label、設定分組標題 */
  --line-c1: 18px;
  --spacing-c1: 0.015em;
  --text-b3: 14px;   /* 對應 Figma B3 14/21/1.5%：次要內文、空清單提示、toast、彈窗說明文字 */
  --line-b3: 21px;
  --spacing-b3: 0.015em;
  --text-b1: 16px;   /* 對應 Figma B1 16/24/1.5%：輸入框、按鈕、body 預設閱讀字級 */
  --line-b1: 24px;
  --spacing-b1: 0.015em;
  --text-s1: 18px;   /* 對應 Figma S1 18/25/0：彈窗標題、金額旁的幣別符號 */
  --line-s1: 25px;
  --text-h5: 24px;   /* 對應 Figma H5 24/30/0：頁面主標題、帳單卡片到期日數字、年度總覽總金額，全站最大字級 */
  --line-h5: 30px;
  --text-h2: 40px;   /* 對應 Figma H2 40/50/0：帳單表單裡的金額大數字，2026-10-30 照 Figma 精確值補上，原本誤用 h5(24px) */
  --line-h2: 50px;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  --text-s2: 16px;   /* 對應 Figma S2 16/22/1.5%：目前只有「載入中」文字用到，跟 B1 同樣 16px 但行高字重不同 */
  --line-s2: 22px;
  --spacing-s2: 0.015em;
  --text-h3: 32px;   /* 對應 Figma H3 32/40/0：登入頁「Welcome, Dodo」問候語 */
  --line-h3: 40px;
  --text-b2: 16px;   /* 對應 Figma B2 16/26/2%：登入／Face ID 頁的副標說明文字 */
  --line-b2: 26px;
  --spacing-b2: 0.02em;

  /* z-index 層級規則：數字越大蓋越上面，新增疊層元件時比照這個等級去選，
     避免像之前下拉選單被別的東西蓋住那樣各自亂喊數字 */
  --z-content: 1;    /* 卡片/列表項目內部，跟自己的滑動刪除鈕比疊層 */
  --z-page-loading: 4; /* 單頁內容載入中的蓋版（.loading-screen），要蓋過頁面內容，
                           但故意比底部導覽列（--z-nav）低一階，讓導覽列（含中間凸起
                           的「＋」按鈕）一定蓋在它上面，不會被蓋版切到；真正要連
                           導覽列也一起擋住操作的情境才用 --z-blocking */
  --z-nav: 5;         /* 底部導覽列 */
  --z-dropdown: 50;   /* 自訂下拉選單的選項面板 */
  --z-toast: 200;     /* 底部提示訊息 */
  --z-modal: 300;     /* 一般彈窗（確認視窗、alert） */
  --z-blocking: 400;  /* 全螢幕阻擋操作的遮罩，永遠蓋最上面 */

  /* 淺色模式（預設）：背景用純白，卡片靠陰影浮起來，不是靠底色深淺區分 */
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-muted: #F3F3FA;
  --color-text: #14152B;
  --color-text-muted: #6B6B85;
  --color-border: #E5E5F2;

  --color-primary: #4F46E5;
  --color-primary-contrast: #FFFFFF;
  --color-accent: #059669;
  --color-accent-contrast: #FFFFFF;

  --color-status-overdue: #DC2626;
  --color-status-dueSoon: #B45309;
  --color-status-normal: #4F46E5;
  --color-status-paid: #059669;

  --shadow-card: 0 2px 6px rgba(20, 21, 60, 0.05), 0 8px 20px rgba(20, 21, 60, 0.06);
  --shadow-float: 0 10px 24px rgba(79, 70, 229, 0.28);

  /* 總覽頁頂部卡片用的漸層底色，跟主色 --color-primary 同色系、往深紫收斂 */
  --gradient-hero: linear-gradient(135deg, #4F46E5 0%, #2E1F8F 100%);

  /* 2026-10-22 全面改版：啟動頁／載入中／登入頁／Face ID 頁這四個畫面現在共用
     同一套深藍漸層背景（取代原本四個各自不同色的淺色漸層），全部都要白字 */
  --gradient-dark: linear-gradient(180deg, #11232F 0%, #214C5E 100%);

  /* 「載入中」進度條跟啟動頁動畫共用的深色系配色，取自 Figma 新版設計 */
  --color-progress-track: #00313E;
  --color-progress-fill: #00AFD5;
  --color-loading-text: #D2D5DB;

  /* 登入／Face ID 頁主要 CTA 按鈕的黃綠色，只有這顆按鈕用，跟全站主色 --color-primary 無關 */
  --color-cta-bg: #EDF039;
  --color-cta-text: #30300C;

  /* 2026-10-26 首頁改版、2026-10-28 校正成 Figma 精確數值：深色介面有兩層不同深淺的底色，
     --color-grey-800 比較淺，用在導覽列／篩選 tab 容器／統計小方塊；--color-surface-black
     比較深，用在「今日待繳金額」卡片跟帳單列表的外層容器。底部導覽列全站共用，所以這裡
     改了會連月曆／總覽／設定頁的導覽列一起變深色（其他頁面內容本身還沒改版，過渡期會有
     導覽列深、頁面淺的不一致，之後陸續把其他頁面也換成深色就會統一）。 */
  --color-grey-800: #212936;
  --color-surface-black: #131927;
  --color-text-grey: #9EA2AE;
  --color-text-warning: #FFAA00;  /* Figma Text Color/text-warning、Icon Color/icon-warning */
  --color-nav-active: #00AFD5;
  --color-nav-inactive: var(--color-text-grey);

  /* 帳單狀態小標籤（已繳費／已逾期 X 天／X 天後到期）用不透明的粉彩色塊，
     跟其他狀態色（--color-status-*）那種半透明疊加的做法不一樣——
     疊在深色卡片上半透明會變得太暗看不清楚，所以另外開一組純色 token */
  --chip-paid-bg: #C5E9CD;
  --chip-paid-text: #308242;
  --chip-overdue-bg: #FAC5C3;
  --chip-overdue-text: #A9302D;
  --chip-duesoon-bg: #FFE5B0;
  --chip-duesoon-text: #B57900;
  --chip-normal-bg: #E1F7FE;    /* 大於 3 天（Figma bill state「大於3天」：Primary-100／Primary-700） */
  --chip-normal-text: #07728C;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 2026-10-29：<html>／<body> 的底色直接預設深色，不要再靠 JS 加 class 才變深色。
   原本是等 initAuth() 執行到才用 JS 加上 .auth-flow-dark，這中間有個時間差——
   HTML 剛解析完、CSS 套用的第一瞬間，底色還是舊的淺色，要等 JS 跑完才變深色。
   這個時間差在 iOS 加入主畫面的獨立模式下，特別容易卡在螢幕最下緣的安全區域
   （Home 指示條那一截），變成那截怎麼樣都還是卡著最初那個淺色、不會跟著變深色。
   現在整個 App 一開啟最先看到的永遠是深色（啟動頁），所以直接把深色當預設值，
   不用等 JS 才套用，從第一格畫面開始就是深色，沒有時間差可以卡住。
   淺色主題的頁面（月曆/總覽/設定）則改成自己明確畫一層淺色背景蓋上去
   （見下面 .page 那條規則新增的 background），不再依賴 body 預設是淺色這件事 */
/* 2026-10-30：拿掉 10/28 加的 html／body height:100%（commit ddcf91a 當時就註明是
   沒辦法驗證的猜測）。它跟 body 的 min-height:100vh、登入頁自己的 min-height:100vh
   三個高度疊在一起，iOS 26 算出來差幾個像素，頁面就會比螢幕多一點點、可以上下拉，
   Face ID 畫面就在邊界來回彈（抖動）。
   同時補上純色 background-color：iOS 26 的獨立模式 App 最底下那截（Home 指示條）
   只認純色，看不懂漸層，抓不到就退回白色。#214C5E 是 --gradient-dark 最底下那個顏色，
   漸層照常蓋在上面，純色只是給 iOS 抓的備用色 */
html {
  -webkit-text-size-adjust: 100%;
  background-color: #214C5E;
  background-image: var(--gradient-dark);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: #214C5E;
  background-image: var(--gradient-dark);
  color: var(--color-text);
  font-size: var(--text-b1);
  line-height: var(--line-b1);
  letter-spacing: var(--spacing-b1);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  transition: background var(--duration-normal) var(--ease-standard);
}
/* 啟動頁／登入流程期間（見 auth.js initAuth）暫時把 <body> 底色也換成深色，
   這樣啟動頁淡出、登入頁淡入這些 opacity 動畫露出背後顏色時不會閃白，
   登入完成後會自動移除這個 class，不影響還是淺色主題的其他頁面。
   .page-dark 是同一招用在首頁（見 app.js router()）：body 本身留了 padding-bottom
   給底部導覽列用，內容不夠長時往下捲會多捲出這一截，露出 body 預設的白色，
   要讓 body 的底色也跟著首頁換成深色才不會穿幫。
   2026-10-29 再補一次：同樣的 class 要連 <html> 也一起設定，不能只設定 <body>——
   iOS Safari 手指往下滑超過內容底部時會有「橡皮筋彈跳」效果，多彈出來的那一截
   露出的是 <html> 的底色，不是 <body> 的，只改 body 在電腦瀏覽器上測不出問題
   （沒有這種彈跳效果），只有真的在 iPhone 上滑到底才會看到還是白的 */
html.auth-flow-dark,
html.page-dark,
body.auth-flow-dark,
body.page-dark { background-color: #214C5E; background-image: var(--gradient-dark); }

/* 登入流程（啟動頁／登入／Face ID）期間整個畫面鎖死：body 直接釘滿螢幕、不能捲動，
   登入頁高度改成「剛好貼滿」而不是「至少一個螢幕高」，才不會多出幾個像素可以上下拉 */
html.auth-flow-dark { overflow: hidden; overscroll-behavior: none; }
body.auth-flow-dark {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body.auth-flow-dark #app-root { height: 100%; }
body.auth-flow-dark .pin-lock { min-height: 0; height: 100%; box-sizing: border-box; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.page {
  padding: var(--space-5);
  padding-top: calc(var(--space-6) + env(safe-area-inset-top));
  max-width: 480px;
  margin: 0 auto;
  /* <body>/<html> 現在預設是深色（見上面說明），淺色頁面（月曆/總覽/設定）
     要自己明確畫一層淺底蓋上去，不能再靠「body 本來就是白的」這件事。
     min-height:100vh 是避免內容太短時，底下沒蓋到的地方露出 body 的深色 */
  background: var(--color-bg);
  min-height: 100vh;
}

h1 {
  font-size: var(--text-h5);
  line-height: var(--line-h5);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  margin: 0 0 var(--space-4);
}
h2 {
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--spacing-b3);
  margin: var(--space-5) 0 var(--space-2);
}

/* ============ 帳單卡片（可往左滑露出刪除鈕） ============ */
.bill-list { display: flex; flex-direction: column; gap: var(--space-2); }

.bill-card-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  /* iOS Safari 的已知算圖 bug：overflow:hidden 配圓角時，裡面滑動刪除鈕的紅色背景
     偶爾會在圓角邊緣漏出一絲線條，強制丟給獨立合成層可以讓裁切正確套用（跟底部
     導覽列 .bottom-nav 用的是同一招） */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
.bill-card-delete {
  position: absolute;
  /* 四邊都內縮 2px，不讓這個色塊碰到外層 wrapper 圓角的弧線範圍——實測發現不管刪除鈕
     自己的角有沒有配合設圓角，圓角弧線那段的反鋸齒還是會跟 overflow:hidden 的裁切
     對不齊、漏出一絲紅色縫隙，唯一乾淨的解法是讓色塊本身完全不接觸到那段弧線 */
  top: 2px; right: 2px; bottom: 2px;
  width: 76px;
  border: none;
  border-radius: 0;
  background: var(--color-status-overdue);
  color: #fff;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-semibold);
  min-height: 0;
}
.bill-card {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  /* 圓角故意不設在這裡：外層 .bill-card-wrapper 的 overflow:hidden 已經會把這張卡片
     裁成圓角，兩邊各自畫一次圓角、兩條圓弧邊緣反鋸齒對不齊，就是角落那絲紅色縫隙的真正成因 */
  background: var(--color-surface-muted);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  touch-action: pan-y;
}

/* 已繳的卡片故意不用 opacity 做淡化——這張卡片背後疊著一個平常被完全擋住的
   紅色刪除鈕（左滑才會露出來），opacity 會讓整張卡片（含背景）一起變透明，
   結果紅色刪除鈕會透出來。改成分別把文字換成淡色，卡片本身維持不透明
   （背景現在已跟未繳費卡片統一用同一個灰底，這裡只需要再淡化文字顏色） */
.bill-card.status-paid .bill-card-name,
.bill-card.status-paid .bill-card-day,
.bill-card.status-paid .bill-card-amount { color: var(--color-text-muted); }

/* 左側：到期日方塊（大字日期數字 + 小字星期），顏色隨緊急程度變化 */
.bill-card-date { flex-shrink: 0; width: 40px; text-align: center; }
.bill-card-day { display: block; font-size: var(--text-h5); font-weight: var(--weight-semibold); line-height: var(--line-h5); font-family: var(--font-number); }
.bill-card-weekday { display: block; font-size: var(--text-c3); line-height: var(--line-c3); font-weight: var(--weight-semibold); text-transform: uppercase; color: var(--color-text-muted); margin-top: 2px; }
.status-overdue .bill-card-day, .status-dueToday .bill-card-day { color: var(--color-status-overdue); }
.status-dueSoon .bill-card-day { color: var(--color-status-dueSoon); }
.status-normal .bill-card-day { color: var(--color-status-normal); }

/* 中間：標題 + 繳費狀態小標籤 */
.bill-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.bill-card-name { font-weight: var(--weight-semibold); font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-card-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: var(--text-c3);
  line-height: var(--line-c3);
  font-weight: var(--weight-semibold);
  padding: 2px var(--space-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text-muted) 15%, transparent);
  color: var(--color-text-muted);
}
/* 圓點改用 CSS 畫出來的小圓形，不再是「●」文字符號——文字符號的視覺大小
   綁死在字級上，字體渲染出來偏笨重，用色塊圓形才能自己控制精準的大小 */
.bill-card-status-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-overdue .bill-card-status-pill, .status-dueToday .bill-card-status-pill {
  background: color-mix(in srgb, var(--color-status-overdue) 15%, transparent);
  color: var(--color-status-overdue);
}
.status-dueSoon .bill-card-status-pill {
  background: color-mix(in srgb, var(--color-status-dueSoon) 15%, transparent);
  color: var(--color-status-dueSoon);
}
.status-normal .bill-card-status-pill {
  background: color-mix(in srgb, var(--color-status-normal) 15%, transparent);
  color: var(--color-status-normal);
}
.status-paid .bill-card-status-pill {
  background: color-mix(in srgb, var(--color-status-paid) 15%, transparent);
  color: var(--color-status-paid);
}

/* 右側：金額 */
.bill-card-amount { flex-shrink: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-semibold); font-family: var(--font-number); }

.empty-hint { color: var(--color-text-muted); text-align: center; padding: var(--space-6) 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); }

/* ============ 深色頁面（目前只有首頁，2026-10-26 改版） ============ */
/* 2026-10-29 改成正確的架構：Amber 最早就說過「只希望帳單清單那個區塊會捲動，
   其他區塊不動」，之前一直做成整頁一起捲動（日期／金額卡片／tab 全部跟著捲），
   這也是為什麼 body 捲動相關的色塊問題一直修不乾淨——根本問題是「不該讓整頁捲動」。
   現在把 .page--dark 固定成剛好一個螢幕高、自己不捲動（overflow:hidden），裡面用
   flex 直向排列，日期/金額卡片/tab 這些照內容自然高度排好不動，「帳單」清單自己
   在剩下的空間內捲動（見 .bill-list--dark 的 flex/overflow 設定） */
.page--dark {
  background: var(--gradient-dark);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 原本吃 .page 的 padding-bottom（space-5），這裡額外加上導覽列的高度，
     不然「帳單」清單捲到底時，最後一筆會被固定在螢幕下方的導覽列擋住 */
  padding-bottom: calc(var(--space-5) + 72px + env(safe-area-inset-bottom));
  color: #FFFFFF;
}
/* 這頁改成自己不捲動，body 原本留給導覽列用的那截 padding-bottom 用不到
   （上面 .page--dark 自己留了），兩邊都留會變成 body 又多出一截可以捲動的空間，
   捲到底又會看到 body 底色——這就是之前色塊問題怎麼修都修不乾淨的真正原因。
   2026-10-29 補上 auth-flow-dark 也要一起歸零：啟動頁／登入／Face ID 這幾頁
   根本沒有底部導覽列，body 那 64px+安全區的 padding-bottom 對它們來說完全是
   多餘的，會在 <body> 底下多留一截沒人用、沒被任何畫面內容蓋到的空間——
   Amber 反應 Face ID 頁最下面也會看到一截色塊，很可能就是這截多出來的空間
   在安全區域那段渲染不正常（這塊實測桌面瀏覽器完全看不出來，只能先排除
   這個明顯多餘、找得到的根因） */
body.page-dark,
html.page-dark,
body.auth-flow-dark,
html.auth-flow-dark { padding-bottom: 0; }
.page--dark h2 { color: var(--color-loading-text); }
.page--dark .empty-hint { color: var(--color-loading-text); }

.home-date { margin: 0 0 var(--space-4); font-size: var(--text-b1); line-height: var(--line-b1); font-weight: var(--weight-semibold); color: #FFFFFF; }
.home-date-weekday { font-weight: var(--weight-regular); }

/* 「今日待繳金額」卡片：大數字＋底下本月待繳／本月已逾期兩個統計（獨立一個淺灰底小方塊），
   數值跟內距都是 2026-10-28 用 Figma 精確讀出來的（之前額度被鎖住時是用截圖目測） */
.home-summary-card {
  background: var(--color-surface-black);
  border-radius: 20px;
  padding: var(--space-4) 20px;
  margin-bottom: var(--space-5);
}
.home-summary-main { margin-bottom: var(--space-4); }
.home-summary-label { margin: 0 0 var(--space-1); font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); color: var(--color-loading-text); }
.home-summary-amount {
  margin: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  font-size: var(--text-h3);
  line-height: var(--line-h3);
  font-weight: var(--weight-semibold);
  font-family: var(--font-number);
  letter-spacing: 0;
  color: #FFFFFF;
}
.home-summary-currency { font-size: var(--text-b3); line-height: var(--line-b3); font-weight: var(--weight-semibold); padding-bottom: 4px; }
.home-summary-stats {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-grey-800);
  border-radius: 12px;
  padding: var(--space-2) var(--space-3);
}
.home-summary-stat { flex: 1; text-align: center; }
.home-summary-stat-label { margin: 0 0 4px; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-loading-text); }
.home-summary-stat-value { margin: 0; font-size: var(--text-s1); line-height: var(--line-s1); font-weight: var(--weight-semibold); font-family: var(--font-number); letter-spacing: 0; color: #FFFFFF; }
/* 「本月已逾期」的數字用警示紅，跟旁邊「本月待繳」的白色數字區分開——這是 Figma 原稿裡
   唯一特別上色的數字，不是沿用狀態標籤的紅（色號不同，特地對過） */
.home-summary-stat-value--danger { color: #F7A9A7; }
.home-summary-stat-unit { margin-left: 4px; font-size: var(--text-c1); line-height: var(--line-c1); font-weight: var(--weight-regular); color: #FFFFFF; }
.home-summary-stat-divider { width: 1px; align-self: stretch; background: rgba(255, 255, 255, 0.12); }

.home-bill-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.home-bill-title { margin: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-semibold); color: #FFFFFF; text-transform: none; }
.home-bill-more { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-c1); line-height: var(--line-c1); color: var(--color-loading-text); text-decoration: none; }
.home-bill-more svg { width: 16px; height: 16px; }

/* 首頁的篩選 tab／帳單列表深色版，CSS 選擇器多一層 .filter-tabs--dark／.bill-list--dark
   去蓋掉預設的淺色樣式，月曆頁沒加這兩個 class，維持原本的淺色外觀不受影響。
   2026-10-28 校正：tab 列其實跟淺色版基礎樣式結構一樣（四等分塞進一個膠囊容器裡），
   上一版因為 Figma 額度被鎖、憑截圖誤判成「沒有容器」，這裡改回容器＋換色就好 */
/* 2026-10-29 修正：容器跟選中膠囊都要是全圓角（999px），不是沿用淺色版的 16px／10px，
   上一版改回「容器包四等分」時漏改圓角數值 */
.filter-tabs.filter-tabs--dark { background: var(--color-grey-800); border-radius: var(--radius-pill); overflow: hidden; }
.filter-tabs--dark .filter-tab { color: var(--color-loading-text); border-radius: 0; font-size: 13px; } /* 2026-11-21 字級 12→13（Figma Button Font/Tab-Small-SB），深底淺字視覺偏細所以加大 */ /* 2026-11-21 未選中字由 #9EA2AE 提亮到 #D2D5DB（Figma Text Color/text-light-grey），深色底字比較扎實 */
.filter-tabs--dark .filter-tab.active { background: var(--color-cta-bg); color: var(--color-cta-text); border-radius: var(--radius-pill); box-shadow: none; }
/* 2026-11-21 tab 滑動黃塊：有 .tab-pill 時，選中的 tab 自己不再畫底色，改由獨立的黃塊滑過去。
   曲線同底部導覽列（過衝再回彈），0.5 秒；字色 0.3 秒跟著淡換 */
.filter-tabs.has-tab-pill { position: relative; }
.filter-tabs.has-tab-pill .filter-tab { position: relative; z-index: 1; transition: color 300ms ease; }
.filter-tabs--dark.has-tab-pill .filter-tab.active { background: none; }
.tab-pill {
  position: absolute; left: 0; top: 0; z-index: 0;
  background: var(--color-cta-bg); border-radius: var(--radius-pill);
  pointer-events: none; will-change: transform, width;
  transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1), width 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* 總覽月／年只有 2 格、黃塊只移動約 62px，原本的回彈太小又會被容器圓角裁掉：
   回彈加強（y1 1.56→1.75，2.0 太過頭），並讓黃塊衝過頭時可以稍微超出容器邊緣，才看得到彈 */
.filter-tabs.filter-tabs--dark.yearly-tabs { overflow: visible; }
.yearly-tabs .tab-pill { transition: transform 500ms cubic-bezier(0.34, 1.75, 0.64, 1), width 500ms cubic-bezier(0.34, 1.75, 0.64, 1); }
@media (prefers-reduced-motion: reduce) { .tab-pill { transition: none; } .filter-tabs.has-tab-pill .filter-tab { transition: none; } }

/* 帳單列表：外層是一個整塊的深色圓角容器（跟上面「今日待繳金額」卡片同一個底色），
   裡面一筆一筆用細線分隔，不是各自獨立、有間距圓角陰影的卡片。
   2026-10-29：這個容器現在是首頁唯一會捲動的區塊——flex:0 1 auto 代表「不主動長高，
   但必要時可以被壓縮」，帳單筆數少、內容撐不滿剩餘空間時，容器照原本邏輯貼齊內容
   高度就好（跟之前畫面一樣）；筆數多、內容會超出畫面剩餘空間時，flex 容器會把它
   壓縮到剩餘空間的高度，壓縮後出不去的內容改成在容器內部上下捲動（overflow-y:auto），
   而不是讓整個頁面跟著往下捲。min-height:0 是讓這個壓縮規則在 flex 版面裡真正生效的
   關鍵，沒有這行瀏覽器預設會讓它硬撐出內容的完整高度、擠爆外層導致整頁捲動 */
/* 2026-11-01 修正：首頁帳單筆數多、內容超出畫面時，flex 會把「所有」可壓縮的子元素
   依各自高度按比例壓扁，連 tab 列也被擠掉約 9px，膠囊下緣被裁切、文字沒置中。
   這頁只有帳單清單該被壓縮（它自己會捲動），其他區塊一律維持原本高度 */
.page--dark > * { flex-shrink: 0; }
.page--dark > .bill-list--dark { flex-shrink: 1; }
.bill-list--dark {
  gap: 8px;
  background: var(--color-surface-black);
  border-radius: 20px;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-2) 0;
}
/* flex-shrink:0 是關鍵：.bill-list--dark 繼承了 .bill-list 原本的 display:flex，
   容器空間不夠時，瀏覽器預設會把每一筆卡片都壓扁來塞進去，而不是讓它們維持原本大小、
   超出的部分交給上面設定的 overflow-y:auto 捲動——沒有這行會變成卡片全部擠在一起、
   文字都被壓爛，而不是正常捲動 */
/* 2026-11-01 照 Figma（node 4413:8107）校正滑動刪除：每一列左右各留 16px，
   中間是高 52、圓角 16 的裁切容器（.bill-card-clip），卡片左滑時內容被這個容器切齊
   （所以文字不會貼到清單邊緣），刪除鈕靠右、右側兩角跟著容器變圓、左側直角，
   卡片跟刪除鈕之間留 4px；分隔線畫在容器外面，滑動時不會跟著動 */
.bill-list--dark .bill-card-wrapper {
  --swipe-gap: 4px;
  position: relative;
  flex-shrink: 0;
  margin: 0 var(--space-4);
  /* 2026-11-01 照 Figma：每列自己只留「內容到分隔線」的 12px；上方的 8px 只給第一筆，下方的 8px 只給最後一筆，
     其餘列與列之間的 8px 由清單的 gap 提供 */
  padding: 0 0 12px;
  overflow: visible;
  border-radius: 0;
  transform: none;
  -webkit-transform: none;
}
.bill-list--dark .bill-card-clip {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
/* 2026-10-29 修正：divider 不該整條貫穿到容器左右邊緣，要跟 row 自己的左右內距切齊，
   border-bottom 沒辦法被 padding 內縮（border 永遠畫在最外緣），改用虛擬元素自己定位 */
.bill-list--dark .bill-card-wrapper:first-child,
.bill-list--dark .scroll-ind-anchor + .bill-card-wrapper { padding-top: 8px; } /* 捲動指示條的錨點會插在最前面，所以「第一筆」要連錨點後面那筆一起算 */
.bill-list--dark .bill-card-wrapper:nth-last-child(1 of .bill-card-wrapper) { padding-bottom: 8px; } /* 只數真的帳單列（月曆切換時清單尾端會暫時多一個殘影，不能把它算進「最後一筆」） */
.bill-list--dark .bill-card-wrapper:not(:nth-last-child(1 of .bill-card-wrapper))::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}
/* 背景不能真的設成 none：.bill-card 底下疊著滑動才會露出的紅色刪除鈕（見 swipe.js），
   卡片平常要用實色蓋住它，不然滑動鈕沒滑開也會透出來。用跟外層容器同一個底色，
   視覺上完全融在一起，不會像之前那樣明顯跳出一張卡片。上下 padding 不對稱
   （上 8、下 12）是照 Figma 原稿的間距結構抓的，不是隨便給一樣的數字 */
.bill-list--dark .bill-card {
  border-radius: 0; /* 圓角由外層 .bill-card-clip 負責，卡片自己有圓角會讓後面的紅色刪除鈕從四角露出來 */
  background: var(--color-surface-black);
  box-shadow: none;
  padding: 4px;
  gap: 24px;
}
.bill-list--dark .bill-card-date { width: 26px; }
.bill-list--dark .bill-card-body { gap: 2px; }
.bill-list--dark .bill-card-delete {
  opacity: 0; /* 平常隱形，滑開才顯示（swipe.js 控制） */
  top: 0; right: 0; bottom: 0;
  width: var(--swipe-delete-w); /* 照 Figma swipe-delete 元件 64（首頁原本是手畫 57，現已改用元件） */
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #EE443F;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.24px;
  font-weight: 500;
  white-space: nowrap;
}
/* 2026-11-23 右滑「已繳」鈕：躲在卡片後面的左側，右滑時露出（swipe.js 控制 opacity），寬度同刪除鈕 64 */
.bill-list--dark .bill-card-paid {
  opacity: 0;
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: var(--swipe-delete-w);
  padding: 0;
  border: none;
  border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  background: #43B75D; /* 同月曆小點「已繳」的綠（Figma 變數 397:2870） */
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.24px;
  font-weight: 500;
  white-space: nowrap;
  min-height: 0;
}
/* 設計稿的帳單列表沒有分類圖示方塊，月曆頁的淺色卡片才有，用 class 選擇器關掉就好，
   不用動共用的 billCard.js 讓月曆頁也跟著不見 */
.bill-list--dark .category-icon-tile { display: none; }
/* 金額要往右撐開（flex:1），狀態標籤才會被推到最右邊，不是兩個緊貼在一起靠左 */
.bill-list--dark .bill-card-meta { display: flex; align-items: center; gap: 4px; width: 100%; }
.bill-list--dark .bill-card-meta .bill-card-amount { flex: 1; }
.bill-list--dark .bill-card-name,
.bill-list--dark .bill-card-day { color: #FFFFFF; }
/* 金額文字不管什麼狀態都是淺灰色，不是只有已繳費才變淡——這點跟原本淺色版的邏輯不一樣 */
.bill-list--dark .bill-card-amount,
.bill-list--dark .bill-card-weekday { color: var(--color-text-grey); }
/* 日期數字/星期字級沿用淺色版大字級（24px）跟全大寫會太突兀，設計稿這裡字比較小、
   星期縮寫也是一般大小寫（Fri）不是全大寫（FRI） */
.bill-list--dark .bill-card-day { font-size: 18px; line-height: 1.4; font-weight: var(--weight-medium); letter-spacing: 0; } /* 2026-11-21 照 Figma 新樣式 S1-M（18／Medium／行高 140%） */
.bill-list--dark .bill-card-weekday { font-size: 12px; line-height: 1.5; text-transform: none; margin-top: 0; } /* Figma 日期與星期 gap 0（共用樣式原本多 2px） */
/* 前面淺色版「已繳費整列文字變淡」的規則（.bill-card.status-paid ...）選擇器疊了三層
   class，權重比這裡的深色規則還高，不管寫在檔案多後面都蓋不過去，這裡要用一樣高或更高
   的權重明確蓋回來——設計稿裡已繳費那筆的名稱/金額顏色其實跟其他筆一樣，只有標籤變綠 */
.bill-list--dark .bill-card.status-paid .bill-card-name,
.bill-list--dark .bill-card.status-paid .bill-card-day { color: #FFFFFF; }
.bill-list--dark .bill-card.status-paid .bill-card-amount { color: var(--color-text-grey); }

.bill-list--dark .bill-card-status-pill,
.bill-list--dark .status-dueSoon .bill-card-status-pill { background: var(--chip-duesoon-bg); color: var(--chip-duesoon-text); }
/* 「大於 3 天」標籤（Figma bill state 新變體）：Primary-100 底、Primary-700 字，首頁與月曆共用 */
.bill-list--dark .status-normal .bill-card-status-pill { background: var(--chip-normal-bg); color: var(--chip-normal-text); }
.bill-list--dark .status-overdue .bill-card-status-pill,
.bill-list--dark .status-dueToday .bill-card-status-pill { background: var(--chip-overdue-bg); color: var(--chip-overdue-text); }
.bill-list--dark .status-paid .bill-card-status-pill { background: var(--chip-paid-bg); color: var(--chip-paid-text); }
/* 新版狀態文案已經把意思講得很清楚（已逾期 5 天／2 天後到期），不需要再靠一顆小圓點輔助 */
.bill-list--dark .bill-card-status-dot { display: none; }

/* 帳單列表的空狀態：插畫圖示＋置中文字，照 Figma「空狀態」元件的數字抓
   （插圖 136x102、間距 24px、四周留白 24px），跟共用的 .empty-hint（月曆／總覽頁用，
   純文字靠置中但沒有插畫）不是同一套，這裡是首頁深色版專用的新元件 */
.bill-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding: 24px;
  text-align: center;
}
.bill-empty-state-icon { width: 136px; height: 102px; } /* 2026-11-03 換成 Amber 提供的新插圖（408x306 的 3x 圖），Figma 畫面設定 136x102 */
.bill-empty-state-text { margin: 0; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); font-weight: var(--weight-medium); color: var(--color-text-grey); }

/* 全站共用的「載入中」畫面：2026-10-22 改版，統一成深藍漸層滿版＋文字＋假進度條
   （取代之前內頁淺色小字、開機驗證另外一套樣式，兩邊各自長得不一樣的寫法）。
   用 position:fixed 置中，不透過外層 .page 的 padding 去算高度——.page 上方有
   頁面標題的留白，如果照外層的框去抓「置中」，中心點會被那段留白往下拉走，看起來偏上。
   底部預設扣掉底部導覽列的高度（跟 body 的 padding-bottom 用同一個數字），置中基準是
   「扣掉導覽列後、真正看得到內容的範圍」；開機驗證那種還沒有導覽列可看的情境，
   renderPageLoading(true) 會多加一個 is-full class 把 bottom 蓋回 0，佔滿整個螢幕 */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* 2026-10-29 修正兩個問題：
     1. 底部導覽列實際高度是 60px（量出來的，不是沿用舊版猜的 64px），之前的數字
        跟導覽列中間的「＋」浮動按鈕要多留的 28px 空間疊加起來，蓋版跟導覽列之間
        會露出一截頁面本身的漸層背景，在導覽列正上方看起來像一塊奇怪的淺色色塊。
     2. 「＋」按鈕凸出導覽列上緣，蓋版只要蓋到導覽列上緣就會把凸出來的那截切斷——
        這兩個需求（不留縫隙／不切到按鈕）用純數字調蓋版高度互相矛盾，魚與熊掌
        不能兼得，所以改個更根本的做法：把這層蓋版的疊層順序（z-index）改成比
        導覽列低（見 --z-page-loading），這樣蓋版數字只要對齊導覽列高度、完全不留
        縫隙即可，導覽列（含「＋」按鈕）永遠穩穩蓋在蓋版上面，不會被切到 */
  /* 2026-11-18 再改：蓋版直接蓋滿整個螢幕（導覽列 z-index 比它高，不會被蓋住），
     用 padding-bottom 把內容往上推，維持「置中在導覽列上方」。以前是 bottom 空出 72px，
     蓋版自己的漸層（只拉伸在它自己的高度）跟底下頁面底色的漸層（拉伸在整個螢幕）在交界處顏色
     對不上，底部會多出一條色塊 */
  bottom: 0;
  box-sizing: border-box;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--gradient-dark);
  z-index: var(--z-page-loading);
}
.loading-screen.is-full { padding-bottom: 0; }
.loading-text {
  margin: 0;
  color: var(--color-loading-text);
  font-size: var(--text-s2);
  line-height: var(--line-s2);
  letter-spacing: var(--spacing-s2);
  font-weight: var(--weight-semibold);
}

.gmail-alert {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-status-dueSoon);
  color: #fff;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-c1);
  line-height: var(--line-c1);
  letter-spacing: var(--spacing-c1);
  margin-bottom: var(--space-2);
}
.gmail-alert svg { flex-shrink: 0; width: 20px; height: 20px; }

/* 訂閱服務即將自動續訂的首頁提醒（Figma 4437:25626）：日期標題下方的膠囊橫幅，
   左邊喇叭、右邊關閉鈕固定，中間文字區域超出時跑馬燈；關閉只是這次先不看，見 home.js */
.home-date--with-alert { margin-bottom: 8px; }
.subscription-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 4px 16px;
  margin-bottom: 20px;
  background: #2B3E4A;
  border-radius: 999px;
  color: #FFAA00;
  font-size: 12px;   /* Figma C1 Caption：12px／行高 1.5／字距 1.5%，一般粗細（原本誤讀成 10px） */
  line-height: 18px;
  letter-spacing: 0.015em;
  font-weight: 400;
}
.subscription-alert-icon { flex-shrink: 0; width: 20px; height: 20px; }
.subscription-alert-viewport { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.subscription-alert-track { display: inline-flex; align-items: center; }
.subscription-alert-item { flex-shrink: 0; padding-right: 32px; }
.subscription-alert-item a { color: inherit; text-decoration: underline; }
.subscription-alert-track.is-marquee { animation: subscription-marquee linear infinite; }
@keyframes subscription-marquee { from { transform: translateX(0); } to { transform: translateX(var(--marquee-distance)); } }
.subscription-alert-close {
  flex-shrink: 0;
  min-height: auto;
  width: 20px;
  height: 20px;
  padding: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.subscription-alert-close img { width: 20px; height: 20px; display: block; }

/* ============ 底部導覽列（2026-11-11 照 Figma 改成半透明膠囊，全站只有一個、常駐在外層） ============ */
/* 外層固定在畫面底部（安全區上方 8px），本身不擋點擊；膠囊寬 = 螢幕左右各留 16、高 64、圓角 32。
   8pt 網格：單格高 56、圓角 28、膠囊內距 4、＋鈕圓 48。5 格等分，選中滑塊用 transform 左右滑動 */
.bottom-nav {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 8px);
  z-index: var(--z-nav);
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}
.bottom-nav[hidden] { display: none; }
.nav-capsule {
  --slot: 0;
  position: relative;
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  width: 100%;
  max-width: 448px;
  height: 64px;
  padding: 4px;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  /* 去掉 iOS 的點擊灰底 */
  -webkit-tap-highlight-color: transparent;
}
/* 不支援毛玻璃的瀏覽器：改用較不透明的深色底，文字才讀得清楚 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav-capsule { background: rgba(33, 41, 54, 0.92); }
}
/* 邊緣一圈由亮到暗的細線（Figma 描邊漸層）：用遮罩只露出 1px 邊框 */
.nav-capsule::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.3) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
/* 選中滑塊：寬 = 一格，往右移 slot × 100%（相對自己的寬度），所以任何螢幕寬度都對得準 */
.nav-pill {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 5);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.14);
  transform: translateX(calc(var(--slot) * 100%));
  transition: transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1); /* 滑到位時稍微衝過頭再回彈 */
  pointer-events: none;
}
.nav-tab {
  position: relative;
  z-index: 1;
  height: 56px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 28px;
  text-decoration: none;
  color: var(--color-loading-text); /* 未選中：淺灰 #D2D5DB（對比約 5:1） */
  font-size: var(--text-c3);
  line-height: var(--line-c3);
  font-weight: var(--weight-medium);
  transition: color var(--duration-fast) var(--ease-standard);
}
.nav-tab-icon { display: flex; width: 24px; height: 24px; }
/* 回彈感（2026-11-21）：按下去圖示與文字縮到 86%（90ms），放開時用過衝曲線彈回（380ms）；切換成功時選中那格再彈一下 */
.nav-tab-icon, .nav-tab-label { transition: transform 380ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.nav-tab.is-pressed .nav-tab-icon, .nav-tab.is-pressed .nav-tab-label { transform: scale(0.86); transition-duration: 90ms; transition-timing-function: ease-out; }
.nav-tab-icon svg { width: 100%; height: 100%; }
.nav-tab.active { color: #FFFFFF; font-weight: var(--weight-semibold); }
/* 中間新增帳單鈕：膠囊內 48 的黃色圓，6px 淺黃內圈（Accent-200），不是分頁、不會被選中 */
.nav-add {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: 56px;
  height: 56px;
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.nav-add-icon {
  width: 48px;
  height: 48px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 6px solid #F6F8B6;
  background: var(--color-cta-bg);
  color: #131927;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.nav-add-icon svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-add:active .nav-add-icon { transform: scale(0.94); }
/* 選中時 icon 短暫彈性放大再彈回（只在選中那一格重新被切換時播放一次） */
.nav-tab.active .nav-tab-icon { animation: nav-icon-pop 380ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.nav-tab.active .nav-tab-label { animation: nav-label-pop 380ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes nav-label-pop { 0% { transform: scale(0.9); } 100% { transform: scale(1); } }
@keyframes nav-icon-pop {
  0% { transform: scale(1); opacity: 0.6; }
  45% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ============ 表單 ============ */
form { display: flex; flex-direction: column; gap: var(--space-4); }
label { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); font-weight: var(--weight-medium); color: var(--color-text-muted); }
/* 表單裡不屬於任何 <label> 的獨立標題文字（例如金額、分類、繳費狀態這種後面接的不是
   單一輸入框，是一整組自訂元件），沿用跟 label 一樣的文字樣式，但不用 label 的 flex 排版 */
.field-label { display: block; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); font-weight: var(--weight-medium); color: var(--color-text-muted); margin-bottom: var(--space-1); }

/* ============ 帳單編輯頁：滑入式全高度 Sheet ============ */
/* 整頁背景先鋪一層半透明深色（呼應 modal-overlay 的調性），.bill-sheet-panel 本身
   從畫面下緣往上頂，頂部特意留一小段縫隙露出後面的深色，做出「Sheet 疊在上面」的錯覺——
   這個頁面本身還是走原本的整頁路由（不是真的浮在其他畫面上面的 modal），純粹是視覺呈現 */
.bill-sheet-page {
  height: 100vh;
  overflow: hidden;
  /* Figma：Sheet 後面露出的是首頁的深藍漸層 */
  background: var(--gradient-dark);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
}
/* Sheet 後面露出的當日日期（Figma 首頁左上角），Sheet 從 y=86 開始，日期在 y≈56~80，不會被蓋到 */
.bill-sheet-date {
  position: absolute;
  top: calc(56px + env(safe-area-inset-top));
  left: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #FFFFFF;
  line-height: 1.4;
}
.bill-sheet-date strong { font-size: 16px; font-weight: var(--weight-semibold); letter-spacing: 0.015em; }
.bill-sheet-date span { font-size: 14px; line-height: 1.5; }
/* 2026-10-30 照 Figma 改回白底：Sheet 本體是白色（surface-white），只有後面露出的首頁是深色。
   這個範圍內重新定義共用變數，裡面的輸入框／列／下拉選單會自動換成 Figma 的淺色配色：
   列底 grey-50 #F3F5F7、文字 #131927、次要文字 #6D717F、分隔線 grey-200 #E5E7EA。
   Sheet 高度 = 螢幕高度 - 頂部 86px（Figma 的 modal-sheet 從 y=86 開始），內容超出時只捲中間表單、
   底部儲存鈕固定不動 */
.bill-sheet-panel {
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  margin-top: calc(86px + env(safe-area-inset-top));
  height: calc(100vh - 86px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bill-sheet-slide-up var(--duration-normal) var(--ease-standard);
  box-shadow: 0 48px 0 0 #FFFFFF; /* 開啟時衝過頭、關閉時先上提，底下都不露空隙（2026-11-23） */
  --color-bg: #FFFFFF;
  --color-surface: #F3F5F7;
  --color-surface-muted: #F3F5F7;
  --color-text: #131927;
  --color-text-muted: #6D717F;
  --color-border: #E5E7EA;
  color: var(--color-text);
}
@keyframes bill-sheet-slide-up {
  from { transform: translateY(28px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}
.bill-sheet-handle-wrap { padding: 12px 0; display: flex; justify-content: center; flex-shrink: 0; }
.bill-sheet-handle { width: 36px; height: 4px; border-radius: var(--radius-pill); background: #D1D1D3; }
.bill-sheet-form { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; }
.bill-sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bill-sheet-scroll > * { flex-shrink: 0; }
/* 空的錯誤訊息不佔位，不然每一個空 <p class="error"> 都會多撐出一段間距 */
.bill-sheet-scroll .error:empty { display: none; }
.bill-sheet-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-s1);
  line-height: var(--line-s1);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
}
.bill-sheet-divider { height: 1px; background: #E5E7EA; width: 100%; }
/* 底部按鈕區：Figma save-button-wrapper（左右 36、上 12、下 24、按鈕之間 10） */
.bill-sheet-footer {
  display: flex;
  gap: 10px;
  padding: 12px 36px calc(24px + env(safe-area-inset-bottom));
  background: #FFFFFF;
  flex-shrink: 0;
}
.bill-sheet-footer button {
  flex: 1;
  height: 48px;
  min-height: 0;
  /* 同上：flex 置中，避免文字偏下 */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0;
  font-weight: var(--weight-semibold);
}
.bill-btn-primary { background: #00AFD5; color: #FFFFFF; }
.bill-btn-primary.is-incomplete { background: #E5E7EA; color: #9EA2AE; }
.bill-btn-outline { background: #FFFFFF; color: #00AFD5; border: 1.5px solid #00AFD5; }

/* ============ 金額欄位（大字顯示 + 點擊喚出自訂鍵盤） ============ */
.amount-field { margin: 0; padding-bottom: 4px; border-bottom: 1px solid #E5E7EA; display: flex; flex-direction: column; gap: 4px; }
.amount-field .field-label { margin: 0; }
.amount-field .field-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); }
.amount-display {
  width: 100%;
  min-height: 0;
  padding: 0;
  background: none;
  border: none;
  text-align: left;
  color: var(--color-text);
  font-family: var(--font-number);
  letter-spacing: 0;
  font-size: var(--text-h2);
  line-height: var(--line-h2);
  font-weight: var(--weight-medium);
  display: flex;
  flex-direction: row; /* 全站 label 預設是直向排列，這裡要 $ 跟數字同一行 */
  align-items: baseline;
  gap: 0;
  cursor: text;
}
.amount-display-currency { color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; }
.numpad-drawer { margin: 0; }
/* 金額輸入框：長得跟原本的大字顯示一樣（40px Medium），只是改成真的輸入框，才叫得出系統鍵盤 */
.amount-display input {
  flex: 1;
  width: 0; /* 輸入框預設有固定最小寬度，歸零才不會把整排撐出畫面 */
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  outline: none;
}
.amount-display input::placeholder { color: #131927; opacity: 1; }

/* 帳單表單裡「循環帳單專屬欄位」這種用 div 包起來、依條件顯示/隱藏的欄位群組——
   div 本身原本沒有 gap，裡面的 label 會直接疊在一起，跟其他直屬 <form> 的欄位間距不一致。
   這裡補上跟 form 一樣的 gap，顯示/隱藏改用 JS 切換 display:flex／none 才不會蓋掉這個 gap 設定 */
.form-field-group { display: flex; flex-direction: column; gap: var(--space-4); }

input, select {
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-b1);
  line-height: var(--line-b1);
  letter-spacing: var(--spacing-b1);
  font-family: inherit;
}
input:focus, select:focus { border-color: var(--color-primary); }

/* 欄位驗證失敗：JS 端判斷不合法時加上 is-invalid，紅框取代/搭配下面的文字錯誤訊息，
   一眼就能看出是哪一格錯了，不用逐行找 .error 文字對到哪個欄位 */
input.is-invalid, select.is-invalid, .custom-select-trigger.is-invalid {
  border-color: var(--color-status-overdue);
}
input.is-invalid:focus, select.is-invalid:focus { border-color: var(--color-status-overdue); }
/* .date-row-trigger 平常沒有邊框（純色底的膠囊列），驗證失敗時額外畫一條紅框，
   跟其他欄位的作法不一樣是因為它本來就沒有邊框可以「換色」，要用 box-shadow 模擬邊框
   才不會讓內距跟著邊框粗細跳動 */
.date-row-trigger.is-invalid { box-shadow: 0 0 0 1.5px var(--color-status-overdue); }

/* 不可互動狀態：欄位/按鈕處理中或被鎖住時統一用「變淡+禁用游標」表示，
   之前只靠 JS 的 disabled 屬性鎖住互動，畫面上看不出來，容易誤以為當掉了 */
input:disabled, select:disabled, .custom-select-trigger[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ 自訂下拉選單（取代原生 select，選單固定彈在輸入框正下方） ============ */
.custom-select { position: relative; }
.custom-select-native { display: none; }
.custom-select-trigger {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-b1);
  line-height: var(--line-b1);
  letter-spacing: var(--spacing-b1);
  font-family: inherit;
  font-weight: var(--weight-regular);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  cursor: pointer;
}
.custom-select-trigger.is-placeholder { color: var(--color-text-muted); }
.custom-select-trigger::after {
  content: '';
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--duration-fast) var(--ease-standard);
}
.custom-select-trigger.is-open::after { transform: rotate(-135deg); }
.custom-select-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  max-height: 240px;
  overflow-y: auto;
  padding: var(--space-1);
}
/* 下拉選單出現時 150ms 淡入＋從上方 4px 滑下（離場維持瞬間，小選單慢了反而拖） */
.custom-select-panel { animation: motion-dropdown-in var(--motion-fade) var(--ease-out); }
.custom-select-option {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-3);
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-medium);
  cursor: pointer;
}
.custom-select-option:active { transform: none; opacity: 1; }
.custom-select-option:hover, .custom-select-option.is-selected { background: var(--color-surface-muted); }

/* 把好幾個設定列「黏」成一張卡片（例如繳費到期日＋已繳費、重複帳單＋金額規則），
   照 Figma 畫稿：外層整體一個大圓角，裡面每一列用細線分隔，不是各自獨立、有間距的膠囊。
   2026-10-30 修正：原本在這裡用 overflow:hidden 裁出圓角，會連同下拉選單/月曆面板一起
   裁掉——面板其實有展開，只是被裁得看不到，像「點了沒反應」。改成只在頭尾兩列個別畫
   圓角，不裁切整個容器，面板才能正常浮出來 */
.row-group { display: flex; flex-direction: column; width: 100%; }
.row-group > .list-row, .row-group > .date-row {
  border-radius: 0;
  border-bottom: 1.5px solid var(--color-border);
}
.row-group > .list-row:first-child, .row-group > .date-row:first-child { border-top-left-radius: 20px; border-top-right-radius: 20px; }
.row-group > .list-row:last-child, .row-group > .date-row:last-child,
.row-group > .list-row.is-last-visible, .row-group > .date-row.is-last-visible { border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; }
.row-group > .list-row:last-child, .row-group > .date-row:last-child,
/* 中間某一列因為條件隱藏（例如「金額規則」只在有重複週期時才出現），這時候它上面
   那列會變成「視覺上的最後一列」，但 CSS 的 :last-child 認的是 DOM 順序、不管
   display:none，單靠 CSS 沒辦法自動偵測，所以用這個 class 讓 JS 直接告訴它「這列
   現在是最後一列，不要畫分隔線」（見 billForm.js 的 updateGeneralFieldVisibility） */
.row-group > .list-row.is-last-visible, .row-group > .date-row.is-last-visible {
  border-bottom: none;
}

/* ============ 設定列（一整排「標籤＋值」的膠囊列，照 Figma 畫稿：日期選擇列／
   重複帳單等下拉選單列都共用這個底，右側內容依情境換成日期觸發鈕或下拉選單）。
   padding 照 Figma 精確值：外層列本身 8px 上下，裡面「Left/Right Item」各自再 8px 上下、
   12px 左右，兩層疊加起來才會是 Figma 量出來的 53px 列高，不是單層 44px ============ */
.list-row, .date-row {
  width: 100%;
  min-height: 0;
  padding: 16px var(--space-3);
  background: var(--color-surface-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.date-row { position: relative; }
/* 自訂日期選擇列（見 components/datePicker.js）：觸發鈕本身不再自己畫底色/內距，
   改由外層 .date-row 提供這個膠囊外觀，鈕只負責填滿整排、點擊展開月曆 */
.date-row-trigger {
  width: 100%;
  min-height: 44px;
  padding: 0;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  color: var(--color-text);
  cursor: pointer;
}
.date-row-trigger--readonly { cursor: default; pointer-events: none; } /* 續訂日期：只顯示、不能點 */
.date-row-trigger svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--color-text-muted); }
.date-row-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: var(--color-text-muted); flex-shrink: 0; }
.date-row-right { display: flex; align-items: center; gap: var(--space-1); }
.date-row-value { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); color: var(--color-text-muted); }
.date-row-value--selected { color: var(--color-nav-active); font-weight: var(--weight-medium); }

/* 下拉選單列（重複帳單／訂閱規則）：跟日期列共用同一個 .list-row 膠囊底，
   自訂下拉選單（customSelect.js）本來自己有背景/內距，塞進這排列裡要拿掉，
   讓它融進同一排，只保留文字+箭頭的觸發外觀 */
.list-row .custom-select { flex: 1; display: flex; justify-content: flex-end; min-width: 0; }
.list-row .custom-select-trigger {
  width: auto;
  min-height: 0;
  padding: 0;
  background: none;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}
.list-row .custom-select-trigger.is-placeholder { color: var(--color-text-muted); font-weight: var(--weight-regular); }
.list-row .custom-select-trigger::after {
  content: '';
  width: 20px;
  height: 20px;
  border: none;
  transform: none;
  background: url('../icons/categories/chevron-updown.svg') center / contain no-repeat;
}
.list-row .custom-select-trigger.is-open::after { transform: none; }
.list-row .custom-select-panel { left: auto; min-width: 124px; }

/* 月曆面板：浮在日期列正下方，跟自訂下拉選單同一套定位邏輯（top:calc(100% + 4px)） */
.date-calendar-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-3);
}
.date-calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.date-calendar-month { font-size: var(--text-b1); line-height: var(--line-b1); font-weight: var(--weight-semibold); color: var(--color-text); }
.date-calendar-nav { display: flex; gap: var(--space-2); }
.date-calendar-nav-btn {
  min-height: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  background: none;
  color: var(--color-nav-active);
  display: flex;
  align-items: center;
  justify-content: center;
}
.date-calendar-nav-btn svg { width: 18px; height: 18px; }
.date-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: var(--space-1);
}
.date-calendar-weekdays span {
  text-align: center;
  font-size: var(--text-c1);
  line-height: var(--line-c1);
  letter-spacing: var(--spacing-c1);
  color: var(--color-text-muted);
}
.date-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: var(--space-1); }
.date-calendar-day {
  min-height: 0;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  padding: 0;
  background: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  color: var(--color-text);
}
span.date-calendar-day.is-outside { color: var(--color-text-muted); opacity: 0.4; }
.date-calendar-day.is-today { color: var(--color-nav-active); border: 1.5px solid var(--color-nav-active); }
.date-calendar-day.is-selected { background: var(--color-nav-active); color: #FFFFFF; }

button {
  min-height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  font-size: var(--text-b1);
  line-height: var(--line-b1);
  letter-spacing: var(--spacing-b1);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
button:active { transform: scale(0.98); opacity: 0.9; }
button.danger { background: var(--color-status-overdue); }
button.secondary { background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border); }
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  /* 處理中的按鈕不需要按下的縮放回饋，維持原尺寸避免看起來像還能繼續按 */
  transform: none;
}

.error { color: var(--color-status-overdue); font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); min-height: 1.2em; }
.hint { color: var(--color-text-muted); font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); }

/* ============ PIN / Google 登入鎖畫面 ============ */
.pin-lock {
  position: relative; /* 給 .auth-brand 這種貼在角落的元素當定位基準 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  text-align: center;
}
.auth-hint { color: var(--color-text-muted); font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); }

/* 啟動頁 logo 動畫：P 圖標定格 → 由左至右擦出變成完整 Paycue 字樣 → 定格 →
   維持水平置中、垂直往上移動並縮小到登入頁小 logo 的位置與大小 → 整頁淡出。
   這幾個 is-* class 由 auth.js 的 renderWelcome() 依照時間序加上去。
   收尾位置（水平置中、距頂 100px、90×24）跟登入頁／Face ID 頁自己的 logo
   位置、大小完全對齊，所以淡出銜接上去不會有跳動感 */
.splash-screen {
  position: fixed;
  inset: 0;
  background: var(--gradient-dark);
  z-index: var(--z-blocking);
  transition: opacity var(--duration-normal) var(--ease-standard);
}
.splash-screen.is-fading-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 171px;
  height: 46px;
  transform: translate(-50%, -50%) scale(1);
  transition: top 600ms var(--ease-standard), transform 600ms var(--ease-standard);
}
.splash-logo-wrap.is-collapsed {
  top: 100px;
  /* 90 / 171，縮到登入頁小 logo 的實際寬度 */
  transform: translate(-50%, 0) scale(0.5263);
}

.splash-logo-icon,
.splash-logo-wordmark {
  position: absolute;
  left: 0;
  display: block;
}
/* 2026-10-29 修正：P 圖標淡出、Paycue 字樣擦出這兩個動畫之前是同時開始（都是 600ms），
   兩個疊在同一個位置、同時變化，會有一瞬間「兩個都半透明疊在一起」，Amber 反應這段
   正常速度看也會「卡一下」——改成接力進行：P 圖標先完全淡出（300ms），字樣才開始擦出
   （300ms，用 transition-delay 等前一段做完），兩段加起來一樣是 600ms，不影響後面
   「貼齊登入頁位置」那段動畫的啟動時間，但畫面上任何時刻都只有一個東西在動 */
.splash-logo-icon {
  /* 原本這裡是 5.18px，算法是「(46 - 35.6309) / 2」，假設 P 在完整 Paycue 字樣
     SVG 裡是垂直置中的——但去比對 logo-wordmark-light.svg 的實際座標，P 其實是貼齊
     在字樣方塊的最上緣（y 幾乎從 0 開始，下面多出來的高度是留給 ycue 其他字母的
     下伸筆畫，不是拿來置中 P 用的），改成 0 才會跟字樣裡的 P 疊在同一個位置，
     不然轉場時兩個 P 會有約 5px 的垂直落差，看起來像對不準的殘影 */
  top: 0;
  width: 33.8936px;
  height: 35.6309px;
  opacity: 1;
  transition: opacity 300ms var(--ease-standard);
}
.splash-logo-wordmark {
  top: 0;
  width: 171px;
  height: 46px;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 300ms var(--ease-standard) 300ms;
}
.splash-screen.is-revealed .splash-logo-icon { opacity: 0; }
.splash-screen.is-revealed .splash-logo-wordmark { clip-path: inset(0 0% 0 0); }

/* 登入頁／Face ID 頁：深藍漸層滿版、文字白色、全部靠左對齊（跟其他畫面置中的排法不同，
   照 Figma 設計稿來）。.pin-lock 原本的 text-align:center 在這裡整個覆蓋掉，
   logo 本身比容器窄，靠 .pin-lock 原本的 align-items:center 自然置中；
   問候語／底部整塊內容靠 align-self:stretch 撐滿寬度，文字才會貼齊左邊 */
.pin-lock.auth-bg-login,
.pin-lock.auth-bg-faceid {
  background: var(--gradient-dark);
  color: #FFFFFF;
  text-align: left;
  justify-content: space-between;
  /* 100px／36px／64px 都是 Figma 設計稿上的實際數字，36px 不在 8px 間距節奏裡，
     所以沒有用 --space-* token，直接寫死對齊設計稿 */
  padding: 100px 36px 64px;
}

.auth-header-logo { align-self: center; }
.auth-header-logo img { display: block; width: 90px; height: 24px; }

/* 登入頁專用的問候語，Face ID 頁沒有這個元素 */
.auth-greeting {
  align-self: stretch;
  margin: 0;
  font-size: var(--text-h3);
  line-height: var(--line-h3);
  font-weight: var(--weight-medium);
  letter-spacing: 0;
}

/* 底部整塊：圖示 + 下面一整組（標題／說明／錯誤訊息／主要按鈕），兩層都靠左、撐滿寬度。
   48px／24px／8px／74px 都是 Figma 設計稿上的實際數字，不在 8px 間距節奏裡 */
.auth-action-block {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 48px;
}
.auth-action-icon { display: block; width: 48px; height: 48px; }

/* 標題群組／錯誤訊息／按鈕這組的容器。Face ID 頁有錯誤訊息格要排進去，彼此間距 24px；
   登入頁沒有錯誤訊息格，直接用 74px 一次跳過——這樣不管有沒有顯示錯誤訊息，
   按鈕在畫面上的位置都不會因為多那一行字而跳動（錯誤訊息格固定保留一行高度） */
.auth-action-group {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}
.auth-action-group--plain { gap: 74px; }

.auth-action-text { align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
.auth-action-text h2 {
  margin: 0;
  font-size: var(--text-h5);
  line-height: var(--line-h5);
  font-weight: var(--weight-semibold);
  color: #FFFFFF;
  text-transform: none;
}
.auth-action-block .auth-hint {
  margin: 0;
  color: var(--color-loading-text);
  font-size: var(--text-b2);
  line-height: var(--line-b2);
  letter-spacing: var(--spacing-b2);
}

/* Face ID 驗證失敗的錯誤訊息，固定保留一行文字的高度（不管有沒有字），
   按鈕才不會因為這行字一下有一下沒有而跳動位置 */
.auth-error-text {
  align-self: stretch;
  margin: 0;
  min-height: var(--line-b2);
  color: #F16965;
  font-size: var(--text-b2);
  line-height: var(--line-b2);
  letter-spacing: var(--spacing-b2);
  font-weight: var(--weight-medium);
}

/* 畫面左上角的品牌小字（例如 PIN 頁的「PayCue」），不佔版面流量、固定貼在角落 */
.auth-brand {
  position: absolute;
  top: var(--space-5);
  left: var(--space-5);
  font-size: var(--text-c1);
  line-height: var(--line-c1);
  letter-spacing: var(--spacing-c1);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
}

/* 畫面切換動畫：新內容淡入＋輕微上滑，取代原本的直接替換硬切。
   套用方式：內容 innerHTML 換好之後，在容器上加這個 class 觸發一次動畫。
   已經有全域的 prefers-reduced-motion 設定會自動把 duration 壓到接近 0，這裡不用重覆處理 */
@keyframes auth-screen-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-screen-enter { animation: auth-screen-enter 280ms var(--ease-standard); }

/* 登入流程的主要 CTA 按鈕：黃綠色膠囊形狀，照 Figma Button Font/Medium 規格
   （14px／Semi Bold／行高 16px／字距 0），跟全站其他按鈕的字級系統無關，獨立寫死 */
/* 2026-11-02 照 Figma 4437:22996 調整：高 48、左右 20、字 16／行高 20（原本 40／14／16） */
.btn-pill {
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--color-cta-bg);
  color: var(--color-cta-text);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 16px;
  line-height: 20px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
}

/* Google 登入那顆按鈕沒辦法直接用 .btn-pill 畫：Google 的 renderButton() 只能選它
   自己的官方配色樣式，改不成品牌黃。做法是疊兩層——上面是純視覺的 .btn-pill 黃色
   膠囊（擋住底下真正的 Google 按鈕長相），下面是真正的 Google 按鈕但幾乎全透明，
   使用者眼睛看到黃色按鈕、手指點下去點到的其實是底下那顆真的 Google 按鈕，
   流程完全沒變，只是換皮 */
.auth-cta-wrap {
  position: relative;
  width: 100%;
  height: 48px;
}
.auth-cta-visual {
  position: absolute;
  inset: 0;
  z-index: 2; /* 蓋在真正的 Google 按鈕上面，確保畫面上看到的黃色膠囊永遠在最上層 */
  pointer-events: none; /* 讓點擊穿透到下面真正的 Google 按鈕 */
}
.auth-cta-google {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: var(--radius-pill);
  opacity: 0; /* opacity:0（不是 visibility:hidden／display:none）元素本來就還是可以被點擊 */
}
/* Google 官方按鈕最高只有 40px，黃色假按鈕改成 48px 後，底下 8px 會點不到；
   把真按鈕往下拉長 1.2 倍（40→48），點擊範圍就跟畫面上的黃色膠囊一樣大 */
.auth-cta-google > div, .auth-cta-google iframe { transform: scaleY(1.2); transform-origin: top; }

/* 次要動作用純文字連結樣式（例如「改用 PIN 碼」），不做按鈕框，比 button.secondary 更輕 */
.auth-link {
  background: none;
  border: none;
  color: inherit;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-medium);
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: auto;
  padding: var(--space-1);
  width: auto;
}
.auth-link:active { transform: none; opacity: 0.6; }
/* 連結文字前面帶一個小圖示時用（例如「改用 PIN 碼」），圖示跟文字水平排一列 */
.auth-link-icon { display: inline-flex; align-items: center; gap: var(--space-1); }

/* 「載入中」畫面用的安撫動畫進度條——Apps Script／各頁 API 都是整包資料一次回來，
   沒辦法回報真實進度百分比，這條只是視覺上的安撫，不對應真實進度 */
.loading-progress {
  width: 200px; /* Figma 4437:22996 進度條寬 200（原 240） */
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-progress-track);
  overflow: hidden;
}
.loading-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-progress-fill);
  border-radius: var(--radius-pill);
  transition: width var(--duration-fast) var(--ease-standard);
}

/* ============ 自訂數字鍵盤（帳單編輯頁金額輸入用） ============ */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.numpad-key {
  min-height: 52px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: var(--text-s1);
  line-height: var(--line-s1);
  font-weight: var(--weight-semibold);
  font-family: var(--font-number);
  display: flex;
  align-items: center;
  justify-content: center;
}
.numpad-key:active { transform: scale(0.96); opacity: 0.85; }
.numpad-key-text { font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-text-muted); }
.numpad-key svg { width: 22px; height: 22px; }

/* ============ PIN 方格輸入（4-6 位數字，逐格顯示＋動效） ============ */
.pin-boxes { position: relative; display: flex; gap: var(--space-2); justify-content: center; }
.pin-boxes-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  padding: 0;
  margin: 0;
  min-height: 0;
  caret-color: transparent;
}
.pin-box {
  width: 40px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--text-h5);
  line-height: var(--line-h5);
  font-weight: var(--weight-semibold);
  font-family: var(--font-number);
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.pin-box.is-active { border-color: var(--color-primary); }
.pin-box.is-filled { border-color: var(--color-text-muted); }

@keyframes pin-shake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-9px); }
  40%, 60% { transform: translateX(9px); }
}
.pin-boxes.is-shake { animation: pin-shake 500ms var(--ease-standard); }
.pin-boxes.is-shake .pin-box { border-color: var(--color-status-overdue); }

.pin-boxes.is-success .pin-box {
  border-color: var(--color-status-paid);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-status-paid) 25%, transparent);
}

/* PIN 正確後接著顯示的「驗證成功」畫面：發光打勾徽章
   這個畫面是直接整個換掉 .pin-lock 的內容，不是包在 .pin-lock 容器裡，
   所以置中要自己再帶一次 min-height:100vh，不能靠 .pin-lock 那份 */
.pin-success {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  text-align: center;
}
.pin-success-badge {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-status-paid) 15%, transparent);
  color: var(--color-status-paid);
  box-shadow: 0 0 24px color-mix(in srgb, var(--color-status-paid) 45%, transparent);
  animation: pin-success-pop 400ms var(--ease-standard);
}
.pin-success-badge svg { width: 32px; height: 32px; }
@keyframes pin-success-pop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* 首頁「本月待繳」的全部／待繳／已繳／逾期 小分頁 ／總覽的本月／本年切換（深色版覆蓋寫在 .filter-tabs--dark） */
.filter-tabs {
  display: flex;
  background: var(--color-surface-muted);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--space-3);
}
.filter-tab {
  flex: 1;
  min-height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: var(--text-c1);
  line-height: var(--line-c1);
  letter-spacing: var(--spacing-c1);
  font-weight: var(--weight-semibold);
}
.filter-tab.active { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-card); }

/* ============ 分類圖示（漸層方塊模擬毛玻璃質感） ============ */
/* 沒有實際的毛玻璃美術素材，用「漸層底色 + 一層對角線高光疊層 + 內陰影」去模仿類似的
   光澤感。--icon-color 由外部（categoryIcons.js）帶入該分類自己的顏色，同一套規則
   套用在任何分類上顏色都會自動對應，不用每個分類各寫一次樣式 */
.category-icon-tile {
  --icon-tile-size: 44px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-tile-size);
  height: var(--icon-tile-size);
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--icon-color) 78%, white 22%), var(--icon-color));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), inset 0 -6px 10px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(20, 21, 60, 0.12);
  overflow: hidden;
  color: #fff;
}
/* 對角線高光：左上亮、右下漸淡，模擬玻璃表面反光 */
.category-icon-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
.category-icon-tile svg {
  position: relative;
  z-index: 1;
  width: calc(var(--icon-tile-size) * 0.5);
  height: calc(var(--icon-tile-size) * 0.5);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}
/* 有真實 Figma 素材的圖示（見 categoryIcons.js 的 REAL_ICON_ASSETS）：白底方塊本身
   就是這個 icon 方塊，不用再疊漸層／高光那些模擬效果，素材本身已經是完成品 */
.category-icon-tile--asset {
  background: #FFFFFF;
  box-shadow: 1.6px 4.8px 9px rgba(22, 52, 80, 0.1);
  border-radius: var(--radius-md);
}
.category-icon-tile--asset::before { display: none; }
.category-icon-tile--asset img { position: relative; z-index: 1; }

/* ============ 分類選擇器（帳單編輯頁用，4 欄網格卡片，照 Figma 畫稿） ============ */
/* 卡片本身只是排版容器（icon 方塊 + 名稱垂直堆疊），不畫邊框／底色——
   這點刻意不跟著深色主題的 --color-surface 變數走：這些圖示方塊本身就是自帶陰影的
   白色小卡片（像 App 圖示那樣），不是一般隨頁面背景換色的表單元件，固定白底才對得起
   Figma 原稿，也才看得出陰影 */
.category-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 60px);
  justify-content: space-between;
  gap: 4px 21px;
}
.category-picker-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-height: 0;
  /* 這張卡片本身是 <button>，不蓋掉全站按鈕預設的底色／內距會吃到主色背景 */
  background: none;
  padding: 0;
  min-width: 0;
}
.category-picker-card-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 1.6px 4.8px 9px rgba(22, 52, 80, 0.1);
  transition: box-shadow var(--duration-fast) var(--ease-standard);
}
/* 「更多／收回」那顆鈕的箭頭，跟其他分類圖示共用同一個白底卡片外觀，
   箭頭本身是 24x24（比真正的分類圖示 36x36 小一號，照 Figma 原稿） */
.category-picker-toggle-chevron { width: 24px; height: 24px; }
.category-picker-toggle-chevron--up { transform: rotate(180deg); }
/* 選中狀態：邊框直接畫在 icon 方塊本身（不是整張卡片），顏色用首頁導覽列同一個
   主色（teal），跟 Figma 原稿一致，不是沿用表單按鈕的靛紫色 */
.category-picker-card.is-selected .category-picker-card-icon,
.category-picker-card.is-selected .category-icon-tile--asset {
  box-shadow: inset 0 0 0 2px #00AFD5, 1.6px 4.8px 9px rgba(22, 52, 80, 0.1);
}
.category-picker-card-name {
  font-size: var(--text-c1);
  line-height: var(--line-c1);
  letter-spacing: var(--spacing-c1);
  font-weight: var(--weight-medium);
  color: #6D717F;
  text-align: center;
  width: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.category-picker-card.is-selected .category-picker-card-name { color: #00AFD5; }
.category-picker-card-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-nav-active);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}
.category-picker-card-badge svg { width: 11px; height: 11px; }
.category-picker-card.is-selected .category-picker-card-badge { opacity: 1; transform: scale(1); }

/* ============ 帳單分類管理（設定頁，跟帳單卡片一樣左滑露出刪除鈕） ============ */

/* ============ 設定頁 ============ */
section { margin-bottom: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.switch-row {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  color: var(--color-text);
}
/* 原本靠原生 checkbox 的 width/height/accent-color 撐外觀，不同瀏覽器呈現不一致，
   改成自己畫軌道＋滑塊，才能保證每個裝置上都是同一種左右滑動的開關樣式 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input[type="checkbox"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.toggle-switch .toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 999px;
  transition: background-color 0.2s ease;
  pointer-events: none;
}
.toggle-switch .toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.toggle-switch input[type="checkbox"]:checked + .toggle-slider { background: var(--color-status-paid); }
.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-switch input[type="checkbox"]:focus-visible + .toggle-slider { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* 每個來源一張卡片，欄位上下堆疊＋各自帶小標籤，手機螢幕窄也不會擠成一團 */
#gmail-sources-list { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.source-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.source-field { display: flex; flex-direction: column; gap: var(--space-1); }
.source-field-label { font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-text-muted); }
.remove-source-btn { background: var(--color-surface-muted); color: var(--color-text-muted); min-height: 44px; }
#add-source-btn { width: 100%; margin-bottom: var(--space-3); background: var(--color-surface-muted); color: var(--color-text); }
#save-sources-btn { width: 100%; }
.remove-source-btn { background: var(--color-surface-muted); color: var(--color-text-muted); min-height: 44px; }

/* 設定清單首頁：分組標題 + List Item，點進去才是細項設定 */
.settings-group { margin-bottom: var(--space-5); }
.settings-group-title {
  font-size: var(--text-c1);
  line-height: var(--line-c1);
  letter-spacing: var(--spacing-c1);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--spacing-c1);
  margin: 0 0 var(--space-2) var(--space-1);
}
.settings-list {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.settings-list-item {
  display: flex;
  flex-direction: row; /* label 標籤全域預設是 column（表單欄位用），這裡要蓋掉 */
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  min-height: 52px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--color-border);
}
.settings-list-item:last-child { border-bottom: none; }
.settings-list-item-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); }
.settings-list-item-chevron { width: 18px; height: 18px; color: var(--color-text-muted); flex-shrink: 0; }
.settings-list-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-surface-muted);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-list-item-icon svg { width: 17px; height: 17px; }
.settings-list-item-left { display: flex; align-items: center; gap: var(--space-3); }

/* 設定子頁的返回按鈕 */
.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--color-primary);
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-medium);
  text-decoration: none;
  margin-bottom: var(--space-4);
  /* 這個 class 也會套在 <button>（例如新增帳單頁的返回鈕）上，蓋掉全站 button 的預設樣式，
     讓它看起來還是像一個純文字連結，不是實心按鈕 */
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
}
.settings-back svg { width: 18px; height: 18px; }

/* ============ 月曆 ============ */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
/* ---- 月曆頁深色版（2026-11-01 照 Figma「月曆」section）---- */
/* 期間切換標題列（共用元件 periodHeader.js，Figma header-section）：箭頭在左右兩端、年月置中。
   箭頭圖示 24px，但可點範圍擴到 44px（用負 margin 讓視覺位置不變，左右箭頭仍貼齊 24px 邊界） */
.period-header { display: flex; align-items: center; justify-content: space-between; }
.period-header-title { margin: 0; font-size: var(--text-b1); line-height: var(--line-b1); font-weight: var(--weight-semibold); color: #FFFFFF; text-align: center; }
.period-header button { width: 44px; min-height: 44px; height: 44px; margin: -10px; padding: 0; background: none; color: #D2D5DB; display: flex; align-items: center; justify-content: center; }
.period-header button svg { width: 24px; height: 24px; }
.cal-top { margin-bottom: 20px; }

/* 月曆卡片：Surface black 底、圓角 20，touch-action 讓左右滑切月份時垂直捲動仍正常 */
.cal-card { background: var(--color-surface-black); border-radius: 20px; padding: 16px 16px 8px; margin-bottom: 20px; touch-action: pan-y; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  line-height: 18px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  color: var(--color-text-grey);
  margin-bottom: 4px;
}
/* 排與排的 4px 間距改成每格自己的 margin-bottom（同樣的版面；card 底部 padding 12→8 補掉最後一排多出的 4px），
   這樣收合時整排高度＋間距能一起縮成 0，不會留下一條條空隙 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 0; }
.cal-cell {
  height: 44px;
  margin-bottom: 4px;
  padding: 2px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: #FFFFFF;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-medium);
  min-height: 0;
}
.cal-cell.empty { visibility: hidden; }
/* 2026-11-23 收合成兩週：沒留下的排高度縮成 0＋淡出（轉場讓月曆、小把手、列表高度同一條緩入緩出曲線同時變化）。
   JS 量測終點時加 .is-measuring 暫時關掉所有轉場 */
:root { --cal-ease: cubic-bezier(0.45, 0, 0.25, 1); --cal-ms: 360ms; }
/* 不做淡出（半透明的格子疊著會有殘影感，2026-11-23 Amber 回報）：收起的排只靠高度縮成 0＋被裁切，像捲起來 */
.cal-cell { transition: height var(--cal-ms) var(--cal-ease), padding var(--cal-ms) var(--cal-ease), margin-bottom var(--cal-ms) var(--cal-ease); }
.cal-cell.is-folded { height: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0; overflow: hidden; pointer-events: none; }
/* 小把手：收合時才展開出現（高度與淡入跟著同一條曲線），平時不佔空間 */
.cal-handle { display: flex; width: 100%; min-height: 0; max-height: 0; padding: 0; border: 0; background: none; justify-content: center; opacity: 0; overflow: hidden; pointer-events: none; transition: max-height var(--cal-ms) var(--cal-ease), padding var(--cal-ms) var(--cal-ease), opacity var(--cal-ms) var(--cal-ease); }
.cal-handle span { display: block; width: 36px; height: 4px; border-radius: 2px; background: #6D717F; } /* Figma Grey-500 */
.cal-card.is-collapsed .cal-handle { max-height: 16px; padding-top: 8px; opacity: 1; pointer-events: auto; }
.cal-card.is-measuring, .cal-card.is-measuring * { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .cal-cell, .cal-handle { transition: none; } }
.cal-day-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; transition: background-color var(--motion-fade) var(--ease-out), color var(--motion-fade) var(--ease-out), box-shadow var(--motion-fade) var(--ease-out); }
/* 今天：只有藍色數字（沒有外圈）；選中：黃色實心圓＋深色數字；今天＋選中：黃底再加藍色細框 */
.cal-cell.is-today .cal-day-num { color: #00AFD5; }
.cal-cell.is-selected .cal-day-num { background: #EDF039; color: var(--color-surface-black); }
.cal-cell.is-selected.is-today .cal-day-num { box-shadow: 0 0 0 1.5px #00AFD5 inset; }
/* 圓點依帳單狀態上色：逾期紅／即將到期黃／已繳綠，一天最多 3 顆；大於 3 天（一般）不亮圓點（見 calendar.js） */
.cal-dots { display: flex; gap: 3px; height: 4px; align-items: center; justify-content: center; }
.cal-dots .cal-dot { width: 4px; height: 4px; border-radius: 50%; }
.cal-dot.status-overdue, .cal-dot.status-dueToday { background: #EE443F; }
.cal-dot.status-dueSoon { background: #FFAA00; }
.cal-dot.status-normal { background: #00AFD5; }
.cal-dot.status-paid { background: #43B75D; }

/* 下方清單區：標題＋沿用首頁的深色帳單列（清單自己捲動，上面的月曆不動） */
.cal-list-wrap { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 0 1 auto; }
.page--dark > .cal-list-wrap { flex-shrink: 1; }
.cal-list-title { margin: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: var(--color-loading-text); text-transform: none; }
.bill-list--dark.is-cal-morphing .bill-card-wrapper.is-staying { background: var(--color-surface-black); z-index: 1; }
.bill-list--dark.is-cal-morphing .bill-card-wrapper.is-entering { z-index: 0; }
.cal-list-wrap .bill-list--dark { flex: 0 1 auto; min-height: 0; overflow-y: auto; }

/* ============ 彈窗共用動畫（見 :root 的 --motion-* token）============ */
@keyframes motion-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* 彈性進場：用關鍵影格讓「衝過頭 10px」固定，不會因為彈窗高度不同而放大；數字同 sheetMotion.js sheetInFrames */
@keyframes motion-sheet-in {
  0% { transform: translateY(100%); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  62% { transform: translateY(-10px); animation-timing-function: cubic-bezier(0.33, 0, 0.2, 1); }
  100% { transform: translateY(0); }
}
@keyframes motion-dialog-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes motion-dropdown-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes motion-dropdown-in-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ 提示卡 / 確認彈窗 ============ */
.toast {
  position: fixed;
  left: 50%;
  /* 位置：導覽列膠囊（距底 8、高 64）上方再留 8px */
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #F3FFFE;
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-toast-out) var(--ease-in), transform var(--motion-toast-out) var(--ease-in);
  z-index: var(--z-toast);
  max-width: 90vw;
  text-align: center;
}
/* 帶「復原」按鈕的提示（showUndoToast）：要能點，所以開 pointer-events */
.toast.toast--action { pointer-events: auto; display: flex; align-items: center; gap: 16px; }
.toast-action { background: none; border: 0; padding: 0; min-height: 0; color: var(--color-cta-bg); font: inherit; font-weight: var(--weight-semibold); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); transition: opacity var(--motion-toast-in) var(--ease-out), transform var(--motion-toast-in) var(--ease-out); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Figma Pop-Up 寬 303（375 寬螢幕左右各留 36） */
  padding: 0 36px;
  z-index: var(--z-modal);
  animation: motion-fade-in var(--motion-dialog-in) var(--ease-out);
}
/* 離場：先播 120ms 淡出再移除（modal.js removeModalOverlay）；離場期間不能再被點 */
.modal-overlay.is-closing { opacity: 0; pointer-events: none; transition: opacity var(--motion-dialog-out) var(--ease-in); }
.modal-overlay.is-closing .modal-card { opacity: 0; transform: scale(0.97); transition: opacity var(--motion-dialog-out) var(--ease-in), transform var(--motion-dialog-out) var(--ease-in); }
/* 2026-11-01 照 Figma Pop-Up（node 4437:24900）校正：底色 Grey/50、1.5px Grey/100 邊框、
   圓角 24、內距 24、區塊間距 24、雙層陰影 */
.modal-card {
  background: #F9FAFB;
  border: 1.5px solid #F3F4F6;
  border-radius: 24px;
  padding: 24px;
  max-width: 303px;
  width: 100%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12), 0 15px 35px rgba(103, 110, 118, 0.08);
  animation: motion-dialog-in var(--motion-dialog-in) var(--ease-out);
}
.modal-card h3 { margin: 0 0 4px; font-size: 18px; line-height: 1.4; letter-spacing: 0; font-weight: 600; color: #131927; }
.modal-card p { margin: 0 0 24px; font-size: 14px; line-height: 1.5; letter-spacing: 0.21px; color: #6D717F; }
.modal-actions { display: flex; gap: 16px; }
/* 按鈕：高 48 全圓角，字 16 semibold。預設＝實心青（Primary/500），.modal-btn-outline＝白底青框青字；
   刪除這類危險動作用 outline、取消用實心，照 Figma（確認刪除＝外框、取消＝實心） */
.modal-actions button {
  flex: 1;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  /* 文字用 flex 置中，不靠上下 padding 撐（padding+行高+框線會超過 48，文字就往下掉） */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 999px;
  border: 1.5px solid #00AFD5;
  background: #00AFD5;
  color: #FFFFFF;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0;
  font-weight: 600;
  white-space: nowrap;
}
.modal-actions button.modal-btn-outline { background: #FFFFFF; color: #00AFD5; }
/* 三個選項的彈窗（刪除循環帳單）：按鈕直向排列、各自撐滿寬度 */
.modal-actions--stack { flex-direction: column; }

.blocking-overlay { z-index: var(--z-blocking); }
.blocking-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.blocking-card p { margin: var(--space-3) 0 0; }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--color-surface-muted);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 帳單 Sheet：照 Figma（2026-10-30）逐項校正的細節 ============
   放在檔案最後面，讓同樣權重的規則以這裡為準 */
/* 設定列：列高 53（上下 16 + 一行 21），日期列的觸發鈕不能再撐 44px 高 */
.bill-sheet-panel .date-row-trigger { min-height: 21px; }
.bill-sheet-panel .date-row-trigger svg { width: 20px; height: 20px; color: #9EA2AE; stroke-width: 1.5; }
.bill-sheet-panel .date-row-right { gap: 8px; }
.bill-sheet-panel .date-row-value { font-weight: var(--weight-regular); }
/* 已選日期：主色 #00AFD5 + Medium */
.bill-sheet-panel .date-row-value--selected { color: #00AFD5; font-weight: var(--weight-medium); }
/* 下拉選單列：拿掉輸入框的外框跟底色（之前「永不」旁邊那圈奇怪的框就是這個），只留文字＋上下箭頭 */
.bill-sheet-panel .list-row .custom-select-trigger {
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  gap: 8px;
  color: #131927;
  font-weight: var(--weight-medium);
}
.bill-sheet-panel .list-row { min-height: 0; }
/* 展開的選單／月曆浮層：白底，才不會跟 grey-50 的列糊在一起 */
.bill-sheet-panel .custom-select-panel,
.bill-sheet-panel .date-calendar-panel { background: #FFFFFF; box-shadow: 0 4px 16px rgba(19, 25, 39, 0.16); }
/* 開關：Figma 44x24，關＝#E5E7EA，開＝#00AFD5，圓點直徑 20 */
.bill-sheet-panel .toggle-switch { width: 44px; height: 24px; }
.bill-sheet-panel .toggle-switch .toggle-slider { background: #E5E7EA; }
.bill-sheet-panel .toggle-switch .toggle-slider::before { width: 20px; height: 20px; left: 2px; top: 2px; box-shadow: none; }
.bill-sheet-panel .toggle-switch input[type="checkbox"]:checked + .toggle-slider { background: #00AFD5; }
.bill-sheet-panel .toggle-switch input[type="checkbox"]:checked + .toggle-slider::before { transform: translateX(20px); }
/* 訂閱名稱輸入框：標籤與輸入框間距 8、外框 1.5px #E5E7EA、圓角 12、內距 8/12、字 14 Regular、提示文字 #9EA2AE */
.bill-sheet-panel .form-field-group label { gap: 8px; font-size: 14px; line-height: 21px; letter-spacing: 0.02em; color: #6D717F; }
.bill-sheet-panel #subscription-name-input {
  min-height: 0;
  padding: 8px 12px;
  border: 1.5px solid #E5E7EA;
  border-radius: 12px;
  background: #FFFFFF;
  font-size: 14px;
  line-height: 21px;
  font-weight: var(--weight-regular);
  color: #131927;
}
.bill-sheet-panel #subscription-name-input::placeholder { color: #9EA2AE; }
.bill-sheet-panel #subscription-name-input:focus { border-color: #00AFD5; }
.bill-sheet-panel #subscription-name-input.is-invalid { border-color: var(--color-status-overdue); }
/* 群組之間統一用 Sheet 的 16px 間距，不要再各自疊加 */
.bill-sheet-panel .form-field-group { gap: 16px; }


/* 下滑關閉 Sheet 時不要讓動作「傳給」整頁：Sheet 內容捲到底／頂時繼續滑，不會拉動後面的頁面（橡皮筋）。
   html／body 也一併關掉橡皮筋，不然手指不在 Sheet 範圍內滑動時整頁還是會被拉動 */
.bill-sheet-scroll { overscroll-behavior: contain; }
html.page-dark, body.page-dark { overscroll-behavior: none; }

/* ===== 2026-10-30 第二輪 Figma 校正 ===== */
/* 月曆預設浮在欄位上方；上方放不下才放下方（JS 加 is-below） */
.date-calendar-panel { top: auto; bottom: calc(100% + 4px); animation: motion-dropdown-in-up var(--motion-fade) var(--ease-out); }
.date-calendar-panel.is-below { top: calc(100% + 4px); bottom: auto; animation-name: motion-dropdown-in; }

/* 設定列的下拉選單（重複帳單／訂閱規則）：照 Figma 做成白色圓角卡片，寬 160、靠右、
   底部對齊並「蓋住」這一列（往上展開），選項每列高 53，目前選中的前面打勾 */
.bill-sheet-panel .list-row .custom-select-panel {
  top: auto;
  bottom: -1px;
  left: auto;
  right: 0;
  width: 160px;
  min-width: 160px;
  padding: 0;
  border-radius: 20px;
  background: #FFFFFF;
  box-shadow: 0 4px 24px rgba(19, 25, 39, 0.16);
  overflow: hidden;
  max-height: none;
}
.bill-sheet-panel .list-row .custom-select-option {
  position: relative;
  min-height: 53px;
  padding: 0 16px 0 40px;
  border-radius: 0;
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: #131927;
  background: none;
}
.bill-sheet-panel .list-row .custom-select-option:hover { background: none; }
.bill-sheet-panel .list-row .custom-select-option.is-selected::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23131927' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* 重複帳單的選單：「永不」跟其他週期之間有一條分隔線（Figma） */
.bill-sheet-panel .custom-select-panel[data-name="repeatRule"] .custom-select-option:first-child,
.bill-sheet-panel .custom-select-panel[data-name="repeatRule"] .scroll-ind-anchor + .custom-select-option { border-bottom: 1.5px solid #E5E7EA; }

/* 沒有真實圖示素材時的備用方塊：圓角比照房租那顆（16px），不要用比較小的 10px */
.category-picker-card .category-icon-tile { border-radius: 16px; }

/* 載入中進度條高度 8px → 6px（Figma） */
.loading-progress { height: 6px; }

/* 「自動產生下一期帳單」開關下方的說明小字（Figma 4437:24899）：青色 12px，前面一顆資訊圖示，跟卡片左右對齊 */
.active-status-hint { margin: -8px 0 0; padding: 0 12px; font-size: 12px; line-height: 18px; letter-spacing: 0.015em; color: #00AFD5; display: flex; align-items: center; gap: 4px; min-height: 18px; }
.active-status-hint svg { flex-shrink: 0; display: block; }
.active-status-hint span { display: block; line-height: 16px; }

/* 金額沒填就想標已繳費（Figma 4463:20645）：金額標題變紅，底線下方出現紅色說明，填了金額就恢復 */
.amount-field.is-invalid .field-label { color: #EE443F; }
.amount-error-text { display: none; margin: 4px 0 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); color: #EE443F; }
.amount-field.is-invalid ~ .amount-error-text { display: block; }

/* ============ 整頁「載入失敗」畫面（Figma 4479:23118、4479:23074，元件見 components/loadError.js） ============
   整頁蓋掉（含底部導覽列），疊層順序比 toast／彈窗低、比一般內容高 */
.load-error {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-dark);
  /* 下拉手勢要自己處理，不讓瀏覽器把它當成頁面捲動 */
  touch-action: none;
  overscroll-behavior: none;
  /* 拉動時不要選到文字或拖出圖片 */
  user-select: none;
  -webkit-user-select: none;
}
.load-error-image { -webkit-user-drag: none; pointer-events: none; }
.load-error-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px;
}
.load-error-image { width: 160px; height: 120px; object-fit: fill; display: block; }
.load-error-image--page { height: 124px; }
.load-error-text { margin: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); color: var(--color-text-grey); text-align: center; }
.load-error-hint { margin: 0; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); font-weight: var(--weight-medium); color: var(--color-text-grey); text-align: center; }
/* 「頁面載入失敗」文字與按鈕之間 12px，兩者都撐滿插圖寬度（160） */
.load-error-action { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 160px; }
.load-error-btn {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: #00AFD5; /* Figma Primary/500 */
  color: #FFFFFF;
  font-size: 14px;
  line-height: 16px;
  font-weight: var(--weight-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 下拉重新整理的轉圈圈：平常看不到，拉的時候跟著畫面往下露出來 */
.load-error-pull-spinner {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 56px);
  left: 50%;
  width: 24px;
  height: 24px;
  opacity: 0;
  transform: translate(-50%, -28px);
}
/* 轉動的圓環放在內層：外層只負責位置（translate），內層只負責旋轉。
   不能在同一個元素上同時用 transform 定位又用 rotate 轉，瀏覽器會先轉再位移，
   位移量跟著轉，圓圈就繞著奇怪的軌跡跑（2026-11-03 真機實測發現） */
.load-error-pull-spinner::before {
  content: '';
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 2.5px solid rgba(158, 162, 174, 0.35);
  border-top-color: var(--color-text-grey);
  border-radius: 50%;
}
.load-error-pull-spinner.is-ready::before { border-top-color: #00AFD5; }
.load-error-pull-spinner.is-spinning::before { border-top-color: #00AFD5; animation: load-error-spin 0.8s linear infinite; }
@keyframes load-error-spin { to { transform: rotate(360deg); } }

/* 同分類重複提示（Figma 4479:22735）：卡片下方紅字 12px Medium，到期日的字一起變紅 */
.duplicate-hint { margin: -8px 0 0; padding: 0 12px; font-size: 12px; line-height: 18px; letter-spacing: 0.02em; font-weight: var(--weight-medium); color: #EE443F; }
.duplicate-hint:empty { display: none; }
.bill-sheet-panel .date-row-trigger.has-duplicate .date-row-value { color: #EE443F; }
/* 日期沒選就按新增：照 Figma 只有右邊「選擇日期」變紅字，不畫紅框（2026-11-19 Amber 回報實機畫了紅框，跟 Figma 不符） */
.bill-sheet-panel .date-row-trigger.is-invalid { box-shadow: none; }
.bill-sheet-panel .date-row-trigger.is-invalid .date-row-value { color: #EE443F; }

/* 提示框（Figma 4436:11296）：黑 60% 底、無框線 */
.toast { background: rgba(0, 0, 0, 0.6); border: 0; }

/* 載入中文字後面的「. → .. → ...」依序出現動畫（1.2 秒一輪）：三個點都先佔位，只切換透明度；
   第 1、2、3 個點分別在 0%、25%、50% 亮起，一起在 85% 熄掉，再重頭來 */
.loading-dots > span { opacity: 0; animation: 1.2s infinite step-end; }
.loading-dots > span:nth-child(1) { animation-name: loading-dot-1; }
.loading-dots > span:nth-child(2) { animation-name: loading-dot-2; }
.loading-dots > span:nth-child(3) { animation-name: loading-dot-3; }
@keyframes loading-dot-1 { 0% { opacity: 1; } 85% { opacity: 0; } }
@keyframes loading-dot-2 { 0% { opacity: 0; } 25% { opacity: 1; } 85% { opacity: 0; } }
@keyframes loading-dot-3 { 0% { opacity: 0; } 50% { opacity: 1; } 85% { opacity: 0; } }

/* ---- 總覽頁深色版（2026-11-03 照 Figma「總覽」section）---- */
/* 月／年小分頁：每格 62×40（Figma Button Size=Medium）、寬 124，置中（Figma overview-mode-tabs） */
.filter-tabs.yearly-tabs { width: 124px; padding: 0; margin: 0 auto 20px; }
/* 文字照 Figma Button Font/Medium（14／Semi Bold／行高 16／字距 0）；2026-11-09 曾用 Medium，2026-11-21 Amber 覺得深色底偏細，改 Semi Bold */
.yearly-tabs .filter-tab { min-height: 40px; font-family: var(--font-sans); font-size: 15px; line-height: 16px; letter-spacing: 0; font-weight: var(--weight-semibold); }
/* 期間卡片：深色圓角卡，左上角年月藥丸（點了彈出滾輪面板）、下方左右箭頭夾著半圓甜甜圈 */
.yearly-card { display: flex; flex-direction: column; align-items: flex-start; background: var(--color-surface-black); border-radius: 20px; padding: 20px; margin-bottom: 20px; }
.yearly-period-btn {
  display: inline-flex; align-items: center; gap: 4px;
  width: auto; height: 29px; min-height: 0; padding: 0 8px 0 14px;
  border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.1); color: #FFFFFF;
  font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium);
}
.yearly-period-btn svg { width: 16px; height: 16px; }
.yearly-summary { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 0 24px; }
/* 箭頭圖示 24px，可點範圍撐到 44px（負邊距讓圖示維持在原位置） */
.yearly-arrow { flex-shrink: 0; width: 44px; height: 44px; min-height: 44px; margin: -10px; padding: 0; background: none; color: #D2D5DB; display: flex; align-items: center; justify-content: center; }
.yearly-arrow svg { width: 24px; height: 24px; }
.yearly-arrow:disabled { opacity: 0.3; pointer-events: none; }
/* 切換期間時清單區的載入中／載入失敗（Figma「總覽-切換期間-載入中／載入失敗」） */
.yearly-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0 0; }
.yearly-state--error { padding-top: 8px; }
.yearly-state-text { margin: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); color: var(--color-text-grey); text-align: center; }
.yearly-state-text--loading { color: rgba(255, 255, 255, 0.6); }
.yearly-state-image { display: block; }
.yearly-state-btn { width: 160px; }
/* 半圓甜甜圈：240×132，沒有卡片底色；圓心文字最大寬 140、只有金額置中，$ 絕對定位掛在金額左邊 */
.yearly-donut { position: relative; width: 240px; height: 132px; flex-shrink: 0; }
.yearly-donut-svg { display: block; overflow: visible; }
.yearly-donut-total {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
}
.yearly-donut-total-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: var(--color-loading-text); }
.yearly-donut-total-amount { position: relative; font-size: 32px; line-height: 40px; font-weight: var(--weight-medium); font-family: var(--font-number); letter-spacing: 0; color: #FFFFFF; }
.yearly-donut-currency { position: absolute; right: 100%; bottom: 0; margin-right: 4px; font-size: var(--text-b3); line-height: var(--line-b3); font-weight: var(--weight-regular); color: var(--color-loading-text); }
/* 分類明細清單卡：跟首頁帳單清單同一個深色圓角容器，自己捲動、上方內容不動 */
.yearly-list-card { background: var(--color-surface-black); border-radius: 20px; padding: 8px 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 0 1 auto; }
.yearly-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 20px; }
.yearly-row:not(:last-child)::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: 0; height: 1px; background: #394050; }
.yearly-row-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; }
.yearly-row-name { flex: 1; min-width: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: #FFFFFF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yearly-row-amount { flex-shrink: 0; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-regular); color: #FFFFFF; font-family: var(--font-number); }
/* 佔比固定 40px 寬、靠右，讓每列的金額左邊界一致（Figma：C2 12 Medium 灰） */
.yearly-row-share { flex-shrink: 0; width: 40px; text-align: right; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); font-weight: var(--weight-medium); color: var(--color-text-grey); }

/* 空狀態：整個 App 通用——清單裡沒有項目時不要深色卡片底，插圖與文字直接落在漸層背景上
   （Figma「空狀態」元件，Amber 2026-11-03 全局改動；:has 讓首頁切分頁、刪到沒有時也即時生效） */
.bill-list--dark:has(> .bill-empty-state), /* 只認直接子層：月曆切換時暫放的殘影裡也有空狀態，不能被誤判成「現在是空的」 */
.yearly-list-card:has(.bill-empty-state) { background: none; padding: 0; }

/* 總覽：年月標題＋甜甜圈整塊可左右滑動；touch-action 讓垂直捲動照常 */
.yearly-summary { touch-action: pan-y; }

/* ---- 總覽「選擇年月／年份」底部滾輪面板（Figma period-wheel-month／period-wheel-year）---- */
.period-picker-overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0.6); animation: motion-fade-in var(--motion-in) var(--ease-out); }
.period-picker-overlay.is-closing { opacity: 0; pointer-events: none; transition: opacity var(--motion-sheet-out) var(--ease-out); }
.period-picker-sheet {
  width: 100%; box-sizing: border-box;
  background: var(--color-surface-black); border-radius: 24px 24px 0 0;
  padding: 24px 24px calc(36px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px;
  animation: motion-sheet-in var(--motion-sheet-in) var(--ease-out);
  box-shadow: 0 48px 0 0 var(--color-surface-black); /* 衝過頭時底下不露空隙：在面板下方多畫一塊同色 */
}
.period-picker-sheet { position: relative; }
/* 面板上緣的拖曳區（往下拉可取消）；標題列蓋在上面，但只有 ✕ 接收點擊，其餘讓手勢穿透給拖曳區 */
.period-picker-grab { position: absolute; top: 0; left: 0; right: 0; height: 72px; touch-action: none; }
.period-picker-head { position: relative; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.period-picker-close { pointer-events: auto; }
/* 面板上緣的小橫槓（Figma handle：40×4、白 60%、距上緣 8），提示可以往下拉取消；深色底上白 30% 對比太低 */
.period-picker-sheet::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(255, 255, 255, 0.6); pointer-events: none; }
.period-picker-title { margin: 0; font-size: var(--text-s1); line-height: var(--line-s1); font-weight: var(--weight-semibold); color: #FFFFFF; }
.period-picker-close { width: 44px; height: 44px; min-height: 44px; margin: -10px; padding: 0; background: none; color: #FFFFFF; display: flex; align-items: center; justify-content: center; }
.period-picker-close svg { width: 24px; height: 24px; }
.period-picker-wheels { position: relative; height: 220px; display: grid; grid-template-columns: 1fr; gap: 17px; }
.period-picker-wheels.has-month { grid-template-columns: 1fr 1fr; }
/* 選中那一格的底條：固定在正中間（上下各留 2 格 × 44px） */
.period-picker-bar { position: absolute; left: 0; right: 0; top: 88px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.1); pointer-events: none; }
.period-wheel { position: relative; height: 220px; overflow: hidden; touch-action: none; /* 手指由 periodPicker.js 自己處理（先快後慢的停定位），不用內建捲動與吸附 */ }
.period-wheel::-webkit-scrollbar { display: none; }
.period-wheel-inner { padding: 88px 0; }
.period-wheel-item { height: 44px; display: flex; align-items: center; justify-content: center; color: #FFFFFF; font-weight: var(--weight-medium); user-select: none; -webkit-user-select: none; }
/* 距離中間越遠越小越淡：選中 S1 18 粗體白、相鄰 B2 16 白 50%、遠處 B4 14 白 30% */
.period-wheel-item[data-d="0"] { font-size: var(--text-s1); font-weight: var(--weight-semibold); opacity: 1; }
.period-wheel-item[data-d="1"] { font-size: 16px; opacity: 0.5; }
.period-wheel-item[data-d="2"] { font-size: var(--text-b3); opacity: 0.3; }
.period-picker-confirm { height: 52px; border-radius: var(--radius-pill); background: var(--color-cta-bg); color: var(--color-surface-black); font-size: var(--text-b1); font-weight: var(--weight-semibold); }

/* ============ 設定頁深色版（2026-11-11 照 Figma「設定」section）============ */
/* 設定首頁＋推播通知（之後帳單分類、Gmail 來源也用同一套）。主容器同時帶 page--dark（深色底）
   和 page--settings（這裡的樣式）。數值全部取自 Figma：頁面左右 24、區塊間距 24；
   卡片 Grey/900 #131927 圓角 20；列 padding 14/20（高 52）；分隔線 Grey/700 左右各縮 16 */
.page--settings { gap: var(--space-5); padding-bottom: calc(var(--space-5) + 72px + env(safe-area-inset-bottom)); }
.page--settings.page--no-nav { padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); }
.page--settings h1 { margin: 0; color: #FFFFFF; }
.page--settings .settings-group { margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.page--settings .settings-group-title {
  margin: 0;
  font-size: var(--text-b3);
  line-height: var(--line-b3);
  letter-spacing: var(--spacing-b3);
  font-weight: var(--weight-medium);
  text-transform: none;
  color: var(--color-loading-text); /* Figma text-light-grey #D2D5DB */
}
.page--settings .settings-list {
  background: var(--color-surface-black);
  border-radius: 20px;
  box-shadow: none;
  overflow: hidden;
}
.page--settings .settings-list-item {
  position: relative;
  padding: 14px 20px;
  min-height: 52px;
  border-bottom: none;
  color: #FFFFFF;
}
.page--settings .settings-list-item + .settings-list-item::before {
  content: '';
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 1px;
  background: #394050; /* Figma Grey/700 */
}
.page--settings .settings-list-item-left { gap: var(--space-3); }
.page--settings .settings-list-item-icon { width: 24px; height: 24px; border-radius: 0; background: none; color: #FFFFFF; }
.page--settings .settings-list-item-icon svg { width: 24px; height: 24px; }
.page--settings .settings-list-item-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: #FFFFFF; }
.page--settings .settings-list-item-chevron { width: 24px; height: 24px; color: var(--color-loading-text); }
.page--settings .settings-list-item-chevron svg { width: 24px; height: 24px; display: block; }
.page--settings .settings-list-item-note { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); color: var(--color-text-grey); }

/* 開關（深色版）：軌道 44×24 圓角 16、圓點 20；關＝Grey/700＋白點，開＝Accent 黃＋深色點 */
.page--settings .toggle-switch { width: 52px; height: 32px; } /* 2026-11-12 照 Figma 放大（原 44×24），好點好看 */
.page--settings .toggle-switch .toggle-slider { background: #394050; border-radius: 16px; }
.page--settings .toggle-switch .toggle-slider::before { width: 28px; height: 28px; left: 2px; top: 2px; box-shadow: none; background: #FFFFFF; }
.page--settings .toggle-switch input[type="checkbox"]:checked + .toggle-slider { background: var(--color-cta-bg); }
.page--settings .toggle-switch input[type="checkbox"]:checked + .toggle-slider::before { transform: translateX(20px); background: var(--color-surface-black); }
.page--settings .toggle-switch input[type="checkbox"]:focus-visible + .toggle-slider { outline-color: var(--color-cta-bg); }

/* 返回設定：箭頭 24、文字 B4 淺灰，間距 4 */
.page--settings .settings-back { gap: 4px; margin: 0; color: var(--color-loading-text); font-weight: var(--weight-medium); }
.page--settings .settings-back svg { width: 24px; height: 24px; }

/* 外框按鈕（測試推播）：Accent 黃描邊 1.5、文字黃、圓角全圓、高 48 */
.page--settings button.secondary {
  width: 100%;
  min-height: 48px;
  background: transparent;
  color: var(--color-cta-bg);
  border: 1.5px solid var(--color-cta-bg);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-semibold);
}


/* ============ 帳單分類頁（2026-11-11 照 Figma） ============ */
/* 8pt 網格：列 56 ＝ 上 8 ＋ 內容 40 ＋ 下 8；分隔線在列底部、左右縮進 16（Grey/700）；
   左滑刪除塊＝列高 − 16（就是 40 高的裁切容器），圓角 12，右側兩角跟著容器變圓 */
.swipe-list-page { min-height: 0; }
.swipe-list-card {
  background: var(--color-surface-black);
  border-radius: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 0 1 auto;
  min-height: 0;
}
.swipe-row-wrapper { --swipe-gap: 4px; position: relative; padding: 8px 16px; }
.swipe-row-wrapper:not(.is-last)::after {
  content: '';
  position: absolute;
  left: 16px; right: 16px; bottom: 0;
  height: 1px;
  background: #394050;
}
.swipe-row-clip { position: relative; height: var(--row-h, 48px); overflow: hidden; border-radius: 12px; transform: translateZ(0); -webkit-transform: translateZ(0); }
.swipe-row {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--row-h, 48px);
  padding: 0 4px;
  background: var(--color-surface-black);
  touch-action: pan-y;
  color: #FFFFFF;
}
.category-row-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; }
.category-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); }
/* 圓底鉛筆鈕：視覺 40，點擊範圍用 ::before 往外多 2px（共 44） */
.row-edit-btn {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-cta-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-edit-btn::before { content: ''; position: absolute; inset: -2px; }
.row-edit-btn svg { width: 24px; height: 24px; }
.swipe-row-delete {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: var(--swipe-delete-w);
  min-height: 0;
  padding: 0; /* 寬度固定 64（Figma swipe-delete），文字置中 */
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 0;
  background: #EE443F;
  color: #FFFFFF;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.24px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  opacity: 0; /* 平常隱形，滑開才顯示（swipe.js 控制） */
}

/* 按鈕：列表短時跟在卡片後面；列表長時（.is-long）切成底部固定，卡片自己捲動，
   卡片下緣停在按鈕上緣（按鈕高 48＋下方留白 24＋安全區 → 頁面底部留 72＋安全區，2026-11-12 照 Figma Gmail 長列表） */
.swipe-list-page.is-long { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.swipe-list-page.is-long .swipe-list-card { flex: 1 1 auto; }
.swipe-list-page.is-long .list-add-inline { display: none; }
.page-footer {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(31, 70, 87, 0) 0%, #20495E 40%, #214C5E 100%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: var(--z-nav);
}
.page-footer button { width: 100%; }
.swipe-list-page.is-long .page-footer { display: block; }

/* ============ 淺色底部彈窗（新增／編輯分類、Gmail 來源共用，Figma source-form-sheet 同系列） ============ */
.form-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6); /* Figma scrim：Black 60% */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: var(--z-modal);
  animation: motion-fade-in var(--motion-in) var(--ease-out);
}
.form-sheet-overlay.is-closing { opacity: 0; pointer-events: none; transition: opacity var(--motion-sheet-out) var(--ease-out); }
.form-sheet {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 86px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  color: #131927;
  animation: motion-sheet-in var(--motion-sheet-in) var(--ease-out);
  box-shadow: 0 48px 0 0 #FFFFFF; /* 衝過頭時底下不露空隙 */
  /* 彈窗內是淺色，沿用新增帳單頁的淺色變數 */
  --color-text: #131927;
  --color-text-muted: #6D717F;
  --color-border: #E5E7EA;
}
.form-sheet-handle-wrap { padding: 12px 0; display: flex; justify-content: center; flex-shrink: 0; touch-action: none; cursor: grab; }
.form-sheet-handle { width: 36px; height: 4px; border-radius: var(--radius-pill); background: #D1D1D3; }
.form-sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 36px; display: flex; flex-direction: column; gap: 16px; }
.form-sheet-body > * { flex-shrink: 0; }
.form-sheet-head { display: flex; align-items: center; gap: 16px; }
.form-sheet-title { flex: 1; margin: 0; font-size: var(--text-s1); line-height: var(--line-s1); font-weight: var(--weight-semibold); letter-spacing: 0; color: #131927; text-transform: none; }
.form-sheet-close {
  flex-shrink: 0;
  width: 40px; height: 40px; min-height: 0;
  padding: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  color: #00AFD5;
  display: flex; align-items: center; justify-content: center;
}
.form-sheet-close svg { width: 24px; height: 24px; }
.form-sheet-field { display: flex; flex-direction: column; gap: 8px; font-weight: var(--weight-regular); }
.form-sheet-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: #131927; }
/* 輸入框：Figma Input Outline（白底、1.5px 灰框、圓角 10）。字級用 16px 而不是 Figma 的 14px：
   iPhone Safari 輸入框字小於 16px 時，點進去會自動放大整個畫面，很干擾 */
.form-sheet input[type="text"], .form-sheet input:not([type]) {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  background: #FFFFFF;
  border: 1.5px solid #E5E7EA;
  border-radius: 10px;
  color: #131927;
  font-size: 16px;
  line-height: 24px;
}
.form-sheet input:focus { border-color: #00AFD5; outline: none; }
.form-sheet input.is-invalid, .form-sheet input.is-invalid:focus { border-color: var(--color-status-overdue); }
.form-sheet-error { font-weight: var(--weight-regular); font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-status-overdue); }
.form-sheet-error[hidden] { display: none; }
.form-sheet-footer { flex-shrink: 0; padding: 12px 36px calc(24px + env(safe-area-inset-bottom)); background: #FFFFFF; }
.form-sheet-save {
  width: 100%;
  height: 48px;
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0;
  font-weight: var(--weight-semibold);
}

/* 色票：12 色 × 兩排，40 的圓、選中時深色外圈 2px；已被其他（或自己）分類使用的中間有小黑點 */
.color-field { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 12px; }
.swatch-grid { display: grid; grid-template-columns: repeat(6, 40px); justify-content: space-between; gap: 8px 0; }
.swatch {
  position: relative;
  width: 40px; height: 40px; min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
}
.swatch::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--swatch); }
.swatch.is-used::after { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #131927; }
.swatch.is-selected { border-color: #131927; }
.color-hint { margin: 0; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: #6D717F; }
.color-hint[hidden] { display: none; }

/* 「還有帳單在用」阻擋彈窗裡的清單：警告色圓點＋名稱＋月份，整段（含空白）同一條底線，可點 */
.modal-card-lead { margin: 0 0 12px; }
.blocked-bill-list { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.blocked-bill-item { display: inline-flex; align-items: center; gap: 8px; color: #131927; text-decoration: none; }
.blocked-bill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-warning); flex-shrink: 0; /* Figma icon-warning */ }
.blocked-bill-text { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); text-decoration: underline; white-space: pre; }
.blocked-bill-more { font-size: var(--text-c1); line-height: var(--line-c1); color: #6D717F; padding-left: 16px; }

/* ============ Gmail 帳單來源頁（2026-11-11 照 Figma） ============ */
/* 列高 72 ＝ 上 8 ＋ 內容 56 ＋ 下 8；左滑刪除塊 56 高（列高 − 16）。其餘沿用帳單分類的共用列表樣式 */
/* 列高跟帳單分類統一（Figma list-row：內容區 48＋上下留白 8＝64），來源列兩行文字約 43 放得下 */
.page-header { display: flex; flex-direction: column; gap: 8px; }
.page-header h1 { margin: 0; }
.page-hint { margin: 0; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-text-grey); }
.source-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.source-label { font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-medium); color: #FFFFFF; }
.source-hint { font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-loading-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swipe-list-empty { display: flex; justify-content: center; padding: 24px 0; }

/* 分類下拉（Figma Dropdown／Expanded Menu）：觸發鈕高 48、圓角 16、1.5 灰框；展開時青色框＋光暈；
   選項面板在彈窗內展開（白底、圓角 8、陰影），每項高 48：左分類 icon ＋ 名稱，已選的右邊打勾 */
.category-dropdown { display: flex; flex-direction: column; gap: 8px; }
.dd-trigger {
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 48px; min-height: 0;
  padding: 12px;
  background: #FFFFFF;
  border: 1.5px solid #E5E7EA;
  border-radius: 16px;
  color: #131927;
  font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-regular);
  text-align: left;
}
.dd-trigger.is-open { border-color: #00AFD5; box-shadow: 0 0 0 3px rgba(0, 175, 213, 0.22); }
.dd-trigger:disabled { background: #F3F5F7; color: #9EA2AE; cursor: not-allowed; opacity: 1; }
.dd-icon { flex-shrink: 0; width: 24px; height: 24px; display: flex; }
.dd-icon[hidden] { display: none; }
.dd-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-text.is-placeholder { color: inherit; }
.category-dropdown.is-loading .dd-text { color: #9EA2AE; }
.dd-chevron { flex-shrink: 0; width: 24px; height: 24px; color: #9EA2AE; transform: rotate(90deg); display: flex; }
.dd-chevron svg { width: 24px; height: 24px; }
.dd-trigger.is-open .dd-chevron { color: #00AFD5; transform: rotate(-90deg); }
.dd-menu { max-height: 248px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: #FFFFFF; border-radius: 8px; padding: 8px 0; box-shadow: 0 8px 24px rgba(19, 25, 39, 0.14), 0 2px 6px rgba(19, 25, 39, 0.08); }
.dd-menu[hidden] { display: none; }
.dd-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 12px 16px 12px 12px; background: none; border-radius: 0; color: #131927; font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3); font-weight: var(--weight-regular); text-align: left; }
.dd-item:active { background: #F3F5F7; }
.dd-item-icon { flex-shrink: 0; width: 24px; height: 24px; display: flex; }
.dd-item-text { flex: 1; min-width: 0; }
.dd-item-check { flex-shrink: 0; width: 24px; height: 24px; display: flex; color: #131927; }
.dd-item-check svg { width: 24px; height: 24px; }
.dd-helper { margin: 0; font-size: var(--text-c1); line-height: var(--line-c1); letter-spacing: var(--spacing-c1); color: var(--color-text-warning); }
.dd-helper[hidden] { display: none; }
.category-glyph { display: inline-flex; } .category-glyph svg { width: 100%; height: 100%; }

/* ---------- 處理中回饋（2026-11-12）---------- */
/* 儲存鈕：儲存中保持亮色，左邊小轉圈圈＋「儲存中...」，整個彈窗內容淡一點、不能操作 */
.btn-spinner {
  flex-shrink: 0;
  width: 16px; height: 16px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.form-sheet-save.is-saving { background: #00AFD5; color: #FFFFFF; opacity: 0.9; }
.form-sheet.is-saving .form-sheet-body { opacity: 0.5; pointer-events: none; transition: opacity var(--duration-fast); }
/* 刪除／檢查中：透明遮罩擋誤觸＋跟吐司同位置的膠囊 */
.busy-scrim { position: fixed; inset: 0; z-index: var(--z-toast); background: rgba(0, 0, 0, 0.12); }
.busy-pill {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
  font-size: var(--text-b3); line-height: var(--line-b3); letter-spacing: var(--spacing-b3);
  white-space: nowrap;
}
.busy-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- 自製捲動指示條（scrollIndicator.js）---------- */
.has-scroll-indicator { scrollbar-width: none; }
.has-scroll-indicator::-webkit-scrollbar { display: none; }
.scroll-ind-anchor { position: sticky; top: 0; height: 0; z-index: 5; pointer-events: none; }
.scroll-ind-thumb {
  position: absolute; top: 0;
  width: 4px; border-radius: 2px;
  opacity: 0; transition: opacity 200ms ease;
}
.scroll-ind-thumb--dark { background: rgba(255, 255, 255, 0.4); }
.scroll-ind-thumb--light { background: rgba(19, 25, 39, 0.3); }

/* 捲動指示條：支援捲動驅動動畫的瀏覽器，位置由瀏覽器依捲動進度直接算（不經過 JS，不卡頓、橡皮筋時夾在頭尾） */
.scroll-ind-thumb { will-change: transform, opacity; }
.scroll-ind-thumb.is-driven {
  top: var(--ind-top, 12px);
  transform: translateY(0);
  animation: scroll-ind-slide linear both;
  animation-timeline: scroll(nearest block);
}
@keyframes scroll-ind-slide { to { transform: translateY(var(--ind-travel, 0px)); } }

/* ---------- 總覽換期間動畫（overviewMotion.js／donutMorph.js）---------- */
/* 主要分頁切換轉場：舊畫面的殘影蓋在原位淡出；層級在導覽列（--z-nav）下面，不能點 */
.page-transition-ghost { position: absolute; z-index: 3; pointer-events: none; }

/* 清單卡片當定位基準：消失的列複製一份絕對定位在原位淡出 */
.yearly-list-card { position: relative; }
/* 換期間動畫中：留下的列有實色底、疊在上層，進場與離場的列從它們後面滑過去 */
/* 動畫中往下退的列不要把卡片撐出捲動範圍 */
.yearly-list-card.is-morphing { overflow: hidden; }
.yearly-list-card.is-morphing .yearly-row.is-staying { background: var(--color-surface-black); z-index: 1; }
.yearly-list-card.is-morphing .yearly-row.is-entering, .yearly-list-card.is-morphing .yearly-row.is-exiting { z-index: 0; }
/* 圓心金額、年月標題在位移＋模糊時，不要被裁切，也不要影響版面 */
.yearly-donut-total-amount, .yearly-period-btn span { will-change: transform, opacity; }
.yearly-donut-total-amount.is-ghost { white-space: nowrap; }

/* 展示版小字 */
.demo-note { margin: 24px 0 0; text-align: center; font-size: 12px; line-height: 18px; color: var(--color-text-grey); }
