/* ========================================================================
   La Morada Tandil — theme.css
   Cubre: panel, login, inventario, reportes, valores, pagos.
   Layout inspirado en el panel viejo (HOTEL VIEJO / HOTEL NUEVO con divisor).
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta */
    --bg:           #f4f5f7;
    --bg-alt:       #ffffff;
    --surface:      #ffffff;
    --surface-2:    #f9fafb;
    --surface-3:    #eef0f4;
    --border:       #e3e6eb;
    --border-2:     #d4d8df;
    --text:         #111827;
    --text-muted:   #6b7280;
    --text-faint:   #9ca3af;
    --primary:      #2563eb;
    --primary-600:  #1d4ed8;
    --primary-50:   #eff6ff;
    --accent:       #7c3aed;

    /* Estados de habitación */
    --state-libre:        #16a34a;
    --state-libre-txt:    #ffffff;
    --state-limpieza:     #facc15;
    --state-limpieza-txt: #1f2937;
    --state-ocupada:      #dc2626;
    --state-ocupada-txt:  #ffffff;
    --state-terminada:    #2563eb;
    --state-terminada-txt:#ffffff;
    --state-reservada:    #7c3aed;
    --state-reservada-txt:#ffffff;

    /* Roles cromáticos */
    --ok:     #16a34a;
    --warn:   #f59e0b;
    --danger: #dc2626;
    --info:   #0ea5e9;

    /* Sombras / radios */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.10);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Espacios */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:         #0b0d12;
        --bg-alt:     #12151c;
        --surface:    #171a21;
        --surface-2:  #1f232c;
        --surface-3:  #2a2f3a;
        --border:     #2a2f3a;
        --border-2:   #3a4150;
        --text:       #f3f4f6;
        --text-muted: #9ca3af;
        --text-faint: #6b7280;
        --primary-50: #1e293b;
    }
}

/* =========================================================
   RESET / BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0 0 var(--space-3); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 var(--space-3); }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.92em;
}

.container { max-width: 1500px; margin: 0 auto; }

/* =========================================================
   PANEL — header + nav
   ========================================================= */
.panel-body {
    background: var(--bg);
    min-height: 100vh;
    padding-bottom: 80px; /* deja espacio para el botón flotante */
}

.panel-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}
.panel-header__inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 10px var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 16px;
    flex-shrink: 0;
}
.brand svg {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: 3px;
    width: 26px; height: 26px;
    flex-shrink: 0;
}

.panel-nav {
    display: flex; gap: 2px; align-items: center; flex-wrap: wrap;
    flex: 1;
}
.panel-nav a {
    padding: 6px 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-sm);
}
.panel-nav a:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}
.panel-nav a.active {
    background: var(--primary-50);
    color: var(--primary-600);
    font-weight: 600;
}

.panel-header__meta {
    display: flex; align-items: center; gap: var(--space-2);
    flex-wrap: wrap;
}
.clock {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    padding: 4px 10px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

/* Chips */
.chip {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    white-space: nowrap;
}
.chip--info  { background: #e0f2fe; border-color: #bae6fd; color: #075985; }
.chip--warn  { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.chip--ok    { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.chip--danger{ background: #fee2e2; border-color: #fecaca; color: #991b1b; font-weight: 700; }
.chip--ghost { background: transparent; }
@media (prefers-color-scheme: dark) {
    .chip--info  { background: #082f49; border-color: #075985; color: #bae6fd; }
    .chip--warn  { background: #422006; border-color: #92400e; color: #fed7aa; }
    .chip--ok    { background: #14532d; border-color: #166534; color: #bbf7d0; }
    .chip--danger{ background: #450a0a; border-color: #991b1b; color: #fecaca; }
}

/* ===== Card de alerta: habitaciones vencidas (reportes admin) ===== */
.card--alerta-vencidas {
    border-left: 4px solid var(--danger, #dc2626);
    background: linear-gradient(180deg, rgba(220,38,38,.04), transparent 60%);
}
.card--alerta-vencidas.is-ok {
    border-left-color: var(--ok, #16a34a);
    background: linear-gradient(180deg, rgba(22,163,74,.04), transparent 60%);
}
.table--vencidas .row-vencida {
    background: rgba(220,38,38,.06);
}
.table--vencidas .row-vencida td { border-bottom-color: rgba(220,38,38,.18); }
.table--vencidas .row-vencida:hover td { background: rgba(220,38,38,.10); }
.table--vencidas .t-vencido {
    color: var(--danger, #dc2626);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
    .card--alerta-vencidas { background: linear-gradient(180deg, rgba(220,38,38,.10), transparent 60%); }
    .card--alerta-vencidas.is-ok { background: linear-gradient(180deg, rgba(22,163,74,.10), transparent 60%); }
    .table--vencidas .row-vencida { background: rgba(220,38,38,.12); }
    .table--vencidas .row-vencida:hover td { background: rgba(220,38,38,.18); }
    .table--vencidas .t-vencido { color: #fca5a5; }
}

/* =========================================================
   PANEL — main + grilla de habitaciones (HOTEL VIEJO/NUEVO)
   ========================================================= */
.panel-main {
    max-width: 1500px;
    margin: 0 auto;
    padding: var(--space-4);
}
.panel-grid {
    /* Mantenido por compatibilidad — ahora usamos panel-stack */
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    align-items: start;
}

/* Layout vertical: habitaciones full-width arriba, cards 3-col abajo */
.panel-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.panel-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
    align-items: start;
}
/* Orden deseado: Minibar (izq) — Mensajes (medio) — Caja (der) */
.panel-bottom .card--minibar  { order: 1; }
.panel-bottom .card--mensajes { order: 2; }
.panel-bottom .card--caja     { order: 3; }
@media (max-width: 1100px) {
    .panel-bottom { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
    .panel-bottom { grid-template-columns: 1fr; }
}

/* Subtítulo en card head */
.card__subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Botón minimizar (toggle) en card head */
.card__toggle {
    width: 28px; height: 28px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s, transform .12s;
}
.card__toggle:hover { background: var(--surface-2); }
.card__toggle:active { transform: scale(.92); }

/* Body colapsable */
.card--collapsible .card__body {
    transition: max-height .25s ease, opacity .2s ease, margin-top .2s ease;
}
.card--collapsible.is-collapsed .card__body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: -8px;
    pointer-events: none;
}
.card--collapsible.is-collapsed .card__head {
    margin-bottom: 0;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-4);
}
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}
.card__head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}
.card__actions {
    display: flex; gap: 6px; flex-wrap: wrap;
}

/* Grilla de habitaciones */
.rooms-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: var(--space-3);
}

.rooms-row {
    display: grid;
    grid-template-columns: repeat(20, minmax(0, 1fr));
    gap: 10px;
    /* Marca visual del divisor entre HOTEL VIEJO y HOTEL NUEVO */
    position: relative;
}

/* Etiquetas HOTEL VIEJO / HOTEL NUEVO.
   Pintamos cada etiqueta como una "pill" oscura/clara según tema, para que
   se lean fuerte sin importar el fondo. */
.rooms-labels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 6px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    gap: 12px;
}
.rooms-labels span {
    text-align: center;
    padding: 6px 12px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    justify-self: center;
    min-width: 140px;
}

/* Divisor vertical entre HOTEL VIEJO y HOTEL NUEVO.
   El color se adapta al tema: oscuro en claro, claro en oscuro.
   Así siempre contrasta contra el fondo del card. */
.rooms-row::before {
    content: '';
    position: absolute;
    top: -32px;
    bottom: -12px;
    left: calc(50% - 1.5px);
    width: 3px;
    background: var(--text);
    border-radius: 2px;
    opacity: .55;
    pointer-events: none;
    z-index: 1;
}
@media (prefers-color-scheme: dark) {
    .rooms-row::before {
        background: #ffffff;
        opacity: .85;
        box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 0 8px rgba(255,255,255,.35);
    }
}

.rooms-spacer { display: none; }

/* Wrapper de cada celda (botón + tipo abajo) */
.room-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: relative;
    z-index: 1;
}

/* SUPER VIP: solo más grandes, sin border dorado ni estrella.
   Crecen únicamente hacia el exterior con transform: scale() y origin por fila.
   El layout box queda igual al de las regulares, así no hay desfase de
   alineación posible — sólo el dibujo visual queda más grande. */
.room-wrap--super-vip {
    z-index: 3;
    position: relative;
}
.room-wrap--super-vip .room-card {
    aspect-ratio: 1 / 1.05;          /* idéntico al resto: alinea el layout */
    transform: scale(1.18);
}

/* Fila superior (40..21): crece hacia ARRIBA — bottom alineado */
.rooms-row[data-row="top"] .room-wrap--super-vip .room-card {
    transform-origin: bottom center;
}

/* Fila inferior (1..20): crece hacia ABAJO — top alineado */
.rooms-row[data-row="bottom"] .room-wrap--super-vip .room-card {
    transform-origin: top center;
}

/* La parte de la card escalada que se proyecta hacia abajo en la fila
   inferior tapa al `.room-kind` siguiente (el nombre). Como
   transform-origin: top center y scale(1.18), la card crece hacia abajo:
   altura final = 1.05 × 1.18 = 1.239 (× ancho), o sea proyecta
   (1.239 − 1.05) = ~19% del ancho de la card más allá del bottom original.
   Margen del 22% deja respiro para el nombre. */
.rooms-row[data-row="bottom"] .room-wrap--super-vip .room-kind {
    margin-top: 22%;
}

.room-wrap--super-vip .room-card .room-num {
    font-size: clamp(20px, 2.7vw, 30px);
}
.room-kind {
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

/* Tarjeta de habitación */
.room-card {
    position: relative;
    aspect-ratio: 1 / 1.05;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 3px;
    background: var(--state-libre);
    color: var(--state-libre-txt);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    font-weight: 700;
    transition: filter .15s, box-shadow .15s, transform .08s,
                background-color .3s ease, color .3s ease;
    overflow: hidden;
    line-height: 1.1;
}
.room-card:hover { filter: brightness(1.07); box-shadow: var(--shadow-md); }
.room-card:active { transform: scale(0.97); }
.room-card.is-selected,
.room-card[aria-pressed="true"] {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(37,99,235,.7);
}
@media (prefers-color-scheme: dark) {
    .room-card.is-selected,
    .room-card[aria-pressed="true"] { border-color: #ffffff; }
}

/* Estados — colores */
.room-card[data-estado="libre"]      { background: var(--state-libre);      color: var(--state-libre-txt); }
.room-card[data-estado="limpieza"]   { background: var(--state-limpieza);   color: var(--state-limpieza-txt); }
.room-card[data-estado="ocupada"]    { background: var(--state-ocupada);    color: var(--state-ocupada-txt); }
.room-card[data-estado="terminada"]  { background: var(--state-terminada);  color: var(--state-terminada-txt); }
.room-card[data-estado="reservada"]  { background: var(--state-reservada);  color: var(--state-reservada-txt); }

/* Vencida automática: ocupada/reservada cuyo timer llegó a 0.
   Visualmente igual que 'terminada' (azul) + leve pulso para llamar la atención.
   El timer sigue corriendo en negativo: lo manejamos aparte para que se vea bien. */
.room-card.is-vencida {
    background: var(--state-terminada) !important;
    color: var(--state-terminada-txt) !important;
    animation: vencida-pulse 2.4s ease-in-out infinite;
}
.room-card.is-vencida .timer {
    opacity: 1;
    font-weight: 800;
    background: rgba(0,0,0,.18);
    border-radius: 6px;
    padding: 0 6px;
}
@keyframes vencida-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,.55); }
    50%      { box-shadow: 0 0 0 6px rgba(37,99,235,0); }
}
@media (prefers-reduced-motion: reduce) {
    .room-card.is-vencida { animation: none; }
}

/* Por terminar: ocupada/reservada con 15 min o menos hasta fin de turno.
   Titila azul ↔ rojo para que se vea fuerte y sepamos que se viene el final.
   Sigue así hasta que el bloque se termine manualmente o se agregue otro
   turno (al renovar restante vuelve a subir y la clase se quita sola).
   Va antes que .is-vencida en specificity, así cuando entra a vencida
   (timer=0) toma la animación azul calma. */
.room-card.is-por-terminar {
    animation: por-terminar-flash 1s steps(1, end) infinite;
}
.room-card.is-por-terminar .timer {
    font-weight: 800;
    background: rgba(0,0,0,.20);
    border-radius: 6px;
    padding: 0 6px;
}
@keyframes por-terminar-flash {
    0%, 49% {
        background: #dc2626;
        color: #ffffff;
        box-shadow: 0 0 0 2px #dc2626, 0 0 12px rgba(220,38,38,.55);
    }
    50%, 100% {
        background: #2563eb;
        color: #ffffff;
        box-shadow: 0 0 0 2px #2563eb, 0 0 12px rgba(37,99,235,.55);
    }
}
/* Si entra a vencida (timer <=0), is-vencida domina y vuelve al azul calmo. */
.room-card.is-vencida.is-por-terminar { animation: vencida-pulse 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .room-card.is-por-terminar {
        animation: none;
        background: #dc2626 !important;
        color: #ffffff !important;
        box-shadow: 0 0 0 2px #dc2626;
    }
}

/* Modal: error de clave admin en borrar movimiento */
.modal-borrar-error {
    color: #dc2626;
    font-weight: 700;
    margin: 0;
}

.room-card .state-line {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: .95;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    padding: 0 2px;
}
.room-card .timer {
    font-size: 11px;
    font-weight: 600;
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
    opacity: .95;
    min-height: 13px;
}
.room-card .room-num {
    font-size: clamp(18px, 2.4vw, 26px);
    font-weight: 800;
    margin-top: 1px;
}
.room-card .room-code {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 9px;
    font-weight: 700;
    opacity: .9;
}

.help {
    margin-top: var(--space-3);
    color: var(--text-muted);
    font-size: 13px;
}
.help--inline { margin: 0 0 0 var(--space-3); display: inline; }

/* =========================================================
   PANEL LATERAL (caja + minibar + mensajes)
   ========================================================= */
.panel-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.panel-side .card { padding: var(--space-3); }

/* Caja */
.card--caja {}
.caja-total {
    display: flex; flex-direction: column; align-items: center;
    margin: var(--space-2) 0 var(--space-1);
    padding: var(--space-3);
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    border-radius: var(--radius-md);
}
.caja-total__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: .9;
}
.caja-total__value {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.caja-total__value::before { content: '$'; opacity: .85; margin-right: 2px; }

.caja-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: var(--space-2);
}

.mov-list {
    list-style: none;
    margin: 0; padding: 0;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.mov-list__item {
    display: grid;
    grid-template-columns: 50px 1fr auto auto 30px;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    background: rgba(220,38,38,.08);          /* No cobrado → rojo suave */
    border-left: 3px solid var(--danger, #dc2626);
    transition: background .12s ease, border-left-color .12s ease;
}
.mov-list__item:hover { background: rgba(220,38,38,.16); }
.mov-list__item.is-cobrado {
    background: rgba(22,163,74,.10);          /* Cobrado → verde suave */
    border-left-color: var(--ok, #16a34a);
}
.mov-list__item.is-cobrado:hover { background: rgba(22,163,74,.18); }
.mov-list__item:last-child { border-bottom: none; }
.mov-hora   { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mov-label  { font-weight: 600; }
.mov-monto  { font-variant-numeric: tabular-nums; font-weight: 700; }
.mov-monto::before { content: '$'; opacity: .65; margin-right: 1px; }
.mov-estado {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--danger, #dc2626);
    color: #fff;
    white-space: nowrap;
}
.mov-list__item.is-cobrado .mov-estado {
    background: var(--ok, #16a34a);
}
.mov-borrar {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    line-height: 1;
    color: var(--text-muted);
    border-radius: 6px;
    transition: background .12s ease, color .12s ease;
}
.mov-borrar:hover {
    background: var(--danger, #dc2626);
    color: #fff;
}
@media (max-width: 480px) {
    .mov-list__item {
        grid-template-columns: 1fr auto 30px;
        grid-template-areas:
            "hora monto borrar"
            "label estado estado";
        row-gap: 4px;
    }
    .mov-hora   { grid-area: hora; }
    .mov-label  { grid-area: label; }
    .mov-monto  { grid-area: monto; text-align: right; }
    .mov-estado { grid-area: estado; justify-self: end; }
    .mov-borrar { grid-area: borrar; }
}

/* Compat: por si quedan estilos viejos referenciando mov-cobrado */
.mov-cobrado { display: none; }

/* Minibar */
.card--minibar {}
.minibar-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}
.minibar-item {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--space-2);
    padding: 6px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.minibar-item__info {
    display: flex; flex-direction: column;
    min-width: 0;
}
.minibar-name {
    font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.minibar-stock {
    font-size: 11px;
    color: var(--text-muted);
}
.minibar-item__actions {
    display: flex; align-items: center; gap: 6px;
    flex-shrink: 0;
}
.minibar-price {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

/* Mensajes */
.card--mensajes {}
.mensaje-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}
.mensaje-item {
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
}
.mensaje-meta {
    display: flex; justify-content: space-between;
    font-size: 12px;
    margin-bottom: 2px;
}
.mensaje-meta strong { color: var(--text); }
.mensaje-hora { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mensaje-texto {
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--text);
}
.mensaje-actions {
    display: flex; gap: 4px;
}
.mensaje-empty {
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    padding: var(--space-3);
}

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    transition: background .15s, border-color .15s, transform .05s, filter .15s;
    text-decoration: none;
    line-height: 1.2;
    font-size: 14px;
}
.btn:hover  { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn--ok      { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn--ok:hover{ filter: brightness(.93); }
.btn--danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { filter: brightness(.93); }
.btn--ghost   { background: transparent; }

.btn--xs { padding: 3px 8px; font-size: 12px; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn--xl { padding: 12px 22px; font-size: 16px; }
.btn--block { width: 100%; }

/* Stock control en /inventario */
.stock-ctl {
    display: inline-flex; align-items: center; gap: 4px;
}
.stock-n {
    min-width: 28px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   INPUTS / FORMS
   ========================================================= */
.input, .select, .textarea {
    width: 100%;
    padding: 7px 10px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
    font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.input--sm    { padding: 4px 8px; font-size: 13px; }
.input--area  { min-height: 90px; resize: vertical; }
.input--precio { max-width: 120px; }

.field { margin-bottom: var(--space-3); display: block; }
.field > span,
.field > label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

.row-actions {
    display: flex; align-items: center; gap: var(--space-3);
    margin-top: var(--space-3);
    flex-wrap: wrap;
}

/* =========================================================
   TABLAS
   ========================================================= */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table th, .table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}
.table th {
    background: var(--surface-2);
    font-weight: 700;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.t-right { text-align: right !important; }

.table--precios input { text-align: right; }

/* =========================================================
   MODALES (dialog)
   ========================================================= */
.modal {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: calc(100% - 32px);
}
.modal::backdrop {
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
}
.modal__form {
    padding: var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-2);
}
.modal__form h3 { margin-bottom: var(--space-2); }
.modal__actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: var(--space-3);
}

/* =========================================================
   PÁGINAS DEDICADAS
   ========================================================= */

/* Inventario CRUD */
.page-inventario .panel-main {
    max-width: 1100px;
}
.page-inventario .table th,
.page-inventario .table td { padding: 6px 8px; }

/* Login */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-alt) 100%);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    padding: var(--space-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: var(--space-2);
}
.auth-card .sub {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
    font-size: 13px;
}

/* Pagos / pagos online (preserva si existe) */
.pay-wrap { max-width: 720px; margin: 0 auto; padding: var(--space-4); }
.pay-tabs {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: var(--space-4);
    overflow-x: auto;
    gap: 2px;
}
.pay-tabs button {
    flex: 1;
    min-width: 120px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: background .15s;
    white-space: nowrap;
    cursor: pointer;
}
.pay-tabs button.is-active {
    background: var(--primary);
    color: #fff;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
/* Tablet ancha → mantiene 20 columnas */
@media (max-width: 1450px) {
    .panel-main { padding: var(--space-3); }
    .rooms-row { gap: 8px; }
}

/* Tablet (10 cols × 4 filas → desactivamos divisor lateral) */
@media (max-width: 1100px) {
    .rooms-row {
        grid-template-columns: repeat(10, minmax(0, 1fr));
        column-gap: 10px;
        row-gap: 18px;            /* separación vertical entre filas */
    }
    .rooms-row::before { display: none; }
    .rooms-labels { display: none; }
    .rooms-wrap { gap: 22px; }    /* separación entre HOTEL VIEJO y NUEVO */
}

@media (max-width: 800px) {
    .rooms-row {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        column-gap: 12px;
        row-gap: 22px;
    }
    .panel-header__inner { gap: var(--space-2); }
    .panel-nav a { padding: 5px 8px; font-size: 13px; }
    .rooms-wrap { gap: 26px; }
}

@media (max-width: 600px) {
    body { font-size: 14px; }
    .rooms-row {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        column-gap: 12px;
        row-gap: 26px;            /* mucho más espacio vertical para que no se superpongan */
    }
    .rooms-wrap { gap: 30px; }
    .panel-main { padding: var(--space-2); }
    .room-card .room-num { font-size: 16px; }
    .room-card .timer { font-size: 10px; }
    .room-card .state-line { font-size: 9px; }
    .room-kind {
        font-size: 9px;            /* la etiqueta del tipo más compacta en mobile */
        padding: 0 2px;
    }
}

@media (max-width: 380px) {
    .rooms-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        column-gap: 14px;
        row-gap: 30px;
    }
    .rooms-wrap { gap: 34px; }
}

/* =========================================================
   UTILIDADES
   ========================================================= */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.hidden { display: none !important; }

/* Spinner */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Focus accesible */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* =========================================================
   HAMBURGER MENU (mobile)
   ========================================================= */
.btn-hamburger {
    display: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}
.btn-hamburger:active { background: var(--border); }

@media (max-width: 800px) {
    .btn-hamburger { display: inline-flex; align-items: center; justify-content: center; }

    /* Por defecto el menú está oculto en mobile */
    .panel-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        padding: var(--space-2) var(--space-3);
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        z-index: 60;
    }
    .panel-nav.is-open {
        display: flex;
    }
    .panel-nav a {
        padding: 12px 14px;
        font-size: 15px;
        border-radius: var(--radius-sm);
    }
    .panel-header {
        position: relative;
    }
    .panel-header__inner {
        flex-wrap: nowrap;
    }
    .panel-header__meta {
        margin-left: auto;
    }
    /* En mobile el reloj ocupa menos */
    .clock { font-size: 13px; padding: 3px 7px; }
    .chip  { font-size: 11px; padding: 2px 7px; }
}

/* =========================================================
   MODAL DE CONFIRMACIÓN GENÉRICO
   ========================================================= */
.modal-confirm__msg {
    font-size: 16px;
    line-height: 1.5;
    margin: 0 0 var(--space-3);
    color: var(--text);
}
.modal-confirm__detail {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 var(--space-3);
}
.btn--xl {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    min-height: 48px;
}
.btn--block {
    width: 100%;
    display: block;
}
/* Botones de acción dentro del modal-hab: pila vertical, grandes (touch) */
.modal-hab__acciones {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: var(--space-3) 0;
}
.modal-hab__acciones .btn {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
    font-weight: 600;
}
.modal-hab__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.modal-hab__info {
    margin: 0 0 var(--space-2);
    font-size: 14px;
    color: var(--text-muted);
}

/* =========================================================
   MODAL: ACCIONES DE HABITACIÓN
   ========================================================= */
.modal--hab {
    width: min(440px, 92vw);
    border: 0;
    border-radius: 16px;
    padding: 0;
    background: transparent;
}
.modal--hab::backdrop {
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
}
.modal--hab .modal__form {
    background: var(--surface);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-hab__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.modal-hab__head h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.modal-hab__info {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}
.modal-hab__acciones {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}
.modal-hab__acciones .btn {
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    min-height: 50px;
    border-radius: 12px;
    justify-content: center;
}

/* Chips para tipo de habitación */
.chip--vip {
    background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    color: #5b21b6;
    border-color: #a78bfa;
    font-weight: 700;
}
.chip--super-vip {
    background: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
    color: #92400e;
    border-color: #f59e0b;
    font-weight: 800;
}
.chip--super-vip::before { content: '★ '; }

/* =========================================================
   PÁGINA DE PAGOS (pagos.php) — MOBILE-FIRST
   ========================================================= */
.page-pagos {
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Header con gradiente y "wave" inferior */
.simple-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    padding: 32px 16px 44px;
    text-align: center;
    position: relative;
    margin-bottom: -24px;
}
.simple-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 28px;
    background: var(--bg);
    border-radius: 28px 28px 0 0;
}
.simple-header .container {
    position: relative;
    z-index: 1;
    text-align: center;
}
.brand-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}
.brand-sub {
    margin: 6px 0 0;
    color: rgba(255,255,255,.88);
    font-size: 13px;
    font-weight: 500;
}

/* Container central angosto */
.container--narrow {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 16px 32px;
    position: relative;
    z-index: 2;
}

/* Tabs tipo "segmented control" — scrollables en mobile */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1 0 auto;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background .18s, color .18s, transform .12s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--text); }
.tab:active { transform: scale(.97); }
.tab.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37,99,235,.28);
}

/* Tab panes con fade */
.tab-pane { display: none; }
.tab-pane.is-active {
    display: block;
    animation: fadeIn .25s cubic-bezier(.4,0,.2,1);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* Cards refinadas dentro de pagos */
.page-pagos .card {
    border-radius: 16px;
    box-shadow: 0 2px 14px rgba(0,0,0,.05);
    border: 1px solid var(--border);
    padding: 20px;
}
.page-pagos .card h2 {
    font-size: 1.05rem;
    margin: 0 0 6px;
    font-weight: 700;
}
.page-pagos .help {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 18px;
    line-height: 1.5;
}

/* Inputs grandes y cómodos para tocar */
.page-pagos .input,
.page-pagos .select {
    padding: 12px 14px;
    font-size: 15px;
    border-radius: 10px;
    min-height: 46px;
}
.page-pagos .field { margin-bottom: 14px; }
.page-pagos .field > span,
.page-pagos .field > label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    display: block;
}
.page-pagos .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Precio grande: tarjeta sólida moderna (sin gradiente) */
.big-price {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    margin: 18px 0;
    padding: 16px 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.big-price::before {
    content: 'TOTAL';
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ====== Servicio a habitación: lista de productos ====== */
.svc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 14px 0 6px;
    /* Permite scroll cuando hay muchos productos */
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.svc-list::-webkit-scrollbar { width: 6px; }
.svc-list::-webkit-scrollbar-track { background: transparent; }
.svc-list::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 3px;
}

.svc-item {
    display: grid;
    grid-template-columns: 1fr auto 80px;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.svc-item.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.svc-item__info { min-width: 0; }
.svc-item__nombre {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.svc-item__precio {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

.svc-item__qty {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px;
    gap: 0;
}
.svc-item__qty .qty-input {
    /* Override del .input { width:100% } global */
    width: 44px !important;
    padding: 4px 2px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    background: transparent;
    border: none;
    color: var(--text);
    -moz-appearance: textfield;
}
.svc-item__qty .qty-input:focus {
    outline: none;
    box-shadow: none;
}
.svc-item__qty .qty-input::-webkit-outer-spin-button,
.svc-item__qty .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.btn-qty {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background .12s ease, color .12s ease;
    padding: 0;
}
.btn-qty:hover {
    background: var(--primary);
    color: #fff;
}
.btn-qty:active { transform: scale(.92); }

.svc-item__sub {
    text-align: right;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.svc-item:not(.is-active) .svc-item__sub {
    color: var(--text-faint);
    font-weight: 600;
}

@media (max-width: 420px) {
    .svc-item {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "info  qty"
            "info  sub";
        row-gap: 2px;
        column-gap: 10px;
        padding: 8px 12px;
    }
    .svc-item__info { grid-area: info; }
    .svc-item__qty  { grid-area: qty;  justify-self: end; }
    .svc-item__sub  { grid-area: sub;  justify-self: end; font-size: 13px; }
}

/* Botones de pago grandes (≥48px) */
.page-pagos .btn--block {
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    min-height: 48px;
    box-shadow: 0 4px 14px rgba(37,99,235,.18);
}
.page-pagos .btn--block:hover { box-shadow: 0 6px 18px rgba(37,99,235,.24); }

/* Estado loading en botones */
.btn.is-loading {
    pointer-events: none;
    opacity: .85;
    position: relative;
    color: transparent !important;
}
.btn.is-loading::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 18px; height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* Mensaje inline (info/error/loading) */
.help--inline {
    display: block;
    margin: 12px 0 0;
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    color: var(--text-muted);
    line-height: 1.4;
}
.help--inline.is-error {
    color: var(--danger);
    background: #fef2f2;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 500;
    border: 1px solid #fee2e2;
}
.help--inline.is-loading {
    color: var(--primary);
    font-weight: 600;
}

/* Resumen con definition-list */
.summary {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}
.dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
    margin: 0 0 14px;
}
.dl dt {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: center;
}
.dl dd {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    align-self: center;
}

/* =========================================================
   PÁGINA DE RETORNO MP (mp-retorno.php)
   ========================================================= */
.page-retorno {
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    padding: 24px 16px;
}
.page-retorno .container--narrow { width: 100%; padding: 0; }

.card--centered {
    text-align: center;
    padding: 36px 24px;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,.06);
}
.card--centered::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    background: var(--ok);
    color: #fff;
    border-radius: 50%;
    font-size: 32px;
    font-weight: 800;
    box-shadow: 0 6px 20px rgba(22,163,74,.25);
}
.page-retorno.is-error .card--centered::before {
    content: '!';
    background: var(--danger);
    box-shadow: 0 6px 20px rgba(220,38,38,.25);
}
.heading {
    font-size: 1.4rem;
    margin: 0 0 8px;
    color: var(--text);
    font-weight: 800;
}
.big-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 1.25rem;
    background: var(--primary-50);
    color: var(--primary-600);
    padding: 14px 18px;
    border-radius: 12px;
    margin: 18px 0;
    letter-spacing: 0.08em;
    border: 1px dashed var(--primary);
    word-break: break-all;
}
.big-code strong { font-weight: 800; }

/* ==== Bloque de código de reserva (página de éxito) ==== */
.codigo-aviso {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    padding: 14px 18px;
    border-radius: 12px;
    margin: 22px 0 18px;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}
.codigo-aviso strong {
    color: #9a3412;
    font-weight: 800;
}
@media (prefers-color-scheme: dark) {
    .codigo-aviso {
        background: #2a1a0a;
        border-color: #b45309;
        color: #fdba74;
    }
    .codigo-aviso strong { color: #fed7aa; }
}

.codigo-box {
    background: var(--surface-2);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 22px 18px 18px;
    margin: 18px 0 14px;
    box-shadow: 0 8px 28px rgba(37,99,235,.15);
    text-align: center;
}
.codigo-box--mini {
    border-width: 1px;
    box-shadow: none;
    padding: 16px 14px 14px;
}
.codigo-box__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.codigo-box__valor {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.12em;
    line-height: 1.05;
    margin-bottom: 14px;
    word-break: break-all;
    user-select: all;
    -webkit-user-select: all;
    cursor: copy;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background .15s ease;
}
.codigo-box__valor:hover {
    background: rgba(37,99,235,.08);
}
.codigo-box--mini .codigo-box__valor {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.btn--copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
    min-height: 40px;
}
.btn--copy:hover {
    background: var(--primary-600);
    text-decoration: none;
}
.btn--copy:active { transform: scale(.97); }
.btn--copy.is-ok {
    background: var(--ok, #16a34a);
}
.btn--copy.is-ok::before {
    content: '✓ ';
}
.btn--copy.is-ok .btn--copy__icon { display: none; }
.btn--copy__icon {
    font-size: 16px;
    line-height: 1;
}

.codigo-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin: 6px 0 18px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: 10px;
    line-height: 1.5;
}
.help--meta {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 12px;
}
.actions-row {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.actions-row .btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 12px;
    min-height: 48px;
}

/* Tablet+ */
@media (min-width: 600px) {
    .simple-header { padding: 40px 16px 52px; }
    .brand-title { font-size: 1.85rem; }
    .brand-sub  { font-size: 14px; }
    .container--narrow { padding: 0 24px 48px; }
    .page-pagos .card { padding: 26px; }
    .big-price { font-size: 3rem; padding: 26px 16px 22px; }
    .actions-row { flex-direction: row; justify-content: center; }
    .actions-row .btn { width: auto; min-width: 220px; }
    .heading { font-size: 1.6rem; }
    .big-code { font-size: 1.4rem; }
}

/* iOS: respetar safe area en bottom */
@supports (padding: max(0px)) {
    .container--narrow {
        padding-bottom: max(32px, env(safe-area-inset-bottom));
    }
}

/* =====================================================================
   PÁGINA VOZ (asistente de recepción) — Fase 1
   ===================================================================== */
.voz-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.help--small { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

/* --- Switch grande ON/OFF --- */
.voz-switch {
    margin: 8px 0 16px;
}
.voz-switch__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.voz-switch__inner:hover { background: var(--surface-3); }
.voz-switch__inner input {
    /* Ocultamos el checkbox real, lo reemplaza el track */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.voz-switch__track {
    position: relative;
    flex: 0 0 56px;
    width: 56px;
    height: 32px;
    background: var(--border-2);
    border-radius: 999px;
    transition: background .2s ease;
}
.voz-switch__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    background: #fff;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    transition: transform .22s cubic-bezier(.4,.0,.2,1);
}
.voz-switch__inner input:checked ~ .voz-switch__track {
    background: var(--ok, #16a34a);
}
.voz-switch__inner input:checked ~ .voz-switch__track::after {
    transform: translateX(24px);
}
.voz-switch__label {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.voz-switch__label strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}
.voz-switch__label small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Estación --- */
.voz-estacion__acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 8px;
}
.btn--danger {
    background: var(--danger, #dc2626);
    color: #fff;
    border-color: var(--danger, #dc2626);
}
.btn--danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

/* --- Live transcript --- */
.voz-mic { margin: 0 0 12px; }
.voz-live {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px dashed var(--border-2);
    border-radius: 12px;
    min-height: 70px;
}
.voz-live__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}
.voz-live__text {
    font-size: 16px;
    color: var(--text);
    line-height: 1.4;
    word-break: break-word;
    min-height: 1.4em;
}

/* --- Lista de eventos --- */
.voz-eventos-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 540px;
    overflow-y: auto;
}
.voz-evento {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-faint);
    border-radius: 10px;
    padding: 10px 14px;
}
.voz-evento[data-decision="venta"]     { border-left-color: var(--ok, #16a34a); }
.voz-evento[data-decision="consulta"]  { border-left-color: var(--primary); }
.voz-evento[data-decision="reserva"]   { border-left-color: #f59e0b; }
.voz-evento[data-decision="nada"]      { border-left-color: var(--text-faint); opacity: .75; }
.voz-evento__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.voz-evento__hora {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.voz-evento__texto {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}
.voz-evento--empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    list-style: none;
    background: var(--surface-2);
    border-radius: 10px;
}

/* --- Chip warn extra (modo oscuro ya lo cubre) --- */
.chip--warn { background: #fef3c7; border-color: #fde68a; color: #92400e; }

/* =====================================================================
   Badge de mensajes sin leer (card de Mensajes en el panel)
   ===================================================================== */
.msg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    margin-left: 8px;
    background: var(--danger, #dc2626);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
    box-shadow: 0 0 0 0 rgba(220,38,38,.6);
    transition: transform .15s ease;
}
.msg-badge[hidden] { display: none; }

/* "Ping" cuando entra un mensaje nuevo: agranda y emite onda. */
@keyframes msg-badge-ping {
    0%   { transform: scale(1);    box-shadow: 0 0 0 0   rgba(220,38,38,.6); }
    40%  { transform: scale(1.35); box-shadow: 0 0 0 10px rgba(220,38,38,0); }
    100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(220,38,38,0); }
}
.msg-badge--ping { animation: msg-badge-ping 1.1s ease-out 2; }

/* Halo del card de mensajes cuando llega uno nuevo */
@keyframes mensajes-card-pulse {
    0%, 100% { box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.08)); }
    50%      { box-shadow: 0 0 0 3px rgba(220,38,38,.35); }
}
.card--mensajes-ping { animation: mensajes-card-pulse 1.1s ease-out 2; }

@media (prefers-reduced-motion: reduce) {
    .msg-badge--ping,
    .card--mensajes-ping { animation: none; }
}

/* --- Bloque "Permiso denegado" --- */
.voz-bloqueado {
    margin-top: 14px;
    padding: 14px 18px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 12px;
    color: #92400e;
}
.voz-bloqueado h3 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
}
.voz-bloqueado p { margin: 4px 0; }
.voz-bloqueado ol {
    margin: 8px 0 12px;
    padding-left: 22px;
    line-height: 1.55;
}
.voz-bloqueado .btn { margin-top: 6px; }
.voz-live--error .voz-live__text {
    color: var(--danger, #dc2626);
    font-weight: 600;
}

/* --- Diagnóstico técnico --- */
.voz-diag-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}
.voz-diag-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.35;
}
.voz-diag-row span  { color: var(--text-muted); }
.voz-diag-row strong { text-align: right; word-break: break-word; }
.voz-diag-row--ok  { border-color: var(--ok, #16a34a); }
.voz-diag-row--ok strong { color: var(--ok, #16a34a); }
.voz-diag-row--err { border-color: var(--danger, #dc2626); background: rgba(220,38,38,.06); }
.voz-diag-row--err strong { color: var(--danger, #dc2626); }
@media (max-width: 480px) {
    .voz-diag-row { flex-direction: column; gap: 2px; }
    .voz-diag-row strong { text-align: left; }
}
@media (prefers-color-scheme: dark) {
    .voz-bloqueado {
        background: #422006;
        border-color: #92400e;
        color: #fed7aa;
    }
    .voz-bloqueado h3 { color: #fed7aa; }
}
