/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Accessibility floor ──
   1) iOS Safari auto-zooms inputs whose font-size < 16px — annoying jump.
      Force every editable field to 16px so the page never zooms.
   2) Set body baseline to 16px so unstyled text has a sane default. */
input, textarea, select { font-size: 16px !important; }
body { font-size: 16px; }

/* ── Utility classes ── */
.pos-rel { position: relative; }
.flex-1  { flex: 1; }

/* ── Unified empty-state component (D17) ── */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 24px; }
.empty-state .es-icon { width: 64px; height: 64px; border-radius: 16px; background: #242424; display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 16px; opacity: 0.7; }
.empty-state .es-title { font-size: 15px; font-weight: 600; color: #ccc; margin-bottom: 6px; letter-spacing: -0.01em; }
.empty-state .es-desc { font-size: 13px; color: #AAA; line-height: 1.6; margin-bottom: 18px; max-width: 240px; }
.empty-state .es-cta { height: 38px; padding: 0 22px; background: #fff; border: none; border-radius: 12px; color: #000; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: -0.01em; }
body.light-mode .empty-state .es-icon { background: #F0F0F0 !important; }
body.light-mode .empty-state .es-title { color: #1A1A1A !important; }
body.light-mode .empty-state .es-desc { color: #777 !important; }
body.light-mode .empty-state .es-cta { background: #1A1A1A !important; color: #fff !important; }

/* ── Theme tokens (use var(--xxx) for new code; existing !important rules stay until migrated) ── */
:root {
  --bg-page:       #161616;
  --bg-card:       #202020;
  --bg-elevated:   #242424;
  --text-primary:  #EFEFEF;
  --text-muted:    #B0B0B0;
  --text-faint:    #999999;
  --border:        #333333;
  --border-strong: #333333;
}
body.light-mode {
  --bg-page:       #F2F2F2;
  --bg-card:       #FFFFFF;
  --bg-elevated:   #F8F8F8;
  --text-primary:  #1A1A1A;     /* 16:1 on white, AAA */
  --text-muted:    #5A5A5A;     /* 7:1 on white, 5.6:1 on #EBE — solid AA */
  --text-faint:    #888888;     /* 5.6:1 on white — was #BBB (1.9:1, invisible) */
  --border:        #D8D8D8;
  --border-strong: #C0C0C0;
}
body {
  background: #1E1E1E; min-height: 100vh;
  font-family: 'DM Sans', sans-serif;
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px 48px;
  user-select: none;
}

/* ── Top nav ── */
.proto-nav {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 24px; max-width: 760px;
}
.nav-btn {
  padding: 5px 12px; border-radius: 20px;
  background: #242424; border: 1px solid #333333;
  color: #AAA; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all 0.2s; letter-spacing: 0.04em;
  white-space: nowrap;
}
.nav-btn:hover { border-color: #999; color: #ccc; }
.nav-btn.active { background: #fff; color: #000; border-color: #EFEFEF; }

/* ── Phone shell ── */
.phone-shell {
  position: relative;
  width: 375px; height: 812px;
}
.phone-frame {
  position: absolute; inset: 0;
  border-radius: 54px;
  box-shadow: 0 0 0 1.5px #333333, 0 0 0 10px #0F0F0F, 0 0 0 11.5px #282828, 0 40px 120px rgba(0,0,0,0.9);
  pointer-events: none; z-index: 100;
}
.screen-area {
  position: absolute; inset: 0;
  border-radius: 54px; overflow: hidden;
  background: #161616;
}

/* On narrow viewports (real phones / small windows), the fixed 375x812
   phone-shell overflows the viewport and the bezel/box-shadow no longer
   lines up with the screen-area — drop the bezel and let the screen fill
   the viewport so everything stays aligned. */
@media (max-width: 420px) {
  body { padding: 0; min-height: 100vh; }
  .proto-nav { display: none; }
  .phone-shell {
    width: 100vw; height: 100vh;
    border-radius: 0;
  }
  .phone-frame { display: none; }
  .screen-area, .page { border-radius: 0; }
  .notch { display: none; }
}

/* ── Page container ── */
.page {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  background: #161616;
  border-radius: 54px;
  overflow: hidden;
}
.page.active { display: flex; }

/* ── Notch ── */
.notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 120px; height: 34px; background: inherit;
  border-radius: 0 0 20px 20px; z-index: 50;
}
.home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; background: #282828; border-radius: 3px; z-index: 50;
}

/* ── Shared components ── */
.back-btn {
  width: 34px; height: 34px; background: #202020;
  border: 1.5px solid #333333; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color 0.2s; flex-shrink: 0;
}
.back-btn:hover { border-color: #888; }

/* Unified per-page nav: home-style logo (no box) used as a clickable
   element. Sits next to .back-btn when both are needed; appears alone
   when back would just go home anyway. */
.nav-logo-injected {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; transition: opacity 0.2s; color: #EFEFEF;
  font-family: 'DM Sans', sans-serif; line-height: 1; height: 34px;
}
.nav-logo-injected:hover { opacity: 0.7; }
/* When sitting next to a back-btn, pull tight against it (overrides parent gap) */
.back-btn + .nav-logo-injected,
.scan-back + .nav-logo-injected { margin-left: -4px; }

/* Language picker indicator — checkmark, not a dot. Hidden when inactive,
   shown when active. Uses mask so we can color it via CSS. */
.lang-check {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-block; opacity: 0; transition: opacity 0.2s;
  background-color: #EFEFEF;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>') center / contain no-repeat;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>') center / contain no-repeat;
}
.lang-check.checked { opacity: 1; }
body.light-mode .lang-check { background-color: #1A1A1A; }
.nav-logo-injected .logo-btn-name {
  font-size: 16px; font-weight: 700; color: #EFEFEF; letter-spacing: -0.03em;
}
body.light-mode .nav-logo-injected,
body.light-mode .nav-logo-injected .logo-btn-name { color: #1A1A1A !important; }

/* ── Company brief modal ──────────────────────────────────── */
.brief-overlay { z-index: 700 !important; }
.brief-card {
  width: 340px !important;
  max-height: 80vh;
  background: #202020 !important;
  border: 1px solid #333333 !important;
  border-radius: 22px !important;
  padding: 0 !important;
  overflow: hidden;
  display: flex; flex-direction: column;
  font-family: 'DM Sans', 'Noto Sans TC', 'PingFang TC', sans-serif;
  box-shadow: 0 20px 48px rgba(0,0,0,0.6);
}
.brief-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #1F1F1F;
  background: linear-gradient(180deg, #242424 0%, #202020 100%);
  flex-shrink: 0;
}
.brief-h-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.brief-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  color: #6B8EC4; background: rgba(107,142,196,0.1);
  border: 1px solid rgba(107,142,196,0.25);
  border-radius: 7px; padding: 4px 9px; text-transform: uppercase;
}
.brief-pill::before {
  content: '✦'; font-size: 12px;
}
.brief-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2C2C2C; border: none; color: #888;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.brief-close:hover { background: #333; color: #EFEFEF; }
.brief-company { font-size: 17px; font-weight: 700; color: #EFEFEF; letter-spacing: -0.02em; line-height: 1.3; }
.brief-low-conf { font-size: 13px; color: #F5C842; margin-top: 6px; }

.brief-loading { padding: 32px 20px; text-align: center; }
.brief-loading-text { font-size: 13px; color: #888; margin-top: 14px; }
.brief-error { padding: 32px 20px; text-align: center; color: #E05555; font-size: 15px; line-height: 1.6; }

.brief-body { padding: 14px 20px 20px; overflow-y: auto; }
.brief-body::-webkit-scrollbar { display: none; }
.brief-section { margin-bottom: 16px; }
.brief-section:last-child { margin-bottom: 0; }
.brief-h {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: #999; text-transform: uppercase; margin-bottom: 6px;
}
.brief-p { font-size: 14px; color: #ccc; line-height: 1.65; }
.brief-headline {
  background: rgba(107,142,196,0.06);
  border: 1px solid rgba(107,142,196,0.2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px; font-weight: 600;
  color: #EFEFEF; line-height: 1.55;
}
.brief-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.brief-fact { background: #0D0D0D; border: 1px solid #1F1F1F; border-radius: 10px; padding: 8px 10px; }
.brief-fact-label { font-size: 11px; color: #999; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.brief-fact-value { font-size: 13px; color: #EFEFEF; font-weight: 600; line-height: 1.3; }
.brief-news {
  border-left: 2px solid #6B8EC4;
  padding: 6px 0 8px 12px;
  margin-bottom: 10px;
}
.brief-news:last-child { margin-bottom: 0; }
.brief-news-date { font-size: 12px; font-weight: 700; color: #6B8EC4; letter-spacing: 0.08em; margin-bottom: 3px; }
.brief-news-title { font-size: 14px; color: #EFEFEF; font-weight: 600; line-height: 1.4; margin-bottom: 4px; }
.brief-news-why { font-size: 13px; color: #888; line-height: 1.5; }
.brief-talk { padding-left: 18px; margin: 0; }
.brief-talk li { font-size: 13px; color: #ccc; line-height: 1.7; margin-bottom: 4px; }
/* Light mode */
body.light-mode .brief-card { background: #FFFFFF !important; border-color: #E0E0E0 !important; }
body.light-mode .brief-head { background: linear-gradient(180deg, #FAFAFA, #FFFFFF) !important; border-bottom-color: #EEEEEE; }
body.light-mode .brief-company { color: #1A1A1A; }
body.light-mode .brief-h { color: #888; }
body.light-mode .brief-p { color: #333; }
body.light-mode .brief-fact { background: #F5F5F5; border-color: #E5E5E5; }
body.light-mode .brief-fact-value { color: #1A1A1A; }
body.light-mode .brief-news-title { color: #1A1A1A; }
body.light-mode .brief-talk li { color: #333; }
body.light-mode .brief-close { background: #EEEEEE !important; color: #555 !important; }
/* .brief-headline used to render as #EFEFEF (white) on light blue tint = invisible */
body.light-mode .brief-headline { color: #1A1A1A !important; background: rgba(107,142,196,0.08) !important; border-color: rgba(107,142,196,0.3) !important; }
body.light-mode .brief-news-why { color: #666 !important; }
body.light-mode .brief-fact-label { color: #777 !important; }
body.light-mode .brief-loading-text { color: #666 !important; }

/* Editable scan-result fields — inline so user can fix OCR misreads */
.scan-edit-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  color: #EFEFEF;
  font-family: 'DM Sans', 'Noto Sans TC', 'PingFang TC', sans-serif;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.scan-edit-input::placeholder { color: #888; }
.scan-edit-input:hover { border-color: #333333; background: rgba(255,255,255,0.02); }
.scan-edit-input:focus { border-color: #6BAF7A; background: rgba(107,175,122,0.06); }
/* Scan-result is overlaid on the camera page (always dark like Apple Camera).
   So even in light mode, keep input text light — don't flip to dark on dark bg. */
body.light-mode .scan-edit-input { color: #EFEFEF; }
body.light-mode .scan-edit-input::placeholder { color: #888; }
body.light-mode .scan-edit-input:hover { border-color: #333; background: rgba(255,255,255,0.02); }
body.light-mode .scan-edit-input:focus { border-color: #6BAF7A; background: rgba(107,175,122,0.06); }

/* "了解這間公司" trigger button shown in scan-result */
.brief-trigger {
  width: 100%; height: 40px; margin-top: 10px; margin-bottom: 4px;
  background: rgba(107,142,196,0.1); color: #6B8EC4;
  border: 1px solid rgba(107,142,196,0.25); border-radius: 12px;
  font-family: 'DM Sans','Noto Sans TC',sans-serif;
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s;
}
.brief-trigger:hover { background: rgba(107,142,196,0.18); }
.brief-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
body.light-mode .brief-trigger {
  background: rgba(107,142,196,0.12) !important;
  color: #4A6FA6 !important;
  border-color: rgba(107,142,196,0.4) !important;
}

/* ── Duplicate-contact modal ──────────────────────────────── */
.dup-overlay { z-index: 800 !important; }   /* sits above scan-result overlay */
.dup-card {
  width: 320px !important;
  background: #202020 !important;
  border: 1px solid #333333 !important;
  border-radius: 22px !important;
  padding: 22px 20px 18px !important;
  font-family: 'DM Sans', 'Noto Sans TC', 'PingFang TC', sans-serif;
  box-shadow: 0 20px 48px rgba(0,0,0,0.6);
}
.dup-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  color: #F5C842;
  background: rgba(245,200,66,0.08);
  border: 1px solid rgba(245,200,66,0.22);
  border-radius: 7px; padding: 4px 9px;
  margin: 0 auto 12px; text-transform: uppercase;
}
.dup-pill::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: #F5C842;
}
.dup-card .dup-q {
  font-size: 16px; font-weight: 700; color: #EFEFEF;
  text-align: center; letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.dup-card .dup-reason {
  font-size: 13px; color: #888; text-align: center;
  margin-bottom: 16px; line-height: 1.5;
}
.dup-compare {
  display: flex; gap: 8px; align-items: stretch;
  margin-bottom: 16px;
}
.dup-side {
  flex: 1; min-width: 0;
  background: #0E0E0E;
  border: 1px solid #2C2C2C;
  border-radius: 12px;
  padding: 12px 10px 10px;
  text-align: center;
}
.dup-side-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  margin-bottom: 8px; text-transform: uppercase;
}
.dup-side.left  { border-color: rgba(107,175,122,0.25); }
.dup-side.left  .dup-side-tag { color: #6BAF7A; }
.dup-side.right { border-color: rgba(107,142,196,0.25); }
.dup-side.right .dup-side-tag { color: #6B8EC4; }
.dup-side .dup-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  margin: 0 auto 8px;
}
.dup-side.left  .dup-avatar { background: rgba(107,175,122,0.14); border: 1.5px solid rgba(107,175,122,0.45); color: #6BAF7A; }
.dup-side.right .dup-avatar { background: rgba(107,142,196,0.14); border: 1.5px solid rgba(107,142,196,0.45); color: #6B8EC4; }
.dup-side .dup-name {
  font-size: 13px; font-weight: 700; color: #EFEFEF;
  line-height: 1.3; word-break: break-word;
}
.dup-side .dup-sub {
  font-size: 12px; color: #AAA; margin-top: 3px;
  line-height: 1.4; word-break: break-word;
}
.dup-arrow {
  width: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #999;
}
/* Buttons */
.dup-btn-row { display: flex; gap: 8px; }
.dup-btn {
  flex: 1; height: 44px; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.dup-btn:active { transform: scale(0.97); }
.dup-btn.primary { background: #fff; color: #000; border: none; }
.dup-btn.primary:hover { background: #f0f0f0; }
.dup-btn.secondary { background: #282828; color: #ccc; border: 1px solid #2E2E2E; }
.dup-btn.secondary:hover { border-color: #888; color: #EFEFEF; }
.dup-btn.cancel {
  background: none; border: none; color: #999; font-weight: 500;
  font-size: 13px; height: 32px; margin-top: 8px; width: 100%;
}
.dup-btn.cancel:hover { color: #888; }
/* Step 2 action cards */
.dup-action {
  display: block; text-align: left; padding: 14px 16px;
  border-radius: 12px; cursor: pointer; width: 100%;
  font-family: inherit; transition: transform 0.1s, border-color 0.15s;
  margin-bottom: 8px;
}
.dup-action:active { transform: scale(0.99); }
.dup-action.merge { background: #fff; color: #000; border: none; }
.dup-action.merge:hover { background: #f5f5f5; }
.dup-action.over { background: #242424; color: #EFEFEF; border: 1px solid #333333; }
.dup-action.over:hover { border-color: #888; }
.dup-action .a-title { font-size: 15px; font-weight: 700; display: block; margin-bottom: 3px; }
.dup-action .a-rec {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: #22C55E; margin-left: 6px; vertical-align: 1px;
}
.dup-action .a-desc {
  font-size: 13px; font-weight: 400; line-height: 1.5; display: block;
}
.dup-action.merge .a-desc { color: #999; }
.dup-action.over  .a-desc { color: #888; }
/* Light mode */
body.light-mode .dup-card {
  background: #FFFFFF !important;
  border-color: #E0E0E0 !important;
}
body.light-mode .dup-card .dup-q { color: #1A1A1A; }
body.light-mode .dup-card .dup-reason { color: #666; }
body.light-mode .dup-side { background: #F8F8F8; border-color: #E5E5E5; }
body.light-mode .dup-side .dup-name { color: #1A1A1A; }
body.light-mode .dup-btn.primary { background: #1A1A1A !important; color: #fff !important; }
body.light-mode .dup-btn.secondary { background: #F0F0F0 !important; color: #555 !important; border-color: #DDD !important; }
body.light-mode .dup-action.merge { background: #1A1A1A !important; color: #fff !important; }
body.light-mode .dup-action.merge .a-desc { color: #ccc !important; }
body.light-mode .dup-action.over { background: #F5F5F5 !important; color: #1A1A1A !important; border-color: #DDD !important; }
body.light-mode .dup-action.over .a-desc { color: #666 !important; }

/* Premium subscription status card — CHAMPAGNE identity, mode-agnostic.
   Same light-gold palette in dark and light mode (like a real LinkedIn
   Premium / Tinder Gold card). Uses CSS variables so we can tweak the
   palette in one spot. */
.prem-status-card {
  --prem-bg-1:    #F5EBD3;
  --prem-bg-2:    #EADBB1;
  --prem-edge:    #C4A05A;
  --prem-ink-1:   #2A1F0A;  /* numbers */
  --prem-ink-2:   #5B4520;  /* labels */
  --prem-ink-3:   #8A6F3A;  /* meta */
  --prem-divider: rgba(91, 69, 32, 0.18);
  --prem-pill-bg: rgba(91, 69, 32, 0.10);

  position: relative;
  background: linear-gradient(135deg, var(--prem-bg-1) 0%, var(--prem-bg-2) 100%);
  border: 1px solid var(--prem-edge);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 6px 22px rgba(180, 140, 60, 0.18);
}
.prem-status-glow {
  position: absolute; right: -50px; top: -70px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, transparent 60%);
  pointer-events: none;
}
/* Lock the same palette in light mode (don't adapt to page bg) */
body.light-mode .prem-status-card {
  background: linear-gradient(135deg, var(--prem-bg-1) 0%, var(--prem-bg-2) 100%) !important;
  border-color: var(--prem-edge) !important;
}
/* Override every inline color used in the card to the champagne palette */
.prem-status-card [style*="color:#fff"]            { color: var(--prem-ink-1) !important; }
.prem-status-card [style*="color:#888"]            { color: var(--prem-ink-3) !important; }
.prem-status-card [style*="color:#777"]            { color: var(--prem-ink-2) !important; }
.prem-status-card [style*="background:#1F1A12"]    { background: var(--prem-divider) !important; }
.prem-status-card [style*="border-top:1px solid #1F1A12"] { border-top-color: var(--prem-divider) !important; }
.prem-status-card .premium-name                    { color: var(--prem-ink-1) !important; }
/* ACTIVE pill — re-tinted to brown-on-cream */
.prem-status-card [style*="color:#E8C97A"]         { color: var(--prem-ink-2) !important; }
.prem-status-card [style*="background:rgba(232,201,122,0.1)"] { background: var(--prem-pill-bg) !important; }
.prem-status-card [style*="border:1px solid rgba(232,201,122,0.25)"] { border-color: var(--prem-edge) !important; }
.prem-status-card [stroke="#777"]                  { stroke: var(--prem-ink-2) !important; }
body.light-mode .prem-status-card [style*="color:#fff"] { color: var(--prem-ink-1) !important; }
body.light-mode .prem-status-card [style*="color:#888"] { color: var(--prem-ink-3) !important; }
body.light-mode .prem-status-card [style*="color:#777"] { color: var(--prem-ink-2) !important; }

/* Cancel-subscription flow — light mode parity */
body.light-mode #cancelStep1,
body.light-mode #cancelStep2,
body.light-mode #cancelStep3,
body.light-mode #cancelStep4 { background: #EBEBEB !important; }
body.light-mode #cancelOverlay [style*="color:#fff"] { color: #1A1A1A !important; }
body.light-mode #cancelOverlay [style*="color:#666"] { color: #777 !important; }
body.light-mode #cancelOverlay [style*="color:#555"] { color: #888 !important; }
body.light-mode #cancelOverlay [style*="color:#444"] { color: #999 !important; }
body.light-mode #cancelOverlay [style*="color:#888"] { color: #888 !important; }
body.light-mode #cancelOverlay [style*="color:#333"] { color: #999 !important; }
/* Reason / pause / continue cards — flip dark surfaces to white */
body.light-mode #cancelOverlay [style*="background:#111"]    { background: #FFFFFF !important; border-color: #E0E0E0 !important; }
body.light-mode #cancelOverlay [style*="background:#161616"] { background: #F5F5F5 !important; }
body.light-mode #cancelOverlay [style*="background:#1A1A1A"] { background: #F5F5F5 !important; }
body.light-mode #cancelOverlay [style*="border:1px solid #1E1E1E"] { border-color: #E0E0E0 !important; }
body.light-mode #cancelOverlay [style*="border:1px solid #2A2A2A"] { border-color: #D0D0D0 !important; }
/* "What you'll lose" red warning cards — soften red for light bg */
body.light-mode #cancelOverlay [style*="background:#1A0808"] { background: #FFF0F0 !important; border-color: #F5C8C8 !important; }
body.light-mode #cancelOverlay [style*="border:1px solid #2A1010"] { border-color: #F5C8C8 !important; }
body.light-mode #cancelOverlay [style*="color:#E05555"] { color: #C04040 !important; }
body.light-mode #cancelOverlay [style*="color:#883333"] { color: #B57070 !important; }
/* Discount offer card — re-apply champagne palette so it matches the
   premium status card (don't flip to white-on-dark) */
body.light-mode #cancelOverlay [style*="background:linear-gradient(135deg,#1A140A,#2A1E0A)"] {
  background: linear-gradient(135deg, #F5EBD3 0%, #EADBB1 100%) !important;
  border-color: #C4A05A !important;
}
body.light-mode #cancelOverlay [style*="background:linear-gradient(135deg,#1A140A,#2A1E0A)"] [style*="color:#fff"] { color: #2A1F0A !important; }
body.light-mode #cancelOverlay [style*="background:linear-gradient(135deg,#1A140A,#2A1E0A)"] [style*="color:#888"] { color: #5B4520 !important; }
body.light-mode #cancelOverlay [style*="background:linear-gradient(135deg,#1A140A,#2A1E0A)"] [style*="color:#555"] { color: #8A6F3A !important; }
body.light-mode #cancelOverlay [style*="background:linear-gradient(135deg,#1A140A,#2A1E0A)"] [style*="color:#E8C97A"] { color: #5B4520 !important; }
body.light-mode #cancelOverlay [style*="background:#E8C97A11"] { background: rgba(91, 69, 32, 0.08) !important; }

.scroll-body { flex: 1; overflow-y: auto; scrollbar-width: none; }
.scroll-body::-webkit-scrollbar { display: none; }

.section-label {
  font-size: 11px; font-weight: 600; color: #888;
  letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 10px;
}

/* contact row with swipe */
.swipe-wrapper { position: relative; overflow: hidden; border-bottom: 1px solid #1E1E1E; }
.sw-actions-left {
  position: absolute; top: 0; left: 0; bottom: 0;
  display: flex; min-width: 240px;
}
.sw-star { background: #1A1A10; }
.sw-star span { color: #F5C842; }
.sw-actions-right {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; min-width: 160px;
}
.sw-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 0 22px; cursor: pointer; min-width: 80px;
}
.sw-action span { font-size: 12px; font-weight: 600; }
.sw-share  { background: #1A2A1E; } .sw-share span  { color: #6BAF7A; }
.sw-folder { background: #1A1E2A; } .sw-folder span { color: #6B8EC4; }
.sw-hide   { background: #282828; } .sw-hide span   { color: #888; }
.sw-delete { background: #2A0F0F; } .sw-delete span { color: #E05555; }

.contact-row {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; background: #161616;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  touch-action: pan-y;
}
.contact-row.no-t { transition: none; }
.c-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.c-info { flex: 1; min-width: 0; }
.c-name { font-size: 15px; font-weight: 600; color: #EFEFEF; }
.c-role { font-size: 12px; color: #999; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-time { font-size: 11px; color: #888; flex-shrink: 0; }
.c-chevron { color: #333333; flex-shrink: 0; }

/* toast */
.toast-el {
  position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #000; font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: 20px; white-space: nowrap; z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.toast-el.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ════════════════════════════════════════
   SPLASH
════════════════════════════════════════ */
#splash {
  background: #161616;
  align-items: center; justify-content: center;
}
#splash .notch { background: #161616; }
.splash-glow {
  position: absolute; width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.035) 0%, transparent 65%);
  top: 50%; left: 50%; transform: translate(-50%,-58%);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:0.7;transform:translate(-50%,-58%) scale(1)}50%{opacity:1;transform:translate(-50%,-58%) scale(1.08)} }
.splash-content { display: flex; flex-direction: column; align-items: center; position: relative; z-index: 2; }
.splash-logo { margin-bottom: 26px; animation: fadeUp 0.8s cubic-bezier(0.16,1,0.3,1) both 0.15s; }
.circle-l { stroke-dasharray:151;stroke-dashoffset:151;animation:draw 0.65s cubic-bezier(0.4,0,0.2,1) forwards 0.35s; }
.circle-r { stroke-dasharray:151;stroke-dashoffset:151;animation:draw 0.65s cubic-bezier(0.4,0,0.2,1) forwards 0.5s; }
.center-dot { opacity:0;transform-origin:44px 32px;transform:scale(0);animation:dotPop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards 0.9s; }
@keyframes draw{to{stroke-dashoffset:0}} @keyframes dotPop{to{opacity:1;transform:scale(1)}}
.splash-words { opacity:0;animation:fadeUp 0.7s cubic-bezier(0.16,1,0.3,1) forwards 0.75s; display:flex;flex-direction:column;align-items:center;gap:8px; }
.splash-name { color:#EFEFEF;font-size:32px;font-weight:700;letter-spacing:-0.04em;line-height:1; }
.splash-slogan { color:#888;font-size:13px;letter-spacing:0.18em;text-transform:uppercase; }
.splash-loader { position:absolute;bottom:72px;left:50%;transform:translateX(-50%);opacity:0;animation:fadeIn 0.5s forwards 1.2s; }
.loader-track { width:48px;height:2px;background:#282828;border-radius:2px;overflow:hidden; }
.loader-fill { height:100%;background:#fff;width:0%;animation:load 1.8s cubic-bezier(0.4,0,0.2,1) forwards 1.4s; }
@keyframes load{0%{width:0%}60%{width:70%}100%{width:100%}}
@keyframes fadeUp{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
@keyframes fadeIn{to{opacity:1}}

/* ════════════════════════════════════════
   ONBOARDING
════════════════════════════════════════ */
#onboarding { background: #161616; }
#onboarding .notch { background: #161616; }
.ob-skip { position:absolute;top:52px;right:24px;color:#888;font-size:13px;font-weight:500;cursor:pointer;z-index:20; }
.ob-track { display:flex;width:400%;height:100%;transition:transform 0.5s cubic-bezier(0.4,0,0.2,1);touch-action:pan-y; }
.ob-slide { width:375px;height:812px;flex-shrink:0;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 32px 140px;position:relative; }
.ob-illus { width:240px;height:240px;margin-bottom:48px;position:relative;flex-shrink:0; }
.ob-num { font-size:12px;color:#888;letter-spacing:0.2em;text-transform:uppercase;margin-bottom:16px;align-self:flex-start; }
.ob-title { font-size:22px;font-weight:600;color:#EFEFEF;letter-spacing:-0.02em;line-height:1.25;margin-bottom:14px;align-self:flex-start; }
.ob-title em { font-style:normal;color:#888; }
.ob-desc { font-size:15px;color:#999;line-height:1.6;align-self:flex-start; }
.ob-bottom { position:absolute;bottom:0;left:0;right:0;padding:0 32px 40px;display:flex;flex-direction:column;align-items:center;gap:20px;z-index:10; }
.ob-dots { display:flex;gap:6px;align-items:center; }
.ob-dot { width:6px;height:6px;border-radius:50%;background:#333333;transition:all 0.3s cubic-bezier(0.4,0,0.2,1);cursor:pointer; }
.ob-dot.active { width:20px;border-radius:3px;background:#fff; }
.ob-start { width:100%;height:54px;background:#fff;color:#000;border:none;border-radius:16px;font-family:'DM Sans',sans-serif;font-size:16px;font-weight:600;cursor:pointer;opacity:0;transform:translateY(20px);transition:opacity 0.4s cubic-bezier(0.16,1,0.3,1),transform 0.4s;pointer-events:none; }
.ob-start.visible { opacity:1;transform:translateY(0);pointer-events:auto; }

/* scan illus */
.scan-scene { position:absolute;inset:0;display:flex;align-items:center;justify-content:center; }
.scan-frame-box { width:180px;height:110px;position:relative; }
.sf-corner { position:absolute;width:22px;height:22px; }
.sf-corner.tl{top:0;left:0;border-top:2.5px solid #fff;border-left:2.5px solid #fff;border-radius:4px 0 0 0}
.sf-corner.tr{top:0;right:0;border-top:2.5px solid #fff;border-right:2.5px solid #fff;border-radius:0 4px 0 0}
.sf-corner.bl{bottom:0;left:0;border-bottom:2.5px solid #fff;border-left:2.5px solid #fff;border-radius:0 0 0 4px}
.sf-corner.br{bottom:0;right:0;border-bottom:2.5px solid #fff;border-right:2.5px solid #fff;border-radius:0 0 4px 0}
.sf-card { position:absolute;inset:14px;background:#242424;border-radius:8px;border:1px solid #333333;display:flex;flex-direction:column;justify-content:center;padding:10px 14px;gap:5px; }
.sf-line { height:6px;border-radius:3px;background:#333; }
.sf-scan { position:absolute;left:14px;right:14px;height:1.5px;background:linear-gradient(90deg,transparent,rgba(255,255,255,0.8),transparent);animation:scanSw 2s ease-in-out infinite; }
@keyframes scanSw{0%{top:20px;opacity:0}10%{opacity:1}90%{opacity:1}100%{top:90px;opacity:0}}
.sf-badge { position:absolute;bottom:-28px;left:50%;transform:translateX(-50%);background:#fff;color:#000;font-size:11px;font-weight:700;padding:4px 12px;border-radius:20px;white-space:nowrap;animation:badgePop 2.5s ease-in-out infinite; }
@keyframes badgePop{0%,35%{opacity:0;transform:translateX(-50%) translateY(4px) scale(0.9)}55%,85%{opacity:1;transform:translateX(-50%) translateY(0) scale(1)}100%{opacity:0;transform:translateX(-50%) translateY(4px) scale(0.9)}}

/* tap phones illus */
.phones-scene { position:absolute;inset:0;display:flex;align-items:center;justify-content:center; }
.iphone-ob { background:#1C1C1E;border-radius:22px;border:1.5px solid #3A3A3C;position:absolute;width:72px;height:138px;top:50%;box-shadow:0 6px 28px rgba(0,0,0,0.6);z-index:1; }
.iphone-ob::after{content:'';position:absolute;right:-3px;top:36px;width:3px;height:22px;background:#3A3A3C;border-radius:0 2px 2px 0}
.iphone-ob::before{content:'';position:absolute;left:-3px;top:28px;width:3px;height:14px;background:#3A3A3C;border-radius:2px 0 0 2px;box-shadow:0 20px 0 #3A3A3C}
.iph-screen{position:absolute;inset:3px;background:#161616;border-radius:20px}
.iph-di{position:absolute;top:10px;left:50%;transform:translateX(-50%);width:32px;height:10px;background:#000;border-radius:6px;z-index:2}
.iph-left { transform:translateY(-50%) rotate(90deg); animation:iphL 2.8s ease-in-out infinite; }
.iph-right { transform:translateY(-50%) rotate(-90deg); animation:iphR 2.8s ease-in-out infinite; }
@keyframes iphL{0%,100%{left:6px}50%{left:51px}} @keyframes iphR{0%,100%{right:6px}50%{right:51px}}
.loop-wrap{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:44px;height:44px;display:flex;align-items:center;justify-content:center;z-index:10}
.loop-icon{animation:loopT 2.8s ease-in-out infinite}
@keyframes loopT{0%{opacity:1;transform:scale(1) rotate(0deg)}35%{opacity:1;transform:scale(1) rotate(120deg)}45%{opacity:0;transform:scale(0.2) rotate(160deg)}72%{opacity:0}88%{opacity:1;transform:scale(1) rotate(360deg)}100%{opacity:1;transform:scale(1) rotate(360deg)}}

/* cards illus */
.cards-wrap{position:absolute;inset:0;overflow:hidden}
.card-item{position:absolute;background:#242424;border:1px solid #333333;border-radius:12px;padding:10px 14px;width:150px}
.ci-name{color:#EFEFEF;font-size:13px;font-weight:600;margin-bottom:3px}.ci-role{color:#999;font-size:11px}.ci-tag{display:inline-block;margin-top:6px;background:#222;color:#888;font-size:11px;padding:2px 8px;border-radius:20px}
.ci1{top:20px;left:20px;animation:flt 3s ease-in-out infinite}.ci2{top:80px;right:10px;animation:flt 3s ease-in-out infinite 0.5s}.ci3{bottom:40px;left:30px;animation:flt 3s ease-in-out infinite 1s}.ci4{bottom:100px;right:5px;animation:flt 3s ease-in-out infinite 1.5s}
@keyframes flt{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
.ai-badge2{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;color:#000;font-size:12px;font-weight:700;padding:6px 16px;border-radius:20px;letter-spacing:0.05em;animation:bP 2s ease-in-out infinite;white-space:nowrap}
@keyframes bP{0%,100%{transform:translate(-50%,-50%) scale(1)}50%{transform:translate(-50%,-50%) scale(1.05)}}

/* notif illus */
.notif-wrap2{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px}
.notif-card2{width:200px;background:#242424;border:1px solid #333333;border-radius:14px;padding:12px 14px;animation:slN 3s ease-in-out infinite}
.notif-card2:nth-child(2){animation-delay:0.4s}.notif-card2:nth-child(3){animation-delay:0.8s}
@keyframes slN{0%,100%{transform:translateX(0)}50%{transform:translateX(-4px)}}
.nt{display:flex;align-items:center;gap:8px;margin-bottom:6px}.nt-icon{width:22px;height:22px;border-radius:6px;background:#fff;display:flex;align-items:center;justify-content:center;font-size:12px;flex-shrink:0}
.nt-app{color:#999;font-size:11px;font-weight:600;letter-spacing:0.1em;text-transform:uppercase}.nt-time{color:#888;font-size:11px;margin-left:auto}
.nt-title{color:#EFEFEF;font-size:12px;font-weight:600;margin-bottom:2px}.nt-body{color:#999;font-size:11px;line-height:1.4}

/* ════════════════════════════════════════
   LOGIN / REGISTER
════════════════════════════════════════ */
.auth-screen { flex:1;display:flex;flex-direction:column;padding:64px 32px 40px;overflow-y:auto;scrollbar-width:none; }
.auth-screen::-webkit-scrollbar{display:none}
.logo-row{display:flex;align-items:center;gap:10px;margin-bottom:36px;margin-top:8px}
.logo-name{font-size:17px;font-weight:700;color:#EFEFEF;letter-spacing:-0.03em}
.auth-heading{font-size:24px;font-weight:600;color:#EFEFEF;letter-spacing:-0.03em;line-height:1.2;margin-bottom:24px}
.input-group{display:flex;flex-direction:column;gap:12px;margin-bottom:20px}
.input-wrap{position:relative}
.input-wrap input{width:100%;height:52px;background:#1E1E1E;border:1.5px solid #333333;border-radius:14px;color:#EFEFEF;font-family:'DM Sans',sans-serif;font-size:15px;padding:0 48px 0 16px;outline:none;transition:border-color 0.2s;-webkit-appearance:none}
.input-wrap input::placeholder{color:#888}
.input-wrap input:focus{border-color:#EFEFEF}
.input-label{position:absolute;top:-9px;left:12px;font-size:12px;font-weight:600;color:#999;letter-spacing:0.08em;text-transform:uppercase;background:#161616;padding:0 4px;pointer-events:none}
.eye-btn{position:absolute;right:14px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:#888;display:flex;align-items:center;padding:4px;transition:color 0.2s}
.btn-primary{width:100%;height:52px;background:#fff;color:#000;border:none;border-radius:14px;font-family:'DM Sans',sans-serif;font-size:16px;font-weight:600;cursor:pointer;margin-bottom:16px;transition:background 0.15s;box-sizing:border-box;align-self:stretch;flex-shrink:0;display:block}
.btn-primary:active{background:#ddd}
.sub-links{display:flex;justify-content:space-between;margin-bottom:24px}
.sub-link-btn{font-size:13px;color:#888;cursor:pointer;background:none;border:none;font-family:'DM Sans',sans-serif;font-weight:500}
.sub-link-btn.bright{color:#EFEFEF;font-weight:600}
.divider{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.div-line{flex:1;height:1px;background:#282828}
.div-text{font-size:13px;color:#888;font-weight:500;letter-spacing:0.1em;text-transform:uppercase}
.social-row{display:flex;gap:10px}
.btn-social{flex:1;height:52px;background:#111;border:1.5px solid #333333;border-radius:14px;color:#EFEFEF;font-family:'DM Sans',sans-serif;font-size:15px;font-weight:500;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:background 0.15s,border-color 0.15s}
.btn-social:hover{background:#242424;border-color:#3A3A3A}

/* ════════════════════════════════════════
   HOME
════════════════════════════════════════ */
/* #home background: handled by .page rule + light-mode override */
#home .notch { background: #0A0A0A; }
.home-topbar{padding:48px 24px 12px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.logo-btn{display:flex;align-items:center;gap:8px;background:none;border:none;cursor:pointer;transition:opacity 0.2s}
.logo-btn:hover{opacity:0.7}
.logo-btn-name{font-size:15px;font-weight:700;color:#EFEFEF;letter-spacing:-0.03em}
.settings-btn{width:36px;height:36px;background:#202020;border:1.5px solid #333333;border-radius:10px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:border-color 0.2s}
.settings-btn:hover{border-color:#888}
.home-scroll{flex:1;overflow-y:auto;scrollbar-width:none;padding:20px 24px 120px}
.home-scroll::-webkit-scrollbar{display:none}
.greeting{margin-bottom:20px}
.greeting-text{font-size:18px;font-weight:600;color:#EFEFEF;letter-spacing:-0.02em;line-height:1.3}
.greeting-sub{font-size:13px;color:#888;margin-top:4px}
.my-card{width:100%;height:56px;background:#111;border-radius:14px;border:1px solid #333333;position:relative;overflow:hidden;cursor:pointer;margin-bottom:16px;transition:border-color 0.2s, height 0.35s cubic-bezier(0.4,0,0.2,1)}
.my-card.expanded{height:140px}
.my-card:hover{border-color:#3A3A3A}
.mc-collapsed{position:absolute;inset:0;display:flex;align-items:center;padding:0 14px;gap:10px;pointer-events:none}
.mc-collapsed-avatar{width:32px;height:32px;border-radius:50%;background:#242424;border:1.5px solid #333333;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#888;flex-shrink:0;overflow:hidden}
.mc-collapsed-info{flex:1;min-width:0}
.mc-collapsed-name{font-size:15px;font-weight:600;color:#EFEFEF;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mc-collapsed-role{font-size:12px;color:#999;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mc-edit-btn{position:absolute;right:12px;top:50%;transform:translateY(-50%);background:#242424;border:1px solid #333333;border-radius:8px;padding:5px 10px;font-size:12px;color:#AAA;font-weight:600;cursor:pointer;font-family:'DM Sans',sans-serif;transition:all 0.2s;white-space:nowrap;z-index:2}
.mc-edit-btn:hover{border-color:#999;color:#EFEFEF}
.my-card .mc-expanded{opacity:0;pointer-events:none;transition:opacity 0.2s}
.my-card.expanded .mc-expanded{opacity:1;pointer-events:auto}
.my-card.expanded .mc-collapsed{opacity:0}
.my-card:hover{border-color:#888}
.mc-name{position:absolute;top:18px;left:18px;font-size:16px;font-weight:700;color:#EFEFEF;letter-spacing:-0.02em}
.mc-title{position:absolute;top:38px;left:18px;font-size:11px;color:#AAA}
.mc-company{position:absolute;top:52px;left:18px;font-size:11px;color:#999}
.mc-divider{position:absolute;top:74px;left:18px;right:18px;height:1px;background:#282828}
.mc-email{position:absolute;top:84px;left:18px;font-size:11px;color:#888}
.mc-phone{position:absolute;top:98px;left:18px;font-size:11px;color:#888}
.mc-edit{position:absolute;top:14px;right:14px;background:#242424;border:1px solid #333333;border-radius:8px;padding:4px 10px;font-size:11px;color:#AAA;font-weight:600;cursor:pointer;font-family:'DM Sans',sans-serif;transition:all 0.2s}
.mc-edit:hover{border-color:#999;color:#EFEFEF}
.section-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.see-all{font-size:12px;color:#888;cursor:pointer;transition:color 0.2s}
.see-all:hover{color:#888}
.followup-list{display:flex;flex-direction:column;gap:8px;margin-bottom:20px}
.fi-item{display:flex;align-items:center;gap:12px;background:#111;border:1px solid #282828;border-radius:14px;padding:12px 14px;cursor:pointer;transition:border-color 0.2s}
.fi-item:hover{border-color:#888}
.fi-avatar{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex-shrink:0}
.fi-info{flex:1;min-width:0}
.fi-name{font-size:15px;font-weight:600;color:#EFEFEF}
.fi-reason{font-size:12px;color:#999;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fi-act{background:#242424;border:1px solid #333333;border-radius:8px;padding:5px 10px;font-size:11px;color:#888;font-weight:600;white-space:nowrap;cursor:pointer;font-family:'DM Sans',sans-serif;transition:all 0.2s;flex-shrink:0}
.fi-act:hover{border-color:#999;color:#EFEFEF}
.ai-badge-pill{display:inline-flex;align-items:center;gap:5px;background:#fff;color:#000;font-size:11px;font-weight:700;padding:3px 8px;border-radius:20px;letter-spacing:0.05em}
.bottom-actions{position:absolute;bottom:0;left:0;right:0;padding:12px 24px 36px;background:linear-gradient(180deg,transparent 0%,#161616 25%);display:flex;gap:12px;z-index:20}
.action-btn{flex:1;height:54px;border-radius:16px;border:none;font-family:'DM Sans',sans-serif;font-size:15px;font-weight:600;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:transform 0.15s,background 0.15s;letter-spacing:-0.01em}
.action-btn:active{transform:scale(0.97)}
.btn-exchange{background:#fff;color:#000}
.btn-exchange:hover{background:#eee}
/* Dark-mode default: button bg is white, so logo strokes/dot must be DARK
   to remain visible (the SVG inline attributes set them to white, which
   would be invisible against the white button). */
.btn-exchange [data-ring]{stroke:#000 !important}
.btn-exchange [data-dot]{fill:#000 !important}
.btn-scan-home{background:#fff;color:#000}
.btn-scan-home:hover{background:#eee}

/* ════════════════════════════════════════
   SETTINGS (in drawer)
════════════════════════════════════════ */
.drawer-overlay{position:absolute;inset:0;background:rgba(0,0,0,0.6);z-index:40;opacity:0;pointer-events:none;transition:opacity 0.3s;border-radius:54px}
.drawer-overlay.open{opacity:1;pointer-events:auto}
.drawer{position:absolute;top:0;right:0;width:240px;height:100%;background:#0F0F0F;border-left:1px solid #282828;border-radius:0 54px 54px 0;z-index:50;transform:translateX(100%);transition:transform 0.35s cubic-bezier(0.4,0,0.2,1);display:flex;flex-direction:column;padding:56px 0 40px}
.drawer.open{transform:translateX(0)}
.drawer-header{padding:0 24px 24px;border-bottom:1px solid #242424;margin-bottom:8px;display:flex;align-items:center;gap:8px}
.drawer-logo-name{font-size:15px;font-weight:700;color:#EFEFEF;letter-spacing:-0.03em}
.drawer-item{display:flex;align-items:center;gap:12px;padding:14px 24px;cursor:pointer;transition:background 0.15s}
.drawer-item:hover{background:#202020}
.d-icon{width:32px;height:32px;background:#242424;border:1px solid #333333;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.d-label{font-size:15px;font-weight:500;color:#ccc}
.drawer-divider{height:1px;background:#242424;margin:8px 24px}
.drawer-logout{margin-top:auto;padding:14px 24px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:background 0.15s}
.drawer-logout:hover{background:#1A0A0A}
.drawer-logout span{font-size:15px;font-weight:500;color:#E05555}

/* ════════════════════════════════════════
   WALLET
════════════════════════════════════════ */
/* #wallet background: handled by .page rule + light-mode override */
.wallet-topbar{padding:48px 20px 12px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.wallet-title-row{display:flex;align-items:center;gap:8px}
.wallet-title{font-size:15px;font-weight:700;color:#EFEFEF;letter-spacing:-0.03em}
.wallet-actions{display:flex;gap:8px}
.edit-btn-sm{height:34px;padding:0 14px;background:#202020;border:1.5px solid #333333;border-radius:10px;color:#888;font-size:13px;font-weight:600;cursor:pointer;font-family:'DM Sans',sans-serif;transition:all 0.2s}
.edit-btn-sm:hover{border-color:#888;color:#EFEFEF}
.edit-btn-sm.active{border-color:#EFEFEF;color:#EFEFEF;background:#242424}
.search-wrap{padding:0 20px 14px;flex-shrink:0}
.search-inner{position:relative}
.search-inner input{width:100%;height:44px;background:#1E1E1E;border:1.5px solid #333333;border-radius:12px;color:#EFEFEF;font-family:'DM Sans',sans-serif;font-size:15px;padding:0 16px 0 40px;outline:none;transition:border-color 0.2s;-webkit-appearance:none}
.search-inner input::placeholder{color:#888}
.search-inner input:focus{border-color:#999}
.search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);pointer-events:none;color:#888}
.wallet-scroll{flex:1;overflow-y:auto;scrollbar-width:none;padding:8px 20px 32px}
.wallet-scroll::-webkit-scrollbar{display:none}
.section-header2{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;margin-top:20px}
.section-sub{font-size:11px;color:#888}
.folder-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:4px}
.folder-item{display:flex;flex-direction:column;align-items:center;gap:8px;cursor:pointer;position:relative;touch-action:none}
.folder-item:hover{opacity:0.8}
.folder-box{width:88px;height:88px;border-radius:22px;background:#1E1E1E;border:1.5px solid #2C2C2C;display:flex;align-items:center;justify-content:center;transition:border-color 0.15s;position:relative}
.folder-item:hover .folder-box{border-color:#383838}
.folder-item.drop-target .folder-box{border-color:#EFEFEF;background:#282828;transform:scale(1.06)}
.folder-count{position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;background:#fff;color:#000;font-size:11px;font-weight:700;border-radius:9px;display:flex;align-items:center;justify-content:center;padding:0 4px}
.folder-name{font-size:12px;font-weight:500;color:#AAA;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:88px}
.folder-grid.edit-mode .folder-item:not(.add-btn){animation:wiggle 0.4s ease-in-out infinite alternate}
@keyframes wiggle{from{transform:rotate(-1.5deg)}to{transform:rotate(1.5deg)}}
.delete-badge{position:absolute;top:-6px;left:-6px;z-index:5;width:20px;height:20px;background:#E05555;border-radius:50%;display:none;align-items:center;justify-content:center;font-size:16px;color:#EFEFEF;font-weight:300;line-height:1;cursor:pointer}
.folder-grid.edit-mode .delete-badge{display:flex}
.folder-item.add-btn .folder-box{border-style:dashed;border-color:#333333}
.folder-item.add-btn:hover .folder-box{border-color:#999}
.folder-item.add-btn .folder-name{color:#888}
.ai-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.ai-folder{background:#111;border:1px solid #282828;border-radius:14px;padding:14px 10px;cursor:pointer;transition:border-color 0.2s;display:flex;flex-direction:column;gap:6px;min-height:88px;justify-content:center}
.ai-folder:hover{border-color:#888}
.ai-folder-name{font-size:12px;font-weight:600;color:#888}
.ai-folder-count{font-size:11px;color:#888}

/* ════════════════════════════════════════
   SETTINGS PAGE
════════════════════════════════════════ */
/* #settings background: handled by .page rule + light-mode override */
.settings-topbar{padding:48px 20px 12px;display:flex;align-items:center;gap:12px;flex-shrink:0}
.settings-title{font-size:16px;font-weight:700;color:#EFEFEF;letter-spacing:-0.02em}
.settings-scroll{flex:1;overflow-y:auto;scrollbar-width:none;padding:0 20px 40px}
.settings-scroll::-webkit-scrollbar{display:none}
.profile-card{background:#111;border:1px solid #282828;border-radius:18px;padding:18px 16px;display:flex;align-items:center;gap:14px;margin-bottom:24px;cursor:pointer;transition:border-color 0.2s}
.profile-card:hover{border-color:#888}
.profile-avatar-s{width:52px;height:52px;border-radius:50%;background:#1A2A1E;color:#6BAF7A;display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:700;flex-shrink:0;border:2px solid #333333}
.profile-info-s{flex:1;min-width:0}
.profile-name-s{font-size:16px;font-weight:700;color:#EFEFEF;letter-spacing:-0.02em}
.profile-email-s{font-size:13px;color:#999;margin-top:2px}
.profile-edit-s{background:#242424;border:1.5px solid #333333;border-radius:9px;padding:6px 14px;font-size:13px;font-weight:600;color:#888;cursor:pointer;font-family:'DM Sans',sans-serif;transition:all 0.2s}
.profile-edit-s:hover{border-color:#999;color:#EFEFEF}
.s-section{margin-bottom:20px}
.s-section-label{font-size:11px;font-weight:600;color:#888;letter-spacing:0.15em;text-transform:uppercase;margin-bottom:8px;padding-left:4px}
.setting-block{background:#111;border:1px solid #282828;border-radius:16px;overflow:hidden}
.setting-row{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid #202020;cursor:pointer;transition:background 0.15s}
.setting-row:last-child{border-bottom:none}
.setting-row:hover{background:#202020}
.setting-row.danger:hover{background:#1A0A0A}
.row-icon{width:30px;height:30px;border-radius:8px;background:#242424;border:1px solid #2C2C2C;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.row-icon.di{background:#1A0808;border-color:#2A1010}
.row-content{flex:1;min-width:0}
.row-label{font-size:15px;font-weight:500;color:#ccc}
.row-label.danger{color:#E05555}
.row-sub-s{font-size:12px;color:#888;margin-top:1px}
.row-right-s{display:flex;align-items:center;gap:8px;flex-shrink:0}
.row-value-s{font-size:13px;color:#888}
.row-chev{color:#333333}
.toggle{width:38px;height:22px;border-radius:11px;background:#333333;position:relative;cursor:pointer;transition:background 0.25s;flex-shrink:0}
.toggle.on{background:#fff}
.toggle-knob{position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#555;transition:transform 0.25s,background 0.25s}
.toggle.on .toggle-knob{transform:translateX(16px);background:#000}
.version-txt{text-align:center;font-size:12px;color:#333333;margin-top:12px;letter-spacing:0.08em}

/* ════════════════════════════════════════
   EXCHANGE PAGE
════════════════════════════════════════ */
#exchange { background: #050505; }
.carousel-wrap{position:absolute;left:0;right:0;top:50%;transform:translateY(-55%);height:230px;z-index:10;transition:top 0.52s cubic-bezier(0.4,0,0.2,1),transform 0.52s;overflow:hidden;touch-action:pan-y;}
.carousel-wrap.activated{top:96px;transform:translateY(0) scale(0.92)}
.carousel-track{position:absolute;top:0;left:0;height:185px;display:flex;align-items:center}
.card-slot{flex-shrink:0;width:300px;height:185px;padding:0 10px;display:flex;align-items:center;justify-content:center;pointer-events:auto}
.biz-card{width:100%;height:100%;border-radius:20px;position:relative;overflow:hidden;cursor:pointer;box-shadow:0 16px 48px rgba(0,0,0,0.7),0 0 0 1px rgba(255,255,255,0.07);transform:scale(0.91);filter:brightness(0.45);transition:transform 0.32s cubic-bezier(0.4,0,0.2,1),filter 0.32s,box-shadow 0.32s}
.card-slot.active .biz-card{transform:scale(1);filter:brightness(1);box-shadow:0 24px 64px rgba(0,0,0,0.85),0 0 0 1px rgba(255,255,255,0.1)}
.bc0{background:linear-gradient(135deg,#1C1C1C 0%,#0D0D0D 100%)}
.bc1{background:linear-gradient(135deg,#0D1828 0%,#080D14 100%)}
.bc2{background:linear-gradient(135deg,#1A0D0D 0%,#0D0808 100%)}
.bc-inner{padding:20px;height:100%;display:flex;flex-direction:column;justify-content:space-between}
.bc-top{display:flex;justify-content:space-between;align-items:flex-start}
.bc-name{font-size:16px;font-weight:700;color:#EFEFEF;letter-spacing:-0.03em}
.bc-role{font-size:12px;color:rgba(255,255,255,0.4);margin-top:3px}
.bc-logo{width:28px;height:20px;opacity:0.55}
.bc-bottom{display:flex;justify-content:space-between;align-items:flex-end}
.bc-email{font-size:11px;color:rgba(255,255,255,0.3)}
.bc-company{font-size:13px;font-weight:600;color:rgba(255,255,255,0.5);letter-spacing:0.06em}
.ex-dots{position:absolute;left:50%;transform:translateX(-50%);display:flex;gap:0;align-items:center;z-index:20;bottom:204px;transition:bottom 0.45s cubic-bezier(0.4,0,0.2,1)}
.ex-dots.activated{bottom:40px}
.ex-dot{width:28px;height:28px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.ex-dot-inner{width:6px;height:6px;border-radius:50%;background:rgba(255,255,255,0.22);transition:all 0.3s cubic-bezier(0.4,0,0.2,1);pointer-events:none}
.ex-dot.active .ex-dot-inner{background:#fff;width:18px;border-radius:3px}
.ex-hint{position:absolute;left:50%;transform:translateX(-50%);bottom:178px;font-size:13px;color:rgba(255,255,255,0.22);white-space:nowrap;z-index:20;transition:opacity 0.3s}
.ex-hint.hidden{opacity:0;pointer-events:none}
.ex-panel{position:absolute;left:0;right:0;bottom:0;height:62%;display:flex;flex-direction:column;align-items:center;padding:24px 32px 56px;z-index:5;opacity:0;pointer-events:none;transform:translateY(32px);transition:opacity 0.42s cubic-bezier(0.4,0,0.2,1),transform 0.42s}
.ex-panel.visible{opacity:1;pointer-events:auto;transform:translateY(0)}
.mode-toggle{display:flex;gap:5px;margin-bottom:32px;background:rgba(255,255,255,0.05);border-radius:12px;padding:4px}
.mode-btn{padding:7px 22px;border-radius:9px;font-size:13px;font-weight:600;cursor:pointer;color:rgba(255,255,255,0.35);border:none;background:none;font-family:'DM Sans',sans-serif;letter-spacing:0.04em;transition:all 0.22s}
.mode-btn.active{background:#fff;color:#000}
.nfc-wrap2{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center}
.nfc-rings2{position:relative;width:130px;height:130px;display:flex;align-items:center;justify-content:center;margin-bottom:10px}
.nfc-ring2{position:absolute;border-radius:50%;border:1.5px solid rgba(255,255,255,0.12);animation:ringE 2.4s ease-out infinite}
.nfc-ring2:nth-child(1){width:38px;height:38px;animation-delay:0s}
.nfc-ring2:nth-child(2){width:66px;height:66px;animation-delay:0.45s}
.nfc-ring2:nth-child(3){width:96px;height:96px;animation-delay:0.9s}
.nfc-ring2:nth-child(4){width:124px;height:124px;animation-delay:1.35s}
@keyframes ringE{0%{opacity:0.55;transform:scale(0.82)}70%{opacity:0.12;transform:scale(1)}100%{opacity:0}}
.nfc-center2{width:34px;height:34px;border-radius:50%;background:#fff;z-index:2;display:flex;align-items:center;justify-content:center;box-shadow:0 0 24px rgba(255,255,255,0.18)}
.qr-wrap2{flex:1;display:none;flex-direction:column;align-items:center;justify-content:center}
.qr-wrap2.visible{display:flex}
.nfc-wrap2.hidden{display:none}
.qr-box2{width:150px;height:150px;background:#fff;border-radius:14px;padding:12px;display:grid;grid-template-columns:repeat(7,1fr);gap:2.5px}
.qr-cell2{border-radius:1.5px}
.wait-txt{font-size:15px;font-weight:500;color:rgba(255,255,255,0.35);margin-top:22px;letter-spacing:0.02em}
.wait-dots span{animation:blink2 1.5s ease-in-out infinite}
.wait-dots span:nth-child(2){animation-delay:0.2s}
.wait-dots span:nth-child(3){animation-delay:0.4s}
@keyframes blink2{0%,80%,100%{opacity:0.2}40%{opacity:1}}
.dismiss-hint{font-size:12px;color:rgba(255,255,255,0.13);margin-top:20px;letter-spacing:0.05em}
.ex-state-label{position:absolute;top:58px;left:50%;transform:translateX(-50%);font-size:15px;font-weight:600;color:rgba(255,255,255,0.45);letter-spacing:0.02em;z-index:30;white-space:nowrap;transition:opacity 0.3s}

/* ════════════════════════════════════════
   SCAN PAGE
════════════════════════════════════════ */
#scan { background: #000; }
.scan-camera-bg{position:absolute;inset:0;background:radial-gradient(ellipse at 30% 40%,rgba(255,255,255,0.015) 0%,transparent 50%),radial-gradient(ellipse at 70% 60%,rgba(255,255,255,0.01) 0%,transparent 40%),#080808;z-index:0}
.scan-topbar{position:relative;z-index:10;padding:52px 20px 0;display:flex;align-items:center;gap:12px}
.scan-back{width:36px;height:36px;background:rgba(255,255,255,0.08);border:1px solid rgba(255,255,255,0.12);border-radius:10px;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background 0.2s;flex-shrink:0}
.scan-back:hover{background:rgba(255,255,255,0.14)}
.scan-title-txt{font-size:16px;font-weight:600;color:#EFEFEF;letter-spacing:-0.02em}
.scan-sub-txt{font-size:12px;color:rgba(255,255,255,0.35);margin-top:1px}
.scan-area2{position:relative;z-index:5;flex:1;display:flex;align-items:center;justify-content:center}
.scan-frame-w{position:relative;width:300px;height:175px}
.sc-corner{position:absolute;width:28px;height:28px}
.sc-corner.tl{top:0;left:0;border-top:3px solid #fff;border-left:3px solid #fff;border-radius:6px 0 0 0}
.sc-corner.tr{top:0;right:0;border-top:3px solid #fff;border-right:3px solid #fff;border-radius:0 6px 0 0}
.sc-corner.bl{bottom:0;left:0;border-bottom:3px solid #fff;border-left:3px solid #fff;border-radius:0 0 0 6px}
.sc-corner.br{bottom:0;right:0;border-bottom:3px solid #fff;border-right:3px solid #fff;border-radius:0 0 6px 0}
.sc-frame-b{position:absolute;inset:0;border:1px solid rgba(255,255,255,0.08);border-radius:4px;pointer-events:none}
/* Scan-line animation removed — caused a "play arrow" look during permission prompt. */
.sc-line{display:none}

/* iOS Safari shows a native ▶ play button on <video> until a stream attaches.
   Hide all native controls so the camera prompt phase looks clean. */
#scanVideo::-webkit-media-controls,
#scanVideo::-webkit-media-controls-start-playback-button,
#scanVideo::-webkit-media-controls-play-button,
#scanVideo::-webkit-media-controls-overlay-play-button { display: none !important; -webkit-appearance: none !important; }
#scanVideo { pointer-events: none; }
@keyframes scMove{0%{top:12px;opacity:0}8%{opacity:1}92%{opacity:1}100%{top:calc(100% - 12px);opacity:0}}
.sc-badge{position:absolute;bottom:-38px;left:50%;transform:translateX(-50%);background:#fff;color:#000;font-size:12px;font-weight:700;padding:6px 16px;border-radius:20px;white-space:nowrap;display:flex;align-items:center;gap:6px;animation:scBadge 2.4s ease-in-out infinite;box-shadow:0 4px 20px rgba(255,255,255,0.15)}
.sc-badge-dot{width:6px;height:6px;border-radius:50%;background:#161616;animation:dotBl 2.4s ease-in-out infinite}
@keyframes scBadge{0%,35%{opacity:0;transform:translateX(-50%) translateY(6px) scale(0.9)}48%,88%{opacity:1;transform:translateX(-50%) translateY(0) scale(1)}100%{opacity:0;transform:translateX(-50%) translateY(-4px) scale(0.95)}}
@keyframes dotBl{0%,100%{opacity:1}50%{opacity:0.3}}
.scan-hint2{position:relative;z-index:10;text-align:center;font-size:13px;color:rgba(255,255,255,0.3);letter-spacing:0.05em;margin-bottom:8px}
.scan-bottom{position:relative;z-index:10;padding:0 32px 52px;display:flex;flex-direction:column;align-items:center;gap:12px}
.scan-row{display:flex;gap:16px;align-items:center;justify-content:center;width:100%}
.scan-pill{display:flex;flex-direction:column;align-items:center;gap:8px;cursor:pointer;transition:opacity 0.2s}
.scan-pill:hover{opacity:0.7}
.scan-pill-icon{width:52px;height:52px;background:rgba(255,255,255,0.08);border:1px solid rgba(255,255,255,0.12);border-radius:16px;display:flex;align-items:center;justify-content:center;transition:background 0.2s}
.scan-pill:hover .scan-pill-icon{background:rgba(255,255,255,0.12)}
.scan-pill-label{font-size:12px;color:rgba(255,255,255,0.4);font-weight:500}
.scan-cancel{background:none;border:none;color:rgba(255,255,255,0.4);font-family:'DM Sans',sans-serif;font-size:15px;font-weight:500;cursor:pointer;transition:color 0.2s;letter-spacing:0.02em}
.scan-cancel:hover{color:rgba(255,255,255,0.7)}
.page { background: #161616; }
/* ── Light mode ── */
/* Only applies to logged-in screens, not splash/onboarding/login/register */

/* Smooth transition on bg + border only, never on SVG */
body.light-mode .page,
body.light-mode .contact-row,
body.light-mode .setting-block,
body.light-mode .fi-item,
body.light-mode .profile-card,
body.light-mode .folder-box,
body.light-mode .row-icon,
body.light-mode .d-icon,
body.light-mode .back-btn,
body.light-mode .edit-btn-sm,
body.light-mode .settings-btn,
body.light-mode .drawer {
  transition: background-color 0.55s ease, border-color 0.45s ease, color 0.45s ease !important;
}

/* Exclude pre-login pages from light mode */
/* splash 也支援淺色（user 要求一致性） */
body.light-mode #splash {
  background: #EBEBEB !important;
}
body.light-mode #splash [data-ring],
body.light-mode #splash svg [stroke="white"] { stroke: #1A1A1A !important; }
body.light-mode #splash [data-dot],
body.light-mode #splash svg [fill="white"] { fill: #1A1A1A !important; }
body.light-mode #splash .splash-logo circle { stroke: #1A1A1A !important; fill: none; }
body.light-mode #splash .splash-logo .center-dot { fill: #1A1A1A !important; stroke: none; }
body.light-mode #splash [style*="color:#fff"]:not([data-ring]):not([data-dot]) { color: #1A1A1A !important; }
/* loader fill bar: white→dark in light */
body.light-mode #splash .loader-fill { background: #1A1A1A !important; }
body.light-mode #splash .loader-track { background: #DDDDDD !important; }
/* onboarding / login / register: user 改變心意，要支援淺色 */
body.light-mode #onboarding,
body.light-mode #login,
body.light-mode #register {
  background: #EBEBEB !important;
}
/* onboarding 卡片 / notif-card 內元素 */
body.light-mode #onboarding [style*="background:#1A1A1A"],
body.light-mode #onboarding [style*="background:#111"] {
  background: #FFFFFF !important;
  border-color: #E0E0E0 !important;
}
/* login / register 表單 */
body.light-mode #login [style*="background:#161616"],
body.light-mode #login [style*="background:#1A1A1A"],
body.light-mode #login [style*="background:#111"],
body.light-mode #register [style*="background:#161616"],
body.light-mode #register [style*="background:#1A1A1A"],
body.light-mode #register [style*="background:#111"] {
  background: #FFFFFF !important;
  border-color: #DDDDDD !important;
}
body.light-mode #login input,
body.light-mode #register input {
  background: #FFFFFF !important;
  color: #1A1A1A !important;
  border-color: #CCCCCC !important;
}
body.light-mode #login input::placeholder,
body.light-mode #register input::placeholder { color: #999 !important; }
body.light-mode #login [style*="color:#fff"]:not([data-ring]):not([data-dot]),
body.light-mode #register [style*="color:#fff"]:not([data-ring]):not([data-dot]),
body.light-mode #onboarding [style*="color:#fff"]:not([data-ring]):not([data-dot]) { color: #1A1A1A !important; }
body.light-mode #login [style*="color:#888"],
body.light-mode #register [style*="color:#888"],
body.light-mode #onboarding [style*="color:#888"] { color: #666 !important; }
body.light-mode #login [style*="color:#666"],
body.light-mode #register [style*="color:#666"],
body.light-mode #onboarding [style*="color:#666"] { color: #777 !important; }
body.light-mode #login [style*="color:#555"],
body.light-mode #register [style*="color:#555"],
body.light-mode #onboarding [style*="color:#555"] { color: #888 !important; }
body.light-mode #login [style*="color:#444"],
body.light-mode #register [style*="color:#444"],
body.light-mode #onboarding [style*="color:#444"] { color: #999 !important; }
/* onboarding class-based colors (not inline, so attribute selectors miss) */
body.light-mode #onboarding .ob-title { color: #1A1A1A !important; }
body.light-mode #onboarding .ob-title em { color: #777 !important; }
body.light-mode #onboarding .ob-desc { color: #666 !important; }
body.light-mode #onboarding .ob-skip { color: #1A1A1A !important; }
/* onboarding 內部 class-based colors（非 inline，attribute selector 抓不到） */
body.light-mode #onboarding .ci-name { color: #1A1A1A !important; }
body.light-mode #onboarding .ci-role { color: #777 !important; }
body.light-mode #onboarding .ci-tag { background: #EEEEEE !important; color: #555 !important; }
body.light-mode #onboarding .nt-title { color: #1A1A1A !important; }
body.light-mode #onboarding .nt-body { color: #666 !important; }
/* splash 內 class-based */
body.light-mode #splash .splash-name { color: #1A1A1A !important; }
/* login / register: class-based 白字 */
body.light-mode #login .logo-name,
body.light-mode #register .logo-name,
body.light-mode #onboarding .logo-name { color: #1A1A1A !important; }
body.light-mode #login .auth-heading,
body.light-mode #register .auth-heading { color: #1A1A1A !important; }
body.light-mode #login .input-wrap input,
body.light-mode #register .input-wrap input {
  background: #FFFFFF !important;
  color: #1A1A1A !important;
  border-color: #DDDDDD !important;
}
/* Input labels (絕對定位的「Company Code」「選填」)：黑底→淺底 */
body.light-mode #login .input-label,
body.light-mode #register .input-label,
body.light-mode #login [style*="background:#0A0A0A"],
body.light-mode #register [style*="background:#0A0A0A"] {
  background: #EBEBEB !important;
  color: #888 !important;
}

/* ──────────────────────────────────────────────────────
   Comprehensive class-based color overrides for light mode
   (User: '不只這個吧 全部檢查一次')
   These classes have hard-coded color:#fff that broad
   inline-style attribute selectors miss.
   ────────────────────────────────────────────────────── */
body.light-mode .greeting-text { color: #1A1A1A !important; }
body.light-mode .mc-name,
body.light-mode .mac-name,
body.light-mode .mac-score-row,
body.light-mode .mc-collapsed-name { color: #1A1A1A !important; }
body.light-mode .c-name,
body.light-mode .ci-name,
body.light-mode .bc-name,
body.light-mode .fi-name { color: #1A1A1A !important; }
body.light-mode .profile-name-s { color: #1A1A1A !important; }
body.light-mode .wallet-title,
body.light-mode .settings-title { color: #1A1A1A !important; }
body.light-mode .modal-title { color: #1A1A1A !important; }
body.light-mode .kpi-val { color: #1A1A1A !important; }
body.light-mode .auth-heading { color: #1A1A1A !important; }
/* scan page bg always BLACK (camera), so text must stay WHITE in light mode too */
body.light-mode #scan .scan-title-txt { color: #ffffff !important; }
body.light-mode #scan .scan-sub-txt { color: rgba(255,255,255,0.5) !important; }
body.light-mode #scan [style*="color:#fff"] { color: #ffffff !important; }
body.light-mode #scan [style*="color:#888"] { color: #888 !important; }
body.light-mode #scan [style*="color:#666"] { color: #666 !important; }
body.light-mode #scan [style*="color:#555"] { color: #555 !important; }
body.light-mode #scan [style*="color:#444"] { color: #444 !important; }
body.light-mode #scan svg [stroke="white"] { stroke: #ffffff !important; }
body.light-mode #scan .back-btn {
  background: rgba(255,255,255,0.07) !important;
  border-color: rgba(255,255,255,0.1) !important;
}
body.light-mode #scan .back-btn svg polyline,
body.light-mode #scan .back-btn svg line { stroke: #FFFFFF !important; }

/* ── Scan-result sheet — force dark in BOTH modes (camera context).
   Some inline bgs were getting light-mode treatment from elsewhere; lock them. */
body.light-mode #scanResultOverlay,
body.light-mode #scanResultOverlay * { color-scheme: dark; }
body.light-mode #scanResultOverlay > div { background: #111 !important; border-top-color: #222 !important; }
body.light-mode #scanResultOverlay [style*="background:#161616"],
body.light-mode #scanResultOverlay [style*="background:#202020"],
body.light-mode #scanResultOverlay [style*="background:#1A1A1A"],
body.light-mode #scanResultOverlay [style*="background:#242424"] {
  background: #161616 !important;
}
body.light-mode #scanResultOverlay [style*="border:1px solid #242424"],
body.light-mode #scanResultOverlay [style*="border:1px solid #282828"] {
  border-color: #282828 !important;
}
/* All text inside scan result stays light on dark */
body.light-mode #scanResultOverlay [style*="color:#EFEFEF"],
body.light-mode #scanResultOverlay [style*="color:#fff"],
body.light-mode #scanResultOverlay [style*="color:#FFFFFF"] { color: #EFEFEF !important; }
body.light-mode #scanResultOverlay [style*="color:#888"] { color: #999 !important; }
body.light-mode #scanResultOverlay [style*="color:#AAA"],
body.light-mode #scanResultOverlay [style*="color:#aaa"] { color: #AAA !important; }
body.light-mode #scanResultOverlay [style*="color:#999"] { color: #999 !important; }
/* Buttons in result panel */
body.light-mode #scanResultOverlay button[style*="background:#fff"] { background: #fff !important; color: #000 !important; }
body.light-mode #scanResultOverlay button[style*="background:#242424"] { background: #242424 !important; color: #AAA !important; border-color: #333 !important; }
body.light-mode .logo-name,
body.light-mode .logo-btn-name,
body.light-mode .drawer-logo-name { color: #1A1A1A !important; }
body.light-mode .folder-item { color: #1A1A1A !important; }
body.light-mode .delete-badge { color: #FFFFFF !important; }  /* delete badge stays white on red */
body.light-mode .dash-period { color: #1A1A1A !important; }
body.light-mode .search-inner { color: #1A1A1A !important; }
body.light-mode .nav-btn.active { background: #1A1A1A !important; color: #FFFFFF !important; }
body.light-mode .modal-btn { color: #1A1A1A !important; }
/* hover states need light overrides */
body.light-mode .edit-btn-sm,
body.light-mode .edit-btn-sm:hover { color: #1A1A1A !important; }
body.light-mode .profile-edit-s:hover { color: #1A1A1A !important; }
body.light-mode .mc-edit:hover,
body.light-mode .mc-edit-btn:hover { color: #1A1A1A !important; }
body.light-mode .fi-act:hover { color: #1A1A1A !important; }
body.light-mode .search-tag-x:hover { color: #1A1A1A !important; }
body.light-mode .sub-link-btn { color: #555 !important; }
/* tpl-thumb is template card preview — let user-chosen colors show */
body.light-mode .tpl-thumb { color: revert !important; }
/* bg-preset is color picker swatches — preserve their inherent colors */
body.light-mode .bg-preset { color: revert !important; }
/* card scanner illustration corners (white in dark, need dark in light) */
body.light-mode #onboarding [class*="scanner"] svg path,
body.light-mode #onboarding [style*="border:2px solid"][style*="rgba(255,255,255"] {
  border-color: rgba(0,0,0,0.5) !important;
}
/* primary button: white→dark on light bg */
body.light-mode #login .btn-primary,
body.light-mode #register .btn-primary {
  background: #1A1A1A !important;
  color: #FFFFFF !important;
}
/* social login buttons */
body.light-mode #login .btn-social,
body.light-mode #register .btn-social {
  background: #FFFFFF !important;
  color: #1A1A1A !important;
  border-color: #DDDDDD !important;
}
/* SVG strokes in login/register that were white → dark in light
   Onboarding ILLUSTRATIONS are excluded (mock UI, dark by design) */
body.light-mode #login svg [stroke="white"],
body.light-mode #register svg [stroke="white"] { stroke: #1A1A1A !important; }
/* Google / Microsoft logos use fill="white" — flip them dark in light mode */
body.light-mode #login .btn-social svg [fill="white"],
body.light-mode #register .btn-social svg [fill="white"] { fill: #1A1A1A !important; }

/* Onboarding scanner frame corners + scan line: switch to dark in light mode
   (these are the page-level illustration frame, not "inside" content) */
body.light-mode #onboarding .sf-corner.tl,
body.light-mode #onboarding .sf-corner.tr,
body.light-mode #onboarding .sf-corner.bl,
body.light-mode #onboarding .sf-corner.br { border-color: #1A1A1A !important; }
body.light-mode #onboarding .sf-scan {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.5), transparent) !important;
}

/* Page indicator dots: white→dark, dark→light gray */
body.light-mode #onboarding .ob-dot { background: #CCCCCC !important; }
body.light-mode #onboarding .ob-dot.active { background: #1A1A1A !important; }

/* Onboarding ILLUSTRATIONS stay dark (they show "what app looks like")
   Revert the broad overrides that were hiding them */
body.light-mode #onboarding .card-item,
body.light-mode #onboarding .notif-card2,
body.light-mode #onboarding .iphone-ob,
body.light-mode #onboarding .iph-screen,
body.light-mode #onboarding .ai-badge2 {
  /* Use original dark backgrounds */
  background: #1A1A1A !important;
}
body.light-mode #onboarding .iph-screen { background: #0A0A0A !important; }
body.light-mode #onboarding .ai-badge2 { background: #fff !important; color: #000 !important; }
/* Names inside illustration cards stay WHITE (dark cards) */
body.light-mode #onboarding .ci-name { color: #fff !important; }
body.light-mode #onboarding .ci-role { color: #555 !important; }
body.light-mode #onboarding .ci-tag { background: #222 !important; color: #888 !important; }
body.light-mode #onboarding .nt-title { color: #fff !important; }
body.light-mode #onboarding .nt-body { color: #555 !important; }
body.light-mode #onboarding .nt-app,
body.light-mode #onboarding .nt-time { color: #888 !important; }
/* Loop icon (slide 2) stays white inside dark phone illustration */
body.light-mode #onboarding .loop-icon path,
body.light-mode #onboarding .loop-icon polyline { stroke: #fff !important; }
/* Mock notification badges */
body.light-mode #onboarding .sf-badge,
body.light-mode #onboarding .ai-badge-pill { background: #fff !important; color: #000 !important; }

/* ── Page backgrounds ── */
body.light-mode .page { background: #EBEBEB !important; }
body.light-mode .notch { background: #EBEBEB !important; }
body.light-mode .home-scroll,
body.light-mode .wallet-scroll,
body.light-mode .settings-scroll,
body.light-mode .scroll-body { background: #EBEBEB !important; }
body.light-mode .contact-row { background: #EBEBEB !important; }
body.light-mode .bottom-actions { background: linear-gradient(transparent, #EBEBEB 35%) !important; }
body.light-mode .card-mgmt-bar { background: #EFEFED !important; border-top-color: #DDDDD8 !important; }

/* ── Cards & containers ── */
body.light-mode .fi-item,
body.light-mode .setting-block,
body.light-mode .card-block,
body.light-mode .profile-card,
body.light-mode .folder-box { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode .folder-count,
body.light-mode .ai-folder-count-badge { background: #1A1A1A !important; color: #fff !important; }
body.light-mode .ai-folder { background: #FFFFFF !important; border-color: #CCCCCC !important; }

/* ── Row icons (settings) ── */
body.light-mode .row-icon { background: #F0F0F0 !important; border-color: #CCCCCC !important; }
body.light-mode .row-icon svg { stroke: #1A1A1A !important; }
body.light-mode .d-icon  { background: #F0F0F0 !important; border-color: #CCCCCC !important; }
body.light-mode .d-icon svg { stroke: #1A1A1A !important; }

/* ── Folder SVG icons ── */
body.light-mode .folder-box svg { stroke: #1A1A1A !important; }
body.light-mode .folder-box svg circle { stroke: #1A1A1A !important; fill: none !important; }
body.light-mode .folder-box svg path { stroke: #1A1A1A !important; fill: none !important; }
body.light-mode .folder-box svg line { stroke: #1A1A1A !important; }
body.light-mode .folder-box svg polyline { stroke: #1A1A1A !important; }
body.light-mode .folder-box svg polygon { stroke: #1A1A1A !important; fill: none !important; }
body.light-mode .folder-box svg rect { stroke: #1A1A1A !important; fill: none !important; }

/* ── Inputs ── */
body.light-mode .search-inner input,
body.light-mode .input-wrap input,
body.light-mode .modal-input { background: #FFFFFF !important; border-color: #CCCCCC !important; color: #1A1A1A !important; }
body.light-mode input::placeholder { color: #BBBBBB !important; }
body.light-mode .input-label { color: #777777 !important; background: #EBEBEB !important; }
body.light-mode .search-icon { color: #777777 !important; }

/* ── Buttons ── */
/* Back btn — white bg, dark border, dark arrow */
body.light-mode .back-btn { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode .back-btn svg polyline { stroke: #1A1A1A !important; }
body.light-mode .back-btn svg line { stroke: #1A1A1A !important; }

/* Settings gear btn */
body.light-mode .settings-btn { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode .settings-btn svg { stroke: #1A1A1A !important; }

/* Edit / small btns */
body.light-mode .edit-btn-sm { background: #FFFFFF !important; border-color: #CCCCCC !important; color: #1A1A1A !important; }
body.light-mode .more-btn { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode .more-btn svg circle { fill: #1A1A1A !important; }

/* fi-act (發信) button on followup cards */
body.light-mode .fi-act { background: #FFFFFF !important; border-color: #CCCCCC !important; color: #1A1A1A !important; }

/* mc-edit button on home card */
body.light-mode .mc-edit { background: #FFFFFF !important; border-color: #CCCCCC !important; color: #1A1A1A !important; }

/* profile edit button */
body.light-mode .profile-edit-s { background: #F0F0F0 !important; border-color: #CCCCCC !important; color: #1A1A1A !important; }

/* Action btns (exchange/scan) — keep dark */
body.light-mode .btn-exchange,
body.light-mode .btn-scan-home { background: #1A1A1A !important; color: #fff !important; }
body.light-mode .btn-exchange svg circle { stroke: #fff !important; }
body.light-mode .btn-exchange svg circle:last-child { fill: #fff !important; stroke: none !important; }
body.light-mode .btn-scan-home svg { stroke: #fff !important; }

/* ── Text ── */
body.light-mode .greeting-text,
body.light-mode .logo-btn-name,
body.light-mode .topbar-title,
body.light-mode .settings-title,
body.light-mode .auth-heading,
body.light-mode .c-name,
body.light-mode .cr-name,
body.light-mode .fi-name,
body.light-mode .mc-name,
body.light-mode .mc-title,
body.light-mode .mc-company,
body.light-mode .mc-email,
body.light-mode .mc-phone,
body.light-mode .folder-name,
body.light-mode .ai-folder-name,
body.light-mode .row-label,
body.light-mode .profile-name-s,
body.light-mode .profile-email-s,
body.light-mode .d-label,
body.light-mode .wallet-title { color: #1A1A1A !important; }

body.light-mode .greeting-sub,
body.light-mode .c-role,
body.light-mode .cr-role,
body.light-mode .fi-reason,
body.light-mode .c-time,
body.light-mode .cr-time,
body.light-mode .section-label,
body.light-mode .row-sub-s,
body.light-mode .ai-folder-count,
body.light-mode .section-sub,
body.light-mode .see-all,
body.light-mode .version-txt { color: #777777 !important; }

body.light-mode .row-chev,
body.light-mode .c-chevron { color: #CCCCCC !important; }

/* ── Logo SVG ── */
body.light-mode .logo-btn svg circle { stroke: #1A1A1A !important; fill: none !important; }
body.light-mode .logo-btn svg circle:last-child { fill: #1A1A1A !important; stroke: none !important; }

/* ── Toggle ── */
body.light-mode .toggle { background: #CCCCCC !important; }
body.light-mode .toggle.on { background: #1A1A1A !important; }
body.light-mode .toggle-knob { background: #999 !important; }
body.light-mode .toggle.on .toggle-knob { background: #fff !important; }

/* ── Dividers ── */
body.light-mode .home-indicator { background: #CCCCCC !important; }
body.light-mode .swipe-wrapper { border-color: #E8E8E8 !important; }
body.light-mode .div-line { background: #CCCCCC !important; }
body.light-mode .div-text { color: #777777 !important; }

/* ── Drawer ── */
body.light-mode .drawer { background: #E4E4E4 !important; border-color: #CCCCCC !important; }
body.light-mode .drawer-divider { background: #CCCCCC !important; }
body.light-mode .drawer-logo-name { color: #1A1A1A !important; }
body.light-mode .drawer-overlay { background: rgba(0,0,0,0.2) !important; }
body.light-mode .drawer-logout span { color: #E05555 !important; }

/* ── Modal ── */
body.light-mode .modal-box { background: #F5F5F5 !important; border-color: #CCCCCC !important; }
body.light-mode .modal-title { color: #1A1A1A !important; }
body.light-mode .modal-sub { color: #777777 !important; }
body.light-mode .modal-btn { color: #777777 !important; }
body.light-mode .modal-btn.primary { color: #1A1A1A !important; }
body.light-mode .modal-btn.danger { color: #E05555 !important; }
body.light-mode .modal-actions { border-color: #CCCCCC !important; }
body.light-mode .modal-divider-h { background: #CCCCCC !important; }
body.light-mode .modal-section-title { color: #777777 !important; }

/* ── Exchange + Scan always dark ── */
body.light-mode #exchange { background: #050505 !important; }
body.light-mode #scan { background: #000 !important; }

/* ── Hover states — light & readable ── */
body.light-mode .setting-row:hover { background: #E0E0E0 !important; }
body.light-mode .drawer-item:hover { background: #D8D8D8 !important; }
body.light-mode .contact-row:hover { background: #E4E4E4 !important; }

body.light-mode .search-tag { background: #fff !important; border-color: #CCC !important; color: #555 !important; }
body.light-mode .search-tag-x { background: #E0E0E0 !important; color: #888 !important; }

/* ── Contact detail quick action buttons ── */
body.light-mode .qa-btn-cd { background: #fff !important; border-color: #CCC !important; }
body.light-mode .qa-btn-cd:hover { background: #F0F0F0 !important; }
body.light-mode .qa-icon-cd { stroke: #1A1A1A !important; }
body.light-mode .qa-label-cd { color: #555 !important; }

/* ── Home page static dark wrappers (override inline styles) ── */
/* Name pill (top-right of greeting row) */
body.light-mode .home-mycard-pill { background: var(--bg-card) !important; border-color: var(--border) !important; }
body.light-mode .home-mycard-pill #homeMcAvatarSmall { background: var(--bg-elevated) !important; border-color: var(--border) !important; color: var(--text-faint) !important; }
body.light-mode .home-mycard-pill #homeMcNameSmall { color: var(--text-primary) !important; }

/* TapRadar block */
body.light-mode .tap-radar { background: var(--bg-card) !important; border-color: var(--border) !important; }
body.light-mode .tap-radar > div:first-child > span:nth-of-type(1) { color: var(--text-primary) !important; }
body.light-mode .tap-radar > div:first-child > span:nth-of-type(2) { color: var(--text-muted) !important; }
body.light-mode .tap-radar #agentInput { background: var(--bg-page) !important; border-color: var(--border) !important; color: var(--text-primary) !important; }
body.light-mode .tap-radar #agentInput::placeholder { color: var(--text-faint) !important; }
body.light-mode .tap-radar #voiceBtn svg { stroke: var(--text-faint) !important; }
body.light-mode .tap-radar button[onclick="runAgentSearch()"] { background: var(--bg-elevated) !important; border-color: var(--border) !important; }
body.light-mode .tap-radar button[onclick="runAgentSearch()"] svg { stroke: var(--text-primary) !important; }
body.light-mode .tap-radar #agentThinking,
body.light-mode .tap-radar #agentAnswer { background: var(--bg-page) !important; border-color: var(--border) !important; }
body.light-mode .tap-radar #agentThinking > div { color: var(--text-muted) !important; }
body.light-mode .tap-radar #agentAnswer > div:first-child { color: var(--text-muted) !important; }
body.light-mode .tap-radar #agentAnswerText { color: var(--text-primary) !important; }

/* Agent chips */
body.light-mode .agent-chip { background: var(--bg-page) !important; border-color: var(--border) !important; color: var(--text-muted) !important; }

/* Priority Card (今日首要) */
body.light-mode .priority-card { background: var(--bg-card) !important; border-color: var(--border) !important; }
body.light-mode .priority-card #pcName { color: var(--text-primary) !important; }
body.light-mode .priority-card #pcRole,
body.light-mode .priority-card #pcDays { color: var(--text-muted) !important; }
body.light-mode .priority-card .pc-ai-voice { background: var(--bg-page) !important; border-color: var(--border) !important; }
body.light-mode .priority-card #pcAngle { color: var(--text-primary) !important; }

/* Mini action cards (#2 #3) */
body.light-mode .mac-card { background: var(--bg-card) !important; border-color: var(--border) !important; }
body.light-mode .mac-card [id$="name"] { color: var(--text-primary) !important; }
body.light-mode .mac-card [id$="role"] { color: var(--text-muted) !important; }

/* Contact detail more menu (cdMenu) */
body.light-mode .cd-menu { background: var(--bg-card) !important; border-color: var(--border) !important; }
body.light-mode .cd-menu > div { color: var(--text-primary); }

/* Contact detail "聯絡資料" info block */
body.light-mode .cd-info-block { background: var(--bg-card) !important; border-color: var(--border) !important; }
body.light-mode .cd-info-block input { color: var(--text-primary) !important; }

/* ── ContactDetail 整頁 light mode 補強 ────────────────────── */
/* Page bg */
body.light-mode #contactDetail { background: var(--bg-page) !important; }
/* Hero name/title/company */
body.light-mode #cdName    { color: var(--text-primary) !important; }
body.light-mode #cdTitle   { color: var(--text-muted) !important; }
body.light-mode #cdCompany { color: var(--text-muted) !important; }
/* Hero avatar — green tint card looks fine in both */
/* Quick action buttons (信箱/電話/分享) */
body.light-mode #contactDetail .qa-btn-cd {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
}
body.light-mode #contactDetail .qa-btn-cd .qa-icon-cd { stroke: var(--text-primary) !important; }
body.light-mode #contactDetail .qa-btn-cd .qa-label-cd { color: var(--text-muted) !important; }
/* Info block (聯絡資料) row dividers + icon container */
body.light-mode #contactDetail .cd-info-block > div { border-bottom-color: #ECECEC !important; }
body.light-mode #contactDetail .cd-info-block > div > div:first-child {
  background: #F5F5F5 !important;
  border-color: var(--border) !important;
}
body.light-mode #contactDetail .cd-info-block > div > div:first-child svg { stroke: var(--text-muted) !important; }
body.light-mode #contactDetail .cd-info-block .flex-1 > div:first-child { color: var(--text-muted) !important; }
/* Save to Contacts button */
body.light-mode #cdSaveBtn {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}
/* AI Draft block container */
body.light-mode .cd-draft-block {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
}
body.light-mode .cd-draft-block > div:first-child > div:first-child { color: var(--text-muted) !important; }
body.light-mode #cdDraftPreview { color: var(--text-primary) !important; }
/* AI Draft action buttons row dividers */
body.light-mode .cd-draft-block button {
  color: var(--text-muted) !important;
  border-color: #ECECEC !important;
}
body.light-mode .cd-draft-block > div:last-child {
  border-top-color: #ECECEC !important;
}

/* ── Folder inner page ── */
body.light-mode #folderInner .back-btn svg polyline { stroke: #1A1A1A !important; }
body.light-mode #folderInner .edit-btn-sm { background: #fff !important; border-color: #CCC !important; color: #333 !important; }
body.light-mode #folderInner .search-inner input { background: #fff !important; border-color: #CCC !important; color: #1A1A1A !important; }

/* ── Contact detail info rows ── */
body.light-mode #contactDetail .card-block { background: #fff !important; border-color: #CCC !important; }
body.light-mode #contactDetail input { color: #1A1A1A !important; }
body.light-mode #contactDetail .section-label { color: #888 !important; }

/* ── Folder names ── */
body.light-mode .folder-name { color: #1A1A1A !important; }
body.light-mode .ai-folder-name { color: #1A1A1A !important; }

/* ── Settings topbar logo ── */
body.light-mode .settings-topbar .settings-title { color: #1A1A1A !important; }
body.light-mode .back-btn svg { stroke: #1A1A1A !important; }
body.light-mode .back-btn svg polyline { stroke: #1A1A1A !important; }

/* ── My Card compact (light mode) ── */
body.light-mode .my-card { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode .mc-collapsed-name { color: #1A1A1A !important; }
body.light-mode .mc-collapsed-role { color: #888 !important; }
body.light-mode .mc-collapsed-avatar { background: #F0F0F0 !important; border-color: #CCCCCC !important; color: #555 !important; }
body.light-mode .mc-edit-btn { background: #F0F0F0 !important; border-color: #CCCCCC !important; color: #555 !important; }
body.light-mode .mc-name { color: #1A1A1A !important; }
body.light-mode .mc-title { color: #777 !important; }
body.light-mode .mc-company { color: #888 !important; }
body.light-mode .mc-email { color: #888 !important; }
body.light-mode .mc-phone { color: #888 !important; }
body.light-mode .mc-divider { background: #E0E0E0 !important; }

/* ── Priority / follow-up cards ── */
body.light-mode #priorityCard { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode .fi-name { color: #1A1A1A !important; }
body.light-mode .mac-card { background: #FFFFFF !important; border-color: #CCCCCC !important; }
body.light-mode [style*="background:#111"] { background: #FFFFFF !important; }
body.light-mode [style*="background:#1A1A1A"] { background: #F0F0F0 !important; }
body.light-mode [style*="background:#141414"] { background: #F5F5F5 !important; }
body.light-mode [style*="background:#161616"] { background: #EFEFEF !important; }
body.light-mode [style*="color:#fff"]:not(.btn-exchange):not(.btn-scan-home):not([data-ring]):not([data-dot]):not(.prem-status-card *):not(.prem-status-card):not(.my-card *):not(.card-mgmt-preview *):not(#ccPreview *):not(#nc_ccPreview *):not(#ec_preview *):not(.cd-card *):not(.ex-card *):not(#homeCardPreview *):not(#scanResultOverlay *):not(.biz-card *):not(.biz-card) { color: #1A1A1A !important; }
body.light-mode [style*="color:#888"]:not(#homeCardPreview *):not(.biz-card *) { color: #777 !important; }
body.light-mode [style*="color:#555"]:not(#homeCardPreview *):not(.biz-card *) { color: #888 !important; }
body.light-mode [style*="color:#444"]:not(#homeCardPreview *):not(.biz-card *) { color: #999 !important; }
body.light-mode [style*="color:#333"]:not(#homeCardPreview *):not(.biz-card *) { color: #AAA !important; }
body.light-mode [style*="border:1px solid #2A2A2A"] { border-color: #CCCCCC !important; }
body.light-mode [style*="border:1px solid #1E1E1E"] { border-color: #E0E0E0 !important; }
body.light-mode [style*="border-color:#2A2A2A"] { border-color: #CCCCCC !important; }
body.light-mode [style*="border-bottom:1px solid #141414"] { border-color: #EBEBEB !important; }
body.light-mode [style*="border-bottom:1px solid #1E1E1E"] { border-color: #E0E0E0 !important; }

/* (splash 改為支援淺色，原本「restore to dark」block 已移除) */

/* ── Patch: missing color fallbacks for important readable text ── */
body.light-mode [style*="color:#ccc"]:not(.btn-exchange):not(.btn-scan-home):not([data-ring]):not([data-dot]):not(#homeCardPreview *):not(.biz-card *):not(#scanResultOverlay *) { color: #444 !important; }
body.light-mode [style*="color:#bbb"]:not(.btn-exchange):not(.btn-scan-home):not([data-ring]):not([data-dot]):not(#homeCardPreview *):not(.biz-card *):not(#scanResultOverlay *) { color: #555 !important; }
body.light-mode [style*="color:#aaa"]:not(.btn-exchange):not(.btn-scan-home):not([data-ring]):not([data-dot]):not(#homeCardPreview *):not(.biz-card *):not(#scanResultOverlay *) { color: #444 !important; }
body.light-mode [style*="color:#999"]:not(.btn-exchange):not(.btn-scan-home):not([data-ring]):not([data-dot]):not(#homeCardPreview *):not(.biz-card *):not(#scanResultOverlay *) { color: #666 !important; }
body.light-mode [style*="color:#666"]:not(.btn-exchange):not(.btn-scan-home):not([data-ring]):not([data-dot]):not(#homeCardPreview *):not(.biz-card *):not(#scanResultOverlay *) { color: #777 !important; }

/* ── Patch: priority-card "查看草稿" button (white-on-white regression fix) ── */
body.light-mode .priority-card button[onclick*="openPriorityContact"] {
  background: #1A1A1A !important;
  color: #fff !important;
}

/* ── Patch: contactDetail timeline first dot (white-on-white) ── */
body.light-mode .cd-tl-dot {
  background: #1A1A1A !important;
  border-color: #1A1A1A !important;
}

/* ── Patch: contactDetail AI badge / icon white squares (cdNotes + AI draft) ── */
body.light-mode .cd-ai-icon {
  background: #1A1A1A !important;
}
body.light-mode .cd-ai-icon svg {
  stroke: #FFFFFF !important;
}

/* ── Patch: wallet AI 人脈分析 hero card border (#222 not auto-covered) ── */
body.light-mode .wallet-ai-summary {
  background: #FFFFFF !important;
  border-color: #DDDDD8 !important;
}

/* ── Patch: dashboard AI Insights white card (no border in light mode) ── */
body.light-mode .dash-ai-insight {
  border: 1px solid #DDDDD8 !important;
  background: #FFFFFF !important;
}

/* ── Patch: settings layoutOpt rows — fix invisible #EFEFEF text in light mode ── */
body.light-mode .s-layout-opt {
  border-bottom-color: #E8E8E8 !important;
}
body.light-mode #layoutOpt1Name,
body.light-mode #layoutOpt2Name,
body.light-mode #layoutOpt3Name {
  color: var(--text-primary) !important;   /* was #EFEFEF — invisible on light card */
}
body.light-mode #layoutOpt1Sub,
body.light-mode #layoutOpt2Sub,
body.light-mode #layoutOpt3Sub {
  color: var(--text-muted) !important;     /* sub-label — keep muted but readable */
}
body.light-mode #layoutCheck1,
body.light-mode #layoutCheck2,
body.light-mode #layoutCheck3 {
  border-color: var(--border-strong) !important;
}

/* ── Patch: createCard page (整頁 light mode 補強) ── */
/* Page bg + header text */
body.light-mode #createCard { background: var(--bg-page) !important; }
body.light-mode #ccTitleText { color: var(--text-primary) !important; }
body.light-mode #ccSubText   { color: var(--text-muted) !important; }
/* Top "掃描匯入" button */
body.light-mode #createCard > div:first-of-type button {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}
/* Layout selector pills (左對齊/置中/右對齊/雙欄) */
body.light-mode #createCard .cc-layout {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}
body.light-mode #createCard .cc-layout.active {
  background: var(--bg-elevated) !important;
  border-color: var(--text-primary) !important;
  color: var(--text-primary) !important;
}
/* Form inputs (姓名/職稱/公司/email/電話/自訂) — input + floating label */
body.light-mode #createCard .cc-inp {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
}
body.light-mode #createCard .cc-inp::placeholder { color: var(--text-faint) !important; }
body.light-mode #createCard .cc-label,
body.light-mode #createCard .pos-rel > span {
  color: var(--text-muted) !important;
  background: var(--bg-page) !important;        /* floating label bg matches page */
}
/* Avatar / logo upload squares (target by the SVG inside since they share parent type) */
body.light-mode #createCard #ccAvatarIcon { stroke: var(--text-faint) !important; }
body.light-mode #createCard #ccLogoIcon   { stroke: var(--text-faint) !important; }
/* The avatar wrap div is the closest div ancestor of #ccAvatarIcon */
body.light-mode #createCard #ccLogoBtn {
  background: var(--bg-card) !important;
  border-color: var(--border-strong) !important;
}
/* Avatar wrap doesn't have an ID — match by being the parent containing #ccAvatarIcon */
body.light-mode #createCard #ccAvatarIcon {
  /* This selector ensures we target the icon styling */
}
/* "大頭貼" tiny label under upload */
body.light-mode #createCard div[style*="flex-direction:column"] > span { color: var(--text-muted) !important; }
/* THE BLACK BAR FIX: bottom gradient that anchors the 完成 button.
   Match by inline style substring — that's the only reliable selector. */
body.light-mode #createCard > div[style*="linear-gradient(180deg,transparent"] {
  background: linear-gradient(180deg, transparent 0%, var(--bg-page) 30%) !important;
}
/* Bottom 完成 button — keep dark on light bg as a strong CTA (intentional) */
/* (no change needed — looks good either way) */

/* ── Patch: contactDetail AI draft preview blur fade-out gradient ── */
body.light-mode .cd-draft-blur {
  background: linear-gradient(to bottom, transparent, #FFFFFF) !important;
}

/* ── Patch: contactDetail AI draft block 3-button divider (#1A1A1A borders) ── */
body.light-mode .cd-draft-block > div[style*="border-top:1px solid #1A1A1A"] {
  border-top-color: #EBEBEB !important;
}
body.light-mode .cd-draft-block button[style*="border-right:1px solid #1A1A1A"] {
  border-right-color: #EBEBEB !important;
}

/* ── Patch: cdMenu inner divider (between menu items) ── */
body.light-mode .cd-menu > div[style="height:1px;background:#1E1E1E"] {
  background: #EBEBEB !important;
}

/* ── Patch: loader screen (page transition) ── */
body.light-mode #loaderScreen { background: #EBEBEB !important; }
body.light-mode #loaderScreen [data-ring] { stroke: #1A1A1A !important; }

/* ── SVG logo (data-ring stroke=white) 在淺色模式下變黑：所有出現 logo 的地方
   除了底部 .btn-exchange / .btn-scan-home（白底圓圈本來就是 logo 用白色 stroke
   in dark mode AND light mode：白底深色按鈕內 logo 應該是白色 stroke）── */
body.light-mode [data-ring]:not(.btn-exchange [data-ring]):not(.btn-scan-home [data-ring]) { stroke: #1A1A1A !important; }
body.light-mode [data-dot]:not(.btn-exchange [data-dot]):not(.btn-scan-home [data-dot]) { fill: #1A1A1A !important; }
/* But: .btn-exchange and .btn-scan-home become DARK in light mode (per existing rule),
   so their logos should stay white. Override the above for these buttons: */
body.light-mode .btn-exchange [data-ring],
body.light-mode .btn-scan-home [data-ring] { stroke: #FFFFFF !important; }
body.light-mode .btn-exchange [data-dot],
body.light-mode .btn-scan-home [data-dot] { fill: #FFFFFF !important; }

/* ── QA Round 5: wallet .ai-badge-pill 白底 在 light mode 跟頁面背景融合 ── */
body.light-mode .ai-badge-pill {
  background: #1A1A1A !important;
  color: #FFFFFF !important;
}

/* ── QA Round 5: TapRadar voiceBtn SVG stroke #444 太淺 ── */
body.light-mode #voiceBtn svg { stroke: #1A1A1A !important; }

/* ── exchange 頁強制深色背景，但 back-btn / 底部說明文字需要在淺色模式對比正確 ── */
/* exchange 頁本身保持深色（per design），但內部 .back-btn 不該被 light-mode 規則蓋成淺色 */
body.light-mode #exchange { background: #050505 !important; }
body.light-mode #exchange .back-btn {
  background: rgba(255,255,255,0.07) !important;
  border-color: rgba(255,255,255,0.1) !important;
}
body.light-mode #exchange .back-btn svg polyline,
body.light-mode #exchange .back-btn svg line { stroke: #FFFFFF !important; }
body.light-mode #exchange [style*="color:#fff"]:not([data-ring]):not([data-dot]) { color: #FFFFFF !important; }
body.light-mode #exchange [style*="color:#888"] { color: #888 !important; }
body.light-mode #exchange [style*="color:#666"] { color: #666 !important; }
body.light-mode #exchange [style*="color:#555"] { color: #555 !important; }
body.light-mode #exchange [style*="color:#444"] { color: #444 !important; }

/* ── QA Round 5: contactDetail cdAiInsight 黑卡 (#080808) ── */
body.light-mode #cdAiInsight,
body.light-mode [style*="background:#080808"] {
  background: #F5F5F5 !important;
  border-color: #E0E0E0 !important;
}
body.light-mode [style*="background:#0D0D0D"] {
  background: #F5F5F5 !important;
}
body.light-mode [style*="background:#0F0F0F"] {
  background: #F5F5F5 !important;
}
body.light-mode #loaderScreen [data-dot]  { fill: #1A1A1A !important; }
body.light-mode #loaderScreen > div[style*="border:1.5px solid"] { border-color: rgba(0,0,0,0.08) !important; }

/* ── Patch: preserve danger (red) row-label color in light mode ── */
body.light-mode .row-label.danger { color: #E05555 !important; }
body.light-mode .modal-btn.danger { color: #E05555 !important; }

/* ── Patch: home preference radio circles (white-on-white when selected) ── */
body.light-mode [id^="layoutCheck"][style*="background"] {
  background: #1A1A1A !important;
  border-color: #1A1A1A !important;
}

/* ── Home page greeting & sub ── */
body.light-mode .greeting-sub { color: #888 !important; }
body.light-mode .see-all { color: #999 !important; }
body.light-mode .section-label { color: #888 !important; }

/* ── Bottom nav ── */
body.light-mode .nav-bottom { background: rgba(245,245,243,0.97) !important; border-top-color: #DDDDD8 !important; }
body.light-mode .nav-btn { color: #AAA !important; }
body.light-mode .nav-btn.active { color: #1A1A1A !important; }
body.light-mode .nav-btn svg { stroke: #AAA !important; }
body.light-mode .nav-btn.active svg { stroke: #1A1A1A !important; }

/* ── Dashboard ── */
body.light-mode #dashboard { background: #EBEBEB !important; }
body.light-mode .dash-period { background: #FFFFFF !important; border-color: #CCCCCC !important; color: #888 !important; }
body.light-mode .dash-period.active { background: #1A1A1A !important; color: #fff !important; border-color: #1A1A1A !important; }
body.light-mode .kpi-card { background: #FFFFFF !important; border-color: #DDDDD8 !important; }
body.light-mode .kpi-val { color: #1A1A1A !important; }
body.light-mode .kpi-label { color: #888 !important; }

/* ── CompanyDB ── */
body.light-mode #companyDB { background: #EBEBEB !important; }
body.light-mode #companyDB [style*="background:#0A0A0A"] { background: #EBEBEB !important; }
body.light-mode #companyDB [style*="background:#111"] { background: #FFFFFF !important; }

/* ── Subscription page ── */
/* Patch: subscriptionPage now supports light mode (was force-dark) */
body.light-mode #subscriptionPage { background: #EBEBEB !important; }
body.light-mode #subscriptionPage .scroll-body > div[style*="background:linear-gradient"] {
  /* Keep premium gold card golden (don't lighten it — it's the brand moment) */
  background: linear-gradient(135deg, #1A140A, #2A1E0A) !important;
}
body.light-mode #subscriptionPage .scroll-body > div[style*="background:#111"] {
  background: #FFFFFF !important;
  border-color: #E0E0E0 !important;
}
body.light-mode #subscriptionPage button[onclick*="startCancelFlow"] {
  border-color: #CCCCCC !important;
  color: #888 !important;
}
/* Whites OUTSIDE the gold gradient card: convert to dark.
   Whites INSIDE the gold gradient card (e.g. "247", "TapCard Premium"): keep white. */
body.light-mode #subscriptionPage > div span[style*="color:#fff"] { color: #1A1A1A !important; }
body.light-mode #subscriptionPage .scroll-body > div[style*="background:#111"] [style*="color:#fff"] { color: #1A1A1A !important; }

/* (cancel flow light-mode rules now live near .prem-status-card overrides) */
body.light-mode #cancelOverlay { background: transparent !important; }

/* ── Patch: Premium upgrade sheet (the slide-up modal) ── */
body.light-mode .premium-sheet {
  background: #FFFFFF !important;
  border-top-color: #E0E0E0 !important;
}
body.light-mode .premium-sheet-handle { background: #DDDDDD !important; }
body.light-mode .premium-sheet-title  { color: #1A1A1A !important; }
body.light-mode .premium-sheet-sub    { color: #777 !important; }
body.light-mode .premium-feat         { color: #444 !important; }
body.light-mode .premium-feat-icon    { background: #F0F0F0 !important; }
body.light-mode .premium-cancel       { color: #888 !important; }
/* Premium gold CTA stays gold in both modes (brand color) */

/* ── Patch: Premium welcome shimmer overlay (#premiumWelcome) ── */
body.light-mode #premiumWelcome { background: #EBEBEB !important; }
body.light-mode #premiumWelcome #wBefore,
body.light-mode #premiumWelcome #wAfter { color: #888 !important; }
body.light-mode #premiumWelcome #wName  { color: #1A1A1A !important; }

/* ── createCard / newCard / editCard: 啟用淺色模式（user 要求） ── */
body.light-mode #createCard,
body.light-mode #newCard,
body.light-mode #editCard {
  background: #EBEBEB !important;
}
/* createCard 頁內 dark inline elements → 淺色覆蓋 */
body.light-mode #createCard [style*="background:#161616"],
body.light-mode #createCard [style*="background:#1A1A1A"],
body.light-mode #createCard [style*="background:#111"],
body.light-mode #createCard [style*="background:#141414"],
body.light-mode #newCard [style*="background:#161616"],
body.light-mode #newCard [style*="background:#1A1A1A"],
body.light-mode #newCard [style*="background:#111"],
body.light-mode #editCard [style*="background:#161616"],
body.light-mode #editCard [style*="background:#1A1A1A"],
body.light-mode #editCard [style*="background:#111"] {
  background: #FFFFFF !important;
  border-color: #DDDDDD !important;
}
/* createCard inputs 在淺色下 */
body.light-mode #createCard input,
body.light-mode #newCard input,
body.light-mode #editCard input {
  background: #FFFFFF !important;
  color: #1A1A1A !important;
  border-color: #CCCCCC !important;
}
body.light-mode #createCard input::placeholder,
body.light-mode #newCard input::placeholder,
body.light-mode #editCard input::placeholder { color: #999 !important; }
/* section labels */
body.light-mode #createCard .section-label,
body.light-mode #newCard .section-label,
body.light-mode #editCard .section-label { color: #666 !important; }
/* Layout buttons (左對齊/置中/右對齊/雙欄) inactive state */
body.light-mode #createCard .cc-layout:not(.active),
body.light-mode #newCard .cc-layout:not(.active),
body.light-mode #editCard .cc-layout:not(.active) {
  background: #FFFFFF !important;
  border-color: #DDDDDD !important;
  color: #666 !important;
}
/* The "完成" button at bottom (white in dark mode → keep dark in light) */
body.light-mode #createCard button[onclick*="finishCreateCard"] {
  background: #1A1A1A !important;
  color: #FFFFFF !important;
}
/* createCard bottom 漸層遮罩 (預設 → #0A0A0A) 改成淺色 */
body.light-mode #createCard > div[style*="background:linear-gradient(180deg,transparent 0%,#0A0A0A"],
body.light-mode #createCard div[style*="linear-gradient"][style*="#0A0A0A"] {
  background: linear-gradient(180deg, transparent 0%, #EBEBEB 30%) !important;
}
/* Top section "建立你的第一張名片" */
body.light-mode #createCard [style*="color:#fff"]:not([data-ring]):not([data-dot]):not(#ccPreview *):not(#ccPreview) { color: #1A1A1A !important; }
body.light-mode #newCard [style*="color:#fff"]:not([data-ring]):not([data-dot]) { color: #1A1A1A !important; }
body.light-mode #editCard [style*="color:#fff"]:not([data-ring]):not([data-dot]) { color: #1A1A1A !important; }
body.light-mode #createCard [style*="color:#444"] { color: #888 !important; }
body.light-mode #newCard [style*="color:#444"] { color: #888 !important; }
body.light-mode #editCard [style*="color:#444"] { color: #888 !important; }
/* Card preview area itself stays dark (it's the user's card, not the page chrome) — preserved */

/* ── Card preview text colors are USER-CHOSEN for the card design,
   not affected by light/dark mode. Restore inline colors so JS-set
   text colors actually show. ── */
body.light-mode #ccPvName, body.light-mode #ccPvTitle, body.light-mode #ccPvComp,
body.light-mode #ccPvEmail, body.light-mode #ccPvPhone, body.light-mode #ccPvCustom,
body.light-mode [id^="nc_ccPv"], body.light-mode [id^="ec_ccPv"] {
  color: revert !important;
}
/* Card preview text uses USER-CHOSEN colors via inline style — they must not be
   overridden by the broad light-mode color rule. Re-affirm inline color. */
body.light-mode #ccPreview [style*="color:#fff"],
body.light-mode #nc_ccPreview [style*="color:#fff"],
body.light-mode #ec_preview [style*="color:#fff"],
body.light-mode .my-card [style*="color:#fff"],
body.light-mode .card-mgmt-preview [style*="color:#fff"] {
  color: #fff !important;
}
body.light-mode #ccPreview [style*="color:#ffffff"],
body.light-mode #nc_ccPreview [style*="color:#ffffff"],
body.light-mode #ec_preview [style*="color:#ffffff"],
body.light-mode .my-card [style*="color:#ffffff"],
body.light-mode .card-mgmt-preview [style*="color:#ffffff"] {
  color: #ffffff !important;
}

/* ── Onboarding preference page (#homeChoice) light-mode ── */
body.light-mode #homeChoice { background: #EBEBEB !important; }
body.light-mode #homeChoice [style*="color:#fff"] { color: #1A1A1A !important; }
body.light-mode #homeChoice [style*="color:#555"] { color: #666 !important; }
body.light-mode .choice-card { background: #FFFFFF !important; border-color: #E0E0E0 !important; }
body.light-mode .choice-card:hover, body.light-mode .choice-card:active {
  background: #F5F5F5 !important; border-color: #B0B0B0 !important;
}

/* ── Toast ── */
body.light-mode .toast-el { background: #1A1A1A !important; color: #fff !important; }

/* ── Home indicator ── */
body.light-mode .home-indicator { background: #CCCCCC !important; }

/* ── Wallet page headers ── */
body.light-mode .wallet-title { color: #1A1A1A !important; }
body.light-mode .wallet-topbar { background: #EBEBEB !important; }
body.light-mode .section-header2 .section-label { color: #888 !important; }
body.light-mode .section-sub { color: #AAA !important; }

/* ── Modal overlay ── */
.modal-overlay {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
  border-radius: 54px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  width: 300px; background: #202020;
  border: 1px solid #333333; border-radius: 20px; overflow: hidden;
  transform: scale(0.9) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.34,1.2,0.64,1);
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-title { font-size: 16px; font-weight: 700; color: #EFEFEF; padding: 18px 18px 4px; letter-spacing: -0.02em; }
.modal-sub   { font-size: 13px; color: #999; padding: 0 18px 14px; }
.modal-input {
  width: calc(100% - 36px); margin: 0 18px 14px; height: 44px;
  background: #111; border: 1.5px solid #333333; border-radius: 12px;
  color: #EFEFEF; font-family: 'DM Sans',sans-serif; font-size:15px;
  padding: 0 14px; outline: none; display: block; -webkit-appearance: none;
}
.modal-input:focus { border-color: #999; }
.modal-input::placeholder { color: #888; }
.modal-actions { display: flex; border-top: 1px solid #282828; }
.modal-btn {
  flex: 1; height: 48px; border: none; background: none;
  font-family: 'DM Sans',sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.15s; color: #888;
}
.modal-btn:hover { background: #282828; }
.modal-btn.primary { color: #EFEFEF; border-left: 1px solid #282828; }
.modal-btn.danger  { color: #E05555; }
.modal-section-title { font-size: 13px; font-weight: 600; color: #999; letter-spacing: 0.1em; text-transform: uppercase; padding: 14px 18px 6px; }
.modal-divider-h { height: 1px; background: #282828; margin: 0 18px; }

/* ── Dashboard ── */
.dash-period {
  padding: 7px 16px; border-radius: 20px;
  background: #202020; border: 1.5px solid #333333;
  color: #999; font-family: 'DM Sans',sans-serif;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.dash-period.active { background: #fff; color: #000; border-color: #EFEFEF; }
.dash-period:hover:not(.active) { border-color: #888; color: #888; }
.kpi-card {
  background: #111; border: 1px solid #282828;
  border-radius: 14px; padding: 14px;
}
.kpi-val { font-size: 26px; font-weight: 700; color: #EFEFEF; letter-spacing: -0.04em; line-height: 1; }
.kpi-label { font-size: 12px; color: #999; margin-top: 4px; font-weight: 500; }
.kpi-delta { font-size: 12px; font-weight: 600; margin-top: 6px; }
.kpi-delta.up { color: #4CAF50; }
.kpi-delta.down { color: #E05555; }
.kpi-delta.neutral { color: #888; }

/* Light mode dashboard */
body.light-mode .kpi-card { background: #fff !important; border-color: #DDD !important; }
body.light-mode .kpi-val { color: #111 !important; }
body.light-mode .kpi-label { color: #888 !important; }
body.light-mode .dash-period { background: #fff !important; border-color: #CCC !important; color: #888 !important; }
body.light-mode .dash-period.active { background: #111 !important; color: #fff !important; border-color: #111 !important; }

/* ── Card background & text presets ── */
.bg-preset {
  width: 38px; height: 38px; border-radius: 10px;
  border: 2px solid transparent; cursor: pointer; flex-shrink: 0;
  transition: border-color 0.15s, transform 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.bg-preset:hover { transform: scale(1.08); }
.bg-preset.active { border-color: #EFEFEF; }
.bg-upload { background: #202020; border: 1.5px dashed #333; }
.bg-upload:hover { border-color: #AAA; }
.txt-preset {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; flex-shrink: 0;
  transition: border-color 0.15s, transform 0.15s;
}
.txt-preset:hover { transform: scale(1.1); }
.txt-preset.active { border-color: #888; box-shadow: 0 0 0 2px #161616, 0 0 0 4px #888; }


/* ── Template thumbnails ─────────────────────────────────── */
.tpl-thumb {
  width: 80px; height: 50px; border-radius: 10px; flex-shrink: 0;
  cursor: pointer; position: relative; overflow: hidden;
  border: 2px solid transparent; transition: border-color 0.15s, transform 0.15s;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 6px 7px; box-sizing: border-box;
}
.tpl-thumb:hover { transform: scale(1.05); }
.tpl-thumb.active { border-color: #EFEFEF; box-shadow: 0 0 0 1px rgba(255,255,255,0.4); }
.tpl-thumb-name { font-size: 0px; color: transparent; }
.tpl-thumb-line { height: 3px; border-radius: 2px; margin-bottom: 2px; }
.tpl-thumb-line2 { height: 2px; border-radius: 1px; opacity: 0.6; }
.tpl-thumb-dot { width: 12px; height: 12px; border-radius: 50%; margin-bottom: 3px; }


.tpl-thumb {
  width:80px;height:50px;border-radius:10px;flex-shrink:0;cursor:pointer;
  position:relative;overflow:hidden;border:2px solid transparent;
  transition:border-color 0.15s,transform 0.15s;display:flex;
  flex-direction:column;justify-content:space-between;
  padding:7px 8px;box-sizing:border-box;
}
.tpl-thumb:hover{transform:scale(1.06);}
.tpl-thumb.active{border-color:#EFEFEF;box-shadow:0 0 0 1px rgba(255,255,255,0.3);}





/* ── Light mode: page titles & UI text ── */
body.light-mode .section-label { color: #333 !important; }
body.light-mode .back-btn { background: rgba(0,0,0,0.08) !important; border-color: rgba(0,0,0,0.12) !important; }
body.light-mode .back-btn svg { stroke: #333 !important; }
body.light-mode .nav-bottom { background: rgba(245,245,243,0.95) !important; border-top-color: #E0E0E0 !important; }
body.light-mode .nav-icon svg { stroke: #888 !important; }
body.light-mode .nav-icon.active svg { stroke: #111 !important; }
body.light-mode .drawer { background: #F5F5F3 !important; }
body.light-mode .d-label { color: #333 !important; }
body.light-mode .d-icon svg { stroke: #555 !important; }
body.light-mode .drawer-logo-name { color: #111 !important; }
body.light-mode .drawer-logout span { color: #E05555 !important; }
body.light-mode .drawer-divider { background: #DDD !important; }
body.light-mode .drawer-header { border-bottom-color: #E0E0E0 !important; }
body.light-mode [style*="font-size:16px"][style*="font-weight:700"][style*="color:#fff"] {
  color: #111 !important;
}
body.light-mode [style*="color:#444"][style*="margin-top:2px"] {
  color: #888 !important;
}
body.light-mode .cc-layout { background: #E8E8E4 !important; border-color: #CCC !important; color: #555 !important; }
body.light-mode .cc-layout.active { background: #333 !important; border-color: #333 !important; color: #fff !important; }
body.light-mode .card-add-btn { background: #F0F0EE !important; border-color: #DDD !important; color: #555 !important; }
body.light-mode .setting-row { background: #fff !important; border-color: #E8E8E8 !important; }
body.light-mode .row-label { color: #111 !important; }
body.light-mode .row-sub-s { color: #888 !important; }
body.light-mode .section-header { color: #111 !important; }


/* ══ CARD IMMUNE ZONE ══
   Background: set via JS setProperty('background', ..., 'important') — CSS cannot override.
   Text: the inner wrapper div has style="color:${tc}" (inline style).
   We must NOT use color:unset/inherit on card children — it breaks inline colors.
   Instead we use color:inherit which respects the cascade from the inline-styled wrapper. */
body.light-mode .my-card,
body.light-mode .card-mgmt-preview,
body.light-mode #ccPreview,
body.light-mode #nc_ccPreview,
body.light-mode #ec_preview {
  color: inherit;
}


/* ══ Premium Gold Theme ══ */
:root {
  --gold:     #E8C97A;
  --gold-mid: #D4A96B;
  --gold-dark:#C4806B;
  --premium-gradient: linear-gradient(90deg, #E8C97A 0%, #D4A96B 50%, #C4806B 100%);
}

/* Premium name gradient + shimmer */
.premium-name {
  background: var(--premium-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}
.premium-name::after {
  content: ' ✦';
  background: var(--premium-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 0.65em;
  vertical-align: middle;
}

/* Premium badge pill */
.premium-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(90deg, #E8C97A22, #C4806B22);
  border: 1px solid #E8C97A55;
  color: #E8C97A;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  letter-spacing: 0.06em;
}

/* Paywall modal */
.premium-modal-overlay {
  position: absolute; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.premium-modal-overlay.open {
  opacity: 1; pointer-events: auto;
}
.premium-sheet {
  width: 100%; background: #111;
  border-radius: 24px 24px 0 0;
  padding: 8px 24px 48px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  border-top: 1px solid #222;
}
.premium-modal-overlay.open .premium-sheet {
  transform: translateY(0);
}
.premium-sheet-handle {
  width: 36px; height: 4px; background: #333333;
  border-radius: 2px; margin: 12px auto 20px;
}
.premium-sheet-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg,#E8C97A22,#C4806B22);
  border: 1px solid #E8C97A44;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
}
.premium-sheet-title {
  font-size: 20px; font-weight: 700; color: #EFEFEF;
  text-align: center; margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.premium-sheet-sub {
  font-size: 15px; color: #AAA;
  text-align: center; line-height: 1.6;
  margin-bottom: 24px;
}
.premium-features {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 24px;
}
.premium-feat {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; color: #aaa;
}
.premium-feat-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: #242424; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; font-size: 15px;
}
.premium-cta {
  width: 100%; height: 52px;
  background: linear-gradient(90deg, #E8C97A, #C4806B);
  border: none; border-radius: 14px;
  color: #000; font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.premium-cancel {
  width: 100%; height: 44px; background: none;
  border: none; color: #888; font-size: 15px;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
}


/* ── Premium gold logo & text (applied after purchase) ── */
.gold-logo circle { stroke: url(#goldGrad) !important; }
.gold-logo .gold-dot { fill: #E8C97A !important; }
.gold-text { color: #E8C97A !important; }

/* Global gold gradient def — injected once in body */


/* ── aespa brand gradient ── */
.aespa-brand {
  background: linear-gradient(90deg, #6B8EC4, #9B6BC4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}


/* ── Mini action cards ─────────────────────────────────── */
.mac-card {
  background: #111; border: 1px solid #282828;
  border-radius: 16px; padding: 14px;
  cursor: pointer; transition: border-color 0.2s;
  display: flex; flex-direction: column; gap: 4px;
}
.mac-card:hover { border-color: #888; }
.mac-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 5px; display: inline-block;
  margin-bottom: 6px; width: fit-content; text-transform: uppercase;
}
.mac-badge.red    { background: #E0555515; color: #E05555; border: 1px solid #E0555530; }
.mac-badge.yellow { background: #F5C84215; color: #F5C842; border: 1px solid #F5C84230; }
.mac-badge.green  { background: #6BAF7A15; color: #6BAF7A; border: 1px solid #6BAF7A30; }
.mac-name { font-size: 16px; font-weight: 700; color: #EFEFEF; letter-spacing: -0.02em; }
.mac-sub { font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mac-score-row { display: flex; align-items: baseline; gap: 3px; margin-top: 6px; }
.mac-score-row span:first-child { font-size: 20px; font-weight: 700; color: #EFEFEF; }
.mac-label { font-size: 11px; color: #888; }

/* ── Priority contact card loading ─── */
#priorityCard { user-select: none; }


/* ── Home layout choice ─────────────────────────────────── */
.choice-card {
  background: #111; border: 1.5px solid #282828;
  border-radius: 18px; padding: 18px;
  cursor: pointer; transition: all 0.2s;
}
.choice-card:hover, .choice-card:active {
  border-color: #888; background: #202020;
  transform: scale(0.99);
}

/* ── AI Agent ────────────────────────────────────────────── */
.agent-chip {
  white-space: nowrap; flex-shrink: 0;
  background: #111; border: 1px solid #282828;
  border-radius: 20px; padding: 5px 12px;
  font-size: 13px; color: #999; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  transition: all 0.15s;
}
.agent-chip:hover { border-color: #888; color: #888; }

.thinking-dots { display: flex; gap: 3px; align-items: center; }
.thinking-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: #555; display: block;
  animation: tdot 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tdot {
  0%,80%,100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

.agent-match-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: #161616;
  border: 1px solid #242424; border-radius: 12px;
  cursor: pointer; transition: border-color 0.15s;
}
.agent-match-item:hover { border-color: #333333; }
.agent-match-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}


/* ══ Coach Mark / Spotlight System ═══════════════════════ */
#coachOverlay {
  position: absolute; inset: 0; z-index: 9000;
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s;
}
#coachOverlay.active { opacity: 1; pointer-events: auto; }

/* Dark overlay using SVG mask — the "hole" is punched out in JS */
#coachMask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.72);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* Highlight ring around the target */
#coachRing {
  position: absolute;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.12), 0 0 24px rgba(255,255,255,0.15);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

/* Tooltip card */
#coachCard {
  position: absolute;
  background: #fff;
  border-radius: 16px;
  padding: 16px 18px;
  width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}
#coachCard .coach-step {
  font-size: 11px; font-weight: 700; color: #999;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 6px;
}
#coachCard .coach-title {
  font-size: 15px; font-weight: 700; color: #111;
  letter-spacing: -0.02em; margin-bottom: 6px;
  line-height: 1.3;
}
#coachCard .coach-desc {
  font-size: 13px; color: #AAA; line-height: 1.6;
  margin-bottom: 14px;
}
#coachCard .coach-actions {
  display: flex; align-items: center; justify-content: space-between;
}
#coachCard .coach-skip {
  font-size: 13px; color: #999; background: none; border: none;
  cursor: pointer; font-family: 'DM Sans', sans-serif; padding: 0;
}
#coachCard .coach-next {
  height: 32px; padding: 0 16px;
  background: #111; border: none; border-radius: 9px;
  color: #EFEFEF; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
}
/* Arrow pointer on card */
#coachCard::before {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  background: #fff;
  transform: rotate(45deg);
}
#coachCard.arrow-top::before    { top: -6px; left: 24px; }
#coachCard.arrow-bottom::before { bottom: -6px; left: 24px; }
#coachCard.arrow-left::before   { left: -6px; top: 20px; }
#coachCard.arrow-right::before  { right: -6px; top: 20px; }
/* Dot indicators */
#coachDots {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 5px;
}
.coach-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: background 0.2s, transform 0.2s;
}
.coach-dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* ── Search history ── */
.search-history {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 20px 12px; flex-shrink: 0;
}
.search-tag {
  display: flex; align-items: center; gap: 5px;
  background: #202020; border: 1px solid #333333;
  border-radius: 20px; padding: 4px 10px 4px 12px;
  font-size: 13px; color: #888; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.search-tag:hover { border-color: #888; color: #ccc; }
.search-tag-x {
  width: 14px; height: 14px; border-radius: 50%;
  background: #333333; display: flex; align-items: center;
  justify-content: center; font-size: 11px; color: #AAA;
  flex-shrink: 0; transition: background 0.15s;
}
.search-tag-x:hover { background: #444; color: #EFEFEF; }
.card-mgmt-item {
  background: #111; border: 1px solid #282828; border-radius: 16px;
  margin-bottom: 10px; overflow: hidden;
}
.card-mgmt-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid #282828;
}
.star-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px; transition: transform 0.15s; }
.star-btn:hover { transform: scale(1.2); }
.card-add-btn {
  width: 100%; height: 52px; background: #111; border: 1.5px dashed #333333;
  border-radius: 16px; color: #999; font-family: 'DM Sans',sans-serif;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.card-add-btn:hover { border-color: #999; color: #888; }

/* ── AI + My folder grid unified ── */
.ai-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.ai-folder {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; cursor: pointer; transition: opacity 0.15s;
}
.ai-folder:hover { opacity: 0.8; }
.ai-folder-box {
  width: 88px; height: 88px; border-radius: 22px;
  background: #1E1E1E; border: 1.5px solid #2C2C2C;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s; position: relative;
}
.ai-folder:hover .ai-folder-box { border-color: #383838; }
.ai-folder-name { font-size:12px; font-weight:500; color:#AAA; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:88px; }
.ai-folder-count-badge { position:absolute; top:-6px; right:-6px; min-width:18px; height:18px; background:#fff; color:#000; font-size:11px; font-weight:700; border-radius:9px; display:flex; align-items:center; justify-content:center; padding:0 4px; }
.company-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: #111; border: 1px solid #282828;
  border-radius: 14px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.2s;
}
.company-row:hover { border-color: #888; }
.company-av {
  width: 36px; height: 36px; border-radius: 10px; background: #242424;
  border: 1px solid #333333; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; color: #888; flex-shrink: 0;
}

/* CreateCard inputs — grey placeholder, white when typed */
#createCard input { color: #999 !important; }
#createCard input:not(:placeholder-shown) { color: #EFEFEF !important; }
#createCard input::placeholder { color: #888 !important; font-style: italic; }
@keyframes loaderDraw {
  0%   { stroke-dashoffset: 151; opacity: 0.15; }
  50%  { stroke-dashoffset: 40;  opacity: 0.8; }
  100% { stroke-dashoffset: 151; opacity: 0.15; }
}
@keyframes loaderDot {
  0%   { opacity: 0.2; r: 4; }
  50%  { opacity: 1;   r: 6; }
  100% { opacity: 0.2; r: 4; }
}
@keyframes loaderSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   Light mode systematic patch — broken pages
   These pages were built dark-first with inline styles. Rather than
   refactor every element, use attribute selectors scoped to each page
   to flip the common dark-theme inline patterns to their light equiv.
   ═══════════════════════════════════════════════════════════════ */

/* Generic page bg + back-button arrow + section labels */
body.light-mode #dashboard,
body.light-mode #admin,
body.light-mode #companyDB,
body.light-mode #subscriptionPage,
body.light-mode #folderInner { background: var(--bg-page) !important; }

body.light-mode #dashboard .back-btn svg,
body.light-mode #admin .back-btn svg,
body.light-mode #companyDB .back-btn svg,
body.light-mode #subscriptionPage .back-btn svg,
body.light-mode #folderInner .back-btn svg { stroke: #1A1A1A !important; }

body.light-mode #dashboard .section-label,
body.light-mode #admin .section-label,
body.light-mode #companyDB .section-label { color: var(--text-muted) !important; }

/* ── Common inline patterns: text colors ─────────────────── */
body.light-mode #dashboard [style*="color:#EFEFEF"],
body.light-mode #admin [style*="color:#EFEFEF"],
body.light-mode #companyDB [style*="color:#EFEFEF"],
body.light-mode #subscriptionPage [style*="color:#EFEFEF"],
body.light-mode #folderInner [style*="color:#EFEFEF"] { color: var(--text-primary) !important; }

body.light-mode #dashboard [style*="color:#AAA"],
body.light-mode #admin [style*="color:#AAA"],
body.light-mode #companyDB [style*="color:#AAA"],
body.light-mode #subscriptionPage [style*="color:#AAA"],
body.light-mode #folderInner [style*="color:#AAA"] { color: var(--text-muted) !important; }

body.light-mode #dashboard [style*="color:#999"],
body.light-mode #admin [style*="color:#999"],
body.light-mode #companyDB [style*="color:#999"],
body.light-mode #subscriptionPage [style*="color:#999"],
body.light-mode #folderInner [style*="color:#999"] { color: var(--text-muted) !important; }

body.light-mode #dashboard [style*="color:#888"],
body.light-mode #admin [style*="color:#888"],
body.light-mode #companyDB [style*="color:#888"],
body.light-mode #subscriptionPage [style*="color:#888"],
body.light-mode #folderInner [style*="color:#888"] { color: var(--text-muted) !important; }

/* ── Common inline patterns: backgrounds ─────────────────── */
body.light-mode #dashboard [style*="background:#111"],
body.light-mode #admin [style*="background:#111"],
body.light-mode #companyDB [style*="background:#111"],
body.light-mode #subscriptionPage [style*="background:#111"],
body.light-mode #folderInner [style*="background:#111"] { background: var(--bg-card) !important; }

body.light-mode #dashboard [style*="background:#202020"],
body.light-mode #admin [style*="background:#202020"],
body.light-mode #companyDB [style*="background:#202020"],
body.light-mode #subscriptionPage [style*="background:#202020"],
body.light-mode #folderInner [style*="background:#202020"] { background: var(--bg-elevated) !important; }

body.light-mode #dashboard [style*="background:#242424"],
body.light-mode #admin [style*="background:#242424"],
body.light-mode #companyDB [style*="background:#242424"],
body.light-mode #subscriptionPage [style*="background:#242424"],
body.light-mode #folderInner [style*="background:#242424"] { background: var(--bg-elevated) !important; }

/* ── Common inline patterns: borders ─────────────────────── */
body.light-mode #dashboard [style*="border:1px solid #282828"],
body.light-mode #admin [style*="border:1px solid #282828"],
body.light-mode #companyDB [style*="border:1px solid #282828"],
body.light-mode #subscriptionPage [style*="border:1px solid #282828"],
body.light-mode #folderInner [style*="border:1px solid #282828"] { border-color: var(--border) !important; }

body.light-mode #dashboard [style*="border:1px solid #333333"],
body.light-mode #admin [style*="border:1px solid #333333"],
body.light-mode #companyDB [style*="border:1px solid #333333"],
body.light-mode #subscriptionPage [style*="border:1px solid #333333"],
body.light-mode #folderInner [style*="border:1px solid #333333"] { border-color: var(--border) !important; }

body.light-mode #dashboard [style*="border-bottom:1px solid #202020"],
body.light-mode #admin [style*="border-bottom:1px solid #202020"],
body.light-mode #subscriptionPage [style*="border-bottom:1px solid #202020"] { border-bottom-color: #ECECEC !important; }

body.light-mode #dashboard [style*="border-top:1px solid #242424"],
body.light-mode #admin [style*="border-top:1px solid #242424"] { border-top-color: #ECECEC !important; }

/* ── Subscription page — gold premium status card stays gold (intentional accent),
   but text on it must be readable. The card has its own .prem-status-card class.
   Skip the gold card from above overrides; instead just bump white-ish text. */
body.light-mode #subscriptionPage .prem-status-card { /* keep gold gradient */ }
body.light-mode #subscriptionPage .premium-name { color: #5A4A2A !important; }   /* dark gold for "TapCard Premium" */
body.light-mode #subscriptionPage .prem-status-card [style*="color:#EFEFEF"] { color: #3A2A0A !important; }  /* big numbers 199 / 247 */
body.light-mode #subscriptionPage .prem-status-card [style*="color:#AAA"] { color: #6A5A3A !important; }    /* "月費用" labels */
body.light-mode #subscriptionPage .prem-status-card [style*="color:#888"] { color: #6A5A3A !important; }    /* "NT$" "天" small */

/* Pipeline detail border — fix the inner divider */
body.light-mode #pipelineDetail { border-top-color: #ECECEC !important; }
body.light-mode #pipelineDetailLabel { color: var(--text-muted) !important; }

/* Admin page — pending request cards (have unique inline gradients) */
body.light-mode #adminPendingList > div {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
}
body.light-mode #adminMemberList > div {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
}

/* CompanyDB folder grid — inherits .folder-grid which may have its own bg */
body.light-mode #companyDB .folder-grid > * {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
}

/* FolderInner search input + list rows */
body.light-mode #folderInner input[type="search"] {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  color: var(--text-primary) !important;
}

/* PTR loader — TapCard branded (two interlocking circles + center dot).
   Spin animation rotates the whole logo while loading. */
@keyframes ptrSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
#ptrRing { transform-origin: 50% 50%; }

/* Light mode: invert the loader colors so it's visible on light bg.
   --ptr-fg = the brand circles, --ptr-bg = the faint outline behind. */
body.light-mode #ptrIndicator {
  --ptr-fg: #1A1A1A;
  --ptr-bg: rgba(0,0,0,0.12);
}

/* ══════════════════════════════════════════════════════════════
   Tab bar — bottom navigation (4 destinations + center scan)
   ══════════════════════════════════════════════════════════════ */
.tab-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: stretch; justify-content: space-around;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; cursor: pointer;
  color: #888; padding: 4px 0 6px;
  font-family: 'DM Sans', 'Noto Sans TC', sans-serif;
  transition: color 0.15s;
}
.tab-item svg { width: 22px; height: 22px; display: block; }
.tab-item span { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.tab-item.active { color: #EFEFEF; }
.tab-item:active { transform: scale(0.96); }

/* Center scan — the action that's NOT just a destination */
.tab-scan {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 0;
  position: relative;
}
.tab-scan-pill {
  width: 52px; height: 52px; margin-top: -16px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #EFEFEF, #BFBFBF);
  color: #161616; box-shadow: 0 6px 16px rgba(0,0,0,0.5), 0 0 0 4px rgba(20,20,20,0.92);
  transition: transform 0.15s;
}
.tab-scan-pill svg { width: 24px; height: 24px; }
.tab-scan:active .tab-scan-pill { transform: scale(0.92); }

/* All pages get bottom padding so tab bar doesn't cover content.
   Tab bar = 56px + safe-area + 16px FAB pop-up + 12px breathing = ~100px+. */
.page { padding-bottom: 0; }
.home-scroll, .scroll-body, .settings-scroll, .wallet-scroll, #folderInnerList, #cardMgmtList, #adminMemberList, #companyFolderGrid { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important; }
/* Pages where tab is hidden don't need the padding (avoid huge empty space) */
body[data-active-page="exchange"] .home-scroll,
body[data-active-page="scan"] .home-scroll,
body[data-active-page="createCard"] .scroll-body,
body[data-active-page="editCard"] .scroll-body,
body[data-active-page="newCard"] .scroll-body,
body[data-active-page="admin"] .scroll-body,
body[data-active-page="companyDB"] .scroll-body { padding-bottom: 40px !important; }

/* Hide tab bar on full-screen flows that need the whole screen */
body[data-no-tabbar] .tab-bar { display: none; }
.tab-bar.hidden { display: none; }

/* Light mode */
body.light-mode .tab-bar {
  background: rgba(255,255,255,0.92);
  border-top-color: rgba(0,0,0,0.08);
}
body.light-mode .tab-item { color: #888; }
body.light-mode .tab-item.active { color: #1A1A1A; }
body.light-mode .tab-scan-pill {
  background: linear-gradient(135deg, #1A1A1A, #2A2A2A);
  color: #EFEFEF;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2), 0 0 0 4px rgba(255,255,255,0.92);
}

/* ══════════════════════════════════════════════════════════════
   Home card preview — "tap to exchange"
   ══════════════════════════════════════════════════════════════ */
.home-card-preview { -webkit-tap-highlight-color: transparent; }
.home-card-preview:active { transform: scale(0.985); box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important; }

/* ══════════════════════════════════════════════════════════════
   First-time overlay — appears once on first home visit
   ══════════════════════════════════════════════════════════════ */
.first-time-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 0 32px;
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
  text-align: center;
}
.first-time-overlay.show { opacity: 1; pointer-events: auto; }
.ftov-arrow {
  font-size: 56px; color: #EFEFEF;
  animation: ftovBob 1.4s ease-in-out infinite;
  margin-top: -120px; margin-bottom: -16px;
}
@keyframes ftovBob {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50%      { transform: translateY(-12px); opacity: 1; }
}
.ftov-text { color: #EFEFEF; }
.ftov-h { font-size: 22px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.ftov-p { font-size: 14px; color: #BBB; line-height: 1.5; }
.ftov-cta {
  margin-top: 8px; padding: 12px 28px; border-radius: 999px;
  background: #FFFFFF; color: #000; border: none;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600; cursor: pointer;
}
