/* ============================================================
   app.css － 口袋日常 全站視覺（Mobile First）
   ・品牌色取自 App 圖示：口袋藍、太陽黃、珊瑚紅、米白底（v14）
   ・介面主色只用口袋藍；各功能的代表色只留在資料分類（行事曆項目、圖表等），避免畫面太花
   ・色彩、圓角、陰影、間距統一由 CSS Variables 管理
   ・動畫都很短，並尊重系統的「減少動態效果」設定
   ============================================================ */

:root {
  /* 基本色 */
  --pt-bg: #fbf6ee;
  --pt-surface: #ffffff;
  --pt-surface-2: #f8f3ea;
  --pt-text: #1b2048;
  --pt-muted: #5c6080;
  --pt-faint: #9497ad;
  --pt-border: #ede5d8;
  --pt-border-strong: #d8cfbf;

  /* 主色：口袋藍 */
  --pt-primary: #2e3db0;
  --pt-primary-hover: #25329a;
  --pt-primary-soft: #eceefb;
  --pt-primary-ink: #1e2a8c;

  /* 品牌輔色（太陽黃、珊瑚紅只做點綴，不拿來當內文顏色） */
  --pt-navy: #161c72;
  --pt-sun: #febd33;
  --pt-sun-soft: #fff3d6;
  --pt-sun-ink: #7a4f00;
  --pt-coral: #fc6150;
  --pt-coral-soft: #ffe9e5;
  --pt-coral-ink: #b8352a;

  /* 狀態色（文字都另有圖示或文字說明，不只靠顏色） */
  --pt-danger: #e2483a;
  --pt-danger-soft: #fdecea;
  --pt-danger-ink: #b0302a;
  --pt-warning: #f59f00;
  --pt-warning-soft: #fff5de;
  --pt-warning-ink: #8f5a00;
  --pt-success: #16a34a;
  --pt-success-soft: #e7f7ed;
  --pt-success-ink: #13743a;
  --pt-violet: #7c5cff;
  --pt-violet-soft: #f1edff;
  --pt-violet-ink: #5a3fd6;

  /* 各功能代表色 */
  --c-home: #2e3db0;     --c-home-soft: #eceefb;
  --c-tasks: #7c5cff;    --c-tasks-soft: #f1edff;
  --c-notes: #e8a30c;    --c-notes-soft: #fff6df;
  --c-ledger: #12a37f;   --c-ledger-soft: #e4f6f0;
  --c-settings: #64748b; --c-settings-soft: #eef1f5;
  --c-admin: #ea6a1f;    --c-admin-soft: #fff0e6;
  --c-weather: #0ea5e9;  --c-weather-soft: #e3f4fc;
  --c-stocks: #c026d3;   --c-stocks-soft: #fbe9fc;
  --c-calendar: #0d9488; --c-calendar-soft: #e0f4f1;
  --c-bills: #e11d48;    --c-bills-soft: #fde8ed;
  --c-dates: #db2777;    --c-dates-soft: #fce7f3;
  --c-links: #6366f1;    --c-links-soft: #eceefe;
  --c-zhai: #b7791f;     --c-zhai-soft: #fdf3dc;
  --c-parking: #2563eb;  --c-parking-soft: #e6eefc;

  /* 股票漲跌（台股：紅漲綠跌） */
  --stk-up: #e03131;     --stk-up-soft: #fdecec;
  --stk-down: #0ca678;   --stk-down-soft: #e3f7f0;

  /* 收支 */
  --pt-income: #16a34a;
  --pt-expense: #e5484d;

  /* 形狀與陰影 */
  --pt-radius: 20px;
  --pt-radius-sm: 14px;
  --pt-radius-xs: 10px;
  --pt-shadow: 0 1px 2px rgba(22, 28, 114, 0.04), 0 6px 18px rgba(22, 28, 114, 0.05);
  --pt-shadow-hover: 0 2px 4px rgba(22, 28, 114, 0.05), 0 12px 30px rgba(22, 28, 114, 0.1);
  --pt-shadow-pop: 0 20px 56px rgba(22, 28, 114, 0.2);

  /* 尺寸 */
  --pt-gap: 1rem;
  --pt-gap-lg: 1.5rem;
  --pt-touch: 44px;
  --pt-sidebar-w: 256px;
  --pt-topbar-h: 56px;
  --pt-tabbar-h: 66px;

  /* 動畫 */
  --pt-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pt-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --pt-ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);

  /* 字體 */
  --pt-font: system-ui, -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", "Microsoft JhengHei", sans-serif;

  /* 安全區 */
  --pt-safe-top: env(safe-area-inset-top, 0px);
  --pt-safe-right: env(safe-area-inset-right, 0px);
  --pt-safe-bottom: env(safe-area-inset-bottom, 0px);
  --pt-safe-left: env(safe-area-inset-left, 0px);

  /* 實際可見高度（app.js 依 visualViewport 更新） */
  --vvh: 100vh;

  /* 目前頁面的代表色（依 body[data-page] 切換） */
  --mod: var(--c-home);
  --mod-soft: var(--c-home-soft);

  /* 套用到 Bootstrap */
  --bs-body-bg: var(--pt-bg);
  --bs-body-color: var(--pt-text);
  --bs-body-font-family: var(--pt-font);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.6;
  --bs-border-color: var(--pt-border);
  --bs-secondary-color: var(--pt-muted);
  --bs-link-color: var(--pt-primary);
  --bs-link-color-rgb: 46, 61, 176;
  --bs-link-hover-color: var(--pt-primary-hover);
  --bs-link-hover-color-rgb: 37, 50, 154;
  --bs-primary: var(--pt-primary);
  --bs-primary-rgb: 46, 61, 176;
  --bs-border-radius: var(--pt-radius-sm);
}

body[data-page="home"] { --mod: var(--c-home); --mod-soft: var(--c-home-soft); }
body[data-page="tasks"] { --mod: var(--c-tasks); --mod-soft: var(--c-tasks-soft); }
body[data-page="notes"] { --mod: var(--c-notes); --mod-soft: var(--c-notes-soft); }
body[data-page="ledger"] { --mod: var(--c-ledger); --mod-soft: var(--c-ledger-soft); }
body[data-page="settings"] { --mod: var(--c-settings); --mod-soft: var(--c-settings-soft); }
body[data-page="admin-users"] { --mod: var(--c-admin); --mod-soft: var(--c-admin-soft); }
body[data-page="weather"] { --mod: var(--c-weather); --mod-soft: var(--c-weather-soft); }
body[data-page="stocks"] { --mod: var(--c-stocks); --mod-soft: var(--c-stocks-soft); }
body[data-page="calendar"] { --mod: var(--c-calendar); --mod-soft: var(--c-calendar-soft); }
body[data-page="bills"] { --mod: var(--c-bills); --mod-soft: var(--c-bills-soft); }
body[data-page="dates"] { --mod: var(--c-dates); --mod-soft: var(--c-dates-soft); }
body[data-page="links"] { --mod: var(--c-links); --mod-soft: var(--c-links-soft); }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  background-color: var(--pt-bg);
  background-image:
    radial-gradient(900px 420px at -10% -12%, rgba(46, 61, 176, 0.10), transparent 62%),
    radial-gradient(760px 380px at 110% -8%, rgba(18, 163, 127, 0.08), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--pt-text); font-weight: 700; letter-spacing: 0.01em; }

img, svg, canvas, video { max-width: 100%; }
img { height: auto; }

.text-secondary { color: var(--pt-muted) !important; }
.num { font-variant-numeric: tabular-nums; }

/* 長標題、長網址、長內容都可以換行 */
.card, .modal, .offcanvas, .toast, .alert, .table-stack, .state-box { overflow-wrap: anywhere; }
.mini-sub > *, .item-meta > *, .item-lines > *, .page-head > *, .card-header > * { min-width: 0; }

:focus-visible {
  outline: 3px solid rgba(46, 61, 176, 0.5);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  padding: 0.75rem 1rem;
  background: var(--pt-surface);
  color: var(--pt-primary);
  border-radius: 0 0 var(--pt-radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ============================================================
   動畫
   ============================================================ */

@keyframes pt-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes pt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pt-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes pt-shimmer {
  from { background-position: -320px 0; }
  to { background-position: 320px 0; }
}
@keyframes pt-pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); }
}
@keyframes pt-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pt-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pt-donut { from { stroke-dasharray: 0 400; } }
@keyframes pt-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(6px, -8px); }
}
@keyframes pt-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes pt-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-3deg); }
}
@keyframes pt-out {
  to { opacity: 0; transform: translateX(24px) scale(0.98); }
}

/* 頁面載入時，主內容依序淡入 */
.app-main > * { animation: pt-rise 0.5s var(--pt-ease) both; }
.app-main > *:nth-child(2) { animation-delay: 0.05s; }
.app-main > *:nth-child(3) { animation-delay: 0.1s; }
.app-main > *:nth-child(4) { animation-delay: 0.15s; }
.app-main > *:nth-child(5) { animation-delay: 0.2s; }
.app-main > *:nth-child(n+6) { animation-delay: 0.25s; }

/* 動態產生的清單項目：由 App.reveal() 加上 --i 依序出現 */
.reveal { animation: pt-rise 0.42s var(--pt-ease) both; animation-delay: calc(var(--i, 0) * 40ms); }

/* ============================================================
   按鈕、表單
   ============================================================ */

.btn {
  min-height: var(--pt-touch);
  padding: 0.5rem 1rem;
  border-radius: var(--pt-radius-sm);
  font-size: 1rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }

.btn-primary {
  --bs-btn-bg: var(--pt-primary);
  --bs-btn-border-color: var(--pt-primary);
  --bs-btn-hover-bg: var(--pt-primary-hover);
  --bs-btn-hover-border-color: var(--pt-primary-hover);
  --bs-btn-active-bg: var(--pt-primary-hover);
  --bs-btn-active-border-color: var(--pt-primary-hover);
  --bs-btn-disabled-bg: var(--pt-primary);
  --bs-btn-disabled-border-color: var(--pt-primary);
  --bs-btn-focus-shadow-rgb: 46, 61, 176;
  box-shadow: 0 4px 14px rgba(46, 61, 176, 0.28);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(46, 61, 176, 0.36); }

/* 主要操作按鈕使用目前頁面的代表色 */
.btn-mod {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--mod);
  --bs-btn-border-color: var(--mod);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--mod);
  --bs-btn-hover-border-color: var(--mod);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--mod);
  --bs-btn-active-border-color: var(--mod);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--mod);
  --bs-btn-disabled-border-color: var(--mod);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--mod) 32%, transparent);
}
.btn-mod:hover { filter: brightness(0.94); }

.btn-outline-primary {
  --bs-btn-color: var(--pt-primary);
  --bs-btn-border-color: #c7cef5;
  --bs-btn-hover-color: var(--pt-primary-ink);
  --bs-btn-hover-bg: var(--pt-primary-soft);
  --bs-btn-hover-border-color: var(--pt-primary);
  --bs-btn-active-color: var(--pt-primary-ink);
  --bs-btn-active-bg: var(--pt-primary-soft);
  --bs-btn-active-border-color: var(--pt-primary);
  --bs-btn-focus-shadow-rgb: 46, 61, 176;
  background: var(--pt-surface);
}

.btn-outline-secondary {
  --bs-btn-color: var(--pt-text);
  --bs-btn-border-color: var(--pt-border-strong);
  --bs-btn-hover-bg: var(--pt-surface-2);
  --bs-btn-hover-color: var(--pt-text);
  --bs-btn-hover-border-color: #b7bfcf;
  --bs-btn-active-bg: #eef1f6;
  --bs-btn-active-color: var(--pt-text);
  --bs-btn-active-border-color: #b7bfcf;
  --bs-btn-disabled-color: var(--pt-faint);
  --bs-btn-disabled-border-color: var(--pt-border);
  background: var(--pt-surface);
}

.btn-danger {
  --bs-btn-bg: var(--pt-danger);
  --bs-btn-border-color: var(--pt-danger);
  --bs-btn-hover-bg: #cf3a3f;
  --bs-btn-hover-border-color: #cf3a3f;
  --bs-btn-active-bg: #cf3a3f;
  --bs-btn-active-border-color: #cf3a3f;
}

.btn-outline-danger {
  --bs-btn-color: var(--pt-danger-ink);
  --bs-btn-border-color: #f2c4c5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--pt-danger);
  --bs-btn-hover-border-color: var(--pt-danger);
  --bs-btn-active-bg: var(--pt-danger);
  --bs-btn-active-border-color: var(--pt-danger);
  background: var(--pt-surface);
}

/* 只有圖示的按鈕：觸控目標至少 44×44 */
.btn-icon {
  min-width: var(--pt-touch);
  min-height: var(--pt-touch);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pt-text);
  border-radius: var(--pt-radius-sm);
  font-size: 1.25rem;
}
.btn-icon:hover { background: #eef1f6; }
.btn-icon-sm { font-size: 1rem; }

.form-label { font-weight: 600; margin-bottom: 0.35rem; color: var(--pt-text); }

/* 手機輸入欄位字級至少 16px，避免 iOS 自動放大 */
.form-control,
.form-select {
  min-height: var(--pt-touch);
  font-size: 1rem;
  border-radius: var(--pt-radius-sm);
  border-color: var(--pt-border-strong);
  background-color: var(--pt-surface);
  max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:hover, .form-select:hover { border-color: #b7bfcf; }
.form-control:disabled, .form-select:disabled { background-color: #eef1f6; }
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--pt-primary);
  box-shadow: 0 0 0 4px rgba(46, 61, 176, 0.14);
}
.form-control::placeholder { color: var(--pt-faint); }
textarea.form-control { min-height: 9rem; }
.form-control-lg { font-size: 1.5rem; font-weight: 700; min-height: 56px; }

.form-check { min-height: var(--pt-touch); padding-top: 0.55rem; }
.form-check-input { width: 1.3em; height: 1.3em; margin-top: 0.15em; background-color: var(--pt-surface); border-color: #98a2b3; }
.form-check-input:checked { background-color: var(--pt-primary); border-color: var(--pt-primary); }
.form-check-label { padding-left: 0.3rem; }
.form-text { color: var(--pt-muted); font-size: 0.875rem; }

.form-error-summary {
  background: var(--pt-danger-soft);
  color: var(--pt-danger-ink);
  border: 1px solid #f6caca;
  border-radius: var(--pt-radius-sm);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1rem;
  animation: pt-rise 0.25s var(--pt-ease);
}
.invalid-feedback { color: var(--pt-danger-ink); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--pt-danger); }
fieldset legend.form-label { float: none; font-size: 1rem; }

/* ============================================================
   卡片、提示、標籤
   ============================================================ */

.card {
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--pt-border);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-header:first-child { border-radius: var(--pt-radius) var(--pt-radius) 0 0; }
.card-header h2 { font-size: 1.02rem; margin: 0; display: flex; align-items: center; gap: 0.55rem; }
.card-body { padding: 1rem; }

/* 卡片標題前的小圖示：帶底色的圓角方塊 */
.card-header h2 > .bi,
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.95rem;
  background: var(--mod-soft);
  color: var(--mod);
}
.ico-lg { width: 42px; height: 42px; border-radius: 12px; font-size: 1.25rem; }
.tone-primary { --mod: var(--c-home); --mod-soft: var(--c-home-soft); }
.tone-tasks { --mod: var(--c-tasks); --mod-soft: var(--c-tasks-soft); }
.tone-notes { --mod: var(--c-notes); --mod-soft: var(--c-notes-soft); }
.tone-ledger { --mod: var(--c-ledger); --mod-soft: var(--c-ledger-soft); }
.tone-danger { --mod: var(--pt-danger); --mod-soft: var(--pt-danger-soft); }
.tone-warning { --mod: var(--pt-warning); --mod-soft: var(--pt-warning-soft); }
.tone-success { --mod: var(--pt-success); --mod-soft: var(--pt-success-soft); }
.tone-violet { --mod: var(--pt-violet); --mod-soft: var(--pt-violet-soft); }
.tone-weather { --mod: var(--c-weather); --mod-soft: var(--c-weather-soft); }
.tone-stocks { --mod: var(--c-stocks); --mod-soft: var(--c-stocks-soft); }
.tone-calendar { --mod: var(--c-calendar); --mod-soft: var(--c-calendar-soft); }
.tone-bills { --mod: var(--c-bills); --mod-soft: var(--c-bills-soft); }
.tone-dates { --mod: var(--c-dates); --mod-soft: var(--c-dates-soft); }
.tone-links { --mod: var(--c-links); --mod-soft: var(--c-links-soft); }

.alert {
  border-radius: var(--pt-radius-sm);
  border-width: 1px;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.alert > .bi { font-size: 1.1rem; line-height: 1.5; }
.alert-danger { background: var(--pt-danger-soft); color: var(--pt-danger-ink); border-color: #f6caca; }
.alert-success { background: var(--pt-success-soft); color: var(--pt-success-ink); border-color: #c4e8d1; }
.alert-info { background: var(--pt-primary-soft); color: var(--pt-primary-ink); border-color: #d3d9fa; }
.alert-warning { background: var(--pt-warning-soft); color: var(--pt-warning-ink); border-color: #f5dea6; }

/* 狀態標籤：文字＋圖示，不只靠顏色 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
  background: #f1f3f8;
  color: #475467;
  white-space: nowrap;
}
.tag-primary { background: var(--pt-primary-soft); color: var(--pt-primary-ink); }
.tag-violet { background: var(--pt-violet-soft); color: var(--pt-violet-ink); }
.tag-danger { background: var(--pt-danger-soft); color: var(--pt-danger-ink); }
.tag-success { background: var(--pt-success-soft); color: var(--pt-success-ink); }
.tag-warning { background: var(--pt-warning-soft); color: var(--pt-warning-ink); }
.tag-solid-danger { background: var(--pt-danger); color: #fff; }

/* 會閃爍提醒的小圓點（逾期等緊急狀態） */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pt-danger);
  animation: pt-pulse 1.8s infinite;
  flex: 0 0 auto;
}

.count-badge {
  min-width: 1.9rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: #eef1f6;
  color: var(--pt-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.count-badge.is-alert { background: var(--pt-danger); color: #fff; }

/* 分類小圓點（顏色由 JS 依分類名稱決定） */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: currentColor; }

/* ============================================================
   版面：桌面側欄；手機頂欄＋底部導覽列
   ============================================================ */

.app-shell { min-height: 100vh; min-height: 100dvh; }

.app-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b6ef0 0%, #7c5cff 55%, #12a37f 130%);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(91, 110, 240, 0.35);
  flex: 0 0 auto;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: calc(var(--pt-topbar-h) + var(--pt-safe-top));
  padding: var(--pt-safe-top) calc(0.5rem + var(--pt-safe-right)) 0 calc(0.85rem + var(--pt-safe-left));
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid rgba(230, 233, 241, 0.9);
}
.app-brand {
  font-weight: 700;
  color: var(--pt-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--pt-touch);
}
.app-brand:hover { color: var(--pt-text); }
.app-topbar-title {
  margin-left: auto;
  color: var(--pt-muted);
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 大頭貼（暱稱第一個字） */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e5ff, #f1edff);
  color: var(--pt-primary-ink);
  font-weight: 700;
  font-size: 0.95rem;
  flex: 0 0 auto;
}
.avatar-btn {
  min-width: var(--pt-touch);
  min-height: var(--pt-touch);
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
}

.app-sidebar { display: none; }

.app-offcanvas {
  --bs-offcanvas-width: min(300px, 86vw);
  --bs-offcanvas-bg: var(--pt-surface);
  padding-top: var(--pt-safe-top);
  padding-left: var(--pt-safe-left);
  padding-bottom: var(--pt-safe-bottom);
}
.app-offcanvas .offcanvas-body { display: flex; flex-direction: column; gap: 1rem; }
.offcanvas-header .btn-icon { margin-left: auto; }

/* 選單項目：每個功能有自己的顏色 */
.app-nav { gap: 0.2rem; }
.app-nav .nav-link {
  --nav: var(--c-home);
  --nav-soft: var(--c-home-soft);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--pt-touch);
  padding: 0.45rem 0.7rem;
  color: #344054;
  border-radius: var(--pt-radius-sm);
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.app-nav .nav-link .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 1.05rem;
  color: var(--nav);
  background: var(--nav-soft);
  transition: transform 0.2s var(--pt-ease-spring);
}
.app-nav .nav-link:hover { background: var(--pt-surface-2); color: var(--pt-text); }
.app-nav .nav-link:hover .bi { transform: scale(1.08); }
.app-nav .nav-link.active {
  background: var(--nav-soft);
  color: var(--pt-text);
  font-weight: 700;
}
.app-nav .nav-link.active .bi { background: var(--nav); color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--nav) 35%, transparent); }
.app-nav .mod-home { --nav: var(--c-home); --nav-soft: var(--c-home-soft); }
.app-nav .mod-tasks { --nav: var(--c-tasks); --nav-soft: var(--c-tasks-soft); }
.app-nav .mod-notes { --nav: var(--c-notes); --nav-soft: var(--c-notes-soft); }
.app-nav .mod-ledger { --nav: var(--c-ledger); --nav-soft: var(--c-ledger-soft); }
.app-nav .mod-settings { --nav: var(--c-settings); --nav-soft: var(--c-settings-soft); }
.app-nav .mod-admin-users { --nav: var(--c-admin); --nav-soft: var(--c-admin-soft); }
.app-nav .mod-weather { --nav: var(--c-weather); --nav-soft: var(--c-weather-soft); }
.app-nav .mod-stocks { --nav: var(--c-stocks); --nav-soft: var(--c-stocks-soft); }
.app-nav .mod-calendar { --nav: var(--c-calendar); --nav-soft: var(--c-calendar-soft); }
.app-nav .mod-bills { --nav: var(--c-bills); --nav-soft: var(--c-bills-soft); }
.app-nav .mod-dates { --nav: var(--c-dates); --nav-soft: var(--c-dates-soft); }
.app-nav .mod-links { --nav: var(--c-links); --nav-soft: var(--c-links-soft); }
.nav-section { font-size: 0.75rem; font-weight: 700; color: var(--pt-faint); letter-spacing: 0.08em; margin: 0.5rem 0.7rem 0.25rem; }

.app-userbox {
  margin-top: auto;
  padding: 0.75rem;
  border-radius: var(--pt-radius);
  background: var(--pt-surface-2);
  border: 1px solid var(--pt-border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.app-user-name { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; min-width: 0; }
.app-user-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 手機底部導覽列 */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  padding: 0.25rem calc(0.25rem + var(--pt-safe-right)) calc(0.25rem + var(--pt-safe-bottom)) calc(0.25rem + var(--pt-safe-left));
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid rgba(230, 233, 241, 0.9);
}
.app-tabbar a, .app-tabbar button {
  --nav: var(--c-home);
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border: 0;
  background: transparent;
  color: var(--pt-muted);
  font-size: 0.75rem;
  text-decoration: none;
  border-radius: var(--pt-radius-sm);
}
.app-tabbar .bi { font-size: 1.3rem; line-height: 1; transition: transform 0.25s var(--pt-ease-spring); }
.app-tabbar .is-active { color: var(--nav); font-weight: 700; }
.app-tabbar .is-active .bi { transform: translateY(-2px) scale(1.1); }
.app-tabbar .mod-home { --nav: var(--c-home); }
.app-tabbar .mod-tasks { --nav: var(--c-tasks); }
.app-tabbar .mod-notes { --nav: #c78a00; }
.app-tabbar .mod-ledger { --nav: var(--c-ledger); }
.app-tabbar .mod-weather { --nav: var(--c-weather); }
.app-tabbar .mod-stocks { --nav: var(--c-stocks); }

.app-main {
  padding: var(--pt-gap) calc(var(--pt-gap) + var(--pt-safe-right)) calc(var(--pt-tabbar-h) + 1.5rem + var(--pt-safe-bottom)) calc(var(--pt-gap) + var(--pt-safe-left));
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}
.app-main:focus { outline: none; }

/* ============================================================
   頁首與工具列
   ============================================================ */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: var(--pt-gap);
}
.page-title { font-size: 1.45rem; margin: 0; display: flex; align-items: center; gap: 0.7rem; }
.page-title > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 1.25rem;
  color: #fff;
  background: var(--mod);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--mod) 35%, transparent);
}
.page-sub { margin: 0.15rem 0 0; color: var(--pt-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.toolbar { margin-bottom: var(--pt-gap); }
.toolbar .card-body { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.toolbar label { font-size: 0.8125rem; font-weight: 600; color: var(--pt-muted); margin-bottom: 0.25rem; display: block; }

/* 搜尋框前的放大鏡 */
.search-wrap { position: relative; }
.search-wrap > .bi { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--pt-faint); pointer-events: none; }
.search-wrap .form-control { padding-left: 2.4rem; }

/* 分段切換（全部／支出／收入、篩選快捷） */
.seg {
  display: flex;
  gap: 0.25rem;
  padding: 3px;
  background: #eef1f6;
  border-radius: var(--pt-radius-sm);
}
.seg button {
  flex: 1 1 0;
  min-height: var(--pt-touch);
  min-width: var(--pt-touch);
  padding: 0 0.7rem;
  border: 0;
  background: transparent;
  border-radius: 9px;
  color: var(--pt-muted);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.seg button[aria-pressed="true"] { background: var(--pt-surface); color: var(--pt-text); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }

/* ============================================================
   KPI 統計卡片
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: var(--pt-gap);
}
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem;
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
  color: var(--pt-text);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s var(--pt-ease), box-shadow 0.2s ease, border-color 0.2s ease;
}
a.kpi:hover, button.kpi:hover { color: var(--pt-text); }
button.kpi { text-align: left; font: inherit; }
.kpi::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--mod-soft);
  opacity: 0.7;
  pointer-events: none;
}
.kpi-head { display: flex; align-items: center; gap: 0.5rem; color: var(--pt-muted); font-size: 0.875rem; font-weight: 600; position: relative; z-index: 1; }
.kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.kpi-value small { font-size: 0.875rem; font-weight: 600; color: var(--pt-muted); margin-left: 0.15rem; }
.kpi-sub { font-size: 0.8125rem; color: var(--pt-muted); position: relative; z-index: 1; }
.kpi.is-alert { border-color: #f6caca; background: linear-gradient(180deg, #fff 0%, #fff6f6 100%); }
.kpi.is-alert .kpi-value { color: var(--pt-danger-ink); }
.kpi.is-warn { border-color: #f5dea6; background: linear-gradient(180deg, #fff 0%, #fffaf0 100%); }
.kpi.is-active { border-color: var(--mod); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mod) 18%, transparent), var(--pt-shadow); }

/* 進度條（支出占收入比例等） */
.meter { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; position: relative; z-index: 1; }
.meter > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--pt-success);
  transform-origin: left center;
  animation: pt-grow-x 0.9s var(--pt-ease) both;
}
.meter.is-warn > span { background: var(--pt-warning); }
.meter.is-danger > span { background: var(--pt-danger); }

/* ============================================================
   首頁問候卡
   ============================================================ */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--pt-radius) + 4px);
  padding: 1.25rem;
  margin-bottom: var(--pt-gap);
  color: #fff;
  background: linear-gradient(125deg, #4f63d9 0%, #6a5af0 48%, #7c5cff 70%, #12a37f 140%);
  box-shadow: 0 14px 36px rgba(46, 61, 176, 0.3);
}
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
  animation: pt-float 9s ease-in-out infinite;
}
.hero::before { width: 220px; height: 220px; right: -60px; top: -90px; }
.hero::after { width: 140px; height: 140px; right: 90px; bottom: -80px; animation-delay: -4s; background: rgba(255, 255, 255, 0.08); }
.hero > * { position: relative; z-index: 1; }
.hero-date { margin: 0; opacity: 0.85; font-size: 0.9375rem; }
.hero-title { margin: 0.15rem 0 0.25rem; font-size: 1.55rem; font-weight: 800; color: #fff; }
.hero-text { margin: 0 0 1rem; opacity: 0.92; }
.hero-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.hero-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 68px;
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--pt-radius-sm);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.hero-action .bi { font-size: 1.3rem; }
.hero-action:hover { background: rgba(255, 255, 255, 0.24); color: #fff; }
.hero-action:active { transform: scale(0.96); }

/* ============================================================
   清單與卡片
   ============================================================ */

.item-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pt-gap); align-items: start; }

.item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: transform 0.2s var(--pt-ease), box-shadow 0.2s ease;
}
/* 左側色條：表示緊急程度或類型 */
.item-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent, transparent);
}
.item-card.is-overdue { --accent: var(--pt-danger); border-color: #f6caca; }
.item-card.is-today { --accent: var(--pt-warning); }
.item-card.is-waiting { --accent: var(--pt-violet); }
.item-card.is-high { --accent: #f97316; }
.item-card.is-done { --accent: var(--pt-success); opacity: 0.78; }
.item-card.is-pinned { --accent: var(--c-notes); }
.is-leaving { animation: pt-out 0.35s var(--pt-ease) forwards; pointer-events: none; }
.item-card .card-body { display: flex; flex-direction: column; gap: 0.55rem; }
.item-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.item-title.is-done { text-decoration: line-through; color: var(--pt-muted); }
.item-preview { color: #475467; margin: 0; white-space: pre-line; }
.item-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; color: var(--pt-muted); font-size: 0.875rem; }
.item-lines { margin: 0; display: grid; gap: 0.2rem; font-size: 0.9375rem; padding: 0.6rem 0.75rem; background: var(--pt-surface-2); border-radius: var(--pt-radius-xs); }
.item-lines dt { display: inline; font-weight: 600; color: var(--pt-muted); }
.item-lines dd { display: inline; margin: 0; }
.item-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; padding-top: 0.35rem; }
.item-actions .btn { flex: 1 1 auto; }
.item-actions .btn-square { flex: 0 0 auto; min-width: var(--pt-touch); padding-left: 0.75rem; padding-right: 0.75rem; }
.due-text { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; }
.due-text.is-overdue { color: var(--pt-danger-ink); }
.due-text.is-today { color: var(--pt-warning-ink); }
.due-text.is-soon { color: var(--pt-primary-ink); }

/* 完成按鈕的勾選動畫 */
.btn-complete .bi { transition: transform 0.25s var(--pt-ease-spring); }
.btn-complete:hover .bi { transform: scale(1.18); }
.check-pop { animation: pt-pop 0.4s var(--pt-ease-spring); }

/* 首頁小清單 */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--pt-border);
}
.mini-list li:last-child { border-bottom: 0; }
.mini-main { flex: 1 1 auto; min-width: 0; }
.mini-title { font-weight: 600; margin: 0; }
.mini-sub { margin: 0.15rem 0 0; color: var(--pt-muted); font-size: 0.875rem; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.mini-more { display: inline-flex; align-items: center; gap: 0.25rem; min-height: var(--pt-touch); font-weight: 600; text-decoration: none; font-size: 0.9375rem; }
.mini-more:hover { text-decoration: underline; }
.done-btn {
  min-width: var(--pt-touch);
  min-height: var(--pt-touch);
  margin: -0.4rem 0 -0.4rem -0.4rem;
  border: 0;
  background: transparent;
  border-radius: 50%;
  color: var(--pt-faint);
  font-size: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.2s var(--pt-ease-spring);
}
.done-btn:hover { color: var(--pt-success); transform: scale(1.1); }

.home-grid,
.chart-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pt-gap);
  align-items: start;
  margin-bottom: var(--pt-gap);
}

/* ============================================================
   載入中、無資料、錯誤
   ============================================================ */

.state-box {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.75rem 1rem;
  color: var(--pt-muted);
  text-align: center;
  animation: pt-fade 0.3s ease;
}
.state-box.is-row { flex-direction: row; flex-wrap: wrap; }
.state-empty .state-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--mod-soft);
  color: var(--mod);
  font-size: 1.5rem;
  animation: pt-pop 0.45s var(--pt-ease-spring);
}
.state-error { color: var(--pt-danger-ink); }
.state-error .bi { font-size: 1.4rem; }

/* 骨架畫面（載入中的灰色條） */
.skeleton { display: grid; gap: 0.7rem; padding: 1rem; grid-column: 1 / -1; }
.skel {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #eef1f6 0px, #f7f8fb 160px, #eef1f6 320px);
  background-size: 640px 100%;
  animation: pt-shimmer 1.3s linear infinite;
}
.skel.w-40 { width: 40%; }
.skel.w-60 { width: 60%; }
.skel.w-80 { width: 80%; }
.skel.h-lg { height: 22px; }

/* 分頁 */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.75rem; margin-top: var(--pt-gap); }
.pager-info { color: var(--pt-muted); font-size: 0.9375rem; }

/* ============================================================
   表格：小畫面改為卡片式堆疊
   ============================================================ */

.table-stack { display: block; width: 100%; border-collapse: collapse; margin: 0; }
.table-stack tbody { display: block; }
.table-stack thead { display: none; }
.table-stack tr { display: block; padding: 0.85rem 1rem; border-bottom: 1px solid var(--pt-border); }
.table-stack tr:last-child { border-bottom: 0; }
.table-stack td { display: flex; gap: 0.75rem; padding: 0.15rem 0; border: 0; min-width: 0; }
.table-stack td::before { content: attr(data-label); flex: 0 0 4.5em; color: var(--pt-muted); font-weight: 600; font-size: 0.875rem; }
.user-cell { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }

/* 使用者管理 */
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.user-text small { color: var(--pt-muted); overflow-wrap: anywhere; }
.user-table tr.is-disabled .user-text strong, .user-table tr.is-disabled .avatar { opacity: 0.55; }
.cell-actions { justify-content: flex-end; }
.cell-actions::before { content: none !important; }
.cell-actions .btn { width: 100%; margin-top: 0.4rem; white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1rem; margin: 0; }
.detail-grid dt { font-size: 0.8125rem; color: var(--pt-muted); font-weight: 600; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.login-list { list-style: none; margin: 0; padding: 0; }
.login-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--pt-border);
}
.login-list li:last-child { border-bottom: 0; }
.login-list .lg-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f1f3f8;
  color: var(--pt-muted);
}
.login-list li.is-ok .lg-ico { background: var(--pt-success-soft); color: var(--pt-success-ink); }
.login-list li.is-fail .lg-ico { background: var(--pt-danger-soft); color: var(--pt-danger-ink); }
.login-list li.is-fail strong { color: var(--pt-danger-ink); }
.login-list .lg-main { display: flex; flex-direction: column; min-width: 0; }
.login-list .lg-main small { color: var(--pt-muted); overflow-wrap: anywhere; }
.login-list .lg-time { font-size: 0.8125rem; color: var(--pt-muted); text-align: right; }
#detailTitle .avatar { width: 32px; height: 32px; }
#detailActions { flex-wrap: wrap; }
@media (max-width: 575.98px) {
  #detailActions .btn { flex: 1 1 calc(50% - 0.5rem); }
  .login-list li { grid-template-columns: auto minmax(0, 1fr); }
  .login-list .lg-time { grid-column: 2; text-align: left; }
}
@media (min-width: 768px) {
  .cell-actions .btn { width: auto; margin-top: 0; }
  .user-table th:nth-child(1) { width: 34%; }
  .user-table th:nth-child(2) { width: 18%; }
  .user-table th:last-child, .user-table td.cell-actions { width: 7.5rem; text-align: right; white-space: nowrap; }
  .user-table td.cell-actions { display: table-cell; }
}

/* ============================================================
   圖表
   ============================================================ */

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--pt-font); }
.chart .axis-text { fill: var(--pt-faint); }
.chart .grid-line { stroke: #edf0f5; }
.chart .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: pt-grow 0.6s var(--pt-ease) both; animation-delay: calc(var(--i, 0) * 18ms); cursor: pointer; }
.chart .bar:hover { filter: brightness(0.9); }
.chart .line-path { animation: pt-draw 1.1s var(--pt-ease) both; }
.chart .line-area { animation: pt-fade 0.9s ease both; }
.chart .line-dot { cursor: pointer; transition: r 0.15s ease; }
.chart .donut-seg { animation: pt-donut 0.9s var(--pt-ease) both; cursor: pointer; transition: stroke-width 0.2s ease; }
.chart .donut-seg:hover { stroke-width: 19; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: #1d2433;
  color: #fff;
  font-size: 0.8125rem;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.2);
  animation: pt-fade 0.15s ease;
}
.chart-legend { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.15rem; }
.chart-legend li { min-width: 0; }
.chart-legend button,
.chart-legend .lg-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: var(--pt-touch);
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: var(--pt-radius-xs);
  background: transparent;
  color: var(--pt-text);
  text-align: left;
  font-size: 0.9375rem;
}
.chart-legend button:hover, .chart-legend button[aria-pressed="true"] { background: var(--pt-surface-2); }
.chart-legend .lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend .lg-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.chart-legend .lg-pct { color: var(--pt-muted); font-size: 0.8125rem; font-weight: 500; margin-left: 0.35rem; }
.chart-keys { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.8125rem; color: var(--pt-muted); margin-bottom: 0.4rem; }
.chart-keys span { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-keys .dot { border-radius: 3px; }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; align-items: center; }
/* 圓餅圖和圖例：卡片夠寬時並排（依卡片寬度，不依螢幕寬度） */
.card-body { container-type: inline-size; }
@container (min-width: 440px) {
  .donut-wrap { grid-template-columns: 180px minmax(0, 1fr); gap: 1.25rem; }
}
.donut-box { max-width: 210px; width: 100%; margin: 0 auto; }

/* ============================================================
   記帳
   ============================================================ */

.amount-income { color: var(--pt-success-ink); }
.amount-expense { color: var(--pt-danger-ink); }

.month-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-bottom: var(--pt-gap);
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius);
  box-shadow: var(--pt-shadow);
}
.month-label { flex: 1 1 auto; text-align: center; font-size: 1.15rem; margin: 0; font-variant-numeric: tabular-nums; }
.month-label.is-changing { animation: pt-rise 0.3s var(--pt-ease); }

.ledger-filters { display: grid; gap: 0.6rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--pt-border); background: var(--pt-surface-2); }
.ledger-filters .row-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }

.day-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--pt-muted);
  margin: 0;
  padding: 0.45rem 1rem;
  background: var(--pt-surface-2);
  border-bottom: 1px solid var(--pt-border);
}
.day-head .day-sum { font-variant-numeric: tabular-nums; font-weight: 600; }
.day-head .is-today { color: var(--c-ledger); }
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li { border-bottom: 1px solid var(--pt-border); }
.entry-list li:last-child { border-bottom: 0; }
.entry-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 60px;
  padding: 0.55rem 1rem;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--pt-text);
  transition: background-color 0.15s ease;
}
.entry-row:hover { background: var(--pt-surface-2); }
.entry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1.05rem;
  flex: 0 0 auto;
  color: #fff;
  background: var(--cat, var(--pt-faint));
}
.entry-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.entry-cat { font-weight: 600; }
.entry-sub { color: var(--pt-muted); font-size: 0.875rem; }
.entry-amt { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-big { display: inline-flex; margin-left: 0.35rem; }

.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.type-toggle .btn { font-weight: 600; }
.type-toggle .btn-check:checked + .btn.is-expense { background: var(--pt-danger-soft); border-color: var(--pt-danger); color: var(--pt-danger-ink); }
.type-toggle .btn-check:checked + .btn.is-income { background: var(--pt-success-soft); border-color: var(--pt-success); color: var(--pt-success-ink); }
.type-toggle .btn-check:focus-visible + .btn { outline: 3px solid rgba(46, 61, 176, 0.5); outline-offset: 2px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--pt-touch);
  padding: 0.25rem 0.85rem;
  border: 1px solid var(--pt-border-strong);
  border-radius: 999px;
  background: var(--pt-surface);
  color: var(--pt-text);
  font-size: 0.9375rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.chip:hover { background: var(--pt-surface-2); }
.chip:active { transform: scale(0.95); }
.chip.is-selected { border-color: var(--mod); background: var(--mod-soft); font-weight: 600; }

/* 首頁本月收支 */
.money-rows { display: grid; gap: 0.6rem; }
.money-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.money-row .lbl { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--pt-muted); font-weight: 600; }
.money-row .val { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* ============================================================
   天氣
   ============================================================ */

.btn-link-sm {
  border: 0;
  background: none;
  padding: 0 0.25rem;
  min-height: var(--pt-touch);
  color: var(--pt-primary);
  font-weight: 600;
  text-decoration: underline;
}
.page-sub .tag { vertical-align: middle; }

/* 目前天氣主卡：依天氣換色 */
.wx-now {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-radius: calc(var(--pt-radius) + 4px);
  padding: 1.25rem;
  margin-bottom: var(--pt-gap);
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  box-shadow: 0 14px 36px rgba(14, 165, 233, 0.28);
}
.wx-now::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  top: -110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}
.wx-now > * { position: relative; z-index: 1; }
.wx-sun { background: linear-gradient(135deg, #f59f00 0%, #fb923c 45%, #3b82f6 160%); box-shadow: 0 14px 36px rgba(245, 159, 0, 0.3); }
.wx-cloud { background: linear-gradient(135deg, #64748b 0%, #7c8db5 55%, #94a3b8 100%); box-shadow: 0 14px 36px rgba(100, 116, 139, 0.3); }
.wx-rain { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #0ea5e9 100%); }
.wx-storm { background: linear-gradient(135deg, #312e81 0%, #4f46e5 60%, #7c3aed 100%); box-shadow: 0 14px 36px rgba(79, 70, 229, 0.3); }
.wx-night { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #4f46e5 120%); box-shadow: 0 14px 36px rgba(30, 58, 138, 0.35); }
.wx-now-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.wx-place { margin: 0; opacity: 0.9; font-weight: 600; }
.wx-temp { font-size: 4.2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; margin: 0.35rem 0; font-variant-numeric: tabular-nums; }
.wx-deg { font-size: 1.4rem; font-weight: 700; vertical-align: top; margin-left: 0.15rem; opacity: 0.9; }
.wx-text { margin: 0; font-size: 1.05rem; font-weight: 600; }
.wx-big-icon { font-size: 4.5rem; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.15)); animation: pt-drift 6s ease-in-out infinite; }
.wx-now-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}
.wx-now-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--pt-radius-sm);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.wx-now-grid .lbl { font-size: 0.8125rem; opacity: 0.9; display: inline-flex; gap: 0.35rem; align-items: center; }
.wx-now-grid .val { font-weight: 700; font-size: 1.05rem; }
.wx-desc { margin: 0.9rem 0 0; font-size: 0.9375rem; opacity: 0.92; }

.wx-col { display: grid; gap: var(--pt-gap); min-width: 0; }

/* 即時雨況 */
.rain-status, .rain-outlook {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--pt-radius-sm);
  margin-bottom: 0.75rem;
}
.rain-status > .bi, .rain-outlook > .bi { font-size: 1.9rem; flex: 0 0 auto; }
.rain-status div, .rain-outlook div { display: flex; flex-direction: column; min-width: 0; }
.rain-status strong { font-size: 1.1rem; }
.rain-status span, .rain-outlook span { color: var(--pt-muted); font-size: 0.875rem; }
.rain-status.is-raining { background: #e0efff; color: #1d4ed8; }
.rain-status.is-raining > .bi { animation: pt-drift 2.5s ease-in-out infinite; }
.rain-status.is-stopped { background: #eef6ff; color: #2563eb; }
.rain-status.is-dry { background: var(--pt-success-soft); color: var(--pt-success-ink); }
.rain-status.is-unknown { background: #f1f3f8; color: var(--pt-muted); }
.rain-outlook { border: 1px dashed var(--pt-border-strong); background: var(--pt-surface); }
.rain-outlook.is-stop > .bi { color: var(--pt-warning); }
.rain-outlook.is-long > .bi, .rain-outlook.is-coming > .bi { color: #2563eb; }
.rain-outlook.is-dry > .bi { color: var(--pt-success); }
.rain-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 0.6rem; }
.rain-metrics > div { text-align: center; padding: 0.6rem 0.25rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); border: 1px solid var(--pt-border); }
.rain-metrics .val { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #1d4ed8; }
.rain-metrics .lbl { font-size: 0.8125rem; color: var(--pt-muted); }

/* 逐 3 小時：可橫向滑動 */
.hour-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.hour-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.25rem;
  border-radius: var(--pt-radius-sm);
  background: var(--pt-surface-2);
  border: 1px solid var(--pt-border);
  scroll-snap-align: start;
  min-width: 0;
}
.hour-item.is-now { background: var(--mod-soft); border-color: color-mix(in srgb, var(--mod) 40%, transparent); }
.hour-item .bi { font-size: 1.5rem; }
.h-time { font-size: 0.8125rem; color: var(--pt-muted); white-space: nowrap; }
.hour-item.is-now .h-time { color: var(--pt-text); font-weight: 700; }
.h-temp { font-weight: 800; font-size: 1.05rem; }
.h-pop, .w-pop { font-size: 0.8125rem; color: var(--pt-faint); display: inline-flex; align-items: center; gap: 0.15rem; white-space: nowrap; }
.h-pop.is-wet, .w-pop.is-wet { color: #2563eb; font-weight: 700; }
.wx-ico-sun { color: #f59f00; }
.wx-ico-night { color: #6366f1; }
.wx-ico-cloud { color: #64748b; }
.wx-ico-rain { color: #2563eb; }
.wx-ico-storm { color: #7c3aed; }

/* 一週預報 */
.week-list { list-style: none; margin: 0; padding: 0; }
.week-list li {
  display: grid;
  grid-template-columns: 2.9rem 1.5rem 3.1rem 2rem minmax(16px, 1fr) 2rem;
  align-items: center;
  gap: 0.4rem;
  min-height: 52px;
  border-bottom: 1px dashed var(--pt-border);
}
.week-list li:last-child { border-bottom: 0; }
.week-list .bi { font-size: 1.35rem; text-align: center; }
.w-day { display: flex; flex-direction: column; line-height: 1.2; }
.w-day small { color: var(--pt-faint); font-size: 0.75rem; }
.w-min { text-align: right; color: var(--pt-muted); font-variant-numeric: tabular-nums; }
.w-max { font-weight: 700; font-variant-numeric: tabular-nums; }
.w-bar { position: relative; height: 6px; border-radius: 999px; background: #eef1f6; }
.w-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #f59f00);
  transform-origin: left center;
  animation: pt-grow-x 0.8s var(--pt-ease) both;
}

/* 卡片很窄時（手機小螢幕）縮小一週預報的欄位 */
@container (max-width: 250px) {
  .week-list li { grid-template-columns: 2.6rem 1.3rem 2.7rem 1.8rem minmax(10px, 1fr) 1.8rem; gap: 0.3rem; }
  .w-pop { font-size: 0.75rem; }
}

/* 雷達圖 */
.radar-box { border-radius: var(--pt-radius-sm); overflow: hidden; background: #0b1220; min-height: 120px; }
.radar-box img { display: block; width: 100%; height: auto; }

/* 首頁問候卡上的天氣 */
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.hero-weather {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--pt-touch);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  animation: pt-fade 0.4s ease both;
}
.hero-weather:hover { color: #fff; background: rgba(255, 255, 255, 0.26); }
.hero-weather .bi { font-size: 1.3rem; }
.hero-weather small { font-weight: 500; opacity: 0.9; }
.hero-umbrella {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.9375rem;
  animation: pt-pop 0.45s var(--pt-ease-spring) both;
}

@media (min-width: 576px) {
  .wx-now { padding: 1.5rem 1.75rem; }
  .wx-now-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wx-temp { font-size: 5rem; }
  .wx-big-icon { font-size: 5.5rem; }
}

/* ============================================================
   視窗（Modal）與提示（Toast）
   ============================================================ */

.modal { --bs-modal-bg: var(--pt-surface); }
.modal-backdrop.show { opacity: 0.4; }
.modal-header .btn-icon { margin-left: auto; }
.modal-content { border: 0; border-radius: calc(var(--pt-radius) + 4px); box-shadow: var(--pt-shadow-pop); }
.modal-header, .modal-footer { border-color: var(--pt-border); }
.modal-footer { gap: 0.5rem; }
.modal-footer > * { margin: 0; }
.modal-footer .btn-delete { margin-right: auto; }
.modal.fade .modal-dialog { transform: translateY(16px) scale(0.98); transition: transform 0.25s var(--pt-ease); }
.modal.show .modal-dialog { transform: none; }

.app-toasts {
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 calc(0.75rem + var(--pt-safe-right)) calc(0.75rem + var(--pt-safe-bottom)) calc(0.75rem + var(--pt-safe-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 1090;
}
.app-toast {
  pointer-events: auto;
  width: min(420px, 100%);
  background: var(--pt-surface);
  border: 1px solid var(--pt-border);
  border-radius: var(--pt-radius-sm);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.16);
  font-size: 1rem;
}
.app-toast.showing, .app-toast.show { animation: pt-rise 0.3s var(--pt-ease-spring); }
.app-toast .toast-body { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.45rem 0.45rem 0.85rem; }
.app-toast .toast-body > .bi { font-size: 1.2rem; }
.app-toast-text { flex: 1 1 auto; min-width: 0; }
.app-toast-success .toast-body > .bi { color: var(--pt-success); animation: pt-pop 0.45s var(--pt-ease-spring); }
.app-toast-error { border-color: #f6caca; }
.app-toast-error .toast-body > .bi { color: var(--pt-danger); }

/* ============================================================
   帳號頁面（登入、註冊…）
   ============================================================ */

body.layout-auth {
  background:
    radial-gradient(700px 500px at 0% 0%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(18, 163, 127, 0.18), transparent 60%),
    linear-gradient(160deg, #eef1ff 0%, #f6f4ff 45%, #effaf6 100%);
  background-attachment: fixed;
}
.auth-main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(1.5rem + var(--pt-safe-top)) calc(1rem + var(--pt-safe-right)) calc(1.5rem + var(--pt-safe-bottom)) calc(1rem + var(--pt-safe-left));
}
.auth-card {
  width: 100%;
  max-width: 430px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 24px 60px rgba(52, 64, 140, 0.16);
  animation: pt-rise 0.5s var(--pt-ease) both;
}
.auth-card .card-body { padding: 1.75rem 1.5rem; }
.auth-brand { color: var(--pt-text); font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.6rem; }
.auth-brand > .bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b6ef0 0%, #7c5cff 55%, #12a37f 130%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 110, 240, 0.35);
}
.auth-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 1.25rem; }
.auth-card .btn-primary { min-height: 50px; font-size: 1.05rem; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-top: 1.25rem; }
.auth-links a { display: inline-flex; align-items: center; min-height: var(--pt-touch); font-weight: 600; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ============================================================
   響應式
   ============================================================ */

@media (max-width: 767.98px) {
  .kpi-grid.cols-3 > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 575.98px) {
  /* 提示訊息顯示在上方，避免擋住底部按鈕 */
  .app-toasts {
    top: 0;
    bottom: auto;
    padding: calc(0.5rem + var(--pt-safe-top)) calc(0.75rem + var(--pt-safe-right)) 0 calc(0.75rem + var(--pt-safe-left));
  }
  /* 表單視窗全螢幕，高度跟著實際可見高度（鍵盤開啟時底部按鈕仍看得到） */
  .modal-fullscreen-sm-down { height: var(--vvh); }
  .modal-fullscreen-sm-down .modal-content { border-radius: 0; }
  .modal-fullscreen-sm-down .modal-header { padding-top: calc(0.75rem + var(--pt-safe-top)); }
  .modal-fullscreen-sm-down .modal-footer { padding-bottom: calc(0.75rem + var(--pt-safe-bottom)); }
  .modal-fullscreen-sm-down .modal-footer .btn { flex: 1 1 auto; }
  .modal-fullscreen-sm-down .modal-footer .btn-delete { flex: 0 0 auto; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .page-title { font-size: 1.3rem; }
  .kpi-value { font-size: 1.35rem; }
  .hero-title { font-size: 1.35rem; }
}

@media (min-width: 576px) {
  .toolbar .card-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .toolbar-wide { grid-column: 1 / -1; }
  .ledger-filters .row-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .hero { padding: 1.5rem 1.75rem; }
  .hero-actions { grid-template-columns: repeat(3, minmax(0, 140px)); }
}

@media (min-width: 768px) {
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--pt-gap); }
  .kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auth-main { align-items: center; }

  /* 滑鼠移上去時卡片微微浮起 */
  @media (hover: hover) {
    .item-card:hover, a.kpi:hover, button.kpi:hover { transform: translateY(-2px); box-shadow: var(--pt-shadow-hover); }
  }

  .table-stack { display: table; table-layout: fixed; }
  .table-stack tbody { display: table-row-group; }
  .table-stack thead { display: table-header-group; }
  .table-stack tr { display: table-row; padding: 0; transition: background-color 0.15s ease; }
  .table-stack tbody tr:hover { background: var(--pt-surface-2); }
  .table-stack th, .table-stack td {
    display: table-cell;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--pt-border);
    text-align: left;
    vertical-align: middle;
  }
  .table-stack th { color: var(--pt-muted); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; background: var(--pt-surface-2); }
  .table-stack td::before { content: none; }
  .table-stack tbody tr:last-child td { border-bottom: 0; }
}

/* 桌面：固定側欄，隱藏頂欄與底部導覽列 */
@media (min-width: 992px) {
  .app-shell { display: grid; grid-template-columns: var(--pt-sidebar-w) minmax(0, 1fr); }
  .app-topbar, .app-tabbar { display: none; }
  .app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: 1.25rem 1rem 1.25rem calc(1rem + var(--pt-safe-left));
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--pt-border);
  }
  .app-sidebar .app-brand { font-size: 1.1rem; padding: 0 0.4rem; margin-bottom: 0.5rem; }
  .app-main { padding: var(--pt-gap-lg) calc(var(--pt-gap-lg) + var(--pt-safe-right)) calc(2rem + var(--pt-safe-bottom)) var(--pt-gap-lg); }
  .toolbar .card-body { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toolbar .toolbar-wide { grid-column: auto; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
  .chart-grid.wx-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .home-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-title { font-size: 1.6rem; }
}

@media (min-width: 1200px) {
  .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 手機橫放（高度很小）：減少上下留白，底部導覽列不固定 */
@media (orientation: landscape) and (max-height: 480px) {
  .app-topbar { position: static; }
  .app-tabbar { position: static; }
  .app-main { padding-bottom: calc(1rem + var(--pt-safe-bottom)); }
  .auth-main { align-items: flex-start; padding-top: calc(0.75rem + var(--pt-safe-top)); }
  .auth-title { margin-bottom: 0.75rem; }
  textarea.form-control { min-height: 5rem; }
  .hero::before, .hero::after { display: none; }
}

/* ============================================================
   雙螢幕與摺疊裝置（Surface Duo 等）
   支援 viewport segments 時：內容分左右兩欄，欄間距等於鉸鏈寬度，卡片不跨鉸鏈。
   不支援時維持一般響應式版面。
   ============================================================ */
@media (horizontal-viewport-segments: 2) {
  .app-shell { display: block; }
  .app-topbar { display: flex; }
  .app-tabbar { display: flex; }
  .app-sidebar { display: none; }
  .app-main { max-width: none; padding-left: 0; padding-right: 0; }
  .app-main > * { margin-left: var(--pt-gap); margin-right: var(--pt-gap); }

  .app-main > .item-grid,
  .app-main > .home-grid,
  .app-main > .chart-grid,
  .app-main > .kpi-grid,
  .app-main > .settings-grid {
    margin-left: 0;
    margin-right: 0;
    grid-template-columns: env(viewport-segment-width 0 0, 50%) env(viewport-segment-width 1 0, 50%);
    column-gap: calc(env(viewport-segment-left 1 0, 50%) - env(viewport-segment-right 0 0, 50%));
  }
  .app-main > .item-grid > *,
  .app-main > .home-grid > *,
  .app-main > .chart-grid > *,
  .app-main > .kpi-grid > *,
  .app-main > .settings-grid > * {
    margin-left: var(--pt-gap);
    margin-right: var(--pt-gap);
  }

  .modal-dialog {
    margin-left: calc(env(viewport-segment-left 1 0, 50%) + 1rem);
    margin-right: 1rem;
    max-width: calc(env(viewport-segment-width 1 0, 50%) - 2rem);
  }
  .app-toasts { left: env(viewport-segment-left 1 0, 50%); }
}

@media (vertical-viewport-segments: 2) {
  .app-topbar { position: static; }
}

/* 尊重「減少動態效果」設定 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .app-topbar, .app-sidebar, .app-offcanvas, .app-tabbar, .page-actions, .toolbar, .item-actions, .pager, .app-toasts { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; }
  .app-main > * { animation: none; }
}

/* ============================================================
   股票
   ============================================================ */
.is-up { color: var(--stk-up); }
.is-down { color: var(--stk-down); }
.back-link { display: inline-flex; align-items: center; gap: 0.25rem; min-height: var(--pt-touch); margin: -0.5rem 0 0.25rem; color: var(--pt-muted); font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--mod); }
.stk-source, .stk-note { font-size: 0.8125rem; color: var(--pt-muted); margin: 0.75rem 0 0; }
.stk-source { margin-top: var(--pt-gap-lg); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--stk-up); margin-right: 0.35rem; vertical-align: middle; animation: stk-pulse 1.6s ease-in-out infinite; }
@keyframes stk-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 49, 49, 0.45); } 50% { box-shadow: 0 0 0 6px rgba(224, 49, 49, 0); } }

/* 大盤 */
.mkt-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: var(--pt-gap); }
.mkt-strip:empty { display: none; }
.mkt-card {
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.85rem 1rem; border-radius: var(--pt-radius);
  background: var(--pt-surface); border: 1px solid var(--pt-border); box-shadow: var(--pt-shadow);
  border-top: 3px solid var(--pt-border);
}
.mkt-card.is-up { border-top-color: var(--stk-up); }
.mkt-card.is-down { border-top-color: var(--stk-down); }
.mkt-name { font-size: 0.8125rem; font-weight: 700; color: var(--pt-muted); }
.mkt-value { font-size: 1.35rem; font-weight: 800; color: var(--pt-text); line-height: 1.2; }
.mkt-chg { font-size: 0.875rem; font-weight: 700; }
.mkt-card.is-up .mkt-chg { color: var(--stk-up); }
.mkt-card.is-down .mkt-chg { color: var(--stk-down); }
.mkt-sub { font-size: 0.72rem; color: var(--pt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-name .live-dot { width: 7px; height: 7px; }
.mkt-tabs { max-width: 420px; }
.us-strip { margin-bottom: var(--pt-gap); }
.us-card .stk-price small { font-size: 0.75rem; font-weight: 700; margin-right: 0.15rem; color: var(--pt-muted); }
.us-spark { display: block; width: 100%; height: 44px; margin-top: 0.4rem; stroke: var(--pt-muted); }
.us-spark.is-up { stroke: var(--stk-up); }
.us-spark.is-down { stroke: var(--stk-down); }
.us-news { margin-top: var(--pt-gap); }
.us-news .chip-row { margin: 0 0 0.75rem; }
.us-news .chip { min-height: 40px; }

/* 搜尋 */
.stk-search { position: relative; z-index: 5; }
.stk-search .card-body { display: block; }
.stk-results {
  list-style: none; margin: 0.5rem 0 0; padding: 0.25rem; border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm);
  background: var(--pt-surface); box-shadow: var(--pt-shadow-pop); max-height: min(60vh, 420px); overflow-y: auto;
}
.stk-results li { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.25rem 0.25rem 0; border-bottom: 1px solid var(--pt-border); }
.stk-results li:last-child { border-bottom: 0; }
.stk-results .stk-res-empty { padding: 0.75rem; color: var(--pt-muted); display: block; }
.stk-res-main {
  flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.6rem; align-items: baseline;
  padding: 0.45rem 0.6rem; min-height: var(--pt-touch); border-radius: var(--pt-radius-sm); color: var(--pt-text); text-decoration: none;
}
.stk-res-main:hover, .stk-res-main:focus-visible { background: var(--mod-soft); }
.stk-res-code { font-weight: 800; color: var(--mod); }
.stk-res-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-res-ind { grid-column: 2; font-size: 0.75rem; color: var(--pt-muted); }
.stk-results .btn-sm { min-height: 36px; white-space: nowrap; }

/* 自選股 */
.stk-status-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.25rem 0 0.75rem; }
.stk-status { font-size: 0.8125rem; color: var(--pt-muted); }
.stk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 0.75rem; }
.stk-card {
  position: relative; border-radius: var(--pt-radius); background: var(--pt-surface); border: 1px solid var(--pt-border);
  box-shadow: var(--pt-shadow); transition: transform 0.2s var(--pt-ease), box-shadow 0.2s var(--pt-ease); overflow: hidden;
}
.stk-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--pt-border); }
.stk-card.is-up::before { background: var(--stk-up); }
.stk-card.is-down::before { background: var(--stk-down); }
.stk-card:hover { transform: translateY(-2px); box-shadow: var(--pt-shadow-hover); }
.stk-link { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem 1rem 0.9rem 1.15rem; color: var(--pt-text); text-decoration: none; }
.stk-top { display: flex; align-items: baseline; gap: 0.4rem; padding-right: 2.25rem; min-width: 0; }
.stk-name { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stk-code { color: var(--pt-muted); font-size: 0.8125rem; font-weight: 600; flex: none; white-space: nowrap; }
.stk-top .tag { margin-left: auto; flex: none; }
.stk-price { font-size: 1.75rem; font-weight: 800; line-height: 1.2; margin-top: 0.25rem; }
.stk-card.is-up .stk-price, .stk-card.is-up .stk-chg { color: var(--stk-up); }
.stk-card.is-down .stk-price, .stk-card.is-down .stk-chg { color: var(--stk-down); }
.stk-chg { font-size: 0.9rem; font-weight: 700; color: var(--pt-muted); }
.lim { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.75rem; line-height: 1.5; color: #fff; background: var(--pt-muted); vertical-align: 0.1em; }
.is-up .lim { background: var(--stk-up); }
.is-down .lim { background: var(--stk-down); }
.stk-range { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--pt-muted); }
.stk-range.is-empty { display: block; }
.stk-bar { position: relative; height: 6px; margin: 0 6px; border-radius: 999px; background: linear-gradient(90deg, var(--stk-down-soft), #eef1f6 50%, var(--stk-up-soft)); }
.stk-bar i { position: absolute; top: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--pt-surface); border: 3px solid var(--pt-muted); transform: translateY(-50%); transition: left 0.5s var(--pt-ease); }
.stk-card.is-up .stk-bar i { border-color: var(--stk-up); }
.stk-card.is-down .stk-bar i { border-color: var(--stk-down); }
.stk-meta { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.4rem; font-size: 0.75rem; color: var(--pt-muted); }
.stk-alerts { display: inline-flex; align-items: center; gap: 0.2rem; }
.stk-hit { margin-top: 0.5rem; align-self: flex-start; animation: stk-ring 1.2s ease-in-out 2; }
@keyframes stk-ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
.stk-remove { position: absolute; top: 0.35rem; right: 0.35rem; color: var(--pt-faint); }
.stk-remove:hover { color: var(--pt-danger); }
.stk-card.flash-up { animation: stk-flash-up 1.2s ease-out; }
.stk-card.flash-down { animation: stk-flash-down 1.2s ease-out; }
@keyframes stk-flash-up { 0% { background: var(--stk-up-soft); } 100% { background: var(--pt-surface); } }
@keyframes stk-flash-down { 0% { background: var(--stk-down-soft); } 100% { background: var(--pt-surface); } }

/* 個股報價 */
.stk-code-lg { font-size: 1rem; font-weight: 700; color: var(--pt-muted); }
#btnWatch.is-on { color: #b7791f; border-color: #f2c94c; background: #fff8e1; }
.quote-card { padding: 1rem 1.15rem; display: grid; gap: 1rem; margin-bottom: var(--pt-gap); }
.qc-main { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.85rem; row-gap: 0.15rem; }
.qc-price { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.qc-main.is-up .qc-price, .qc-main.is-up .qc-chg { color: var(--stk-up); }
.qc-main.is-down .qc-price, .qc-main.is-down .qc-chg { color: var(--stk-down); }
.qc-chg { font-size: 1.05rem; font-weight: 700; color: var(--pt-muted); }
.qc-time { flex-basis: 100%; font-size: 0.8125rem; color: var(--pt-muted); }
.qc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem 0.75rem; margin: 0; }
.qc-grid > div { padding: 0.45rem 0.6rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); min-width: 0; }
.qc-grid dt { font-size: 0.75rem; font-weight: 600; color: var(--pt-muted); }
.qc-grid dd { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 分頁 */
.stk-tabs { display: flex; gap: 0.25rem; overflow-x: auto; margin-bottom: 0.75rem; padding: 0.25rem; border-radius: var(--pt-radius); background: #eef1f6; scrollbar-width: none; }
.stk-tabs::-webkit-scrollbar { display: none; }
.stk-tabs [role="tab"] {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: var(--pt-touch);
  padding: 0 0.85rem; border: 0; border-radius: var(--pt-radius-sm); background: transparent; color: var(--pt-muted); font-weight: 700; white-space: nowrap;
}
.stk-tabs [role="tab"][aria-selected="true"] { background: var(--pt-surface); color: var(--mod); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }

/* K 線 */
.k-legend { display: inline-flex; gap: 0.75rem; font-size: 0.8125rem; font-weight: 700; }
.k-ma5 { color: #d98a00; }
.k-ma20 { color: #7c5cff; }
.k-info { display: flex; flex-wrap: wrap; gap: 0.15rem 0.85rem; font-size: 0.8125rem; color: var(--pt-text); margin: 0 0 0.5rem; min-height: 2.6em; }
.k-info strong { font-weight: 800; }
.k-chart { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.k-chart svg { display: block; width: 100%; height: auto; }
.k-chart .grid-line { stroke: #edf0f5; }
.k-chart .axis-text { fill: var(--pt-faint); }
.k-cross { stroke: #475467; stroke-width: 1; stroke-dasharray: 3 3; }
.k-hit { cursor: crosshair; }

/* 營收與 EPS */
.fund-kpis { margin: 0.5rem 0 0.75rem; }
.fund-kpis .kpi-value small { font-size: 0.8rem; font-weight: 700; color: var(--pt-muted); }
.fund-kpis .kpi-sub b { font-weight: 800; }
.fund-chart { margin-bottom: 0.75rem; }
.fund-chart .bar-hl { fill: var(--mod); }
.fund-chart .bar-norm { fill: color-mix(in srgb, var(--mod) 40%, #fff); }
.fund-chart .bar-neg { fill: var(--stk-down); }
.fund-table { margin-bottom: 0; font-size: 0.9rem; }
.fund-table th, .fund-table td { padding: 0.5rem 0.6rem; white-space: nowrap; }
.fund-table thead th { color: var(--pt-muted); font-size: 0.8125rem; }
.fund-table td.is-up, .fund-table td.is-down { font-weight: 700; }

/* 新聞與重大訊息 */
.ann-list, .news-list, .alert-list, .stk-notes { list-style: none; margin: 0; padding: 0; }
.ann-list li { border-bottom: 1px solid var(--pt-border); }
.ann-list li:last-child, .news-list li:last-child, .stk-notes li:last-child { border-bottom: 0; }
.ann-list summary { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.6rem 0; cursor: pointer; min-height: var(--pt-touch); list-style: none; }
.ann-list summary::-webkit-details-marker { display: none; }
.ann-list summary::after { content: "展開說明"; font-size: 0.75rem; color: var(--mod); font-weight: 700; }
.ann-list details[open] summary::after { content: "收合"; }
.ann-time { font-size: 0.75rem; color: var(--pt-muted); }
.ann-title { font-weight: 700; }
.ann-body { white-space: pre-wrap; font-size: 0.875rem; padding: 0.75rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); max-height: 50vh; overflow-y: auto; }
.ann-link { display: inline-flex; align-items: center; gap: 0.3rem; min-height: var(--pt-touch); font-size: 0.875rem; font-weight: 600; }
.news-list li { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0; border-bottom: 1px solid var(--pt-border); }
.news-list a { font-weight: 700; color: var(--pt-text); text-decoration: none; }
.news-list a:hover { color: var(--mod); text-decoration: underline; }
.news-list a .bi { font-size: 0.75em; color: var(--pt-faint); }
.news-list small { color: var(--pt-muted); }

/* 目標價、筆記 */
.alert-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem 0.75rem; align-items: end; margin-bottom: 0.75rem; }
.alert-form .form-error-summary, .alert-form-btn { grid-column: 1 / -1; }
.alert-form-btn .btn { width: 100%; }
.alert-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.5rem; border-radius: var(--pt-radius-sm); }
.alert-list li + li { margin-top: 0.25rem; }
.alert-list li > span:first-of-type { flex: 1 1 auto; }
.alert-list li.is-hit { background: var(--pt-warning-soft); }
.alert-list li.is-hit > .bi { color: #d98a00; }
.stk-notes { margin-top: 0.75rem; }
.stk-notes li { padding: 0.6rem 0; border-bottom: 1px solid var(--pt-border); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-foot { display: flex; align-items: center; gap: 0.25rem; color: var(--pt-muted); }
.note-foot small { margin-right: auto; }

/* 首頁自選股小卡 */
.home-stk { list-style: none; margin: 0; padding: 0; }
.home-stk li + li { border-top: 1px solid var(--pt-border); }
.home-stk a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 0.75rem; padding: 0.5rem 0; min-height: var(--pt-touch); color: var(--pt-text); text-decoration: none; }
.home-stk .hs-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-stk .hs-name small { color: var(--pt-muted); font-weight: 600; margin-left: 0.3rem; }
.home-stk .hs-price { font-weight: 800; text-align: right; }
.home-stk .hs-chg { grid-column: 2; font-size: 0.75rem; font-weight: 700; text-align: right; }
.home-stk .is-up .hs-price, .home-stk .is-up .hs-chg { color: var(--stk-up); }
.home-stk .is-down .hs-price, .home-stk .is-down .hs-chg { color: var(--stk-down); }
.home-stk .hs-hit { grid-column: 1; font-size: 0.75rem; color: #b7791f; font-weight: 700; }

@media (min-width: 768px) {
  .mkt-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 576px) {
  .alert-form { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; }
  .alert-form-btn { grid-column: auto; }
  .stk-tabs [role="tab"] { flex: 1 1 0; }
}
@media (max-width: 575.98px) {
  /* 手機：自選股兩欄小卡 */
  .stk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .stk-link { padding: 0.7rem 0.7rem 0.75rem 0.9rem; }
  .stk-top { flex-wrap: wrap; column-gap: 0.35rem; row-gap: 0; padding-right: 1.9rem; }
  .stk-top .tag { display: none; }
  .stk-name { font-size: 0.95rem; flex: 1 1 100%; }
  .stk-price { font-size: 1.35rem; }
  .stk-chg { font-size: 0.78rem; }
  .stk-range { grid-template-columns: minmax(0, 1fr); }
  .stk-range .num { display: none; }
  .stk-remove { top: 0; right: 0; }
  .stk-hit { font-size: 0.7rem; }
  /* 分頁：圖示在上、文字在下，四個都看得到 */
  .stk-tabs [role="tab"] { flex: 1 1 0; flex-direction: column; gap: 0; min-height: 54px; padding: 0.3rem 0.2rem; font-size: 0.78rem; }
  .stk-tabs [role="tab"] .bi { font-size: 1.05rem; }
  .fund-kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .fund-table { font-size: 0.85rem; }
  .fund-table th, .fund-table td { padding: 0.45rem 0.35rem; }
}
@media (min-width: 576px) {
  .fund-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .quote-card { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); align-items: center; }
}
@media (min-width: 1200px) {
  .qc-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .quote-card { grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot, .stk-hit, .stk-card.flash-up, .stk-card.flash-down { animation: none; }
}

/* ============================================================
   行事曆
   ============================================================ */
.ci-event { --ci: var(--c-home); --ci-soft: var(--c-home-soft); }
.ci-task { --ci: var(--c-tasks); --ci-soft: var(--c-tasks-soft); }
.ci-bill { --ci: var(--c-bills); --ci-soft: var(--c-bills-soft); }
.ci-date { --ci: var(--c-dates); --ci-soft: var(--c-dates-soft); }
.cal-card { overflow: hidden; margin-bottom: var(--pt-gap); }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--pt-border); }
.cal-nav { display: flex; align-items: center; gap: 0.25rem; }
.cal-title { font-size: 1.15rem; font-weight: 800; margin: 0; min-width: 8.5em; text-align: center; font-variant-numeric: tabular-nums; }
.cal-today-btn { margin-left: 0.4rem; min-height: 36px; }
.cal-layers { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cal-layer {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 36px; padding: 0 0.7rem; border-radius: 999px;
  border: 1px solid var(--pt-border); background: var(--pt-surface); color: var(--pt-muted); font-size: 0.8125rem; font-weight: 600;
}
.cal-layer i { width: 10px; height: 10px; border-radius: 3px; background: var(--ly); opacity: 0.35; }
.cal-layer[aria-pressed="true"] { color: var(--pt-text); border-color: color-mix(in srgb, var(--ly) 45%, var(--pt-border)); background: color-mix(in srgb, var(--ly) 8%, var(--pt-surface)); }
.cal-layer[aria-pressed="true"] i { opacity: 1; }
.ly-event { --ly: var(--c-home); } .ly-task { --ly: var(--c-tasks); } .ly-bill { --ly: var(--c-bills); } .ly-date { --ly: var(--c-dates); } .ly-zhai { --ly: var(--c-zhai); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0.4rem 0; border-bottom: 1px solid var(--pt-border); background: var(--pt-surface-2); }
.cal-week span { text-align: center; font-size: 0.8125rem; font-weight: 700; color: var(--pt-muted); }
.cal-week .is-sun { color: var(--pt-danger); } .cal-week .is-sat { color: var(--c-home); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); transition: opacity 0.2s ease; }
.cal-grid.is-loading { opacity: 0.6; }
.cal-cell {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0.1rem; min-width: 0; min-height: 104px;
  padding: 0.35rem 0.35rem 0.4rem; border: 0; border-right: 1px solid var(--pt-border); border-bottom: 1px solid var(--pt-border);
  background: var(--pt-surface); color: var(--pt-text); text-align: left; transition: background-color 0.15s ease;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--pt-surface-2); }
.cal-cell.is-other { background: #fafbfd; }
.cal-cell.is-other .cal-num, .cal-cell.is-other .cal-lunar { opacity: 0.45; }
.cal-cell.is-selected { background: var(--mod-soft); box-shadow: inset 0 0 0 2px var(--mod); z-index: 1; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.2rem; }
.cal-num { display: inline-flex; align-items: center; justify-content: center; min-width: 1.75rem; height: 1.75rem; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-cell.is-sun .cal-num { color: var(--pt-danger); }
.cal-cell.is-sat .cal-num { color: var(--c-home); }
.cal-cell.is-today .cal-num { background: var(--mod); color: #fff; }
.cal-zhai { display: inline-flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem; border-radius: 6px; background: var(--c-zhai-soft); color: var(--c-zhai); font-size: 0.7rem; font-weight: 800; }
.cal-lunar { font-size: 0.7rem; color: var(--pt-faint); line-height: 1.2; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-lunar.is-month { color: var(--c-calendar); font-weight: 700; }
.cal-cell.is-zhai .cal-lunar { color: var(--c-zhai); font-weight: 700; }
.cal-items { display: flex; flex-direction: column; gap: 2px; margin-top: 0.15rem; min-width: 0; }
.cal-pill {
  display: block; padding: 1px 0.35rem; border-radius: 5px; background: var(--ci-soft); color: var(--ci);
  border-left: 3px solid var(--ci); font-size: 0.72rem; font-weight: 600; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-pill.is-overdue { background: var(--pt-danger-soft); color: var(--pt-danger-ink); border-left-color: var(--pt-danger); }
.cal-more { font-size: 0.7rem; color: var(--pt-muted); font-weight: 700; padding-left: 0.2rem; }
.cal-day-card .card-header { flex-wrap: wrap; gap: 0.5rem; }
.cal-day-card .card-header h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; min-width: 0; }
#btnAddOnDay { white-space: nowrap; min-height: 40px; }
.cal-day-lunar { font-size: 0.8125rem; font-weight: 600; color: var(--pt-muted); }
.tag-zhai { background: var(--c-zhai-soft); color: var(--c-zhai); }
.cal-list, .up-list { list-style: none; margin: 0; padding: 0; }
.cal-list li + li { border-top: 1px solid var(--pt-border); }
.cl-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; width: 100%; min-height: 52px;
  padding: 0.5rem 0.25rem; border: 0; background: none; color: var(--pt-text); text-align: left; text-decoration: none; border-radius: var(--pt-radius-sm);
}
.cl-row:hover { background: var(--pt-surface-2); }
.cl-ico { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ci-soft); color: var(--ci); flex: none; }
.cl-main { display: flex; flex-direction: column; min-width: 0; }
.cl-main strong { overflow-wrap: anywhere; }
.cl-main small { color: var(--pt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-time { font-size: 0.8125rem; font-weight: 700; color: var(--pt-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 767.98px) {
  .cal-bar { padding: 0.6rem 0.6rem; }
  .cal-cell { min-height: 64px; padding: 0.25rem 0.15rem; align-items: center; }
  .cal-head { justify-content: center; }
  .cal-num { min-width: 1.6rem; height: 1.6rem; font-size: 0.875rem; }
  .cal-zhai { position: absolute; top: 2px; right: 2px; width: 0.95rem; height: 0.95rem; font-size: 0.55rem; border-radius: 4px; }
  .cal-lunar { font-size: 0.62rem; text-align: center; max-width: 100%; }
  .cal-items { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px; }
  .cal-pill { width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%; background: var(--ci); font-size: 0; }
  .cal-pill.is-overdue { background: var(--pt-danger); }
  .cal-more { display: none; }
  .cal-layers { width: 100%; }
  .cal-layer { min-height: 34px; padding: 0 0.6rem; }
}

/* 首頁：即將到來、常用連結 */
.zhai-note { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; margin-bottom: 0.6rem; border-radius: var(--pt-radius-sm); background: var(--c-zhai-soft); color: #7a5312; font-weight: 600; }
.zhai-note.is-today { background: linear-gradient(90deg, #fde68a, var(--c-zhai-soft)); }
.zhai-note span { display: flex; flex-direction: column; }
.zhai-note small { font-weight: 500; opacity: 0.85; }
.up-list li + li { border-top: 1px dashed var(--pt-border); }
.up-list a { display: grid; grid-template-columns: 4.6rem auto minmax(0, 1fr); align-items: center; gap: 0.6rem; padding: 0.45rem 0; min-height: var(--pt-touch); color: var(--pt-text); text-decoration: none; }
.up-when { display: flex; flex-direction: column; line-height: 1.2; }
.up-when b { font-size: 0.9rem; }
.up-when small { font-size: 0.72rem; color: var(--pt-muted); }
.up-when.is-hot b { color: var(--pt-danger); }
.up-main { display: flex; flex-direction: column; min-width: 0; }
.up-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-main small { color: var(--pt-muted); }
.home-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 0.4rem; }
.home-links a { display: flex; align-items: center; gap: 0.5rem; min-height: var(--pt-touch); padding: 0.35rem 0.5rem; border-radius: var(--pt-radius-sm); border: 1px solid var(--pt-border); color: var(--pt-text); text-decoration: none; }
.home-links a:hover { border-color: var(--mod); background: var(--mod-soft); }
.hl-name { font-weight: 600; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ============================================================
   固定繳費
   ============================================================ */
.bills-grid { align-items: start; }
.bill-list { list-style: none; margin: 0; padding: 0; }
.bill-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "date main right" "date actions actions";
  gap: 0.35rem 0.85rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--pt-border);
}
.bill-item:last-child { border-bottom: 0; }
.bill-date { grid-area: date; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 3.6rem; height: 3.6rem; border-radius: 14px; background: var(--mod-soft); color: var(--mod); line-height: 1.1; }
.bill-date b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bill-date small { font-size: 0.7rem; font-weight: 600; }
.bill-item.is-overdue .bill-date { background: var(--pt-danger); color: #fff; }
.bill-item.is-soon .bill-date { background: var(--pt-warning-soft); color: var(--pt-warning-ink); }
.bill-item.is-off { opacity: 0.6; }
.bill-item.is-off .bill-date { background: #eef1f6; color: var(--pt-muted); }
.bill-main { grid-area: main; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.bill-main strong { font-size: 1rem; overflow-wrap: anywhere; }
.bill-main small { color: var(--pt-muted); overflow-wrap: anywhere; }
.bill-right { grid-area: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.bill-amt { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.bill-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 0.15rem; }
.bill-actions .btn-sm { min-height: 36px; margin-right: auto; }

/* ============================================================
   重要日期
   ============================================================ */
.date-filter { margin: 0 0 var(--pt-gap); }
.date-filter .chip { min-height: 40px; }
.date-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 0.75rem; }
.date-grid.is-past .date-card { opacity: 0.65; }
.date-card {
  --kc: var(--c-dates); --kc-soft: var(--c-dates-soft);
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.9rem; padding: 1rem 2.75rem 1.1rem 1rem;
  border-radius: var(--pt-radius); background: var(--pt-surface); border: 1px solid var(--pt-border); box-shadow: var(--pt-shadow); overflow: hidden;
}
.date-card.k-birthday { --kc: #db2777; --kc-soft: #fce7f3; }
.date-card.k-anniversary { --kc: #e11d48; --kc-soft: #fde8ed; }
.date-card.k-trip { --kc: #0ea5e9; --kc-soft: #e3f4fc; }
.date-card.k-document { --kc: #ea6a1f; --kc-soft: #fff0e6; }
.date-card.k-other { --kc: #7c5cff; --kc-soft: #f1edff; }
.date-card.is-remind { border-color: color-mix(in srgb, var(--kc) 45%, var(--pt-border)); }
.date-card.is-today { background: linear-gradient(135deg, var(--kc-soft), var(--pt-surface) 70%); border-color: var(--kc); }
.dc-count { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 4.6rem; height: 4.6rem; border-radius: 18px; background: var(--kc-soft); color: var(--kc); line-height: 1.1; }
.dc-count b { font-size: 1.6rem; font-weight: 800; }
.dc-count small { font-size: 0.72rem; font-weight: 700; }
.dc-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.dc-kind { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 700; color: var(--kc); }
.dc-title { font-size: 1.05rem; overflow-wrap: anywhere; }
.dc-date { font-size: 0.8125rem; color: var(--pt-muted); }
.dc-extra { font-size: 0.8125rem; font-weight: 700; color: var(--pt-text); }
.dc-note { font-size: 0.8125rem; color: var(--pt-muted); overflow-wrap: anywhere; }
.dc-tag { align-self: flex-start; margin-top: 0.2rem; }
.dc-edit { position: absolute; top: 0.35rem; right: 0.35rem; color: var(--pt-faint); }
.dc-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--kc-soft); }
.dc-bar i { display: block; height: 100%; background: var(--kc); border-radius: 0 4px 4px 0; transition: width 0.8s var(--pt-ease); }

/* ============================================================
   常用連結
   ============================================================ */
#btnArrange.is-on { background: var(--mod-soft); border-color: var(--mod); color: var(--mod); }
.lk-group + .lk-group { margin-top: var(--pt-gap-lg); }
.lk-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; font-weight: 800; margin: 0 0 0.6rem; color: var(--pt-text); }
.lk-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 0.6rem; }
.lk-tile { display: flex; align-items: center; border-radius: var(--pt-radius-sm); background: var(--pt-surface); border: 1px solid var(--pt-border); box-shadow: var(--pt-shadow); transition: transform 0.2s var(--pt-ease), box-shadow 0.2s var(--pt-ease); min-width: 0; }
.lk-tile:hover { transform: translateY(-2px); box-shadow: var(--pt-shadow-hover); }
.lk-link { flex: 1 1 auto; display: flex; align-items: center; gap: 0.7rem; min-width: 0; min-height: 60px; padding: 0.55rem 0.75rem; color: var(--pt-text); text-decoration: none; }
.lk-ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none; border-radius: 11px; color: #fff; font-weight: 800; font-size: 1rem; }
.home-links .lk-ico { width: 28px; height: 28px; border-radius: 8px; font-size: 0.8rem; }
.lk-text { display: flex; flex-direction: column; min-width: 0; }
.lk-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-text small { color: var(--pt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-go { margin-left: auto; color: var(--pt-faint); font-size: 0.8rem; }
.lk-tools { display: flex; flex: none; padding-right: 0.25rem; }
@media (prefers-reduced-motion: reduce) {
  .dc-bar i, .lk-tile, .cal-grid { transition: none; }
}

/* ============================================================
   v12：快速新增、重複行程、自訂首頁、選單排序、通知中心
   ============================================================ */
body[data-page="notify"] { --mod: var(--c-home); --mod-soft: var(--c-home-soft); }
.app-nav .mod-notify { --nav: #f59f00; --nav-soft: #fff5de; }
.ci-zhai { --ci: var(--c-zhai); --ci-soft: var(--c-zhai-soft); }
.ci-stock { --ci: var(--c-stocks); --ci-soft: var(--c-stocks-soft); }

/* 首頁：四個快捷鍵、自訂按鈕 */
.hero-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hero-tools { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.hero-custom {
  display: inline-flex; align-items: center; justify-content: center; width: var(--pt-touch); height: var(--pt-touch);
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.1rem;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.hero-custom:hover { background: rgba(255, 255, 255, 0.28); }
.hero-custom:active { transform: scale(0.94); }
.hero-custom:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.8); outline-offset: 2px; }
@media (min-width: 576px) {
  .hero-actions { grid-template-columns: repeat(4, minmax(0, 140px)); }
}
@media (max-width: 380px) {
  .hero-action { font-size: 0.8125rem; min-height: 62px; }
}

/* 頂欄鈴鐺、側欄未讀數 */
.bell-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--pt-touch); height: var(--pt-touch); border-radius: 50%; color: #344054; font-size: 1.2rem; text-decoration: none;
}
.bell-btn:hover { background: var(--pt-surface-2); color: var(--pt-text); }
.bell-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--pt-danger); box-shadow: 0 0 0 2px #fff; }
.app-topbar-title + .bell-btn { margin-left: 0; }
.nav-badge {
  margin-left: auto; min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--pt-danger); color: #fff;
  font-size: 0.75rem; font-weight: 700; line-height: 1.4rem; text-align: center;
}

/* 快速新增的分頁 */
.quick-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; margin-bottom: 1rem;
  padding: 0.25rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); border: 1px solid var(--pt-border);
}
.quick-tabs button {
  --qt: var(--c-home); --qt-soft: var(--c-home-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  min-height: 56px; border: 0; border-radius: calc(var(--pt-radius-sm) - 2px); background: transparent; color: var(--pt-muted);
  font-size: 0.875rem; font-weight: 600;
}
.quick-tabs button .bi { font-size: 1.2rem; }
.quick-tabs button[aria-selected="true"] { background: var(--pt-surface); color: var(--qt); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
.quick-tabs button:focus-visible { outline: 3px solid rgba(46, 61, 176, 0.5); outline-offset: 1px; }
.quick-tabs .qt-task { --qt: var(--c-tasks); }
.quick-tabs .qt-ledger { --qt: var(--c-ledger); }
.quick-tabs .qt-event { --qt: var(--c-calendar); }
.quick-tabs .qt-note { --qt: #c78a00; }
#quickModal .chip-row { margin-top: 0; }
#quickModal .chip { min-height: 38px; padding: 0.2rem 0.75rem; }
#quickModal .chip.is-selected { border-color: var(--pt-primary); background: var(--pt-primary-soft); }

/* 多選項詢問視窗 */
.choose-list { display: grid; gap: 0.5rem; }
.choose-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; width: 100%; text-align: left;
  min-height: var(--pt-touch); padding: 0.65rem 0.9rem; border-radius: var(--pt-radius-sm);
  border: 1px solid var(--pt-border-strong); background: var(--pt-surface); color: var(--pt-text);
}
.choose-opt small { color: var(--pt-muted); }
.choose-opt:hover { background: var(--pt-surface-2); border-color: var(--pt-primary); }
.choose-opt:focus-visible { outline: 3px solid rgba(46, 61, 176, 0.5); outline-offset: 1px; }
.choose-opt.is-danger strong { color: var(--pt-danger-ink); }
.choose-opt.is-danger:hover { border-color: var(--pt-danger); background: var(--pt-danger-soft); }

/* 行程的重複設定 */
.ev-repeat { padding: 0.75rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); border: 1px solid var(--pt-border); }
.ev-series-note { display: flex; gap: 0.4rem; align-items: flex-start; margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--pt-radius-sm); background: var(--c-calendar-soft); color: #0b5f58; font-size: 0.875rem; }
.wk-picks { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.3rem; }
.wk-pick {
  min-height: 40px; border-radius: 10px; border: 1px solid var(--pt-border-strong); background: var(--pt-surface); color: var(--pt-text); font-weight: 600;
}
.wk-pick.is-sun { color: var(--pt-danger-ink); }
.wk-pick.is-sat { color: var(--c-calendar); }
.wk-pick[aria-pressed="true"] { background: var(--c-calendar); border-color: var(--c-calendar); color: #fff; }
.wk-pick:focus-visible { outline: 3px solid rgba(13, 148, 136, 0.45); outline-offset: 1px; }
.cal-pill.is-repeat::before { content: "↻ "; opacity: 0.75; }

/* 排序清單（自訂首頁、選單排序） */
.sort-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.sort-item {
  display: flex; align-items: center; gap: 0.5rem; min-height: var(--pt-touch); padding: 0.25rem 0.35rem 0.25rem 0.75rem;
  border-radius: var(--pt-radius-sm); border: 1px solid var(--pt-border); background: var(--pt-surface);
}
.sort-item .form-check-input { margin: 0; flex: none; width: 1.15rem; height: 1.15rem; }
.sort-item label { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; padding: 0.35rem 0; }
.sort-item label .bi { color: var(--pt-muted); }
.sort-item.is-hidden label { color: var(--pt-faint); text-decoration: line-through; }
.sort-fixed { font-size: 0.75rem; color: var(--pt-muted); padding: 0 0.6rem; }

/* 通知中心 */
.notify-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pt-gap); align-items: start; }
@media (min-width: 992px) { .notify-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.notify-list { list-style: none; margin: 0; padding: 0; }
.notify-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem 0.25rem; border-bottom: 1px solid var(--pt-border); }
.notify-item:last-child { border-bottom: 0; }
.notify-item.is-unread { background: linear-gradient(90deg, var(--pt-primary-soft), transparent 70%); border-radius: var(--pt-radius-sm); }
.notify-main { flex: 1 1 auto; min-width: 0; }
.notify-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.notify-item.is-unread .notify-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pt-primary); margin-right: 0.4rem; vertical-align: middle; }
.notify-msg { margin: 0.15rem 0 0; white-space: pre-line; color: #344054; font-size: 0.9375rem; overflow-wrap: anywhere; }
.notify-meta { margin: 0.25rem 0 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; color: var(--pt-muted); font-size: 0.8125rem; }
.notify-actions { display: flex; flex: none; gap: 0.1rem; }
.push-kinds { display: grid; gap: 0.4rem; }
.push-kinds .form-check { display: flex; gap: 0.6rem; align-items: flex-start; margin: 0; padding: 0.55rem 0.75rem; border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); cursor: pointer; }
.push-kinds .form-check-input { float: none; margin: 0.2rem 0 0; flex: none; }
.push-kinds .form-check-label { display: flex; flex-direction: column; }
.push-kinds small { color: var(--pt-muted); }

/* ============================================================
   v13：附近停車場、服務條款與隱私權政策
   ============================================================ */
body[data-page="parking"] { --mod: var(--c-parking); --mod-soft: var(--c-parking-soft); }
.app-nav .mod-parking { --nav: var(--c-parking); --nav-soft: var(--c-parking-soft); }
.tone-parking { --mod: var(--c-parking); --mod-soft: var(--c-parking-soft); }
:root { --pk-ok: #15803d; --pk-ok-soft: #e3f5e9; --pk-few: #b45309; --pk-few-soft: #fdf1dc; --pk-full: #c81e1e; --pk-full-soft: #fde7e7; --pk-na: #667085; --pk-na-soft: #eef0f3; }

/* 定位列 */
.pk-loc .card-body { display: flex; flex-direction: column; gap: 0.75rem; }
.pk-loc-row { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: flex-start; }
.pk-loc-ico {
  flex: none; width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-parking-soft); color: var(--c-parking); font-size: 1.4rem;
}
.pk-loc-ico.is-busy .bi { animation: pk-spin 1.4s linear infinite; }
.pk-loc-ico.is-great, .pk-loc-ico.is-good { background: var(--pk-ok-soft); color: var(--pk-ok); }
.pk-loc-ico.is-fair { background: var(--pk-few-soft); color: var(--pk-few); }
.pk-loc-ico.is-poor, .pk-loc-ico.is-error { background: var(--pk-full-soft); color: var(--pk-full); }
@keyframes pk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pk-loc-ico.is-busy .bi { animation: none; } }
.pk-loc-main { flex: 1 1 260px; min-width: 0; }
.pk-loc-title { margin: 0; font-weight: 700; font-size: 1.05rem; }
.pk-loc-sub { margin: 0.15rem 0 0; color: var(--pt-muted); font-size: 0.9375rem; }
.pk-loc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pk-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; margin-top: 0.5rem; }
.pk-acc-bar { flex: 0 0 140px; height: 8px; border-radius: 999px; background: var(--pt-surface-2); overflow: hidden; border: 1px solid var(--pt-border); }
.pk-acc-bar span { display: block; height: 100%; width: 10%; border-radius: inherit; background: var(--pk-na); transition: width 0.4s ease; }
.pk-acc.is-great .pk-acc-bar span, .pk-acc.is-good .pk-acc-bar span { background: var(--pk-ok); }
.pk-acc.is-fair .pk-acc-bar span { background: var(--pk-few); }
.pk-acc.is-poor .pk-acc-bar span { background: var(--pk-full); }
.pk-acc-text { font-size: 0.875rem; color: #344054; }
.pk-tips { padding: 0.75rem 1rem; border-radius: var(--pt-radius-sm); background: var(--pk-few-soft); color: #5c3b06; font-size: 0.9375rem; }
.pk-tips ul { padding-left: 1.2rem; }

/* 篩選 */
.pk-filters .card-body { display: flex; flex-direction: column; gap: 0.75rem; }
.pk-filter-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; justify-content: space-between; }
.seg-group { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); border: 1px solid var(--pt-border); }
.seg-btn {
  min-height: 40px; padding: 0.3rem 0.8rem; border: 0; border-radius: calc(var(--pt-radius-sm) - 2px); background: transparent; color: var(--pt-muted); font-weight: 600; font-size: 0.9375rem;
}
.seg-btn[aria-pressed="true"] { background: var(--pt-surface); color: var(--mod); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
.seg-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 1px; }
#pkSort { min-height: 40px; width: auto; }

/* 分頁 */
.pk-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.75rem; }
.pk-tabs button {
  min-height: 44px; padding: 0.4rem 1rem; border-radius: 999px; border: 1px solid var(--pt-border-strong); background: var(--pt-surface); color: #344054; font-weight: 600;
}
.pk-tabs button[aria-selected="true"] { background: var(--mod); border-color: var(--mod); color: #fff; }
.pk-tabs button:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 2px; }
.pk-updated { margin-left: auto; font-size: 0.8125rem; color: var(--pt-muted); }

/* 版面：分布圖＋清單 */
.pk-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pt-gap); align-items: start; }
@media (min-width: 992px) { .pk-layout { grid-template-columns: 320px minmax(0, 1fr); } .pk-radar-card { position: sticky; top: 1rem; } }
.pk-radar { display: block; width: 100%; max-width: 300px; margin: 0 auto; height: auto; }
.pk-ring { fill: var(--c-parking-soft); stroke: #c7d6f7; stroke-width: 1.5; }
.pk-ring.is-half { fill: none; stroke-dasharray: 4 4; }
.pk-axis { stroke: #c7d6f7; stroke-width: 1; }
.pk-n { font-size: 12px; font-weight: 700; fill: var(--c-parking); }
.pk-scale { font-size: 10px; fill: var(--pt-muted); }
.pk-accring { fill: rgba(37, 99, 235, 0.14); stroke: rgba(37, 99, 235, 0.45); stroke-width: 1; }
.pk-me { fill: var(--c-parking); stroke: #fff; stroke-width: 3; }
.pk-dot { stroke: #fff; stroke-width: 2; }
.pk-dot.pk-ok { fill: var(--pk-ok); } .pk-dot.pk-few { fill: var(--pk-few); } .pk-dot.pk-full { fill: var(--pk-full); } .pk-dot.pk-na { fill: #98a2b3; }
.pk-radar a:focus-visible .pk-dot, .pk-radar a:hover .pk-dot { stroke: #111827; stroke-width: 2.5; }
.pk-legend { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1rem; font-size: 0.8125rem; color: #344054; }
.pk-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; }
.pk-legend .pk-ok { background: var(--pk-ok); } .pk-legend .pk-few { background: var(--pk-few); } .pk-legend .pk-full { background: var(--pk-full); } .pk-legend .pk-na { background: #98a2b3; }

/* 停車場卡片 */
.pk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.pk-card {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "avail body" "actions actions"; gap: 0.75rem 0.9rem;
  padding: 0.9rem; border-radius: var(--pt-radius); background: var(--pt-surface); border: 1px solid var(--pt-border); box-shadow: var(--pt-shadow);
  scroll-margin-top: 80px;
}
.pk-card:target { outline: 3px solid rgba(37, 99, 235, 0.45); }
@media (min-width: 768px) { .pk-card { grid-template-columns: 96px minmax(0, 1fr) auto; grid-template-areas: "avail body actions"; align-items: start; } }
.pk-avail {
  grid-area: avail; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 84px;
  border-radius: 14px; padding: 0.4rem; background: var(--pk-na-soft); color: var(--pk-na);
}
.pk-avail strong { font-size: 1.85rem; line-height: 1.05; font-weight: 800; font-variant-numeric: tabular-nums; }
.pk-avail span { font-size: 0.75rem; font-weight: 600; line-height: 1.3; }
.pk-avail.pk-ok { background: var(--pk-ok-soft); color: var(--pk-ok); }
.pk-avail.pk-few { background: var(--pk-few-soft); color: var(--pk-few); }
.pk-avail.pk-full { background: var(--pk-full-soft); color: var(--pk-full); }
.pk-body { grid-area: body; min-width: 0; }
.pk-name { margin: 0; font-size: 1.0625rem; font-weight: 700; overflow-wrap: anywhere; }
.pk-where { margin: 0.25rem 0 0; display: flex; flex-wrap: wrap; gap: 0.15rem 0.75rem; font-size: 0.875rem; color: var(--pt-muted); }
.pk-dist { color: var(--c-parking); font-weight: 700; display: inline-flex; align-items: center; gap: 0.2rem; }
.pk-dist .bi { display: inline-block; transition: transform 0.3s ease; }
.pk-addr { flex-basis: 100%; overflow-wrap: anywhere; }
.pk-chips { margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pk-chip { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--pt-surface-2); border: 1px solid var(--pt-border); font-size: 0.75rem; color: #344054; }
.pk-chip.is-open { background: var(--pk-ok-soft); border-color: #bfe5cb; color: var(--pk-ok); }
.pk-fare { margin-top: 0.4rem; font-size: 0.875rem; }
.pk-fare summary { cursor: pointer; color: var(--c-parking); font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.pk-fare p { margin: 0.25rem 0 0; white-space: pre-line; overflow-wrap: anywhere; color: #344054; }
.pk-time { margin: 0.35rem 0 0; font-size: 0.75rem; color: var(--pt-muted); }
.pk-actions { grid-area: actions; display: flex; gap: 0.4rem; align-items: center; }
@media (min-width: 768px) { .pk-actions { flex-direction: column; align-items: stretch; } }
.pk-actions .btn-sm { min-height: 44px; padding-inline: 0.9rem; }
.pk-fav[aria-pressed="true"] { color: #e0a100; }
.pk-source { margin: 1rem 0 0; font-size: 0.8125rem; color: var(--pt-muted); }

/* 服務條款、隱私權政策 */
.legal-main { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.legal-card { padding: clamp(1.25rem, 4vw, 2.5rem); border-radius: var(--pt-radius); background: var(--pt-surface); border: 1px solid var(--pt-border); box-shadow: var(--pt-shadow); }
.legal-card h1 { font-size: 1.75rem; font-weight: 800; margin: 0 0 0.25rem; }
.legal-meta { color: var(--pt-muted); font-size: 0.875rem; margin: 0 0 1.5rem; }
.legal-card h2 { font-size: 1.125rem; font-weight: 700; margin: 1.75rem 0 0.5rem; }
.legal-card p, .legal-card li { line-height: 1.85; color: #2b3245; }
.legal-card ol, .legal-card ul { padding-left: 1.4rem; }
.legal-card table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.9375rem; }
.legal-card th, .legal-card td { border: 1px solid var(--pt-border); padding: 0.5rem 0.65rem; text-align: left; vertical-align: top; }
.legal-card th { background: var(--pt-surface-2); }
.legal-table { overflow-x: auto; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1rem; margin-top: 1rem; font-size: 0.875rem; }
.legal-links a { color: var(--pt-muted); }
.legal-links a:hover { color: var(--pt-text); }
.agree-check { display: flex; gap: 0.5rem; align-items: flex-start; }
.agree-check .form-check-input { flex: none; margin-top: 0.3rem; }
.app-legal { margin-top: auto; padding: 1rem 0.75rem 0.5rem; font-size: 0.8125rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; }
.app-legal a { color: var(--pt-muted); text-decoration: none; }
.app-legal a:hover { text-decoration: underline; color: var(--pt-text); }

/* ============================================================
   v14：口袋日常 品牌介面
   原則：極簡、高效率、少干擾。主色只用口袋藍；太陽黃、珊瑚紅只做點綴。
   手機：常用功能在底部（單手可及），表單從下方升起（底部面板）。
   ============================================================ */

body { background-image: none; }
body.layout-auth, body.layout-legal {
  background:
    radial-gradient(520px 360px at 100% 0%, rgba(254, 189, 51, 0.22), transparent 62%),
    radial-gradient(620px 420px at 0% 100%, rgba(46, 61, 176, 0.12), transparent 62%),
    var(--pt-bg);
  background-attachment: fixed;
}
h1, h2, h3 { font-weight: 800; letter-spacing: 0.02em; }

/* 介面主色統一：每一頁、每張卡片的代表色都用口袋藍（資料分類的顏色不受影響） */
body[data-page] { --mod: var(--pt-primary); --mod-soft: var(--pt-primary-soft); }
.tone-primary, .tone-tasks, .tone-notes, .tone-ledger, .tone-violet, .tone-weather, .tone-stocks,
.tone-calendar, .tone-bills, .tone-dates, .tone-links, .tone-parking { --mod: var(--pt-primary); --mod-soft: var(--pt-primary-soft); }

/* ---------- 按鈕：圓潤的膠囊形，呼應圖示的圓角 ---------- */
.btn { border-radius: 999px; font-weight: 600; padding: 0.5rem 1.15rem; position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.btn-icon { border-radius: 50%; padding: 0; }
.btn-primary, .btn-mod { box-shadow: 0 6px 16px rgba(46, 61, 176, 0.24); }
.btn-primary:hover, .btn-mod:hover { box-shadow: 0 8px 20px rgba(46, 61, 176, 0.32); filter: none; }
.btn-mod { --bs-btn-hover-bg: var(--pt-primary-hover); --bs-btn-hover-border-color: var(--pt-primary-hover); --bs-btn-active-bg: var(--pt-primary-hover); }
.btn-outline-secondary { --bs-btn-hover-border-color: var(--pt-border-strong); --bs-btn-active-bg: var(--pt-surface-2); }
.btn-icon:hover { background: var(--pt-surface-2); }
.btn.is-done { --bs-btn-disabled-bg: var(--pt-success); --bs-btn-disabled-border-color: var(--pt-success); --bs-btn-disabled-color: #fff; background: var(--pt-success); border-color: var(--pt-success); color: #fff; opacity: 1; }
.btn .pt-check { display: inline-block; animation: pt-pop 0.45s var(--pt-ease-spring); }

/* 漣漪：按下去的回饋 */
.pt-ripple {
  position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: 0.18;
  transform: scale(0); animation: pt-ripple 0.55s ease-out forwards;
}
@keyframes pt-ripple { to { transform: scale(1); opacity: 0; } }
.app-tabbar a, .app-tabbar button, .seg button, .seg-btn, .chip, .hero-action, .quick-tabs button, .choose-opt, .pk-tabs button { position: relative; overflow: hidden; }

/* ---------- 表單 ---------- */
.form-control, .form-select { border-radius: 14px; }
.form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 4px rgba(46, 61, 176, 0.14); }
.form-label { font-weight: 700; }
.form-check-input { border-color: #a9a39a; }
/* 切換開關：較大、填色軌道、圓鈕彈性滑動 */
.form-switch .form-check-input {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  width: 2.8em; height: 1.6em; margin-top: 0; border: 0; background-color: #d6cfc2;
  transition: background-position 0.28s var(--pt-ease-spring), background-color 0.2s ease;
}
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); }
.form-switch .form-check-input:checked { background-color: var(--pt-primary); }
.form-switch { display: flex; align-items: center; gap: 0.5rem; padding-left: 0; }
.form-switch .form-check-input { float: none; margin-left: 0; flex: none; }
.form-switch .form-check-label { padding-left: 0; }
/* 輸入錯誤：左右搖晃 */
@keyframes pt-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
.is-shake { animation: pt-shake 0.45s ease both; }
.auth-card .alert-danger { animation: pt-shake 0.45s ease both; }

/* ---------- 卡片：留白多、分隔線少 ---------- */
.card { border-color: var(--pt-border); border-radius: var(--pt-radius); }
.card-header { border-bottom: 0; padding: 1rem 1.1rem 0.35rem; }
.card-header h2 { font-size: 1.05rem; font-weight: 800; }
.card-body { padding: 1rem 1.1rem 1.15rem; }
.card-header h2 > .bi, .ico { border-radius: 10px; }
.kpi { border-radius: var(--pt-radius); }
.kpi::after { display: none; }
.kpi-value { color: var(--pt-navy); }
.kpi.is-alert .kpi-value { color: var(--pt-danger-ink); }
.kpi.is-alert { background: #fff; border-color: #f4c9c2; }
.kpi.is-warn { background: #fff; border-color: #f3dca8; }
.count-badge { background: var(--pt-surface-2); }
/* v17：只改沒有顏色的標籤，避免蓋掉 tag-danger 等顏色 */
.tag:not([class*=" tag-"]) { background: var(--pt-surface-2); color: #4d5170; }
.skel { background: linear-gradient(90deg, #f1ebe0 0px, #faf6ef 160px, #f1ebe0 320px); background-size: 640px 100%; }
.state-empty .state-ico { border-radius: 18px; }

/* 收藏、置頂：按下時彈一下 */
.pop .bi, .bi.pop { animation: pt-pop 0.45s var(--pt-ease-spring); }

/* ---------- 頁首 ---------- */
.page-title { font-weight: 800; letter-spacing: 0.02em; }
.page-title > .bi { background: var(--pt-primary-soft); color: var(--pt-primary); box-shadow: none; border-radius: 14px; }
@media (max-width: 575.98px) {
  .page-title > .bi { display: none; }
  .page-title { font-size: 1.6rem; }
  .page-head { margin-bottom: 0.85rem; }
}

/* ---------- 手機頂欄：品牌標誌；往下捲時換成頁面名稱 ---------- */
.app-topbar { background: rgba(251, 246, 238, 0.9); border-bottom-color: transparent; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.app-topbar.is-scrolled { border-bottom-color: var(--pt-border); box-shadow: 0 4px 16px rgba(22, 28, 114, 0.05); }
.app-brand { gap: 0.5rem; flex: none; }
.app-mark { width: 32px; height: 32px; display: block; flex: none; }
.app-brand-name { font-weight: 800; color: var(--pt-navy); letter-spacing: 0.06em; font-size: 1.05rem; transition: opacity 0.2s ease; }
.app-topbar-title {
  flex: 1 1 auto; min-width: 0; margin: 0 auto 0 0.1rem; font-weight: 800; color: var(--pt-text); font-size: 1rem;
  opacity: 0; transform: translateY(6px); transition: opacity 0.2s ease, transform 0.25s var(--pt-ease);
}
.app-topbar.is-scrolled .app-brand-name { display: none; }
.app-topbar.is-scrolled .app-topbar-title { opacity: 1; transform: none; }
body[data-page="home"] .app-topbar-title { display: none; }
body[data-page="home"] .app-brand { margin-right: auto; }
body[data-page="home"] .app-topbar.is-scrolled .app-brand-name { display: inline; }
.bell-btn { color: var(--pt-text); }
.avatar { background: var(--pt-sun-soft); color: var(--pt-sun-ink); }

/* ---------- 手機底部列：首頁、常用、＋新增、常用、全部 ---------- */
.app-tabbar { background: rgba(255, 255, 255, 0.95); border-top: 1px solid var(--pt-border); align-items: flex-end; padding-top: 0.3rem; }
.app-shell .app-tabbar a, .app-shell .app-tabbar button { --nav: var(--pt-primary); color: var(--pt-muted); font-weight: 600; font-size: 0.72rem; min-height: 54px; }
.app-shell .app-tabbar .is-active { color: var(--pt-primary); font-weight: 800; }
.app-tabbar .is-active::before {
  content: ""; position: absolute; top: -0.3rem; left: 50%; width: 22px; height: 4px; margin-left: -11px;
  border-radius: 0 0 4px 4px; background: var(--pt-sun);
}
.app-tabbar .is-active .bi { transform: none; }
.app-shell .app-tabbar .tab-add { flex: 0 0 76px; overflow: visible; min-height: 54px; }
.tab-add-btn {
  display: flex; align-items: center; justify-content: center; width: 58px; height: 58px; border-radius: 50%;
  background: var(--pt-primary); color: #fff; font-size: 1.7rem;
  box-shadow: 0 10px 22px rgba(46, 61, 176, 0.38), 0 0 0 5px #fff;
  transform: translateY(-16px); transition: transform 0.28s var(--pt-ease-spring), box-shadow 0.2s ease;
}
.tab-add-btn .bi { font-size: 1.6rem; transition: transform 0.3s var(--pt-ease-spring); }
.tab-add:active .tab-add-btn { transform: translateY(-16px) scale(0.9); }
.tab-add:focus-visible { outline: none; }
.tab-add:focus-visible .tab-add-btn { outline: 3px solid rgba(46, 61, 176, 0.5); outline-offset: 3px; }
@media (hover: hover) { .tab-add:hover .tab-add-btn .bi { transform: rotate(90deg); } }

/* ---------- 「全部」：從下方升起的功能面板 ---------- */
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--pt-border-strong); margin: 0.55rem auto 0; flex: none; }
.app-offcanvas.offcanvas-bottom {
  height: auto; max-height: calc(var(--vvh) - 2.5rem - var(--pt-safe-top));
  border: 0; border-radius: 26px 26px 0 0; box-shadow: 0 -12px 40px rgba(22, 28, 114, 0.18);
  padding-top: 0; padding-bottom: var(--pt-safe-bottom);
  transition: transform 0.38s var(--pt-ease-sheet);
}
.app-offcanvas .offcanvas-header { padding: 0.5rem 1rem 0.25rem; }
.app-offcanvas .offcanvas-title .app-mark { width: 28px; height: 28px; }
.app-offcanvas .offcanvas-body { overflow-y: auto; padding: 0.5rem 1rem 1rem; gap: 0.5rem; }
.app-offcanvas .app-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.25rem; }
.app-offcanvas .app-nav .nav-item { min-width: 0; }
.app-offcanvas .app-nav .nav-link {
  position: relative; flex-direction: column; justify-content: flex-start; gap: 0.35rem; min-height: 86px; padding: 0.55rem 0.15rem;
  text-align: center; font-size: 0.8125rem; line-height: 1.3; border-radius: 16px;
}
.app-offcanvas .app-nav .nav-link .bi { width: 50px; height: 50px; border-radius: 16px; font-size: 1.4rem; background: var(--pt-primary-soft); color: var(--pt-primary); }
.app-offcanvas .app-nav .nav-link.active { background: transparent; }
.app-offcanvas .app-nav .nav-link.active .bi { background: var(--pt-primary); color: #fff; }
.app-offcanvas .nav-badge { position: absolute; top: 0.35rem; left: calc(50% + 12px); margin: 0; }
.app-offcanvas .nav-section { margin: 0.5rem 0.25rem 0.1rem; }
.app-offcanvas .app-userbox { margin-top: 0.5rem; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.app-offcanvas .app-userbox form .btn { width: auto !important; }
.app-offcanvas .app-legal { flex-basis: 100%; padding: 0; margin: 0; }
@media (max-width: 359.98px) { .app-offcanvas .app-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 576px) { .app-offcanvas .app-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); } .app-offcanvas.offcanvas-bottom { max-width: 720px; margin: 0 auto; } }

/* ---------- 桌面側欄：Logo、新增按鈕、單色圖示 ---------- */
.side-add { display: none; }
.side-add kbd { margin-left: 0.35rem; padding: 0.05rem 0.4rem; border-radius: 6px; background: rgba(255, 255, 255, 0.2); color: #fff; font-size: 0.75rem; font-family: inherit; }
.app-nav .nav-link, .app-nav [class*="mod-"] { --nav: var(--pt-primary); --nav-soft: var(--pt-primary-soft); }
.app-nav .nav-link { color: var(--pt-text); border-radius: 14px; }
.app-nav .nav-link .bi { background: transparent; color: var(--pt-muted); }
.app-nav .nav-link:hover { background: var(--pt-surface-2); }
.app-nav .nav-link.active { background: var(--pt-primary-soft); color: var(--pt-primary-ink); }
.app-nav .nav-link.active .bi { background: var(--pt-primary); color: #fff; box-shadow: 0 4px 10px rgba(46, 61, 176, 0.28); }
.app-userbox { background: var(--pt-surface-2); border-color: var(--pt-border); border-radius: 18px; }
@media (min-width: 992px) {
  .app-sidebar { background: var(--pt-surface); gap: 0.85rem; }
  .app-brand-logo { padding: 0.15rem 0.4rem 0.25rem; margin: 0; }
  .app-brand-logo img { width: 168px; height: auto; display: block; }
  .side-add { display: inline-flex; width: 100%; min-height: 48px; font-size: 1.02rem; }
}

/* ---------- 首頁問候卡：口袋藍＋太陽 ---------- */
.hero { background: var(--pt-primary); box-shadow: 0 16px 36px rgba(46, 61, 176, 0.26); border-radius: 26px; }
.hero::before {
  width: 168px; height: 168px; right: -46px; top: -74px; background: var(--pt-sun); opacity: 1;
  animation: pt-sun 14s ease-in-out infinite;
}
.hero::after {
  /* 口袋的縫線 */
  width: auto; height: 0; left: 1.1rem; right: 1.1rem; top: auto; bottom: 0.65rem; border-radius: 0;
  background: none; border-top: 2px dashed rgba(255, 255, 255, 0.35); animation: none;
}
@keyframes pt-sun { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(-6px, 6px) rotate(8deg); } }
.hero-date { opacity: 0.9; }
.hero-title { font-weight: 900; letter-spacing: 0.03em; }
.hero-weather { background: rgba(22, 28, 114, 0.38); border-color: rgba(255, 255, 255, 0.25); }
.hero-custom { background: #fff; color: var(--pt-primary); }
.hero-custom:hover { background: var(--pt-sun-soft); }
.hero-actions { margin-bottom: 0.9rem; }
.hero-action { background: #fff; border: 0; color: var(--pt-text); border-radius: 18px; box-shadow: 0 4px 12px rgba(22, 28, 114, 0.18); }
.hero-action .bi { color: var(--pt-primary); }
.hero-action:hover { background: var(--pt-sun-soft); color: var(--pt-text); }

/* ---------- 提示訊息：從下方彈出的深色膠囊 ---------- */
.app-toast { background: var(--pt-navy); color: #fff; border: 0; border-radius: 999px; box-shadow: 0 14px 34px rgba(22, 28, 114, 0.32); width: auto; max-width: min(440px, 100%); }
.app-toast .toast-body { padding: 0.45rem 0.45rem 0.45rem 1rem; }
.app-toast .btn-icon { color: rgba(255, 255, 255, 0.8); min-width: 40px; min-height: 40px; }
.app-toast .btn-icon:hover { background: rgba(255, 255, 255, 0.12); }
.app-toast-success .toast-body > .bi { color: var(--pt-sun); }
.app-toast-error .toast-body > .bi { color: #ff9a8c; }
.app-toast.showing, .app-toast.show { animation: pt-toast-in 0.42s var(--pt-ease-spring); }
@keyframes pt-toast-in { from { opacity: 0; transform: translateY(24px) scale(0.92); } to { opacity: 1; transform: none; } }
@media (max-width: 991.98px) {
  .app-toasts { top: auto; bottom: calc(var(--pt-tabbar-h) + 0.85rem + var(--pt-safe-bottom)); padding-top: 0; }
  body.modal-open .app-toasts, body.layout-auth .app-toasts, body.layout-legal .app-toasts { bottom: calc(0.85rem + var(--pt-safe-bottom)); }
}

/* ---------- 視窗：手機上改成從下方升起的底部面板，可往下滑關閉 ---------- */
.modal-content { border-radius: 24px; }
.modal-header { border-bottom: 0; padding-bottom: 0.4rem; }
.modal-footer { border-top: 0; }
.modal-title { font-weight: 800; }
@media (max-width: 575.98px) {
  .modal-dialog, .modal-fullscreen-sm-down {
    margin: 0; width: 100%; max-width: none; height: var(--vvh); min-height: 0; display: flex; align-items: flex-end;
  }
  .modal-content, .modal-fullscreen-sm-down .modal-content {
    height: auto; max-height: calc(var(--vvh) - 1.5rem - var(--pt-safe-top)); border-radius: 26px 26px 0 0; overflow-y: auto;
  }
  .modal-dialog-scrollable .modal-content { overflow: hidden; }
  .modal-content::before { content: ""; display: block; flex: none; width: 40px; height: 5px; border-radius: 3px; background: var(--pt-border-strong); margin: 0.55rem auto 0; }
  .modal-fullscreen-sm-down .modal-header { padding-top: 0.5rem; }
  .modal-header { touch-action: none; }
  .modal-footer { padding-bottom: calc(0.75rem + var(--pt-safe-bottom)); }
  .modal-footer .btn { flex: 1 1 auto; }
  .modal-footer .btn-delete, .modal-footer .form-check { flex: 0 0 auto; }
  .modal.fade .modal-dialog { transform: translateY(100%); transition: transform 0.38s var(--pt-ease-sheet); }
  .modal.show .modal-dialog { transform: none; }
  .modal.is-dragging .modal-dialog { transition: none; }
}

/* ---------- 下拉更新 ---------- */
html, body { overscroll-behavior-y: none; }
.ptr {
  position: fixed; left: 50%; top: calc(var(--pt-topbar-h) + var(--pt-safe-top) + 6px); z-index: 1015;
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; background: #fff; color: var(--pt-primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; box-shadow: 0 6px 18px rgba(22, 28, 114, 0.18);
  transform: translateY(-90px); opacity: 0; pointer-events: none;
}
.ptr .bi { transition: transform 0.2s ease; }
.ptr.is-ready .bi { transform: rotate(180deg); }
.ptr.is-loading .bi { animation: pk-spin 0.8s linear infinite; }
.ptr.is-back { transition: transform 0.3s var(--pt-ease), opacity 0.3s ease; }
@media (min-width: 992px) { .ptr { display: none; } }

/* ---------- 完成時的小彩紙 ---------- */
.pt-confetti { position: fixed; z-index: 2000; width: 8px; height: 11px; border-radius: 2px; pointer-events: none; }

/* ---------- 排序清單：可拖曳 ---------- */
.sort-handle {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 44px; margin-left: -0.5rem;
  border: 0; background: transparent; color: var(--pt-faint); cursor: grab; touch-action: none; border-radius: 10px; font-size: 1.15rem;
}
.sort-handle:active { cursor: grabbing; }
.sort-item.is-dragging { position: relative; z-index: 3; background: #fff; box-shadow: var(--pt-shadow-pop); transform: scale(1.02); }
.sort-list.is-sorting .sort-item:not(.is-dragging) { transition: transform 0.18s ease; }

/* ---------- 登入、註冊等頁面 ---------- */
.auth-logo { width: 184px; height: auto; display: block; }
.auth-brand { margin-bottom: 1.25rem; }
.auth-card { border-radius: 26px; border: 1px solid var(--pt-border); box-shadow: 0 24px 60px rgba(22, 28, 114, 0.12); }
.auth-card .btn-primary { min-height: 52px; }
.legal-card { border-radius: 26px; }

/* ---------- 停車場、快速新增等配合品牌色 ---------- */
.quick-tabs { border-radius: 18px; }
.quick-tabs button { border-radius: 14px; }
.quick-tabs .qt-task, .quick-tabs .qt-ledger, .quick-tabs .qt-event, .quick-tabs .qt-note { --qt: var(--pt-primary); }
.seg { border-radius: 999px; background: var(--pt-surface-2); border: 1px solid var(--pt-border); }
.seg button { border-radius: 999px; }
.seg-group { border-radius: 24px; }   /* 換行成兩排時也好看 */
.seg-btn { border-radius: 999px; }
.pk-tabs button[aria-selected="true"] { background: var(--pt-primary); border-color: var(--pt-primary); }

@media (prefers-reduced-motion: reduce) {
  .hero::before { animation: none; }
  .pt-ripple, .pt-confetti { display: none; }
}

/* ============================================================
   v15：會員等級、模組管理、問題回報、鈴鐺浮框
   ============================================================ */
:root {
  --tier-sunny: #2f7fc1;  --tier-sunny-soft: #e5f1fb;
  --tier-warm: #c46a00;   --tier-warm-soft: #fff1d9;
}
.tier-sunny { --tier: var(--tier-sunny); --tier-soft: var(--tier-sunny-soft); }
.tier-warm { --tier: var(--tier-warm); --tier-soft: var(--tier-warm-soft); }
.tier-badge {
  display: inline-flex; align-items: center; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: var(--tier-soft); color: var(--tier); border: 1px solid color-mix(in srgb, var(--tier) 30%, transparent); white-space: nowrap; text-decoration: none;
}
a.tier-badge:hover { color: var(--tier); filter: brightness(0.97); }
.tier-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tier); margin-right: 0.4rem; flex: none; }
.app-user-name .tier-badge { margin-left: auto; flex: none; }
.app-user-name span.avatar + span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 選單：管理員看得到的「未開放」功能 */
.nav-tag { margin-left: auto; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; background: var(--pt-surface-2); color: var(--pt-muted); border: 1px dashed var(--pt-border-strong); }
.app-offcanvas .nav-tag { position: absolute; top: 0.2rem; right: 0.15rem; margin: 0; }

/* 會員方案 */
.member-now .card-body { display: flex; align-items: center; gap: 1rem; }
.member-medal { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 2rem; background: var(--tier-soft); color: var(--tier); flex: none; }
.member-label { margin: 0; color: var(--pt-muted); font-size: 0.8125rem; font-weight: 600; }
.member-tier { margin: 0; font-size: 1.5rem; font-weight: 900; color: var(--tier); }
.member-exp { margin: 0; color: var(--pt-muted); font-size: 0.875rem; }
.tier-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; margin-top: 0.85rem; }
@media (max-width: 767.98px) { .tier-grid { grid-template-columns: 1fr; } }
.tier-card.is-current { border: 2px solid var(--tier); }
.tier-name { display: flex; align-items: center; font-size: 1.1rem; font-weight: 800; margin: 0 0 0.6rem; color: var(--tier); }
.tier-mods { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.tier-mods li { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9375rem; }
.tier-mods .bi { color: var(--tier); }
.member-note { margin: 1rem 0 0; color: var(--pt-muted); font-size: 0.875rem; text-align: center; }

/* 模組管理 */
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tier-kpi .kpi-head { display: flex; align-items: center; }
.tier-kpi .kpi-value { color: var(--tier); }
.mod-list { list-style: none; margin: 0; padding: 0; }
.mod-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--pt-border); min-height: 56px; }
.mod-row:last-child { border-bottom: 0; }
.mod-row .form-switch { flex: 1 1 auto; min-width: 0; }
.mod-status { font-size: 0.8125rem; color: var(--pt-success); font-weight: 600; white-space: nowrap; }
.mod-row.is-off .mod-status { color: var(--pt-muted); }
.mod-row.is-off .form-check-label { color: var(--pt-muted); }
.mod-tier { width: auto; flex: none; min-height: 40px; }

/* 等級異動紀錄（使用者管理） */
.tier-log { list-style: none; margin: 0; padding: 0; }
.tier-log li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--pt-border); }
.tier-log li:last-child { border-bottom: 0; }
.tl-main, .tl-meta { display: flex; flex-direction: column; min-width: 0; }
.tl-main small, .tl-meta small { color: var(--pt-muted); }
.tl-meta { text-align: right; font-size: 0.8125rem; white-space: nowrap; }

/* 問題回報 */
.fb-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1rem; align-items: start; }
@media (max-width: 991.98px) { .fb-grid { grid-template-columns: 1fr; } }
.fb-cats { display: flex; }
.fb-cats .seg-btn { flex: 1 1 0; justify-content: center; }
.fb-cats .seg-btn[aria-checked="true"] { background: #fff; color: var(--pt-primary); box-shadow: 0 2px 8px rgba(22, 28, 114, 0.1); }
.fb-list { list-style: none; margin: 0; padding: 0; }
.fb-item { padding: 0.85rem 0; border-bottom: 1px solid var(--pt-border); }
.fb-item:last-child { border-bottom: 0; }
.fb-item.is-click { cursor: pointer; border-radius: 12px; padding-left: 0.5rem; padding-right: 0.5rem; margin: 0 -0.5rem; }
.fb-item.is-click:hover, .fb-item.is-click:focus-visible { background: var(--pt-surface-2); }
.fb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; font-size: 0.875rem; }
.fb-time { color: var(--pt-muted); font-size: 0.8125rem; }
.fb-meta .fb-time:last-child { margin-left: auto; }
.fb-status { padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.fb-status.is-new { background: var(--pt-coral-soft); color: var(--pt-coral-ink); }
.fb-status.is-doing { background: var(--pt-sun-soft); color: var(--pt-sun-ink); }
.fb-status.is-done { background: #e3f6ec; color: #1f7a4d; }
.fb-replied { font-size: 0.75rem; color: var(--pt-primary); font-weight: 600; }
.fb-text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.fb-excerpt { color: var(--pt-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fb-full { padding: 0.75rem 0.9rem; border-radius: 14px; background: var(--pt-surface-2); margin-bottom: 0.6rem; }
.fb-reply { margin-top: 0.6rem; padding: 0.65rem 0.85rem; border-radius: 14px; background: var(--pt-primary-soft); }
.fb-reply-head { margin: 0 0 0.25rem; font-size: 0.8125rem; font-weight: 700; color: var(--pt-primary-ink); display: flex; gap: 0.4rem; align-items: center; }
.fb-reply-head span { margin-left: auto; font-weight: 500; color: var(--pt-muted); }
.chip-n { margin-left: 0.25rem; font-weight: 800; }
.fb-filter { margin: 0 0 0.85rem; }

/* 側欄：Logo 旁的鈴鐺 */
.side-brand { display: none; }
@media (min-width: 992px) {
  .side-brand { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
  .side-brand .app-brand-logo img { width: 150px; }
  .side-bell { position: relative; flex: none; }
}

/* 鈴鐺浮框 */
.bell-pop {
  position: fixed; z-index: 1060; width: min(380px, calc(100vw - 16px)); max-height: min(520px, calc(var(--vvh) - 90px));
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--pt-border); border-radius: 20px;
  box-shadow: 0 18px 48px rgba(22, 28, 114, 0.2); overflow: hidden;
  opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top right; transition: opacity 0.18s ease, transform 0.22s var(--pt-ease-spring);
}
.bell-pop.is-open { opacity: 1; transform: none; }
.bell-pop.is-sheet { left: 8px; right: 8px; width: auto; }
.bell-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0.9rem 0.4rem 1rem; }
.bell-pop-head strong { font-size: 1rem; }
.bell-pop-all { color: var(--pt-primary); font-weight: 600; min-height: 36px; padding: 0.2rem 0.7rem; }
.bell-pop-body { overflow-y: auto; flex: 1 1 auto; padding: 0 0.4rem; }
.bell-pop-list { list-style: none; margin: 0; padding: 0; }
.bell-pop-item {
  display: flex; align-items: flex-start; gap: 0.65rem; width: 100%; padding: 0.6rem; border: 0; background: transparent; text-align: left;
  border-radius: 14px; color: var(--pt-text);
}
.bell-pop-item:hover, .bell-pop-item:focus-visible { background: var(--pt-surface-2); }
.bp-ico { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--pt-primary-soft); color: var(--pt-primary); flex: none; }
.bp-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bp-title { font-weight: 600; font-size: 0.9375rem; color: var(--pt-muted); }
.bp-msg { font-size: 0.8125rem; color: var(--pt-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bp-time { font-size: 0.75rem; color: var(--pt-faint); white-space: nowrap; flex: none; }
.bell-pop-item.is-unread .bp-title { color: var(--pt-text); font-weight: 800; }
.bell-pop-item.is-unread .bp-time { color: var(--pt-primary); font-weight: 700; }
.bell-pop-item.is-unread .bp-ico { position: relative; }
.bell-pop-item.is-unread .bp-ico::after { content: ""; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--pt-coral); box-shadow: 0 0 0 2px #fff; }
.bell-pop-empty { margin: 0; padding: 1.75rem 1rem; text-align: center; color: var(--pt-muted); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.bell-pop-empty .bi { font-size: 1.5rem; color: var(--pt-faint); }
.bell-pop-foot { display: flex; align-items: center; justify-content: center; gap: 0.25rem; padding: 0.75rem; border-top: 1px solid var(--pt-border); font-weight: 600; text-decoration: none; min-height: 48px; }
.bell-pop .state-box { padding: 1rem; }
@media (prefers-reduced-motion: reduce) { .bell-pop { transition: none; } }
.tier-ico { margin-right: 0.4rem; }
.tier-price { margin-left: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--pt-muted); }

/* ============================================================
   v16：記事本（彩色卡片、清單）
   ============================================================ */
:root {
  --nc-yellow: #fff3b0; --nc-green: #d8f2cc; --nc-blue: #d7eafb; --nc-pink: #fde0e7;
  --nc-purple: #ebe0fb; --nc-orange: #ffe3c4; --nc-gray: #ebe8e2;
}
.nc-yellow { --nc: var(--nc-yellow); } .nc-green { --nc: var(--nc-green); } .nc-blue { --nc: var(--nc-blue); }
.nc-pink { --nc: var(--nc-pink); } .nc-purple { --nc: var(--nc-purple); } .nc-orange { --nc: var(--nc-orange); } .nc-gray { --nc: var(--nc-gray); }
.note-actions { gap: 0.4rem; }
.note-search { margin-bottom: 0.75rem; }
.note-tabs { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.15rem 0.1rem 0.6rem; margin-bottom: 0.25rem; scrollbar-width: none; }
.note-tabs::-webkit-scrollbar { display: none; }
.note-tab {
  flex: none; min-height: 40px; padding: 0.35rem 1rem; border-radius: 999px; border: 1px solid var(--pt-border); background: #fff;
  color: var(--pt-text); font-weight: 600; white-space: nowrap;
}
.note-tab[aria-selected="true"] { background: var(--pt-primary); border-color: var(--pt-primary); color: #fff; }
.note-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: start; }
@media (min-width: 768px) { .note-board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .note-board { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.note-board > .state-box { grid-column: 1 / -1; }
.note-card {
  position: relative; display: flex; flex-direction: column; gap: 0.35rem; min-height: 120px; max-height: 300px; overflow: hidden;
  padding: 0.85rem 0.9rem 0.7rem; border-radius: 18px; background: var(--nc, #fff); border: 1px solid rgba(22, 28, 114, 0.08);
  box-shadow: 0 2px 6px rgba(22, 28, 114, 0.05); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.note-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; background: linear-gradient(transparent, var(--nc, #fff)); pointer-events: none; }
.note-card:hover { box-shadow: 0 8px 20px rgba(22, 28, 114, 0.12); }
.note-card:active { transform: scale(0.98); }
.note-card:focus-visible { outline: 3px solid rgba(46, 61, 176, 0.45); outline-offset: 2px; }
.nc-pin { position: absolute; top: 0.6rem; right: 0.65rem; color: var(--pt-primary); font-size: 0.9rem; }
.nc-title { margin: 0; padding-right: 1.1rem; font-size: 1rem; font-weight: 800; line-height: 1.35; word-break: break-word; }
.nc-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 0.9375rem; line-height: 1.55; color: #33374f; }
.nc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.nc-list li { display: flex; align-items: flex-start; gap: 0.25rem; font-size: 0.9375rem; line-height: 1.4; }
.nc-list li.is-checking span { text-decoration: line-through; opacity: 0.55; }
.nc-chk { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: -0.3rem 0 -0.3rem -0.4rem; border: 0; background: transparent; color: #4b4f68; border-radius: 8px; position: relative; z-index: 1; }
.nc-chk::before { content: ""; position: absolute; inset: -7px; }
.nc-list li > span { padding-top: 0.05rem; word-break: break-word; }
.nc-more { margin: 0.15rem 0 0; font-size: 0.8125rem; color: var(--pt-muted); }
.nc-cat { margin: auto 0 0; padding-top: 0.25rem; font-size: 0.75rem; color: var(--pt-muted); position: relative; z-index: 1; }

/* 編輯畫面 */
.modal .modal-content.note-sheet { --bs-modal-bg: var(--nc, #fff); background-color: var(--nc, #fff); transition: background-color 0.25s ease; }
.note-sheet-head { gap: 0.25rem; padding: 0.5rem 0.6rem; border: 0; }
.note-saved { flex: 1 1 auto; font-size: 0.75rem; color: var(--pt-muted); text-align: right; padding-right: 0.25rem; }
.note-done { min-height: 40px; padding: 0.3rem 1rem; }
.note-sheet-body { padding: 0.25rem 1.1rem 1rem; }
.note-title-input, .note-text-input { width: 100%; border: 0; background: transparent; outline: none; color: var(--pt-text); }
.note-title-input { font-size: 1.3rem; font-weight: 800; padding: 0.3rem 0; margin-bottom: 0.25rem; }
.note-text-input { font-size: 1.05rem; line-height: 1.7; resize: none; min-height: 180px; padding: 0.3rem 0;
  background-image: linear-gradient(transparent calc(1.7em - 1px), rgba(22, 28, 114, 0.08) calc(1.7em - 1px)); background-size: 100% 1.7em; background-attachment: local; }
.note-title-input::placeholder, .note-text-input::placeholder { color: var(--pt-faint); }
.chk-list { list-style: none; margin: 0; padding: 0; }
.chk-row { display: flex; align-items: center; gap: 0.5rem; min-height: 46px; border-bottom: 1px solid rgba(22, 28, 114, 0.07); }
.chk-row .form-check-input { flex: none; width: 1.35em; height: 1.35em; margin: 0; }
.chk-text { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; outline: none; font-size: 1.05rem; padding: 0.35rem 0; color: var(--pt-text); }
.chk-row.is-done .chk-text { text-decoration: line-through; color: var(--pt-muted); }
.chk-del { flex: none; width: 36px; height: 36px; min-height: 36px; color: var(--pt-faint); opacity: 0; }
.chk-row:hover .chk-del, .chk-row:focus-within .chk-del { opacity: 1; }
@media (hover: none) { .chk-del { opacity: 1; } }
.chk-add { display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 46px; border: 0; background: transparent; color: var(--pt-muted); font-size: 1.05rem; padding: 0 0.1rem; }
.chk-done-group { margin-top: 0.5rem; border-top: 1px solid rgba(22, 28, 114, 0.12); padding-top: 0.25rem; }
.chk-done-group summary { list-style: none; display: flex; align-items: center; gap: 0.5rem; min-height: 44px; color: var(--pt-muted); font-style: italic; cursor: pointer; }
.chk-done-group summary::-webkit-details-marker { display: none; }
.chk-done-group summary .bi { transition: transform 0.2s ease; }
.chk-done-group:not([open]) summary .bi { transform: rotate(-90deg); }
.note-sheet-foot { flex-direction: column; align-items: stretch; gap: 0.5rem; padding: 0.6rem 1rem calc(0.6rem + var(--pt-safe-bottom)); border-top: 1px solid rgba(22, 28, 114, 0.08); background: rgba(255, 255, 255, 0.45); }
.note-colors { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.15rem; }
.note-color { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(22, 28, 114, 0.15); background: var(--nc, #fff); position: relative; }
.note-color[aria-checked="true"] { border-color: var(--pt-primary); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pt-primary); }
.note-color[aria-checked="true"]::after { content: "\F633"; font-family: "bootstrap-icons"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--pt-primary); font-size: 1rem; }
.note-foot-row { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.note-cat { display: flex; align-items: center; gap: 0.35rem; flex: 1 1 auto; min-width: 0; color: var(--pt-muted); }
.note-cat .form-control { background: transparent; }
.note-sheet .modal-footer > * { margin: 0; }

/* ============================================================
   v16：記帳（月份圓環圖、圖示分類、數字鍵盤）
   ============================================================ */
.lg-monthbar { display: flex; align-items: center; gap: 0.25rem; margin-bottom: 0.85rem; }
.lg-month { margin: 0; font-size: 1.35rem; font-weight: 900; min-width: 8.5em; text-align: center; }
.lg-this { margin-left: 0.25rem; }
.lg-add { margin-left: auto; }
@media (max-width: 991.98px) { .lg-add { display: none; } .lg-monthbar { justify-content: center; } }
.lg-overview .card-body { padding-top: 1.1rem; }
.lg-totals { display: flex; justify-content: space-between; gap: 0.75rem; }
.lg-total { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; border: 0; background: transparent; padding: 0.25rem 0.4rem; border-radius: 12px; min-height: 56px; opacity: 0.6; }
.lg-total.is-income { align-items: flex-end; }
.lg-total[aria-selected="true"] { opacity: 1; }
.lg-total-label { font-weight: 800; font-size: 0.95rem; color: var(--pt-text); position: relative; }
.lg-total-label::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 7px; border-radius: 4px; z-index: -1; }
.lg-total-label { z-index: 0; }
.is-expense .lg-total-label::after { background: #ffd166; }
.is-income .lg-total-label::after { background: #7cc6f2; }
.lg-total-val { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.lg-ring-wrap { position: relative; width: min(260px, 72vw); margin: 0.25rem auto 0.75rem; }
.lg-ring svg { width: 100%; height: auto; display: block; }
.lg-ring .donut-seg { transition: opacity 0.2s ease; }
.lg-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.lg-ring-label { display: flex; align-items: center; gap: 0.2rem; font-weight: 800; color: var(--pt-muted); pointer-events: auto; }
.lg-eye { border: 0; background: transparent; color: var(--pt-muted); width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.lg-eye:hover { background: var(--pt-surface-2); }
.lg-ring-val { font-size: 1.6rem; font-weight: 900; color: var(--pt-navy); font-variant-numeric: tabular-nums; }
.lg-ring-val.is-neg { color: var(--pt-danger-ink); }
.lg-alert { margin: 0 0 0.75rem; padding: 0.5rem 0.8rem; font-size: 0.875rem; }
.lg-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.lg-cats-empty { text-align: center; color: var(--pt-muted); padding: 0.5rem; }
.lg-cat { display: flex; align-items: center; gap: 0.7rem; width: 100%; border: 0; background: transparent; padding: 0.45rem 0.35rem; border-radius: 14px; text-align: left; min-height: 52px; }
.lg-cat:hover, .lg-cat[aria-pressed="true"] { background: var(--pt-surface-2); }
.lg-cat-ico { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none;
  background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--c); font-size: 1.1rem; }
.lg-cat-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.lg-cat-name { font-weight: 700; display: flex; align-items: baseline; gap: 0.4rem; }
.lg-cat-name small { color: var(--pt-faint); font-weight: 500; font-size: 0.75rem; }
.lg-cat-bar { height: 6px; border-radius: 3px; background: var(--pt-surface-2); overflow: hidden; }
.lg-cat-bar span { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.lg-cat-val { display: flex; flex-direction: column; align-items: flex-end; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lg-cat-val small { color: var(--pt-muted); font-weight: 600; font-size: 0.75rem; }
.ledger-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0 1.1rem 0.5rem; }
.ledger-filters .search-wrap { flex: 1 1 100%; }
.lg-filter-tag { display: inline-flex; align-items: center; gap: 0.2rem; padding-right: 0.2rem; }
.btn-close-tag { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }

/* 記一筆：上方分類、下方計算機 */
.lg-manage { display: flex; margin: 0.6rem auto 0; }
.lg-sheet-head { gap: 0.25rem; padding: 0.55rem 0.6rem 0.45rem; border-bottom: 1px solid var(--pt-border); }
.lg-sheet-head .lg-type { margin: 0 auto; }
.lg-type { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--pt-surface-2); border: 1px solid var(--pt-border); }
.lg-type-btn { min-width: 84px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 800; color: var(--pt-muted); cursor: pointer; }
.btn-check:checked + .lg-type-btn.is-expense { background: #ffd166; color: #5c3b00; }
.btn-check:checked + .lg-type-btn.is-income { background: #7cc6f2; color: #0b3a5c; }
.btn-check:focus-visible + .lg-type-btn { outline: 3px solid rgba(46, 61, 176, 0.45); }
.lg-sheet-body { padding: 0.6rem 0.75rem; }
@media (min-width: 576px) { .lg-entry-dialog .lg-sheet { height: min(860px, calc(var(--vvh) - 2rem)); } .lg-entry-dialog .lg-sheet-body { min-height: 0; } }
@media (max-width: 575.98px) { .lg-entry-dialog .modal-content.lg-sheet { height: calc(var(--vvh) - 0.75rem - var(--pt-safe-top)); max-height: none; } }
.lg-catgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.2rem; }
@media (min-width: 400px) { .lg-catgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.lg-cattile, .lg-cm-main { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.35rem 0.1rem; border: 0; background: transparent; border-radius: 14px; min-height: 76px; width: 100%; --c: #98a2b3; }
.lg-cattile-ico { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); transition: transform 0.2s var(--pt-ease-spring), background-color 0.15s ease; }
.lg-cattile.is-add .lg-cattile-ico { background: var(--pt-surface-2); color: var(--pt-muted); border: 1px dashed var(--pt-border-strong); }
.lg-cattile-name { font-size: 0.78rem; font-weight: 600; color: var(--pt-text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-cattile[aria-pressed="true"] .lg-cattile-ico { background: var(--c); color: #fff; transform: scale(1.08); box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 40%, transparent); }
.lg-cattile[aria-pressed="true"] .lg-cattile-name { font-weight: 800; }
.lg-newcat { margin-top: 0.5rem; padding: 0.75rem; border-radius: 16px; background: var(--pt-surface-2); }
.lg-iconpick { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.25rem; margin-top: 0.6rem; }
@media (max-width: 380px) { .lg-iconpick { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.lg-icon { aspect-ratio: 1; min-height: 40px; border-radius: 12px; border: 1px solid transparent; background: #fff; color: var(--pt-text); font-size: 1.15rem; display: flex; align-items: center; justify-content: center; }
.lg-icon[aria-checked="true"] { background: var(--pt-primary); color: #fff; }
.lg-pad { flex: none; border-top: 1px solid var(--pt-border); background: #fff; }
.lg-amountbar { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; }
.lg-amount-cat { width: 44px; height: 44px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  --c: #98a2b3; background: color-mix(in srgb, var(--c) 18%, #fff); color: var(--c); }
.lg-amount-main { flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column; }
.lg-amount-val { font-size: 1.75rem; font-weight: 900; line-height: 1.15; color: #c4302b; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-income .lg-amount-val { color: #15803d; }
.lg-amount-sub { display: flex; gap: 0.5rem; font-size: 0.8125rem; min-width: 0; }
.lg-catname { font-weight: 700; color: var(--pt-muted); white-space: nowrap; }
.lg-amount-calc { color: var(--pt-muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-note { flex: 1 1 45%; min-width: 0; border: 0; border-left: 1px solid var(--pt-border); padding: 0.5rem 0 0.5rem 0.7rem; background: transparent; outline: none; font-size: 0.9375rem; }
.lg-datebar { display: flex; align-items: center; gap: 0.25rem; margin: 0 0.6rem 0.45rem; padding: 0.15rem; border-radius: 999px; border: 2px solid var(--pt-text); background: #fff; position: relative; }
.lg-date-step { width: 44px; height: 40px; border: 0; background: transparent; border-radius: 999px; color: var(--pt-text); flex: none; }
.lg-date-label { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; font-weight: 800; font-size: 0.98rem; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 0.4rem; white-space: nowrap; }
.lg-date-input { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lg-keypad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(54px, auto); gap: 0.45rem; padding: 0.55rem 0.65rem calc(0.6rem + var(--pt-safe-bottom)); background: #fbe7b0; }
.lg-keypad button { border: 2px solid var(--pt-text); border-radius: 999px; background: #fff; font-size: 1.4rem; font-weight: 800; color: var(--pt-text); min-height: 52px; }
.lg-keypad button:active { transform: scale(0.94); }
.lg-keypad .is-op { background: #4fb3e8; color: #fff; }
.lg-keypad .is-ok { grid-column: 5; grid-row: 3 / span 2; background: #fc6150; color: #fff; font-size: 1.3rem; }
@media (min-width: 576px) { .lg-keypad { grid-auto-rows: 50px; } .lg-keypad button { min-height: 0; font-size: 1.25rem; } }

/* 分類管理 */
.seg-full { display: flex; }
.seg-full button { flex: 1 1 0; }
.lg-cm-hint { text-align: center; font-weight: 700; margin: 0.6rem 0 0.5rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--pt-text); }
.lg-cm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.lg-cm-tile { position: relative; touch-action: auto; }
.lg-cm-grid.is-editing .lg-cm-tile { touch-action: none; }
.lg-cm-main { border: 2px solid var(--pt-text); border-radius: 16px; min-height: 84px; background: #fff; }
.lg-cm-del { position: absolute; top: -8px; left: -8px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: #e5484d; color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.lg-cm-del::before { content: ""; position: absolute; inset: -8px; }
.lg-cm-grid.is-editing .lg-cm-tile:not(.is-dragging) { animation: lg-wiggle 0.5s ease-in-out infinite alternate; }
.lg-cm-grid.is-editing .lg-cm-tile:nth-child(2n) { animation-delay: -0.25s; }
@keyframes lg-wiggle { from { transform: rotate(-1deg); } to { transform: rotate(1deg); } }
.lg-cm-tile.is-dragging { z-index: 2; transform: scale(1.08); opacity: 0.9; }
.lg-cm-tile.is-dragging .lg-cm-main { box-shadow: var(--pt-shadow-pop); }
.lg-cm-edit { padding: 0.25rem 0; }
.lg-cm-add { min-height: 52px; font-size: 1.05rem; }
@media (prefers-reduced-motion: reduce) { .lg-cm-grid.is-editing .lg-cm-tile { animation: none; } }
.note-color:not([class*="nc-"]) { --nc: #fff; }
#btnType { white-space: nowrap; flex: none; }

/* ============================================================
   v17：逾期提醒、待辦紅黃綠、重要日期新版
   ============================================================ */
/* 標籤顏色 */
.tag-waiting { background: #fff4b8; color: #7a5800; border-color: #f2d65c; }
.tag-p3 { background: #e5383b; color: #fff; }
.tag-p2 { background: #fff1c7; color: #8a5a00; border-color: #f4d27a; }
.tag-p2 .bi { color: #f2b400; font-size: 0.6rem; }
.tag-p1 { background: #dff5e7; color: #17733b; border-color: #b6e3c6; }
.tag-p1 .bi { color: #22a356; font-size: 0.6rem; }
.tone-waiting { --mod: #e9b80c; --mod-soft: #fff6c9; }

/* 待辦卡片：左側色條＝嚴重程度 */
.item-card.sev-red { --accent: #e5383b; }
.item-card.sev-yellow { --accent: #f2c230; }
.item-card.sev-green { --accent: #2fb36b; }
.item-card::before { width: 6px; }
.item-card.is-overdue { background: #fff6f5; border-color: #f4c2bd; }
.due-pill {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.7rem; border-radius: 999px;
  font-size: 0.875rem; font-weight: 700; background: var(--pt-surface-2); color: #4d5170;
}
.due-pill.is-overdue { background: #e5383b; color: #fff; }
.due-pill.is-today { background: #ffe3cf; color: #b0450c; }
.due-pill.is-soon { background: #fff1c7; color: #8a5a00; }

/* 首頁：逾期事項放在最上面 */
.od-card { margin-bottom: var(--pt-gap); border: 1.5px solid #f4b4ad; background: linear-gradient(180deg, #fff1ef, var(--pt-surface) 70%); }
.od-card .card-header h2 { color: #b42318; }
.od-ico { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; background: #e5383b; color: #fff; animation: od-ring 1.4s ease-in-out 2; }
.od-card .mini-title { font-size: 1.02rem; }
@keyframes od-ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-14deg); } 30% { transform: rotate(12deg); } 45% { transform: rotate(-8deg); } 60% { transform: rotate(4deg); } }

/* 逾期提醒視窗 */
.od-modal { border: 0; overflow: hidden; }
.od-modal-head { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 1.5rem 1rem 1rem; text-align: center; }
.od-modal-head h2 { font-weight: 800; color: #b42318; }
.od-bell { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: #fde4e1; color: #e5383b; font-size: 1.9rem; animation: od-ring 1.2s ease-in-out 0.2s 2; }
.od-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.od-list li { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.7rem 0.75rem; border-radius: 14px; background: #fff6f5; border: 1px solid #f6d0cb; }
.od-list .mini-title { font-weight: 700; font-size: 1.02rem; margin: 0; }
.od-list .mini-sub { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.15rem 0 0; font-size: 0.875rem; }
.od-more { margin: 0.6rem 0 0; color: var(--pt-muted); font-size: 0.875rem; text-align: center; }
.od-modal .modal-footer { gap: 0.5rem; flex-wrap: nowrap; }
.od-modal .modal-footer .btn { min-height: 48px; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .od-ico, .od-bell { animation: none; } }

/* 重要日期：類型 */
.dk-row, .dl-row, .dh-card, .dl-quick-btn { --kc: #2e3db0; --kc-soft: #e9ecfb; }
.k-birthday { --kc: #db2777; --kc-soft: #fde4f1; --g1: #be185d; --g2: #f472b6; }
.k-anniversary { --kc: #e11d48; --kc-soft: #fde5ea; --g1: #be123c; --g2: #fb7185; }
.k-trip { --kc: #0284c7; --kc-soft: #e0f2fe; --g1: #075985; --g2: #38bdf8; }
.k-document { --kc: #ea580c; --kc-soft: #ffedd5; --g1: #c2410c; --g2: #fb923c; }
.k-other { --kc: #7c3aed; --kc-soft: #ede9fe; --g1: #5b21b6; --g2: #a78bfa; }

.dk-row { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.15rem 0.1rem 0.6rem; margin: 0 0 0.5rem; scrollbar-width: none; }
.dk-row::-webkit-scrollbar { display: none; }
.dk-chip[data-kind=""] { --kc: var(--pt-primary); --kc-soft: var(--pt-primary-soft); }
.dk-chip {
  flex: none; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0.3rem 0.95rem;
  border-radius: 999px; border: 1.5px solid var(--pt-border); background: var(--pt-surface); color: var(--pt-text);
  font-size: 1rem; font-weight: 600; transition: background-color 0.15s ease, transform 0.12s ease;
}
.dk-chip .bi { color: var(--kc); }
.dk-chip:active { transform: scale(0.95); }
.dk-chip.is-selected { background: var(--kc); border-color: var(--kc); color: #fff; }
.dk-chip.is-selected .bi { color: #fff; }
.dk-n { font-size: 0.8rem; font-weight: 800; min-width: 1.3rem; padding: 0 0.35rem; border-radius: 999px; background: var(--kc-soft); color: var(--kc); text-align: center; }
.dk-n:empty { display: none; }
.dk-chip.is-selected .dk-n { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* 最近的一天：大卡片 */
.dh-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; width: 100%; overflow: hidden;
  padding: 1.25rem 1.35rem 1.4rem; margin-bottom: 1.1rem; border: 0; border-radius: 26px; text-align: left; color: #fff;
  background: linear-gradient(135deg, var(--g1, #2e3db0), var(--g2, #6b7cf0)); box-shadow: 0 14px 30px -14px var(--kc);
  transition: transform 0.2s var(--pt-ease);
}
.dh-card:active { transform: scale(0.985); }
.dh-deco { position: absolute; right: -0.6rem; bottom: -1.4rem; font-size: 8.5rem; line-height: 1; opacity: 0.16; transform: rotate(-12deg); pointer-events: none; }
.dh-kind { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.95rem; font-weight: 700; opacity: 0.95; }
.dh-bell { display: inline-flex; align-items: center; gap: 0.25rem; margin-left: 0.4rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: rgba(255, 255, 255, 0.25); font-size: 0.8rem; }
.dh-title { margin-top: 0.35rem; font-size: 1.6rem; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; position: relative; }
.dh-count { display: inline-flex; align-items: baseline; gap: 0.4rem; margin-top: 0.2rem; font-size: 1.15rem; font-weight: 700; position: relative; }
.dh-count b { font-size: 4rem; font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; }
.dh-count .dh-today { font-size: 2.6rem; letter-spacing: 0.02em; }
.dh-date { font-size: 1.05rem; font-weight: 600; opacity: 0.95; position: relative; }
.dh-note { margin-top: 0.35rem; font-size: 0.95rem; opacity: 0.9; overflow-wrap: anywhere; position: relative; }
.dh-bar { align-self: stretch; height: 6px; margin-top: 0.9rem; border-radius: 999px; background: rgba(255, 255, 255, 0.28); position: relative; }
.dh-bar i { display: block; height: 100%; border-radius: inherit; background: #fff; transition: width 0.9s var(--pt-ease); }
.dh-card.is-today { animation: dh-glow 2.4s ease-in-out infinite; }
@keyframes dh-glow { 0%, 100% { box-shadow: 0 14px 30px -14px var(--kc); } 50% { box-shadow: 0 16px 40px -8px var(--kc); } }

/* 清單 */
.dl-group { display: grid; gap: 0.6rem; margin-bottom: 1.1rem; }
.dl-month { margin: 0.25rem 0 0; font-size: 1.05rem; font-weight: 800; color: var(--pt-text); }
.dl-row {
  display: flex; align-items: center; gap: 0.9rem; width: 100%; min-height: 80px; padding: 0.8rem 1rem 0.8rem 0.85rem;
  border-radius: 20px; border: 1px solid var(--pt-border); background: var(--pt-surface); box-shadow: var(--pt-shadow);
  text-align: left; color: var(--pt-text); transition: transform 0.18s var(--pt-ease), box-shadow 0.18s ease;
}
.dl-row:hover { transform: translateY(-2px); box-shadow: var(--pt-shadow-hover); }
.dl-row:active { transform: scale(0.985); }
.dl-row.is-remind { border-color: color-mix(in srgb, var(--kc) 40%, var(--pt-border)); background: linear-gradient(90deg, var(--kc-soft), var(--pt-surface) 45%); }
.dl-row.is-today { border: 2px solid var(--kc); background: var(--kc-soft); }
.dl-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px; background: var(--kc-soft); color: var(--kc); font-size: 1.5rem; }
.dl-row.is-remind .dl-ico, .dl-row.is-today .dl-ico { background: var(--kc); color: #fff; }
.dl-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.dl-title { font-size: 1.15rem; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.dl-bell { color: var(--kc); font-size: 0.9rem; }
.dl-sub { font-size: 0.95rem; color: var(--pt-muted); font-weight: 600; }
.dl-note { font-size: 0.9rem; color: var(--pt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-days { flex: none; display: flex; align-items: baseline; gap: 0.15rem; color: var(--kc); }
.dl-days b { font-size: 2rem; font-weight: 900; line-height: 1; }
.dl-days small { font-size: 0.85rem; font-weight: 700; }
.dl-group.is-past .dl-row { opacity: 0.6; box-shadow: none; }
.dl-group.is-past .dl-days { color: var(--pt-muted); }
.dl-past-toggle {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 48px; margin: 0.25rem 0 0.75rem; padding: 0 0.25rem;
  border: 0; background: none; color: var(--pt-muted); font-size: 1rem; font-weight: 700;
}
.dl-past-toggle .dk-n { --kc: var(--pt-muted); --kc-soft: var(--pt-surface-2); }
.dl-past-toggle .bi { margin-left: auto; transition: transform 0.2s ease; }
.dl-past-toggle[aria-expanded="true"] .bi { transform: rotate(180deg); }

/* 還沒有日期 */
.dl-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 2rem 1rem 1.5rem; }
.dl-empty-ico { display: inline-flex; align-items: center; justify-content: center; width: 84px; height: 84px; border-radius: 28px; background: var(--c-dates-soft); color: var(--c-dates); font-size: 2.4rem; }
.dl-empty-title { margin: 1rem 0 0.2rem; font-size: 1.3rem; font-weight: 800; }
.dl-empty-sub { margin: 0 0 1.2rem; color: var(--pt-muted); font-size: 1rem; }
.dl-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; width: 100%; max-width: 360px; }
.dl-quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 1rem 0.5rem; border-radius: 18px;
  border: 1.5px solid var(--kc-soft); background: var(--kc-soft); color: var(--kc); font-size: 1rem; font-weight: 800;
}
.dl-quick-btn .bi { font-size: 1.6rem; }
.dl-quick-btn:active { transform: scale(0.96); }
@media (min-width: 768px) {
  #dateList { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; align-items: start; }
  .dh-card { padding: 1.6rem 1.8rem 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { .dh-card.is-today { animation: none; } .dh-bar i { transition: none; } }

/* v17：待辦分類用點選 */
.cat-pick { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 42px; padding: 0.3rem 0.9rem;
  border-radius: 999px; border: 1.5px solid var(--pt-border); background: var(--pt-surface); color: var(--pt-text);
  font-size: 0.95rem; font-weight: 600; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.cat-chip .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: currentColor; display: inline-block; }
.cat-chip .bi { color: var(--pt-muted); }
.cat-chip:active { transform: scale(0.95); }
.cat-chip.is-selected { border-color: var(--mod); background: var(--mod-soft); color: var(--pt-text); box-shadow: inset 0 0 0 1px var(--mod); }
.cat-chip.is-selected .bi { color: var(--mod); }

/* v17：同意條款（註冊、條款更新） */
.agree-box { margin: 0.25rem 0 1rem; padding: 0.75rem; border-radius: 18px; background: var(--pt-surface-2); border: 1.5px solid transparent; transition: border-color 0.15s ease; }
.agree-box.is-invalid { border-color: var(--pt-danger); background: var(--pt-danger-soft); }
.agree-docs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.agree-doc {
  display: flex; align-items: center; gap: 0.5rem; min-height: 50px; padding: 0.5rem 0.65rem; border-radius: 14px;
  background: var(--pt-surface); border: 1px solid var(--pt-border); color: var(--pt-text); font-weight: 700; font-size: 0.95rem; text-decoration: none;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.agree-doc:hover { border-color: var(--pt-primary); color: var(--pt-text); }
.agree-doc:active { transform: scale(0.97); }
.agree-doc-ico { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--pt-primary-soft); color: var(--pt-primary); }
.agree-doc-go { margin-left: auto; font-size: 0.75rem; color: var(--pt-faint); }
.agree-doc > span:not(.agree-doc-ico) { white-space: nowrap; }
@media (max-width: 420px) { .agree-doc-go { display: none; } .agree-doc { padding: 0.5rem; gap: 0.45rem; } }
.agree-row { position: relative; display: flex; align-items: center; gap: 0.7rem; min-height: 52px; margin-top: 0.6rem; padding: 0.35rem 0.25rem; cursor: pointer; font-weight: 600; line-height: 1.4; }
.agree-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.agree-tick {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none; border-radius: 9px;
  border: 2px solid var(--pt-border-strong); background: var(--pt-surface); color: transparent; font-size: 1.1rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s var(--pt-ease-spring);
}
.agree-input:checked + .agree-tick { background: var(--pt-primary); border-color: var(--pt-primary); color: #fff; transform: scale(1.06); }
.agree-input:focus-visible + .agree-tick { outline: 3px solid var(--pt-primary-soft); outline-offset: 2px; }
.agree-box.is-invalid .agree-tick { border-color: var(--pt-danger); }
.agree-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0.5rem 0 1.25rem; }
.agree-badge { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 24px; background: linear-gradient(135deg, var(--pt-primary), #5b6ef0); color: #fff; font-size: 2.1rem; box-shadow: 0 12px 26px -10px var(--pt-primary); }
.agree-head .auth-title { margin: 1rem 0 0.25rem; }
.agree-sub { margin: 0; color: var(--pt-muted); }
.agree-out { display: block; width: 100%; min-height: 44px; margin-top: 0.5rem; border: 0; background: none; color: var(--pt-muted); font-weight: 600; }
.agree-out:hover { color: var(--pt-text); text-decoration: underline; }

/* v18：手機頂列的上一頁 */
.top-back {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 44px; margin-left: -0.45rem; flex: none;
  border-radius: 12px; color: var(--pt-text); font-size: 1.35rem; text-decoration: none;
}
.top-back:hover { color: var(--pt-text); }
.top-back:active { background: var(--pt-surface-2); }
body:not([data-page="home"]) .app-topbar .app-brand { display: none; }
body:not([data-page="home"]) .app-topbar-title { opacity: 1; transform: none; font-size: 1.05rem; }

/* v18：條款在頁面裡打開 */
.doc-modal .modal-header { gap: 0.25rem; justify-content: flex-start; }
.doc-modal .doc-back { margin-left: -0.5rem; font-size: 1.25rem; }
.doc-body.legal-card { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
.doc-modal .modal-footer .btn { min-height: 50px; }

/* v18：會員鎖頭、升級、方案價格 */
.app-nav .nav-link.is-locked { opacity: 0.6; }
.nav-lock { margin-left: auto; font-size: 0.8rem; color: var(--tier-warm, #c46a00); }
.app-offcanvas .nav-lock { position: absolute; top: 0.35rem; right: 0.45rem; margin: 0; }
.tier-mods li.is-locked { color: var(--pt-muted); }
.tier-mods li.is-locked .bi { color: var(--tier-warm, #c46a00); }
.up-cta { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; min-height: 60px; margin-top: 1.25rem; border: 0; font-size: 1.1rem; font-weight: 800; background: linear-gradient(135deg, #f59f00, #f76707); box-shadow: 0 12px 26px -12px #f76707; }
.up-cta[hidden] { display: none; }
.up-cta:hover { background: linear-gradient(135deg, #f08c00, #e8590c); }
.up-cta small { font-size: 0.8rem; font-weight: 600; opacity: 0.9; }

.up-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.75rem 1rem 1.6rem; margin-bottom: 1rem; border-radius: 26px; color: #fff; background: radial-gradient(circle at 80% -10%, #ffd166 0, transparent 45%), linear-gradient(140deg, #f59f00, #f76707 70%, #e8590c); box-shadow: 0 16px 34px -16px #f76707; }
.up-sun { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); font-size: 2.4rem; animation: up-spin 18s linear infinite; }
@keyframes up-spin { to { transform: rotate(360deg); } }
.up-title { margin: 0.75rem 0 0.15rem; font-size: 1.8rem; font-weight: 900; letter-spacing: 0.08em; }
.up-sub { margin: 0; font-size: 1rem; opacity: 0.95; }
.up-h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 0.75rem; }
.up-perk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.up-perk-list li { display: flex; align-items: center; gap: 0.6rem; font-size: 1rem; font-weight: 600; }
.up-perk-list .bi { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none; border-radius: 10px; background: #fff1d9; color: #c46a00; }
.up-done .card-body { display: flex; align-items: center; gap: 0.85rem; }
.up-done .card-body > .bi { font-size: 2rem; color: #c46a00; }
.up-done-title { margin: 0; font-size: 1.1rem; font-weight: 800; }
.up-done-sub { margin: 0; color: var(--pt-muted); }

.up-plans { display: grid; gap: 0.65rem; }
.up-plan {
  position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name price" "per price"; align-items: center; gap: 0.1rem 0.75rem;
  padding: 1rem 3.2rem 1rem 1.1rem; border-radius: 20px; border: 2px solid var(--pt-border); background: var(--pt-surface); cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.up-plan:active { transform: scale(0.985); }
.up-plan-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.up-plan-name { grid-area: name; font-size: 1.1rem; font-weight: 800; }
.up-plan-per { grid-area: per; font-size: 0.9rem; color: var(--pt-muted); }
.up-plan-price { grid-area: price; color: var(--pt-text); white-space: nowrap; }
.up-plan-price small { font-size: 0.8rem; font-weight: 700; margin-right: 0.15rem; color: var(--pt-muted); }
.up-plan-price b { font-size: 1.7rem; font-weight: 900; }
.up-plan-check { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--pt-border-strong); color: transparent; }
.up-badge { position: absolute; top: -0.65rem; left: 1rem; padding: 0.1rem 0.65rem; border-radius: 999px; background: #f76707; color: #fff; font-size: 0.78rem; font-weight: 800; }
.up-plan.is-selected { border-color: #f59f00; background: #fffaf0; box-shadow: 0 10px 24px -14px #f76707; }
.up-plan.is-selected .up-plan-check { background: #f59f00; border-color: #f59f00; color: #fff; }
.up-plan:has(.up-plan-input:focus-visible) { outline: 3px solid #ffd8a8; outline-offset: 2px; }
.up-pay { min-height: 56px; margin-top: 1rem; font-size: 1.1rem; font-weight: 800; }
.up-note { margin: 0.85rem 0 0; color: var(--pt-muted); font-size: 0.875rem; line-height: 1.9; text-align: center; }
.pay-sum { margin: 0 0 1rem; display: grid; gap: 0.5rem; padding: 0.85rem 1rem; border-radius: 16px; background: var(--pt-surface-2); }
.pay-sum div { display: flex; justify-content: space-between; gap: 1rem; }
.pay-sum dt { font-weight: 600; color: var(--pt-muted); }
.pay-sum dd { margin: 0; font-weight: 700; text-align: right; }
.pay-agree { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .up-sun { animation: none; } }

.plan-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 0.85rem; }
.plan-row.is-off { opacity: 0.65; }
.plan-row-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.plan-months { font-weight: 800; color: #c46a00; }
.plan-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.85rem; }
.plan-per { color: var(--pt-muted); font-size: 0.9rem; }
.plan-updated { margin: 0.5rem 0 0; color: var(--pt-faint); font-size: 0.8rem; }

/* v19：付費設定、註冊試用 */
.pay-cfg .card-body { display: grid; gap: 1rem; }
.pay-cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pay-cfg-title { margin: 0; font-weight: 800; font-size: 1rem; }
.pay-cfg-sub { margin: 0.15rem 0 0; color: var(--pt-muted); font-size: 0.875rem; }
.pay-cfg .form-switch .form-check-input { width: 3rem; height: 1.6rem; }
.pay-cfg-days { width: 7.5rem; flex: none; }
.reg-trial { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin: 0 0 0.75rem; padding: 0.55rem 0.75rem; border-radius: 14px; background: #fff4dc; color: #8a4b00; font-weight: 700; }
.reg-trial .bi { color: #f76707; }

/* v20：常用地點、天氣特報、生活指數、一週天氣圖示 */
.wx-places { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin: -0.25rem 0 0.85rem; }
.wxp-item { display: inline-flex; align-items: center; gap: 0.15rem; }
.wxp-chip { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 40px; padding: 0.35rem 0.85rem; border: 1px solid var(--pt-border-strong); border-radius: 999px; background: var(--pt-surface); color: var(--pt-text); font-weight: 700; text-decoration: none; transition: transform 0.15s ease, background 0.15s ease; }
.wxp-chip small { font-weight: 500; color: var(--pt-muted); }
.wxp-chip:active { transform: scale(0.95); }
.wxp-chip.is-active { border-color: #3b82f6; background: #e8f1ff; color: #1d4ed8; }
.wxp-chip.is-active small { color: #1d4ed8; }
.wxp-chip.is-add { border-style: dashed; color: var(--pt-muted); font-weight: 600; }
.wxp-chip.is-locked .bi { color: #f59f00; }
.wxp-del { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #fde2e1; color: #c92a2a; }
.wxp-edit { margin-left: auto; border: 0; background: none; color: var(--pt-muted); font-size: 0.875rem; font-weight: 600; padding: 0.35rem 0.5rem; }

.wx-alert { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; padding: 0.85rem 1rem; border-radius: var(--pt-radius); background: #fff1e6; border: 1px solid #ffc9a3; color: #9a3412; }
.wx-alert > .bi { font-size: 1.6rem; color: #ea580c; flex: none; }
.wx-alert div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wx-alert strong { font-size: 1.05rem; }
.wx-alert span { font-size: 0.875rem; }
.wx-alert a { flex: none; font-weight: 700; color: #c2410c; white-space: nowrap; }
.ci-alert { --ci: #ea580c; --ci-soft: #fff1e6; }

.life-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.life-tile { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.8rem 0.9rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); border: 1px solid var(--pt-border); min-width: 0; }
.life-tile .lbl { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--pt-muted); font-size: 0.8125rem; font-weight: 600; }
.life-tile .val { font-size: 1.5rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.life-tile .sub { color: var(--pt-muted); font-size: 0.8125rem; }
.life-tile.uv-l .val { color: #2f9e44; }
.life-tile.uv-m .val { color: #e67700; }
.life-tile.uv-h .val { color: #f76707; }
.life-tile.uv-vh .val { color: #e03131; }
.life-tile.uv-x .val { color: #9c36b5; }
.life-tile.is-big .val { color: #1d4ed8; }

.wx-license { margin: 0.25rem auto 0; max-width: 46rem; text-align: center; color: var(--pt-faint); font-size: 0.75rem; line-height: 1.7; word-break: break-all; }

.place-mode { display: grid; gap: 0.35rem; margin-top: 0.25rem; }
.place-mode .form-check { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.75rem 0.6rem 2.25rem; border: 1px solid var(--pt-border); border-radius: 12px; margin: 0; }
.place-mode .form-check-label { display: flex; flex-direction: column; }
.place-mode small { color: var(--pt-muted); }
.place-mode .form-check:has(input:checked) { border-color: #3b82f6; background: #f3f8ff; }
.place-mode .form-check:has(input:disabled) { opacity: 0.6; }

.wx-badge { display: inline-flex; align-items: center; gap: 0.2rem; margin-left: 0.35rem; font-size: 0.8rem; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.wx-badge .bi { font-size: 0.95rem; }
.wx-badge-pop { color: #2563eb; font-size: 0.75rem; }
.wx-badge.is-full { padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--pt-surface-2); border: 1px solid var(--pt-border); color: var(--pt-text); font-size: 0.8125rem; }
.wx-badge.is-full .bi { font-size: 1rem; }
.cal-head .wx-badge { margin-left: auto; font-size: 0.7rem; min-width: 0; }
.cal-head .wx-badge .bi { font-size: 0.85rem; }
.cal-head .wx-badge-pop { display: none; }
.cal-head .wx-badge + .cal-zhai { margin-left: 0.1rem; }
@media (max-width: 575.98px) { .cal-cell.is-zhai .cal-head .wx-badge { margin-right: 0.95rem; } }
.dh-wx { display: block; margin-top: 0.35rem; }
.dh-wx .wx-badge.is-full { margin-left: 0; background: rgba(255, 255, 255, 0.85); }
.dl-sub .wx-badge { font-size: 0.75rem; }

.hero-alert { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0 0 1rem; padding: 0.35rem 0.75rem; border-radius: 999px; background: #fff1e6; color: #c2410c; font-weight: 700; font-size: 0.9375rem; text-decoration: none; animation: pt-pop 0.45s var(--pt-ease-spring) both; }
.hero-umbrella:not([hidden]) + .hero-alert { margin-top: -0.5rem; }
.hero-alert:hover { color: #9a3412; }

/* ============================================================
   刪除帳號（v21）
   ============================================================ */
.del-wrap { max-width: 640px; }
.del-progress { display: flex; gap: 0.4rem; margin: 0 0 1rem; }
.del-progress span { flex: 1 1 0; height: 6px; border-radius: 999px; background: var(--pt-border); transition: background-color 0.25s ease; }
.del-progress span.is-on { background: var(--pt-danger); }
.del-step h2 { margin-bottom: 0.75rem; }
.del-step h2:focus { outline: none; }
.del-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.del-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-radius: 14px; background: var(--pt-surface-2); font-size: 0.9375rem; }
.del-list li .bi { color: var(--pt-muted); }
.del-list strong { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.del-reasons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.del-reasons .chip[aria-pressed="true"] { border-color: var(--pt-danger); background: var(--pt-danger-soft); color: var(--pt-danger-ink); font-weight: 600; }
.del-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.del-actions .btn { flex: 1 1 0; min-height: var(--pt-touch); }
.del-zone { border-color: color-mix(in srgb, var(--pt-danger) 25%, var(--pt-border)); }
.restore-box { text-align: center; }
.restore-ico { margin: 0 0 0.25rem; font-size: 2.25rem; color: var(--pt-danger); }

/* 後台：刪除紀錄 */
.dr-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dr-bars { display: grid; gap: 0.55rem; }
.dr-bar { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 5rem; align-items: center; gap: 0.6rem; font-size: 0.875rem; }
.dr-track { display: block; height: 10px; border-radius: 999px; background: var(--pt-surface-2); overflow: hidden; }
.dr-fill { display: block; width: 0; height: 100%; border-radius: 999px; background: var(--pt-coral); transition: width 0.6s var(--pt-ease); }
.dr-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--pt-muted); white-space: nowrap; }
.dr-reasons { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.15rem 0 0.4rem; }
.dr-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
@media (max-width: 767.98px) { .dr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) {
  .del-list { grid-template-columns: 1fr; }
  .dr-bar { grid-template-columns: 6.5rem minmax(0, 1fr) 4.25rem; }
}
@media (prefers-reduced-motion: reduce) { .dr-fill, .del-progress span { transition: none; } }
