/* ==========================================================================
   PayoutLens - Professional Dark Theme (v20)
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:            #0b1020;
  --bg-elev-1:     #0f172a;
  --bg-elev-2:     #131c35;
  --bg-elev-3:     #1b2545;
  --surface:       #111a32;
  --surface-hover: #182245;

  /* Borders & dividers */
  --border:        #1f2a4a;
  --border-strong: #2a3866;

  /* Text */
  --text:          #e6ecff;
  --text-muted:    #9aa6c7;
  --text-subtle:   #6d7aa0;
  --text-invert:   #0b1020;

  /* Brand / accents */
  --primary:       #6366f1;
  --primary-600:   #5458e3;
  --primary-700:   #4347c9;
  --accent:        #22d3ee;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  /* Effects */
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.3);
  --shadow:        0 6px 18px rgba(0,0,0,.35);
  --shadow-lg:     0 18px 48px rgba(0,0,0,.45);
  --focus-ring:    0 0 0 3px rgba(99,102,241,.35);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo,
               Consolas, 'Liberation Mono', monospace;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -200px, rgba(99,102,241,.15), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(34,211,238,.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

::selection { background: rgba(99,102,241,.45); color: #fff; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 .6em 0;
  line-height: 1.25;
}
h1 { font-size: 1.85rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: .95rem; }
h6 { font-size: .85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

p { margin: 0 0 1em 0; color: var(--text); }
small, .muted, .text-muted { color: var(--text-muted); }

a {
  color: #93a1ff;
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: #b6c0ff; text-decoration: underline; text-underline-offset: 3px; }

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: .9em;
}
code {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  color: #cdd6ff;
}
pre {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow: auto;
  color: #cdd6ff;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ---------- Layout ---------- */
.container, .wrap, main, .main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 28px;
}

header, .site-header, nav.top, .navbar {
  background: rgba(11,16,32,.85);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

header .container,
.site-header .container,
.navbar .container,
nav.top .container {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand, .logo, .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text) !important;
  text-decoration: none;
}
.brand::before, .logo::before, .navbar-brand::before {
  content: "";
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(99,102,241,.45);
}

nav a, .nav a, .navbar a, header a {
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
  font-weight: 500;
}
nav a:hover, .nav a:hover, .navbar a:hover, header a:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}
nav a.active, .nav a.active, .navbar a.active {
  color: var(--text);
  background: var(--bg-elev-3);
}

footer, .site-footer {
  margin-top: 48px;
  padding: 24px 28px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .9rem;
  text-align: center;
}

/* ---------- Cards / panels ---------- */
.card, .panel, .box, .tile {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev-1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.card:hover, .panel:hover, .tile:hover {
  border-color: var(--border-strong);
}

.kpi, .stat, .metric {
  background: linear-gradient(180deg, var(--surface), var(--bg-elev-1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.kpi .label, .stat .label, .metric .label {
  color: var(--text-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.kpi .value, .stat .value, .metric .value {
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.grid, .row, .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0 20px 0;
  font-size: .93rem;
}
thead { background: var(--bg-elev-2); }
th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .78rem;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:hover td { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Forms ---------- */
form { margin: 0; }

label, .label {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-elev-1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: .95rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  outline: none;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  background: var(--bg-elev-2);
}
input:disabled, select:disabled, textarea:disabled {
  opacity: .55;
  cursor: not-allowed;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.form-row, .field, .form-group { margin-bottom: 14px; }

/* ---------- Buttons ---------- */
button, .btn, input[type="submit"], input[type="button"], a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff !important;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: .92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s ease, border-color .15s ease,
              transform .05s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-sm);
  line-height: 1.2;
}
button:hover, .btn:hover, input[type="submit"]:hover, a.btn:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
}
button:active, .btn:active, input[type="submit"]:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, input[type="submit"]:focus-visible {
  box-shadow: var(--focus-ring);
}
button:disabled, .btn:disabled, input[type="submit"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn-secondary, .btn.secondary, button.secondary {
  background: var(--bg-elev-2);
  color: var(--text) !important;
  border-color: var(--border-strong);
}
.btn-secondary:hover, .btn.secondary:hover, button.secondary:hover {
  background: var(--bg-elev-3);
}

.btn-ghost, .btn.ghost {
  background: transparent;
  color: var(--text) !important;
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-hover); }

.btn-danger, .btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-success, .btn.success {
  background: var(--success);
  border-color: var(--success);
}

.btn-sm, .btn.sm { padding: 6px 10px; font-size: .82rem; }
.btn-lg, .btn.lg { padding: 12px 22px; font-size: 1rem; }

/* ---------- Badges / pills ---------- */
.badge, .pill, .tag, .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: .76rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-elev-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  letter-spacing: .02em;
}
.badge-success, .badge.success { background: rgba(16,185,129,.15); color: #6ee7b7; border-color: rgba(16,185,129,.35); }
.badge-warning, .badge.warning { background: rgba(245,158,11,.15); color: #fcd34d; border-color: rgba(245,158,11,.35); }
.badge-danger,  .badge.danger  { background: rgba(239,68,68,.15);  color: #fca5a5; border-color: rgba(239,68,68,.35); }
.badge-info,    .badge.info    { background: rgba(59,130,246,.15); color: #93c5fd; border-color: rgba(59,130,246,.35); }

/* ---------- Alerts / flashes ---------- */
.alert, .flash, .notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  margin: 12px 0;
}
.alert-success, .flash.success { background: rgba(16,185,129,.10); border-color: rgba(16,185,129,.4); color: #a7f3d0; }
.alert-warning, .flash.warning { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.4); color: #fde68a; }
.alert-danger,  .flash.danger,
.alert-error,   .flash.error   { background: rgba(239,68,68,.10);  border-color: rgba(239,68,68,.4);  color: #fecaca; }
.alert-info,    .flash.info    { background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.4); color: #bfdbfe; }

/* ---------- Auth / landing ---------- */
.auth-wrap, .auth, .login, .signup {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card, .login .card, .signup .card {
  max-width: 420px;
  width: 100%;
  padding: 28px 26px;
  background: linear-gradient(180deg, var(--surface), var(--bg-elev-1));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* ---------- Utilities ---------- */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* Numeric / monospace columns in tables */
td.num, .num, .money {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  text-align: right;
}

/* Scrollbars (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-elev-1); }
::-webkit-scrollbar-thumb {
  background: var(--bg-elev-3);
  border-radius: 8px;
  border: 2px solid var(--bg-elev-1);
}
::-webkit-scrollbar-thumb:hover { background: #2d3a6e; }

/* Responsive */
@media (max-width: 720px) {
  .container, .wrap, main, .main { padding: 16px; }
  h1 { font-size: 1.5rem; }
  table { font-size: .88rem; }
  header .container, .navbar .container { flex-wrap: wrap; }
}


/* === v23 nav scroll strip === */
html, body { overflow-x: hidden; }

nav { max-width: 100vw; }

nav .pl-navlinks {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-elev-3) transparent;
  white-space: nowrap;
  max-width: 100%;
  padding-bottom: 4px;
  mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
nav .pl-navlinks::-webkit-scrollbar { height: 6px; }
nav .pl-navlinks::-webkit-scrollbar-thumb { background: var(--bg-elev-3); border-radius: 4px; }
nav .pl-navlinks a { flex: 0 0 auto; }

nav > div {
  flex-wrap: nowrap !important;
  overflow: hidden;
}

/* Make sure page content never causes horizontal page scroll */
main, .main, .container, .wrap { max-width: 100%; overflow-x: hidden; }

