/* =========================================================
   Panel de administración
   ========================================================= */
@font-face { font-family: "Inter"; src: url("../fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Serif Display"; src: url("../fonts/dm-serif-display-400.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #f5f3ef; --card: #fff; --ink: #1f1a15; --ink-2: #6a6157; --line: #e5ded3;
  --blue: #1d4f91; --blue-d: #153b6e; --blue-soft: #e8eef8;
  --green: #1e7b47; --green-soft: #e3f3e9; --red: #b3261e; --red-soft: #fdecea; --amber: #8a5a00; --amber-soft: #fff3d6;
  --r: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
p { margin: 0 0 .5em; }
ul { list-style: none; margin: 0; padding: 0; }
h1 { font: 400 clamp(30px, 6vw, 40px)/1.1 "DM Serif Display", Georgia, serif; margin: 0 0 20px; }
h2 { margin: 0; }
:focus-visible { outline: 3px solid #c98a2b; outline-offset: 2px; border-radius: 4px; }
.hint { color: var(--ink-2); font-size: 14px; }
.hint-inline { color: var(--ink-2); font-weight: 400; font-size: 13px; }
.center { text-align: center; }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1.5px solid var(--blue);
  background: var(--blue); color: #fff; font: 600 15px/1.2 "Inter", system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--blue-d); border-color: var(--blue-d); }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--blue); border-color: #c9d5e8; }
.btn-ghost:hover { background: var(--blue-soft); border-color: var(--blue); }
.btn-danger { background: transparent; color: var(--red); border-color: #efc2be; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
input:not([type="checkbox"]), select {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid #d8cfc2; border-radius: 10px;
  background: #fff; color: var(--ink); font: 16px/1.3 "Inter", system-ui, sans-serif;
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29, 79, 145, .15); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); flex: none; margin: 0; }
.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; font-weight: 500; }
.alert-ok { background: var(--green-soft); color: #154f2f; border: 1px solid #b7dfc3; }
.alert-error { background: var(--red-soft); color: #7d1a13; border: 1px solid #f3c2bd; }

/* ---------- Modo demo ---------- */
.alert-demo { background: #fff3d6; color: #5c3d00; border: 1px solid #ecd39a; }
.demo-banner { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; background: #fff3d6; border: 1px solid #ecd39a; color: #5c3d00; border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-size: 15px; }
.demo-banner strong { background: #8a5a00; color: #fff; padding: 2px 10px; border-radius: 999px; font-size: 13px; }
.pill-demo { background: #fff3d6; color: var(--amber); }
.demo-dialog { border: 0; border-radius: 20px; padding: 28px 24px 22px; width: min(420px, calc(100% - 32px)); text-align: center; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
.demo-dialog::backdrop { background: rgba(20, 43, 74, .55); backdrop-filter: blur(3px); }
.demo-dialog-icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.demo-dialog h2 { font: 400 30px/1.1 "DM Serif Display", Georgia, serif; margin-bottom: 6px; }
.demo-dialog-lead { font-weight: 700; color: var(--amber); margin-bottom: 10px; }
.demo-dialog-text { color: var(--ink-2); margin-bottom: 20px; }
.demo-box { margin-top: 22px; padding: 16px; border-radius: 14px; background: #fff3d6; border: 1px solid #ecd39a; text-align: center; }
.demo-box-title { font-weight: 700; color: #5c3d00; }
.demo-box code { background: #fff; padding: 2px 8px; border-radius: 6px; font-size: 15px; border: 1px solid #ecd39a; }
.demo-box .btn { margin-top: 10px; background: #fff; }

/* ---------- Login / alta ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 400px); justify-content: center; align-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 0%, #dfe8f6, transparent 50%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px 24px; box-shadow: 0 30px 60px -40px rgba(31, 26, 21, .5); }
.auth-card h1 { font-size: 30px; margin: 14px 0 4px; }
.auth-card .hint { margin-bottom: 20px; }
.auth-card input { margin-bottom: 14px; }
.auth-card .btn { margin-top: 6px; }
.auth-card .center { margin: 18px 0 0; }
.auth-logo { width: 44px; height: 44px; }

/* ---------- Estructura del panel ---------- */
.shell { min-height: 100vh; }
.side { background: #142b4a; color: #e8eef8; }
.side-top { padding: 14px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.brand svg { width: 34px; height: 34px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: #a9bad3; }
.side-nav { display: flex; overflow-x: auto; gap: 4px; padding: 0 10px 10px; scrollbar-width: none; }
.side-nav a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #c8d5e8; text-decoration: none; font-weight: 500; white-space: nowrap; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav a[aria-current="page"] { background: #fff; color: #142b4a; }
.side-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.badge { background: #f3c25b; color: #3d2a00; font-size: 12px; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 6px; }
.side-user { display: none; }
.main { padding: 24px 16px 60px; max-width: 1100px; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 250px 1fr; }
  .side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
  .side-top { padding: 22px 20px; }
  .side-nav { flex-direction: column; overflow: visible; padding: 0 12px; flex: 1; }
  .side-user { display: block; padding: 18px 20px; border-top: 1px solid rgba(255, 255, 255, .1); }
  .side-user .hint { color: #a9bad3; }
  .side-actions { display: flex; gap: 8px; margin-top: 10px; }
  .side-actions .btn { color: #fff; border-color: rgba(255, 255, 255, .25); }
  .side-actions .btn:hover { background: rgba(255, 255, 255, .1); }
  .main { padding: 40px 48px 80px; }
  .mobile-user { display: none; }
}

/* Barra inferior móvil con usuario y salir */
@media (max-width: 899px) {
  .side-user { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 14px; }
  .side-user p { margin: 0; }
  .side-user .hint { color: #a9bad3; font-size: 13px; }
  .side-actions { display: flex; gap: 6px; }
  .side-actions .btn { color: #fff; border-color: rgba(255, 255, 255, .25); min-height: 40px; padding: 6px 12px; }
}

/* ---------- Bloques comunes ---------- */
.card, .panel, .user, .res { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card { padding: 22px; }
.panel { padding: 0; margin-bottom: 24px; }
.panel > summary { list-style: none; margin: 16px; display: inline-flex; }
.panel > summary::-webkit-details-marker { display: none; }
.panel[open] > summary { background: transparent; color: var(--blue); border-color: #c9d5e8; }
.panel > form { padding: 0 16px 18px; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }
.grid-form { display: grid; gap: 14px; }
.grid-form .wide { grid-column: 1 / -1; }
@media (min-width: 700px) { .grid-form { grid-template-columns: repeat(3, 1fr); } }
.stack { display: grid; gap: 4px; }
.stack input { margin-bottom: 10px; }
.stack .btn { justify-self: start; margin-top: 4px; }
.block { margin-bottom: 28px; }
.block-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; }
.two { display: grid; gap: 18px; }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; align-items: start; } }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); vertical-align: 2px; }
.pill-owner { background: #fff3d6; color: var(--amber); }
.pill-pendiente { background: var(--amber-soft); color: var(--amber); }
.pill-confirmada { background: var(--green-soft); color: var(--green); }
.pill-cancelada { background: #eee; color: #666; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.checklist li { padding: 6px 0 6px 26px; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.seg { display: inline-flex; background: #e9e3d9; border-radius: 12px; padding: 4px; gap: 2px; overflow-x: auto; max-width: 100%; }
.seg a { min-height: 40px; display: flex; align-items: center; padding: 0 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.seg a[aria-current="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* ---------- Reservas ---------- */
.day { margin-bottom: 28px; }
.day-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.res-grid { display: grid; gap: 10px; }
@media (min-width: 700px) { .res-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .res-grid { grid-template-columns: repeat(3, 1fr); } }
.res { padding: 16px; border-left: 4px solid #e3a008; }
.res.is-confirmada { border-left-color: var(--green); }
.res.is-cancelada { border-left-color: #bbb; opacity: .7; }
.res-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.res-hora { font-size: 22px; font-weight: 800; }
.res-pax { font-weight: 600; color: var(--ink-2); }
.res-top .pill { margin-left: auto; }
.res-nombre { font-weight: 700; font-size: 17px; margin: 0; }
.tel { font-weight: 600; text-decoration: none; display: inline-flex; min-height: 32px; align-items: center; }
.res-notas { color: var(--ink-2); font-style: italic; font-size: 14px; }
.res-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- Carta ---------- */
.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.row:last-child { border-bottom: 0; }
.row-title { font-weight: 600; margin: 0; }
.row-main .hint { margin: 2px 0 0; }
.row-price { font-weight: 700; color: var(--blue); margin: 0; }
.row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.inline-edit { display: contents; }
.inline-edit > summary { list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit[open] > form { order: 10; flex-basis: 100%; background: #faf8f4; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 6px; }
@media (min-width: 760px) {
  .row { grid-template-columns: 1fr auto auto; }
  .row-actions { grid-column: auto; justify-content: flex-end; }
  .inline-edit[open] > form { order: 0; }
  .row:has(.inline-edit[open]) { grid-template-columns: 1fr auto; }
  .row:has(.inline-edit[open]) .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- Galería ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.photo { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-foot { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.photo-foot p { font-size: 14px; color: var(--ink-2); margin: 0; flex: 1; }
.photo-foot .btn { width: 100%; }
.preview { max-width: 260px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- Usuarios ---------- */
.users { display: grid; gap: 12px; }
.user { padding: 18px; }
.user-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.user-id p { margin: 0; }
.user-perms { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: 13px; padding: 4px 10px; border-radius: 8px; background: #f1ede6; color: #4a4239; }
.tag-all { background: #fff3d6; color: var(--amber); font-weight: 600; }
.user .row-actions { padding-top: 12px; border-top: 1px solid var(--line); }
.perms { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; background: #fcfbf8; }
.perms legend { font-weight: 700; padding: 0 6px; }
.perms .hint { margin-bottom: 12px; }
.perms-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .perms-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .perms-grid { grid-template-columns: repeat(4, 1fr); } }
.perm-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); margin-bottom: 6px; }
.perm { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; min-height: 40px; cursor: pointer; margin: 0; }
.perm.is-locked { color: #aaa; cursor: not-allowed; }
.lock { font-size: 12px; font-weight: 400; }
