/* app-05-editorial.css
 * 日式雜誌風改版（v3.71）＋ 全站樣式正規化（v3.73）
 *
 * 這是 app.css 拆開後的第 5 層（共 6 層）。
 * CSS 是後面蓋前面，所以 index.html 必須照 app-01 → app-06 → v4.css 的順序載入。
 * 要改外觀，先找最後面的層（v4.css），那裡改不動才往前找。
 */
/* ═══════════════════════════════════════════════════════════════
   v3.71 — JAPANESE MODERN EDITORIAL / MATTE FROSTED SURFACE
   暖白、低彩度、細線與霧面塑料；覆蓋舊 Glass / Liquid Glass 外觀。
   ═══════════════════════════════════════════════════════════════ */
:root,
html:not([data-theme="dark"]){
  --primary:#34342F;
  --primary-dk:#1F1F1C;
  --success:#55705C;
  --danger:#8A5550;
  --warn:#8A6D3F;
  --bg:#F5F4F0;
  --card:#ECEAE5;
  --bg2:#F0EEE9;
  --tint:#E7E5DF;
  --tint-warn:#EEE9DE;
  --sidebar:#F0EEE9;
  --text:#181817;
  --muted:#77746E;
  --border:rgba(20,20,20,.09);
  --t1:#73796C;
  --t2:#858077;
  --t3:#A69B88;
}
html[data-theme="dark"]{
  --primary:#E7E3DA;
  --primary-dk:#F5F2EA;
  --success:#9FAE9D;
  --danger:#C49A94;
  --warn:#BFA77E;
  --bg:#1D1D1B;
  --card:#2D2C28;
  --bg2:#252521;
  --tint:#33332E;
  --tint-warn:#3A3428;
  --sidebar:#232320;
  --text:#F0EEE8;
  --muted:#A9A69E;
  --border:rgba(255,255,255,.09);
  --t1:#9FA694;
  --t2:#A9A49A;
  --t3:#BEB39F;
}
body,html[data-theme="dark"] body{
  background:var(--bg) !important;
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Hiragino Sans","PingFang TC","Noto Sans TC",sans-serif;
  line-height:1.65;
  letter-spacing:.01em;
}
body::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:9999;
  pointer-events:none;
  opacity:.022;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
}

/* Navigation */
.sidebar,html:not([data-theme="dark"]) .sidebar,html[data-theme="dark"] .sidebar{
  width:196px;
  background-color:rgba(240,238,233,.9) !important;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' opacity='.035'/%3E%3C/svg%3E") !important;
  -webkit-backdrop-filter:blur(7px) !important;
  backdrop-filter:blur(7px) !important;
  border-right:1px solid var(--border) !important;
  box-shadow:inset -1px 0 rgba(255,255,255,.38),5px 0 24px rgba(48,44,37,.025) !important;
  color:var(--text);
}
html[data-theme="dark"] .sidebar{background-color:rgba(35,35,32,.94) !important;box-shadow:inset -1px 0 rgba(255,255,255,.04),6px 0 26px rgba(0,0,0,.08) !important}
.sb-head{padding:32px 20px 22px;border-bottom:0 !important}
.sb-head h1{font-family:inherit;font-size:18px;font-weight:600;color:var(--text) !important;letter-spacing:-.01em}
.sb-head p{margin-top:5px;color:var(--muted) !important;font-size:9px;letter-spacing:.13em;text-transform:uppercase}
.sb-toggle{padding:4px 17px 13px;border-bottom:1px solid var(--border) !important}
.sb-toggle button{color:var(--muted) !important;border-radius:4px}
.sb-nav{padding:24px 13px}
.nav-item,html:not([data-theme="dark"]) .nav-item{
  margin:1px 0;
  padding:9px 10px 9px 13px;
  border:0;
  border-left:1px solid transparent;
  border-radius:4px;
  color:var(--muted) !important;
  font-size:12px;
  font-weight:400;
}
.nav-ico{display:none !important}
.nav-item:hover,html:not([data-theme="dark"]) .nav-item:hover{background:rgba(127,122,112,.06) !important;color:var(--text) !important}
.nav-item.active,html:not([data-theme="dark"]) .nav-item.active,html[data-theme="dark"] .nav-item.active{
  background:rgba(127,122,112,.09) !important;
  color:var(--text) !important;
  border-left-color:var(--text) !important;
  box-shadow:none !important;
}
.sb-user,.sb-footer{border-top:1px solid var(--border) !important}
.sb-footer{padding:12px 14px;gap:4px}
.sb-footer button,html:not([data-theme="dark"]) .sb-footer button{border:0 !important;background:transparent !important;color:var(--muted) !important;padding:5px 2px;border-radius:2px}
.sb-footer button:hover{color:var(--text) !important;text-decoration:underline;text-underline-offset:3px}
.sb-whatsnew{margin:0 14px 8px !important;padding:7px 8px !important;border:1px solid var(--border) !important;border-radius:3px !important;background:transparent !important;color:var(--muted) !important;font-size:10px !important}
.sb-version{color:var(--muted) !important;font-size:9px;letter-spacing:.04em}

/* Page frame and editorial hierarchy */
.main{padding:32px clamp(28px,4vw,68px) 72px;background:transparent !important}
.mode-bar{margin:0 0 44px;padding:0 0 16px;border-bottom:1px solid var(--border)}
.mode-bar-title{margin-right:auto;color:var(--muted);font-size:9px;letter-spacing:.14em}
.mode-btn,.invest-market-tab{
  padding:5px 10px !important;
  border:1px solid var(--border) !important;
  border-radius:4px !important;
  background:transparent !important;
  color:var(--muted) !important;
  font-size:11px !important;
  font-weight:500 !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}
.mode-btn.active,.invest-market-tab.active,html:not([data-theme="dark"]) .mode-btn.active,html:not([data-theme="dark"]) .invest-market-tab.active,html[data-theme="dark"] .mode-btn.active,html[data-theme="dark"] .invest-market-tab.active{
  background:var(--primary) !important;
  border-color:var(--primary) !important;
  color:var(--bg) !important;
}
.mode-theme-btn{
  width:32px;height:30px;margin-left:4px;padding:0;border:1px solid var(--border);border-radius:5px;
  background:transparent;color:var(--text);font-size:14px;cursor:pointer;box-shadow:none;
}
.mode-theme-btn:hover{background:rgba(127,122,112,.07)}
.page-header{margin-bottom:30px;align-items:flex-end}
/* 標題與內文用同一套字（黑體）：明體大標與四周的黑體內容並置時視覺會打架 */
.page-title{font-family:inherit;font-size:clamp(30px,3vw,42px);line-height:1.18;font-weight:500;letter-spacing:-.02em}

/* Dashboard hero */
.dashboard-hero{display:grid;grid-template-columns:minmax(0,7fr) minmax(260px,5fr);gap:36px;align-items:end;padding:18px 0 38px}
.dashboard-hero .page-header{margin:0}
.dashboard-networth{text-align:right}
.dashboard-networth-label{color:var(--muted);font-size:10px;letter-spacing:.06em}
.dashboard-networth-value{margin-top:3px;color:var(--text) !important;font-size:clamp(34px,4vw,52px);line-height:1.15;font-weight:500;letter-spacing:-.045em;font-variant-numeric:tabular-nums}
.dashboard-networth-note{margin-top:5px;color:var(--muted);font-size:10px}

/* KPI rows: typography and dividers, not floating cards */
.stats-grid{gap:0;margin-bottom:38px;border-block:1px solid var(--border)}
.stats-grid .card,html:not([data-theme="dark"]) .stats-grid .card,html[data-theme="dark"] .stats-grid .card{
  min-width:0;
  padding:19px 20px 19px 0;
  background:transparent !important;
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}
.stats-grid .card+.card{padding-left:20px;border-left:1px solid var(--border) !important}
.card-title,.health-label,.calc-stat-label{margin-bottom:6px;color:var(--muted);font-size:10px;font-weight:500;letter-spacing:.05em}
.card-value{font-size:22px;font-weight:500;letter-spacing:-.025em;font-variant-numeric:tabular-nums}
.card-sub,.health-desc{color:var(--muted);font-size:9px}
.dashboard-card-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.ledger-icon-btn{display:inline-grid;place-items:center;width:24px;height:24px;margin:-5px -2px -3px 0;padding:3px;border:0;border-radius:5px;background:transparent;color:var(--muted);cursor:pointer}
.ledger-icon-btn:hover,.ledger-icon-btn:focus-visible{color:var(--text);background:rgba(127,122,112,.09);outline:none}
.ledger-icon-btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.surplus-history-note{margin:-4px 0 10px;padding:9px 11px;border-radius:7px;background:var(--bg2);color:var(--muted);font-size:11px;line-height:1.5}
.surplus-history-list{max-height:58vh;overflow-y:auto;padding-right:3px}
.surplus-history-row{padding:12px 2px;border-bottom:1px solid var(--border)}
.surplus-history-row:last-child{border-bottom:0}
.surplus-history-head,.surplus-history-flow,.surplus-history-detail{display:flex;align-items:center;justify-content:space-between;gap:10px}
.surplus-history-head{font-size:13px;font-weight:700}
.surplus-history-head b{font-size:16px;white-space:nowrap}
.surplus-history-flow{margin-top:7px;color:var(--text);font-size:11px}
.surplus-history-detail{justify-content:flex-start;flex-wrap:wrap;margin-top:4px;color:var(--muted);font-size:10px}
.health-grid{gap:0;margin-bottom:48px;border-bottom:1px solid var(--border)}
.health-card,html:not([data-theme="dark"]) .health-card,html[data-theme="dark"] .health-card{
  padding:18px 20px 22px 0;
  background:transparent !important;
  border:0 !important;
  border-top:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}
.health-card+.health-card{padding-left:20px;border-left:1px solid var(--border) !important}
.health-value{font-size:20px;font-weight:500}

/* Matte surfaces */
html:not([data-theme="dark"]) .chart-card,
html:not([data-theme="dark"]) .chart-full,
html:not([data-theme="dark"]) .table-card,
html:not([data-theme="dark"]) .calc-form,
html:not([data-theme="dark"]) .calc-stat,
html:not([data-theme="dark"]) .calc-chart-card,
html:not([data-theme="dark"]) .item-card,
html:not([data-theme="dark"]) .invest-toolbar,
html:not([data-theme="dark"]) .invest-trend-card,
html:not([data-theme="dark"]) .acct-panel,
html:not([data-theme="dark"]) .budget-panel,
html:not([data-theme="dark"]) .acct-donut-card,
html:not([data-theme="dark"]) .acct-trend-block,
html:not([data-theme="dark"]) .cashflow-panel,
html:not([data-theme="dark"]) .modal{
  background-color:rgba(236,234,229,.86) !important;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' opacity='.035'/%3E%3C/svg%3E") !important;
  -webkit-backdrop-filter:blur(6px) !important;
  backdrop-filter:blur(6px) !important;
  border:1px solid rgba(72,67,58,.11) !important;
  border-radius:6px !important;
  box-shadow:inset 0 1px rgba(255,255,255,.5),inset 0 -1px rgba(46,42,35,.02),0 10px 28px rgba(48,44,37,.045),0 2px 6px rgba(48,44,37,.025) !important;
}
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .chart-full,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .calc-form,
html[data-theme="dark"] .calc-stat,
html[data-theme="dark"] .calc-chart-card,
html[data-theme="dark"] .item-card,
html[data-theme="dark"] .invest-toolbar,
html[data-theme="dark"] .invest-trend-card,
html[data-theme="dark"] .acct-panel,
html[data-theme="dark"] .budget-panel,
html[data-theme="dark"] .acct-donut-card,
html[data-theme="dark"] .acct-trend-block,
html[data-theme="dark"] .cashflow-panel,
html[data-theme="dark"] .modal{
  background:rgba(45,44,40,.92) !important;
  -webkit-backdrop-filter:blur(6px) !important;
  backdrop-filter:blur(6px) !important;
  border:1px solid var(--border) !important;
  border-radius:6px !important;
  box-shadow:inset 0 1px rgba(255,255,255,.06),0 12px 28px rgba(0,0,0,.14) !important;
}
.chart-full{padding:26px 28px;margin-bottom:48px}
.chart-card{padding:24px 26px}
.chart-title,.table-title,.invest-trend-title{font-size:15px;font-weight:500;letter-spacing:-.01em}
.chart-title-row{margin-bottom:18px}
.charts-grid{gap:22px;margin-bottom:42px}

/* Tables and lists */
.table-card{margin-bottom:24px;overflow:hidden}
.table-header{padding:16px 18px;background:transparent;border-bottom:1px solid var(--border)}
th,html:not([data-theme="dark"]) .table-card th,html[data-theme="dark"] .table-card th{
  padding:11px 14px;
  background:rgba(127,122,112,.035) !important;
  color:var(--muted);
  font-size:9px;
  font-weight:500;
  letter-spacing:.06em;
}
td{padding:14px;font-size:12px}
tr:hover td,html:not([data-theme="dark"]) tr:hover td,html[data-theme="dark"] tr:hover td{background:rgba(127,122,112,.045) !important}

/* Flat controls */
.btn,.btn-sm,.btn-icon,.mode-btn,.invest-market-tab{border-radius:5px !important;transform:none !important}
.btn-primary,html:not([data-theme="dark"]) .btn-primary,html[data-theme="dark"] .btn-primary{
  background:var(--primary) !important;
  border:1px solid var(--primary) !important;
  color:var(--bg) !important;
  box-shadow:none !important;
}
.btn-primary:hover{background:var(--primary-dk) !important}
#backup-reminder .br-ok,
html:not([data-theme="dark"]) #backup-reminder .br-ok,
html[data-theme="dark"] #backup-reminder .br-ok{
  background:var(--primary) !important;
  color:var(--bg) !important;
  box-shadow:none !important;
}
#backup-reminder .br-title,
html:not([data-theme="dark"]) #backup-reminder .br-title,
html[data-theme="dark"] #backup-reminder .br-title{color:var(--text) !important}
.btn-ghost,.btn-icon,html:not([data-theme="dark"]) .btn-ghost,html:not([data-theme="dark"]) .btn-icon,html[data-theme="dark"] .btn-ghost,html[data-theme="dark"] .btn-icon{
  background:rgba(245,243,238,.5) !important;
  border:1px solid var(--border) !important;
  color:var(--text) !important;
  box-shadow:inset 0 1px rgba(255,255,255,.35) !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}
html[data-theme="dark"] .btn-ghost,html[data-theme="dark"] .btn-icon{background:rgba(255,255,255,.035) !important}
.btn-danger,html:not([data-theme="dark"]) .btn-danger,html[data-theme="dark"] .btn-danger{background:transparent !important;border:1px solid color-mix(in srgb,var(--danger) 38%,transparent) !important;color:var(--danger) !important;box-shadow:none !important}
input,select,textarea,select.filter,html:not([data-theme="dark"]) input,html:not([data-theme="dark"]) select,html:not([data-theme="dark"]) textarea,html:not([data-theme="dark"]) select.filter,html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] select.filter{
  background:rgba(249,248,245,.72) !important;
  border:1px solid var(--border) !important;
  border-radius:5px !important;
  color:var(--text) !important;
  box-shadow:inset 0 1px rgba(255,255,255,.35) !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] select.filter{background:rgba(255,255,255,.04) !important}
input:focus,select:focus,textarea:focus,select.filter:focus{border-color:rgba(52,52,47,.45) !important;box-shadow:0 0 0 2px rgba(52,52,47,.08) !important}

/* Muted labels and progress */
.badge{padding:2px 7px;border-radius:3px !important;background:rgba(127,122,112,.08) !important;border:1px solid var(--border) !important;color:var(--muted) !important;box-shadow:none !important;-webkit-backdrop-filter:none !important;backdrop-filter:none !important;font-weight:500}
.health-bar-wrap,.liab-progress-wrap,.goal-progress-wrap,.budget-progress,.rp-track,html:not([data-theme="dark"]) .health-bar-wrap,html:not([data-theme="dark"]) .liab-progress-wrap,html:not([data-theme="dark"]) .goal-progress-wrap,html:not([data-theme="dark"]) .budget-progress,html:not([data-theme="dark"]) .rp-track,html[data-theme="dark"] .health-bar-wrap,html[data-theme="dark"] .liab-progress-wrap,html[data-theme="dark"] .goal-progress-wrap,html[data-theme="dark"] .budget-progress,html[data-theme="dark"] .rp-track{height:3px;background:rgba(127,122,112,.16);border-radius:1px;box-shadow:none}
.health-bar,.liab-progress-bar,.goal-progress-bar,.budget-progress-bar,.rp-fill,html:not([data-theme="dark"]) .health-bar,html:not([data-theme="dark"]) .liab-progress-bar,html:not([data-theme="dark"]) .goal-progress-bar,html:not([data-theme="dark"]) .budget-progress-bar,html:not([data-theme="dark"]) .rp-fill,html[data-theme="dark"] .health-bar,html[data-theme="dark"] .liab-progress-bar,html[data-theme="dark"] .goal-progress-bar,html[data-theme="dark"] .budget-progress-bar,html[data-theme="dark"] .rp-fill{background:var(--text) !important;border-radius:1px;box-shadow:none !important}

/* Page-specific quiet structure */
.goal-card,html:not([data-theme="dark"]) .goal-card,html[data-theme="dark"] .goal-card{margin:0;padding:22px 0;background:transparent !important;border:0 !important;border-top:1px solid var(--border) !important;border-radius:0 !important;box-shadow:none !important;-webkit-backdrop-filter:none !important;backdrop-filter:none !important}
.goal-card:last-child{border-bottom:1px solid var(--border) !important}
.item-card{border-radius:4px !important}
.item-photo,.catalog-image{background:var(--bg2)}
.item-info{padding:12px}
.invest-trend-card{overflow:hidden}
.invest-trend-head{padding:18px 20px;border-bottom:1px solid var(--border)}
.calc-layout{grid-template-columns:minmax(280px,5fr) minmax(0,7fr);gap:22px}
.calc-result-grid{gap:0;border-block:1px solid var(--border)}
.calc-stat,html:not([data-theme="dark"]) .calc-stat,html[data-theme="dark"] .calc-stat{background:transparent !important;border:0 !important;border-radius:0 !important;box-shadow:none !important}
.calc-stat+.calc-stat{border-left:1px solid var(--border) !important}
.overlay{background:rgba(28,27,24,.32)}
.modal{border-radius:7px !important}
.donut-dot{border-radius:1px}
.donut-legend{scrollbar-color:rgba(127,122,112,.28) transparent}

/* Dashboard — editorial overview composition */
#page-dashboard .dashboard-hero{padding:22px 0 52px}
#page-dashboard .page-title{font-size:clamp(38px,4vw,52px)}
#page-dashboard .dashboard-networth-value{font-size:clamp(42px,5vw,60px)}
#page-dashboard .stats-grid{margin-bottom:54px}
#page-dashboard .stats-grid .card{padding-top:22px;padding-bottom:22px}
#page-dashboard .card-value{font-size:25px;color:var(--text) !important}
.dashboard-section-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.dashboard-section-heading>span:last-child{color:var(--muted);font-size:10px;letter-spacing:.02em}
.dashboard-trend-section{margin-bottom:48px}
.dashboard-trend-card{margin-bottom:0;padding:28px 30px 22px}
.dashboard-trend-meta{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:2px}
.dashboard-trend-delta{color:var(--text) !important;font-size:28px;font-weight:500;letter-spacing:-.035em;font-variant-numeric:tabular-nums}
.dashboard-trend-caption{margin-top:2px;color:var(--muted);font-size:10px}
.dashboard-trend-actions{display:flex;align-items:center;gap:10px;padding-top:2px}
#trend-year-btns{display:flex;gap:4px;flex-wrap:wrap}
#page-dashboard .health-grid{margin-top:0;margin-bottom:52px}

@media(max-width:768px){
  .sidebar{width:196px !important}
  .mobile-topbar{background:rgba(240,238,233,.96);border-bottom:1px solid var(--border)}
  .mobile-topbar-title,.mobile-hamburger{color:var(--text)}
  .main{padding:72px 16px 48px}
  .mode-bar{margin-bottom:28px}
  .dashboard-hero{grid-template-columns:1fr;gap:18px;padding:8px 0 28px}
  .dashboard-networth{text-align:left}
  #page-dashboard .dashboard-hero{padding:8px 0 32px}
  #page-dashboard .stats-grid{margin-bottom:38px}
  .dashboard-trend-meta{flex-direction:column;gap:14px}
  .dashboard-trend-actions{width:100%;justify-content:space-between}
  .stats-grid.g4,.stats-grid.g3,.stats-grid.g2{grid-template-columns:1fr 1fr}
  .stats-grid .card:nth-child(3){padding-left:0;border-left:0 !important;border-top:1px solid var(--border) !important}
  .stats-grid .card:nth-child(4){border-top:1px solid var(--border) !important}
  .health-grid{grid-template-columns:1fr 1fr}
  .health-card:nth-child(3){padding-left:0;border-left:0 !important;border-top:1px solid var(--border) !important}
  .health-card:nth-child(4){border-top:1px solid var(--border) !important}
  .chart-full,.chart-card{padding:20px 18px}
  .calc-layout{grid-template-columns:1fr}
}
@media(max-width:480px){
  .stats-grid.g4,.stats-grid.g3,.stats-grid.g2,.health-grid{grid-template-columns:1fr}
  .stats-grid .card,.stats-grid .card+.card,.stats-grid .card:nth-child(3),.health-card,.health-card+.health-card,.health-card:nth-child(3){padding:16px 0;border-left:0 !important;border-top:1px solid var(--border) !important}
  .stats-grid .card:first-child,.health-card:first-child{border-top:0 !important}
  .page-title{font-size:30px}
}

/* ═══════════════════════════════════════════════════════════════
   v3.73 — COMPLETE UI NORMALIZATION
   最終覆蓋：移除所有舊 Glass / Liquid Glass、藍色原生控制項與膠囊元件殘留。
   ═══════════════════════════════════════════════════════════════ */
input[type="checkbox"],input[type="radio"],input[type="range"]{accent-color:var(--text)}

/* 鍵盤焦點沿用炭黑／暖灰，不露出瀏覽器預設藍框 */
button:focus,input:focus,textarea:focus,a:focus{outline:none}
button:focus-visible,input:focus-visible,textarea:focus-visible,a:focus-visible,
.item-card:focus-visible{
  outline:1px solid var(--text) !important;outline-offset:2px !important;
  box-shadow:none !important;
}

/* 尚未被前一版涵蓋的 Surface */
.card,.retire-progress,.receivable-box,.receivable-item,.cc-payable-row,.cc-pay-items,
.invest-symbol-picker,.invest-trend-stat,.photo-preview-wrap,.rp-twocol>div,
html:not([data-theme="dark"]) .card,html[data-theme="dark"] .card{
  background:var(--card) !important;
  background-image:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
  border:1px solid var(--border) !important;
  border-radius:6px !important;
  box-shadow:inset 0 1px rgba(255,255,255,.28),0 8px 22px rgba(48,44,37,.035) !important;
}
html[data-theme="dark"] .card,html[data-theme="dark"] .retire-progress,
html[data-theme="dark"] .receivable-box,html[data-theme="dark"] .receivable-item,
html[data-theme="dark"] .cc-payable-row,html[data-theme="dark"] .cc-pay-items,
html[data-theme="dark"] .invest-symbol-picker,html[data-theme="dark"] .invest-trend-stat,
html[data-theme="dark"] .photo-preview-wrap,html[data-theme="dark"] .rp-twocol>div{
  box-shadow:inset 0 1px rgba(255,255,255,.045),0 10px 24px rgba(0,0,0,.12) !important;
}
.stats-grid .card,.health-grid .health-card,.goal-card{
  background:transparent !important;background-image:none !important;box-shadow:none !important;
}

/* 現金流改為編輯式清單，不再是藍灰膠囊玻璃 */
.cf-row,html:not([data-theme="dark"]) .cf-row,html[data-theme="dark"] .cf-row{
  margin:0 !important;padding:12px 0 !important;
  background:transparent !important;background-image:none !important;
  -webkit-backdrop-filter:none !important;backdrop-filter:none !important;
  border:0 !important;border-bottom:1px solid var(--border) !important;
  border-radius:0 !important;box-shadow:none !important;
}
.cf-divider{margin:8px 0 0;border:0;border-top:1px solid var(--text);opacity:.2}
.cf-divider+.cf-row{padding-top:16px !important;border-bottom:0 !important}

/* 分段、分類與期間標籤全部改小圓角 */
.trend-seg{padding:2px !important;border-radius:4px !important;background:transparent !important;box-shadow:none !important}
.trend-seg button,.trend-seg button.active{border-radius:3px !important;box-shadow:none !important}
/* 選中的字色要對比背景：深色模式的 --primary 是米白，寫死白字會看不見 */
.trend-seg button.active{background:var(--primary) !important;color:var(--bg) !important}
.trend-control,.acct-period-tag,.ve-chip,.ve-cat-badge{border-radius:3px !important}
.ve-chip{background:transparent !important}
.ve-chip.total{background:var(--primary) !important;color:var(--bg) !important}

/* 備份提醒與側欄訪客狀態 */
#backup-reminder,html:not([data-theme="dark"]) #backup-reminder,html[data-theme="dark"] #backup-reminder{
  background:var(--card) !important;background-image:none !important;
  -webkit-backdrop-filter:blur(6px) !important;backdrop-filter:blur(6px) !important;
  border:1px solid var(--border) !important;border-radius:6px !important;
  color:var(--text) !important;box-shadow:0 12px 30px rgba(48,44,37,.1) !important;
}
html[data-theme="dark"] #backup-reminder{box-shadow:0 14px 34px rgba(0,0,0,.28) !important}
#backup-reminder .br-dismiss,html:not([data-theme="dark"]) #backup-reminder .br-dismiss,html[data-theme="dark"] #backup-reminder .br-dismiss{
  background:transparent !important;color:var(--muted) !important;border:1px solid var(--border) !important;border-radius:4px !important;
}
#sb-guest button,html:not([data-theme="dark"]) #sb-guest button,html[data-theme="dark"] #sb-guest button{
  background:transparent !important;color:var(--muted) !important;border:1px solid var(--border) !important;border-radius:4px !important;box-shadow:none !important;
}
html:not([data-theme="dark"]) .sb-version,html[data-theme="dark"] .sb-version,
html:not([data-theme="dark"]) #sb-guest>div,html[data-theme="dark"] #sb-guest>div{color:var(--muted) !important}

/* 登入畫面也使用同一設計系統 */
.login-screen,html:not([data-theme="dark"]) .login-screen,html[data-theme="dark"] .login-screen{background:var(--bg) !important;color:var(--text)}
.login-box,html:not([data-theme="dark"]) .login-box,html[data-theme="dark"] .login-box{
  padding:38px 34px;background:var(--card) !important;background-image:none !important;
  border:1px solid var(--border) !important;border-radius:6px !important;
  box-shadow:inset 0 1px rgba(255,255,255,.35),0 18px 48px rgba(48,44,37,.08) !important;
}
.login-title{font-family:"Iowan Old Style","Noto Serif TC","Songti TC",serif;color:var(--text) !important;font-weight:400}
.login-sub,.login-note,#login-loading{color:var(--muted) !important}
.btn-google,.btn-guest{border-radius:4px !important;box-shadow:none !important}
.btn-google{background:var(--primary) !important;color:var(--bg) !important;border:1px solid var(--primary) !important}
.btn-guest{background:transparent !important;color:var(--muted) !important;border:1px solid var(--border) !important}

/* 自有下拉與日期控制：完全取代系統藍色 Popover */
.ui-select-wrap,.ui-date-wrap{position:relative;display:inline-block;width:100%;min-width:0;vertical-align:middle}
.ui-select-wrap.is-compact{width:auto;min-width:118px}
.ui-native-control{
  position:absolute !important;width:1px !important;height:1px !important;margin:0 !important;padding:0 !important;
  opacity:0 !important;pointer-events:none !important;overflow:hidden !important;
}
.ui-select-button,.ui-date-button{
  width:100%;min-height:36px;display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:8px 11px;background:rgba(249,248,245,.72);color:var(--text);
  border:1px solid var(--border);border-radius:5px;font:inherit;font-size:13px;text-align:left;cursor:pointer;
  box-shadow:inset 0 1px rgba(255,255,255,.32);
}
html[data-theme="dark"] .ui-select-button,html[data-theme="dark"] .ui-date-button{background:rgba(255,255,255,.04);box-shadow:inset 0 1px rgba(255,255,255,.035)}
.ui-select-button:focus-visible,.ui-date-button:focus-visible{outline:1px solid var(--text);outline-offset:2px;border-color:var(--border);box-shadow:none}
.ui-select-button:disabled,.ui-date-button:disabled{opacity:.45;cursor:not-allowed}
.ui-control-arrow{color:var(--muted);font-size:12px}
.ui-date-mark{display:grid;place-items:center;width:20px;height:18px;border:1px solid var(--border);border-radius:2px;color:var(--muted);font-size:9px}
.ui-control-menu{
  display:none;position:fixed;z-index:6000;max-height:min(360px,70vh);overflow:auto;
  padding:5px;background:var(--card);color:var(--text);border:1px solid var(--border);border-radius:5px;
  box-shadow:0 14px 34px rgba(48,44,37,.14),inset 0 1px rgba(255,255,255,.3);
}
html[data-theme="dark"] .ui-control-menu{box-shadow:0 16px 38px rgba(0,0,0,.34),inset 0 1px rgba(255,255,255,.04)}
.ui-control-menu.open{display:block}
.ui-control-option{
  width:100%;display:grid;grid-template-columns:18px 1fr;gap:6px;align-items:center;padding:7px 8px;
  background:transparent;color:var(--text);border:0;border-radius:3px;text-align:left;font:inherit;font-size:13px;cursor:pointer;
}
.ui-control-option:hover,.ui-control-option.selected{background:rgba(127,122,112,.11)}
.ui-control-option:disabled{opacity:.38;cursor:not-allowed}
.ui-option-check{color:var(--muted);font-size:11px}
.ui-date-menu{width:286px !important;max-height:none;overflow:hidden;padding:10px}
.ui-date-head{display:grid;grid-template-columns:30px 1fr 30px;align-items:center;margin-bottom:8px}
.ui-date-head strong{text-align:center;font-size:12px;font-weight:500;letter-spacing:.04em}
.ui-date-head button,.ui-date-foot button,.ui-date-day{
  background:transparent;color:var(--text);border:0;border-radius:3px;font:inherit;cursor:pointer;
}
.ui-date-head button{height:28px;font-size:18px}
.ui-date-week,.ui-date-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.ui-date-week span{text-align:center;color:var(--muted);font-size:10px;padding:4px 0}
.ui-date-day{height:32px;font-size:12px}
.ui-date-day:hover{background:rgba(127,122,112,.1)}
.ui-date-day.muted{color:var(--muted);opacity:.38}
.ui-date-day.today{box-shadow:inset 0 0 0 1px var(--border)}
.ui-date-day.selected{background:var(--primary);color:var(--bg);box-shadow:none}
.ui-date-foot{display:flex;justify-content:space-between;margin-top:8px;padding-top:8px;border-top:1px solid var(--border)}
.ui-date-foot button{padding:5px 7px;color:var(--muted);font-size:11px}
.ui-date-foot button:hover{color:var(--text);background:rgba(127,122,112,.08)}

@media(max-width:480px){
  .ui-control-menu{max-width:calc(100vw - 16px)}
  .ui-date-menu{width:calc(100vw - 24px) !important}
}

