/* Gestor de reservas — estilos mobile first, sin frameworks.
   Tema claro por defecto; oscuro según el sistema o el botón de la cabecera (data-theme). */

/* Fuentes autoalojadas (la CSP no permite orígenes externos). */
@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/fraunces-latin-wght.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-wght.woff2") format("woff2");
}

/* Tokens del sistema de diseño MisterPlan (Figma: colecciones Color, Spacing y Radius).
   La paleta base se oscureció donde no llegaba a WCAG AA: el terracota de la marca
   (#c4572e) queda para usos decorativos y los botones usan #a9461f. */
:root {
    --bg: #fbf6ef;
    --surface: #ffffff;
    --surface-2: #f3ebdf;
    --surface-hover: #f8f1e7;
    --text: #2b2118;
    --text-2: #3d3026;
    --muted: #7a6a5c;
    --border: #e7dccd;
    --border-strong: #9a8775;

    --brand: #c4572e;
    --primary: #a9461f;
    --primary-hover: #8e3a19;
    --primary-pressed: #76301a;
    --primary-soft: #f8e9e1;
    --primary-text: #a9461f;
    --on-primary: #ffffff;
    --disabled: #e7dccd;
    --on-disabled: #7a6a5c;

    --secondary: #2a7f7a;
    --secondary-strong: #226660;
    --secondary-soft: #e4f1ef;
    --secondary-soft-2: #cde5e2;
    --on-secondary: #ffffff;
    --ring: rgba(42, 127, 122, 0.4);

    --success: #4d7530;
    --success-solid: #4d7530;
    --success-soft: #eaf1e2;
    --warning: #7a4e0e;
    --warning-solid: #e9a23b;
    --on-warning: #2b2118;
    --warning-soft: #fcf1de;
    --danger: #b3261e;
    --danger-solid: #b3261e;
    --danger-soft: #fbeae8;
    --neutral-soft: #f3ebdf;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --radius-sm: 8px;
    --radius: 8px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(43, 33, 24, 0.06);
    --shadow: 0 1px 2px rgba(43, 33, 24, 0.05), 0 4px 14px -6px rgba(43, 33, 24, 0.12);
    --shadow-lg: 0 24px 48px -12px rgba(43, 33, 24, 0.3);
    --backdrop: rgba(43, 33, 24, 0.48);

    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");

    color-scheme: light;
}

/* Tema oscuro (no está en Figma): misma paleta cálida sobre fondos tostados, con los
   colores de acción aclarados para mantener el contraste AA. Se repite para el modo
   del sistema y para la elección explícita. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1c1611;
        --surface: #261e18;
        --surface-2: #2f261f;
        --surface-hover: #2c231c;
        --text: #f3ebdf;
        --text-2: #e2d6c6;
        --muted: #b3a595;
        --border: #3b2f26;
        --border-strong: #7a6a5c;
        --brand: #e0835a;
        --primary: #e0835a;
        --primary-hover: #e99872;
        --primary-pressed: #f0ad8c;
        --primary-soft: rgba(224, 131, 90, 0.16);
        --primary-text: #f0a27f;
        --on-primary: #2b2118;
        --disabled: #3b2f26;
        --on-disabled: #b3a595;
        --secondary: #6cc1b9;
        --secondary-strong: #8ad1ca;
        --secondary-soft: rgba(108, 193, 185, 0.14);
        --secondary-soft-2: rgba(108, 193, 185, 0.24);
        --on-secondary: #2b2118;
        --ring: rgba(108, 193, 185, 0.5);
        --success: #9ccb7a;
        --success-soft: rgba(94, 140, 58, 0.2);
        --warning: #f2be6e;
        --warning-soft: rgba(233, 162, 59, 0.16);
        --danger: #ff9a8f;
        --danger-soft: rgba(179, 38, 30, 0.22);
        --neutral-soft: rgba(243, 235, 223, 0.08);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, 0.7);
        --backdrop: rgba(10, 7, 5, 0.7);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #1c1611;
    --surface: #261e18;
    --surface-2: #2f261f;
    --surface-hover: #2c231c;
    --text: #f3ebdf;
    --text-2: #e2d6c6;
    --muted: #b3a595;
    --border: #3b2f26;
    --border-strong: #7a6a5c;
    --brand: #e0835a;
    --primary: #e0835a;
    --primary-hover: #e99872;
    --primary-pressed: #f0ad8c;
    --primary-soft: rgba(224, 131, 90, 0.16);
    --primary-text: #f0a27f;
    --on-primary: #2b2118;
    --disabled: #3b2f26;
    --on-disabled: #b3a595;
    --secondary: #6cc1b9;
    --secondary-strong: #8ad1ca;
    --secondary-soft: rgba(108, 193, 185, 0.14);
    --secondary-soft-2: rgba(108, 193, 185, 0.24);
    --on-secondary: #2b2118;
    --ring: rgba(108, 193, 185, 0.5);
    --success: #9ccb7a;
    --success-soft: rgba(94, 140, 58, 0.2);
    --warning: #f2be6e;
    --warning-soft: rgba(233, 162, 59, 0.16);
    --danger: #ff9a8f;
    --danger-soft: rgba(179, 38, 30, 0.22);
    --neutral-soft: rgba(243, 235, 223, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, 0.7);
    --backdrop: rgba(10, 7, 5, 0.7);
    color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Bloquea el scroll de fondo con el panel o un diálogo abiertos. */
body.has-overlay {
    overflow: hidden;
}

a {
    color: var(--primary-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 0.75rem;
    letter-spacing: -0.01em;
}

/* Escala tipográfica del diseño: H1 28/36, H2 22/28, H3 18/24. */
h1 {
    font-size: 1.75rem;
    line-height: 2.25rem;
}

h2 {
    font-size: 1.375rem;
    line-height: 1.75rem;
}

h3 {
    font-size: 1.125rem;
    line-height: 1.5rem;
}

p {
    margin: 0;
}

[hidden] {
    display: none !important;
}

.icon {
    width: 1.125em;
    height: 1.125em;
    flex-shrink: 0;
    vertical-align: -0.2em;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main {
    flex: 1;
    padding-top: 1.75rem;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.muted {
    color: var(--muted);
    font-size: 0.8125rem;
}

.pre-line {
    white-space: pre-line;
}

.eyebrow {
    margin: 0 0 0.25rem;
}

:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

/* ---------- Cabecera y pie ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.5rem;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    text-decoration: none;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    color: #fff;
    background: var(--brand);
    box-shadow: 0 0 0 2px var(--warning-solid);
}

.brand__mark .icon {
    width: 1.15rem;
    height: 1.15rem;
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand__name {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Overline: Inter 12 semibold, mayúsculas, +1.2px. */
.brand__tagline,
.eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-footer {
    margin-top: 4rem;
    padding: 1.5rem 0 2rem;
    font-size: 0.8125rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Botón del tema: se muestra el icono del tema al que se cambiaría. */
.theme-icon--sun {
    display: none;
}

:root[data-theme-resolved="dark"] .theme-icon--sun {
    display: block;
}

:root[data-theme-resolved="dark"] .theme-icon--moon {
    display: none;
}

/* ---------- Cabecera de página y resumen ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin-bottom: 0.35rem;
}

/* Título con el recuento al lado, como en el diseño. */
.page-header__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
}

.page-header__count {
    color: var(--muted);
}

.page-header__lead {
    color: var(--muted);
    max-width: 38rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.stat__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 10px;
}

.stat__icon .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.stat__icon--neutral {
    background: var(--neutral-soft);
    color: var(--text-2);
}

.stat__icon--warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.stat__icon--success {
    background: var(--success-soft);
    color: var(--success);
}

.stat__icon--primary {
    background: var(--primary-soft);
    color: var(--primary-text);
}

.stat__label {
    font-size: 0.8125rem;
    color: var(--muted);
}

.stat__value {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.stat__value.is-updated {
    color: var(--primary-text);
}

/* ---------- Tarjetas ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card--flush {
    padding: 0;
    overflow: hidden;
}

.card__title {
    font-size: 1.375rem;
    line-height: 1.75rem;
    margin: 0 0 1rem;
}

.card__footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* ---------- Avisos ---------- */

/* Banner/Error del diseño: fondo suave, borde y título en el color del estado. */
.alert {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    color: var(--text);
    font-size: 0.875rem;
}

.alert__icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.05rem;
}

.alert ul {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
}

.alert strong,
.alert__title {
    font-weight: 600;
}

.alert--success {
    background: var(--success-soft);
    border-color: var(--success-solid);
}

.alert--success .alert__icon,
.alert--success .alert__title {
    color: var(--success);
}

.alert--error {
    background: var(--danger-soft);
    border-color: var(--danger-solid);
}

.alert--error .alert__icon,
.alert--error strong,
.alert--error .alert__title {
    color: var(--danger);
}

/* Avisos flotantes: abajo en móvil, arriba a la derecha en escritorio. */
.toasts {
    position: fixed;
    z-index: 60;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    pointer-events: none;
}

/* Con el panel abierto, los avisos suben para no tapar sus botones. */
body.has-overlay .toasts {
    top: 1rem;
    bottom: auto;
}

/* Toast del diseño: fondo teñido, barra lateral del color del estado, título y mensaje. */
.toast {
    --toast-accent: var(--success-solid);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0.25rem 0.75rem 1rem;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--toast-accent) 10%, var(--surface));
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--toast-accent) 30%, var(--surface));
    border-left: 4px solid var(--toast-accent);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toast-in 0.35s var(--ease);
}

.toast--error {
    --toast-accent: var(--danger-solid);
}

.toast.is-leaving {
    animation: toast-out 0.25s ease-in forwards;
}

.toast__icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
}

.toast--success .toast__icon {
    color: var(--success);
}

.toast--error .toast__icon {
    color: var(--danger);
}

.toast__body {
    flex: 1;
    min-width: 0;
    padding-top: 0.05rem;
}

.toast__title {
    font-weight: 600;
    font-size: 0.875rem;
}

.toast__text {
    font-size: 0.875rem;
    color: var(--text-2);
}

.toast .icon-btn {
    margin-block: -0.6rem;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
}

/* ---------- Formularios ---------- */

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.optional {
    margin-left: 0.25rem;
    font-weight: 400;
    color: var(--muted);
}

input,
select,
textarea {
    font: inherit;
    width: 100%;
    min-height: 3rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
    resize: vertical;
    min-height: 5rem;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 0.8;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--text-2);
}

/* Input/Focus: borde teal de 2px (sombra interior para no mover el contenido) y anillo. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--secondary);
    box-shadow: inset 0 0 0 1px var(--secondary), 0 0 0 3px var(--ring);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--muted);
    cursor: not-allowed;
}

[aria-invalid="true"],
[aria-invalid="true"]:hover {
    border-color: var(--danger-solid);
    box-shadow: inset 0 0 0 1px var(--danger-solid);
}

[aria-invalid="true"]:focus-visible {
    box-shadow: inset 0 0 0 1px var(--danger-solid), 0 0 0 3px color-mix(in srgb, var(--danger-solid) 30%, transparent);
}

/* El JS reescribe el texto con textContent: el icono va como máscara para no perderse. */
.field-error {
    display: flex;
    gap: 0.375rem;
    margin: 0;
    color: var(--danger);
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

.field-error::before {
    content: "";
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-top: 0.125rem;
    background: currentColor;
    -webkit-mask: var(--icon-alert) center / contain no-repeat;
    mask: var(--icon-alert) center / contain no-repeat;
}

.input-icon {
    position: relative;
}

.input-icon > .icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.input-icon input {
    padding-left: 2.625rem;
}

.input-affix {
    position: relative;
}

.input-affix input {
    padding-right: 2.25rem;
    font-variant-numeric: tabular-nums;
}

.input-affix__suffix {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-section + .form-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* float saca la legend del borde del fieldset para poder maquetarla como un título normal. */
.form-section__title {
    float: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5rem;
    color: var(--text);
}

.form-section__title + * {
    clear: both;
}

.stay-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    border: 1px dashed var(--warning-solid);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.form-intro {
    margin: -0.5rem 0 1.25rem;
}

.hint {
    color: var(--muted);
    font-size: 0.8125rem;
}

/* Filtros del listado */

.filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.filters__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 0.75rem;
}

.filters__search {
    grid-column: 1 / -1;
}

.filters__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filters__actions {
    display: flex;
    gap: 0.5rem;
}

.filters .hint {
    margin-top: -0.25rem;
}

/* Filter Chip: 44px de alto, píldora; seleccionado en teal con check. */
.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* float saca la legend del borde del fieldset para alinearla con los chips. */
.chips__legend {
    float: left;
    margin-right: 0.25rem;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.chip {
    position: relative;
    margin: 0;
}

.chip input {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.chip span {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip__check {
    display: none;
}

.chip:hover span {
    background: var(--neutral-soft);
}

.chip input:checked + span {
    background: var(--secondary);
    border-color: var(--secondary);
    color: var(--on-secondary);
}

.chip input:checked + span .chip__check {
    display: block;
}

.chip input:focus-visible + span {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

/* ---------- Tarjetas de reserva ---------- */

.booking-grid {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    transition: opacity 0.2s;
}

.booking-grid[aria-busy="true"] {
    opacity: 0.6;
}

/* Los esqueletos ya indican la carga: sin atenuar. */
.booking-grid[aria-busy="true"]:has(.booking-card--skeleton) {
    opacity: 1;
}

.booking-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.booking-card:hover {
    border-color: var(--border-strong);
}

.booking-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.booking-card__guest {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.5rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Toda la tarjeta es clicable sin anidar enlaces; los botones quedan por encima. */
.booking-card__link {
    color: var(--text);
    text-decoration: none;
}

.booking-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.booking-card__link:focus-visible {
    outline: none;
}

.booking-card:has(.booking-card__link:focus-visible) {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

.booking-card__line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-2);
}

.booking-card__line .icon {
    color: var(--muted);
}

.booking-card__foot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
}

.booking-card__total-label {
    margin-right: auto;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.booking-card .actions__group {
    position: relative;
    z-index: 1;
    display: inline-flex;
    gap: 0.375rem;
}

.booking-card__amount {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.booking-empty {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
}

.empty-state .muted {
    text-align: center;
}

/* Skeleton/Booking Card */
.booking-card--skeleton {
    gap: 0.75rem;
}

.skeleton {
    display: block;
    height: 0.875rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--neutral-soft) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
}

.skeleton--title {
    width: 45%;
    height: 1.25rem;
}

.skeleton--line {
    width: 70%;
}

.skeleton--short {
    width: 55%;
}

.skeleton--foot {
    height: 1.5rem;
    margin-top: 0.5rem;
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

/* ---------- Botones ---------- */

/* Button del diseño: Primary / Secondary / Ghost × Default / Hover / Pressed / Disabled / Loading.
   48px de alto (44 en la variante pequeña) para cumplir el área táctil mínima. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--on-primary);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn:active:not(:disabled) {
    background: var(--primary-pressed);
}

/* Loading: conserva el color de su variante y muestra el spinner. */
.btn[aria-busy="true"] {
    cursor: progress;
}

.btn:disabled:not([aria-busy="true"]) {
    background: var(--disabled);
    border-color: transparent;
    color: var(--on-disabled);
    box-shadow: none;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: var(--shadow-sm);
}

.btn--secondary {
    background: var(--surface);
    color: var(--secondary);
    border-color: var(--secondary);
}

.btn--secondary:hover {
    background: var(--secondary-soft);
    color: var(--secondary-strong);
}

.btn--secondary:active:not(:disabled) {
    background: var(--secondary-soft-2);
    color: var(--secondary-strong);
}

.btn--ghost {
    background: transparent;
    color: var(--text);
}

.btn--ghost:hover {
    background: var(--neutral-soft);
}

.btn--ghost:active:not(:disabled) {
    background: var(--border);
}

.btn--ghost:disabled:not([aria-busy="true"]) {
    background: transparent;
}

/* Acciones rápidas del listado: tonos suaves de estado. */
.btn--success-soft {
    background: var(--success-soft);
    color: var(--success);
}

.btn--success-soft:hover,
.btn--success-soft:active:not(:disabled) {
    background: color-mix(in srgb, var(--success-solid) 22%, var(--surface));
}

.btn--danger-soft {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn--danger-soft:hover,
.btn--danger-soft:active:not(:disabled) {
    background: color-mix(in srgb, var(--danger-solid) 22%, var(--surface));
}

.btn--small {
    min-height: 2.75rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
}

.btn--icon {
    width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
    background: var(--neutral-soft);
    color: var(--text);
}

.icon-btn .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.icon-btn--small {
    width: 2.75rem;
    height: 2.75rem;
}

.spinner {
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Etiquetas de estado y avatares ---------- */

/* Badge/Status: color sólido + icono + texto (el estado no depende solo del color). */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.625rem 0.25rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.badge .icon {
    width: 0.875rem;
    height: 0.875rem;
    vertical-align: 0;
    stroke-width: 2.5;
}

.badge__dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}

.badge--pendiente {
    background: var(--warning-solid);
    color: var(--on-warning);
}

.badge--confirmada {
    background: var(--success-solid);
    color: #fff;
}

.badge--cancelada {
    background: var(--danger-solid);
    color: #fff;
}

.badge.is-new {
    animation: pop 0.4s var(--ease);
}

@keyframes pop {
    50% {
        transform: scale(1.12);
    }
}

.avatar {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--av-fg);
    background: var(--av-bg);
}

.avatar--lg {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.15rem;
}

.avatar--0 { --av-bg: #f8e9e1; --av-fg: #8e3a19; }
.avatar--1 { --av-bg: #eaf1e2; --av-fg: #4d7530; }
.avatar--2 { --av-bg: #fcf1de; --av-fg: #7a4e0e; }
.avatar--3 { --av-bg: #e4f1ef; --av-fg: #226660; }
.avatar--4 { --av-bg: #f3ebdf; --av-fg: #5c4a3c; }
.avatar--5 { --av-bg: #fbeae8; --av-fg: #9a2019; }

/* ---------- Tabla: tarjetas apiladas en móvil ---------- */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    /* En móvil cada celda muestra su etiqueta con data-label. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.table tbody {
    display: block;
    padding: 0.75rem;
    transition: opacity 0.2s;
}

.table tr {
    display: block;
    position: relative;
    padding: 0.9rem 1rem;
    margin-bottom: 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table tr:last-child {
    margin-bottom: 0;
}

.table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.3rem 0;
    text-align: right;
}

.table td::before {
    content: attr(data-label);
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: left;
}

.table td.cell-guest {
    justify-content: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.65rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table td.cell-guest::before,
.table .actions::before,
.table .empty-row td::before {
    content: none;
}

.cell-guest__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cell-guest__text .muted {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.row-link:hover {
    color: var(--primary-text);
    text-decoration: underline;
}

.table .num {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .actions {
    justify-content: flex-end;
    gap: 0.35rem;
    padding-top: 0.65rem;
}

.actions__group {
    display: inline-flex;
    gap: 0.35rem;
}

.stay {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
}

.stay__dates {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.stay__arrow {
    width: 0.85rem;
    height: 0.85rem;
    color: var(--muted);
}

.table .empty-row {
    border-style: dashed;
}

.table .empty-row td {
    justify-content: center;
    text-align: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 2rem 1rem;
}

.empty-state__icon {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 0.75rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-text);
}

.empty-state__icon .icon {
    width: 1.75rem;
    height: 1.75rem;
}

.empty-state__title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5rem;
    color: var(--text);
}

.empty-state .btn {
    margin-top: 0.75rem;
}

/* Carga: barra de progreso sobre la tabla y filas atenuadas. */
.table-wrap {
    position: relative;
    overflow-x: auto;
}

.table-wrap::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--primary);
    opacity: 0;
}

.table-wrap:has(tbody[aria-busy="true"])::before {
    opacity: 1;
    animation: loading 1s var(--ease) infinite;
}

.table tbody[aria-busy="true"] {
    opacity: 0.55;
}

@keyframes loading {
    0% {
        left: 0;
        width: 0;
    }
    50% {
        left: 20%;
        width: 60%;
    }
    100% {
        left: 100%;
        width: 0;
    }
}

/* ---------- Panel lateral (alta) ---------- */

.drawer {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    justify-content: flex-end;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear 0.3s;
}

.drawer:target,
.drawer.is-open {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.drawer__backdrop {
    position: absolute;
    inset: 0;
    background: var(--backdrop);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

.drawer:target .drawer__backdrop,
.drawer.is-open .drawer__backdrop {
    opacity: 1;
}

.drawer__panel {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 32rem;
    height: 100%;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.35s var(--ease);
}

.drawer:target .drawer__panel,
.drawer.is-open .drawer__panel {
    transform: none;
}

/* Con JS manda la clase is-open: un #nueva-reserva que quede en la URL no lo mantiene abierto. */
.drawer.is-managed:not(.is-open) {
    visibility: hidden;
    pointer-events: none;
    transition-delay: 0.3s;
}

.drawer.is-managed:not(.is-open) .drawer__backdrop {
    opacity: 0;
}

.drawer.is-managed:not(.is-open) .drawer__panel {
    transform: translateX(100%);
}

.drawer__form {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.drawer__title {
    margin: 0 0 0.15rem;
    font-size: 1.125rem;
}

.drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    overscroll-behavior: contain;
}

.drawer__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* ---------- Diálogo de confirmación ---------- */

.dialog {
    width: calc(100% - 2rem);
    max-width: 27.5rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.dialog[open] {
    animation: dialog-in 0.25s var(--ease);
}

.dialog::backdrop {
    background: var(--backdrop);
    animation: fade-in 0.25s var(--ease);
}

.dialog__body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.dialog__icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--danger-soft);
    color: var(--danger);
}

.dialog__icon--success {
    background: var(--success-soft);
    color: var(--success);
}

.dialog__icon .icon {
    width: 1.35rem;
    height: 1.35rem;
}

.dialog__title {
    margin: 0 0 0.5rem;
    font-size: 1.375rem;
    line-height: 1.75rem;
}

.dialog__message {
    color: var(--muted);
}

.dialog__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* En móvil los botones ocupan el ancho y la acción principal queda abajo, junto al pulgar. */
@media (max-width: 479px) {
    .dialog__actions {
        flex-direction: column-reverse;
    }

    .dialog__actions .btn {
        width: 100%;
    }
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

/* ---------- Detalle ---------- */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--muted);
}

/* 44px de alto: área táctil mínima. */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary-text);
}

.detail-grid {
    display: grid;
    gap: 0 1.5rem;
}

/* Tarjeta resumen del detalle (Card + campos en dos columnas + pie con total y acciones). */
.summary {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.summary__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
}

.summary__title {
    margin: 0;
    overflow-wrap: anywhere;
}

/* Campos: overline + valor, dos columnas desde móvil (las largas ocupan la fila). */
.summary__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    margin: 0;
}

.summary__fields > div:nth-child(-n + 2),
.summary__fields .full {
    grid-column: 1 / -1;
}

.summary__fields dt {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.summary__fields dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.summary__foot {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border-strong);
}

.summary__foot .eyebrow {
    margin: 0;
}

.summary__amount {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 2.25rem;
    font-variant-numeric: tabular-nums;
}

.summary__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.summary__note {
    font-size: 0.875rem;
    color: var(--muted);
}

.details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 0;
}

.details__item {
    display: flex;
    gap: 0.75rem;
    min-width: 0;
}

.details__icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9px;
    background: var(--neutral-soft);
    color: var(--muted);
}

.details dt {
    font-size: 0.8125rem;
    color: var(--muted);
}

.details dd {
    margin: 0;
    font-weight: 550;
    overflow-wrap: anywhere;
}

.details__amount {
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
}

.timeline {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.timeline__item {
    position: relative;
    display: flex;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
}

.timeline__item:last-child {
    padding-bottom: 0;
}

/* Línea vertical que une los puntos (salvo tras el último). */
.timeline__item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 1rem;
    top: 2.25rem;
    bottom: 0.25rem;
    width: 2px;
    transform: translateX(-50%);
    background: var(--border);
}

/* Timeline Item: creada (neutro), confirmada (oliva) y cancelada (ladrillo). */
.timeline__dot {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--neutral-soft);
    border: 1px solid var(--border-strong);
    color: var(--text);
}

.timeline__dot .icon {
    width: 1rem;
    height: 1rem;
    stroke-width: 2.5;
}

.timeline__item--confirmada .timeline__dot {
    background: var(--success-solid);
    border-color: var(--success-solid);
    color: #fff;
}

.timeline__item--cancelada .timeline__dot {
    background: var(--danger-solid);
    border-color: var(--danger-solid);
    color: #fff;
}

.timeline__text {
    font-weight: 600;
    padding-top: 0.25rem;
}

.timeline__item time {
    font-size: 0.8125rem;
    color: var(--muted);
}

.timeline__item.is-new {
    animation: fade-in 0.5s var(--ease);
}

/* ---------- Páginas de error ---------- */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 30rem;
    margin: 3rem auto;
    text-align: center;
}

.error-page__icon {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 0.75rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-text);
}

.error-page__icon--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.error-page__icon .icon {
    width: 1.75rem;
    height: 1.75rem;
}

.error-page__code {
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.error-page h1 {
    margin: 0;
}

.error-page .btn {
    margin-top: 1rem;
}

/* ---------- >= 640px ---------- */

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }

    .main {
        padding-top: 2.25rem;
    }

    /* Display 40/48 en pantallas anchas. */
    h1 {
        font-size: 2.5rem;
        line-height: 3rem;
    }

    .toasts {
        left: auto;
        right: 1.5rem;
        top: 5.5rem;
        bottom: auto;
        width: 24rem;
    }

    .filters {
        padding: 1.5rem;
    }

    .booking-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .details .full {
        grid-column: 1 / -1;
    }

    .summary {
        padding: 2rem;
    }

    .summary__fields > div:nth-child(-n + 2) {
        grid-column: auto;
    }

    .summary__foot {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        justify-content: space-between;
    }

    .summary__amount {
        font-size: 2rem;
        line-height: 2.5rem;
    }

    .summary__actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .drawer__panel {
        margin: 0.75rem;
        height: calc(100% - 1.5rem);
        border-radius: var(--radius-lg);
        overflow: hidden;
    }
}

/* ---------- >= 768px: tabla clásica ---------- */

@media (min-width: 768px) {
    .stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .table thead {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
    }

    .table tbody {
        display: table-row-group;
        padding: 0;
    }

    .table tr {
        display: table-row;
        border: 0;
        border-radius: 0;
        padding: 0;
        margin: 0;
        transition: background 0.15s;
    }

    .table th,
    .table td,
    .table td.cell-guest {
        display: table-cell;
        padding: 0.8rem 1rem;
        text-align: left;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
        margin: 0;
    }

    .table tbody tr:last-child td {
        border-bottom: 0;
    }

    .table th {
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
        background: var(--surface-2);
        white-space: nowrap;
    }

    .table th:first-child,
    .table td:first-child {
        padding-left: 1.25rem;
    }

    .table th:last-child,
    .table td:last-child {
        padding-right: 1.25rem;
    }

    .table td::before {
        content: none;
    }

    .cell-guest > * {
        vertical-align: middle;
    }

    .table td.cell-guest {
        white-space: nowrap;
    }

    .table td.cell-guest .avatar {
        margin-right: 0.75rem;
    }

    .cell-guest__text {
        display: inline-flex;
        max-width: 16rem;
    }

    .table tbody tr:not(.empty-row):hover {
        background: var(--surface-hover);
    }

    .stay {
        align-items: flex-start;
    }

    .table .num {
        text-align: right;
    }

    .table .actions {
        text-align: right;
        white-space: nowrap;
    }

    .table .actions > * {
        vertical-align: middle;
    }

    .table .actions .icon-btn {
        margin-left: 0.25rem;
    }

    /* Las acciones aparecen al pasar por la fila (siempre visibles con teclado o en táctil). */
    @media (hover: hover) {
        .table .actions__group {
            opacity: 0;
            transition: opacity 0.15s;
        }

        .table tr:hover .actions__group,
        .table tr:focus-within .actions__group {
            opacity: 1;
        }
    }

    .table .empty-row td {
        text-align: center;
    }
}

/* ---------- >= 960px ---------- */

@media (min-width: 960px) {
    .filters__fields {
        grid-template-columns: minmax(0, 1fr) 14rem 14rem;
    }

    .filters__search {
        grid-column: auto;
    }

    .booking-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .table td:nth-child(2) {
        min-width: 11rem;
    }

    .detail-grid {
        grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
        align-items: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Navegación del panel y sesión ---------- */

.main-nav {
    display: flex;
    gap: 0.25rem;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 550;
    text-decoration: none;
}

.main-nav a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.main-nav a[aria-current="page"] {
    background: var(--primary-soft);
    color: var(--primary-text);
}

/* En móvil solo iconos: el texto queda para lectores de pantalla. */
.main-nav a span,
.user-chip span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.logout-form {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border);
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.8125rem;
}

.timeline__actor {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}

/* ---------- Catálogo público y reserva ---------- */

.catalog {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.catalog__item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    transition: border-color 0.15s, transform 0.15s var(--ease);
}

.catalog__item:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    transform: translateY(-2px);
}

.catalog__icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.5rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-text);
}

.catalog__title {
    margin: 0;
    font-size: 1.0625rem;
}

/* Toda la tarjeta es clicable sin anidar enlaces. */
.catalog__link {
    color: var(--text);
    text-decoration: none;
}

.catalog__link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.catalog__city {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
}

.catalog__price {
    margin: 0.5rem 0 0;
    font-variant-numeric: tabular-nums;
}

.catalog__price strong {
    font-size: 1.25rem;
}

.booking {
    display: grid;
    gap: 0 1.25rem;
}

.booking__title {
    margin: 0;
}

.booking__footer,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* En móvil el envío ocupa todo el ancho. */
@media (max-width: 639px) {
    .booking__footer .btn {
        flex: 1;
    }
}

.confirmation {
    max-width: 36rem;
    margin: 2rem auto;
    text-align: center;
}

.confirmation__icon {
    margin: 0 auto 0.5rem;
    background: var(--success-soft);
    color: var(--success);
}

.confirmation__details {
    margin: 1.5rem 0 1rem;
    text-align: left;
}

/* ---------- Acceso y panel ---------- */

.auth-card,
.form-card {
    max-width: 28rem;
    margin: 2rem auto;
}

.form-card {
    max-width: 40rem;
}

.auth-card__title {
    margin: 0 0 0.25rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.auth-form__submit {
    justify-content: center;
    margin-top: 0.25rem;
}

.auth-card__alt {
    margin: 1.25rem 0 0;
    font-size: 0.875rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 450;
}

.checkbox input {
    width: auto;
    min-height: 0;
    box-shadow: none;
}

.card__title--padded {
    padding: 1.25rem 1.25rem 0;
}

.panel-grid {
    display: grid;
    gap: 0 1.25rem;
}

@media (min-width: 640px) {
    .catalog {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 960px) {
    .catalog {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .main-nav a span,
    .user-chip span {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
    }

    .booking {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
        align-items: start;
    }

    .panel-grid {
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
        align-items: start;
    }
}
