:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-sidebar: #121a26;
  --border: #2a3544;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.25);
  --sidebar-w: 260px;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--border);
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand span { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  color: #94a3b8;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(59,130,246,.12);
  color: #fff;
  border-left-color: var(--primary);
  text-decoration: none;
}

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 { margin: 0; font-size: 1.25rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.content { padding: 1.5rem; flex: 1; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.25rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-card .label { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: .25rem; }
.stat-card.primary .value { color: var(--primary); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.danger .value { color: var(--danger); }

.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
}
table.data-table th, table.data-table td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
table.data-table tbody tr:hover { background: rgba(59,130,246,.05); }

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-primary { background: rgba(59,130,246,.15); color: var(--primary); }
.badge-secondary { background: rgba(148,163,184,.15); color: var(--text-muted); }
.badge-info { background: rgba(6,182,212,.15); color: var(--info); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  border: none;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .35rem; font-weight: 500; color: var(--text-muted); font-size: .85rem; }
.form-control {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } }

.alert {
  padding: .85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: var(--success); }
.alert-danger { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: var(--danger); }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #0f172a 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h2 { margin: 0; font-size: 1.5rem; }
.login-brand p { color: var(--text-muted); margin: .5rem 0 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 992px) { .grid-2 { grid-template-columns: 1fr; } }

.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.activity-list li:last-child { border-bottom: none; }
.activity-list .time { color: var(--text-muted); font-size: .8rem; white-space: nowrap; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: .4rem .65rem;
  cursor: pointer;
}
.user-menu { color: var(--text-muted); font-size: .875rem; }

.chart-bar { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 1rem; }
.chart-bar .bar {
  flex: 1;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  opacity: .85;
}
.chart-labels { display: flex; gap: 6px; margin-top: .5rem; }
.chart-labels span { flex: 1; text-align: center; font-size: .65rem; color: var(--text-muted); }

.actions-inline { display: flex; gap: .35rem; flex-wrap: wrap; }
