/* 臺灣銀行內部系統風格（行員端、帳本監看、入口頁共用）。色彩依臺銀數位品牌規範。 */
:root {
  --bot-red: #9a0036;
  --bot-red-light: #d93657;
  --bot-red-90: #a32244;
  --bot-red-20: #ebcfcf;
  --bot-red-10: #f6e8e8;
  --bot-redlight-10: #fcefee;
  --side-bg: #fbf3f5;
  --side-line: #f0e1e6;
  --ink: #1a1a1a;
  --ink-2: #4d4d4d;
  --ink-3: #808080;
  --ink-4: #b2b2b2;
  --line: #e7e7ea;
  --line-2: #dcdce0;
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f5f5f6;
  --ok: #1e7f4f;
  --ok-bg: #e7f4ec;
  --warn: #a35f00;
  --warn-bg: #fff3dc;
  --roll: #c4610f;
  --roll-bg: #fff1e3;
  --bad: #c0282d;
  --new-bg: #fff6d1;
  --font: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(89, 26, 74, .04), 0 2px 8px rgba(89, 26, 74, .04);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
svg { display: block; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; font-size: 16px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn.primary { background: var(--bot-red); color: #fff; }
.btn.primary:hover { background: #85002f; }
.btn.primary:disabled { background: #d9c4cb; color: #fff; }
.btn.secondary { background: #fff; color: var(--bot-red); border-color: var(--bot-red); }
.btn.secondary:hover { background: var(--bot-redlight-10); }
.btn.secondary:disabled { color: var(--ink-4); border-color: var(--line-2); background: #fff; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg-3); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 18px; font-weight: 600; }

/* 標籤 */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge.PENDING { background: var(--warn-bg); color: var(--warn); }
.badge.REDEEMED, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.new { background: var(--bot-red); color: #fff; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; }

/* 連線狀態 */
.conn-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--ok-bg); color: var(--ok); font-size: 13px; font-weight: 500; white-space: nowrap; }
.conn-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(30, 127, 79, .18); }
.conn-pill.off { background: #fdeaea; color: var(--bad); }
.conn-pill.off::before { animation: blink 1s infinite; box-shadow: 0 0 0 3px rgba(192, 40, 45, .2); }
@keyframes blink { 50% { opacity: .3; } }

/* 卡片與統計 */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { font-size: 13px; color: var(--ink-3); margin: 0 0 8px; letter-spacing: .02em; }
.stat { padding: 18px 20px; }
.stat .k { font-size: 15px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.stat .v { font-size: 34px; font-weight: 500; letter-spacing: .01em; margin: 6px 0 2px; line-height: 1.2; }
.stat .v small { font-size: 16px; color: var(--ink-2); margin-left: 4px; font-weight: 400; }
.stat .s { font-size: 13px; color: var(--ink-3); }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fff; }
.tbl td { padding: 14px; border-bottom: 1px solid #f0f0f2; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: #fcf7f8; }

/* 輸入框 */
.input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 18px; outline: none; }
.input:focus { border-color: var(--bot-red); box-shadow: 0 0 0 3px rgba(154, 0, 54, .12); }
.input.code { font-family: var(--mono); letter-spacing: .25em; text-align: center; font-size: 24px; }

/* 對話框 */
.modal-mask { position: fixed; inset: 0; z-index: 80; background: rgba(30, 30, 30, .45); display: grid; place-items: center; padding: 16px; animation: fade .18s; }
.modal { width: min(420px, 100%); background: #fff; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-b { padding: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 0 18px 18px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg-3); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sim-note { font-size: 12px; color: var(--ink-3); }
