/* ============================================================
   TikJump 设计系统 · 明暗双主题 · 高级质感
   ============================================================ */
:root {
  --brand: #7c3aed;        /* brand purple */
  --brand-2: #d946ef;      /* brand magenta */
  --brand-grad: linear-gradient(135deg, #7c3aed 0%, #d946ef 100%);
  --wa: #25d366;           /* WhatsApp green */
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
  --shadow: 0 4px 16px rgba(16,24,40,.08), 0 2px 6px rgba(16,24,40,.04);
  --shadow-lg: 0 24px 48px -12px rgba(16,24,40,.18);
  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);

  --font: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* Light theme */
:root, [data-theme="light"] {
  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #efe7ff 0%, transparent 55%),
             radial-gradient(1000px 500px at -10% 10%, #ffe7f6 0%, transparent 50%), #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --surface-3: #f3f4f9;
  --border: #eceef4;
  --border-strong: #e0e3ee;
  --text: #131622;
  --text-2: #545a6e;
  --text-3: #8b90a3;
  --card-glow: 0 1px 0 rgba(255,255,255,.6) inset;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0b0d16;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #2a1a52 0%, transparent 55%),
             radial-gradient(1000px 520px at -10% 5%, #3a1140 0%, transparent 50%), #0b0d16;
  --surface: #141726;
  --surface-2: #171a2b;
  --surface-3: #1d2135;
  --border: #232739;
  --border-strong: #2c3150;
  --text: #eef0f7;
  --text-2: #a4abc4;
  --text-3: #6f758f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 28px 60px -16px rgba(0,0,0,.6);
  --card-glow: 0 1px 0 rgba(255,255,255,.04) inset;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; }

/* ===== Common components ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--card-glow);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.brand { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--brand-grad); color: #fff; border: none; box-shadow: 0 6px 18px -6px var(--brand); }
.btn.primary:hover { filter: brightness(1.06); color: #fff; transform: translateY(-1px); }
.btn.wa { background: var(--wa); color: #06371c; border: none; font-weight: 700; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.icon { padding: 9px; width: 38px; height: 38px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: var(--ring); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.cb { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--text-2); }
.cb input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.grid { display: grid; gap: 16px; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }

/* Conversion funnel (shared by board dashboard + admin growth panel) */
.funnel-step { text-align: center; padding: 16px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.funnel-rate { position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 700; color: var(--warn); }
.funnel-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; margin: 0 auto 10px; }
.funnel-val { font-size: 28px; font-weight: 800; }
.funnel-label { font-size: 13px; font-weight: 600; margin-top: 4px; }
.funnel-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.center { display: flex; align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }

/* Table */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--text-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr.flagged td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
table.tbl tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--surface); padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .3s; z-index: 9999; font-weight: 600; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.fade-in { animation: fade .4s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
