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

:root {
  --green: #2d6a4f;
  --green-light: #52b788;
  --green-bg: #f0f7f4;
  --green-dark: #1b4332;
  --red: #c0392b;
  --red-light: #fdf0f0;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ── Pages ────────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Login ────────────────────────────────────────────────────── */
/* page-login fills the full viewport so overscroll top+bottom stays green */
#page-login {
  min-height: 100vh;
  background: linear-gradient(145deg, #1b4332 0%, #2d6a4f 55%, #52b788 100%);
  /* Extend gradient behind status bar on iOS PWA */
  background-attachment: fixed;
}

.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: max(48px, 8vh);
  padding-bottom: 40px;
  padding-left: 16px;
  padding-right: 16px;
  /* Transparent so #page-login gradient shows through */
  background: transparent;
}

.login-logo { text-align: center; margin-bottom: 28px; color: white; }
.login-logo .logo-icon { font-size: 3.5rem; display: block; margin-bottom: 10px; }
.logo-icon-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}
.logo-icon-sm-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.ob-icon-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}
.login-logo h1 { font-size: 2.8rem; font-weight: 800; letter-spacing: 5px; }
.login-logo .logo-sub { font-size: 0.95rem; opacity: 0.85; letter-spacing: 1px; margin-top: 6px; }

.login-form {
  background: white;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

/* ── Password toggle ─────────────────────────────────────────────────────── */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-input-wrap input {
  flex: 1;
  padding-right: 48px !important;
}
.btn-toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 6px;
  color: var(--gray-400);
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
  touch-action: manipulation;
}
.btn-toggle-pw:hover { opacity: 1; }
.btn-toggle-pw.active { opacity: 1; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 7px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  color: var(--gray-800);
  -webkit-appearance: none;
  appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.18);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  cursor: pointer;
}
.checkbox-label input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--green); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  touch-action: manipulation;
  white-space: nowrap;
}
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover, .btn-primary:active { background: var(--green-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--gray-200); color: var(--gray-600); }
.btn-outline:hover { border-color: var(--green-light); color: var(--green); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #a93226; }
.btn-full { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-icon {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--gray-600);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  line-height: 1;
  touch-action: manipulation;
}
.btn-icon:hover { background: var(--gray-100); }
.btn-link {
  background: none;
  border: none;
  color: var(--green);
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 14px;
  text-decoration: underline;
  width: 100%;
  text-align: center;
  padding: 4px;
}

/* Confirm button with spinner */
.btn-confirm {
  background: var(--green);
  color: white;
  min-width: 160px;
}
.btn-confirm:hover { background: var(--green-dark); }
.btn-confirm:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Messages ─────────────────────────────────────────────────────────────── */
.error-msg {
  background: var(--red-light);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-top: 10px;
  border-left: 3px solid var(--red);
}
.success-msg {
  background: var(--green-bg);
  color: var(--green-dark);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-top: 10px;
  border-left: 3px solid var(--green-light);
}
.hidden { display: none !important; }

/* ── Success Toast ────────────────────────────────────────────────────────── */
#success-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 2000;
  background: white;
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  width: 90%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.34,1.56,0.64,1), transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
#success-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
#success-toast .toast-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 14px;
  animation: bounceIn 0.5s ease;
}
#success-toast h3 { font-size: 1.5rem; color: var(--green-dark); margin-bottom: 10px; }
#success-toast p { color: var(--gray-600); font-size: 1rem; line-height: 1.6; }
#success-toast-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#success-toast-backdrop.show { opacity: 1; pointer-events: auto; }

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.2); }
  80% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Hamburger button ────────────────────────────────────────────────────── */
.btn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
}
.btn-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.25s;
}
.btn-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.btn-hamburger.open span:nth-child(2) { opacity: 0; }
.btn-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.btn-hamburger:hover { background: rgba(255,255,255,0.12); }

.btn-logout-mobile {
  display: none;
  background: none;
  border: 1.5px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  white-space: nowrap;
}
.btn-logout-mobile:hover { border-color: white; color: white; background: rgba(255,255,255,0.12); }

/* Mobile dropdown menu */
.mobile-menu {
  position: absolute;
  top: 100%; /* relative to header */
  left: 0;
  right: 0;
  background: var(--green-dark);
  z-index: 200;
  box-shadow: var(--shadow-md);
  border-top: 1px solid rgba(255,255,255,0.1);
  animation: menuSlide 0.2s ease;
  pointer-events: auto;
}
.mobile-menu.hidden {
  display: none;
  pointer-events: none;
}
@keyframes menuSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  padding: 16px 22px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  touch-action: manipulation;
  font-family: var(--font);
}
.mobile-menu-item:hover, .mobile-menu-item.active {
  background: rgba(255,255,255,0.12);
  color: white;
}

.desktop-only { display: inline-flex; }
.mobile-only { display: none; }

/* ── App Header ───────────────────────────────────────────────────────────── */
.app-header {
  background: var(--green-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* allow mobile-menu to flow below */
  padding: 0 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
  overflow: visible; /* ensure dropdown is not clipped */
}
.header-left { display: flex; align-items: center; gap: 10px; }
.logo-icon-sm { font-size: 1.5rem; }
.header-title { font-size: 1.25rem; font-weight: 800; letter-spacing: 3px; color: white; }
.header-nav { display: flex; gap: 4px; }
.nav-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,0.18);
  color: white;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { font-size: 0.9rem; opacity: 0.85; }
.header-right .btn-outline {
  border-color: rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  padding: 6px 14px;
}
.header-right .btn-outline:hover {
  border-color: white;
  color: white;
  background: rgba(255,255,255,0.12);
}

/* ── Tab content ──────────────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }
.content-wrapper { max-width: 900px; margin: 0 auto; padding: 28px 20px; }

/* ── Dashboard info cards ─────────────────────────────────────────────────── */
.dashboard-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 640px) {
  .dashboard-cards { grid-template-columns: 1fr; }
}
.dash-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}

/* ── Onboarding hint banner ───────────────────────────────────────────────── */
.onboarding-banner {
  background: linear-gradient(135deg, var(--green-bg), #d8f3dc);
  border: 1.5px solid var(--green-light);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.onboarding-banner .ob-icon { font-size: 1.8rem; flex-shrink: 0; margin-top: 2px; }
.onboarding-banner h4 { font-size: 1rem; color: var(--green-dark); margin-bottom: 6px; font-weight: 700; }
.onboarding-banner .ob-steps { display: flex; flex-direction: column; gap: 6px; }
.onboarding-banner .ob-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--gray-600);
}
.ob-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ob-dismiss {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  margin-left: auto;
  align-self: flex-start;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Calendar ─────────────────────────────────────────────────────────────── */
.calendar-wrapper { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 18px;
}
.calendar-header h2 { font-size: 1.4rem; font-weight: 700; min-width: 200px; text-align: center; }

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 18px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  min-height: 46px;
  align-items: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--gray-50);
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-name { font-weight: 700; color: var(--gray-800); }
.legend-dates { color: var(--gray-600); }
.legend-time { color: var(--gray-400); font-size: 0.82rem; white-space: nowrap; }

.calendar-grid {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.cal-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.cal-day-header {
  text-align: center;
  padding: 12px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-days-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day {
  min-height: 90px;
  padding: 10px 8px 8px;
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.cal-day:hover:not(.cal-day-other):not(.cal-day-past) { background: var(--green-bg); }
.cal-day-other { background: var(--gray-50); cursor: default; }
.cal-day-past { opacity: 0.38; cursor: default; }
.cal-day-today {
  background: #eef4fb !important;
}
.cal-day-today .cal-day-num {
  background: #1a6fb5;
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(26,111,181,0.35);
}
.cal-day-num {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.cal-day-other .cal-day-num { color: var(--gray-400); }

/* Selection states */
.cal-day-selecting-start { background: rgba(45,106,79,0.12) !important; }
.cal-day-selecting-start .cal-day-num {
  background: var(--green) !important;
  color: white !important;
  border-radius: 50%;
}
.cal-day-selected { background: rgba(45,106,79,0.14) !important; }
.cal-day-selected .cal-day-num {
  background: var(--green) !important;
  color: white !important;
  border-radius: 50%;
}
.cal-day-range { background: rgba(82,183,136,0.12) !important; }

/* ── Booking chips ────────────────────────────────────────────────────────── */
.booking-chip {
  margin-top: 4px;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  line-height: 1.3;
  letter-spacing: 0.2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.booking-chip-start { border-radius: 6px 0 0 6px; margin-right: -1px; }
.booking-chip-mid { border-radius: 0; margin-left: -1px; margin-right: -1px; padding-left: 4px; padding-right: 4px; opacity: 0.85; }
.booking-chip-end { border-radius: 0 6px 6px 0; margin-left: -1px; }
.booking-chip-single { border-radius: 6px; }

/* ── Booking panel ────────────────────────────────────────────────────────── */
.booking-panel {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-top: 24px;
  border: 2px solid var(--green-light);
  overflow: hidden;
  animation: slideDown 0.25s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.booking-panel-header {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.booking-panel-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin: 0;
}
.booking-panel-header .panel-icon { font-size: 1.5rem; }

.booking-panel-body { padding: 24px 28px; }

.selected-range-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green-bg);
  border: 1.5px solid var(--green-light);
  border-radius: 30px;
  padding: 8px 18px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 22px;
}
.selected-range-pill .pill-icon { font-size: 1.1rem; }

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.time-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.time-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  background: white;
  color: var(--gray-800);
  cursor: pointer;
  -webkit-appearance: none;
  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='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.time-group select:focus {
  outline: none;
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.18);
}

.booking-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-wrap: wrap;
}

.calendar-hint {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.9rem;
  margin-top: 18px;
  padding: 12px;
}

/* ── My bookings ──────────────────────────────────────────────────────────── */
.bookings-list { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.booking-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: box-shadow 0.15s;
}
.booking-card:hover { box-shadow: var(--shadow-md); }
.booking-card-color { width: 7px; height: 54px; border-radius: 4px; flex-shrink: 0; }
.booking-card-info { flex: 1; }
.booking-card-dates { font-size: 1.05rem; font-weight: 700; }
.booking-card-time { font-size: 0.875rem; color: var(--gray-400); margin-top: 3px; }
.booking-card-actions { display: flex; gap: 8px; }
.btn-delete {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px;
  border-radius: 6px;
  touch-action: manipulation;
}
.btn-delete:hover { color: var(--red); background: var(--red-light); }
.empty-state {
  text-align: center;
  color: var(--gray-400);
  padding: 56px 16px;
  font-size: 1rem;
}
.empty-state .empty-icon { font-size: 3rem; display: block; margin-bottom: 14px; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 26px;
  border-bottom: 2px solid var(--gray-200);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-tab-btn {
  background: none;
  border: none;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
  touch-action: manipulation;
}
.admin-tab-btn.active { color: var(--green); border-bottom-color: var(--green); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-section-header h3 { font-size: 1.1rem; }

.users-list { display: flex; flex-direction: column; gap: 12px; }
.user-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.user-color-dot { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; border: 2px solid rgba(0,0,0,0.1); }
.user-info { flex: 1; min-width: 120px; }
.user-name { font-weight: 700; font-size: 1rem; }
.user-email { font-size: 0.875rem; color: var(--gray-400); margin-top: 2px; }
.user-badge {
  font-size: 0.72rem;
  background: var(--green-bg);
  color: var(--green-dark);
  border-radius: 20px;
  padding: 2px 9px;
  font-weight: 700;
  margin-left: 6px;
}
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 8px; }
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.stat-card h4 { font-size: 0.8rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 800; color: var(--green-dark); }
.stat-card .stat-sub { font-size: 0.85rem; color: var(--gray-400); margin-top: 4px; }

.stats-users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stats-users-table th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.82rem;
  color: var(--gray-400);
  text-transform: uppercase;
}
.stats-users-table td { padding: 14px 16px; border-top: 1px solid var(--gray-100); font-size: 0.95rem; }
.stats-users-table tr:hover td { background: var(--green-bg); }

.history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.history-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  border: 1px solid var(--gray-200);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.history-action {
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  flex-shrink: 0;
}
.history-action.created { background: var(--green-bg); color: var(--green-dark); }
.history-action.deleted { background: var(--red-light); color: var(--red); }
.history-date { color: var(--gray-400); font-size: 0.8rem; margin-left: auto; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-box {
  position: relative;
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-box-sm { max-width: 360px; }
.modal-box h3 { margin-bottom: 22px; font-size: 1.15rem; }
.modal-box p { color: var(--gray-600); margin-bottom: 22px; font-size: 0.95rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* ── Color picker ─────────────────────────────────────────────────────────── */
.color-picker-row { display: flex; align-items: center; gap: 14px; }
.color-picker-row input[type=color] { width: 44px; height: 44px; border: none; border-radius: 8px; cursor: pointer; padding: 0; }
.color-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(0,0,0,0.1);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
}
.color-preset:hover { transform: scale(1.2); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* ── Responsive: Tablet (≤768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .desktop-nav { display: none; }
  .btn-hamburger { display: flex; }
  .btn-logout-mobile { display: inline-flex; align-items: center; }
  .desktop-only { display: none !important; }
  .mobile-only { display: flex; }
  .app-header { position: sticky; top: 0; padding: 0 14px; height: 56px; }
  .header-title { font-size: 1.1rem; letter-spacing: 2px; }
  .header-user { display: none; }

  /* Calendar */
  .calendar-wrapper { padding: 16px 10px; }
  .cal-day { min-height: 80px; padding: 8px 5px 6px; }
  .cal-day-num { font-size: 0.9rem; width: 28px; height: 28px; }
  .booking-chip { font-size: 0.72rem; padding: 3px 6px; }
  .calendar-header h2 { font-size: 1.25rem; min-width: 170px; }

  /* Legend: stack vertically on tablet */
  .calendar-legend { flex-direction: column; align-items: flex-start; gap: 8px; }
  .legend-item { width: 100%; }

  /* Booking panel */
  .time-row { grid-template-columns: 1fr; gap: 12px; }
  .booking-actions { justify-content: stretch; }
  .booking-actions .btn { flex: 1; }
  .booking-panel-body { padding: 18px 20px; }
  .booking-panel-header { padding: 16px 20px; }

  /* Admin */
  .stats-users-table { font-size: 0.88rem; }
  .stats-users-table th, .stats-users-table td { padding: 10px 12px; }
  .user-card { flex-wrap: wrap; }
  .user-actions { width: 100%; justify-content: flex-end; }

  /* History items: stack on tablet */
  .history-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .history-date { margin-left: 0; }

  /* Modals */
  .modal-box { padding: 26px 22px; }
  .modal-actions { flex-direction: row; }
}

/* ── Responsive: Mobile (≤480px) ─────────────────────────────────────────── */
@media (max-width: 480px) {
  html { font-size: 16px; }

  /* Login */
  .login-container { padding-top: max(28px, 5vh); }
  .login-form { padding: 26px 18px; }
  .login-logo h1 { font-size: 2.4rem; }

  /* Header */
  .app-header { padding: 0 10px; }
  .header-title { font-size: 1rem; letter-spacing: 2px; }

  /* Layout */
  .content-wrapper { padding: 14px 10px; }

  /* Calendar */
  .calendar-wrapper { padding: 10px 6px; }
  .cal-day { min-height: 64px; padding: 6px 3px 4px; }
  .cal-day-num { font-size: 0.82rem; width: 26px; height: 26px; }
  .cal-day-today .cal-day-num { width: 28px; height: 28px; font-size: 0.88rem; }
  .booking-chip { font-size: 0.66rem; padding: 2px 4px; }
  .calendar-header h2 { font-size: 1.1rem; min-width: 150px; }
  .cal-day-header { font-size: 0.72rem; padding: 10px 0; }

  /* Legend */
  .calendar-legend { padding: 10px 12px; gap: 6px; }
  .legend-item { font-size: 0.82rem; padding: 6px 10px; }

  /* Onboarding */
  .onboarding-banner { padding: 12px 14px; gap: 10px; }
  .onboarding-banner .ob-icon { font-size: 1.5rem; }
  .onboarding-banner h4 { font-size: 0.95rem; }
  .onboarding-banner .ob-step { font-size: 0.85rem; }

  /* Booking panel */
  .booking-panel-header { padding: 14px 16px; }
  .booking-panel-header h3 { font-size: 0.98rem; }
  .booking-panel-body { padding: 14px 14px; }
  .selected-range-pill { font-size: 0.88rem; padding: 7px 12px; }
  .booking-actions .btn { font-size: 0.95rem; padding: 12px 16px; }

  /* My bookings */
  .booking-card { padding: 14px 14px; gap: 10px; }
  .booking-card-dates { font-size: 0.98rem; }
  .booking-card-time { font-size: 0.82rem; }

  /* Admin */
  .admin-tab-btn { padding: 10px 14px; font-size: 0.88rem; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 18px; }
  .stat-card .stat-value { font-size: 1.8rem; }
  .stats-users-table { font-size: 0.82rem; }
  .stats-users-table th, .stats-users-table td { padding: 8px 10px; }
  /* Stack table on very small screens */
  .stats-users-table thead { display: none; }
  .stats-users-table tr { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--gray-200); }
  .stats-users-table td { border-top: none; padding: 3px 10px; }
  .user-card { padding: 12px 14px; gap: 10px; }
  .user-name { font-size: 0.95rem; }
  .user-email { font-size: 0.82rem; }

  /* History */
  .history-item { padding: 10px 12px; font-size: 0.85rem; }

  /* Modals */
  .modal-box { padding: 20px 16px; }
  .modal-box h3 { font-size: 1.05rem; margin-bottom: 16px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Very small screens (≤360px) ─────────────────────────────────────────── */
@media (max-width: 360px) {
  .cal-day { min-height: 54px; }
  .booking-chip { font-size: 0.58rem; }
  .header-nav { gap: 0; }
  .nav-btn { padding: 5px 6px; font-size: 0.72rem; }
  .booking-panel-header h3 { font-size: 0.9rem; }
  .selected-range-pill { font-size: 0.82rem; padding: 6px 10px; }
}

/* ── PWA Install Banner ───────────────────────────────────────────────────── */
.pwa-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green-dark);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  line-height: 1.3;
}

.pwa-banner-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.pwa-banner-text {
  flex: 1;
}

.pwa-banner-btn {
  background: var(--green-light);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.pwa-banner-btn:hover {
  background: #40a070;
}

.pwa-banner-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}

.pwa-banner-close:hover {
  color: #fff;
}

/* ── Location info box ───────────────────────────────────────────────────── */
.location-info-box {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  background: #f8fcfa;
  min-height: 100px;
}
.location-info-left {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
}
.location-info-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.3;
  margin-bottom: 2px;
}
.location-info-body {
  font-size: 0.88rem;
  color: var(--gray-700);
  line-height: 1.45;
  margin-bottom: 2px;
}
.location-info-body strong {
  color: var(--gray-900);
}
/* Both location links — identical clean style, no underline */
.location-map-link,
.location-info-phone {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--green-dark);
  text-decoration: none;
  border: none;
  background: none;
  padding: 0;
  margin-top: 0;
  line-height: 1.5;
}
.location-info-right {
  flex: 0 0 110px;
  overflow: hidden;
  position: relative;
  border-left: 1px solid #c3ddd1;
}

/* ── Toast location note ─────────────────────────────────────────────────── */
.toast-location {
  font-size: 0.88rem;
  color: var(--gray-600);
  margin-top: 10px;
  line-height: 1.45;
  border-top: 1px solid var(--gray-100);
  padding-top: 10px;
}
.toast-location strong {
  color: var(--gray-800);
}

/* ── Location photo thumbnail ────────────────────────────────────────────── */
.location-photo {
  width: 100%;
  height: 100%;
  min-height: 90px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  border-radius: 0;
  margin: 0;
  border: none;
  transition: opacity 0.15s;
}
.location-photo:active {
  opacity: 0.8;
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  cursor: pointer;
}
.lightbox.hidden { display: none !important; }
.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.4rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* ── Past booking states ─────────────────────────────────────────────────── */
.legend-item-past {
  opacity: 0.6;
}
/* Past chips: solid grey background with dark text for clear readability */
.booking-chip-past {
  background: #c8cfd8 !important;
  color: #3a3f47 !important;
  opacity: 1;
  filter: none;
}
.booking-card-past {
  opacity: 0.65;
}
.booking-card-past .booking-card-dates,
.booking-card-past .booking-card-time {
  color: var(--gray-400);
}
