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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242736;
  --border: #2e3247;
  --accent: #8B7FCF;
  --accent-hover: #6d28d9;
  --accent-light: #ede9fe;
  --text: #D4BD90;
  --text-muted: #8b90a0;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

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

/* ── Nav bar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.navbar-brand span { color: var(--accent); }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.navbar-user strong { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
}

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

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

input[type="text"], input[type="password"], textarea, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Login page ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.login-form { display: flex; flex-direction: column; gap: 1rem; }

/* ── Alert ── */
.alert {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.alert-error { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(34,197,94,0.15); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.125rem 0.25rem;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { color: var(--text-muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-admin { background: rgba(124,58,237,0.2); color: #c4b5fd; }
.badge-user { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ── Calendar page layout ── */
.page-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

.page-content {
  flex: 1;
  padding: 1.25rem;
  overflow: auto;
}

/* ── FullCalendar overrides ── */
.fc {
  --fc-border-color: var(--border);
  --fc-button-bg-color: var(--surface2);
  --fc-button-border-color: var(--border);
  --fc-button-text-color: var(--text);
  --fc-button-hover-bg-color: var(--accent);
  --fc-button-hover-border-color: var(--accent);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
  --fc-today-bg-color: rgba(124,58,237,0.08);
  --fc-page-bg-color: var(--bg);
  --fc-neutral-bg-color: var(--surface);
  --fc-list-event-hover-bg-color: var(--surface2);
  font-size: 0.875rem;
}

.fc .fc-toolbar-title { font-size: 1.1rem; color: var(--text); }
.fc .fc-col-header-cell-cushion { color: var(--text-muted); font-weight: 500; }
.fc .fc-daygrid-day-number { color: var(--text-muted); }
.fc .fc-event { border-radius: 4px; font-size: 0.8rem; cursor: pointer; }
.fc .fc-event-title { font-weight: 500; }

/* own events highlighted differently */
.fc-event.own-event { border-left: 3px solid var(--success) !important; }

/* ── Admin page ── */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

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

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 { font-size: 1rem; font-weight: 600; }

/* ── Utility ── */
.mt-1 { margin-top: 0.5rem; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.hidden { display: none !important; }
