:root {
  --bg: #F5F6F7;
  --bg-card: #ffffff;
  --text: #212121;
  --muted: #616161;
  --border: #E5E7EB;
  --primary: #1E88E5;
  --primary-600: #1976D2;
  --accent-red: #E53935;
  --accent-yellow: #FBC02D;
  --grey: #BDBDBD;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}
[data-theme="dark"] {
  --bg: #0F1115;
  --bg-card: #1A1D24;
  --text: #ECEFF1;
  --muted: #9CA3AF;
  --border: #2A2F3A;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.3);
  color-scheme: dark;
}
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  /* Replace native indicator with a bright white SVG so it's visible
     regardless of the browser's color-scheme handling. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ECEFF1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><path d='M16 2v4M8 2v4M3 10h18'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  width: 22px; height: 22px;
  opacity: 1; cursor: pointer; padding: 2px;
  border-radius: 4px;
  filter: none;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  background-color: rgba(255,255,255,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Roboto, -apple-system, system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; width: 100%; }
.main { padding: 28px 20px 60px; flex: 1; }

/* TOPBAR */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar__inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand__dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-yellow), var(--primary));
}
.brand__name { font-size: 15px; letter-spacing: .2px; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.nav a {
  padding: 8px 12px; border-radius: 8px; color: var(--muted);
  font-size: 14px; font-weight: 500; transition: var(--transition); white-space: nowrap;
}
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.topbar__right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.user-pill { font-size: 13px; color: var(--muted); white-space: nowrap; }
.user-pill small { opacity: .7; }
.topbar .nav-toggle { display: none !important; }

/* Tablet: hide username text, keep nav inline */
@media (max-width: 960px) {
  .user-pill small { display: none; }
  .user-pill { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .nav { gap: 2px; }
  .nav a { padding: 8px 10px; font-size: 13.5px; }
}

/* Mobile / small tablet: collapse nav into a dropdown */
@media (max-width: 820px) {
  .topbar__inner { gap: 10px; }
  .topbar .nav-toggle { display: inline-flex !important; order: -1; }
  .brand__name { font-size: 14px; }
  .user-pill { display: none; }
  .nav {
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
    padding: 0 12px;
  }
  .nav.is-open { max-height: 70vh; padding: 8px 12px; }
  .nav a { padding: 12px 10px; border-bottom: 1px solid var(--border); border-radius: 0; }
  .nav a:last-child { border-bottom: 0; }
}

@media (max-width: 420px) {
  .logout-btn { padding: 7px 10px; }
  .brand__name { display: none; }
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.icon-btn:hover { background: var(--bg); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: var(--transition); text-decoration: none;
  background: var(--bg-card); color: var(--text);
}
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-600); text-decoration: none; }
.btn--danger { background: var(--accent-red); color: #fff; }
.btn--success { background: #2E7D32; color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* CARDS */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.facilities {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.facility-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: var(--transition); cursor: pointer; position: relative; overflow: hidden;
}
.facility-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-yellow));
  opacity: 0; transition: var(--transition);
}
.facility-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.facility-card:hover::before { opacity: 1; }
.facility-card__icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(30,136,229,.12), rgba(251,192,45,.12));
  display: flex; align-items: center; justify-content: center; color: var(--primary);
  margin-bottom: 14px;
}
.facility-card__title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.facility-card__desc { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; min-height: 42px; }
.facility-card__meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted); align-items:center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); font-size: 12px; }

/* PAGE HEADER */
.page-head { display:flex; align-items:flex-end; justify-content:space-between; margin: 8px 0 20px; gap:16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* FORMS */
.form-row { display: flex; flex-direction: column; margin-bottom: 14px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, .select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: 14px; font-family: inherit;
  transition: var(--transition);
}
.input:focus, .select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,136,229,.15);
}
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* AUTH */
.auth-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin: 0 0 8px; font-size: 24px; }
.auth-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

/* TABLES */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.table tr:hover td { background: var(--bg); }

.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status--pending { background: rgba(251,192,45,.15); color: #B7791F; }
.status--approved { background: rgba(30,136,229,.15); color: var(--primary); }
.status--rejected { background: rgba(229,57,53,.12); color: var(--accent-red); }
.status--cancelled { background: rgba(189,189,189,.2); color: var(--muted); }

/* FLASH */
.flash { margin: 14px 0 0; padding: 12px 16px; border-radius: 8px; font-size: 14px; border:1px solid; }
.flash--info    { background: rgba(30,136,229,.08); border-color: rgba(30,136,229,.25); color: var(--primary); }
.flash--success { background: rgba(46,125,50,.08); border-color: rgba(46,125,50,.25); color: #2E7D32; }
.flash--error   { background: rgba(229,57,53,.08); border-color: rgba(229,57,53,.25); color: var(--accent-red); }
.flash--warn    { background: rgba(251,192,45,.1); border-color: rgba(251,192,45,.3); color: #B7791F; }

/* BOOKING WIDGET */
.booking-grid { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .booking-grid { grid-template-columns: 1fr; } }

.slot-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.slot {
  padding: 10px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); cursor: pointer; font-size: 13px; font-weight: 600;
  transition: var(--transition); text-align: center;
}
.slot:hover:not(.slot--booked):not(.slot--past) { border-color: var(--primary); color: var(--primary); }
.slot--selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.slot--booked   { background: rgba(229,57,53,.08); color: var(--accent-red); border-color: rgba(229,57,53,.2); cursor: not-allowed; text-decoration: line-through; }
.slot--past     { opacity: .35; cursor: not-allowed; }

/* FOOTER */
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0; background: var(--bg-card); color: var(--muted); font-size: 13px;
  text-align: center;
}

/* UTIL */
.row { display: flex; gap: 10px; align-items: center; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.gap-sm { gap: 6px; }
.spacer { flex: 1; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.facility-card, .card { animation: fadeIn .25s ease; }
