/* 打工人小帳本 — 共用樣式（設計變數、版面、元件） */
    :root {
      color-scheme: light;
      --ink-deep: #163b3d;
      --ink: #31595a;
      --muted: #708786;
      --positive: #16856f;
      --positive-strong: #116b5b;
      --positive-pale: #dff4ea;
      --brand: #16856f;
      --brand-soft: #dff4ea;
      --danger: #d95f5f;
      --danger-pale: #ffe7e1;
      --warning: #9a6a18;
      --warning-pale: #fff2c7;
      --paper: #f8f5ed;
      --surface: #fffdf7;
      --surface-soft: #edf7f0;
      --surface-raised: #fffaf0;
      --line: #d7ded5;
      --line-strong: #b9cdc5;
      --blue: #5c88b8;
      --coral: #d95f5f;
      --coral-pale: #ffe7e1;
      --sun: #f6c95f;
      --sun-pale: #fff2c7;
      --shadow: 0 1px 0 rgba(22, 59, 61, 0.04), 0 8px 24px rgba(22, 59, 61, 0.055);
      --shadow-soft: 0 4px 14px rgba(22, 59, 61, 0.065);
      --radius: 22px;
      --control-radius: 14px;
      --sidebar: 256px;
    }
    html[data-theme="dark"] {
      color-scheme: dark;
      --ink-deep: #e8f4ee;
      --ink: #c5ddd5;
      --muted: #91aaa3;
      --positive: #73d1b6;
      --positive-strong: #9be2cc;
      --positive-pale: #193f37;
      --brand: #73d1b6;
      --brand-soft: #193f37;
      --danger: #ff958d;
      --danger-pale: #4b2928;
      --warning: #f0c978;
      --warning-pale: #4a3c20;
      --paper: #111b1b;
      --surface: #192827;
      --surface-soft: #20332f;
      --surface-raised: #263a35;
      --line: #344b46;
      --line-strong: #4b6760;
      --blue: #8eb9e3;
      --coral: #ff958d;
      --coral-pale: #4b2928;
      --sun: #f0c978;
      --sun-pale: #4a3c20;
      --shadow: 0 1px 0 rgba(255, 255, 255, 0.025), 0 8px 24px rgba(0, 0, 0, 0.16);
      --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.15);
    }
    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      min-width: 0;
      min-height: 100dvh;
      color: var(--ink-deep);
      background:
        radial-gradient(circle at 88% 8%, var(--brand-soft), transparent 34%),
        linear-gradient(145deg, var(--paper), var(--surface-soft));
      font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "PingFang SC", "Microsoft YaHei", sans-serif;
      line-height: 1.55;
    }
    button, input, select, textarea { font: inherit; }
    button, input, select { min-height: 44px; }
    button, input, select, textarea {
      border: 1px solid var(--line);
      border-radius: 12px;
    }
    input, select, textarea {
      width: 100%;
      padding: 10px 12px;
      color: var(--ink-deep);
      background: var(--surface);
    }
    textarea { min-height: 92px; resize: vertical; }
    button {
      padding: 10px 16px;
      color: var(--ink-deep);
      background: var(--surface);
      cursor: pointer;
      transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
    }
    button:hover { border-color: var(--brand); }
    button:active { transform: scale(0.98); }
    button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
      outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent);
      outline-offset: 2px;
    }
    button.primary { color: white; border-color: var(--positive-strong); background: var(--positive-strong); }
    button.secondary { color: var(--brand); background: var(--brand-soft); }
    button.danger { color: var(--danger); background: var(--danger-pale); }
    button.ghost { border-color: transparent; background: transparent; }
    .app-shell { min-height: 100dvh; }
    .sidebar {
      position: fixed;
      inset: 0 auto 0 0;
      z-index: 20;
      display: none;
      width: var(--sidebar);
      padding: 28px 20px;
      border-right: 1px solid var(--line);
      background: color-mix(in srgb, var(--surface) 90%, transparent);
      backdrop-filter: blur(18px);
    }
    .brand { margin-bottom: 26px; }
    .brand-mark {
      display: grid;
      place-items: center;
      width: 48px;
      height: 48px;
      margin-bottom: 12px;
      border-radius: 15px;
      color: white;
      font-weight: 800;
      background: var(--ink-deep);
    }
    .brand h1 { margin: 0; font-size: 20px; letter-spacing: -0.04em; }
    .brand p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
    .nav-list { display: grid; gap: 6px; }
    .nav-button {
      display: flex;
      align-items: center;
      width: 100%;
      border-color: transparent;
      background: transparent;
      text-align: left;
    }
    .nav-button.active { color: var(--positive-strong); background: var(--positive-pale); }
    .sidebar-footer { position: absolute; right: 20px; bottom: 24px; left: 20px; display: grid; gap: 8px; }
    .main { width: 100%; padding: 18px 16px calc(92px + env(safe-area-inset-bottom)); }
    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      max-width: 1180px;
      margin: 0 auto 18px;
    }
    .topbar-copy h2 { margin: 0; font-size: clamp(22px, 4vw, 32px); letter-spacing: -0.04em; }
    .topbar-copy p { margin: 3px 0 0; color: var(--muted); }
    .theme-button { flex: 0 0 auto; }
    .storage-alert, .top-reminder {
      max-width: 1180px;
      margin: 0 auto 16px;
      padding: 13px 16px;
      border: 1px solid var(--line);
      border-radius: 14px;
      background: var(--surface);
    }
    .storage-alert { color: var(--danger); background: var(--danger-pale); }
    .storage-alert p { margin: 0; line-height: 1.55; }
    .top-reminder { color: var(--ink); background: var(--warning-pale); }
    .workspace { max-width: 1180px; margin: 0 auto; }
    .page-section { display: none; animation: enter 220ms ease both; }
    .page-section.active { display: block; }
    @keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
    .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
    .section-heading h2 { margin: 0; font-size: clamp(26px, 5vw, 42px); letter-spacing: -0.05em; }
    .section-heading p { max-width: 56ch; margin: 6px 0 0; color: var(--muted); }
    .grid { display: grid; gap: 16px; }
    .grid.two, .grid.three { grid-template-columns: 1fr; }
    .panel {
      min-width: 0;
      padding: 20px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: color-mix(in srgb, var(--surface) 96%, transparent);
      box-shadow: var(--shadow);
    }
    .panel.soft { background: var(--surface-soft); box-shadow: none; }
    .panel h3 { margin: 0 0 14px; font-size: 18px; }
    .panel p { margin-top: 0; }
    .kpi-label { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
    .kpi-value { margin: 4px 0; font-size: clamp(30px, 8vw, 56px); font-weight: 800; line-height: 1.05; letter-spacing: -0.055em; overflow-wrap: anywhere; }
    .kpi-note { color: var(--muted); font-size: 14px; }
    .positive { color: var(--positive); }
    .expense-color { color: var(--danger); }
    .progress-track { height: 12px; overflow: hidden; border-radius: 999px; background: var(--line); }
    .progress-fill { height: 100%; border-radius: inherit; background: var(--positive); transition: transform 300ms ease; transform-origin: left; }
    .form-grid { display: grid; gap: 14px; }
    .field { display: grid; gap: 7px; min-width: 0; }
    .field label { color: var(--ink); font-size: 14px; font-weight: 700; }
    .field small { color: var(--muted); }
    .span-full { grid-column: 1 / -1; }
    .form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
    .formula-list { display: grid; gap: 0; margin: 0; }
    .formula-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 16px;
      padding: 13px 0;
      border-top: 1px solid var(--line);
    }
    .formula-row:first-child { border-top: 0; }
    .formula-row dt { color: var(--muted); }
    .formula-row dd { margin: 0; font-weight: 750; text-align: right; overflow-wrap: anywhere; }
    .record-list { display: grid; gap: 10px; }
    .record-card {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      padding: 14px 0;
      border-top: 1px solid var(--line);
    }
    .record-card:first-child { border-top: 0; }
    .record-title { font-weight: 750; }
    .record-meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
    .record-amount { font-size: 20px; font-weight: 800; text-align: right; }
    .record-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; margin-top: 6px; }
    .record-actions button { min-width: 44px; padding: 8px 10px; }
    .empty-state { padding: 26px 4px; color: var(--muted); text-align: center; }
    .safety-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
    .safety-item { padding: 14px 8px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
    .safety-item.reached { color: var(--positive-strong); border-color: var(--positive); background: var(--positive-pale); }
    .chart-wrap { width: 100%; overflow: hidden; }
    #freedom-chart { display: block; width: 100%; min-height: 280px; }
    .chart-legend { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13px; }
    .legend-dot { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: var(--positive); }
    .legend-dot.target { background: var(--brand); }
    .range-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
    input[type="range"] { min-height: 44px; padding: 0; accent-color: var(--positive); background: transparent; }
    .scenario-card { position: relative; }
    .scenario-card.fastest { border-color: var(--positive); }
    .tag { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 9px; border-radius: 999px; color: var(--positive-strong); background: var(--positive-pale); font-size: 12px; font-weight: 800; }
    .subtle { color: var(--muted); font-size: 14px; }
    .button-row { display: flex; flex-wrap: wrap; gap: 10px; }
    .mobile-tools {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      max-width: 1180px;
      margin: 0 auto 16px;
    }
    .mobile-tools button { padding: 8px 6px; font-size: 13px; }
    .mobile-nav {
      position: fixed;
      right: 0;
      bottom: 0;
      left: 0;
      z-index: 30;
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 2px;
      padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
      border-top: 1px solid var(--line);
      background: color-mix(in srgb, var(--surface) 94%, transparent);
      backdrop-filter: blur(18px);
    }
    .mobile-nav button { min-width: 0; min-height: 48px; padding: 5px 2px; border-color: transparent; border-radius: 10px; background: transparent; font-size: 11px; }
    .mobile-nav button.active { color: var(--positive-strong); background: var(--positive-pale); }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    [hidden] { display: none !important; }
    @media (min-width: 640px) {
      .main { padding-right: 24px; padding-left: 24px; }
      .form-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (min-width: 768px) {
      .sidebar { display: block; }
      .main { margin-left: var(--sidebar); width: calc(100% - var(--sidebar)); padding: 32px 34px 50px; }
      .mobile-nav, .mobile-tools { display: none; }
      .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
    @media (min-width: 1024px) {
      .form-grid.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    /* 奶油薄荷手账视觉系统 */
    html { scroll-behavior: auto; }
    body {
      overflow-x: hidden;
      background-color: var(--paper);
      background-image:
        radial-gradient(circle, color-mix(in srgb, var(--positive) 12%, transparent) 1px, transparent 1.5px),
        linear-gradient(135deg, color-mix(in srgb, var(--sun-pale) 45%, transparent), transparent 42%);
      background-size: 22px 22px, 100% 100%;
      font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", sans-serif;
    }
    button { transition: transform 160ms ease, opacity 160ms ease; }
    button:hover { transform: translateY(-1px); }
    button.primary { color: #fffaf3; border-color: var(--positive-strong); background: var(--positive-strong); }
    input, select { height: 48px; min-height: 48px; }
    input, select, textarea { border-radius: var(--control-radius); background: var(--surface-raised); }
    .app-icon {
      display: inline-block;
      flex: 0 0 auto;
      width: 20px;
      height: 20px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
      vertical-align: -0.2em;
    }
    .icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
    .sidebar {
      padding: 24px 18px;
      border-right: 1px solid var(--line-strong);
      background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
      backdrop-filter: none;
    }
    .brand { padding: 10px 10px 18px; margin-bottom: 12px; border-bottom: 1px dashed var(--line-strong); }
    .brand-mark {
      width: 54px;
      height: 54px;
      margin-bottom: 14px;
      border: 1px solid color-mix(in srgb, var(--positive) 55%, var(--line));
      border-radius: 18px 18px 20px 16px;
      color: var(--positive-strong);
      background: var(--positive-pale);
      box-shadow: 4px 5px 0 color-mix(in srgb, var(--sun) 35%, transparent);
      transform: rotate(-2deg);
    }
    .brand-mark .app-icon { width: 30px; height: 30px; }
    .brand h1 { font-size: 21px; }
    .nav-list { gap: 5px; }
    .nav-button { gap: 11px; min-height: 48px; padding: 11px 13px; border-radius: 15px; font-weight: 600; }
    .nav-button.active { box-shadow: inset 3px 0 var(--positive); }
    .sidebar-footer { padding-top: 14px; border-top: 1px dashed var(--line-strong); }
    .sidebar-footer button, .mobile-tools button, .theme-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
    .main { position: relative; }
    .topbar { padding-bottom: 14px; border-bottom: 1px dashed var(--line-strong); }
    .topbar-copy h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 650; letter-spacing: -0.025em; }
    .theme-button { min-width: 48px; border-color: var(--line-strong); background: var(--sun-pale); }
    .storage-alert, .top-reminder { border-radius: 16px; box-shadow: var(--shadow-soft); }
    .top-reminder { border-style: dashed; background: color-mix(in srgb, var(--sun-pale) 78%, var(--surface)); }
    .section-heading { align-items: center; margin-bottom: 22px; }
    .section-heading h2 { font-size: clamp(1.75rem, 3.5vw, 2.25rem); font-weight: 650; letter-spacing: -0.035em; line-height: 1.16; }
    .grid.two, .grid.dashboard { align-items: start; }
    .grid.dashboard > *, .grid.two > * { align-self: start; }
    .panel {
      position: relative;
      padding: 20px;
      border-color: var(--line-strong);
      border-radius: var(--radius);
      background: var(--surface);
      box-shadow: var(--shadow);
    }
    .panel.form-grid, .field { align-items: start; }
    .panel::after {
      position: absolute;
      width: 34px;
      height: 10px;
      border-radius: 3px;
      background: color-mix(in srgb, var(--sun) 55%, transparent);
      content: "";
      opacity: 0;
      pointer-events: none;
      transform: rotate(3deg);
    }
    .panel.sticker::after { top: -5px; right: 24px; opacity: 1; }
    .panel.featured { border-color: color-mix(in srgb, var(--line-strong) 78%, transparent); background: var(--surface-raised); }
    .panel.mint { background: var(--positive-pale); }
    .panel.coral { background: var(--coral-pale); }
    .panel.sun { background: var(--sun-pale); }
    .panel.plain { background: transparent; box-shadow: none; }
    .panel.soft { border-style: dashed; background: var(--surface-soft); box-shadow: none; }
    .panel-title { display: flex; align-items: center; gap: 9px; grid-column: 1 / -1; margin: 0 0 2px; }
    .panel-title .app-icon { color: var(--positive); }
    .kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .icon-base {
      display: grid;
      place-items: center;
      width: 38px;
      height: 38px;
      border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
      border-radius: 14px;
      background: color-mix(in srgb, var(--surface) 64%, transparent);
      transform: rotate(2deg);
    }
    .icon-base .app-icon { width: 19px; height: 19px; }
    .kpi-label { color: var(--ink); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.035em; }
    .kpi-value { margin: 8px 0 6px; font-size: clamp(1.75rem, 3.2vw, 2.5rem); font-weight: 600; line-height: 1.08; letter-spacing: -0.035em; white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
    .kpi-value.kpi-overflow { white-space: normal; overflow-wrap: anywhere; }
    .record-amount, output { font-size: 1rem; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
    [data-section="dashboard"] .kpi-value { font-size: clamp(1.75rem, 2.8vw, 2.25rem); }
    #month-expense-hours, #safety-months, #unpaid-insight, #commute-insight, #expense-days-insight { font-size: clamp(1.45rem, 2.5vw, 2rem); white-space: normal; }
    .field { grid-auto-rows: max-content; gap: 7px; min-width: 0; }
    .field label { display: flex; align-items: end; min-height: 22px; line-height: 1.35; }
    .form-hint { margin: -4px 0 0; padding: 10px 12px; border-left: 3px solid var(--sun); color: var(--muted); background: color-mix(in srgb, var(--sun-pale) 62%, transparent); }
    .hero-heading { align-items: center; padding: 4px 0 8px; }
    .hero-copy { max-width: 650px; }
    .hero-illustration { flex: 0 0 auto; width: clamp(150px, 20vw, 238px); color: var(--ink-deep); filter: drop-shadow(0 9px 0 rgba(22, 59, 61, 0.05)); }
    .hero-illustration svg { display: block; width: 100%; height: auto; }
    .recent-section { margin-top: 16px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface-raised) 72%, transparent); }
    .recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
    .recent-heading h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
    .recent-heading button { min-width: 44px; }
    .recent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .recent-grid > .empty-state { grid-column: 1 / -1; }
    .recent-note {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 10px;
      align-items: center;
      min-width: 0;
      padding: 14px;
      border: 1px solid var(--line);
      border-radius: 17px 17px 20px 15px;
      background: var(--surface);
      box-shadow: var(--shadow-soft);
    }
    .recent-note:nth-child(2n) { transform: rotate(0.4deg); }
    .category-icon {
      display: grid;
      place-items: center;
      width: 42px;
      height: 42px;
      border-radius: 14px;
      color: var(--positive-strong);
      background: var(--positive-pale);
    }
    .category-icon[data-category="交通"] { color: var(--blue); background: color-mix(in srgb, var(--blue) 15%, var(--surface)); }
    .category-icon[data-category="购物"] { color: var(--coral); background: var(--coral-pale); }
    .category-icon[data-category="娱乐"] { color: var(--warning); background: var(--sun-pale); }
    .category-icon[data-category="房租"] { color: var(--ink); background: var(--surface-soft); }
    .recent-copy { min-width: 0; }
    .recent-copy .record-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .recent-side { text-align: right; }
    .recent-side .record-amount { font-size: 17px; }
    .record-list { gap: 9px; }
    .record-card {
      grid-template-columns: minmax(0, 1fr) auto;
      padding: 13px 0;
      border-top-style: dashed;
    }
    .record-card.expense-record { grid-template-columns: auto minmax(0, 1fr) auto; }
    .record-card > .category-icon { width: 40px; height: 40px; }
    .record-card .record-actions { justify-content: flex-end; }
    .empty-state { display: grid; justify-items: center; gap: 8px; min-height: 120px; align-content: center; }
    .empty-state .app-icon { width: 36px; height: 36px; color: var(--positive); }
    .mobile-tools { position: relative; z-index: 2; }
    .mobile-tools button { min-height: 44px; border-color: var(--line-strong); background: var(--surface-raised); }
    .mobile-nav { border-color: var(--line-strong); background: color-mix(in srgb, var(--surface-raised) 96%, transparent); backdrop-filter: none; }
    .mobile-nav button { display: grid; place-items: center; align-content: center; gap: 2px; min-height: 52px; }
    .mobile-nav .app-icon { width: 19px; height: 19px; }
    .toast {
      position: fixed;
      right: 22px;
      bottom: 22px;
      z-index: 60;
      max-width: min(360px, calc(100vw - 32px));
      padding: 13px 17px;
      border: 1px solid var(--positive);
      border-radius: 16px;
      color: var(--ink-deep);
      background: var(--positive-pale);
      box-shadow: var(--shadow-soft);
      opacity: 0;
      pointer-events: none;
      transform: translateY(12px);
      transition: transform 180ms ease, opacity 180ms ease;
    }
    .toast.visible { opacity: 1; transform: translateY(0); }
    .topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
    .sync-chip {
      display: inline-flex; align-items: center; gap: 7px;
      min-height: 36px; padding: 6px 11px;
      border: 1px dashed var(--line-strong); border-radius: 999px;
      color: var(--muted); background: var(--surface);
      font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap;
      cursor: default;
    }
    .sync-chip .sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 3px color-mix(in srgb, var(--positive) 18%, transparent); }
    .sync-chip[data-state="loading"] .sync-dot, .sync-chip[data-state="saving"] .sync-dot { background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 20%, transparent); animation: sync-pulse 1.1s ease-in-out infinite; }
    .sync-chip[data-state="error"] { color: var(--danger); border-color: var(--danger); background: var(--danger-pale); cursor: pointer; }
    .sync-chip[data-state="error"] .sync-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
    .sync-chip[data-state="error"]:hover { filter: brightness(0.98); }
    @keyframes sync-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
    .alert-retry {
      margin-top: 10px; min-height: 38px; padding: 7px 16px;
      border: 1px solid var(--danger); border-radius: 11px;
      color: var(--danger); background: var(--surface);
      font: inherit; font-weight: 700; cursor: pointer;
    }
    .alert-retry:hover { background: color-mix(in srgb, var(--danger-pale) 70%, var(--surface)); }
    @media (min-width: 1180px) {
      .grid.dashboard { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.72fr); }
      .dashboard-form-card { position: sticky; top: 24px; }
    }
    @media (max-width: 767px) {
      .hero-heading { align-items: flex-start; }
      .hero-illustration { width: 132px; }
      .toast { right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); }
    }
    @media (max-width: 639px) {
      .main { padding-top: 14px; padding-right: 12px; padding-left: 12px; }
      .topbar { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
      .topbar-actions { width: 100%; justify-content: space-between; gap: 6px; }
      .sync-chip { font-size: 11px; padding: 6px 9px; }
      .sync-chip .sync-label { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
      .topbar-copy p { font-size: 13px; }
      .theme-button span { display: none; }
      .section-heading h2 { font-size: 1.75rem; }
      .hero-heading { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 8px; }
      .hero-illustration { width: 100%; }
      .recent-grid { grid-template-columns: 1fr; }
      .recent-note:nth-child(2n) { transform: none; }
      .panel, .recent-section { padding: 17px; }
      .kpi-value { font-size: clamp(1.75rem, 8.5vw, 2.25rem); font-weight: 600; }
      .record-card.expense-record { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
      .record-card.expense-record > :last-child { grid-column: 2; width: 100%; text-align: left; }
      .record-card.expense-record .record-actions { justify-content: flex-start; }
      .mobile-tools { gap: 6px; }
      .mobile-tools button { padding: 7px 4px; font-size: 12px; }
      .mobile-tools .app-icon { width: 17px; height: 17px; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    }
  

    /* ---------- 網站頁尾（首頁與內容頁共用） ---------- */
    .site-footer {
      margin-top: 34px;
      padding: 26px 2px 8px;
      border-top: 1px solid var(--line);
    }
    .footer-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 40px; justify-content: space-between; }
    .footer-brand { display: flex; gap: 13px; max-width: 430px; }
    .footer-mark {
      display: grid; place-items: center; flex: 0 0 auto;
      width: 42px; height: 42px; border-radius: 13px;
      color: var(--positive-strong); background: var(--brand-soft);
    }
    .footer-mark .app-icon { width: 22px; height: 22px; }
    .footer-brand strong { display: block; font-size: 1rem; color: var(--ink-deep); }
    .footer-brand p { margin: 5px 0 0; font-size: 0.82rem; line-height: 1.65; color: var(--muted); }
    .footer-links { display: flex; flex-wrap: wrap; gap: 4px; margin-right: -12px; }
    .footer-links a {
      display: inline-flex; align-items: center; min-height: 38px;
      padding: 0 12px; border-radius: 999px;
      font-size: 0.86rem; color: var(--ink); text-decoration: none;
      transition: color 0.15s ease, background 0.15s ease;
    }
    .footer-links a:hover { color: var(--positive-strong); background: var(--brand-soft); }
    .footer-links a:focus-visible { outline: 2px solid var(--positive); outline-offset: 2px; }
    .footer-links a[aria-current="page"] { color: var(--positive-strong); background: var(--brand-soft); font-weight: 600; }
    .footer-bottom {
      display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between;
      margin-top: 20px; padding-top: 14px;
      border-top: 1px dashed var(--line);
      font-size: 0.76rem; color: var(--muted);
    }
    @media (max-width: 767px) {
      .site-footer { margin-bottom: calc(80px + env(safe-area-inset-bottom)); }
    }
    @media (max-width: 639px) {
      .footer-grid { flex-direction: column; align-items: stretch; gap: 18px; }
      .footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-right: 0; }
      .footer-links a { justify-content: center; min-height: 42px; padding: 0 10px; background: var(--surface-soft); }
      .footer-bottom { flex-direction: column; }
    }
