/* ═══════════════════════════════════════════════════════════
   Viby Booking – main.css
   Mobile-first, system-ui font stack, no external dependencies
   ═══════════════════════════════════════════════════════════ */

:root {
  --navy:     #2c3e50;
  --green:    #27ae60;
  --orange:   #e67e22;
  --blue:     #2980b9;
  --red:      #e74c3c;
  --grey:     #bdc3c7;
  --grey-lt:  #ecf0f1;
  --grey-dk:  #7f8c8d;
  --white:    #ffffff;
  --text:     #2c3e50;
  --text-sm:  #555e6b;
  --border:   #dde1e7;
  --radius:   6px;
  --shadow:   0 1px 4px rgba(0,0,0,0.10);
  --shadow-lg:0 4px 16px rgba(0,0,0,0.12);
  --header-h: 56px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
select { background-color: white; color: #212529; }
select option { background-color: white; color: #212529; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: #f4f6f8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  background: #2c3e50;
  color: var(--white);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo-link { display: flex; align-items: center; text-decoration: none; }
.logo { height: 36px; width: auto; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav-link {
  color: rgba(255,255,255,0.85);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  position: relative;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  text-decoration: none;
}
.badge {
  background: var(--orange);
  color: #fff;
  border-radius: 10px;
  font-size: 0.7rem;
  padding: 1px 6px;
  margin-left: 4px;
  font-weight: 700;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.2);
}
.user-name { font-size: 0.85rem; color: rgba(255,255,255,0.7); }
.nav-link-sm {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}
.nav-link-sm:hover { color: var(--white); }
.nav-logout { color: rgba(255,100,100,0.85); }
.nav-mobile-only { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  padding: 6px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
}

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 12px;
  font-size: 0.8rem;
  margin-top: auto;
}
.site-footer a { color: rgba(255,255,255,0.7); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.card-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.mt-4 { margin-top: 16px; }
.page-narrow { max-width: 700px; margin: 0 auto; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary  { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-primary:hover { background: #219a52; border-color: #219a52; text-decoration: none; }
.btn-secondary{ background: var(--white); color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--grey-lt); text-decoration: none; }
.btn-danger   { background: var(--red); color: var(--white); border-color: var(--red); }
.btn-danger:hover { background: #c0392b; border-color: #c0392b; text-decoration: none; }
.btn-danger-outline { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger-outline:hover { background: var(--red); color: var(--white); text-decoration: none; }
.btn-success  { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-success:hover { background: #219a52; text-decoration: none; }
.btn-link     { background: transparent; color: var(--blue); border-color: transparent; padding-left: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-icon     { padding: 6px 10px; font-size: 1.2rem; }
.btn-sm       { padding: 5px 12px; font-size: 0.83rem; }
.btn-xs       { padding: 3px 8px; font-size: 0.77rem; }
.btn-full     { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.form-group label small { font-weight: 400; color: var(--grey-dk); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
}
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-select-sm {
  padding: 5px 28px 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.83rem;
  background: var(--white);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.form-input-sm {
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.83rem;
  font-family: var(--font);
}
.form-textarea { resize: vertical; min-height: 70px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check label { margin-bottom: 0; font-weight: 400; }
.form-checkbox { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }
.form-group-end { display: flex; align-items: flex-end; padding-bottom: 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-static { padding: 9px 0; color: var(--text-sm); font-size: 0.9rem; }
.form-help { font-size: 0.8rem; color: var(--grey-dk); margin-top: 6px; }
.required { color: var(--red); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.alert-error   { background: #fdf0f0; color: #c0392b; border-color: #f5c6cb; }
.alert-warning { background: #fef9e7; color: #8b6914; border-color: #fde8a0; }
.alert-success { background: #eafaf1; color: #1a7a46; border-color: #a9dfbf; }
.alert-info    { background: #eaf4fb; color: #1a5276; border-color: #aed6f1; }

/* ── Status badges ──────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-confirmed { background: #d5f5e3; color: #1a7a46; }
.status-pending   { background: #fdebd0; color: #a04000; }
.status-rejected  { background: #fdf0f0; color: #922b21; }
.status-cancelled { background: #f2f3f4; color: #717d7e; }

.role-badge { padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.role-admin { background: #d6eaf8; color: #1a5276; }
.role-user  { background: #f2f3f4; color: #555; }
.badge-warning { background: #fdebd0; color: #a04000; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:hover td { background: var(--grey-lt); }
.data-table tr:last-child td { border-bottom: none; }
.action-cell { white-space: nowrap; }
.monospace { font-family: monospace; font-size: 0.82rem; }
.result-count { color: var(--grey-dk); font-size: 0.85rem; margin-bottom: 12px; }
.empty-state { text-align: center; color: var(--grey-dk); padding: 32px 0; }
.inactive-row td { opacity: 0.55; }

/* ── Detail list ────────────────────────────────────────────── */
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin-bottom: 20px; }
.detail-list dt { font-weight: 600; font-size: 0.875rem; color: var(--text-sm); padding-top: 2px; }
.detail-list dd { font-size: 0.9rem; }

/* ── Calendar ───────────────────────────────────────────────── */
.calendar-page { position: relative; }

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.cal-toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.view-switcher { display: flex; gap: 2px; background: var(--grey-lt); padding: 3px; border-radius: var(--radius); }
.view-switcher .btn-sm { border-radius: 4px; border: none; background: transparent; color: var(--text-sm); }
.view-switcher .btn-sm.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow); }
.cal-loading { text-align: center; padding: 12px; color: var(--grey-dk); font-size: 0.85rem; }

/* Week view — CSS grid */
.cal-week-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
.cal-week-grid {
  display: grid;
  min-width: 640px;
  grid-template-rows: auto;
  grid-auto-rows: 30px;
  position: relative;
  border-bottom: 2px solid var(--border);
}
.cal-corner {
  background: var(--grey-lt);
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
}
.cal-day-header {
  background: var(--grey-lt);
  border-bottom: 2px solid var(--border);
  border-right: 1px solid #dee2e6;
  padding: 8px 4px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-sm);
  position: sticky;
  top: 0;
  z-index: 5;
}
.cal-day-header.today { background: #eafaf1; color: var(--green); }
.day-num {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}
.day-num.today-badge {
  background: var(--green);
  color: var(--white);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
}
.cal-time-label {
  grid-column: 1;
  padding: 0 6px;
  text-align: right;
  font-size: 0.72rem;
  color: var(--grey-dk);
  background: var(--grey-lt);
  border-right: 1px solid var(--border);
  border-top: 2px solid #ced4da;
  height: 30px;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  box-sizing: border-box;
}
.cal-time-filler {
  grid-column: 1;
  background: var(--grey-lt);
  border-right: 1px solid var(--border);
  border-top: 1px solid #dee2e6;
  height: 30px;
  box-sizing: border-box;
}
.cal-cell {
  height: 30px;
  border-top: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  cursor: pointer;
  transition: background 0.1s;
  box-sizing: border-box;
}
.cal-cell:hover { background: rgba(41,128,185,0.06); }
.cal-cell.today-col { background: rgba(39,174,96,0.04); }
.cal-cell-hour { border-top: 1px solid #9ba8b5; }
/* Booking blocks — positioned in grid via bookingStyle() */
.cal-booking-block {
  position: relative;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.73rem;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  z-index: 3;
  border-left: 3px solid;
  margin: 1px 2px;
}
.cal-booking-block:hover { filter: brightness(0.92); }
.cal-overflow-pill {
  position: relative;
  border-radius: 4px;
  margin: 1px 2px;
  z-index: 3;
  pointer-events: auto;
  background: var(--grey);
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.85;
}
.cal-overflow-pill:hover { opacity: 1; background: var(--grey-dk); color: var(--white); }
.booking-confirmed { background: #d5f5e3; border-color: var(--green); color: #1a5c34; }
.booking-pending   { background: #fdebd0; border-color: var(--orange); color: #784212; }
.booking-own       { background: #d6eaf8; border-color: var(--blue);   color: #1a3a5c; }
.booking-past      { background: #f2f3f4; border-color: var(--grey);   color: #717d7e; }
.cal-booking-time  { font-weight: 700; }
.cal-booking-name  { display: block; }
.cal-booking-title { display: block; font-style: italic; }

/* Day view */
.cal-day-container { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.cal-day-header-single { padding: 12px 16px; font-weight: 700; color: var(--navy); border-bottom: 2px solid var(--border); }
.cal-day-grid { border-bottom: 2px solid var(--border); }
.cal-day-slot {
  display: flex;
  gap: 12px;
  min-height: 30px;
  padding: 4px 12px;
  border-top: 1px solid #dee2e6;
  cursor: pointer;
  align-items: flex-start;
}
.cal-day-slot:hover { background: var(--grey-lt); }
.cal-day-slot-hour { border-top: 2px solid var(--border); }
.cal-day-time { width: 50px; flex-shrink: 0; font-size: 0.75rem; color: var(--grey-dk); padding-top: 2px; }
.cal-day-events { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.cal-day-event {
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 3px solid;
  font-size: 0.83rem;
  cursor: pointer;
}
.cal-day-event:hover { filter: brightness(0.93); }

/* Month view */
.cal-month-container { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-month-header {
  background: var(--navy); color: var(--white);
  text-align: center; padding: 8px 4px;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
}
.cal-month-cell {
  min-height: 90px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  cursor: pointer;
  transition: background 0.1s;
}
.cal-month-cell:hover { background: var(--grey-lt); }
.cal-month-cell.out-of-month { background: #f8f9fa; }
.cal-month-cell.today { background: #eafaf1; }
.cal-month-num { font-size: 0.85rem; font-weight: 700; color: var(--navy); margin-bottom: 4px; display: block; }
.cal-month-cell.today .cal-month-num {
  background: var(--green); color: var(--white);
  border-radius: 50%; width: 22px; height: 22px;
  line-height: 22px; text-align: center;
}
.cal-month-events { display: flex; flex-direction: column; gap: 2px; }
.cal-month-event {
  font-size: 0.72rem; padding: 2px 5px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border-left: 2px solid;
}
.cal-month-more { font-size: 0.7rem; color: var(--grey-dk); padding: 1px 4px; }

/* Agenda */
.cal-agenda-container { display: flex; flex-direction: column; gap: 8px; }
.cal-agenda-item {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  cursor: pointer;
  border-left: 4px solid var(--grey);
  transition: box-shadow 0.15s;
}
.cal-agenda-item:hover { box-shadow: var(--shadow-lg); }
.cal-agenda-item.booking-confirmed { border-left-color: var(--green); }
.cal-agenda-item.booking-pending   { border-left-color: var(--orange); }
.cal-agenda-item.booking-own       { border-left-color: var(--blue); }
.cal-agenda-item.booking-past      { border-left-color: var(--grey); opacity: 0.7; }

/* ── FullCalendar wrapper ───────────────────────────────────── */
[x-cloak] { display: none !important; }
#fc-calendar { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,0.10); }

/* ── Color legend ───────────────────────────────────────────── */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 10px 4px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-sm);
}
.cal-legend-item { display: flex; align-items: center; gap: 6px; }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.agenda-date { width: 90px; flex-shrink: 0; font-size: 0.82rem; color: var(--text-sm); font-weight: 600; }
.agenda-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.agenda-info strong { font-size: 0.92rem; }
.agenda-title { font-style: italic; color: var(--text-sm); font-size: 0.85rem; }
.agenda-building { font-size: 0.8rem; color: var(--grey-dk); }
.agenda-status { align-self: flex-start; }
.cal-empty { text-align: center; color: var(--grey-dk); padding: 40px; background: var(--white); border-radius: var(--radius); }

/* FAB (floating action button) */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  background: var(--green);
  color: var(--white);
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 52px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(39,174,96,0.4);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 50;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(39,174,96,0.5); text-decoration: none; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.modal-close {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--grey-dk); line-height: 1; padding: 0 4px;
}
.modal-body { padding: 16px 20px; }
.modal-body p { margin-bottom: 10px; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-body { background: var(--navy); }
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h1 { color: var(--white); font-size: 1.5rem; margin-top: 12px; }
.auth-logo { height: 60px; }
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { margin-bottom: 20px; color: var(--navy); }
.auth-help { color: rgba(255,255,255,0.6); font-size: 0.82rem; margin-top: 16px; }

/* ── Admin layout ───────────────────────────────────────────── */
.admin-page { }
.admin-header { margin-bottom: 16px; }
.admin-header h1 { font-size: 1.5rem; margin-bottom: 10px; color: var(--navy); }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav-link {
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-sm);
  text-decoration: none;
  background: var(--white);
  box-shadow: var(--shadow);
  transition: background 0.15s, color 0.15s;
}
.admin-nav-link:hover { background: var(--grey-lt); text-decoration: none; }
.admin-nav-link.active { background: var(--navy); color: var(--white); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card.stat-pending { border-top: 3px solid var(--orange); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--navy); }
.stat-label { font-size: 0.82rem; color: var(--grey-dk); margin-top: 4px; }

/* Booking list (admin dashboard) */
.booking-list { display: flex; flex-direction: column; gap: 10px; }
.booking-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--grey-lt);
  flex-wrap: wrap;
}
.booking-list-item.pending { border-left: 4px solid var(--orange); }
.bli-info { display: flex; flex-direction: column; gap: 3px; }
.bli-info strong { font-size: 0.95rem; }
.bli-location, .bli-time, .bli-user, .bli-title { font-size: 0.82rem; color: var(--text-sm); }
.bli-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.reject-form { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.reject-form-large { margin-top: 12px; }

/* Filters */
.filter-card { padding: 14px 16px; }
.filter-form .form-row { align-items: flex-end; }

/* Recurrence */
.recurrence-section { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.recurrence-section summary { padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--text-sm); list-style: none; }
.recurrence-section summary::before { content: '▶ '; font-size: 0.7rem; }
.recurrence-section[open] summary::before { content: '▼ '; }
.recurrence-body { padding: 14px; border-top: 1px solid var(--border); }
.weekday-checkboxes { display: flex; gap: 8px; flex-wrap: wrap; }
.weekday-label { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; cursor: pointer; }

/* Create user form */
.create-user-form { padding: 14px; background: var(--grey-lt); border-radius: var(--radius); margin-bottom: 16px; }

/* Approval actions */
.approval-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Error pages */
.error-page { text-align: center; padding: 60px 24px; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--navy); opacity: 0.15; line-height: 1; }
.error-page h1 { font-size: 1.8rem; margin-bottom: 12px; }
.error-page p { color: var(--grey-dk); margin-bottom: 24px; }

/* Result icons */
.result-icon { font-size: 4rem; margin: 16px 0; }
.result-success { color: var(--green); }
.result-danger { color: var(--red); }
.text-center { text-align: center; }

/* Recurrence list */
.recurrence-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.recurrence-list li { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }

/* Booking actions */
.booking-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.admin-actions { margin-top: 16px; padding: 14px; background: #fff8f0; border-radius: var(--radius); border: 1px solid #fde8a0; }
.admin-actions h3 { margin-bottom: 12px; font-size: 1rem; }
.cancel-options { background: var(--grey-lt); padding: 12px; border-radius: var(--radius); margin-top: 8px; }
.cancel-options p { font-size: 0.9rem; margin-bottom: 8px; }
.cancel-options label { font-size: 0.9rem; font-weight: 400; }
.cancel-options form { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Booking form panels ────────────────────────────────────── */
.booking-panel {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.booking-panel-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-sm);
  margin-bottom: 12px;
}
.resource-select { font-size: 1rem; min-height: 42px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ── Resource availability cards ───────────────────────────── */
.resource-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin: 8px 0 4px;
}
.resource-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--white);
  user-select: none;
}
.resource-card:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.resource-card.selected { border-color: var(--green); background: #f0faf4; }
.resource-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-bottom: 5px; }
.resource-card-name { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.resource-card-location { font-size: 0.78rem; color: var(--text-sm); margin-bottom: 7px; }
.resource-card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.resource-card-capacity { font-size: 0.75rem; color: var(--grey-dk); }
.badge-ledig { background: #d5f5e3; color: #1a5c34; border: 1px solid #a9dfbf; padding: 2px 7px; border-radius: 10px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.badge-type  { background: var(--grey-lt); color: var(--text-sm); padding: 2px 7px; border-radius: 10px; font-size: 0.7rem; }
.form-section-title { font-size: 0.95rem; font-weight: 700; color: var(--navy); margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.empty-state-inline { color: var(--grey-dk); font-size: 0.9rem; padding: 12px 0; }

/* ── Mine bookinger ─────────────────────────────────────────── */
.mine-bookinger-list { display: flex; flex-direction: column; }
.mine-booking-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.mine-booking-item:last-child { border-bottom: none; }
.mine-booking-info { flex: 1; min-width: 0; }
.mine-booking-resource { font-weight: 600; font-size: 0.97rem; color: var(--navy); }
.mine-booking-sub { font-weight: 400; color: var(--text-sm); }
.mine-booking-location { font-size: 0.8rem; color: var(--text-sm); margin: 2px 0; }
.mine-booking-time { font-size: 0.85rem; color: var(--text); margin-bottom: 4px; }
.mine-booking-title { font-size: 0.82rem; font-style: italic; color: var(--text-sm); }
.mine-booking-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ── Mine bookinger – card layout (mobile) ──────────────────── */
.mine-page { max-width: 960px; margin: 0 auto; }

.booking-cards { display: none; flex-direction: column; gap: 10px; }
.booking-card {
  background: var(--white);
  border-radius: var(--radius);
  border-left: 4px solid var(--grey);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.booking-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
/* Resource name + location stacked block */
.booking-card-resource-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
/* Truncate resource name at ~22 characters */
.booking-card-name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}
/* Location always shown below resource name */
.booking-card-location {
  display: block;
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.booking-card-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.booking-card-status { flex-shrink: 0; }
.booking-card-time {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
}
.booking-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 2px;
}
/* Form inside flex row must flex too so button fills its half */
.booking-card-form {
  display: flex;
  flex: 1;
}
.btn-touch {
  min-height: 44px;
  flex: 1;
  justify-content: center;
  text-align: center;
}

/* Show cards on mobile, table on desktop */
@media (max-width: 767px) {
  .booking-cards { display: flex; }
  .booking-table-desktop { display: none; }
  .mine-page .card { padding: 14px 10px; }
}
@media (min-width: 768px) {
  .booking-cards { display: none; }
  .booking-table-desktop { display: block; }
}
@media (min-width: 768px) {
  .booking-cards { display: none; }
  .booking-table-desktop { display: block; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--navy);
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 99;
  }
  .main-nav.open { display: flex; }
  .nav-user { display: none; }
  .nav-mobile-only { display: block; }
  .nav-mobile-sep { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.15); }
  .cal-toolbar { flex-direction: column; align-items: flex-start; }
  .cal-toolbar-right { width: 100%; justify-content: flex-start; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { margin-top: 10px; color: var(--grey-dk); font-size: 0.8rem; }
  .modal-card { max-height: 80vh; }
  .fab { bottom: 16px; right: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-nav { overflow-x: auto; padding-bottom: 4px; }
  .form-row { flex-direction: column; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .booking-list-item { flex-direction: column; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .main-nav { flex-wrap: wrap; gap: 4px; }
  .main-nav a { font-size: 0.82rem; padding: 6px 8px; }
  .sched-name-col { width: 110px; min-width: 110px; font-size: 0.72rem; }
  .sched-lane { min-width: 500px; }
  .sched-root { overflow-x: auto; }
  .cal-toolbar { flex-wrap: wrap; gap: 6px; }
  table { font-size: 0.82rem; }
  .btn { padding: 6px 10px; font-size: 0.82rem; }
}
