*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #fafaf9; color: #1c1917; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: #1c1917; display: flex; flex-direction: column;
}
.sidebar-brand { padding: 20px; border-bottom: 1px solid #292524; }
.sidebar-brand h1 { color: #fbbf24; font-size: 1.1rem; font-weight: 700; }
.sidebar-brand p  { color: #78716c; font-size: 0.72rem; margin-top: 2px; }

.sidebar nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  font-size: 0.875rem; color: #a8a29e; text-decoration: none;
  transition: background 0.15s;
}
.sidebar nav a:hover  { background: #292524; color: #e7e5e4; }
.sidebar nav a.active { background: #78350f; color: #fde68a; font-weight: 600; }
.sidebar-footer { padding: 12px 20px; border-top: 1px solid #292524; font-size: 0.72rem; color: #57534e; }

.sidebar-header { display: flex; align-items: center; }
.sidebar-brand { flex: 1; }
.nav-toggle { display: none; }

.main { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-size: 0.875rem; cursor: pointer; border: none; font-weight: 500; transition: background 0.15s; font-family: inherit; }
.btn-primary   { background: #b45309; color: #fff; }
.btn-primary:hover   { background: #92400e; }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }
.btn-danger    { background: #fff; color: #dc2626; border: 1px solid #fca5a5; }
.btn-danger:hover    { background: #fef2f2; }
.btn:disabled  { opacity: 0.5; cursor: not-allowed; }

/* ── Cards y superficies ─────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid #e7e5e4; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }

/* ── Barra de fecha ─────────────────────────────────────────────────── */
.date-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-nav  { display: flex; align-items: center; gap: 6px; }
.date-nav-btn { padding: 6px 12px; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; cursor: pointer; font-size: 0.875rem; font-family: inherit; }
.date-nav-btn:hover { background: #f5f5f4; }
.date-label { font-size: 1rem; font-weight: 700; color: #1c1917; }
.date-sub   { font-size: 0.78rem; color: #78716c; }
.hora-sel   { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.hora-sel label { font-size: 0.82rem; color: #57534e; }
.hora-sel select, .hora-sel input[type=time] { border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 10px; font-size: 0.82rem; font-family: inherit; }

/* ── Panel principal (lista + plano) ────────────────────────────────── */
.main-panels { display: flex; gap: 16px; flex: 1; min-height: 0; }

/* ── Lista de reservas ───────────────────────────────────────────────── */
.lista-panel { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.lista-header { display: flex; align-items: center; justify-content: space-between; }
.lista-header h2 { font-size: 0.9rem; font-weight: 700; color: #1c1917; }
.lista-empty { color: #a8a29e; font-size: 0.85rem; text-align: center; padding: 32px 16px; }

.reserva-item {
  background: #fff; border: 1px solid #e7e5e4; border-radius: 10px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  border-left: 4px solid #d6d3d1;
}
.reserva-item:hover { border-color: #b45309; box-shadow: 0 2px 8px rgba(180,83,9,.1); }
.reserva-item.ocasion-cumpleaños  { border-left-color: #f59e0b; }
.reserva-item.ocasion-aniversario { border-left-color: #ec4899; }
.reserva-item.ocasion-negocio     { border-left-color: #3b82f6; }
.reserva-item.ocasion-celebración { border-left-color: #8b5cf6; }

.ri-hora  { font-size: 0.78rem; font-weight: 700; color: #b45309; margin-bottom: 3px; }
.ri-quien { font-size: 0.9rem; font-weight: 600; color: #1c1917; }
.ri-meta  { font-size: 0.78rem; color: #78716c; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ri-tag   { background: #fef3c7; color: #92400e; border-radius: 4px; padding: 1px 6px; font-size: 0.72rem; font-weight: 500; }
.ri-tag.tag-cumpleaños  { background: #fef3c7; color: #92400e; }
.ri-tag.tag-aniversario { background: #fce7f3; color: #9d174d; }
.ri-tag.tag-negocio     { background: #dbeafe; color: #1e40af; }
.ri-tag.tag-celebración { background: #ede9fe; color: #5b21b6; }

/* ── Plano del local ─────────────────────────────────────────────────── */
.plano-panel { flex: 1; overflow-y: auto; }
.plano-inner { padding: 20px; }
.plano-leyenda { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.ley-item { display: flex; align-items: center; gap: 5px; font-size: 0.78rem; color: #57534e; }
.ley-dot  { width: 10px; height: 10px; border-radius: 50%; }

.zona { margin-bottom: 24px; }
.zona-titulo { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #a8a29e; margin-bottom: 10px; }
.zona-mesas  { display: flex; flex-wrap: wrap; gap: 10px; }

.mesa-card {
  width: 90px; height: 90px; border-radius: 12px; border: 2px solid;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  text-align: center; padding: 6px; position: relative;
}
.mesa-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.mesa-num  { font-size: 1.1rem; font-weight: 800; line-height: 1; }
.mesa-cap  { font-size: 0.65rem; margin-top: 2px; opacity: .8; }
.mesa-info { font-size: 0.65rem; margin-top: 4px; font-weight: 500; line-height: 1.2; }

.mesa-card.libre     { background:#f0fdf4; border-color:#86efac; color:#15803d; }
.mesa-card.reservada { background:#fefce8; border-color:#fde047; color:#854d0e; }
.mesa-card.ocupada   { background:#fff1f2; border-color:#fda4af; color:#be123c; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay { display:none; position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.45); align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal-box { background:#fff; border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.2); width:100%; max-width:520px; margin:16px; overflow:hidden; max-height:92vh; overflow-y:auto; }
.modal-header { background:#92400e; padding:16px 24px; display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:1; }
.modal-header h2 { color:#fff; font-size:1rem; font-weight:600; }
.modal-close { background:none; border:none; color:rgba(255,255,255,.8); font-size:1.5rem; cursor:pointer; line-height:1; }
.modal-close:hover { color:#fff; }
.modal-body { padding:24px; display:flex; flex-direction:column; gap:14px; }
.modal-footer { display:flex; align-items:center; justify-content:space-between; padding-top:8px; }

/* ── Formulario ───────────────────────────────────────────────────────── */
.form-row   { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-group { display:flex; flex-direction:column; gap:4px; }
.form-group.full { grid-column:1/-1; }
label { font-size:0.8rem; font-weight:500; color:#374151; }
input, select, textarea { border:1px solid #d1d5db; border-radius:8px; padding:8px 12px; font-size:0.875rem; color:#111; width:100%; outline:none; font-family:inherit; background:#fff; }
input:focus, select:focus, textarea:focus { border-color:#b45309; box-shadow:0 0 0 3px rgba(180,83,9,.12); }
textarea { resize:none; }
.hint { font-size:0.75rem; color:#6b7280; }

/* ── Alert ────────────────────────────────────────────────────────────── */
.alert-error { background:#fef2f2; color:#dc2626; border-radius:8px; padding:10px 14px; font-size:0.85rem; display:none; }
.alert-error.show { display:block; }

/* ── Páginas de tabla / cards ────────────────────────────────────────── */
.page-header { display:flex; align-items:center; justify-content:space-between; }
.page-header h1 { font-size:1.4rem; font-weight:700; }
.search-bar { padding:8px 14px; border:1px solid #d1d5db; border-radius:8px; font-size:0.875rem; width:100%; max-width:360px; outline:none; font-family:inherit; }
.search-bar:focus { border-color:#b45309; box-shadow:0 0 0 3px rgba(180,83,9,.12); }

table { width:100%; border-collapse:collapse; font-size:0.875rem; }
thead th { text-align:left; padding:12px 16px; background:#fafaf9; color:#6b7280; font-weight:500; border-bottom:1px solid #e7e5e4; }
tbody tr { border-bottom:1px solid #f5f5f4; transition:background .1s; }
tbody tr:last-child { border-bottom:none; }
tbody tr:hover { background:#fafaf9; }
td { padding:12px 16px; color:#374151; vertical-align:middle; }
.td-actions { text-align:right; white-space:nowrap; display:flex; gap:8px; justify-content:flex-end; }
.link-edit   { font-size:0.8rem; cursor:pointer; color:#b45309; }
.link-delete { font-size:0.8rem; cursor:pointer; color:#dc2626; }
.link-edit:hover, .link-delete:hover { text-decoration:underline; }
.empty-row td { text-align:center; color:#a8a29e; padding:40px; }

.badge { display:inline-block; padding:2px 8px; border-radius:20px; font-size:0.72rem; font-weight:600; }
.badge-interior { background:#fef3c7; color:#92400e; }
.badge-terraza  { background:#dcfce7; color:#166534; }
.badge-privado  { background:#ede9fe; color:#5b21b6; }

/* ── Mesa badge en tabla ──────────────────────────────────────────────── */
.mesa-badge { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:8px; font-size:0.8rem; font-weight:700; background:#fef3c7; color:#92400e; }

/* ── Tabla responsive ─────────────────────────────────────────────────── */
.table-wrap { overflow: hidden; }

/* ── Responsive (móviles) ───────────────────────────────────────────── */
img { max-width: 100%; height: auto; display: block; }

@media (max-width: 767px) {
  /* Layout base */
  .layout { display: block; height: auto; overflow: visible; }

  /* Sidebar: barra compacta con toggle */
  .sidebar { width: 100%; flex-direction: column; padding: 0; }
  .sidebar-header { padding: 10px 14px; border-bottom: 1px solid #292524; }
  .sidebar-brand { padding: 0; border: none; }
  .sidebar-brand p { display: none; }
  .nav-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex-shrink: 0;
    background: #292524; border: none; border-radius: 8px;
    font-size: 1.3rem; cursor: pointer; color: #e7e5e4; line-height: 1;
  }
  .nav-toggle:hover { background: #3c3936; }
  .sidebar nav {
    display: none; flex-direction: column; gap: 2px;
    padding: 8px 12px; border-bottom: 1px solid #292524;
  }
  .sidebar nav.open { display: flex; }
  .sidebar-footer { display: none; }

  /* Área principal: scroll natural de página */
  .main { padding: 12px; overflow: visible; }
  .main-panels { display: flex; flex-direction: column; gap: 12px; flex: none; min-height: auto; }
  .lista-panel { width: 100%; order: 2; }
  .plano-panel { order: 1; }

  /* Date-bar: 2 filas — navegación/fecha arriba, hora+acción abajo */
  .date-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .hora-sel { order: 10; margin-left: 0; width: auto; }
  .hora-sel label { display: none; }
  .date-bar > button { order: 11; }

  /* Mesas más pequeñas */
  .mesa-card { width: 72px; height: 72px; }
  .mesa-num  { font-size: 1rem; }
  .mesa-cap, .mesa-info { font-size: 0.7rem; }

  /* Modal a pantalla casi completa */
  .modal-box { margin: 8px; max-width: calc(100% - 16px); width: auto; max-height: 92vh; }

  /* Formulario en columna */
  .form-row { grid-template-columns: 1fr; }

  /* Tabla */
  .search-bar { max-width: 100%; }
  .table-wrap { overflow-x: auto; }
  table td, thead th { padding: 10px; font-size: 0.82rem; }
}
