/* 柴寶發薪日｜配色沿用提案簡報 v6：奶油黃底、柴寶藍主色、焦糖棕輔色；版面參考 LINE Bank 的大卡片與留白 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
  --bg: #fbf4dc;
  --surface: #ffffff;
  --soft: #fffaea;
  --line: #efe3bf;
  --blue: #2f6b9a;
  --blue-dark: #245578;
  --blue-soft: #e6f0f8;
  --brown: #a8693c;
  --brown-soft: #f6e7d6;
  --gold-soft: #fff1c4;
  --text: #33271f;
  --muted: #6b5a4c;
  --up: #d23f3f;
  --down: #2f8a57;
  --r-lg: 24px;
  --r-md: 16px;
  --shadow: 0 6px 18px rgba(120, 90, 40, .08);
  --tab-h: 64px;
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #f3e9c8; }
body { min-height: 100dvh; background: #f3e9c8; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; border-radius: 12px; }
ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
svg { display: block; }
[hidden] { display: none !important; }

.app { max-width: 440px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative; }
@media (min-width: 520px) { .app { box-shadow: 0 0 0 1px rgba(160, 120, 60, .12), 0 20px 60px rgba(120, 90, 40, .15); } }

.page { padding: 12px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: pageIn .32s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 頂列 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0 2px; padding-top: max(6px, env(safe-area-inset-top)); }
.topbar.plain h1 { font-size: 19px; font-weight: 700; flex: 1; text-align: center; }
.topbar.plain .chip { flex: none; }
.spacer { width: 44px; }
.hello { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); border: 2px solid #fff; box-shadow: var(--shadow); }
.hello-sub { font-size: 13px; color: var(--muted); }
.hello-name { font-size: 18px; font-weight: 700; white-space: nowrap; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: none; }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: var(--text); stroke: none; }
.icon-btn:active { background: rgba(0, 0, 0, .05); }
.icon-btn .dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--brown); border: 2px solid var(--bg); }

/* 柴寶說話 */
.chai-say { background: var(--surface); border-radius: var(--r-md); padding: 12px 14px; font-size: 15px; line-height: 1.6; position: relative; box-shadow: var(--shadow); }
.chai-say b { color: var(--blue); }

/* 卡片 */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 18px; font-weight: 700; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.small { font-size: 14px; color: var(--muted); line-height: 1.5; }
.strong { font-weight: 700; color: var(--text); }
.num { font-size: 22px; font-weight: 700; }
.num.big { font-size: 28px; }
.num.blue { color: var(--blue); }
.num.minus { color: var(--brown); }
.chip { background: var(--blue-soft); color: var(--blue); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip.on-blue { background: rgba(255, 255, 255, .18); color: #fff; }

.pay-card { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%); color: #fff; gap: 6px; position: relative; overflow: hidden; }
.pay-card::after { content: ''; position: absolute; right: -40px; top: -50px; width: 170px; height: 170px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.pay-card .small { color: rgba(255, 255, 255, .85); }
.pay-card .amount { font-size: 42px; font-weight: 700; letter-spacing: .5px; line-height: 1.15; }
.pay-card .foot { border-top: 1px solid rgba(255, 255, 255, .2); padding-top: 10px; margin-top: 4px; }
.pay-card .bal { font-size: 18px; font-weight: 700; }

.points-line { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--brown); }
.points-line b { font-size: 17px; }
.coin { width: 22px; height: 22px; fill: var(--gold-soft); stroke: var(--brown); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mini-bills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; background: var(--soft); border-radius: 14px; padding: 10px 12px; }
.mini-bills li { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.mini-bills li span:first-child { color: var(--text); }
.bills-todo { display: flex; flex-direction: column; gap: 12px; }
.bills-done, .plan-set, .paid-banner { display: flex; align-items: center; gap: 14px; }
.done-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; flex: none; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.done-badge svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.paid-banner { background: var(--blue-soft); border-radius: var(--r-md); padding: 12px 14px; font-size: 15px; }
.paid-banner b { color: var(--blue); }

/* 按鈕 */
.btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; border-radius: 999px; font-size: 17px; font-weight: 700; padding: 0 20px; width: 100%; text-align: center; transition: transform .12s ease, filter .12s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(47, 107, 154, .28); }
.btn.primary:disabled { background: #b9c6d1; box-shadow: none; cursor: not-allowed; }
.btn.light { background: #fff; color: var(--blue); }
.btn.soft { background: var(--blue-soft); color: var(--blue); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.sm { min-height: 44px; font-size: 15px; width: auto; padding: 0 18px; }
.btn.pulse { animation: pulse 1.4s ease-in-out 3; }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 14px rgba(47, 107, 154, .28), 0 0 0 0 rgba(168, 105, 60, .55); } 50% { box-shadow: 0 6px 14px rgba(47, 107, 154, .28), 0 0 0 10px rgba(168, 105, 60, 0); } }

/* 行情列 */
.mk-row { display: flex; align-items: center; gap: 10px; min-height: 48px; width: 100%; border-radius: 12px; padding: 4px 6px; margin: 0 -6px; width: calc(100% + 12px); }
.mk-row:active, .mk-row.sel { background: var(--soft); }
.mk-name { flex: 1; font-size: 16px; font-weight: 500; min-width: 0; }
.mk-name small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.spark { width: 84px; height: 28px; flex: none; overflow: visible; }
.spark polyline { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chg { font-size: 15px; font-weight: 700; width: 64px; text-align: right; flex: none; }
.chg.big { font-size: 17px; width: auto; }
.up { color: var(--up); } .up polyline { stroke: var(--up); }
.down { color: var(--down); } .down polyline { stroke: var(--down); }
.plan-strip { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 14px; padding: 10px 10px 10px 14px; font-size: 14px; line-height: 1.5; }
.plan-strip p { flex: 1; }
.more-link { display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 14px; color: var(--muted); min-height: 44px; }
.more-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* 待繳清單 */
.bill-list { display: flex; flex-direction: column; }
.bill { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); width: 100%; }
.bill:last-child { border-bottom: 0; }
.bill-ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--blue-soft); }
.bill-ico svg { width: 22px; height: 22px; fill: none; stroke: var(--blue); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bill-ico.brown { background: var(--brown-soft); } .bill-ico.brown svg { stroke: var(--brown); }
.bill-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bill-name { font-size: 16px; font-weight: 700; }
.bill-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bill-meta .tag { color: var(--blue); }
.bill-amt { font-size: 17px; font-weight: 700; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cbbd98; display: grid; place-items: center; flex: none; transition: background .15s, border-color .15s; }
.check svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.bill[aria-checked="true"] .check { background: var(--blue); border-color: var(--blue); }
.bill[aria-checked="true"] .check svg { opacity: 1; }
.bill[aria-checked="false"] .bill-name, .bill[aria-checked="false"] .bill-amt { color: #a69a86; }
.bill:disabled { cursor: default; }
.bill.paid .check { background: var(--down); border-color: var(--down); }
.bill.paid .check svg { opacity: 1; }

.unsure { flex-direction: row; align-items: flex-start; gap: 10px; background: var(--soft); box-shadow: none; border: 1.5px dashed #dccb9b; padding: 14px; width: 100%; }
.unsure-tag { background: #fff; color: var(--brown); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; flex: none; border: 1px solid var(--line); }
.unsure-text { font-size: 14px; line-height: 1.55; color: var(--muted); }
.points-card { background: var(--gold-soft); box-shadow: none; padding: 14px 18px; }
.total-card .row .strong { font-size: 16px; }
.hint-line { font-size: 13px; color: var(--muted); text-align: center; }

/* 行情頁 */
.seg { display: flex; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.seg button { flex: 1; text-align: center; min-height: 40px; border-radius: 999px; font-size: 15px; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--blue); color: #fff; font-weight: 700; }
.ct-value { font-size: 30px; font-weight: 700; margin-top: -6px; }
.chart { width: 100%; height: 130px; overflow: visible; }
.chart .area { opacity: .14; }
.chart .ln { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart.up .area { fill: var(--up); } .chart.up .ln { stroke: var(--up); }
.chart.down .area { fill: var(--down); } .chart.down .ln { stroke: var(--down); }
.chart .ln { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw 1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.axis { font-size: 12px; color: var(--muted); margin-top: -6px; }
.note { text-align: center; margin-top: 2px; font-size: 12.5px; }
.plan-card { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%); color: #fff; gap: 8px; }
.on-blue-sub { color: rgba(255, 255, 255, .85); }
.plan-line { font-size: 19px; font-weight: 700; margin-bottom: 4px; }

/* 我的 */
.me-head { flex-direction: row; align-items: center; gap: 12px; }
.me-head img { width: 96px; flex: none; }
.fgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fgrid button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; padding: 10px 0; border-radius: 14px; text-align: center; color: var(--muted); }
.fgrid button:active { background: var(--soft); }
.fgrid svg { width: 26px; height: 26px; fill: none; stroke: var(--brown); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.replay { flex-direction: row; align-items: center; gap: 12px; width: 100%; }
.replay img { width: 64px; flex: none; }
.replay > span { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }

/* 完成頁 */
.done-page { align-items: center; text-align: center; padding-top: max(24px, env(safe-area-inset-top)); position: relative; overflow: hidden; padding-bottom: calc(28px + env(safe-area-inset-bottom)); min-height: 100dvh; }
.done-page h1 { font-size: 24px; font-weight: 700; }
.done-sub { font-size: 16px; color: var(--brown); font-weight: 500; margin-top: -6px; }
.done-art { width: 210px; animation: bounceIn .7s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes bounceIn { from { transform: scale(.5) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.done-card { width: 100%; text-align: left; }
.done-page .chai-say { text-align: left; width: 100%; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105dvh) rotate(540deg); opacity: .9; } }

/* 分頁列 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 440px); display: flex; background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabbar button { flex: 1; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12.5px; color: #8b7b6b; position: relative; text-align: center; }
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--blue); font-weight: 700; }
.tabbar button.on svg { stroke-width: 2.2; }
.tab-badge { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--brown); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.app.no-tabs .tabbar { display: none; }

.credit { text-align: center; font-size: 12px; color: #9a8a76; margin-top: 4px; }

/* 抽屜 */
.sheet-wrap, .modal-wrap { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: center; }
.sheet-wrap { align-items: flex-end; }
.sheet-bg, .modal-bg { position: absolute; inset: 0; background: rgba(51, 39, 31, .42); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: min(100%, 440px); max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-radius: 26px 26px 0 0; padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .3s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes up { from { transform: translateY(100%); } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: #d8c9a2; margin: 4px auto 12px; }
.sheet h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.sheet .lead { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.sheet .card { box-shadow: none; }
.sheet .btn + .btn { margin-top: 6px; }
.detail-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.detail-list li:last-child { border-bottom: 0; }
.detail-list li.pts { color: var(--brown); }
.detail-list li.sum { font-size: 18px; font-weight: 700; border-top: 1.5px solid var(--text); border-bottom: 0; margin-top: 4px; padding-top: 12px; }
.from-acct { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin: 12px 2px 14px; }
.from-acct b { color: var(--text); }
.processing { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 0 24px; text-align: center; }
.processing img { width: 120px; animation: wiggle .6s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.processing p { font-size: 16px; font-weight: 500; }
.field-label { font-size: 14px; font-weight: 700; color: var(--muted); margin: 14px 2px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-size: 15px; }
.chips button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.fixed-row { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.risk-note { font-size: 13px; color: var(--muted); margin: 12px 2px 14px; line-height: 1.55; }

/* 提示彈窗 */
.modal-wrap { align-items: center; padding: 20px; }
.modal { position: relative; width: min(100%, 360px); background: var(--bg); border-radius: 26px; padding: 22px 20px 18px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop .3s cubic-bezier(.3, 1.4, .5, 1) both; }
.modal img { width: 130px; }
.modal h2 { font-size: 19px; font-weight: 700; }
.modal p { font-size: 15px; line-height: 1.6; color: var(--muted); }
.modal-actions { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 8px; }

/* 導覽 */
.guide { position: fixed; inset: 0; z-index: 50; }
.spot { position: absolute; border-radius: 26px; box-shadow: 0 0 0 9999px rgba(51, 39, 31, .55); transition: all .35s cubic-bezier(.2, .9, .3, 1); pointer-events: none; outline: 3px solid #f3c25b; outline-offset: 3px; }
.spot.none { top: 50%; left: 50%; width: 0; height: 0; outline: 0; }
.bubble { position: absolute; left: 50%; transform: translateX(-50%); width: min(calc(100% - 32px), 400px); background: var(--surface); border-radius: 22px; padding: 16px 16px 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .22); transition: top .35s cubic-bezier(.2, .9, .3, 1); }
.bubble-art { position: absolute; right: 10px; top: -60px; width: 86px; }
.bubble-step { font-size: 12px; font-weight: 700; color: var(--brown); }
.bubble h2 { font-size: 18px; font-weight: 700; margin: 2px 0 4px; padding-right: 70px; }
.bubble p#bubbleText { font-size: 15px; line-height: 1.6; color: var(--muted); }
.bubble-actions { display: flex; justify-content: space-between; margin-top: 10px; }

/* 吐司 */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: rgba(51, 39, 31, .92); color: #fff; font-size: 14px; padding: 10px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 60; max-width: calc(100% - 40px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 標出展示入口 */
.flash { animation: flash 1.2s ease-in-out 3; }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(243, 194, 91, 0); } 50% { box-shadow: var(--shadow), 0 0 0 5px rgba(243, 194, 91, .95); } }

@media (max-width: 350px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .pay-card .amount { font-size: 36px; }
  .spark { width: 64px; }
  .hello-name { font-size: 16px; }
  .fgrid { grid-template-columns: repeat(3, 1fr); }
  .bill-ico { display: none; }
  .bill-meta .tag { display: block; }
  .bill-meta .sep { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
