/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  font-size: 15px;
  display: flex;
  flex-direction: column;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
header {
  background: #fff;
  border-bottom: 2px solid #e5e7eb;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo span { color: #2563eb; }

.header-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: none; }

.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm        { padding: 5px 12px; font-size: 13px; }
.btn-outline   { background: transparent; border: 1.5px solid #2563eb; color: #2563eb; }
.btn-outline:hover { background: #2563eb; color: #fff; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border: 1px solid #e5e7eb;
}

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .15s;
  background: #fff;
  color: #1a1a2e;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Alerts ── */
.alert {
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid;
}
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #dc2626; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #16a34a; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #2563eb; }

/* ── Page content ── */
.page-content { padding: 28px 0; flex: 1; }

/* ── Hero / Landing ── */
.hero {
  text-align: center;
  padding: 60px 20px;
}
.hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; }
.hero p  { font-size: 1.1rem; color: #6b7280; margin-bottom: 32px; }

.auth-cards {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.auth-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  padding: 32px 28px;
  width: 340px;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.auth-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.auth-card p  { font-size: 14px; color: #6b7280; margin-bottom: 22px; }

/* ── Section headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header h2 { font-size: 1.3rem; font-weight: 700; }

/* ── Date nav ── */
.date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.date-nav input[type="date"] {
  padding: 8px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.date-nav input[type="date"]:focus {
  outline: none;
  border-color: #2563eb;
}
.date-label {
  font-weight: 600;
  font-size: 1.1rem;
  color: #1a1a2e;
}

/* ── Scheduler Grid ── */
.grid-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.scheduler-grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  background: #fff;
}

.scheduler-grid th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
  white-space: nowrap;
}
.scheduler-grid th:first-child { text-align: left; min-width: 130px; }
.scheduler-grid th:last-child  { border-right: none; }

.time-cell {
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
  border-right: 1px solid #e5e7eb;
  background: #f8fafc;
  min-width: 130px;
}

/* Slot cells */
.slot-cell {
  padding: 6px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
  vertical-align: middle;
  height: 52px;
  transition: filter .12s;
  position: relative;
}
.slot-cell:last-child { border-right: none; }

.slot-row td { border-bottom: 1px solid #e5e7eb; }
.slot-row .time-cell { height: 52px; }

/* Status colours */
.status-free {
  background: #ffffff;
  cursor: pointer;
}
.status-free:hover { background: #eff6ff; }

.status-reserved {
  background: #fde047;
  cursor: default;
}
.status-reserved.own-reservation {
  cursor: pointer;
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}
.status-reserved.own-reservation:hover { filter: brightness(.94); }

.status-past {
  background: #4b5563;
  cursor: not-allowed;
}

/* Break row */
.break-row td { border-bottom: 1px solid #e5e7eb; }
.break-row .time-cell {
  font-size: 11px;
  color: #9ca3af;
  height: 28px;
}
.break-cell {
  background: #fee2e2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 4px 8px;
  height: 28px;
  border-bottom: 1px solid #e5e7eb;
}

/* Lunch row */
.lunch-row td { border-bottom: 2px solid #e5e7eb; }
.lunch-row .time-cell {
  font-size: 12px;
  color: #92400e;
  height: 44px;
  font-weight: 700;
}
.lunch-cell {
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 8px;
  height: 44px;
  letter-spacing: .02em;
}

/* Initials badge */
.initials-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(0,0,0,.12);
  color: #000;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
}
.initials-badge.own {
  background: rgba(0,0,0,.2);
}

/* "Add" indicator for admin */
.add-indicator {
  color: #9ca3af;
  font-size: 20px;
  line-height: 1;
}

/* ── Legend ── */
.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 13px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
}
.legend-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}

/* ── Reservation count badge ── */
.res-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
}
.res-count.maxed { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ── My Reservations list ── */
.my-reservations { margin-top: 28px; }
.my-reservations h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }

.res-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.res-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.res-item-info { flex: 1; font-size: 14px; }
.res-item-info strong { font-weight: 700; }
.res-item-time { color: #6b7280; font-size: 13px; margin-top: 2px; }

/* ── Admin panel ── */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: #2563eb; border-color: #2563eb; }
.tab-btn:hover:not(.active) { color: #374151; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Location list ── */
.location-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.location-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  gap: 12px;
}
.location-item > span:first-child { font-weight: 500; }
.location-item > span.text-muted  { text-align: right; white-space: nowrap; }

/* Guest list in admin */
.guest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  flex-wrap: wrap;
}
.guest-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 12px;
}
.guest-info { flex: 1; }
.guest-info strong { display: block; font-size: 14px; }
.guest-info small  { color: #6b7280; font-size: 13px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  transform: scale(.95);
  transition: transform .18s;
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.modal-meta { color: #6b7280; font-size: 13px; margin-bottom: 18px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .auth-card { width: 100%; }
  .card { padding: 18px; }
  .modal { padding: 20px; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

/* ── Event list (guest) ── */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 680px;
}

.event-card {
  display: block;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.event-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 16px rgba(37,99,235,.1);
  transform: translateY(-2px);
  text-decoration: none;
}
.event-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.event-card-meta { font-size: 13px; color: #6b7280; }

/* ── Event admin card ── */
.event-admin-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.event-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Event calendar ── */
.event-calendar {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 8px;
}

.cal-month { min-width: 220px; }

.cal-month-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 10px;
  color: #1a1a2e;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-wday {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.cal-empty   { background: transparent; }
.cal-inactive { background: #f3f4f6; color: #d1d5db; cursor: default; }

.cal-event-day {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, transform .1s;
  border: 2px solid transparent;
}
.cal-event-day:hover {
  background: #2563eb;
  color: #fff;
  transform: scale(1.08);
  text-decoration: none;
}

.cal-today { border: 2px solid #f59e0b !important; }
.cal-today.cal-event-day { border-color: #f59e0b; }

/* ── Utility ── */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted { color: #6b7280; font-size: 13px; }
.divider { border: none; border-top: 1px solid #e5e7eb; margin: 20px 0; }
.flex-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #dbeafe;
  color: #1d4ed8;
}
.empty-state {
  text-align: center;
  padding: 32px;
  color: #9ca3af;
  font-size: 15px;
}

/* ── Time Range Rows ── */
.timerange-row td { border-top: 2px solid rgba(0,0,0,.08); }

.timerange-label-cell {
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  letter-spacing: .02em;
  color: #374151;
  padding: 8px 12px;
}

.timerange-time {
  font-size: 12px;
  line-height: 1.3;
  vertical-align: middle;
}

.tr-name {
  display: block;
  font-size: 10px;
  color: #6b7280;
  font-weight: 400;
  margin-top: 2px;
}

/* Bookable time range cells */
.tr-cell {
  transition: filter .12s;
}
.tr-cell:hover { filter: brightness(.92); }

.tr-initials {
  font-size: 9px !important;
  padding: 1px 4px !important;
  line-height: 1.4;
}

/* ── Billing Table ── */
.billing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 4px;
}
.billing-table th {
  text-align: left;
  padding: 6px 10px;
  background: #f1f5f9;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  color: #374151;
  font-size: 12px;
}
.billing-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.billing-table tbody tr:last-child td { border-bottom: none; }
.billing-table input[type="number"] {
  padding: 4px 6px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}

/* ── Footer (sticky bottom) ── */
.site-footer {
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 14px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-links { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.footer-links a { color: #6b7280; }
.footer-links a:hover { color: #2563eb; }
.footer-sep { color: #d1d5db; }
.footer-copy { font-size: 12px; color: #9ca3af; }

/* ── Location checkbox list (event form) ── */
.loc-check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.loc-check-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 400;
  font-size: 14px;
  transition: background .12s, border-color .12s;
}
.loc-check-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.loc-check-item input[type="checkbox"] { margin: 0; cursor: pointer; width: 16px; height: 16px; accent-color: #2563eb; }
.loc-check-item span { font-weight: 500; color: #1a1a2e; }
.loc-check-item:has(input:checked) { background: #eff6ff; border-color: #93c5fd; }
