@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:       #0f1117;
  --surface:  #181c24;
  --border:   #252a35;
  --hover:    #1e2330;
  --accent:   #4f8ef7;
  --accent2:  #34d399;
  --danger:   #f87171;
  --warn:     #fbbf24;
  --text:     #e8eaf0;
  --muted:    #6b7280;
  --sidebar:  200px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 40%, #1a2540 0%, #0f1117 60%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 360px;
}
.login-logo {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  font-size: 22px;
}
.login-title { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.field-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.inp {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
  outline: none; margin-bottom: 14px; transition: border-color .15s;
}
.inp:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 11px; font-size: 14px; font-weight: 500;
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; cursor: pointer; transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.err-msg { font-size: 12px; color: var(--danger); margin-bottom: 10px; display: none; }

/* ── App shell ── */
.app-shell { display: none; min-height: 100vh; }
.app-shell.active { display: flex; }

.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 10;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon {
  width: 32px; height: 32px; background: var(--accent);
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; margin-bottom: 8px;
}
.sidebar-logo-text { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sidebar-logo-sub  { font-size: 11px; color: var(--muted); }

.nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; color: var(--muted);
  font-size: 13px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover  { background: var(--hover); color: var(--text); }
.nav-item.active { background: rgba(79,142,247,.12); color: var(--accent); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.admin-info {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
}
.admin-avatar {
  width: 28px; height: 28px; background: var(--accent);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.admin-name { font-size: 12px; font-weight: 500; }
.logout-btn {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  background: none; border: none; color: var(--muted);
  font-size: 12px; cursor: pointer; text-align: left;
  transition: all .15s; display: flex; align-items: center; gap: 8px;
}
.logout-btn:hover { color: var(--danger); background: rgba(248,113,113,.08); }

.main-area {
  margin-left: var(--sidebar);
  flex: 1; min-height: 100vh;
}
.topbar {
  height: 52px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
  justify-content: space-between; position: sticky; top: 0; z-index: 5;
}
.page-title { font-size: 15px; font-weight: 600; }
.topbar-right { font-size: 12px; color: var(--muted); }

.content { padding: 24px; }

/* ── Pages ── */
.page { display: none; }
.page.active { display: block; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
.stat-val   { font-size: 26px; font-weight: 600; font-family: 'DM Mono', monospace; line-height: 1; }
.stat-val.green  { color: var(--accent2); }
.stat-val.blue   { color: var(--accent); }
.stat-val.yellow { color: var(--warn); }
.stat-val.red    { color: var(--danger); }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 600; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 16px; font-size: 13px;
  border-bottom: 1px solid rgba(37,42,53,.6);
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--hover); }
.mono { font-family: 'DM Mono', monospace; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
}
.badge-green  { background: rgba(52,211,153,.12); color: var(--accent2); }
.badge-blue   { background: rgba(79,142,247,.12);  color: var(--accent); }
.badge-yellow { background: rgba(251,191,36,.12);  color: var(--warn); }
.badge-red    { background: rgba(248,113,113,.12); color: var(--danger); }
.badge-gray   { background: rgba(107,114,128,.12); color: var(--muted); }

/* ── Filters ── */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.filter-inp {
  padding: 7px 10px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); font-size: 13px; outline: none;
  transition: border-color .15s;
}
.filter-inp:focus { border-color: var(--accent); }
.filter-btn {
  padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--accent); color: var(--accent);
  background: rgba(79,142,247,.08);
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.filter-btn:hover { background: rgba(79,142,247,.18); }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.pg-btn {
  padding: 5px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: none;
  color: var(--text); cursor: pointer; font-size: 12px;
  transition: all .15s;
}
.pg-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Class summary bars ── */
.class-row {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(37,42,53,.6);
  display: grid; grid-template-columns: 140px 1fr auto;
  align-items: center; gap: 16px;
}
.class-row:last-child { border-bottom: none; }
.class-name { font-size: 13px; font-weight: 500; }
.class-bar-wrap { position: relative; height: 6px; background: var(--border); border-radius: 3px; }
.class-bar { height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }
.class-bar.warn { background: var(--warn); }
.class-meta { font-size: 12px; color: var(--muted); text-align: right; min-width: 120px; }

/* ── Loading / empty ── */
.loading-row td { text-align: center; color: var(--muted); padding: 40px !important; }
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --sidebar: 220px; }
}
