/* =========================================================================
   WAJIMALL 雛形 — 共用設計系統
   調性：清新綠藍（teal → water-blue）、明亮、留白、接近成品
   所有介面（顧客 / 營運台 / 後台 / 司機）共用此檔，請勿各自發明樣式。
   ========================================================================= */

/* ---- Google Fonts (Noto Sans TC) ---- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

/* =========================== 1. Design tokens =========================== */
:root {
  /* 品牌：綠藍 */
  --brand:        #0FB5A6;
  --brand-600:    #0C9488;
  --brand-700:    #0A7A70;
  --brand-100:    #CFF5EF;
  --brand-50:     #E8FBF8;
  --water:        #2FA8E8;
  --water-50:     #E8F5FD;
  --grad-brand:   linear-gradient(135deg, #16C6B3 0%, #2FA8E8 100%);
  --grad-brand-soft: linear-gradient(135deg, #E9FBF8 0%, #E8F5FD 100%);

  /* 中性（冷調 slate） */
  --ink-900: #0E1B24;
  --ink-700: #33454F;
  --ink-500: #5F7280;
  --ink-400: #69767F;
  --ink-300: #B7C3CB;
  --line:    #E4EBEE;
  --line-2:  #EEF3F4;
  --bg:      #F3F7F7;
  --surface: #FFFFFF;
  --surface-2: #FAFCFC;

  /* 語意 */
  --success: #18A957;  --success-bg: #E6F7EE;
  --warning: #F0A21B;  --warning-bg: #FDF3E0;
  --danger:  #E8523F;  --danger-bg:  #FCE9E6;
  --info:    #2FA8E8;  --info-bg:    #E8F5FD;
  --violet:  #8B5CF6;  --violet-bg:  #F0EBFE;

  /* 半徑 / 陰影 */
  --r-xs: 6px; --r-sm: 9px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --pill: 999px;
  --sh-1: 0 1px 2px rgba(16,40,50,.05), 0 1px 3px rgba(16,40,50,.06);
  --sh-2: 0 4px 14px rgba(16,40,50,.08);
  --sh-3: 0 12px 30px rgba(16,40,50,.12);
  --sh-brand: 0 8px 22px rgba(15,181,166,.30);

  /* 字級（rem：跟隨使用者瀏覽器字級設定，預設 16px 下視覺不變） */
  --fs-xs: .6875rem; --fs-sm: .78125rem; --fs: .875rem; --fs-md: .9375rem;
  --fs-lg: 1.0625rem; --fs-xl: 1.25rem; --fs-2xl: 1.5rem; --fs-3xl: 1.875rem;
}

/* =========================== 2. Reset / base =========================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Noto Sans TC', -apple-system, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink-900);
  background: var(--bg);
  font-size: var(--fs);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; max-width: 100%; }
input, select, textarea { font-family: inherit; font-size: var(--fs); }
ul { list-style: none; }
/* 描線屬性套用到所有 icon 變體，避免漏寫基底 .icon（只寫 icon-sm/lg/xs）時圖示變空白框 */
.icon, .icon-sm, .icon-lg, .icon-xs {
  stroke: currentColor; fill: none; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon { width: 22px; height: 22px; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 28px; height: 28px; }

/* =========================== 3. 文字工具 =========================== */
.t-3xl { font-size: var(--fs-3xl); font-weight: 900; letter-spacing: -.5px; }
.t-2xl { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.3px; }
.t-xl  { font-size: var(--fs-xl);  font-weight: 800; }
.t-lg  { font-size: var(--fs-lg);  font-weight: 700; }
.t-md  { font-size: var(--fs-md);  font-weight: 600; }
.t-sm  { font-size: var(--fs-sm); }
.t-xs  { font-size: var(--fs-xs); }
.muted { color: var(--ink-500); }
.muted-2 { color: var(--ink-400); }
.bold  { font-weight: 700; }
.tnum  { font-variant-numeric: tabular-nums; }
.brand-text { color: var(--brand-600); }
.center { text-align: center; }
.right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================== 4. Layout 工具 =========================== */
.row { display: flex; align-items: center; }
.row-top { display: flex; align-items: flex-start; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center-x { justify-content: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.gap-2 { gap: 2px; } .gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-14 { gap: 14px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.mt-2{margin-top:2px}.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}
.mt-20{margin-top:20px}.mt-24{margin-top:24px}.mt-32{margin-top:32px}
.mb-4{margin-bottom:4px}.mb-6{margin-bottom:6px}.mb-8{margin-bottom:8px}.mb-10{margin-bottom:10px}
.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-20{margin-bottom:20px}.mb-24{margin-bottom:24px}.mb-32{margin-bottom:32px}
.mr-6{margin-right:6px}.mr-8{margin-right:8px}.ml-auto{margin-left:auto}
.ink-900{color:var(--ink-900)}.ink-700{color:var(--ink-700)}
.p-16{padding:16px}.p-20{padding:20px}.p-24{padding:24px}

/* =========================== 5. 按鈕 =========================== */
/* 基底：.btn 及各變體單獨使用時都自帶按鈕版型（避免漏寫 .btn 造成擠壓）。
   含只寫修飾詞（btn-sm/btn-lg/btn-block）卻漏基底 btn 的情況，一律補上版型。 */
.btn, .btn-outline, .btn-grad, .btn-ghost, .btn-danger,
[class*="btn-sm"], [class*="btn-lg"], [class*="btn-block"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--r); cursor: pointer;
  font-size: var(--fs-md); font-weight: 700; color: #fff;
  background: var(--brand); transition: .16s ease; white-space: nowrap;
}
/* btn-icon 不該被上面的 [class*="btn-..."] 影響，維持其方形版型 */
.btn-icon { width: 40px; height: 40px; padding: 0; gap: 0; background: var(--surface-2); color: var(--ink-700); }
.btn:hover { background: var(--brand-600); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-grad { background: var(--grad-brand); box-shadow: var(--sh-brand); }
.btn-grad:hover { filter: brightness(1.04); background: var(--grad-brand); }
.btn-block { width: 100%; }
.btn-lg { height: 52px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn-sm { height: 36px; padding: 0 14px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-ghost { background: var(--brand-50); color: var(--brand-700); }
.btn-ghost:hover { background: var(--brand-100); }
.btn-outline { background: #fff; color: var(--ink-700); box-shadow: inset 0 0 0 1px var(--line); }
.btn-outline:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ink-300); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #d4402d; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center;
            width: 40px; height: 40px; padding: 0; border-radius: var(--r); color: var(--ink-700);
            background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.btn-icon:hover { background: var(--brand-50); color: var(--brand-600); }

/* =========================== 6. 卡片 =========================== */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
        border: 1px solid var(--line-2); }
/* 用作連結的卡片/容器：避免 <a> 預設 inline 造成背景框塌陷、內容溢出。
   :where() 零特異性，帶 .row/.col/.grid 的仍維持各自 display。 */
:where(a.card, a.banner, a.list, a.stat, a.note) { display: block; }
.card-pad { padding: 18px; }
.card-hover { transition: .18s ease; cursor: pointer; }
.card-hover:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: var(--brand-100); }
.section-title { font-size: var(--fs-lg); font-weight: 800; margin-bottom: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.link { color: var(--brand-600); font-weight: 600; font-size: var(--fs-sm); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* =========================== 7. Badge / Chip / Status =========================== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
         border-radius: var(--pill); font-size: var(--fs-xs); font-weight: 700;
         white-space: nowrap; flex: none; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-plain::before { display: none; }
.b-success { color: var(--success); background: var(--success-bg); }
.b-warning { color: #b9790a; background: var(--warning-bg); }
.b-danger  { color: var(--danger);  background: var(--danger-bg); }
.b-info    { color: #1681c4; background: var(--info-bg); }
.b-violet  { color: #6d3fe0; background: var(--violet-bg); }
.b-brand   { color: var(--brand-700); background: var(--brand-50); }
.b-gray    { color: var(--ink-500); background: #EEF2F3; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
        border-radius: var(--pill); font-size: var(--fs-sm); font-weight: 600;
        white-space: nowrap; flex: none;
        background: var(--surface); color: var(--ink-700); box-shadow: inset 0 0 0 1px var(--line); }
.chip .icon { width: 16px; height: 16px; flex: none; }
.chip-active { background: var(--brand); color: #fff; box-shadow: none; }
/* chip-tab：分頁式 chip（行為同 chip，.on/.active/.chip-active 為選中態） */
.chip-tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; white-space: nowrap; flex: none;
  border-radius: var(--pill); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink-700); box-shadow: inset 0 0 0 1px var(--line); }
.chip-tab .icon { width: 16px; height: 16px; flex: none; }
.chip-tab.on, .chip-tab.active, .chip-tab.chip-active { background: var(--brand); color: #fff; box-shadow: none; }

/* =========================== 8. 表單 =========================== */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-700); margin-bottom: 7px; }
.input, .select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface); color: var(--ink-900);
  border: 1.5px solid var(--line); transition: .15s; outline: none;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.input::placeholder { color: var(--ink-400); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; }
/* Fallback：表單欄位/抽屜內漏寫 class 的裸 input/select/textarea 自動套用標準樣式
   （排除搜尋框、stepper、checkbox/radio/file，避免誤傷）。 */
.field input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.input),
.field select:not(.select),
.field textarea:not(.input),
.modal-body input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.input),
.modal-body select:not(.select),
.modal-body textarea:not(.input) {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface); color: var(--ink-900);
  border: 1.5px solid var(--line); transition: .15s; outline: none; font-family: inherit; font-size: var(--fs); }
.field textarea:not(.input), .modal-body textarea:not(.input) { height: auto; min-height: 80px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-400); }
.input-icon .input { padding-left: 42px; }
.stepper { display: inline-flex; align-items: center; border-radius: var(--r); box-shadow: inset 0 0 0 1.5px var(--line); overflow: hidden; }
.stepper button { width: 40px; height: 44px; color: var(--brand-600); font-size: 20px; font-weight: 700; }
.stepper button:hover { background: var(--brand-50); }
/* 提高特異性，確保 stepper/searchbar 內的 input 不被表單 fallback 規則波及 */
.stepper input, .field .stepper input, .modal-body .stepper input { width: 48px; height: 44px; text-align: center; border: none; font-weight: 700; padding: 0; background: none; }
.searchbar input, .field .searchbar input { height: auto; border: none; padding: 0; background: none; }

/* =========================== 9. List =========================== */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; border: 1px solid var(--line-2); }
.li { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); transition: .12s; }
.li:last-child { border-bottom: none; }
.li-click { cursor: pointer; }
.li-click:hover { background: var(--surface-2); }
.li-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
         background: var(--brand-50); color: var(--brand-600); flex: none; }
.li-main { flex: 1; min-width: 0; }
.li-chev { color: var(--ink-300); }

/* =========================== 10. Avatar =========================== */
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
          background: var(--grad-brand); color: #fff; font-weight: 700; flex: none; }
.avatar-lg { width: 64px; height: 64px; font-size: var(--fs-xl); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--fs-sm); }

/* =========================== 11. 統計卡 / 圖表占位 =========================== */
.stat { background: var(--surface); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--sh-1); border: 1px solid var(--line-2); }
.stat-label { font-size: var(--fs-sm); color: var(--ink-500); display: flex; align-items: center; gap: 6px; }
.stat-num { font-size: var(--fs-2xl); font-weight: 900; margin-top: 6px; letter-spacing: -.5px; }
.stat-delta { font-size: var(--fs-xs); font-weight: 700; }
.up { color: var(--success); } .down { color: var(--danger); }
/* 相容別名（僅保留仍被頁面使用者：14px 小圖示、水平比較條、分段膠囊、序號徽章、統計圖示） */
.icon-xs { width: 14px; height: 14px; }
.hbar-track { flex: 1; height: 10px; border-radius: var(--pill); background: #EEF3F4; overflow: hidden; }
.hbar-track > i, .hbar-track > span { display: block; height: 100%; border-radius: var(--pill); background: var(--grad-brand); }
.seg-item { padding: 7px 16px; border-radius: var(--pill); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-500); white-space: nowrap; flex: none; }
.seg-item.on, .seg-item.active { background: #fff; color: var(--brand-700); box-shadow: var(--sh-1); }
.num-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--pill);
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; }
.stat-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
/* 長條圖：格線 + 基準軸 + 飽和漸層 + hover 數值 */
.chart { position: relative; height: 200px; display: flex; align-items: flex-end; gap: 12px;
  padding: 24px 6px 0; border-bottom: 1.5px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 1px), var(--line-2) calc(25% - 1px), var(--line-2) 25%); }
.bar { position: relative; flex: 1; min-width: 0; min-height: 6px; border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #16C6B3 0%, #2FC9B6 55%, #7DE6D8 100%);
  box-shadow: 0 2px 9px rgba(15,181,166,.22); transition: .18s ease; }
.bar:hover { filter: brightness(1.05); transform: translateY(-2px); }
.bar.alt { background: linear-gradient(180deg, #C2EFE9, #E3F7F3); box-shadow: none; }
.bar.hl { background: linear-gradient(180deg, #16C6B3, #2FA8E8); box-shadow: 0 5px 16px rgba(47,168,232,.32); }
.bar[data-v]::before { content: attr(data-v); position: absolute; top: -8px; left: 50%;
  transform: translate(-50%, -100%) scale(.92); background: var(--ink-900); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 7px; white-space: nowrap;
  opacity: 0; transition: .15s; pointer-events: none; z-index: 6; }
.bar[data-v]:hover::before { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.chart.show-values { padding-top: 34px; }
.chart.show-values .bar[data-v]::after { content: attr(data-v); position: absolute; top: -7px;
  left: 50%; transform: translate(-50%, -100%); font-size: 11px; font-weight: 800; color: var(--ink-700); white-space: nowrap; }
.chart-x { display: flex; gap: 12px; padding: 9px 6px 0; }
.chart-x span { flex: 1; text-align: center; font-size: var(--fs-xs); color: var(--ink-400); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--ink-700); }
.legend i.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.spark { height: 56px; width: 100%; display: block; }
/* 甜甜圈：陰影 + 中心字 */
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; display: grid; place-items: center;
  background: conic-gradient(var(--brand) 0 62%, var(--water) 62% 84%, #E4EBEE 84% 100%);
  filter: drop-shadow(0 8px 16px rgba(16,40,50,.10)); }
.donut::after { content: ''; width: 96px; height: 96px; border-radius: 50%; background: #fff; box-shadow: inset 0 1px 5px rgba(16,40,50,.05); }
.donut-c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; z-index: 2; line-height: 1.2; }
/* 水平條形比較圖（排行/佔比） */
.hbar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.hbar-row .lbl { width: 84px; flex: none; font-size: var(--fs-sm); color: var(--ink-700); }
.hbar { flex: 1; height: 10px; border-radius: var(--pill); background: #EEF3F4; overflow: hidden; }
.hbar > i { display: block; height: 100%; border-radius: var(--pill); background: var(--grad-brand); }
.hbar-row .val { width: 64px; flex: none; text-align: right; font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }

/* =========================== 12. 表格（後台） =========================== */
.table-wrap { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: 1px solid var(--line-2); overflow: hidden; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs); }
.tbl thead th { text-align: left; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-500);
                padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .right { text-align: right; }

/* =========================== 13. Timeline（訂單狀態） =========================== */
.timeline { position: relative; padding-left: 8px; }
.tl-item { position: relative; padding: 0 0 22px 28px; }
.tl-item::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: -4px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%;
          background: #fff; box-shadow: 0 0 0 2px var(--ink-300); }
.tl-item.done .tl-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.tl-item.done::before { background: var(--brand); }
.tl-item.active .tl-dot { background: var(--water); box-shadow: 0 0 0 4px var(--water-50); }

/* =========================== 14. Segmented tabs =========================== */
.seg { display: inline-flex; background: #EAF0F1; border-radius: var(--pill); padding: 4px; gap: 2px; }
.seg button { padding: 7px 16px; border-radius: var(--pill); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-500); white-space: nowrap; flex: none; }
.seg button.on { background: #fff; color: var(--brand-700); box-shadow: var(--sh-1); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 12px 4px; margin-right: 18px; font-weight: 600; color: var(--ink-500); border-bottom: 2.5px solid transparent; }
.tabs a.on { color: var(--brand-700); border-bottom-color: var(--brand); }

/* =========================== 15. Empty / Map placeholder =========================== */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-400); }
.empty .icon { width: 56px; height: 56px; margin: 0 auto 14px; color: var(--ink-300); }
.map { position: relative; border-radius: var(--r-lg); overflow: hidden; min-height: 200px;
       background:
         linear-gradient(rgba(47,168,232,.04), rgba(15,181,166,.06)),
         repeating-linear-gradient(0deg, #E8EFF0 0 1px, transparent 1px 28px),
         repeating-linear-gradient(90deg, #E8EFF0 0 1px, transparent 1px 28px),
         #F0F6F6; }
.map-pin { position: absolute; width: 30px; height: 30px; border-radius: 50% 50% 50% 2px;
           transform: rotate(45deg); background: var(--grad-brand); box-shadow: var(--sh-2); }
.map-pin span { transform: rotate(-45deg); display: block; color: #fff; font-weight: 800; text-align: center; line-height: 30px; }
.map-route { position: absolute; height: 3px; background: repeating-linear-gradient(90deg, var(--water) 0 9px, transparent 9px 16px); }
/* 相容別名：.route（SVG 路線，鋪滿地圖）、.pin（地圖標點，誤用名） */
svg.route { position: absolute; inset: 0; width: 100%; height: 100%; }
.map .pin { position: absolute; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 50% 50% 50% 2px;
  transform: translate(-50%, -100%); background: var(--grad-brand); color: #fff; font-weight: 800; font-size: 12px;
  display: grid; place-items: center; box-shadow: var(--sh-2); }
.map .pin .icon, .map .pin svg { color: #fff; }

/* =========================== 16. 裝置外框（index 預覽用） =========================== */
.device-phone { width: 300px; height: 620px; border-radius: 42px; background: #0E1B24; padding: 11px;
                box-shadow: var(--sh-3); flex: none; position: relative; }
.device-phone .screen { width: 100%; height: 100%; border-radius: 32px; overflow: hidden; background: var(--bg); position: relative; }
.device-phone .notch { position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
                       width: 120px; height: 26px; background: #0E1B24; border-radius: 0 0 16px 16px; z-index: 20; }
.device-tablet { width: 520px; height: 700px; border-radius: 34px; background: #0E1B24; padding: 14px; box-shadow: var(--sh-3); flex: none; }
.device-tablet .screen { width: 100%; height: 100%; border-radius: 22px; overflow: hidden; background: var(--bg); }
.device-browser { width: 100%; max-width: 1100px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-3); background: #fff; }
.device-browser .chrome { height: 42px; background: #EAF0F1; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.device-browser .dot { width: 11px; height: 11px; border-radius: 50%; }
.device-browser .url { flex: 1; height: 26px; background: #fff; border-radius: var(--pill); margin-left: 8px; font-size: var(--fs-xs); color: var(--ink-400); display: flex; align-items: center; padding: 0 14px; }

/* =========================== 17. App shell — 手機 =========================== */
/* 手機頁面獨立開啟時，置中顯示在手機尺寸的框裡（像真手機）；
   在 index 的 iframe（寬=框寬）裡則撐滿、看不到舞台背景。 */
body:has(> .phone-app) {
  min-height: 100vh;
  display: grid; place-items: center;
  background: radial-gradient(1100px 700px at 50% -15%, var(--brand-50), var(--bg) 60%);
}
.phone-app { display: flex; flex-direction: column; background: var(--bg);
  width: 412px; max-width: 100vw; height: min(896px, 100vh); overflow: hidden;
  border-radius: 38px; box-shadow: 0 40px 90px rgba(16,40,50,.22), 0 0 0 1px var(--line-2); position: relative; }
@media (max-width: 440px) { .phone-app { border-radius: 0; height: 100vh; box-shadow: none; } }
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
          background: var(--surface); border-bottom: 1px solid var(--line-2); flex: none; position: sticky; top: 0; z-index: 10; }
.topbar.brand { background: var(--grad-brand); color: #fff; border: none; }
.topbar .title { font-size: var(--fs-lg); font-weight: 800; }
.topbar .sp { flex: 1; }
.app-body { flex: 1; overflow-y: auto; padding: 16px; }
.app-body::-webkit-scrollbar { width: 0; }
.bottom-nav { flex: none; display: flex; background: var(--surface); border-top: 1px solid var(--line-2);
              padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
           color: var(--ink-400); font-size: 10.5px; font-weight: 600; }
.bn-item .icon { width: 23px; height: 23px; }
.bn-item.on { color: var(--brand-600); }
.bn-fab { margin-top: -28px; }
.bn-fab .icon { width: 30px; height: 30px; color: #fff; }
.bn-fab .fab { width: 56px; height: 56px; border-radius: 50%; background: var(--grad-brand);
               display: grid; place-items: center; box-shadow: var(--sh-brand); }

/* =========================== 18. App shell — 平板 / 後台（sidebar） =========================== */
.admin { display: flex; height: 100vh; background: var(--bg); }
.sidebar { width: 248px; flex: none; background: var(--surface); border-right: 1px solid var(--line-2);
           display: flex; flex-direction: column; height: 100%; }
.sidebar.compact { width: 220px; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.sb-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--grad-brand); display: grid; place-items: center; color: #fff; font-weight: 900; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.sb-group { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-400); letter-spacing: .04em;
            padding: 16px 12px 6px; text-transform: none; }
.sb-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r);
           color: var(--ink-700); font-weight: 600; font-size: var(--fs); margin-bottom: 2px; transition: .12s; }
.sb-item:hover { background: var(--surface-2); }
.sb-item.on { background: var(--brand-50); color: var(--brand-700); }
.sb-item.on .icon { color: var(--brand-600); }
.sb-item .icon { color: var(--ink-400); }
.sb-item .badge { margin-left: auto; }
.sb-foot { padding: 12px; border-top: 1px solid var(--line-2); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.main-top { height: 62px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 24px;
            background: var(--surface); border-bottom: 1px solid var(--line-2); }
.main-top .title { font-size: var(--fs-xl); font-weight: 800; }
.main-body { flex: 1; overflow-y: auto; padding: 24px; }
.searchbar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--pill);
             background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-400); min-width: 240px; }
.searchbar input { border: none; background: none; outline: none; flex: 1; color: var(--ink-900); }

/* 平板營運台：較大觸控 */
.ops .sb-item { padding: 13px 14px; font-size: var(--fs-md); }
.ops .main-body { padding: 20px; }

/* =========================== 19. 雜項 =========================== */
.pill-tab-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pill-tab-row::-webkit-scrollbar { height: 0; }
.banner { border-radius: var(--r-lg); padding: 18px 20px; color: #fff; background: var(--grad-brand); box-shadow: var(--sh-brand); }
.note { background: var(--info-bg); color: #1681c4; border-radius: var(--r); padding: 12px 14px; font-size: var(--fs-sm); display: flex; gap: 8px; }
.kbd-amt { font-variant-numeric: tabular-nums; font-weight: 900; }
.dot-line { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-300); }
.thumb { width: 64px; height: 64px; border-radius: var(--r); background: var(--grad-brand-soft);
         display: grid; place-items: center; color: var(--brand-600); flex: none; }
.thumb .icon { width: 32px; height: 32px; }
.progress { height: 7px; border-radius: var(--pill); background: #E7EEEF; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad-brand); border-radius: var(--pill); }
.fab-float { position: absolute; right: 18px; bottom: 84px; width: 54px; height: 54px; border-radius: 50%;
             background: var(--grad-brand); display: grid; place-items: center; box-shadow: var(--sh-brand); z-index: 9; }
.fab-float .icon { color: #fff; width: 26px; height: 26px; }

/* =========================== 20. Drawer（抽屜式 dialog，滑出） =========================== */
/* 桌機從右側滑入、手機從底部滑入。全站 .modal-backdrop/.modal 共用。 */
.modal-backdrop { position: fixed; inset: 0; z-index: 9998; display: flex; visibility: hidden; opacity: 0;
  justify-content: flex-end; align-items: stretch;
  background: rgba(14,27,36,.42); backdrop-filter: blur(3px); transition: opacity .25s ease, visibility .25s; }
.modal-backdrop.open { visibility: visible; opacity: 1; }
.modal { display: flex; flex-direction: column; width: 100%; max-width: 460px; height: 100%; max-height: 100%;
  background: var(--surface); box-shadow: -16px 0 48px rgba(14,27,36,.20);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.22,1,.36,1); overflow: hidden; }
.modal-backdrop.open .modal { transform: translateX(0); }
.modal-head { position: relative; flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--brand-50), var(--surface)); }
.modal-head .t { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.2px; }
.modal-head .btn-icon { background: #fff; box-shadow: var(--sh-1); }
.modal-head .btn-icon:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { flex: 1; overflow-y: auto; padding: 22px; }
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.modal-foot { flex: none; display: flex; gap: 12px; padding: 16px 22px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-2); background: var(--surface-2); }
.modal-foot .btn, .modal-foot .btn-outline, .modal-foot .btn-grad, .modal-foot .btn-danger { flex: 1; height: 48px; }
@media (max-width: 560px) {
  .modal-backdrop { justify-content: center; align-items: flex-end; }
  .modal { max-width: 100%; height: auto; max-height: 90vh; border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%); box-shadow: 0 -16px 48px rgba(14,27,36,.22); }
  .modal-backdrop.open .modal { transform: translateY(0); }
  .modal-head { border-radius: var(--r-xl) var(--r-xl) 0 0; padding-top: 26px; }
  .modal-head::before { content: ''; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: var(--pill); background: var(--ink-300); }
}
/* 手機框內 drawer：一律「底部滑入 + 限制在手機框內」，不依賴媒體查詢
   （手機框在桌機是 412px 寬的容器，視窗仍是寬的，故需用 .phone-app 後代選擇器強制覆寫） */
.phone-app .modal-backdrop { position: absolute; justify-content: center; align-items: flex-end; }
.phone-app .modal {
  width: 100%; max-width: 100%; height: auto; max-height: 88%;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  transform: translateY(100%); box-shadow: 0 -16px 48px rgba(14,27,36,.24); }
.phone-app .modal-backdrop.open .modal { transform: translateY(0); }
.phone-app .modal-head { border-radius: var(--r-xl) var(--r-xl) 0 0; padding-top: 26px; }
.phone-app .modal-head::before { content: ''; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: var(--pill); background: var(--ink-300); }
.wj-toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px);
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--pill);
  background: var(--ink-900); color: #fff; font-size: 13px; font-weight: 700; box-shadow: var(--sh-3);
  z-index: 99999; opacity: 0; transition: .22s ease; pointer-events: none; }
.wj-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.wj-toast svg { color: #2FE0C0; }

/* =========================== 21. Switch / 權限矩陣 =========================== */
.switch { position: relative; display: inline-flex; align-items: center; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 23px; border-radius: var(--pill); background: var(--ink-300);
  transition: .18s; position: relative; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16,40,50,.25); transition: .18s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:disabled + .track { opacity: .45; }
/* 權限編輯器：依模組分組的權限列 */
.perm-grp { border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.perm-grp > .hd { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-2);
  font-weight: 700; font-size: var(--fs-sm); border-bottom: 1px solid var(--line-2); }
.perm-grp > .hd .icon { color: var(--brand-600); }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
.perm-row:last-child { border-bottom: none; }
.perm-row .pm { flex: 1; min-width: 0; }
.perm-row code { font-size: var(--fs-xs); color: var(--ink-400); font-family: ui-monospace, monospace; }
/* 矩陣格子 */
.tbl .cell-full { color: var(--success); font-weight: 700; }
.tbl .cell-edit { color: var(--brand-600); font-weight: 700; }
.tbl .cell-view { color: #1681c4; font-weight: 600; }
.tbl .cell-no { color: var(--ink-300); }

/* =========================== 22. 無障礙 (a11y) =========================== */
/* 鍵盤焦點環：滑鼠點擊不顯示，Tab 鍵操作才顯示，全站互動元素一致 */
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; }
/* 表單欄位維持原本柔和的內環，避免雙重外框 */
.input:focus-visible, .select:focus-visible,
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.modal-body input:focus-visible, .modal-body select:focus-visible, .modal-body textarea:focus-visible,
.searchbar input:focus-visible { outline: none; }
/* switch 隱藏了原生 checkbox，焦點時在軌道上補環 */
.switch input:focus-visible + .track { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }

/* 停用狀態：按鈕漏寫時也有一致表現 */
.btn:disabled, .btn-outline:disabled, .btn-grad:disabled, .btn-ghost:disabled,
.btn-danger:disabled, .btn-icon:disabled, button:disabled, [aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

/* 尊重作業系統「減少動態效果」設定 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* =========================== 22. Carrier portal compatibility =========================== */
/* carrier/ pages used some self-invented class names & vars; map them to the design system. */
:root{
  --warn:#b9790a; --warn-bg:var(--warning-bg);
  --ok:var(--success); --ok-bg:var(--success-bg);
  --bad:var(--danger); --bad-bg:var(--danger-bg);
  --muted:var(--ink-400); --brand-l:var(--brand-50);
}
.stat-grid{ display:grid; gap:16px; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); margin-bottom:20px; }
.stat-card{ background:var(--surface); border:1px solid var(--line-2); border-radius:var(--r-lg); box-shadow:var(--sh-1);
  padding:16px 18px; display:flex; align-items:center; gap:13px; min-width:0; }
.kpi-row{ display:grid; gap:16px; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); margin-bottom:20px; }
.kpi-card{ background:var(--surface); border:1px solid var(--line-2); border-radius:var(--r-lg); box-shadow:var(--sh-1);
  padding:16px 18px; display:flex; flex-direction:column; gap:4px; min-width:0; }
.kpi-ic{ width:38px; height:38px; border-radius:11px; display:grid; place-items:center; margin-bottom:4px; }
.kpi-label{ font-size:var(--fs-sm); color:var(--ink-500); }
.kpi-value{ font-size:var(--fs-2xl); font-weight:900; letter-spacing:-.5px; }
.kpi-sub{ font-size:var(--fs-xs); color:var(--ink-400); font-weight:600; }
.card-head{ display:flex; align-items:center; gap:12px; padding:16px 18px; border-bottom:1px solid var(--line-2); }
.card-head .t{ font-size:var(--fs-lg); font-weight:800; }
.card-body{ padding:18px; }
.tbl-wrap{ background:var(--surface); border-radius:var(--r-lg); box-shadow:var(--sh-1); border:1px solid var(--line-2); overflow:hidden; }
table.table{ width:100%; border-collapse:collapse; font-size:var(--fs); }
.table thead th{ text-align:left; font-size:var(--fs-sm); font-weight:700; color:var(--ink-500); padding:13px 16px; background:var(--surface-2); border-bottom:1px solid var(--line); white-space:nowrap; }
.table tbody td{ padding:13px 16px; border-bottom:1px solid var(--line-2); }
.table tbody tr:last-child td{ border-bottom:none; }
.it{ display:flex; align-items:center; gap:13px; padding:13px 0; border-bottom:1px solid var(--line-2); }
.it:last-child{ border-bottom:none; }
.list-item{ display:flex; align-items:center; gap:13px; padding:13px 16px; border-bottom:1px solid var(--line-2); }
.list-item:last-child{ border-bottom:none; }
.nm{ font-weight:700; font-size:var(--fs); }
.ds{ font-size:var(--fs-xs); color:var(--ink-500); margin-top:2px; }
.ico{ width:40px; height:40px; border-radius:11px; display:grid; place-items:center; background:var(--brand-50); color:var(--brand-600); flex:none; }
.flex{ display:flex; }
.aic{ align-items:center; }
.jcb{ justify-content:space-between; }
.gap{ gap:8px; }
.pill{ display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 13px; white-space:nowrap; flex:none;
  border-radius:var(--pill); font-size:var(--fs-sm); font-weight:600; background:var(--surface); color:var(--ink-700); box-shadow:inset 0 0 0 1px var(--line); }
.pill.on,.pill-on{ background:var(--brand); color:#fff; box-shadow:none; }
.tag{ display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 10px; white-space:nowrap; flex:none;
  border-radius:var(--pill); font-size:var(--fs-xs); font-weight:700; background:#EEF2F3; color:var(--ink-500); }
.badge-amber{ color:#b9790a; background:var(--warning-bg); }
.badge-blue{ color:#1681c4; background:var(--info-bg); }
.badge-green{ color:var(--success); background:var(--success-bg); }
.badge-red{ color:var(--danger); background:var(--danger-bg); }
.badge-gray{ color:var(--ink-500); background:#EEF2F3; }
.ta-r{ text-align:right; }
.k{ font-size:var(--fs-sm); color:var(--ink-500); }
.v{ font-weight:700; font-variant-numeric:tabular-nums; }
.d{ color:var(--ink-400); }
.lab{ font-size:var(--fs-sm); color:var(--ink-500); }
.sub{ font-size:var(--fs-xs); color:var(--ink-400); }
.mb{ margin-bottom:16px; }
.logo{ display:grid; place-items:center; }
.breadcrumb{ display:flex; align-items:center; gap:6px; font-size:var(--fs-sm); color:var(--ink-500); margin-bottom:16px; }
.sb-sec{ font-size:var(--fs-xs); font-weight:700; color:var(--ink-400); padding:16px 12px 6px; }
.page-title{ font-size:var(--fs-xl); font-weight:800; letter-spacing:-.3px; }
.badge-ok{ color:var(--success); background:var(--success-bg); }
.badge-warn{ color:#b9790a; background:var(--warning-bg); }
.badge-bad{ color:var(--danger); background:var(--danger-bg); }
