:root {
  --blue-10:#EDF3FF; --blue-20:#DFEAFF; --blue-30:#CBDEFF; --blue-40:#B0CDFF;
  --blue-50:#5090FF; --blue-60:#3A7AEF; --blue-70:#2A63D4; --blue-80:#1A3FB5; --blue-90:#1E3A5F;
  --purple:#801FF9;
  --text:#334155; --text-2:#4B5563; --text-3:#6B7280; --text-4:#9CA3AF;
  --surface:#FFFFFF; --surface-2:#F7F9FC; --surface-3:#EDF2F7; --border:#E2E8F0;
  --green-bg:#E0F9F2; --green:#47D7AC; --green-deep:#0F8F6B;
  --red-bg:#FEE2E2; --red:#B91C1C;
  --amber-bg:#FEF3C7; --amber:#B45309;
  --topbar-h:56px; --sidebar-w:220px;
  --font:"Inter","Outfit","Noto Sans TC","PingFang TC",sans-serif;
  --font-display:"Outfit","Inter","Noto Sans TC",sans-serif;
  --font-mono:"JetBrains Mono", "SF Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); color: var(--text); background: linear-gradient(160deg, #EDF3FF 0%, #FFFFFF 50%, #F5F0FF 100%); background-attachment: fixed; -webkit-font-smoothing: antialiased; }
body { font-size: 14px; line-height: 1.5; }
a { color: var(--blue-60); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; color: var(--blue-70); }

/* ===== APP SHELL ===== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "topbar topbar" "sidebar main"; min-height: 100vh; }

.topbar { grid-area: topbar; background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 18px; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--blue-60); letter-spacing: -0.02em; }
.brand small { font-size: 10px; font-weight: 700; color: var(--text-3); letter-spacing: 0.12em; text-transform: uppercase; margin-left: 4px; }

.bread { color: var(--text-3); font-size: 13px; }
.bread::before { content: "/"; color: var(--text-4); margin-right: 14px; }

.balance-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--green-bg); color: var(--green-deep); border-radius: 999px; font-weight: 700; font-size: 13px; border: 1px solid #BBF7D0; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--blue-50), var(--purple)); color: white; display: grid; place-items: center; font-weight: 800; font-size: 12px; cursor: pointer; }

.sidebar { grid-area: sidebar; background: white; border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-2); cursor: pointer; font-weight: 500; font-size: 13.5px; transition: all 0.12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--blue-10); color: var(--blue-70); font-weight: 600; }
.nav-item.active svg { color: var(--blue-60); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-3); }
.nav-group-label { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-4); padding: 16px 12px 6px; }

.main { grid-area: main; padding: 28px 32px; overflow-x: hidden; }
.page { display: none; animation: fadein 0.2s ease-out; }
.page.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(21,128,61,0); } }
@keyframes rowFlash { 0% { background: #FEF3C7; } 100% { background: transparent; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.02em; color: var(--blue-90); }
.page-head p { color: var(--text-3); font-size: 14px; margin: 0; max-width: 560px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 13.5px; border: none; cursor: pointer; transition: all 0.15s; font-family: var(--font); white-space: nowrap; flex-shrink: 0; }
.btn-primary { background: var(--blue-50); color: white; }
.btn-primary:hover { background: var(--blue-60); }
.btn-ghost { background: white; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--blue-30); color: var(--blue-60); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

.card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin: 0; }

.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .g-4, .g-3, .g-2 { grid-template-columns: 1fr; }
  /* Sidebar → top horizontal scroll bar */
  .app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) auto 1fr; grid-template-areas: "topbar" "sidebar" "main"; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 12px; flex-direction: row !important; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sidebar nav { flex-direction: row; flex: 1; gap: 2px; }
  .nav-item { white-space: nowrap; flex-shrink: 0; padding: 7px 11px; font-size: 13px; }
  .nav-item svg { width: 15px; height: 15px; }
  .nav-group-label { display: none; }
  .sidebar > div:last-child { display: none; } /* hide sidebar footer on mobile */
  /* Topbar: compact */
  .topbar { padding: 0 12px; gap: 8px; }
  .bread { display: none; }
  .brand small { display: none; }
  .balance-pill { font-size: 11.5px; padding: 4px 10px; }
  .icon-btn { width: 32px; height: 32px; }
  /* Main */
  .main { padding: 16px 14px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head h1 { font-size: 20px; }
  .page-head > div:last-child { display: flex; gap: 6px; flex-wrap: wrap; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .card { padding: 14px; border-radius: 10px; }
  .card-head h2 { font-size: 14px; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
  input, textarea, select { font-size: 16px; } /* prevent iOS zoom */
  .modal-box { width: calc(100vw - 20px); max-height: 92vh; }
  .modal-head { padding: 14px 18px 10px; }
  .modal-body { padding: 14px 18px; }
  .modal-foot { padding: 10px 18px; flex-direction: column-reverse; gap: 8px; }
  .modal-foot .btn { width: 100%; }
  .metric .val { font-size: 24px; }
}
@media (max-width: 420px) {
  .sidebar { padding: 6px 10px; }
  .nav-item { padding: 6px 9px; font-size: 12.5px; }
  .balance-pill { display: none; }
  .topbar-right .icon-btn + .icon-btn { display: none; }
}

.metric { padding: 18px 20px; }
.metric .lbl { color: var(--text-3); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.metric .val { font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--blue-90); letter-spacing: -0.02em; margin: 4px 0 2px; line-height: 1.1; }
.metric .delta { font-size: 12px; font-weight: 600; color: var(--green-deep); }
.metric .delta.down { color: var(--red); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: var(--surface-2); font-weight: 700; color: var(--text-3); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border: none; }
tbody tr:hover td { background: var(--surface-2); }

.status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em; }
/* SMS message status — canonical mapping shared with admin.html.
   sent (MAAC accepted/handed to carrier) = BLUE;
   delivered (DLR-confirmed on handset) = GREEN. Different colors so users
   can tell at a glance that delivered is the stronger success state. */
.status.sent { background: #E0EDFF; color: #1D4BA8; }       /* 已送出 ✓ — blue */
.status.delivered { background: var(--green-bg); color: var(--green-deep); } /* ✓ 已送達 — green */
.status.queued { background: #F7F9FC; color: #718096; }
.status.dispatching { background: var(--amber-bg); color: var(--amber); }
.status.scheduled { background: var(--blue-10); color: var(--blue-70); }
.status.draft { background: #F1F5F9; color: #475569; }
.status.failed { background: var(--red-bg); color: var(--red); }
.status.stop { background: #F3E8FF; color: #6B21A8; }
.status.canceled { background: #F1F5F9; color: #64748B; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], textarea, select {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: var(--font); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; background: white; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue-50); box-shadow: 0 0 0 3px var(--blue-10); }
label { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; letter-spacing: 0.02em; text-transform: uppercase; }
.field { margin-bottom: 14px; }
.help { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; margin-bottom: 14px; }
.tabs button { border: none; background: transparent; padding: 6px 14px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-3); cursor: pointer; }
.tabs button.active { background: white; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

.codeblock { background: #0F172A; color: #E2E8F0; border-radius: 8px; padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; overflow-x: auto; position: relative; }
.codeblock .copy { position: absolute; top: 8px; right: 8px; padding: 4px 10px; background: rgba(255,255,255,0.1); color: white; border: none; border-radius: 5px; font-size: 11px; cursor: pointer; font-family: var(--font); font-weight: 600; }
.codeblock .kw { color: #7DD3FC; }
.codeblock .str { color: #86EFAC; }
.codeblock .k { color: #FDA4AF; }

.keyrow { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-family: var(--font-mono); font-size: 13px; }
.keyrow .k { flex: 1; color: var(--text-2); letter-spacing: 0.5px; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--text-4); border-radius: 999px; transition: 0.2s; }
.switch .slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .slider { background: var(--blue-50); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.banner { padding: 10px 14px; border-radius: 8px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.banner.warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #FDE68A; }
.banner.info { background: var(--blue-10); color: var(--blue-80); border: 1px solid var(--blue-20); }
.banner.ok { background: var(--green-bg); color: var(--green-deep); border: 1px solid #BBF7D0; }

.ch { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.ch.sms { background: #FEF3C7; color: #92400E; }
.ch.api { background: #E0E7FF; color: #801FF9; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 11px; font-weight: 600; }
.chip.green { background: var(--green-bg); color: var(--green-deep); border-color: #BBF7D0; }
.vchip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--blue-10); border: 1px solid var(--blue-20); color: var(--blue-70); font-family: var(--font-mono, ui-monospace, monospace); font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all 0.12s; }
.vchip:hover { background: var(--blue-20); border-color: var(--blue-40); }
.vchip.csv { background: #F3EDFF; border-color: #E5DBFF; color: var(--purple); }
.vchip.csv:hover { background: #E5DBFF; }

.amount-card { background: linear-gradient(135deg, #1E3A5F 0%, #1D4BA8 100%); color: white; border-radius: 14px; padding: 24px 28px; position: relative; overflow: hidden; }
.amount-card::before { content: ""; position: absolute; top: -30px; right: -30px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(128,167,255,0.3), transparent 70%); }
.amount-card .lbl { color: #B3C9FF; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.amount-card .val { font-family: var(--font-display); font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; margin: 8px 0 6px; }
.amount-card .sub { color: #B3C9FF; font-size: 13px; margin-bottom: 14px; }
.amount-card .actions { display: flex; gap: 8px; position: relative; }
.amount-card .btn-primary { background: white; color: var(--blue-70); }
.amount-card .btn-ghost { background: transparent; color: white; border-color: rgba(255,255,255,0.2); }

.set-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border: none; padding-bottom: 0; }
.set-row .info { flex: 1; padding-right: 20px; }
.set-row .info h3 { margin: 0 0 3px; font-size: 14px; font-weight: 700; }
.set-row .info p { margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }

/* Toast system */
#toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--blue-90); color: white; padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,0.2); animation: toastin 0.25s ease-out; max-width: 320px; pointer-events: auto; }
.toast.ok { background: var(--green-deep); }
.toast.warn { background: var(--amber); color: white; }
@keyframes toastin { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateY(-10px); opacity: 0; } }
.toast.out { animation: toastout 0.22s ease-in forwards; }

/* Modal system */
.modal-bd { position: fixed; inset: 0; background: rgba(11,17,48,0.45); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 150; padding: 20px; }
.modal-bd.open { display: flex; animation: fadein 0.18s; }
.modal-box { background: white; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,0.3); width: 520px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin: 0; }
.modal-close { border: none; background: transparent; color: var(--text-3); cursor: pointer; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* First-send prompt card on Dashboard */
.first-send-card { background: linear-gradient(135deg, var(--blue-10) 0%, #F3EDFF 100%); border: 2px solid var(--blue-30); border-radius: 14px; padding: 22px 26px; display: flex; gap: 20px; align-items: center; margin-bottom: 20px; }
.first-send-card .ic { width: 54px; height: 54px; border-radius: 12px; background: linear-gradient(135deg, var(--blue-50), var(--purple)); color: white; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 8px 24px rgba(80,144,255,0.3); }
.first-send-card .body { flex: 1; }
.first-send-card h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 17px; font-weight: 800; color: var(--blue-90); }
.first-send-card p { margin: 0; font-size: 13.5px; color: var(--text-2); }

/* API Docs side nav + panels */
.docs-item { padding: 6px 10px; border-radius: 6px; color: var(--text-2); text-decoration: none; cursor: pointer; transition: background 0.12s, color 0.12s; }
.docs-item:hover { background: var(--surface-2); color: var(--text); }
.docs-item.active { background: var(--blue-10); color: var(--blue-70); font-weight: 600; }
.docs-panel { display: none; }
.docs-panel.active { display: block; }
.docs-h3 { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; margin: 18px 0 8px; }

/* Top-up amount option (two-line: 到帳金額 + 實付金額) */
.amount-opt { padding: 12px 6px; border: 1.5px solid var(--border); border-radius: 8px; background: white; cursor: pointer; text-align: center; transition: all 0.12s; }
.amount-opt:hover { border-color: var(--blue-30); }
.amount-opt .pts { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.amount-opt .pay { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.amount-opt.selected { border-color: var(--blue-50); background: var(--blue-10); }
.amount-opt.selected .pts { color: var(--blue-70); }
.amount-opt.selected .pay { color: var(--blue-60); }

/* NCC compliance tooltip */
.ncc-tip { position: relative; display: inline-flex; align-items: center; }
.ncc-tip-body {
  position: absolute; bottom: calc(100% + 10px); right: 0;
  width: 320px; background: var(--blue-90); color: white;
  padding: 14px 16px; border-radius: 10px;
  font-size: 12px; line-height: 1.55; font-weight: 400;
  text-transform: none; letter-spacing: normal;
  box-shadow: 0 14px 40px rgba(11,17,48,0.35);
  opacity: 0; pointer-events: none;
  transform: translateY(4px); transition: opacity 0.15s, transform 0.15s;
  z-index: 40; text-align: left;
  display: flex; flex-direction: column; gap: 7px;
}
.ncc-tip-body::after {
  content: ""; position: absolute; top: 100%; right: 16px;
  border: 6px solid transparent; border-top-color: var(--blue-90);
}
.ncc-tip:hover .ncc-tip-body, .ncc-tip:focus-within .ncc-tip-body {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.ncc-tip-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #80A7FF; margin-bottom: 2px;
}
.ncc-tip-rule { color: rgba(255,255,255,0.92); }
.ncc-tip-rule code { background: rgba(255,255,255,0.1); color: #A7F3D0; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.ncc-tip-foot {
  margin-top: 4px; padding-top: 8px; font-size: 11px; color: #B3C9FF;
  border-top: 1px solid rgba(255,255,255,0.12);
}
/* EDM additions */
.status.sending { background: var(--amber-bg); color: var(--amber); }
.status.opened { background: var(--blue-10); color: var(--blue-70); }
.status.clicked { background: #F3E8FF; color: #6B21A8; }
.status.bounced { background: var(--red-bg); color: var(--red); }
.status.unsubscribed { background: #F1F5F9; color: #64748B; }
.status.complained { background: var(--red-bg); color: var(--red); }
.status.active { background: var(--green-bg); color: var(--green-deep); }
.status.pending { background: var(--amber-bg); color: var(--amber); }
.status.verified { background: var(--green-bg); color: var(--green-deep); }

/* ===== EDM editor ===== */
.ed-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .ed-wrap { grid-template-columns: 1fr; } }
.ed-paper { background: white; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.ed-meta { padding: 18px 26px 6px; border-bottom: 1px solid var(--surface-3); }
.ed-meta .row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--surface-3); }
.ed-meta .row:last-child { border-bottom: none; }
.ed-meta .lbl { width: 84px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.ed-meta input { border: none; outline: none; flex: 1; font-size: 14px; font-family: var(--font); color: var(--text); background: transparent; padding: 4px 0; }
.ed-meta input.subject { font-size: 16px; font-weight: 700; color: var(--blue-90); }
.ed-body { padding: 26px 26px 34px; min-height: 320px; }
.ed-block { position: relative; margin: 0 0 4px; padding: 6px 8px; border-radius: 8px; }
.ed-block:hover { background: var(--surface-2); }
.ed-block[contenteditable]:focus { outline: 2px solid var(--blue-20); background: white; }
.ed-block.h { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--blue-90); }
.ed-block.p { font-size: 15px; line-height: 1.7; color: var(--text); }
.ed-block.btn-block { text-align: center; padding: 12px 8px; }
.ed-block.btn-block .fake-btn { display: inline-block; background: var(--blue-50); color: white; font-weight: 700; font-size: 14px; padding: 11px 26px; border-radius: 8px; }
.ed-block.divider-block { padding: 14px 8px; }
.ed-block.divider-block hr { border: none; border-top: 1px solid var(--border); margin: 0; }
.ed-block.img-block img { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.ed-block .blk-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: none; background: white; color: var(--text-3); font-size: 13px; line-height: 1; display: none; box-shadow: 0 2px 8px rgba(11,17,48,0.12); }
.ed-block:hover .blk-x { display: block; }
.ed-addbar { display: flex; gap: 8px; padding: 10px 26px 22px; flex-wrap: wrap; }
.ed-addbar button { border: 1px dashed var(--border); background: white; color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.ed-addbar button:hover { border-color: var(--blue-40); color: var(--blue-60); background: var(--blue-10); }
.ed-footer-note { padding: 14px 26px; background: var(--surface-2); border-top: 1px solid var(--surface-3); font-size: 12px; color: var(--text-3); }
.ed-side .card { margin-bottom: 14px; }

/* report tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--blue-90); }
.tile .l { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.tile .sub { font-size: 11px; color: var(--text-4); margin-top: 2px; }

/* DNS records */
.dns-rec { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--surface-3); font-size: 13px; }
.dns-rec:last-child { border-bottom: none; }
.dns-rec code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dns-rec .nm { font-size: 11px; color: var(--text-3); margin-bottom: 2px; font-family: var(--font-mono); }

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { background: white; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 24px 80px rgba(11,17,48,0.10); padding: 36px; width: 100%; max-width: 420px; }
.auth-card h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--blue-90); margin: 0 0 6px; }
.auth-card .sub { font-size: 13.5px; color: var(--text-3); margin: 0 0 22px; }
[contenteditable][data-ph]:empty::before { content: attr(data-ph); color: var(--text-4); pointer-events: none; }
.empty-state { text-align: center; padding: 70px 20px; background: white; border: 1px dashed var(--border); border-radius: 16px; }
.empty-state h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--blue-90); margin: 0 0 8px; }
.empty-state p { color: var(--text-3); font-size: 14px; margin: 0 0 20px; }

/* ===== v2: wizard (campaign-001 Recipients→Message→Review) ===== */
.wiz-steps { display: flex; gap: 0; margin-bottom: 22px; background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; width: fit-content; }
.wiz-step { display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: 13.5px; font-weight: 600; color: var(--text-3); border-right: 1px solid var(--surface-3); cursor: pointer; background: white; border-top: none; border-bottom: none; border-left: none; font-family: var(--font); }
.wiz-step:last-child { border-right: none; }
.wiz-step .n { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); color: var(--text-3); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.wiz-step.active { color: var(--blue-70); background: var(--blue-10); }
.wiz-step.active .n { background: var(--blue-50); color: white; }
.wiz-step.done .n { background: var(--green); color: white; }
.wiz-step:disabled { cursor: default; opacity: 0.6; }

/* audience picker */
.aud-card { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 20px 24px; margin-bottom: 14px; }
.aud-card .aud-lbl { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.seg-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-opt { border: 1px solid var(--border); background: white; border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; font-family: var(--font); }
.seg-opt.on { border-color: var(--blue-40); background: var(--blue-10); color: var(--blue-70); }
.est-box { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 20px 24px; }
.est-big { font-family: var(--font-display); font-size: 40px; font-weight: 800; color: var(--blue-70); line-height: 1; }
.est-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); padding: 5px 0; border-bottom: 1px dashed var(--surface-3); }
.est-row:last-child { border-bottom: none; }
.est-row b { color: var(--text); }

/* template gallery */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tpl-card { background: white; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: all 0.2s; cursor: pointer; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(80,144,255,0.16); border-color: var(--blue-30); }
.tpl-thumb { height: 220px; overflow: hidden; position: relative; background: var(--surface-2); border-bottom: 1px solid var(--surface-3); }
.tpl-thumb .zoom { transform: scale(0.42); transform-origin: top center; width: 238%; margin-left: -69%; pointer-events: none; }
.tpl-meta { padding: 12px 14px; }
.tpl-meta .nm { font-weight: 700; font-size: 14px; color: var(--blue-90); }
.tpl-meta .tags { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }
.tpl-preview-modal .modal-box { max-width: 680px; width: 100%; max-height: 86vh; overflow: auto; }
.dev-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dev-toggle button { border: none; background: white; padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-3); cursor: pointer; font-family: var(--font); }
.dev-toggle button.on { background: var(--blue-10); color: var(--blue-70); }
.preview-mobile { max-width: 375px !important; margin: 0 auto; }

/* profile drawer (profile-001) */
.drawer-bd { position: fixed; inset: 0; background: rgba(11,17,48,0.3); z-index: 140; display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw; background: white; border-left: 1px solid var(--border); box-shadow: -20px 0 60px rgba(11,17,48,0.15); z-index: 150; transform: translateX(105%); transition: transform 0.25s ease-out; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--surface-3); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: white; }
.drawer-sect { padding: 16px 22px; border-bottom: 1px solid var(--surface-3); }
.drawer-sect .dl { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); margin-bottom: 10px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.kv .k { color: var(--text-3); }
.tl-item { display: flex; gap: 10px; padding: 7px 0; font-size: 12.5px; align-items: baseline; }
.tl-item .dot2 { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-40); flex-shrink: 0; position: relative; top: 0; }
.tl-item .when { margin-left: auto; color: var(--text-4); font-size: 11.5px; white-space: nowrap; }

/* report context row (analytics-001) */
.ctx-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 900px) { .ctx-grid { grid-template-columns: 1fr; } }
.snapshot-box { max-height: 380px; overflow-y: auto; border: 1px solid var(--surface-3); border-radius: 10px; }
.funnel-flow { display: flex; gap: 6px; align-items: stretch; flex-wrap: wrap; margin-bottom: 20px; }
.funnel-cell { flex: 1; min-width: 96px; background: white; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; position: relative; }
.funnel-cell .fv { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--blue-90); }
.funnel-cell .fl { font-size: 10.5px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.funnel-cell .fs { font-size: 10.5px; color: var(--text-4); margin-top: 1px; }
.funnel-cell.dim { background: var(--surface-2); }

/* ===== v2.3 UX polish ===== */
.picker-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s; background: white; }
.picker-item:hover { border-color: var(--blue-40); background: var(--blue-10); }
.picker-item .pi-thumb { width: 56px; height: 44px; border-radius: 8px; background: linear-gradient(135deg, var(--blue-10), #F5F0FF); overflow: hidden; flex-shrink: 0; display: grid; place-items: center; color: var(--text-4); font-size: 10px; }
.picker-item .pi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.picker-item .pi-name { font-weight: 700; font-size: 13.5px; color: var(--blue-90); }
.picker-item .pi-sub { font-size: 12px; color: var(--text-3); }
.btn[disabled], .btn.busy { opacity: 0.55; pointer-events: none; }
.inbox-preview { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; background: white; }
.inbox-preview .ip-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--blue-50), var(--purple)); color: white; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.inbox-preview .ip-from { font-size: 12.5px; font-weight: 700; color: var(--text); }
.inbox-preview .ip-subj { font-size: 12.5px; font-weight: 700; color: var(--blue-90); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-preview .ip-prev { font-size: 12px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tbody tr:hover td { background: var(--blue-10); }

/* ===== Welcome / onboarding ===== */
.wc-wrap { max-width: 1000px; margin: 0 auto; padding: 0 24px 70px; }
.wc-top { display: flex; align-items: center; gap: 18px; padding: 20px 0 30px; }
.brandmark { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--blue-50); }
.brandmark small { font-size: 10px; font-weight: 700; color: var(--text-3); letter-spacing: 0.12em; }
.wc-steps { display: flex; gap: 6px; margin-left: auto; }
.wcs { font-size: 12.5px; font-weight: 700; color: var(--text-4); padding: 6px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.wcs.on { background: var(--blue-10); color: var(--blue-70); border-color: var(--blue-30); }
.wcs.done { background: var(--green-bg); color: var(--green-deep); border-color: #BBF7D0; }
.wc-head { text-align: center; margin-bottom: 30px; }
.wc-head h1 { font-family: var(--font-display); font-size: 38px; font-weight: 900; letter-spacing: -0.03em; color: var(--blue-90); margin: 0 0 10px; }
.wc-head p { font-size: 16px; color: var(--text-2); margin: 0; }
.wc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.start-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.start-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 26px 24px; display: block; transition: all 0.2s; position: relative; box-shadow: 0 2px 8px rgba(11,17,48,0.04); }
.start-card:hover { transform: translateY(-4px); box-shadow: 0 18px 50px rgba(80,144,255,0.18); border-color: var(--blue-30); }
.start-card.hl { border: 2px solid var(--blue-30); }
.start-card .sc-tag { position: absolute; top: -11px; left: 22px; background: var(--blue-50); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; padding: 3px 11px; border-radius: 999px; }
.start-card .sc-ic { width: 46px; height: 46px; border-radius: 13px; color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.start-card h3 { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--blue-90); margin: 0 0 6px; }
.start-card p { font-size: 13.5px; color: var(--text-3); line-height: 1.55; margin: 0 0 14px; }
.start-card .sc-go { font-size: 13.5px; font-weight: 700; color: var(--blue-60); }
@media (max-width: 900px) { .wc-grid, .start-grid { grid-template-columns: 1fr; } .wc-head h1 { font-size: 27px; } }

/* ===== Activation checklist ===== */
.chk { background: #fff; border: 1px solid var(--blue-30); border-radius: 16px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 8px 30px rgba(80,144,255,0.10); }
.chk-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.chk-head b { font-family: var(--font-display); font-size: 16px; color: var(--blue-90); }
.chk-bar { flex: 1; height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; max-width: 200px; }
.chk-bar i { display: block; height: 100%; background: linear-gradient(90deg,var(--blue-50),var(--purple)); border-radius: 999px; }
.chk-items { display: flex; gap: 10px; flex-wrap: wrap; }
.chk-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); background: #fff; }
.chk-item:hover { border-color: var(--blue-40); background: var(--blue-10); color: var(--blue-70); }
.chk-item.ok { color: var(--green-deep); background: var(--green-bg); border-color: #BBF7D0; }
.chk-item .box { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border); display: grid; place-items: center; font-size: 11px; flex-shrink: 0; }
.chk-item.ok .box { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.setup-mini { display: block; padding: 8px 12px; margin-bottom: 6px; border-radius: 8px; background: var(--blue-10); color: var(--blue-70); font-size: 11.5px; font-weight: 700; }
.setup-mini .sm-bar { height: 4px; background: rgba(80,144,255,0.25); border-radius: 999px; margin-top: 5px; overflow: hidden; }
.setup-mini .sm-bar i { display: block; height: 100%; background: var(--blue-50); border-radius: 999px; }

/* ===== Editor v2: handles, toolbar, slash menu, new blocks ===== */
.ed-block { padding-left: 26px; }
.blk-handle { position: absolute; left: 4px; top: 7px; width: 18px; height: 20px; display: none; align-items: center; justify-content: center; color: var(--text-4); cursor: grab; font-size: 13px; border-radius: 4px; user-select: none; }
.ed-block:hover .blk-handle { display: flex; }
.blk-handle:hover { background: var(--surface-3); color: var(--text-2); }
.ed-block.dragging { opacity: 0.4; }
.ed-block.drop-target { box-shadow: inset 0 2px 0 var(--blue-50); }
.ed-toolbar { position: absolute; display: none; gap: 2px; background: var(--blue-90); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px rgba(11,17,48,0.28); z-index: 300; }
.ed-toolbar button { width: 32px; height: 28px; border: none; background: transparent; color: #fff; font-size: 13px; border-radius: 6px; cursor: pointer; }
.ed-toolbar button:hover { background: rgba(255,255,255,0.16); }
.ed-slash { position: absolute; z-index: 300; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 50px rgba(11,17,48,0.18); padding: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 300px; }
.ed-slash button { text-align: left; border: none; background: transparent; padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--text-2); border-radius: 8px; cursor: pointer; font-family: var(--font); }
.ed-slash button:hover { background: var(--blue-10); color: var(--blue-70); }
.ed-block .cp-box { border: 2px dashed var(--blue-40); border-radius: 12px; padding: 18px 14px; text-align: center; }
.ed-block .cp-code { font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: 0.12em; color: var(--blue-60); outline: none; }
.ed-block .cp-note { font-size: 13px; color: var(--text-3); margin-top: 5px; outline: none; }
.ed-block .qt-box { border-left: 4px solid var(--blue-40); padding: 4px 0 4px 14px; }
.ed-block .qt-text { font-size: 15.5px; font-style: italic; color: var(--text); outline: none; }
.ed-block .qt-who { font-size: 13px; color: var(--text-4); margin-top: 5px; outline: none; }
.ed-block .soc-row { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 6px 0; }
.ed-block .soc { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-4); font-weight: 800; font-size: 12px; }
.ed-block .soc.on { background: var(--blue-50); color: #fff; }
.ed-block .soc-hint { font-size: 11.5px; color: var(--text-4); margin-left: 6px; }
.ed-block .col2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ed-block .col-img { position: relative; background: var(--surface-2); border-radius: 8px; min-height: 92px; display: grid; place-items: center; color: var(--text-4); font-size: 12px; overflow: hidden; margin-bottom: 8px; }
.ed-block .col-img img { width: 100%; display: block; }
.ed-block .col-imgbtn { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: none; background: #fff; color: var(--text-3); box-shadow: 0 2px 8px rgba(11,17,48,0.14); cursor: pointer; }
.ed-block .col-h { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--blue-90); outline: none; }
.ed-block .col-p { font-size: 13.5px; color: var(--text-2); outline: none; margin-top: 3px; }
.ed-block .sp-zone { position: relative; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, #fff 6px, #fff 12px); border-radius: 6px; display: grid; place-items: center; }
.ed-block .sp-ctl { font-size: 11px; color: var(--text-3); font-weight: 700; background: #fff; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.ed-block .sp-ctl button { border: none; background: transparent; cursor: pointer; font-size: 13px; color: var(--blue-60); font-weight: 800; }
.ed-block .hb { border-radius: 8px; padding: 12px 16px; text-align: center; color: #fff; font-family: var(--font-display); font-size: 16px; }
.ed-addbar .grp { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4); align-self: center; margin-left: 6px; }
/* pre-send audit */
.audit { border: 1px solid var(--border); border-radius: 14px; background: #fff; padding: 16px 18px; margin-bottom: 14px; }
.audit.warn { border-color: #FDE68A; background: #FFFBEB; }
.audit .a-h { font-weight: 800; font-size: 14px; color: var(--blue-90); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.audit .a-item { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 3px 0; color: var(--text-2); }
.audit .a-item .m { color: var(--amber); font-weight: 800; }
.audit .a-item.ok .m { color: var(--green-deep); }

/* editor v2.1: html/table blocks, undo buttons */
.ed-block .html-lbl { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--text-4); margin-bottom: 4px; }
.ed-block .html-src { width: 100%; min-height: 74px; font-family: var(--font-mono); font-size: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #0F1326; color: #D7DCE8; resize: vertical; }
.ed-block .html-prev { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 6px; font-size: 14px; }
.ed-block .tb-grid { width: 100%; border-collapse: collapse; }
.ed-block .tb-grid th, .ed-block .tb-grid td { border: 1px solid var(--border); padding: 8px 10px; font-size: 13px; outline: none; }
.ed-block .tb-grid th { background: var(--surface-2); font-weight: 800; color: var(--blue-90); }
.ed-block .tb-ctl { display: flex; gap: 6px; margin-top: 6px; }
.ed-block .tb-ctl button { border: 1px dashed var(--border); background: #fff; border-radius: 6px; font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: 3px 9px; cursor: pointer; }
.ed-block .tb-ctl button:hover { color: var(--blue-60); border-color: var(--blue-40); }
#ed-undo, #ed-redo { border: 1px solid var(--border) !important; border-radius: 8px; width: 34px; font-size: 15px; }
#ed-undo[disabled], #ed-redo[disabled] { opacity: 0.35; }

/* ===== Settings v2: Klaviyo two-pane layout ===== */
.set-layout { display: grid; grid-template-columns: 190px 1fr; gap: 26px; align-items: start; }
.set-nav { position: sticky; top: calc(var(--topbar-h) + 20px); }
.set-group { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: var(--text-4); margin: 16px 0 5px 10px; }
.set-group:first-child { margin-top: 0; }
.set-link { display: block; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 1px; }
.set-link:hover { background: var(--surface-2); color: var(--text); }
.set-link.on { background: var(--blue-10); color: var(--blue-70); }
.set-h { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--blue-90); margin-bottom: 6px; }
.set-sub { font-size: 13px; color: var(--text-3); margin: 0 0 14px; line-height: 1.6; }
.set-row2 { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--surface-3); }
.set-row2:last-child { border-bottom: none; }
.set-row2 b { display: block; font-size: 14px; color: var(--blue-90); }
.set-row2 span { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.set-row2 .tgl { margin-left: auto; }
.tgl { cursor: pointer; flex-shrink: 0; }
.tgl input { display: none; }
.tgl-track { display: inline-block; width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background 0.18s; }
.tgl input:checked + .tgl-track { background: var(--blue-50); }
.tgl-dot { position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(11,17,48,0.25); transition: left 0.18s; }
.tgl input:checked + .tgl-track .tgl-dot { left: 19.5px; }
.mem-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--surface-3); }
.mem-row:last-child { border-bottom: none; }
.mem-row b { font-size: 13.5px; color: var(--blue-90); }
.mem-sub { font-size: 11.5px; color: var(--text-4); }
.plan-card { border-color: var(--blue-30); }
.colorin { width: 62px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 900px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { position: static; display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
  .set-group { display: none; }
  .set-link { white-space: nowrap; border: 1px solid var(--border); }
}

/* ===== Demo design pass: split auth, avatar menu, funnel flow ===== */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-form-side { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-family: var(--font-display); font-size: 28px; font-weight: 900; letter-spacing: -0.02em; color: var(--blue-90); margin: 0 0 8px; }
.auth-form .sub { font-size: 14px; color: var(--text-3); margin: 0 0 24px; }
.auth-visual { background: linear-gradient(150deg, #1E3A5F 0%, #12264a 55%, #2a1a5e 100%); display: grid; place-items: center; padding: 48px; position: relative; overflow: hidden; }
.auth-visual::before { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(80,144,255,0.35), transparent 65%); top: -120px; right: -120px; }
.av-card { background: #fff; border-radius: 18px; box-shadow: 0 40px 100px rgba(0,0,0,0.4); padding: 26px 28px; max-width: 360px; width: 100%; position: relative; z-index: 1; }
.av-quote { color: #C2CADB; font-size: 14px; line-height: 1.7; max-width: 360px; margin-top: 26px; position: relative; z-index: 1; }
.av-quote b { color: #fff; }
.av-stat { position: absolute; z-index: 2; background: #fff; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,0.35); padding: 12px 16px; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } .auth-visual { display: none; } }

.avatar { position: relative; }
.av-menu { position: absolute; top: 40px; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 18px 50px rgba(11,17,48,0.16); min-width: 210px; padding: 6px; display: none; z-index: 100; }
.av-menu.open { display: block; }
.av-menu .am-email { padding: 9px 12px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--surface-3); margin-bottom: 4px; font-family: var(--font-mono); }
.av-menu a { display: block; padding: 8px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.av-menu a:hover { background: var(--blue-10); color: var(--blue-70); }

.funnel-flow { position: relative; }
.funnel-cell { transition: all 0.18s; }
.funnel-cell:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(80,144,255,0.14); }
.funnel-cell::after { content: "→"; position: absolute; right: -12px; top: 50%; transform: translateY(-50%); color: var(--text-4); font-size: 13px; z-index: 2; }
.funnel-cell:last-child::after { content: none; }
.funnel-cell .fbar { height: 4px; border-radius: 999px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.funnel-cell .fbar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue-50), var(--purple)); }

/* ===== Table power features: toolbar, sort, row menu, bulk bar ===== */
.tbl-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tbl-search { padding: 8px 12px 8px 32px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 13px; width: 240px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center; }
.tbl-search:focus { outline: none; border-color: var(--blue-40); }
.tbl-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]:hover { color: var(--blue-60); }
th[data-sort] .arw { opacity: 0; margin-left: 4px; font-size: 10px; }
th[data-sort].on .arw { opacity: 1; }
.row-menu { position: relative; }
.row-menu > button { border: none; background: transparent; color: var(--text-3); font-size: 17px; line-height: 1; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.row-menu > button:hover { background: var(--surface-3); color: var(--text); }
.row-menu .rm-list { position: absolute; right: 0; top: 26px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 44px rgba(11,17,48,0.16); min-width: 160px; padding: 5px; display: none; z-index: 60; }
.row-menu.open .rm-list { display: block; }
.row-menu .rm-list button { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 8px 11px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; font-family: var(--font); }
.row-menu .rm-list button:hover { background: var(--blue-10); color: var(--blue-70); }
.row-menu .rm-list button.danger:hover { background: var(--red-bg); color: var(--red); }
.bulk-bar { position: sticky; bottom: 18px; margin-top: 14px; background: var(--blue-90); color: #fff; border-radius: 12px; padding: 11px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 18px 50px rgba(11,17,48,0.3); z-index: 40; }
.bulk-bar b { font-size: 13.5px; }
.bulk-bar .btn { padding: 7px 14px; font-size: 12.5px; background: rgba(255,255,255,0.14); color: #fff; }
.bulk-bar .btn:hover { background: rgba(255,255,255,0.24); }
.bulk-bar .btn.danger:hover { background: var(--red); }
.bulk-bar .x { margin-left: auto; cursor: pointer; opacity: 0.7; font-size: 17px; }
.bulk-bar .x:hover { opacity: 1; }
td.cbx, th.cbx { width: 34px; padding-right: 0 !important; }

/* auth: error box, demo code, invalid field */
.auth-err { background: var(--red-bg); color: var(--red); border-radius: 9px; padding: 10px 13px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.demo-code-box { background: var(--blue-10); border: 1px dashed var(--blue-30); border-radius: 9px; padding: 9px 13px; font-size: 12.5px; color: var(--blue-70); margin-bottom: 14px; }
.demo-code-box b { font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.14em; }
.auth-form input.bad { border-color: var(--red); background: #FFF7F7; }

/* Google sign-in button + divider */
.g-btn-wrap { display: flex; justify-content: center; margin-bottom: 16px; min-height: 44px; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; color: var(--text-4); font-size: 12px; font-weight: 600; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.signed-note { background: var(--blue-10); border: 1px solid var(--blue-20); color: var(--blue-70); border-radius: 9px; padding: 9px 13px; font-size: 12.5px; margin-bottom: 14px; }

/* Segmented 6-digit code input */
.otp-boxes { display: flex; gap: 10px; }
.otp-boxes input { flex: 1; min-width: 0; height: 58px; text-align: center; font-family: var(--font-mono); font-size: 23px; font-weight: 700; color: var(--blue-90); border: 1.5px solid var(--border); border-radius: 12px; background: #fff; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; padding: 0; }
.otp-boxes input:focus { outline: none; border-color: var(--blue-50); box-shadow: 0 0 0 3px rgba(80,144,255,0.18); }
.otp-boxes input:not(:placeholder-shown), .otp-boxes input[value]:not([value=""]) { border-color: var(--blue-30); }
.otp-boxes.bad input { border-color: var(--red); background: #FFF7F7; animation: otpshake 0.28s ease-in-out; }
@keyframes otpshake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (max-width: 420px) { .otp-boxes { gap: 6px; } .otp-boxes input { height: 50px; font-size: 19px; } }
