:root {
  --bg:        #0a0e16;
  --bg-2:      #0e1320;
  --panel:     #141b27;
  --panel-2:   #1b2433;
  --line:      #283344;
  --line-soft: #1f2836;
  --text:      #e9eef6;
  --muted:     #8a97a9;
  --faint:     #5d6a7d;
  --accent:    #5b8cff;
  --accent-2:  #7b5cff;
  --good:      #3fce82;
  --gold:      #f5c542;
  --silver:    #c4cdd5;
  --bronze:    #cd8a5a;
  --shadow:    0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, .55);
  --radius:    14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(91, 140, 255, .14), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(123, 92, 255, .12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  letter-spacing: .01em;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(13, 18, 28, .72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topleft { display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-logo { height: 34px; width: auto; max-width: 180px; display: block; }
.brand-text { color: var(--text); font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand-text span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.nav { display: flex; gap: 6px; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 7px 12px; border-radius: 8px; transition: background .12s, color .12s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }

.userbox { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); }
.uname { font-weight: 600; }
.logout {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; transition: .12s;
}
.logout:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Layout ---------- */
.container { max-width: 1140px; margin: 0 auto; padding: 34px 28px 70px; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 22px; }

.muted { color: var(--muted); }
.back {
  display: inline-block; color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
}
.back:hover { color: var(--text); }
code {
  background: var(--panel-2); padding: 2px 7px; border-radius: 6px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #b9c4d4;
}

/* ---------- Cards / generic ---------- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px; box-shadow: var(--shadow);
}
.center { max-width: 440px; margin: 8vh auto; text-align: center; }
.center h1 { font-size: 26px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--accent), #4374f0);
  color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 16px -8px rgba(91, 140, 255, .8); transition: transform .1s, filter .12s, box-shadow .12s;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); background: var(--panel-2); }
.btn.discord { background: linear-gradient(180deg, #5865f2, #4752c4); box-shadow: 0 8px 20px -8px rgba(88, 101, 242, .9); margin-top: 20px; width: 100%; justify-content: center; padding: 12px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; margin-bottom: 24px; }
.filters label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.filters input, .filters select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 14px; font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 140, 255, .18);
}
.filters input::-webkit-calendar-picker-indicator { filter: invert(.7); }

/* ---------- Stat cards ---------- */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm);
}
.stat::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.stat span { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

/* ---------- Tables ---------- */
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
table.data th, table.data td { text-align: left; padding: 13px 16px; font-size: 14px; }
table.data th {
  background: var(--panel-2); color: var(--muted); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line);
}
table.data tbody td { border-bottom: 1px solid var(--line-soft); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: rgba(91, 140, 255, .05); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data a { color: var(--accent); text-decoration: none; font-weight: 600; }
table.data a:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700; letter-spacing: .02em; }
.badge.admin { background: rgba(123, 92, 255, .18); color: #b3a4ff; border: 1px solid rgba(123, 92, 255, .3); }
.badge.live { background: rgba(63, 206, 130, .16); color: var(--good); border: 1px solid rgba(63, 206, 130, .3); }

/* ---------- Department cards ---------- */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.dept-card {
  display: block; position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); transition: border-color .14s, transform .14s, box-shadow .14s;
}
.dept-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .8; }
.dept-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.dept-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dept-name { font-weight: 700; font-size: 16px; }
.dept-hours { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.dept-hours small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.dept-meta { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- Leaderboard ranks ---------- */
.leaderboard .rank-col { width: 56px; text-align: center; }
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 7px;
  border-radius: 999px; font-weight: 800; font-size: 13px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.rank.gold   { background: rgba(245, 197, 66, .16);  color: var(--gold);   border-color: rgba(245, 197, 66, .4); }
.rank.silver { background: rgba(196, 205, 213, .16); color: var(--silver); border-color: rgba(196, 205, 213, .35); }
.rank.bronze { background: rgba(205, 138, 90, .18);  color: var(--bronze); border-color: rgba(205, 138, 90, .4); }

/* ---------- Login ---------- */
.login-wrap { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; text-align: center;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: 20px;
  padding: 40px 36px; box-shadow: var(--shadow);
}
.login-logo { height: 76px; width: auto; max-width: 240px; margin: 0 auto 18px; display: block; }
.login-card h1 { font-size: 24px; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Footer ---------- */
.footer { text-align: center; color: var(--faint); font-size: 12px; padding: 26px; border-top: 1px solid var(--line-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .summary-cards { grid-template-columns: 1fr; }
  .nav { display: none; }
  .container { padding: 24px 16px 50px; }
  .topbar { padding: 11px 16px; }
}
