:root {
  --bg: #f5f7fb;
  --ink: #13223d;
  --muted: #5e6d88;
  --line: #d8e2ef;
  --card: #ffffff;
  --primary: #0b5cab;
  --primary-dark: #084781;
  --sum-day: #ececec;
  --sum-night: #cfcfcf;
  --parrilla-day: #dff3df;
  --parrilla-night: #9ccf9c;
  --free: #e7f8ec;
  --busy: #f8d7da;
  --mine: #fff0b3;
  --blocked: #d4d8de;
  --glass: rgba(255, 255, 255, 0.88);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, #d6ecff 0%, transparent 50%),
    radial-gradient(circle at 95% 5%, #ffe9d4 0%, transparent 45%),
    var(--bg);
}
body.login-mode {
  background:
    linear-gradient(rgba(237, 241, 247, 0.56), rgba(237, 241, 247, 0.56)),
    url('/images/cba3029.png') center/cover no-repeat fixed;
  filter: grayscale(28%);
}

.topbar {
  background: linear-gradient(120deg, #0b2849, #0b5cab);
  color: #fff;
  padding: 28px clamp(16px, 5vw, 44px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.eyebrow { margin: 0; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }
.topbar h1 { margin: 6px 0; font-size: clamp(28px, 4vw, 42px); }
.subtitle { margin: 0; opacity: 0.9; }

.layout { margin: 18px auto 34px; padding: 0 8px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(17, 29, 53, 0.08);
  padding: 20px;
}
.sb-panel { overflow: hidden; }
.sb-panel-header {
  margin: -20px -20px 14px;
  padding: 14px 20px;
  border-bottom: 1px solid #e8edf5;
  background: linear-gradient(180deg, #f8fbff, #f2f6fc);
}
.sb-panel-header h2 { margin: 0 0 4px; font-size: 1.55rem; }
.sb-panel-body { padding: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.warn { color: #a53f15; font-weight: 700; display: block; margin-top: 4px; }

.auth-shell { display: grid; place-items: center; min-height: 60vh; }
.auth-card {
  width: min(520px, 100%);
  background: var(--glass);
  backdrop-filter: blur(8px);
}
.auth-help { margin: 12px 0 0; }
.auth-help a { color: var(--primary-dark); font-weight: 700; }

form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}
.auth-card button,
#reserveForm button,
#loginForm button,
#registerForm button,
#blockForm button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); }
button.secondary,
.btn.secondary {
  background: #eaf2ff;
  color: #194179;
  border: 1px solid #bdd4f6;
}

.app-shell { display: grid; gap: 16px; }
.intro {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}
.legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); }
.constraint-note {
  margin-top: 8px;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid #cad9f6;
  color: #2b4f87;
  font-size: 13px;
  font-weight: 600;
}
.dot { width: 12px; height: 12px; border-radius: 999px; display: inline-block; margin-right: 6px; border: 1px solid #b8c8de; }
.dot.free { background: var(--free); }
.dot.busy { background: var(--busy); }
.dot.mine { background: var(--mine); }
.dot.blocked { background: var(--blocked); }

.calendar { display: grid; gap: 12px; }
.day-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.day-title { font-weight: 800; margin-bottom: 9px; text-transform: capitalize; }
.slot-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.slot {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 110px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 4px;
  background: #fff;
}
.slot-sum-day { background: var(--sum-day); }
.slot-sum-night { background: var(--sum-night); }
.slot-parrilla-day { background: var(--parrilla-day); }
.slot-parrilla-night { background: var(--parrilla-night); }
.slot.busy {
  box-shadow: inset 0 0 0 999px var(--busy);
  border: 2px solid #c93c4b;
}
.slot.mine {
  box-shadow: inset 0 0 0 999px var(--mine);
  border: 2px solid #c79200;
}
.slot.blocked {
  box-shadow: inset 0 0 0 999px var(--blocked);
  border: 2px solid #6b7280;
}
.slot small { color: var(--muted); }
.slot button { align-self: end; border-radius: 10px; font-weight: 700; }
.btn-reserve {
  background: linear-gradient(180deg, #246bc1, #1654a0);
  border: 1px solid #0f4b95;
  color: #fff;
}
.btn-reserve:hover { background: linear-gradient(180deg, #2a75cf, #1a5db0); color: #fff; }
.btn-cancel {
  background: #f7fafc;
  border: 1px solid #9cb3d6;
  color: #1a4d95;
}
.btn-cancel:hover { background: #eaf1fb; color: #143d78; }
.badge {
  display: inline-block;
  width: fit-content;
  border-radius: 999px;
  background: #e7eefc;
  color: #173f7f;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}
.busy-badge {
  background: #b42331;
  color: #fff;
}
.mine-badge {
  background: #8a6500;
  color: #fff;
}
.blocked-badge {
  background: #4b5563;
  color: #fff;
}

.grid { display: grid; gap: 16px; }
.two-cols { grid-template-columns: 1fr; }
.admin-grid { display: grid; gap: 16px; }
.reservation-row, .user-row {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.reservation-row:last-child, .user-row:last-child { border-bottom: 0; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 6px; justify-content: end; }
.compact-form { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.pill-approved { background: #dff3df; color: #1d6b2f; }
.pill-pending { background: #fff1cf; color: #8d6100; }
.pill-blocked { background: #f6d7d7; color: #892626; }
.pill-suspended { background: #fbd8e8; color: #8e2150; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #102746;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(3, 15, 33, 0.3);
}

dialog {
  border: 0;
  border-radius: 16px;
  width: min(480px, calc(100% - 24px));
  padding: 0;
}
dialog::backdrop { background: rgba(15, 25, 40, 0.45); }
.dialog-content { padding: 18px; }
.checkbox { display: flex; gap: 8px; align-items: start; }
.checkbox input { width: auto; margin-top: 3px; }
.actions { display: flex; justify-content: end; gap: 8px; }

@media (max-width: 760px) {
  .topbar { align-items: start; flex-direction: column; }
  .intro { flex-direction: column; }
  .reservation-row, .user-row { align-items: start; flex-direction: column; }
  .slot { min-height: 112px; }
}

@media (min-width: 768px) {
  .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-cols { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
