/* ============================================================
   客戶資料收集系統 — 商務 / AI 風格主題（明亮版）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* 品牌：靛藍 → 天藍 → 青（AI 科技感） */
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --brand-soft: #eaf1ff;
  --accent: #06b6d4;
  --indigo: #4f46e5;
  --grad: linear-gradient(135deg, #1d4ed8 0%, #3b6bf0 100%);
  --grad-soft: linear-gradient(120deg, #eef3ff 0%, #e7eefc 100%);

  /* 深夜藍 header + 金色點綴 */
  --ink-1: #0c1530;
  --ink-2: #15233f;
  --ink-3: #1d2f56;
  --gold: #e7b14a;
  --gold-2: #f6cf6a;

  --bg: #f4f7fd;
  --card: #ffffff;
  --border: #e6ebf3;
  --text: #1f2a3d;
  --muted: #7a869a;

  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  --radius: 16px;
  --shadow: 0 2px 14px rgba(31, 45, 80, 0.06);
  --shadow-lg: 0 10px 34px rgba(31, 45, 80, 0.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ───── App bar / nav（深夜藍 + 金色，含極光與光掃動畫）───── */
.appbar {
  position: sticky; top: 0; z-index: 100; color: #fff; overflow: hidden;
  background:
    radial-gradient(120% 160% at 10% -20%, rgba(231,177,74,0.18) 0%, rgba(231,177,74,0) 42%),
    radial-gradient(150% 180% at 100% 0%, rgba(59,107,240,0.30) 0%, rgba(59,107,240,0) 52%),
    linear-gradient(120deg, var(--ink-1) 0%, var(--ink-2) 55%, var(--ink-3) 100%);
  background-size: 200% 200%, 200% 200%, 100% 100%;
  animation: aurora 20s ease-in-out infinite;
  box-shadow: 0 8px 28px rgba(8, 15, 35, 0.32);
}
/* 緩慢光掃 */
.appbar::before {
  content: ""; position: absolute; top: 0; left: -45%; width: 38%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.10), transparent);
  transform: skewX(-18deg); pointer-events: none;
  animation: sweep 9s ease-in-out infinite;
}
@keyframes aurora {
  0%, 100% { background-position: 0% 50%, 100% 50%, 0 0; }
  50%      { background-position: 100% 50%, 0% 50%, 0 0; }
}
@keyframes sweep { 0% { left: -45%; } 60%, 100% { left: 135%; } }
@media (prefers-reduced-motion: reduce) { .appbar { animation: none; } .appbar::before { display: none; } }

.appbar-top {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; max-width: 1140px; margin: 0 auto; gap: 12px;
}
.appbar-title { font-size: 18px; font-weight: 800; letter-spacing: 0.3px; display: flex; align-items: center; gap: 11px; }
.appbar-title .mark {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 10px; font-size: 17px; background: linear-gradient(140deg, var(--gold-2), var(--gold));
  box-shadow: 0 4px 12px rgba(231,177,74,0.45);
}
.brand-ai {
  font-size: 11px; font-weight: 800; letter-spacing: 1.2px; color: #2a1d05;
  background: linear-gradient(140deg, var(--gold-2), var(--gold));
  padding: 3px 8px; border-radius: 6px; box-shadow: 0 2px 9px rgba(231,177,74,0.4);
}
.appbar-user { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.appbar-user img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); }
.appbar-user .role {
  font-size: 10px; padding: 2px 9px; border-radius: 20px; font-weight: 700;
  background: rgba(231,177,74,0.16); color: var(--gold-2); border: 1px solid rgba(231,177,74,0.38);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.btn-logout {
  background: rgba(255,255,255,0.10); color: #fff; border: 1px solid rgba(255,255,255,0.22);
  padding: 7px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.4); }

.nav-tabs {
  position: relative; z-index: 1;
  display: flex; gap: 2px; max-width: 1140px; margin: 0 auto; padding: 0 18px;
}
.nav-tabs a {
  position: relative; color: rgba(255,255,255,0.6); text-decoration: none;
  padding: 12px 18px 15px; font-size: 14.5px; font-weight: 600; letter-spacing: 0.4px; transition: color .2s;
}
.nav-tabs a::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 7px; height: 2.5px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transform: scaleX(0); transform-origin: center; transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.nav-tabs a:hover { color: #fff; }
.nav-tabs a:hover::after { transform: scaleX(0.45); }
.nav-tabs a.active { color: #fff; }
.nav-tabs a.active::after { transform: scaleX(1); }

.dev-banner {
  background: #fff7e6; color: #b45309; text-align: center;
  font-size: 12px; font-weight: 500; padding: 7px 12px; border-bottom: 1px solid #fde9c2;
}

/* ───── Layout ───── */
.container { max-width: 520px; margin: 0 auto; padding: 18px 16px; }
.container.wide { max-width: 1140px; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 22px;
  margin-bottom: 16px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card-title {
  font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 16px;
  display: flex; align-items: center; gap: 9px;
}
.card-title .icon { font-size: 19px; }
.ai-chip {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--indigo);
  background: var(--grad-soft); border: 1px solid #dbe3ff; padding: 3px 9px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 4px;
}

.muted { color: var(--muted); font-size: 13px; }
.notice {
  background: var(--grad-soft); color: var(--brand-ink); padding: 13px 15px;
  border-radius: 12px; font-size: 13px; margin-bottom: 16px; border: 1px solid #dbe6ff;
}
.notice.warn { background: #fff7e6; color: #b45309; border-color: #fde9c2; }
.notice.ok {
  background: linear-gradient(120deg, #fbf3df 0%, #fdf8ec 100%);
  color: #8a6113; border-color: #f0dca8;
}

/* ───── Forms ───── */
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }
.field-label { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.field-label .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--grad); color: #fff;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.req { font-size: 11px; font-weight: 700; color: var(--danger); background: #fee; padding: 2px 7px; border-radius: 6px; }
.opt { font-size: 11px; font-weight: 600; color: var(--muted); background: #f1f4f9; padding: 2px 7px; border-radius: 6px; }

.form-group input[type=text], .form-group input[type=tel], .form-group input[type=email],
.form-group input[type=date], .form-group select, .form-group textarea {
  width: 100%; padding: 13px 15px; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 12px; background: #fbfcfe;
  color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-group textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

.select-wrapper { position: relative; }
.select-wrapper::after {
  content: ""; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 7px solid var(--muted); pointer-events: none;
}

/* 分段選擇器（工廠 / 分級）— 大顆好點 */
.seg-group { display: grid; gap: 10px; }
.seg-group.cols-2 { grid-template-columns: repeat(2, 1fr); }
.seg-group.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg-item { position: relative; }
.seg-item input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.seg-item span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 15px 10px; border: 1.5px solid var(--border); border-radius: 12px;
  background: #fbfcfe; font-size: 16px; font-weight: 700; color: #5b6677; cursor: pointer; transition: all .15s;
  min-height: 52px;
}
.seg-item input:checked + span {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.seg-item input:focus-visible + span { box-shadow: 0 0 0 3px rgba(37,99,235,0.25); }
/* 分級色彩提示 */
.seg-item.g-a input:checked + span { border-color: var(--ok); background: #e9fbf3; color: #047857; box-shadow: 0 0 0 3px rgba(16,185,129,0.14); }
.seg-item.g-b input:checked + span { border-color: var(--warn); background: #fff7e6; color: #b45309; box-shadow: 0 0 0 3px rgba(245,158,11,0.16); }
.seg-item.g-c input:checked + span { border-color: var(--danger); background: #fdecec; color: #b91c1c; box-shadow: 0 0 0 3px rgba(239,68,68,0.14); }

/* 多選（AI 興趣）*/
.checkbox-group { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.checkbox-item {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border: 1.5px solid var(--border); border-radius: 12px; background: #fbfcfe;
  font-size: 15px; font-weight: 600; color: #5b6677; cursor: pointer; user-select: none; transition: all .15s;
}
.checkbox-item .emo { font-size: 19px; }
.checkbox-item input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; margin-left: auto; }
.checkbox-item:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px; border: none;
  font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; transition: transform .1s, box-shadow .15s, opacity .15s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(37,99,235,0.32); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(37,99,235,0.4); }
.btn-primary:active { transform: scale(0.99); }
.btn-lg { padding: 16px; font-size: 17px; border-radius: 14px; }
.btn-block { display: flex; width: 100%; }
.btn-outline { background: #fff; border: 1.5px solid var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-danger-outline { background: #fff; border: 1px solid var(--danger); color: var(--danger); padding: 7px 13px; font-size: 13px; font-weight: 600; border-radius: 9px; cursor: pointer; }
.btn-danger-outline:hover { background: #fdecec; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ───── Camera / OCR (collect) ───── */
.camera-area {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  background: var(--grad-soft);
  border-radius: 14px; overflow: hidden; display: flex; align-items: center;
  justify-content: center; cursor: pointer; border: 2px dashed #b9cdf5; transition: border-color .15s, background .15s;
}
.camera-area:hover { border-color: var(--brand); }
.camera-area.has-photo { border: none; background: #eef2f7; }
.camera-placeholder { text-align: center; color: var(--brand-ink); padding: 16px; }
.camera-placeholder .cam-icon { font-size: 44px; margin-bottom: 10px; }
.camera-placeholder p { font-size: 15px; font-weight: 700; }
.camera-placeholder small { color: var(--muted); font-weight: 500; }
#photoPreview { width: 100%; height: 100%; object-fit: cover; display: none; }
#cameraInput { display: none; }
.photo-actions { display: none; margin-top: 12px; gap: 10px; }
.photo-actions.show { display: flex; }

.ocr-status { margin-top: 14px; padding: 11px 15px; border-radius: 10px; font-size: 13px; font-weight: 600; display: none; }
.ocr-status.loading { display: block; background: #fff7e6; color: #b45309; }
.ocr-status.done { display: block; background: #e9fbf3; color: #047857; }
.ocr-status.error { display: block; background: #fdecec; color: #b91c1c; }
.ocr-fields { display: none; margin-top: 14px; padding-top: 16px; border-top: 1px dashed var(--border); }
.ocr-fields.show { display: block; }
.ocr-field { margin-bottom: 12px; }
.ocr-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.ocr-field input { width: 100%; padding: 12px 14px; font-size: 15px; border: 1.5px solid var(--border); border-radius: 10px; background: #fbfcfe; outline: none; transition: border-color .15s, box-shadow .15s; }
.ocr-field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

/* ───── Records list ───── */
.records-header { display: flex; justify-content: space-between; align-items: center; }
.record-count { font-size: 13px; color: var(--muted); font-weight: 600; }
.record-item { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid #f0f3f8; align-items: flex-start; }
.record-item:last-child { border-bottom: none; }
.record-thumb { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: var(--grad-soft); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.record-info { flex: 1; min-width: 0; }
.record-info .detail { font-size: 13px; color: #41506a; margin-bottom: 2px; }
.record-info .note { font-size: 12px; color: var(--muted); }
.record-info .time { font-size: 11px; color: #aab4c4; margin-top: 3px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.tag.grade-a { background: #d7f5e6; color: #047857; }
.tag.grade-b { background: #fdedcf; color: #b45309; }
.tag.grade-c { background: #fcdede; color: #b91c1c; }
.tag.factory-yes { background: #d6ecff; color: #1d4ed8; }
.tag.factory-no { background: #eef1f6; color: #5b6677; }
.tag.ai-interest { background: #e7e6ff; color: #4f46e5; }
.empty-state { text-align: center; padding: 34px 0; color: #aab4c4; font-size: 14px; }
.empty-state .empty-icon { font-size: 38px; margin-bottom: 8px; }

/* ───── Dashboard ───── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.stat-card .num { font-size: 32px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.chart-card h3 { font-size: 14px; color: var(--text); margin-bottom: 14px; font-weight: 700; }
.chart-card canvas { max-height: 260px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #f0f3f8; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 700; background: #f7f9fc; position: sticky; top: 0; }
table.data tr:hover td { background: #fafcff; }
.table-scroll { overflow-x: auto; border-radius: 10px; }

/* ───── Admin ───── */
.exh-item { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid #f0f3f8; flex-wrap: wrap; }
.exh-item:last-child { border-bottom: none; }
.exh-item .exh-main { flex: 1; min-width: 180px; }
.exh-item .exh-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.exh-item .exh-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.badge-active {
  background: linear-gradient(140deg, var(--gold-2), var(--gold)); color: #2a1d05;
  font-size: 11px; padding: 3px 11px; border-radius: 20px; font-weight: 800; letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(231,177,74,0.4);
}

/* ═══════════════ Login（左 AI 品牌視覺 / 右 登入）═══════════════ */
.auth { min-height: 100vh; display: flex; }

/* 左側品牌視覺 */
.auth-hero {
  flex: 1.15; position: relative; overflow: hidden; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 54px 56px;
  background:
    radial-gradient(110% 120% at 8% 0%, rgba(231,177,74,0.20) 0%, rgba(231,177,74,0) 46%),
    radial-gradient(130% 130% at 100% 8%, rgba(59,107,240,0.34) 0%, rgba(59,107,240,0) 56%),
    linear-gradient(140deg, var(--ink-1) 0%, var(--ink-2) 55%, var(--ink-3) 100%);
  background-size: 200% 200%, 200% 200%, 100% 100%;
  animation: aurora 22s ease-in-out infinite;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(120% 90% at 30% 20%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(120% 90% at 30% 20%, #000 30%, transparent 75%);
}
.auth-hero::after {
  content: ""; position: absolute; width: 360px; height: 360px; right: -90px; bottom: -120px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, rgba(231,177,74,0.5), rgba(231,177,74,0) 62%);
  filter: blur(8px); animation: floaty 9s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }

.auth-hero > * { position: relative; z-index: 1; }
.hero-brand { display: flex; align-items: center; gap: 13px; }
.hero-brand .mk {
  width: 52px; height: 52px; border-radius: 15px; display: flex; align-items: center; justify-content: center;
  font-size: 27px; background: linear-gradient(140deg, var(--gold-2), var(--gold)); box-shadow: 0 8px 22px rgba(231,177,74,0.45);
}
.hero-brand .bn { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.hero-brand .bn small { display: block; font-size: 12px; font-weight: 600; color: var(--gold-2); letter-spacing: 2px; margin-top: 2px; }

.hero-mid { margin: auto 0; }
.hero-mid .eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--gold-2);
  border: 1px solid rgba(231,177,74,0.4); padding: 4px 12px; border-radius: 20px; margin-bottom: 22px;
}
.hero-mid h1 { font-size: 40px; font-weight: 900; line-height: 1.25; letter-spacing: .5px; }
.hero-mid h1 .accent { background: linear-gradient(120deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-mid .tag { margin-top: 16px; font-size: 15px; color: rgba(255,255,255,0.72); line-height: 1.7; max-width: 420px; }

.hero-feats { display: flex; flex-direction: column; gap: 14px; margin-top: 30px; }
.hero-feats .hf { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: rgba(255,255,255,0.9); font-weight: 500; }
.hero-feats .hf .hi {
  width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
}
.hero-foot { font-size: 12px; color: rgba(255,255,255,0.45); letter-spacing: .5px; }

/* 右側登入面板 */
.auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: #fff; }
.auth-card { width: 100%; max-width: 360px; text-align: center; }
.auth-card .logo {
  width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 34px;
  background: linear-gradient(140deg, var(--gold-2), var(--gold)); box-shadow: 0 8px 22px rgba(231,177,74,0.4);
}
.auth-card h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 30px; line-height: 1.6; }
.auth-card .hint { margin-top: 18px; font-size: 12px; color: #aab4c4; line-height: 1.6; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px; border: 1.5px solid var(--border); border-radius: 14px;
  background: #fff; font-size: 15px; font-weight: 700; color: #374151; cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn-google:hover { background: #f7f9fc; border-color: #cdd6e4; box-shadow: var(--shadow); }

.auth-mobilebrand { display: none; }

/* RWD：窄螢幕收成單欄——上方保留深藍 hero（品牌+標題+賣點），
   下方接白色 bottom-sheet 登入卡，質感與桌機版同調 */
@media (max-width: 860px) {
  .auth { flex-direction: column; background: var(--ink-1); }

  .auth-hero {
    flex: none;                 /* 高度依內容，不撐滿 */
    justify-content: flex-start;
    padding: 40px 26px 46px;
  }
  .auth-hero::after { width: 240px; height: 240px; right: -70px; bottom: -90px; }
  .hero-mid { margin: 26px 0 0; }
  .hero-mid .eyebrow { margin-bottom: 16px; }
  .hero-mid h1 { font-size: 30px; }
  .hero-mid .tag { font-size: 14px; margin-top: 12px; }
  .hero-feats { margin-top: 22px; gap: 11px; }
  .hero-feats .hf { font-size: 13.5px; }
  .hero-feats .hf .hi { width: 34px; height: 34px; font-size: 16px; }
  .hero-foot { display: none; }

  /* 白色 bottom-sheet：上拉蓋住 hero 底部，圓角 + 陰影 */
  .auth-panel {
    flex: 1; align-items: flex-start;
    background: #fff;
    border-radius: 26px 26px 0 0;
    margin-top: -22px; position: relative; z-index: 2;
    padding: 32px 24px 40px;
    box-shadow: 0 -10px 30px rgba(8,15,35,0.28);
  }
  /* sheet 頂端的小拉桿裝飾 */
  .auth-panel::before {
    content: ""; position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 4px; background: #d7deea;
  }
  .auth-card { max-width: 420px; margin: 0 auto; }
  .auth-card .logo { width: 56px; height: 56px; font-size: 28px; margin-top: 6px; }
}
@media (max-width: 380px) {
  .hero-mid h1 { font-size: 26px; }
  .auth-card h2 { font-size: 20px; }
}

/* ───── Toast / overlay ───── */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1f2a3d; color: #fff; padding: 13px 26px; border-radius: 12px; font-size: 14px; font-weight: 600;
  z-index: 1000; opacity: 0; transition: all .3s ease; pointer-events: none; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); z-index: 999; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.loading-overlay.show { display: flex; }
.loading-box { background: #fff; border-radius: var(--radius); padding: 32px; text-align: center; max-width: 280px; box-shadow: var(--shadow-lg); }
.loading-box .spinner { width: 38px; height: 38px; border: 3.5px solid #e6ebf3; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px; }
.loading-box p { font-size: 14px; color: #41506a; font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── 我的名單 / 篩選工具列 ───── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.search-box { position: relative; flex: 1; min-width: 180px; }
.search-box input {
  width: 100%; padding: 11px 14px 11px 38px; font-size: 15px; border: 1.5px solid var(--border);
  border-radius: 11px; background: #fbfcfe; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.search-box .si { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .55; }
.filter-chips { display: flex; gap: 6px; flex-shrink: 0; }
.chip {
  padding: 9px 15px; border-radius: 20px; border: 1.5px solid var(--border); background: #fbfcfe;
  font-size: 14px; font-weight: 600; color: #5b6677; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: #c7d2e4; }
.chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.chip.active.g-a { border-color: var(--ok); background: #e9fbf3; color: #047857; }
.chip.active.g-b { border-color: var(--warn); background: #fff7e6; color: #b45309; }
.chip.active.g-c { border-color: var(--danger); background: #fdecec; color: #b91c1c; }

/* ═══════════════════════════════════════════════════════════
   RWD — 手機（iPhone 15 Pro 393px 及以下）
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 560px) {
  .appbar-top { padding: 10px 14px; gap: 8px; }
  .appbar-title { font-size: 15.5px; gap: 8px; white-space: nowrap; }
  .appbar-title .mark { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .brand-ai { font-size: 10px; padding: 2px 6px; letter-spacing: 0.8px; }
  .appbar-user { gap: 8px; }
  .appbar-user .uname { display: none; }          /* 手機隱藏名字，留頭像 + 角色 + 登出 */
  .appbar-user .role { padding: 2px 8px; }
  .btn-logout { padding: 6px 12px; white-space: nowrap; flex-shrink: 0; }

  .nav-tabs { padding: 0 8px; gap: 0; }
  .nav-tabs a { padding: 11px 13px 13px; font-size: 14px; letter-spacing: 0; }
  .nav-tabs a::after { left: 11px; right: 11px; }

  .dev-banner { font-size: 11px; padding: 6px 10px; line-height: 1.5; }

  .container { padding: 14px 12px; }
  .card { padding: 18px 15px; border-radius: 14px; }
  .notice { font-size: 12.5px; padding: 11px 13px; }

  .field-label { font-size: 14.5px; }
  .checkbox-group { gap: 8px; }
  .checkbox-item { padding: 13px 12px; font-size: 14px; gap: 8px; }
  .checkbox-item .emo { font-size: 17px; }
  .seg-item span { font-size: 15px; padding: 14px 6px; }

  /* 我的名單工具列在手機改直向堆疊 */
  .toolbar { gap: 8px; }
  .search-box { min-width: 100%; }
  .filter-chips { width: 100%; }
  .filter-chips .chip { flex: 1; text-align: center; padding: 9px 6px; }

  /* dashboard 統計卡單欄較易讀 */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card .num { font-size: 27px; }

  /* 我的名單下拉避免擠壓標題 */
  .records-header { flex-wrap: wrap; gap: 10px; }
  .records-header select { max-width: 100% !important; width: 100%; }
}

@media (max-width: 380px) {
  .appbar-title { font-size: 14.5px; }
  .nav-tabs a { padding: 11px 10px 13px; font-size: 13.5px; }
}
