*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 220px;
  --sidebar-bg: #1e2433;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #64748b;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ---- LOGIN ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}
.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 8px;
  font-size: 32px;
}
.login-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 16px;
  background: #f8fafc;
}
.form-input:focus { border-color: var(--primary); background: #fff; }
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
  min-height: 18px;
}
.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }

/* ---- LAYOUT ---- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo span { color: var(--sidebar-active); }
.sidebar-user {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--sidebar-text);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-section {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #475569;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background .1s, color .1s;
  border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-item.active { background: rgba(59,130,246,.15); color: #93c5fd; }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.btn-logout {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
}
.btn-logout:hover { background: rgba(255,255,255,.07); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 28px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; }

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 20px;
}
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.guest-name { font-weight: 600; }
.booking-code { font-family: monospace; font-size: 12px; color: var(--text-secondary); }

/* ---- STATUS BADGE ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge-confirmed { background: #eff6ff; color: #1d4ed8; }
.badge-checked_in { background: #f0fdf4; color: #15803d; }
.badge-no_show { background: #fff7ed; color: #c2410c; }
.badge-cancelled { background: #fef2f2; color: #b91c1c; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-blue { background: var(--primary); color: #fff; }
.btn-green { background: #22c55e; color: #fff; }
.btn-orange { background: #f59e0b; color: #fff; }
.btn-red { background: var(--danger); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #f1f5f9; opacity: 1; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- DATE NAV ---- */
.date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.date-nav-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background .1s;
}
.date-nav-btn:hover { background: #f1f5f9; }
.date-nav input[type="date"] {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: var(--card);
}
.date-nav input[type="date"]:focus { border-color: var(--primary); }

/* ---- DETAIL PANEL ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.detail-row { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .4px; }
.detail-value { font-size: 15px; font-weight: 500; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- FORM GROUPS ---- */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
select.form-input { cursor: pointer; }
textarea.form-input { min-height: 90px; resize: vertical; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---- EMPTY / ERROR ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  font-size: 15px;
}
.loading-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}
.toast {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  animation: slideIn .2s ease;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- ADMIN CALENDAR ---- */
.cal-admin-grid { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.cal-admin-header { display: grid; grid-template-columns: repeat(7, 1fr); background: #f8fafc; border-bottom: 1px solid var(--border); }
.cal-admin-hdr { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-secondary); padding: 8px 4px; text-transform: uppercase; letter-spacing: .5px; }
.cal-admin-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-admin-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  min-height: 110px;
  cursor: pointer;
  transition: background .1s;
}
.cal-admin-cell:hover { background: #fafbfe; }
.cal-admin-cell:nth-child(7n) { border-right: none; }
.cal-admin-empty { cursor: default; min-height: 0; }
.cal-admin-empty:hover { background: transparent; }
.cal-today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-closed { background: #fef2f2; }
.cal-closed:hover { background: #fee2e2; }

.cal-day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.cal-day-num { font-weight: 700; font-size: 13px; }
.cal-badge-closed { font-size: 7px; font-weight: 800; padding: 1px 4px; border-radius: 3px; background: #ef4444; color: #fff; letter-spacing: .3px; }

.cal-cap-line { font-size: 9px; color: var(--text-secondary); margin-bottom: 2px; }
.cal-section { margin-bottom: 2px; padding: 2px 3px; border-radius: 3px; font-size: 9px; }
.cal-section-fd { color: #7c3aed; font-weight: 600; }
.cal-section-3h { }
.cal-count-full { color: #ef4444 !important; font-weight: 700; }

.cal-minibar { flex: 1; height: 5px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.cal-minibar-fill { height: 100%; border-radius: 3px; }
.cal-fill-fd { background: #8b5cf6; }
.cal-fill-3h { background: #3b82f6; }

.cal-slot-row { display: flex; align-items: center; gap: 2px; margin-bottom: 1px; }
.cal-slot-time { font-size: 8px; color: var(--text-secondary); min-width: 26px; font-variant-numeric: tabular-nums; }
.cal-slot-count { font-size: 8px; color: var(--text-secondary); min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cal-slot-closed-text { font-size: 8px; color: #ef4444; font-weight: 600; }

/* ---- TABS ---- */
.tabs { display: flex; gap: 4px; background: #f1f5f9; border-radius: 8px; padding: 4px; }
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
