/* ================================================================
   PerdiemPay — Design System v3 (Adaptive Light / Dark Theme)
   Theme driven by [data-theme] on <html>.
   Falls back to prefers-color-scheme via theme.js.
   Brand: #00BCD4 cyan | #FF6B35 orange | #22C55E green
   ================================================================ */

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* ── Brand constants (theme-independent) ─────────────────────── */
:root {
  --primary:        #00BCD4;
  --primary-dark:   #0097A7;
  --primary-light:  rgba(0,188,212,.12);
  --accent:         #FF6B35;
  --accent-light:   rgba(255,107,53,.12);
  --success:        #22C55E;
  --success-light:  rgba(34,197,94,.12);
  --warning:        #F59E0B;
  --warning-light:  rgba(245,158,11,.12);
  --danger:         #EF4444;
  --danger-light:   rgba(239,68,68,.12);

  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --radius-xl:      20px;
  --radius-full:    9999px;

  --nav-h:          60px;
  --bottom-nav-h:   68px;

  /* Transition for theme switch */
  --theme-transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* ── DARK theme tokens ───────────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #101827;
  --bg-card:        #172236;
  --bg-elevated:    #202d45;
  --bg-input:       #111c30;
  --border:         #31415e;
  --border-light:   #25334c;
  --white:          #ffffff;
  --text:           #f1f6fc;
  --text-muted:     #adbbcf;
  --text-faint:     #7889a4;
  --shadow:         0 1px 4px rgba(2,8,23,.36);
  --shadow-md:      0 6px 20px rgba(2,8,23,.42);
  --shadow-lg:      0 14px 44px rgba(2,8,23,.5);
  --nav-bg:         rgba(16,24,39,.9);
  --nav-blur:       blur(16px);

  /* Wallet hero gradient */
  --wallet-hero-bg: linear-gradient(135deg, #123b4d 0%, #152945 100%);
  --wallet-hero-border: rgba(0,188,212,.2);
}

/* ── LIGHT theme tokens ──────────────────────────────────────── */
[data-theme="light"] {
  --bg:             #f0f9ff;
  --bg-card:        #ffffff;
  --bg-elevated:    #f8fafc;
  --bg-input:       #ffffff;
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;
  --white:          #ffffff;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-faint:     #94a3b8;
  --shadow:         0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.07);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.09);
  --nav-bg:         rgba(255,255,255,.92);
  --nav-blur:       blur(12px);

  /* Wallet hero gradient */
  --wallet-hero-bg: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
  --wallet-hero-border: rgba(0,188,212,.3);
}

/* ── Base ────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  transition: var(--theme-transition);
}
[data-theme-lock="light"] .theme-toggle { display: none !important; }

/* ── Theme toggle button ─────────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-muted); transition: color .15s, background .15s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.theme-toggle svg { width: 16px; height: 16px; }
.hidden { display: none !important; }

/* ── Typography ──────────────────────────────────────────────── */
.text-xs    { font-size: .75rem; }
.text-sm    { font-size: .875rem; }
.text-base  { font-size: 1rem; }
.text-lg    { font-size: 1.125rem; }
.text-xl    { font-size: 1.25rem; }
.text-2xl   { font-size: 1.5rem; }
.text-3xl   { font-size: 1.875rem; }
.font-medium{ font-weight: 500; }
.font-semi  { font-weight: 600; }
.font-bold  { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }

/* ── Logo ────────────────────────────────────────────────────── */
.fl-logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.125rem; color: var(--text);
  letter-spacing: -.01em;
}
.fl-logo span { color: var(--primary); }
.fl-logo-icon {
  width: 34px; height: 34px; background: var(--primary);
  border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
}
.fl-logo-icon svg { width: 18px; height: 18px; fill: white; }

.brand-lockup {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); font-size: 1.125rem; font-weight: 800;
  letter-spacing: -.025em; line-height: 1; white-space: nowrap;
}
.brand-lockup__mark { width: 40px; height: 34px; color: #03c4df; filter: drop-shadow(0 5px 10px rgba(0,188,212,.16)); flex: 0 0 auto; }
.brand-lockup__name span { color: #09c9e6; }
.brand-lockup--light { color: #fff; }
.brand-lockup--light .brand-lockup__mark { color: #16d6ec; }
.brand-lockup--compact .brand-lockup__mark { margin: 0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; border: none; cursor: pointer;
  transition: opacity .15s, transform .1s, background .15s; white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-accent   { background: var(--accent);   color: #fff; }
.btn-accent:hover   { opacity: .9; }
.btn-success  { background: var(--success);  color: #fff; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-elevated); }
.btn-dark     { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-dark:hover { border-color: var(--primary); }

.btn-sm  { padding: 7px 14px; font-size: .8125rem; }
.btn-lg  { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-xl  { padding: 16px 32px; font-size: 1.0625rem; border-radius: var(--radius); }
.btn-full { width: 100%; }

.btn-loading { opacity: .7; pointer-events: none; }
.btn-loading::after {
  content: ''; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: white;
  border-radius: 50%; animation: spin .7s linear infinite; margin-left: 6px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: var(--theme-transition);
}
.card-body    { padding: 1.25rem; }
.card-header  {
  padding: .875rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; font-weight: 700;
}

/* ── Form Controls ───────────────────────────────────────────── */
.form-group   { margin-bottom: 1rem; }
.form-label   { display: block; font-size: .75rem; font-weight: 700; margin-bottom: .4rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.form-control {
  width: 100%; background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px; color: var(--text);
  font-size: .9375rem; transition: border-color .15s, background .15s; -webkit-appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-control::placeholder { color: var(--text-faint); }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: .875rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: var(--success-light); color: #16a34a;  border-color: rgba(34,197,94,.3); }
.alert-danger  { background: var(--danger-light);  color: #dc2626;  border-color: rgba(239,68,68,.3); }
.alert-warning { background: var(--warning-light); color: #d97706;  border-color: rgba(245,158,11,.3); }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border-color: rgba(0,188,212,.3); }
[data-theme="dark"] .alert-success { color: #4ade80; }
[data-theme="dark"] .alert-danger  { color: #f87171; }
[data-theme="dark"] .alert-warning { color: #fbbf24; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-full); font-size: .75rem; font-weight: 700; }
.badge-primary { background: var(--primary-light);  color: var(--primary-dark); }
.badge-success { background: var(--success-light);  color: #16a34a; }
.badge-warning { background: var(--warning-light);  color: #d97706; }
.badge-danger  { background: var(--danger-light);   color: #dc2626; }
.badge-gray    { background: var(--bg-elevated);    color: var(--text-muted); }
.badge-hot     { background: var(--accent-light);   color: var(--accent); }
[data-theme="dark"] .badge-success { color: #4ade80; }
[data-theme="dark"] .badge-danger  { color: #f87171; }
[data-theme="dark"] .badge-warning { color: #fbbf24; }

/* ── Dashboard campaign slider ───────────────────────────────── */
.dashboard-slider { width:100%; max-width:1120px; margin:0 auto 1rem; overflow:hidden; }
.dashboard-slider__viewport { position:relative; width:100%; overflow:hidden; border-radius:var(--radius-lg); aspect-ratio:5/2; box-shadow:var(--shadow-md); background:#020817; border:1px solid var(--border); }
.dashboard-slider__track { display:block; width:100%; height:100%; }
.dashboard-slider__slide { position:absolute; inset:0; width:100%; height:100%; overflow:hidden; opacity:0; visibility:hidden; transition:opacity .35s ease; pointer-events:none; }
.dashboard-slider__slide.active { opacity:1; visibility:visible; pointer-events:auto; z-index:1; }
.dashboard-slider__slide img { display:block; width:100%; height:100%; object-fit:contain; object-position:center; }
.dashboard-slider__controls { display:flex; align-items:center; justify-content:center; gap:.75rem; min-height:30px; margin-top:.4rem; }
.dashboard-slider__dots { display:flex; align-items:center; justify-content:center; gap:6px; }
.dashboard-slider__dots button { width:7px; height:7px; padding:0; border:0; border-radius:999px; background:var(--border); cursor:pointer; transition:width .2s,background .2s; }
.dashboard-slider__dots button.active { width:22px; background:var(--primary); }
.dashboard-slider__arrow { width:28px; height:28px; display:grid; place-items:center; padding:0; border:1px solid var(--border); border-radius:50%; background:var(--bg-card); color:var(--text-muted); cursor:pointer; font-size:1.2rem; line-height:1; }
.dashboard-slider__arrow:hover,.dashboard-slider__arrow:focus-visible { color:var(--primary); border-color:var(--primary); outline:none; }
.adv-dashboard-slider,.admin-dashboard-slider { max-width:1120px; margin-left:auto; margin-right:auto; }
@media (prefers-reduced-motion:reduce) {
  .dashboard-slider__slide { transition:none; }
  .dashboard-slider__dots button { transition:none; }
}

/* ── User App Header ─────────────────────────────────────────── */
.user-header {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: var(--nav-bg); backdrop-filter: var(--nav-blur);
  border-bottom: 1px solid var(--border);
  padding: 0 16px; display: flex; align-items: center; justify-content: space-between;
  transition: var(--theme-transition);
}
.header-left  { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.hamburger-btn {
  width: 36px; height: 36px; background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.hamburger-btn span { display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; }
.notif-btn {
  position: relative; width: 36px; height: 36px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; display: grid; place-items: center; font-size: 18px;
}
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; background: var(--accent);
  border-radius: 50%; border: 2px solid var(--bg-card);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 199; }
.sidebar-overlay.open { display: block; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 280px;
  background: var(--bg-card); border-right: 1px solid var(--border);
  z-index: 200; padding: 20px 0;
  transform: translateX(-100%); transition: transform .25s ease, background .2s, border-color .2s;
  display: flex; flex-direction: column;
}
.sidebar.open { transform: translateX(0); }
.sidebar-header {
  padding: 0 20px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.sidebar-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-elevated); border: none; color: var(--text-muted);
  cursor: pointer; display: grid; place-items: center; font-size: 16px;
}
.sidebar-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: var(--radius-sm); font-size: .9375rem; font-weight: 500;
  color: var(--text-muted); transition: background .15s, color .15s; margin-bottom: 2px;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--primary-light); color: var(--primary); }
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.sidebar-footer button {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none;
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--danger);
  font-size: .875rem; font-weight: 600; cursor: pointer;
}
.sidebar-footer button:hover { background: var(--danger-light); }

/* ── Main page layout ────────────────────────────────────────── */
.user-page {
  padding: 16px 16px calc(var(--bottom-nav-h) + 16px);
  min-height: calc(100dvh - var(--nav-h));
  max-width: 480px; margin: 0 auto;
}

/* ── Bottom Navigation ───────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-h);
  background: var(--bg-card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 90; padding: 0 8px 4px; max-width: 480px; margin: 0 auto;
  transition: var(--theme-transition);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; padding: 6px 4px;
  font-size: .6875rem; font-weight: 600; color: var(--text-faint); transition: color .15s;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.75; display: block; margin: 0 auto 2px; }

/* ── Page Title ──────────────────────────────────────────────── */
.page-title    { font-size: 1.625rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.page-subtitle { font-size: .875rem; color: var(--text-muted); margin-bottom: 20px; }

/* ── Dashboard Wallet Hero ───────────────────────────────────── */
.wallet-hero {
  background: var(--wallet-hero-bg);
  border: 1px solid var(--wallet-hero-border);
  border-radius: var(--radius-xl); padding: 22px 20px 20px; margin-bottom: 20px;
}
[data-theme="light"] .wallet-hero { color: #0f172a; }
.wh-greeting  { font-size: 14px; color: var(--text-muted); margin-bottom: 2px; }
.wh-tier-badge {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; padding: 3px 10px; border-radius: var(--radius-full);
  background: var(--primary-light); color: var(--primary); text-transform: uppercase;
}
.wh-bal-label  { font-size: 13px; color: var(--text-muted); margin-top: 16px; margin-bottom: 4px; }
.wh-bal-amount { font-size:clamp(2rem,8vw,2.5rem); font-weight:900; letter-spacing:0; font-variant-numeric:tabular-nums; line-height:1.15; overflow-wrap:anywhere; }
[data-theme="light"] .wh-bal-amount { color: #0f172a; }
.wh-stats { display: flex; gap: 28px; margin-top: 14px; margin-bottom: 18px; }
.wh-stat-val  { font-size: .875rem; font-weight: 700; }
[data-theme="light"] .wh-stat-val { color: #0f172a; }
.wh-stat-lbl  { font-size: .75rem; color: var(--text-muted); }
.wh-actions   { display: flex; gap: 10px; }
.wh-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 700; border: none; cursor: pointer;
  transition: opacity .15s; text-align: center; display: block;
}
.wh-btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.wh-btn-outline:hover { background: var(--primary-light); }
.wh-btn-accent  { background: var(--accent); color: white; box-shadow: 0 4px 12px rgba(255,107,53,.3); }
.wh-btn-accent:hover { opacity: .9; }

/* ── Quick Actions ───────────────────────────────────────────── */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.quick-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  transition: border-color .15s, transform .1s, var(--theme-transition); cursor: pointer;
}
.quick-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.qc-icon  { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 10px; }
.qc-title { font-size: .875rem; font-weight: 700; margin-bottom: 3px; }
.qc-sub   { font-size: .75rem; color: var(--text-muted); }

/* ── Referral Code Widget ────────────────────────────────────── */
.ref-widget { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px; }
.ref-code-val { font-size: 1.625rem; font-weight: 900; letter-spacing: .12em; color: var(--accent); font-family: monospace; }

/* ── Task Cards ──────────────────────────────────────────────── */
.task-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; align-items: center; gap: 12px;
  transition: border-color .15s, var(--theme-transition); position: relative; overflow: hidden;
}
.task-card:hover { border-color: var(--primary); }
.task-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--bg-elevated); display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.task-body  { flex: 1; min-width: 0; }
.task-title { font-size: .9375rem; font-weight: 700; margin-bottom: 3px; }
.task-meta  { font-size: .75rem; color: var(--text-muted); }
.task-payout { font-size: 1rem; font-weight: 800; color: var(--primary); flex-shrink: 0; }
.hot-badge {
  position: absolute; top: 8px; right: 8px; background: var(--accent); color: white;
  font-size: .65rem; font-weight: 800; padding: 2px 7px; border-radius: var(--radius-full);
}

/* ── Filter Tabs ─────────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px;
  border-radius: var(--radius-full); font-size: .8125rem; font-weight: 600; white-space: nowrap;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted);
  transition: all .15s; cursor: pointer;
}
.filter-tab.active { background: var(--primary); color: white; border-color: transparent; }
.filter-tab:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ── Wallet Page ─────────────────────────────────────────────── */
.balance-card { background: var(--wallet-hero-bg); border: 1px solid var(--wallet-hero-border); border-radius: var(--radius-xl); padding: 22px 20px; }
[data-theme="light"] .balance-card { color: #0f172a; }
.bal-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.bal-amount { font-size:clamp(1.9rem,8vw,2.25rem); font-weight:900; letter-spacing:0; font-variant-numeric:tabular-nums; line-height:1.15; overflow-wrap:anywhere; }
[data-theme="light"] .bal-amount { color: #0f172a; }
.bal-actions { display: flex; gap: 10px; margin-top: 16px; }
.bal-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 700;
  cursor: pointer; text-align: center; background: var(--bg-elevated);
  border: 1px solid var(--border); color: var(--text); transition: border-color .15s;
}
.bal-btn:hover { border-color: var(--primary); color: var(--primary); }
[data-theme="light"] .bal-btn { background: rgba(255,255,255,.7); }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; transition: var(--theme-transition); }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size:clamp(1rem,3.2vw,1.125rem); font-weight:800; letter-spacing:0; font-variant-numeric:tabular-nums; line-height:1.25; overflow-wrap:anywhere; }
.money-value { letter-spacing:0!important; font-variant-numeric:tabular-nums; line-height:1.15; overflow-wrap:anywhere; }

/* ── Transaction Rows ────────────────────────────────────────── */
.tx-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.tx-row:last-child { border-bottom: none; }
.tx-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.tx-credit .tx-icon { background: var(--success-light); color: var(--success); }
.tx-debit  .tx-icon { background: var(--danger-light);  color: var(--danger); }
.tx-label { flex: 1; min-width: 0; }
.tx-label strong { font-size: .875rem; font-weight: 600; display: block; }
.tx-label span   { font-size: .75rem;  color: var(--text-muted); }
.tx-amount { font-weight: 700; font-size: .9375rem; }
.tx-credit .tx-amount { color: var(--success); }
.tx-debit  .tx-amount { color: var(--danger); }

/* ── Withdraw Page ───────────────────────────────────────────── */
.withdraw-page { max-width: 480px; margin: 0 auto; }
.wd-balance-banner { background: var(--wallet-hero-bg); border: 1px solid var(--wallet-hero-border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
[data-theme="light"] .wd-balance-banner { color: #0f172a; }
.wd-bal-val { font-size: 1.75rem; font-weight: 900; letter-spacing: -.03em; }
.wd-min-note { font-size: 12px; color: var(--text-muted); }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; font-weight: 800; font-size: 15px; display: grid; place-items: center; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

/* ── Profile Page ────────────────────────────────────────────── */
.profile-hero { background: var(--wallet-hero-bg); border: 1px solid var(--wallet-hero-border); border-radius: var(--radius-xl); padding: 22px 20px; margin-bottom: 16px; display: flex; align-items: center; gap: 14px; }
[data-theme="light"] .profile-hero { color: #0f172a; }
.profile-info h2 { font-size: 1.125rem; font-weight: 800; margin-bottom: 2px; }
.profile-info p  { font-size: .8125rem; color: var(--text-muted); }
.profile-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border-light); font-size: .9375rem; }
.profile-detail-row:last-child { border-bottom: none; }
.pd-label { color: var(--text-muted); }
.pd-value { font-weight: 600; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon  { font-size: 2.5rem; margin-bottom: 12px; color: var(--text-faint); }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; line-height: 1.6; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.pagination .page-item .page-link { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); font-size: .8125rem; font-weight: 600; }
.pagination .page-item.active .page-link { background: var(--primary); color: white; border-color: transparent; }
.pagination .page-item.disabled .page-link { opacity: .35; }

/* ── Admin (always light) ────────────────────────────────────── */
.admin-shell { background: #f8fafc; color: #0f172a; min-height: 100vh; }

/* ── Auth Pages ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem 1rem;
  background: var(--bg); transition: var(--theme-transition);
}
.auth-card {
  width: 100%; max-width: 440px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 2rem; box-shadow: var(--shadow-lg); transition: var(--theme-transition);
}
.auth-header { text-align: center; margin-bottom: 1.75rem; }
.auth-header h1 { font-size: 1.5rem; font-weight: 800; margin-top: 1rem; }
.auth-header p  { color: var(--text-muted); font-size: .9375rem; margin-top: .3rem; }
.auth-brand-mark {
  width: 54px; height: 54px; margin: 0 auto;
  display: grid; place-items: center; border-radius: 15px;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 25px rgba(0,188,212,.22);
}
.auth-brand-mark svg { width: 27px; height: 27px; }
.auth-brand-mark.advertiser {
  background: linear-gradient(135deg,#7C3AED,#4F46E5);
  box-shadow: 0 10px 25px rgba(124,58,237,.28);
}
.auth-portal-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: .8rem; padding: 5px 10px; border-radius: var(--radius-full);
  color: var(--primary); background: var(--primary-light);
  font-size: .6875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.auth-portal-badge svg { width: 13px; height: 13px; }
.auth-portal-badge.advertiser { color: #A78BFA; background: rgba(124,58,237,.14); }
.auth-portal-switch {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: .75rem; color: var(--text-faint); font-size: .78rem;
}
.auth-portal-switch a { color: var(--text-muted); font-weight: 700; }
.auth-portal-switch a:hover { color: var(--primary); }
.auth-inline-icon { width: 16px; height: 16px; flex-shrink: 0; }
.auth-trust-row {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-light);
}
.auth-trust-item { font-size: 11px; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }
.auth-trust-item svg { width: 13px; height: 13px; color: var(--success); }
.advertiser-auth-page {
  background: radial-gradient(circle at 50% 0%, rgba(124,58,237,.2), transparent 42%), var(--bg);
}
.advertiser-auth-page .auth-card { max-width: 480px; }

/* ── Utility ─────────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}
.flex-1{flex:1}.min-w-0{min-width:0}.w-full{width:100%}
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}
.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}
.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}
.p-4{padding:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem}
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; }
/* Explicit card tables are responsive by construction, not viewport detection. */
.table-wrap > .mobile-card-table { min-width:0; display:block; }
.mobile-card-table thead { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.mobile-card-table tbody { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr)); gap:12px; padding:12px; }
.mobile-card-table tbody tr { display:block; min-width:0; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:12px 14px; box-shadow:var(--shadow); }
.mobile-card-table tbody td { display:flex; width:100%; align-items:center; justify-content:space-between; gap:16px; padding:8px 0!important; border-bottom:1px solid var(--border-light)!important; text-align:right; white-space:normal!important; min-width:0!important; }
.mobile-card-table tbody td:last-child { border-bottom:0!important; }
.mobile-card-table tbody td::before { content:attr(data-label); color:var(--text-muted); font-size:.6875rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; text-align:left; flex-shrink:0; }
.mobile-card-table tbody td[data-label="Campaign"],.mobile-card-table tbody td[data-label="User"] { display:block; text-align:left; font-size:1rem; }
.mobile-card-table tbody td[data-label="Campaign"]::before,.mobile-card-table tbody td[data-label="User"]::before { display:none; }
.mobile-card-table tbody td[data-label="Actions"] > div { width:100%; justify-content:flex-end; flex-wrap:wrap; }
.mobile-card-table tbody tr.table-empty { grid-column:1/-1; padding:30px 16px; }
.mobile-card-table tbody tr.table-empty td { display:block; border:0!important; text-align:center!important; padding:0!important; }
.mobile-card-table tbody tr.table-empty td::before { display:none; }
.admin-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.adv-summary-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.5rem; margin-bottom: 1.5rem; align-items: start; }
.adv-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; }
.rounded-full{border-radius:var(--radius-full)}
.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.divider{border:none;border-top:1px solid var(--border-light);margin:1rem 0}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity:1; transform:translateY(0); } }
.fade-in { animation: fadeIn .2s ease; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (min-width: 481px) {
  .bottom-nav { left: 50%; transform: translateX(-50%); }
  .user-page  { padding-bottom: calc(var(--bottom-nav-h) + 24px); }
}
@media (min-width: 700px) {
  .user-page { max-width: 720px; padding-left: 24px; padding-right: 24px; }
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .admin-chart-grid, .adv-summary-grid, .adv-dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  /* Sidebars reduce usable width well before the phone breakpoint. */
  .table-wrap > .mobile-card-table { min-width:0; border-spacing:0 10px; }
  .mobile-card-table thead { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
  .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display:block; width:100%; }
  .mobile-card-table tbody { padding:0 10px 10px; }
  .mobile-card-table tbody tr { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:10px 12px; margin-top:10px; box-shadow:var(--shadow); }
  .mobile-card-table tbody td { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:8px 0!important; border-bottom:1px solid var(--border-light)!important; text-align:right; white-space:normal!important; min-width:0!important; }
  .mobile-card-table tbody td:last-child { border-bottom:0!important; }
  .mobile-card-table tbody td::before { content:attr(data-label); color:var(--text-muted); font-size:.6875rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; text-align:left; flex-shrink:0; }
  .mobile-card-table tbody td[data-label="Campaign"], .mobile-card-table tbody td[data-label="User"] { display:block; text-align:left; font-size:1rem; padding-bottom:10px!important; }
  .mobile-card-table tbody td[data-label="Campaign"]::before, .mobile-card-table tbody td[data-label="User"]::before { display:none; }
  .mobile-card-table tbody td[data-label="Progress"] > div { width:min(160px,45vw); }
  .mobile-card-table tbody td[data-label="Actions"] > div { width:100%; justify-content:flex-end; flex-wrap:wrap; }
  .mobile-card-table tbody td[data-label="Actions"] .btn { flex:1; min-width:90px; }
  .mobile-card-table tbody tr.table-empty { display:block; padding:28px 16px; }
  .mobile-card-table tbody tr.table-empty td { display:block; border:0!important; text-align:center!important; padding:0!important; }
  .mobile-card-table tbody tr.table-empty td::before { display:none; }
}
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card-header { gap: .75rem; flex-wrap: wrap; }
  .table-wrap { margin-inline: -1px; }
  .table-wrap th, .table-wrap td { white-space: nowrap; }

  /* Dense campaign tables become readable cards on phones. */
  .table-wrap > .mobile-card-table { min-width: 0; border-spacing: 0 10px; }
  .mobile-card-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table tbody { padding: 0 10px 10px; }
  .mobile-card-table tbody tr { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-top: 10px; box-shadow: var(--shadow-sm); }
  .mobile-card-table tbody td { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0 !important; border-bottom: 1px solid var(--border-light) !important; text-align: right; white-space: normal !important; }
  .mobile-card-table tbody td:last-child { border-bottom: 0 !important; }
  .mobile-card-table tbody td::before { content: attr(data-label); color: var(--text-muted); font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; text-align: left; flex-shrink: 0; }
  .mobile-card-table tbody td[data-label="Campaign"] { display: block; text-align: left; font-size: 1rem; padding-bottom: 10px !important; }
  .mobile-card-table tbody td[data-label="Campaign"]::before { display: none; }
  .mobile-card-table tbody td[data-label="Progress"] > div { width: 120px; }
  .mobile-card-table tbody td[data-label="Actions"] .btn { width: 100%; justify-content: center; }
}
@media (max-width: 520px) {
  .brand-lockup__name { font-size: .95rem; }
  .admin-content, .adv-content { padding: .875rem !important; }
  .filter-tabs { max-width: calc(100vw - 140px); }
  .task-card { align-items:flex-start; padding:12px; }
  .task-payout { font-size:.875rem; padding-top:2px; }
}

/* v33: CODEX-style editable image preloader and dark-safe selectors */
.bank-select-trigger{width:100%;min-height:52px;background:#071827;border:1.5px solid var(--border);border-radius:var(--radius-sm);padding:12px 14px;color:#f8fafc;font-size:.975rem;font-weight:700;display:flex;align-items:center;justify-content:space-between;cursor:pointer;transition:border-color .15s,box-shadow .15s,background .15s;}
.bank-select-trigger.is-open{border-color:var(--primary);box-shadow:0 0 0 3px rgba(0,188,212,.12);}
.bank-select-trigger .bank-placeholder{color:#94a3b8;font-weight:600;}
.bank-select-trigger .bank-selected{color:#f8fafc;font-weight:800;}
.bank-select-panel{position:absolute;top:calc(100% + 6px);left:0;right:0;background:#071827;border:1.5px solid var(--primary);border-radius:var(--radius-sm);z-index:200;box-shadow:var(--shadow-lg);overflow:hidden;}
.bank-select-search{width:100%;background:#061322;border:1px solid rgba(148,163,184,.28);border-radius:var(--radius-sm);padding:9px 10px 9px 32px;color:#f8fafc;font-size:.875rem;outline:none;}
.bank-select-search::placeholder{color:#94a3b8;}
.bank-select-option{padding:12px 16px;cursor:pointer;font-size:.9375rem;transition:background .1s,color .1s;display:flex;align-items:center;justify-content:space-between;color:#f8fafc;}
.bank-select-option:hover{background:rgba(255,255,255,.06);}
.bank-select-option.is-selected{background:rgba(0,188,212,.16);color:#67e8f9;font-weight:800;}
[data-theme="light"] .bank-select-trigger{background:#fff;color:#0f172a;}
[data-theme="light"] .bank-select-trigger .bank-selected{color:#0f172a;}
[data-theme="light"] .bank-select-panel{background:#fff;}
[data-theme="light"] .bank-select-search{background:#fff;color:#0f172a;border-color:#cbd5e1;}
[data-theme="light"] .bank-select-option{color:#0f172a;}
[data-theme="light"] .bank-select-option:hover{background:#f1f5f9;}
[data-theme="light"] .bank-select-option.is-selected{background:#e0f7fb;color:#0891b2;}
.app-preloader{position:fixed;inset:0;z-index:99999;display:grid;place-items:center;background:radial-gradient(circle at 50% 43%,rgba(0,221,255,.22),transparent 30%),linear-gradient(145deg,#020817 0%,#071626 52%,#020817 100%);transition:opacity .28s ease,visibility .28s ease;}
.app-preloader.is-hidden{opacity:0;visibility:hidden;pointer-events:none;}
.app-preloader-card{width:min(420px,82vw);display:grid;justify-items:center;gap:20px;padding:0;background:transparent;border:0;border-radius:0;box-shadow:none;backdrop-filter:none;}
.app-preloader-image{width:min(260px,68vw);height:150px;object-fit:contain;filter:drop-shadow(0 0 34px rgba(0,221,255,.48));animation:preloaderFloat 1.9s ease-in-out infinite;}
.app-preloader-bar{width:min(220px,52vw);height:4px;border-radius:999px;overflow:hidden;background:rgba(148,163,184,.18);}
.app-preloader-bar span{display:block;width:42%;height:100%;border-radius:inherit;background:linear-gradient(90deg,#00bcd4,#7dd3fc,#00f5d4);animation:preloaderSlide 1.05s ease-in-out infinite;}
.app-preloader p{margin:0;color:#dffbff;font-size:.78rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;}
@keyframes preloaderFloat{0%,100%{transform:translateY(0) scale(1)}50%{transform:translateY(-7px) scale(1.015)}}
@keyframes preloaderSlide{0%{transform:translateX(-110%)}100%{transform:translateX(250%)}}
@media (prefers-reduced-motion:reduce){.app-preloader-image,.app-preloader-bar span{animation:none}.app-preloader-bar span{width:100%}}
