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

/* ── Theme Variables — LIGHT DEFAULT ── */
:root {
  --bg:       #f5f6fa;
  --bg2:      #ffffff;
  --bg3:      #eef0f7;
  --border:   #d1d5e8;
  --text:     #2a2d3e;
  --muted:    #8a90b0;
  --accent:   #5b52d0;
  --accent2:  #4440a0;
  --green:    #1da870;
  --red:      #d94f4f;
  --yellow:   #c9a000;
  --radius:   6px;
  --font:     'Inter', system-ui, -apple-system, sans-serif;
  --mono:     'JetBrains Mono', 'Fira Code', monospace;
  --shadow:   0 2px 12px rgba(90,100,160,.10);
  --sidebar-w: 220px;
}

/* ── Dark Theme ── */
[data-theme="dark"] {
  --bg:       #0f1117;
  --bg2:      #181c27;
  --bg3:      #1e2235;
  --border:   #2a2f45;
  --text:     #d4d8f0;
  --muted:    #6b7299;
  --accent:   #7c6ef5;
  --accent2:  #5b52d0;
  --green:    #3ecf8e;
  --red:      #f06060;
  --yellow:   #f5c842;
  --shadow:   0 2px 12px rgba(0,0,0,.35);
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); text-decoration: underline; }
a.active { color: var(--text); font-weight: 600; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
h2 { font-size: 1.1rem; font-weight: 600; color: var(--text); }
h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); margin: 14px 0 8px; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg3);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

small { font-size: 11px; color: var(--muted); }

select option { background: var(--bg2); color: var(--text); }
[data-theme="dark"] select option { background: var(--bg2); }
th { background: var(--bg3); }

/* ── Theme Toggle — Fixed Bottom Right ── */
.theme-toggle-fixed {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: all .15s;
}
.theme-toggle-fixed:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(91,82,208,.25); }

/* ── Flash Messages ── */
.flash-container { padding: 8px 16px; }
.flash {
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
  font-size: 13px;
}
.flash--error   { border-color: var(--red);    background: rgba(217,79,79,.1);   color: var(--red); }
.flash--success { border-color: var(--green);  background: rgba(29,168,112,.1);  color: var(--green); }
.flash--info    { border-color: var(--accent); background: rgba(91,82,208,.1);   color: var(--accent); }

/* ── Auth Pages ── */
.auth-wrap {
  max-width: 400px;
  margin: 80px auto;
  padding: 32px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.auth-wrap h1 { margin-bottom: 4px; }
.auth-wrap > p { color: var(--muted); font-size: 13px; margin-bottom: 0; }

/* ── Notice ── */
.notice {
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  margin: 12px 0;
  line-height: 1.7;
  font-size: 13px;
}
.notice--info    { background: rgba(91,82,208,.08);  color: var(--text); }
.notice--warning { background: rgba(201,160,0,.08);  border-color: var(--yellow); }
.notice--danger  { background: rgba(217,79,79,.08);  border-color: var(--red); }

/* ── Forms ── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 120px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,82,208,.15);
}
textarea { resize: vertical; }

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--border); }

button.btn--primary, .btn--primary { background: var(--accent); border-color: var(--accent2); color: #fff; }
button.btn--primary:hover, .btn--primary:hover { background: var(--accent2); }
button.btn--danger, .btn--danger { background: rgba(217,79,79,.12); border-color: var(--red); color: var(--red); }
button.btn--danger:hover, .btn--danger:hover { background: rgba(217,79,79,.25); }
button.btn--success, .btn--success { background: rgba(29,168,112,.12); border-color: var(--green); color: var(--green); }
button.btn--success:hover, .btn--success:hover { background: rgba(29,168,112,.25); }
button.btn--warning, .btn--warning { background: rgba(201,160,0,.12); border-color: var(--yellow); color: var(--yellow); }
button.btn--sm, .btn--sm { padding: 4px 10px; font-size: 12px; }

/* ── Checkbox Group ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
  transition: border-color .15s;
}
.checkbox-label:has(input:checked) { border-color: var(--accent); background: rgba(91,82,208,.08); }

/* ── Layout: Sidebar + Main ── */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar toggle button */
.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  padding: 0;
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--bg3); }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0 16px;
  overflow-y: auto;
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-brand {
  font-weight: 700;
  font-size: 1rem;
  padding: 4px 16px 12px;
  color: var(--accent);
}

.sidebar nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.sidebar nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: var(--bg3); color: var(--text); }
.sidebar nav a.active { background: rgba(91,82,208,.12); color: var(--accent); }

.sidebar hr { margin: 8px 16px; }

.sidebar-footer {
  padding: 12px 16px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* Main content */
.main {
  flex: 1;
  padding: 16px 20px 60px;
  margin-left: 0;
  transition: margin-left .2s ease;
  min-width: 0;
  max-width: 100%;
}

/* On desktop, push main content when sidebar is open */
@media (min-width: 769px) {
  .sidebar.open ~ .main,
  .layout:has(.sidebar.open) .main {
    margin-left: var(--sidebar-w);
  }
}

/* Overlay on mobile */
@media (max-width: 768px) {
  .sidebar.open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: -1;
  }
  .main { padding: 12px 12px 60px; }
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
  padding-left: 44px; /* clear toggle button */
}
.page-header h2 { font-size: 1.2rem; font-weight: 700; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:hover td { background: var(--bg3); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Cards / Stat Cards ── */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-card__label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card__value { font-size: 1.4rem; font-weight: 700; margin-top: 4px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge--active     { background: rgba(29,168,112,.15);  color: var(--green); }
.badge--paused     { background: rgba(201,160,0,.15);   color: var(--yellow); }
.badge--processing { background: rgba(91,82,208,.15);   color: var(--accent); }
.badge--ended      { background: rgba(138,144,176,.15); color: var(--muted); }
.badge--approved   { background: rgba(29,168,112,.15);  color: var(--green); }
.badge--rejected   { background: rgba(217,79,79,.15);   color: var(--red); }
.badge--paid       { background: rgba(29,168,112,.15);  color: var(--green); }
.badge--tier       { background: rgba(91,82,208,.15);   color: var(--accent); }
.badge--discord    { background: rgba(88,101,242,.15);  color: #5865f2; }
.badge--private    { background: rgba(201,160,0,.15);   color: var(--yellow); }
.badge--flagged    { background: rgba(217,79,79,.2);    color: var(--red); border: 1px solid var(--red); }
.badge--pending    { background: rgba(201,160,0,.15);   color: var(--yellow); }
.badge--denied     { background: rgba(217,79,79,.15);   color: var(--red); }
.badge--processed  { background: rgba(29,168,112,.15);  color: var(--green); }
.badge--suspended  { background: rgba(217,79,79,.2);    color: var(--red); border: 1px solid var(--red); }

/* ── Platform icons ── */
.plat-icon { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 3px; display: inline-block; margin: 1px; }
.plat-icon.youtube   { background: rgba(255,0,0,.12);    color: #ff4444; }
.plat-icon.tiktok    { background: rgba(0,0,0,.08);      color: var(--text); }
.plat-icon.instagram { background: rgba(225,48,108,.12); color: #e1306c; }
.plat-icon.twitter, .plat-icon.x { background: rgba(29,161,242,.12); color: #1da1f2; }

/* ── Budget bar ── */
.budget-bar { height: 4px; background: var(--border); border-radius: 2px; margin: 4px 0; }
.budget-bar__fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

/* ── Section heading ── */
.section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 24px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ── Details / Accordion ── */
details { margin: 4px 0; }
details > summary {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s;
}
details > summary::-webkit-details-marker { display: none; }
details > summary:hover { background: var(--bg3); }
details[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom-color: transparent; }
.details-body { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); padding: 16px; background: var(--bg2); }

/* ── Inline action form ── */
.action-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
  flex-wrap: wrap;
}

.reject-input {
  padding: 4px 6px !important;
  font-size: 12px !important;
  height: 28px;
}

/* ── Linked list ── */
.linked-list { display: flex; flex-direction: column; gap: 6px; }
.linked-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg3); border-radius: var(--radius); border: 1px solid var(--border); }
.linked-item .handle { flex: 1; font-size: 13px; font-weight: 500; }

/* ── Copy button ── */
.copy-btn {
  padding: 2px 8px;
  font-size: 11px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  transition: all .12s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { border-color: var(--green); color: var(--green); }

/* ── Creator profile ── */
.creator-hero {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.creator-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(91,82,208,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}
.creator-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 4px; }
.creator-stat { text-align: center; }
.creator-stat__val { font-size: 1.3rem; font-weight: 700; }
.creator-stat__lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Withdrawal card ── */
.withdraw-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-width: 520px;
  margin-bottom: 20px;
}
.withdraw-card h3 { margin-bottom: 12px; }

/* ── Category tabs ── */
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-tab {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all .12s;
}
.cat-tab:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Flagged row highlight ── */
tr.flagged-row td { background: rgba(217,79,79,.04); }

/* ── Suspended notice ── */
.suspended-notice {
  max-width: 500px;
  margin: 80px auto;
  text-align: center;
  padding: 40px 32px;
  background: var(--bg2);
  border: 1px solid var(--red);
  border-radius: var(--radius);
}
.suspended-notice h1 { color: var(--red); margin-bottom: 12px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .field-row { flex-direction: column; gap: 0; }
  .creator-stats { gap: 16px; }
  .creator-hero { padding: 16px; }
  th, td { padding: 6px 8px; font-size: 12px; }
  .page-header h2 { font-size: 1rem; }
  .stat-card__value { font-size: 1.1rem; }
}

/* ── Enhanced Sidebar ── */
.sidebar-brand {
  font-weight: 800;
  font-size: 1.05rem;
  padding: 4px 16px 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 10px 12px 4px;
}

.nav-icon {
  display: inline-block;
  width: 20px;
  text-align: center;
  font-size: 14px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sidebar nav a:hover  { background: var(--bg3); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: rgba(91,82,208,.14); color: var(--accent); font-weight: 600; }

/* ── Sidebar User ── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(91,82,208,.18);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-username  { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-balance   { font-size: 11px; color: var(--green); margin-top: 1px; }

/* ── Notification items ── */
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.notif-item:hover    { background: var(--bg3); }
.notif-item--info    { border-left: 3px solid var(--accent); }
.notif-item--success { border-left: 3px solid var(--green); }
.notif-item--warning { border-left: 3px solid var(--yellow); }
.notif-item--danger  { border-left: 3px solid var(--red); }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-msg   { font-size: 12px; color: var(--muted); }
.notif-time  { font-size: 10px; color: var(--muted); margin-top: 2px; }
