:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #1c2024;
  --text-muted: #6b7280;
  --primary: #2f6feb;
  --primary-dark: #1f56c4;
  --booked: #ffe0e0;
  --booked-border: #e57373;
  --free-hover: #eef4ff;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 40px;
  width: auto;
}

.topbar h1 {
  font-size: 1.3rem;
  margin: 0;
}

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

.week-label {
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.btn.ghost:hover { background: #f0f2f5; }

.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn.primary:hover { background: var(--primary-dark); }

main {
  padding: 20px 24px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.rooms-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.room-tab {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
}

.room-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.calendar-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 30px;
}

.calendar {
  display: grid;
  grid-template-columns: 70px repeat(7, minmax(110px, 1fr));
  min-width: 860px;
}

.cal-header {
  padding: 10px 6px;
  text-align: center;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: #fafbfc;
  position: sticky;
  top: 0;
}
.cal-header.today { color: var(--primary); }
.cal-header .day-num { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }

.cal-corner {
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.cal-time-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 4px 6px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.cal-slot {
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 34px;
  position: relative;
  cursor: pointer;
}

.cal-slot:hover { background: var(--free-hover); }

.cal-slot.booked {
  background: var(--booked);
  cursor: default;
}

.booking-chip {
  position: absolute;
  inset: 2px;
  background: var(--booked-border);
  color: white;
  border-radius: 6px;
  font-size: 0.68rem;
  padding: 3px 5px;
  overflow: hidden;
  line-height: 1.2;
}

.upcoming h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.booking-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.booking-card .meta { font-size: 0.85rem; color: var(--text-muted); }
.booking-card .title { font-weight: 600; }

.empty-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 10px 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin-top: 0; font-size: 1.15rem; }

#bookingForm { display: flex; flex-direction: column; gap: 14px; }

#bookingForm label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  flex: 1;
}

#bookingForm input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.row { display: flex; gap: 12px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.form-error {
  color: #c0392b;
  font-size: 0.85rem;
  background: #fdecea;
  padding: 8px 10px;
  border-radius: 6px;
}
.form-error.hidden { display: none; }

.price-note {
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 6px;
  background: #eef4ff;
  color: #1c2024;
  border: 1px solid #d3e0fb;
}
.price-note.hidden { display: none; }
.price-note.free { background: #e9f8ee; border-color: #c7ecd3; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c2024;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 200;
}
.toast.hidden { display: none; }
.toast.error { background: #c0392b; }

.cancel-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #c0392b;
}
.cancel-btn:hover { background: #fdecea; }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .row { flex-direction: column; }
}
