:root {
  --bg: #0b0f19; --bg2: #111827; --bg3: #1f2937; --bg4: #374151;
  --border: #2d3748; --border2: #4a5568;
  --text: #f3f4f6; --text2: #9ca3af; --text3: #6b7280;
  --accent: #3b82f6; --accent2: #2563eb; --accent-glow: rgba(59,130,246,.15);
  --green: #10b981; --green-bg: rgba(16,185,129,.1);
  --red: #ef4444; --red-bg: rgba(239,68,68,.1);
  --orange: #f59e0b; --orange-bg: rgba(245,158,11,.1);
  --purple: #8b5cf6;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.3);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

/* Login */
#login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: radial-gradient(ellipse at top, #1a1f3a 0%, var(--bg) 70%); }
.login-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.login-card .logo { text-align: center; font-size: 32px; font-weight: 800; margin-bottom: 4px; background: linear-gradient(135deg, var(--accent), var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-card .subtitle { text-align: center; color: var(--text2); margin-bottom: 32px; font-size: 14px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text2); font-weight: 500; }
.form-input { width: 100%; padding: 11px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 15px; outline: none; transition: border .2s; }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
select.form-input { appearance: none; cursor: pointer; }
.error-msg { color: var(--red); font-size: 13px; margin-bottom: 10px; text-align: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 22px; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--accent2); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 4px; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { filter: brightness(1.1); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover:not(:disabled) { filter: brightness(1.1); }
.btn-orange { background: var(--orange); color: #000; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--text2); color: var(--text); }

/* Badge */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-role { background: var(--accent-glow); color: var(--accent); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }

/* Top Bar */
.topbar { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 28px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent), var(--purple)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.balance-display { background: var(--bg3); padding: 6px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; color: var(--green); border: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text2); }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 60px); }

/* Sidebar */
.sidebar { width: 220px; background: var(--bg2); border-right: 1px solid var(--border); padding: 16px 0; flex-shrink: 0; overflow-y: auto; }
.nav-section { padding: 16px 20px 6px; font-size: 11px; font-weight: 600; color: var(--text3); letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--text2); cursor: pointer; font-size: 14px; transition: all .1s; text-decoration: none; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { color: var(--accent); background: var(--accent-glow); border-left-color: var(--accent); }
.nav-icon { font-size: 10px; }

/* Content */
.content { flex: 1; padding: 28px; overflow-y: auto; max-height: calc(100vh - 60px); }
.page { display: none; }
.page.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; }

/* Cards */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 12px; color: var(--text3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.orange { color: var(--orange); }
.stat-value.blue { color: var(--accent); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { position: sticky; top: 0; z-index: 1; }
th { background: var(--bg3); color: var(--text2); padding: 10px 14px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,.02); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.text-muted { color: var(--text3); }
.text-sm { font-size: 12px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; color: var(--text3); text-transform: uppercase; }
.filter-group input, .filter-group select { padding: 7px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; outline: none; }
.filter-group input:focus, .filter-group select:focus { border-color: var(--accent); }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-box { position: relative; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-lg { max-width: 750px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; position: sticky; top: 0; background: var(--bg2); z-index: 1; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* Ticket detail */
.ticket-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.ticket-info-item { display: flex; flex-direction: column; }
.ticket-info-label { font-size: 11px; color: var(--text3); }
.ticket-info-value { font-size: 14px; font-weight: 600; }
.selection-card { background: var(--bg3); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; }
.selection-teams { font-weight: 600; margin-bottom: 4px; }
.selection-market { font-size: 12px; color: var(--text2); }
.selection-odds { font-weight: 700; color: var(--accent); }
.selection-result { font-size: 12px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .ticket-info-grid { grid-template-columns: 1fr; }
  .filters { flex-direction: column; }
}

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; }
.pagination button { padding: 6px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; color: var(--text2); cursor: pointer; font-size: 13px; }
.pagination button:hover { background: var(--bg4); color: var(--text); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text3); }

/* Loading */
.loading { text-align: center; padding: 24px; color: var(--text3); }
.spin { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline form rows */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; }
.form-row .form-group { flex: 1; margin-bottom: 0; }
