:root {
  --bg: #0d0f14;
  --surface: #161920;
  --surface2: #1e2130;
  --border: #2a2d3e;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #3ba55c;
  --yellow: #faa61a;
  --red: #ed4245;
  --text: #e3e5e8;
  --muted: #72767d;
  --radius: 10px;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
#sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-user {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .rank { font-size: 11px; color: var(--muted); }

.logout-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  border-radius: 6px; transition: color 0.15s;
}
.logout-btn:hover { color: var(--red); }

/* Main */
#main {
  margin-left: 240px;
  flex: 1;
  padding: 28px;
  min-height: 100vh;
}

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

h1 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }

/* Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card.red .value { color: var(--red); }
.stat-card.yellow .value { color: var(--yellow); }
.stat-card.green .value { color: var(--green); }
.stat-card.blue .value { color: var(--accent); }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}

.table-header h3 { font-size: 15px; font-weight: 600; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge.ban { background: rgba(237,66,69,0.15); color: var(--red); }
.badge.kick { background: rgba(250,166,26,0.15); color: var(--yellow); }
.badge.warn { background: rgba(88,101,242,0.15); color: var(--accent); }
.badge.pending { background: rgba(250,166,26,0.15); color: var(--yellow); }
.badge.approved { background: rgba(59,165,92,0.15); color: var(--green); }
.badge.denied { background: rgba(237,66,69,0.15); color: var(--red); }
.badge.Ownership { background: rgba(237,66,69,0.15); color: var(--red); }
.badge.Management { background: rgba(250,166,26,0.15); color: var(--yellow); }
.badge.Admin { background: rgba(88,101,242,0.15); color: var(--accent); }
.badge.Mod { background: rgba(59,165,92,0.15); color: var(--green); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: rgba(237,66,69,0.15); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: rgba(59,165,92,0.15); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-ghost { background: var(--surface2); color: var(--text); }
.btn-ghost:hover { background: var(--border); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { font-size: 17px; margin-bottom: 18px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.form-group textarea { resize: vertical; min-height: 80px; }

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* Roblox preview */
.roblox-preview {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface2);
  border-radius: 8px;
  margin-top: 8px;
}

.roblox-preview.show { display: flex; }
.roblox-preview img { width: 48px; height: 48px; border-radius: 8px; }
.roblox-preview .info .name { font-size: 14px; font-weight: 600; }
.roblox-preview .info .sub { font-size: 12px; color: var(--muted); }

/* Shifts board */
.shift-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.my-shift-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.my-shift-card h3 { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

.shift-timer {
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

.quota-bar-wrap { margin-bottom: 8px; }
.quota-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.quota-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 1s linear;
}

.quota-bar-fill.done { background: var(--green); }

.quota-msg {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  margin-top: 6px;
  display: none;
}

.quota-msg.show { display: block; }

.staff-board {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.staff-avatar-wrap {
  position: relative;
  cursor: pointer;
}

.staff-avatar-wrap img {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid var(--border);
  object-fit: cover;
  transition: border-color 0.15s;
}

.staff-avatar-wrap.on-duty img { border-color: var(--green); }
.staff-avatar-wrap.on-break img { border-color: var(--yellow); }

.staff-status-dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.staff-avatar-wrap.on-duty .staff-status-dot { background: var(--green); }
.staff-avatar-wrap.on-break .staff-status-dot { background: var(--yellow); }

.staff-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 12px;
  z-index: 10;
  pointer-events: none;
}

.staff-avatar-wrap:hover .staff-tooltip { display: block; }
.staff-tooltip .t-name { font-weight: 600; margin-bottom: 2px; }
.staff-tooltip .t-rank { color: var(--muted); }
.staff-tooltip .t-status { margin-top: 4px; }

/* Player profile */
.player-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.player-card img { width: 64px; height: 64px; border-radius: 10px; }
.player-card .name { font-size: 18px; font-weight: 700; }
.player-card .sub { font-size: 13px; color: var(--muted); }
.player-card .warn-count { margin-top: 6px; font-size: 13px; }
.player-card .warn-count span { color: var(--yellow); font-weight: 700; }

/* Login page */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.login-card .logo { font-size: 28px; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.login-card .sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; }

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.discord-btn:hover { background: var(--accent-hover); }

.error-msg {
  margin-top: 16px;
  font-size: 13px;
  color: var(--red);
}

/* Responsive */
@media (max-width: 768px) {
  #sidebar { width: 60px; }
  .sidebar-logo, .sidebar-user-info, .nav-item span { display: none; }
  #main { margin-left: 60px; padding: 16px; }
}

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .section-grid { grid-template-columns: 1fr; }
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

.roblox-search-row {
  display: flex;
  gap: 8px;
}

.roblox-search-row input { flex: 1; }
