:root {
  --accent: #dc2626;
  --accent-dark: #b91c1c;
  --accent-soft: #fee2e2;
  --ink: #111111;
  --ink-2: #444746;
  --muted: #6b7280;
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 8px 30px rgba(16,24,40,.10);
}

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

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #101418;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  letter-spacing: .2px;
}

.brand-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(220,38,38,.22);
}

.nav { flex: 1; padding: 8px 12px; overflow-y: auto; }

.nav-section {
  padding: 18px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b7280;
}

.nav-item {
  display: block;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 9px;
  color: #d1d5db;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-chip {
  display: block;
  font-size: 13px;
  color: #9ca3af;
  padding: 2px 6px 10px;
}

.main { flex: 1; padding: 30px 34px; overflow-x: hidden; }

.page { max-width: 1080px; margin: 0 auto; }

.page-title { font-size: 24px; font-weight: 700; margin-bottom: 22px; letter-spacing: -.2px; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #101418 0%, #101418 40%, var(--bg) 40%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 34px 34px 30px;
}

.auth-card h1 { font-size: 21px; margin-bottom: 4px; }
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* ---------- Cards / grid ---------- */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin-bottom: 26px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card.cta { display: flex; flex-direction: column; gap: 6px; }
.card-value { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.card-label { font-size: 13px; color: var(--muted); }
.card-hint { font-size: 12px; color: var(--muted); }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
}

.panel h2 { font-size: 17px; margin-bottom: 14px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--ink-2);
}

.form-control {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

textarea.form-control { min-height: 110px; resize: vertical; }

.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, border-color .15s;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; }

.btn-secondary { background: #fff; color: var(--ink); border: 1.5px solid #d1d5db; }
.btn-secondary:hover { background: #f3f4f6; text-decoration: none; }

.btn-min {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--ink-2);
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn-min:hover { background: #f3f4f6; border-color: #cbd5e1; text-decoration: none; }
.btn-min.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-min.btn-primary:hover { background: var(--accent-dark); }
.btn-min.btn-danger { color: var(--err); border-color: #fecaca; }
.btn-min.btn-danger:hover { background: var(--err-bg); }

/* ---------- Content calendar ---------- */
.cal-cell {
  min-height: 108px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.btn-block { width: 100%; }

/* ---------- Alerts / flash ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-error   { background: var(--err-bg); color: var(--err); }
.alert-warning { background: var(--warn-bg); color: var(--warn); }
.alert-info    { background: #e0f2fe; color: #0369a1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1.5px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user  { background: #e0f2fe; color: #0369a1; }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-suspended { background: var(--err-bg); color: var(--err); }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.divider { border-top: 1px solid var(--border); margin: 22px 0; }

/* ---------- Modal ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16,20,24,.55);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-open { display: flex; }
.modal-locked { overflow: hidden; }
.modal-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: 100%;
  padding: 26px;
}
.modal-close {
  float: right;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
}

@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .layout { flex-direction: column; }
  .main { padding: 20px 16px; }
}