/* 招募 CRM 的樣式：蘋果風格（簡單、清楚、易懂）
   ・顏色、圓角、動態都用下面的變數，深色模式只換變數
   ・動態只動 transform 與 opacity；使用者設定「減少動態」時只留淡入淡出 */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-hans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f2f2f7;
  --bg-elev: #ffffff;
  --bg-elev2: #f7f7fa;
  --bg-lane: rgba(118, 118, 128, 0.08);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.62);
  --label-3: rgba(60, 60, 67, 0.32);
  --sep: rgba(60, 60, 67, 0.16);
  --sep-strong: rgba(60, 60, 67, 0.28);

  --blue: #007aff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --teal: #30b0c7;
  --pink: #ff2d55;
  --indigo: #5856d6;
  --yellow: #ffcc00;
  --gray: #8e8e93;
  --brown: #a2845e;
  --accent: var(--blue);
  --on-accent: #ffffff;

  --material: rgba(249, 249, 251, 0.74);
  --material-side: rgba(236, 236, 241, 0.78);
  --scrim: rgba(0, 0, 0, 0.32);
  --shadow-card: 0 0.5px 1px rgba(0, 0, 0, 0.05), 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 18px 48px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-sheet: 0 24px 80px rgba(0, 0, 0, 0.28);
  --ring: 0 0 0 3.5px color-mix(in srgb, var(--accent) 28%, transparent);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* 近似「臨界阻尼彈簧」：一開始快、結尾慢慢停，不回彈 */
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast: 140ms;
  --t: 240ms;
  --t-slow: 380ms;

  --side-w: 248px;
  --top-h: 52px;
  --tab-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: #1c1c1e;
    --bg-elev2: #2c2c2e;
    --bg-lane: rgba(118, 118, 128, 0.14);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.34);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.62);
    --label-3: rgba(235, 235, 245, 0.32);
    --sep: rgba(84, 84, 88, 0.55);
    --sep-strong: rgba(84, 84, 88, 0.8);
    --blue: #0a84ff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --purple: #bf5af2;
    --teal: #40c8e0;
    --pink: #ff375f;
    --indigo: #5e5ce6;
    --yellow: #ffd60a;
    --gray: #98989d;
    --brown: #ac8e68;
    --material: rgba(22, 22, 24, 0.74);
    --material-side: rgba(28, 28, 30, 0.8);
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow-card: none;
    --shadow-float: 0 18px 48px rgba(0, 0, 0, 0.6);
    --shadow-sheet: 0 24px 80px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 12px); }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--label);
  font: 15px/1.47 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "palt" 0;
}
html:lang(zh-Hans) body { font-family: var(--font-hans); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; align-items: center; justify-content: center; }
.icon svg { width: 100%; height: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--label-2); }
.dim { color: var(--label-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.row-flex { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* ============ 外框：側邊欄、上方列、下方分頁列 ============ */
.app { min-height: 100vh; min-height: 100dvh; }
.app.booting { display: grid; place-items: center; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column;
  background: var(--material-side);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-right: 0.5px solid var(--sep);
  padding: calc(14px + env(safe-area-inset-top)) 10px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(160deg, #3b9cff, #0063d6); color: #fff; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.brand-mark .icon { width: 18px; height: 18px; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.env-pill { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }

.nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; margin: 0 -2px; padding: 0 2px; }
.nav-section { margin-bottom: 14px; }
.nav-section-title { font-size: 11.5px; font-weight: 600; color: var(--label-2); padding: 6px 10px 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--label); font-size: 14px; text-align: left; cursor: pointer; text-decoration: none !important;
  transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.nav-item .icon { color: var(--accent); width: 19px; height: 19px; }
.nav-item:hover { background: var(--fill); }
.nav-item:active { transform: scale(0.98); }
.nav-item[aria-current="page"] { background: var(--fill-2); font-weight: 600; }
.nav-badge { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; }
.nav-badge.soft { background: var(--fill-2); color: var(--label-2); }

.sidebar-foot { border-top: 0.5px solid var(--sep); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; color: var(--label); text-decoration: none !important; transition: background-color var(--t-fast) var(--ease); }
.me-chip:hover { background: var(--fill); }
.me-chip .who { min-width: 0; }
.me-chip .who b { display: block; font-size: 13.5px; font-weight: 600; }
.me-chip .who span { display: block; font-size: 12px; color: var(--label-2); }

.main { margin-left: var(--side-w); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  background: transparent;
  transition: background-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.topbar.scrolled {
  background: var(--material);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 0.5px 0 var(--sep);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-right { justify-content: flex-end; }
.topbar-title { font-weight: 600; font-size: 15px; opacity: 0; transform: translateY(4px); transition: opacity var(--t) var(--ease), transform var(--t) var(--spring); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw; }
.topbar.scrolled .topbar-title { opacity: 1; transform: none; }
.back-btn { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 8px 0 2px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); font-size: 15px; cursor: pointer; text-decoration: none !important; }
.back-btn .icon { width: 22px; height: 22px; }
.back-btn:hover { background: var(--fill); }
.back-btn:active { transform: scale(0.97); }

.view-host { position: relative; flex: 1; padding: 0 28px 48px; }
.page { max-width: 1120px; margin: 0 auto; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 4px 0 18px; }
.page-head .titles { flex: 1 1 260px; min-width: 0; }
.page-title { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.012em; }
.page-sub { margin-top: 4px; color: var(--label-2); font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabbar { display: none; }

/* 換頁：新的一頁從下方（或右邊、左邊）滑進來，舊的一頁淡出 */
.view { transition: opacity 260ms var(--ease), transform 340ms var(--spring); will-change: opacity, transform; }
.view.view-enter { opacity: 0; transform: translateY(10px); }
.view.view-enter.from-right { transform: translateX(32px); }
.view.view-enter.from-left { transform: translateX(-32px); }
.view.view-exit { opacity: 0; transition: opacity 150ms var(--ease); pointer-events: none; }

/* ============ 群組卡片與清單列（像 iOS 設定） ============ */
.card { background: var(--bg-elev); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card.pad { padding: 16px 18px; }
.section { margin-top: 26px; }
/* 只有對話框裡最上面那段不留間距；頁面裡被包在 div 裡的段落仍要和上一段分開 */
.sheet-body > .section:first-child, .sheet-body > :first-child > .section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; gap: 10px; padding: 0 4px 8px; }
.section-title { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.section-note { font-size: 13px; color: var(--label-2); }
.section-head .spacer + * { font-size: 14px; white-space: nowrap; }
.group-title { font-size: 13px; color: var(--label-2); padding: 0 16px 6px; margin-top: 22px; }
.group-title:first-child { margin-top: 0; }
.group-foot { font-size: 12.5px; color: var(--label-2); padding: 6px 16px 0; }
.group { background: var(--bg-elev); border-radius: var(--r); box-shadow: var(--shadow-card); overflow: hidden; }
.lrow {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 9px 16px;
  color: var(--label); text-decoration: none !important; background: transparent; width: 100%; border: 0; text-align: left;
}
.lrow + .lrow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--sep); }
.lrow.has-lead + .lrow::before, .lrow.has-lead + .lrow.has-lead::before { left: 60px; }
a.lrow, button.lrow, .lrow.tap { cursor: pointer; transition: background-color var(--t-fast) var(--ease); }
a.lrow:hover, button.lrow:hover, .lrow.tap:hover { background: color-mix(in srgb, var(--fill) 55%, transparent); }
a.lrow:active, button.lrow:active, .lrow.tap:active { background: var(--fill); }
.lrow .lead { flex: none; }
.lrow .body { flex: 1 1 auto; min-width: 0; }
.lrow .title { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .sub { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .trail { flex: none; display: flex; align-items: center; gap: 8px; color: var(--label-2); font-size: 14px; }
.lrow .chev { color: var(--label-3); width: 16px; height: 16px; }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 0; }
.kv > div { padding: 10px 16px; border-top: 0.5px solid var(--sep); min-width: 0; }
.kv > div:nth-child(-n+2) { border-top: 0; }
.kv .k { color: var(--label-2); font-size: 14px; }
.kv .v { font-size: 14.5px; word-break: break-word; }

/* ============ 按鈕 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 0; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 550; white-space: nowrap; text-decoration: none !important;
  background: var(--fill); color: var(--accent);
  transition: transform 90ms var(--ease), background-color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: scale(0.965); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.38; cursor: default; transform: none; filter: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-plain { background: transparent; }
.btn-plain:hover { background: var(--fill); filter: none; }
.btn-destructive { background: var(--red); color: #fff; }
.btn-tinted-red { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.btn-tinted-green { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.btn-gray { color: var(--label); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 16px; border-radius: 12px; font-weight: 600; }
.btn-block { width: 100%; }
.btn.busy { pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--label-2); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), transform 90ms var(--ease), color var(--t-fast);
}
.icon-btn .icon { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--fill); color: var(--label); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.accent { color: var(--accent); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ============ 表單 ============ */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--label-2); }
.field .hint { font-size: 12.5px; color: var(--label-2); }
.field.invalid .input, .field.invalid textarea, .field.invalid select { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent); }
.field .err { font-size: 12.5px; color: var(--red); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.req { color: var(--red); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--sep-strong); background: var(--bg-elev); color: var(--label);
  font-size: 15px; line-height: 1.35;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  -webkit-appearance: none; appearance: none;
}
.sheet .input, .sheet .select, .sheet .textarea { background-color: var(--bg-elev2); border-color: transparent; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.textarea { min-height: 96px; resize: vertical; }
.select { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input::placeholder, .textarea::placeholder { color: var(--label-3); }
.input.code-input { font-size: 26px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; height: 56px; padding-left: calc(12px + 0.4em); }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--label-2); width: 17px; height: 17px; pointer-events: none; }
.search .input { padding-left: 34px; background: var(--fill); border-color: transparent; }
.search .input:focus { background: var(--bg-elev); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14.5px; line-height: 1.4; }
.check input { margin: 2px 0 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* 開關（iOS 的 switch） */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--fill-2); transition: background-color var(--t) var(--ease); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18), 0 0 1px rgba(0,0,0,.2); transition: transform var(--t) var(--spring); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track .knob { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* 分段選擇（segmented control） */
.segmented { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; border-radius: 9px; background: var(--fill); isolation: isolate; max-width: 100%; }
.segmented-thumb { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: 7px; background: var(--bg-elev); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); z-index: -1; }
@media (prefers-color-scheme: dark) { .segmented-thumb { background: #636366; } }
.segmented.ready .segmented-thumb { transition: transform var(--t) var(--spring), width var(--t) var(--spring); }
.segmented-item { position: relative; border: 0; background: transparent; height: 28px; padding: 0 14px; border-radius: 7px; font-size: 13.5px; font-weight: 500; color: var(--label); cursor: pointer; white-space: nowrap; transition: opacity var(--t-fast); }
.segmented-item[aria-selected="true"] { font-weight: 600; }
.segmented-item:active { opacity: 0.6; }
.segmented.block { display: grid; width: 100%; }
.segmented.lg .segmented-item { height: 32px; font-size: 14px; }

/* ============ 標記：狀態、標籤、小圓點 ============ */
/* 顏色（.c-blue 等）放在檔案最後：要蓋過各元件自己的預設色 */
.badge {
  --c: var(--gray);
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: color-mix(in srgb, var(--c) 88%, var(--label));
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.badge.solid { background: var(--c); color: #fff; }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.badge.lg { height: 26px; padding: 0 10px; font-size: 13px; border-radius: 13px; }
.chip { --c: var(--gray); display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--fill); color: var(--label); font-size: 12.5px; white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chip button { border: 0; background: none; padding: 0; margin-right: -4px; color: var(--label-2); cursor: pointer; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; }
.chip button:hover { background: var(--fill-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dotc { --c: var(--gray); width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.tier { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--fill); color: var(--label-2); }
.tier.t-A { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.tier.t-B { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.flag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--orange); }
.flag.red { color: var(--red); }
.flag .icon { width: 14px; height: 14px; }

.avatar { --c: var(--blue); flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c)); user-select: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }

/* ============ 首頁 ============ */
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--bg-elev); box-shadow: var(--shadow-card); margin-bottom: 12px; }
.banner .icon { width: 22px; height: 22px; color: var(--c, var(--accent)); margin-top: 1px; }
.banner .b-body { flex: 1; min-width: 0; }
.banner .b-title { font-weight: 600; }
.banner .b-text { color: var(--label-2); font-size: 14px; margin-top: 2px; }
.banner.warn { --c: var(--orange); background: color-mix(in srgb, var(--orange) 10%, var(--bg-elev)); }
.banner.danger { --c: var(--red); background: color-mix(in srgb, var(--red) 9%, var(--bg-elev)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.tile {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 13px; min-height: 104px;
  border: 0; border-radius: var(--r-lg); background: var(--bg-elev); box-shadow: var(--shadow-card); color: var(--label);
  text-align: left; cursor: pointer; text-decoration: none !important;
  transition: transform 120ms var(--ease), box-shadow var(--t) var(--ease);
}
.tile:hover { box-shadow: var(--shadow-card), 0 6px 20px rgba(0,0,0,.06); }
.tile:active { transform: scale(0.975); }
.tile .t-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c); }
.tile .t-icon .icon { width: 17px; height: 17px; }
.tile .t-num { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; position: absolute; top: 15px; right: 16px; }
.tile .t-label { font-size: 14px; font-weight: 600; color: var(--label-2); margin-top: auto; }
.tile.zero .t-num { color: var(--label-3); }
.tile.zero .t-icon { background: var(--fill-2); color: var(--label-2); }

.meter { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--accent)); transform-origin: left; transition: transform 600ms var(--spring); }
.send-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.send-stat .num { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.send-stat .num small { font-size: 14px; color: var(--label-2); font-weight: 500; }

.funnel { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.funnel-row { display: grid; grid-template-columns: 76px 1fr 92px; align-items: center; gap: 12px; font-size: 14px; }
.funnel-bar { height: 26px; border-radius: 7px; background: var(--fill); overflow: hidden; }
.funnel-bar > i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 85%, #fff), var(--c)); transform-origin: left; transition: transform 700ms var(--spring); min-width: 2px; }
.funnel-num { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-num b { font-weight: 650; }
.funnel-num span { color: var(--label-2); font-size: 12.5px; margin-left: 6px; }

/* ============ 名單表格 ============ */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 240px; max-width: 420px; }
.toolbar-chips { display: contents; }
.filter-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; border: 0; background: var(--fill); color: var(--label); font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background-color var(--t-fast), transform 90ms; }
.filter-btn .icon { width: 15px; height: 15px; color: var(--label-2); }
.filter-btn:active { transform: scale(0.97); }
.filter-btn.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); font-weight: 600; }
.filter-btn.on .icon { color: var(--accent); }
.table-wrap { background: var(--bg-elev); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: 12px; font-weight: 600; color: var(--label-2); padding: 10px 12px; background: var(--bg-elev); border-bottom: 0.5px solid var(--sep); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 0.5px solid var(--sep); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.table tbody tr.tap { cursor: pointer; }
.table tbody tr.tap:hover { background: color-mix(in srgb, var(--fill) 50%, transparent); }
.table tbody tr.selected { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.table .cb { width: 36px; padding-right: 0; }
.table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.name-cell .nm { font-weight: 600; }
.name-cell .hd { font-size: 12.5px; color: var(--label-2); }
.num { font-variant-numeric: tabular-nums; }
.list-cards { display: none; }
.more-row { display: flex; justify-content: center; padding: 16px; }
.bulkbar {
  position: fixed; left: 50%; bottom: 22px; z-index: 40; transform: translate(-50%, 140%); opacity: 0;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 16px;
  background: var(--material); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-float); transition: transform var(--t-slow) var(--spring), opacity var(--t) var(--ease);
  margin-left: calc(var(--side-w) / 2);
}
.bulkbar.show { transform: translate(-50%, 0); opacity: 1; }
.bulkbar .count { font-weight: 600; margin-right: 6px; white-space: nowrap; }

/* ============ 看板 ============ */
.board-wrap { margin: 0 -28px; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding: 4px 28px 24px; scroll-padding: 0 28px; overscroll-behavior-x: contain; }
.col { flex: 0 0 276px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); border-radius: var(--r-lg); background: var(--bg-lane); transition: opacity var(--t) var(--ease), box-shadow var(--t) var(--ease), background-color var(--t) var(--ease), transform var(--t) var(--spring); position: relative; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 650; font-size: 14px; }
.col-head .count { color: var(--label-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.col-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 12px; overflow-y: auto; min-height: 60px; overscroll-behavior: contain; }
.col-empty { padding: 18px 8px; text-align: center; color: var(--label-3); font-size: 13px; }
.col .reason { display: none; position: absolute; left: 10px; right: 10px; top: 44px; z-index: 2; padding: 10px 12px; border-radius: 10px; background: var(--material); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--shadow-card); font-size: 13px; color: var(--label); }
.board.dragging .col.drop-no { opacity: 0.45; }
.board.dragging .col.drop-no .reason { display: block; }
.board.dragging .col.drop-ok { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.board.dragging .col.drop-ok.hover { background: color-mix(in srgb, var(--accent) 12%, var(--bg-lane)); box-shadow: inset 0 0 0 2px var(--accent); }
.board.dragging .col.drop-self { opacity: 0.7; }
.board.dragging .col.loading .col-head::after { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--label-3); border-right-color: transparent; animation: spin .7s linear infinite; margin-left: auto; }
.bcard {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px;
  background: var(--bg-elev); box-shadow: var(--shadow-card), 0 0 0 0.5px var(--sep); cursor: grab; text-decoration: none !important; color: var(--label);
  transition: transform 120ms var(--ease), box-shadow var(--t) var(--ease), opacity var(--t) var(--ease);
  touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.bcard:hover { box-shadow: var(--shadow-card), 0 0 0 0.5px var(--sep-strong), 0 4px 14px rgba(0,0,0,.06); }
.bcard:active { transform: scale(0.985); }
.bcard .top { display: flex; align-items: center; gap: 8px; }
.bcard .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard .hd { font-size: 12.5px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--label-2); }
.bcard .meta .icon { width: 14px; height: 14px; }
.bcard.origin { opacity: 0.32; transform: scale(0.98); }
.bcard.ghost { position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none; cursor: grabbing; box-shadow: var(--shadow-float); transition: none; will-change: transform; }
.bcard.ghost.settle { transition: transform 320ms var(--spring), opacity 200ms var(--ease) 140ms; }
.bcard.flash { animation: flash 900ms var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: var(--shadow-card), 0 0 0 0.5px var(--sep); } }
.ended-zones { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 12px; }
.ended-zone { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--bg-elev); box-shadow: var(--shadow-card), 0 0 0 0.5px var(--sep); font-size: 14px; font-weight: 600; cursor: pointer; border: 0; color: var(--label); width: 100%; text-align: left; position: relative; transition: transform 120ms var(--ease), opacity var(--t), box-shadow var(--t); }
.ended-zone .count { margin-left: auto; color: var(--label-2); font-weight: 500; }
.ended-zone:active { transform: scale(0.98); }
.board.dragging .ended-zone.drop-no { opacity: 0.45; }
.board.dragging .ended-zone.drop-ok { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.board.dragging .ended-zone.drop-ok.hover { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-elev)); }
.ended-zone .zreason { display: none; position: absolute; left: 8px; right: 8px; top: calc(100% + 4px); z-index: 3; font-weight: 400; font-size: 12.5px; padding: 8px 10px; border-radius: 9px; background: var(--material); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--shadow-card); }
.board.dragging .ended-zone.drop-no.hover .zreason { display: block; }
.col.ended { flex-basis: 236px; }
.col.ended.expanded { flex-basis: 276px; }

/* ============ 創作者詳情 ============ */
.hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 6px 0 16px; }
.hero .who { flex: 1 1 260px; min-width: 0; }
.hero .nm { font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -0.012em; word-break: break-word; }
.hero .hd { color: var(--label-2); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs-bar { margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-panel { animation: rise 280ms var(--spring); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.acct-card { padding: 14px 16px; }
.acct-card + .acct-card { margin-top: 10px; }
.acct-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct-head .plat { font-size: 12px; font-weight: 600; color: var(--label-2); background: var(--fill); padding: 2px 8px; border-radius: 6px; }
.stats { display: flex; gap: 22px; margin-top: 10px; flex-wrap: wrap; }
.stats div b { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stats div span { font-size: 12.5px; color: var(--label-2); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bars .bar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bars .bar .meter { height: 8px; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: var(--sep); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); }
.tl-dot i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--gray)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--gray)) 22%, transparent); }
.tl-card { padding: 12px 14px; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--label-2); }
.tl-head .who { color: var(--label); font-weight: 600; }
.tl-subject { font-weight: 600; margin-top: 6px; }
.tl-body { margin-top: 6px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.tl-body.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tl-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.transition-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.transition-line .icon { width: 15px; height: 15px; color: var(--label-3); }

.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 0; background: var(--bg-elev2); color: var(--label); text-align: left; cursor: pointer; width: 100%; transition: transform 100ms var(--ease), background-color var(--t-fast); }
.action-opt:hover { background: var(--fill); }
.action-opt:active { transform: scale(0.985); }
.action-opt[aria-disabled="true"] { cursor: default; opacity: 0.55; }
.action-opt[aria-disabled="true"]:active { transform: none; }
.action-opt .why { font-size: 12.5px; color: var(--label-2); margin-top: 2px; }
.action-opt .icon { width: 18px; height: 18px; color: var(--label-3); margin-left: auto; }

.checklist { display: flex; flex-direction: column; gap: 6px; }
.ck { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.ck .icon { width: 17px; height: 17px; margin-top: 1px; }
.ck.ok .icon { color: var(--green); }
.ck.no .icon { color: var(--red); }
.ck .ck-detail { color: var(--label-2); font-size: 12.5px; }
.guard-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }

/* ============ 外聯撰寫 ============ */
.composer { display: flex; flex-direction: column; gap: 14px; }
.to-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg-elev2); font-size: 14px; }
.to-line .icon { width: 18px; height: 18px; color: var(--label-2); }
.composer .textarea.body { min-height: 220px; font-size: 15px; line-height: 1.55; }
.leftover { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--orange); }
.leftover button { border: 0; border-radius: 8px; padding: 2px 8px; background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); cursor: pointer; font-size: 13px; }
.save-state { font-size: 12.5px; color: var(--label-2); display: inline-flex; align-items: center; gap: 5px; }
.channel-pick { display: flex; flex-direction: column; gap: 8px; }
.channel-opt { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; background: var(--bg-elev2); cursor: pointer; border: 2px solid transparent; transition: border-color var(--t-fast), transform 100ms var(--ease); }
.channel-opt:active { transform: scale(0.99); }
.channel-opt.sel { border-color: var(--accent); }
.channel-opt.off { opacity: 0.5; cursor: default; }
.channel-opt input { position: absolute; opacity: 0; pointer-events: none; }
.channel-opt .icon { width: 20px; height: 20px; color: var(--accent); }
.channel-opt .v { font-weight: 550; word-break: break-all; }

/* ============ 外聯工作台（手機優先） ============ */
.wb-top { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.wb-stage { position: relative; max-width: 560px; margin: 0 auto; }
.wb-card { padding: 18px 18px 16px; touch-action: pan-y; will-change: transform; }
.wb-card.settle { transition: transform 360ms var(--spring), opacity 260ms var(--ease); }
.wb-card .who { display: flex; align-items: center; gap: 12px; }
.wb-card .nm { font-size: 21px; font-weight: 700; line-height: 1.2; }
.wb-card .bio { margin-top: 12px; font-size: 14.5px; color: var(--label); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.wb-card .sec { margin-top: 14px; }
.wb-card .sec-title { font-size: 12.5px; font-weight: 600; color: var(--label-2); margin-bottom: 6px; }
.wb-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.wb-count { font-size: 14px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.wb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.wb-actions .btn-lg { grid-column: 1 / -1; }

/* ============ 匯入 ============ */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px; padding: 24px; border-radius: var(--r-lg); border: 2px dashed var(--sep-strong); background: var(--bg-elev); text-align: center; cursor: pointer; transition: border-color var(--t), background-color var(--t), transform var(--t) var(--spring); }
.dropzone:hover { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev)); transform: scale(1.01); }
.dropzone .big { width: 44px; height: 44px; color: var(--accent); }
.dropzone .dz-title { font-weight: 650; font-size: 16px; }
.dropzone .dz-sub { color: var(--label-2); font-size: 13.5px; }
.sumgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.sum { --c: var(--gray); padding: 12px 14px; border-radius: 12px; background: var(--bg-elev); box-shadow: var(--shadow-card); }
.sum b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--c); line-height: 1.1; }
.sum span { font-size: 13px; color: var(--label-2); }
.stackbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--fill); margin-top: 12px; }
.stackbar i { display: block; height: 100%; background: var(--c); transition: flex-grow 600ms var(--spring); }
.progress { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 400ms var(--spring); }
.code { font-family: var(--mono); font-size: 12.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--fill); }
.code.err { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.code.warn { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.issue-msg { font-size: 13.5px; }
.issue-msg .m2 { color: var(--label-2); font-size: 12.5px; margin-top: 2px; }

/* ============ 模板 ============ */
.ph-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ph-chip { border: 0; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--fill); color: var(--label); font-size: 13px; cursor: pointer; transition: transform 90ms, background-color var(--t-fast); }
.ph-chip:hover { background: var(--fill-2); }
.ph-chip:active { transform: scale(0.96); }
.ph-chip.req { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); font-weight: 600; }
.tpl-preview { padding: 12px 14px; border-radius: 10px; background: var(--bg-elev2); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.tpl-preview mark { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); border-radius: 4px; padding: 0 2px; }
.tpl-preview mark.bad { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }

/* ============ 浮層：sheet、選單、提示 ============ */
.sheet-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t) var(--ease); }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: min(86vh, 860px); display: flex; flex-direction: column;
  background: var(--bg-elev); border-radius: var(--r-xl); box-shadow: var(--shadow-sheet);
  opacity: 0; transform: scale(0.94); transition: opacity 220ms var(--ease), transform 380ms var(--spring);
}
.sheet.sheet-lg { max-width: 720px; }
.sheet.sheet-sm { max-width: 420px; }
.sheet-root.open .sheet-scrim { opacity: 1; }
.sheet-root.open .sheet { opacity: 1; transform: none; }
.sheet-root.closing .sheet { transition: opacity 180ms var(--ease), transform 240ms var(--ease); }
.sheet-grabber { display: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px 8px; }
.sheet-head h2 { flex: 1; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.sheet-body { padding: 8px 18px 18px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 0.5px solid var(--sep); flex-wrap: wrap; }
.sheet-foot .left { margin-right: auto; }
.form-error { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); font-size: 13.5px; animation: rise 220ms var(--spring); }
.form-error ul { margin: 6px 0 0; padding-left: 18px; }
.note-box { padding: 12px 14px; border-radius: 10px; background: var(--bg-elev2); font-size: 14px; color: var(--label); }
.note-box.warn { background: color-mix(in srgb, var(--orange) 11%, transparent); }
.note-box.danger { background: color-mix(in srgb, var(--red) 9%, transparent); }
.secret-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-elev2); font-family: var(--mono); font-size: 13.5px; word-break: break-all; }
.secret-box span { flex: 1; min-width: 0; }

.menu-root { position: fixed; inset: 0; z-index: 110; }
.menu { position: fixed; min-width: 220px; max-width: 320px; padding: 6px; border-radius: 14px; background: var(--material); -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%); box-shadow: var(--shadow-float), 0 0 0 0.5px var(--sep); opacity: 0; transform: scale(0.92); transition: opacity 160ms var(--ease), transform 260ms var(--spring); }
.menu-root.open .menu { opacity: 1; transform: none; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--label); font-size: 14.5px; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--fill); }
.menu-item .icon { width: 18px; height: 18px; color: var(--label-2); margin-left: auto; }
.menu-item.danger { color: var(--red); }
.menu-item.danger .icon { color: var(--red); }
.menu-sep { height: 0.5px; background: var(--sep); margin: 5px 8px; }

.toast-host { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px 10px 12px; border-radius: 22px; background: var(--material); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--shadow-float), 0 0 0 0.5px var(--sep); font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(-14px) scale(0.96); transition: opacity 220ms var(--ease), transform 380ms var(--spring); pointer-events: auto; max-width: 100%; }
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-10px) scale(0.98); transition-duration: 200ms; }
.toast .icon { width: 19px; height: 19px; color: var(--accent); }
.toast.success .icon { color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast.warn .icon { color: var(--orange); }

/* ============ 空狀態、載入中 ============ */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 20px; color: var(--label-2); }
.empty > .icon { width: 40px; height: 40px; color: var(--label-3); }
.empty b { color: var(--label); font-size: 16px; font-weight: 600; }
.empty p { font-size: 14px; max-width: 360px; }
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 37%, var(--fill) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--label-3); border-right-color: transparent; animation: spin 0.75s linear infinite; }
.center-pad { display: grid; place-items: center; padding: 48px 0; }
.err-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; }
.err-state > .icon { width: 36px; height: 36px; color: var(--orange); }

/* ============ 登入 ============ */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 400px; padding: 30px 28px 26px; border-radius: 22px; background: var(--bg-elev); box-shadow: var(--shadow-card), 0 12px 40px rgba(0,0,0,.06); }
.auth-mark { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 14px; background: linear-gradient(160deg, #3b9cff, #0063d6); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 99, 214, 0.3); }
.auth-mark .icon { width: 30px; height: 30px; }
.auth h1 { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.auth .lead-text { text-align: center; color: var(--label-2); font-size: 14.5px; margin: 6px 0 22px; }
.auth .form { gap: 12px; }
.auth .btn-lg { margin-top: 6px; }
.auth-foot { margin-top: 18px; display: flex; justify-content: center; gap: 12px; font-size: 13px; color: var(--label-2); }
.auth-step { animation: rise 320ms var(--spring); }
.qr { width: 196px; height: 196px; margin: 4px auto 2px; padding: 10px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 0.5px var(--sep); }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.steps { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: s; font-size: 14px; }
.steps li { counter-increment: s; display: flex; gap: 10px; }
.steps li::before { content: counter(s); flex: none; width: 21px; height: 21px; border-radius: 50%; background: var(--fill); color: var(--label-2); font-size: 12px; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.lang-switch { display: flex; justify-content: center; margin-top: 16px; }

/* ============ 其他頁 ============ */
.more-grid .lrow .lead .icon { width: 30px; height: 30px; padding: 6px; border-radius: 8px; color: #fff; background: var(--c, var(--accent)); }
.audit-detail { font-family: var(--mono); font-size: 12px; color: var(--label-2); word-break: break-all; white-space: pre-wrap; margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--fill); }
.settings-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; position: relative; }
.settings-row + .settings-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--sep); }
.settings-row .s-text { flex: 1; min-width: 0; }
.settings-row .s-label { font-size: 15px; }
.settings-row .s-hint { font-size: 12.5px; color: var(--label-2); margin-top: 2px; }
.settings-row .s-ctl { flex: 0 0 auto; width: 200px; display: flex; justify-content: flex-end; }
.settings-row .s-ctl .input { text-align: right; }
.settings-row.tall { align-items: flex-start; flex-direction: column; }
.settings-row.tall .s-ctl { width: 100%; }
.settings-row.tall .s-ctl .input { text-align: left; }
.settings-row.changed .s-label::after { content: "●"; color: var(--accent); font-size: 9px; margin-left: 6px; vertical-align: 2px; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: center; gap: 8px; margin-top: 16px; pointer-events: none; }
.savebar > * { pointer-events: auto; }
.savebar .card { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; background: var(--material); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); box-shadow: var(--shadow-float); border-radius: 14px; transform: translateY(20px); opacity: 0; transition: transform var(--t-slow) var(--spring), opacity var(--t); }
.savebar.show .card { transform: none; opacity: 1; }
.invite-box { display: flex; flex-direction: column; gap: 10px; }

/* ============ 補充：登入頁不要外框、提示按鈕、雜項 ============ */
.app.bare .main { margin-left: 0; padding-bottom: 0; }
.app.bare .view-host { padding: 0; }
.btn.pulse { animation: pulse 1.4s var(--ease) 2; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); } }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.filter-chips .chip { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.filter-chips .chip button { color: var(--accent); }
.toggle-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rep-row { display: grid; grid-template-columns: 132px 1fr 32px; gap: 8px; align-items: start; }
.rep-row + .rep-row { margin-top: 8px; }
.rep-row .rep-extra { grid-column: 2 / 3; }
.rep-list { display: flex; flex-direction: column; }
.rep-add { align-self: flex-start; margin-top: 8px; }
.list-cards .lrow .lead input { width: 18px; height: 18px; accent-color: var(--accent); }
.stage-pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.mail-card { padding: 14px 16px; }
.mail-card .mail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mail-card .mail-from { font-weight: 600; word-break: break-all; }
.mail-card .mail-subject { margin-top: 4px; font-weight: 600; }
.mail-card .mail-body { margin-top: 6px; font-size: 14px; white-space: pre-wrap; word-break: break-word; color: var(--label); }
.mail-card .mail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pick-results { display: flex; flex-direction: column; margin-top: 10px; border-radius: var(--r); overflow: hidden; background: var(--bg-elev2); min-height: 46px; }
.pick-results .lrow.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.leave { transition: opacity 220ms var(--ease), transform 260ms var(--spring); opacity: 0; transform: translateX(16px); }
.wb-card .chips { margin-top: 12px; }
.wb-ch { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; }
.wb-ch .icon { width: 17px; height: 17px; color: var(--accent); }
.wb-ch.off { opacity: 0.5; }
.wb-ch .icon.off { color: var(--label-3); }
.done-check { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.done-check .icon { width: 34px; height: 34px; }
.session-row .sub { white-space: normal; }
.kv .v .link-btn { margin-left: 8px; font-size: 13.5px; }
.score { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--label-2); font-size: 13px; }
.bcard .meta .owner { display: inline-flex; align-items: center; gap: 4px; }
.bcard .meta .late { color: var(--red); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.col-more { display: flex; justify-content: center; padding: 4px 0 2px; }
.ended-tabs { padding: 0 10px 6px; }
.issue-table td.code-cell { white-space: nowrap; }
.preview-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tpl-row .sub .badge { margin-right: 4px; }
.notice-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c, var(--accent)); flex: none; }
.notice-ic .icon { width: 17px; height: 17px; }
.lrow.leaving { transition: opacity 220ms var(--ease), transform 280ms var(--spring); opacity: 0; transform: translateX(24px); }
.invite-url { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.help-list { margin: 0; padding-left: 18px; font-size: 14px; color: var(--label-2); display: flex; flex-direction: column; gap: 4px; }
time.late, .late { color: var(--red); }
.seg-scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.seg-scroll::-webkit-scrollbar { display: none; }
/* 在可以左右滑的外框裡，分段控制要跟內容一樣寬：不然底色停在外框寬度，滑過去的分頁會跑到底色外面 */
.tabs-bar > .segmented, .seg-scroll > .segmented { max-width: none; }

/* ============ 手機（窄螢幕） ============ */
@media (max-width: 759px) {
  :root { --top-h: 48px; }
  body { font-size: 16px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .view-host { padding: 0 16px 32px; }
  .page-title { font-size: 28px; }
  .page-head { padding-bottom: 14px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--material); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
    box-shadow: 0 -0.5px 0 var(--sep);
  }
  .tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--label-2); font-size: 10.5px; font-weight: 500; text-decoration: none !important; -webkit-tap-highlight-color: transparent; transition: color var(--t-fast); }
  .tab .icon { width: 24px; height: 24px; transition: transform 120ms var(--ease); }
  .tab:active .icon { transform: scale(0.88); }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); height: 16px; min-width: 16px; font-size: 10.5px; padding: 0 4px; }
  .input, .select, .textarea { font-size: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { min-height: 94px; padding: 12px 14px; }
  .tile .t-num { font-size: 24px; top: 13px; right: 14px; }
  .send-stat { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 64px 1fr 76px; gap: 8px; font-size: 13px; }
  .table-wrap.cards-on-phone { display: none; }
  .list-cards { display: block; }
  .bulkbar { bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); margin-left: 0; max-width: calc(100vw - 24px); overflow-x: auto; }
  .savebar { bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); }
  .toolbar .search { flex-basis: 100%; max-width: none; }
  .toolbar-chips { display: flex; gap: 8px; flex: 1 1 100%; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .toolbar-chips::-webkit-scrollbar { display: none; }
  /* 手機上說明放到標題下一行，「查看全部」才不會被擠成兩行 */
  .section-head { flex-wrap: wrap; row-gap: 2px; }
  .section-head .section-note { order: 3; flex-basis: 100%; }
  .board-wrap { margin: 0 -16px; }
  .board { padding: 4px 16px 18px; scroll-snap-type: x mandatory; gap: 10px; scroll-padding: 0 16px; }
  .col { flex-basis: 84vw; max-height: calc(100dvh - 230px); scroll-snap-align: start; }
  .col.ended { flex-basis: 84vw; }
  .sumgrid { grid-template-columns: repeat(3, 1fr); }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(-n+2) { border-top: 0.5px solid var(--sep); }
  .kv > div:first-child { border-top: 0; }
  .kv .k { padding-bottom: 0; font-size: 12.5px; }
  .kv .v { padding-top: 2px; border-top: 0 !important; }
  .settings-row { flex-wrap: wrap; }
  .settings-row .s-ctl { width: 100%; justify-content: stretch; }
  .settings-row .s-ctl .input { text-align: left; }
  .settings-row .s-ctl.compact { width: auto; }
  .bars .bar { grid-template-columns: 110px 1fr 36px; }
  .hero .nm { font-size: 24px; }
  /* 手機：四個動作排成一列，圖示在上、字在下（像「聯絡人」的按鈕） */
  .hero-actions { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .hero-actions .btn { flex-direction: column; height: auto; min-height: 58px; padding: 8px 4px; gap: 4px; font-size: 12px; border-radius: 12px; }
  .hero-actions .btn .icon { width: 20px; height: 20px; }
  .rep-row { grid-template-columns: 1fr 32px; }
  /* 下拉選單自己占一整行：項目外層是 display: contents（不產生格子），真正的格子是裡面的選單 */
  .rep-row > :first-child > :first-child { grid-column: 1 / -1; }
  .rep-row .rep-extra { grid-column: 1 / 2; }
  .page-actions .btn .lbl-wide { display: none; }

  /* 手機的 sheet 從下方滑上來，可以往下拉關掉 */
  .sheet-root { place-items: end stretch; padding: 0; padding-top: calc(env(safe-area-inset-top) + 24px); }
  .sheet, .sheet.sheet-lg, .sheet.sheet-sm { max-width: none; max-height: calc(100dvh - env(safe-area-inset-top) - 24px); border-radius: 14px 14px 0 0; opacity: 1; transform: translateY(105%); transition: transform 420ms var(--spring); }
  .sheet-root.open .sheet { transform: translateY(0); }
  .sheet-root.closing .sheet { transition: transform 300ms var(--ease); }
  .sheet-grabber { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 6px auto 0; flex: none; }
  .sheet-head { padding-top: 8px; touch-action: none; }
  .sheet-grabber { touch-action: none; }
  .sheet.dragging { transition: none !important; }
  .sheet-foot { justify-content: stretch; }
  .sheet-foot .btn { flex: 1 1 auto; height: 44px; font-size: 16px; }
  .sheet-foot .left { margin-right: 0; }
  .toast-host { top: calc(10px + env(safe-area-inset-top)); }
  .auth-card { padding: 26px 20px 22px; }
}
@media (min-width: 760px) and (max-width: 1080px) {
  :root { --side-w: 216px; }
  .sumgrid { grid-template-columns: repeat(3, 1fr); }
}

/* ============ 無障礙：減少動態、減少透明、提高對比 ============ */
@media (prefers-reduced-motion: reduce) {
  .view.view-enter, .view.view-enter.from-right, .view.view-enter.from-left { transform: none; }
  .view { transition: opacity 200ms ease; }
  .sheet, .sheet-root.open .sheet, .sheet-root.closing .sheet { transform: none !important; transition: opacity 200ms ease !important; }
  @media (max-width: 759px) { .sheet { opacity: 0; } .sheet-root.open .sheet { opacity: 1; } }
  .toast, .toast.in, .toast.out, .menu, .menu-root.open .menu { transform: none !important; }
  .tab-panel, .auth-step, .form-error { animation: none; }
  .bcard.ghost.settle, .wb-card.settle { transition: opacity 200ms ease; }
  .btn.pulse { animation: none; }
  .leave, .lrow.leaving { transform: none; }
  .segmented.ready .segmented-thumb, .switch .knob { transition: none; }
  .meter > i, .funnel-bar > i, .progress > i, .stackbar i { transition: none; }
  .skel { animation: none; }
  .btn:active, .tile:active, .bcard:active, .icon-btn:active, .nav-item:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --material: var(--bg-elev); --material-side: var(--bg); }
  .topbar.scrolled, .tabbar, .sidebar, .menu, .toast, .bulkbar { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --sep: rgba(60, 60, 67, 0.5); --label-2: rgba(60, 60, 67, 0.85); }
  .card, .group, .tile, .bcard, .table-wrap { box-shadow: 0 0 0 1px var(--sep-strong); }
}
@media print {
  .sidebar, .tabbar, .topbar, .bulkbar { display: none !important; }
  .main { margin: 0; }
}

/* ============ 顏色 ============ */
/* 一定要放在最後：.badge、.tile、.avatar、.chip、.dotc、.sum 都先設了自己的預設色（同樣的權重，後寫的贏） */
.c-blue { --c: var(--blue); } .c-green { --c: var(--green); } .c-orange { --c: var(--orange); } .c-red { --c: var(--red); }
.c-purple { --c: var(--purple); } .c-teal { --c: var(--teal); } .c-pink { --c: var(--pink); } .c-indigo { --c: var(--indigo); }
.c-yellow { --c: var(--yellow); } .c-gray { --c: var(--gray); } .c-brown { --c: var(--brown); }
