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

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #1a1a1a;
  --bg-card: #1e1e1e;
  --bg-hover: #252525;
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #2a2a2a;
  --danger: #ff4444;
  --warning: #ffaa00;
  --info: #4488ff;
  --radius: 8px;
  --sidebar-w: 220px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

/* ── Login Page ── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; flex-direction: column; gap: 24px;
}
.login-page h1 { font-size: 2rem; color: var(--accent); }
.login-page p { color: var(--text-muted); }
.login-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #5865F2; color: #fff; border: none; padding: 14px 28px;
  border-radius: var(--radius); font-size: 1rem; cursor: pointer;
  font-weight: 600; transition: background .2s;
}
.login-btn:hover { background: #4752C4; }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--bg-secondary);
  border-right: 1px solid var(--border); padding: 20px 0;
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; height: 100vh; z-index: 100;
}
.sidebar-brand {
  padding: 0 20px 20px; font-size: 1.1rem; font-weight: 700;
  color: var(--accent); border-bottom: 1px solid var(--border);
}
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--text-muted);
  font-size: .9rem; transition: all .15s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--text); background: var(--bg-hover);
  border-left-color: var(--accent);
}
.sidebar-user {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; font-size: .85rem;
}
.sidebar-user img { width: 32px; height: 32px; border-radius: 50%; }
.sidebar-user a { color: var(--text-muted); font-size: .8rem; }

.main { flex: 1; margin-left: var(--sidebar-w); padding: 24px 32px; }

.page { display: none; }
.page.active { display: block; }

.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }

/* ── Cards ── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.stat-card .label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--accent); margin-top: 4px; }

/* ── Tables ── */
.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; padding: 12px 16px; color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.badge-open { background: #00ff8822; color: var(--accent); }
.badge-closed { background: #ffaa0022; color: var(--warning); }
.badge-provisional { background: #4488ff22; color: var(--info); }
.badge-final { background: #00ff8822; color: var(--accent); }
.badge-voided { background: #ff444422; color: var(--danger); }
.badge-draft { background: #88888822; color: var(--text-muted); }
.badge-scheduled { background: #4488ff22; color: var(--info); }
.badge-submitted { background: #ffaa0022; color: var(--warning); }
.badge-featured { background: #00ff8822; color: var(--accent); }
.badge-revealed { background: #4488ff22; color: var(--info); }
.badge-archived { background: #88888822; color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius);
  font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cc3333; }
.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #333; }
.btn-sm { padding: 4px 10px; font-size: .75rem; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; width: 90%; max-width: 540px;
  max-height: 85vh; overflow-y: auto;
}
.modal h2 { font-size: 1.2rem; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-primary);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: .85rem;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}

/* ── Filter tabs ── */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab {
  padding: 6px 14px; border-radius: var(--radius); font-size: .8rem;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ── Pagination ── */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; align-items: center; }
.pagination .info { color: var(--text-muted); font-size: .8rem; }

/* ── Hot Takes cards ── */
.ht-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ht-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.ht-card .ht-text { font-style: italic; margin-bottom: 10px; line-height: 1.5; }
.ht-card .ht-meta { font-size: .75rem; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

/* ── Leaderboard ── */
.rank-1 td:first-child { color: #ffd700; font-weight: 700; }
.rank-2 td:first-child { color: #c0c0c0; font-weight: 700; }
.rank-3 td:first-child { color: #cd7f32; font-weight: 700; }

/* ── Config ── */
.config-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.config-section h3 { font-size: .95rem; margin-bottom: 14px; color: var(--accent); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius); font-size: .85rem;
  animation: toastIn .3s ease; min-width: 240px;
}
.toast-success { background: #00ff8822; border: 1px solid var(--accent); color: var(--accent); }
.toast-error { background: #ff444422; border: 1px solid var(--danger); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Mobile ── */
.mobile-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 150;
  background: var(--bg-secondary); border: 1px solid var(--border);
  color: var(--text); padding: 8px 12px; border-radius: var(--radius);
  font-size: 1.2rem; cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-toggle { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; padding-top: 56px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Type Reference Key */
.type-key {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
}
.type-key-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.type-badge-key {
  font-size: 0.82rem;
  color: #ccc;
  padding: 4px 0;
  border-left: 3px solid;
  padding-left: 10px;
}
.type-straight { border-color: #00ff88; }
.type-ou       { border-color: #ffd700; }
.type-yesno    { border-color: #6c9fff; }

/* Checkbox alignment */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
