/* ==========================================================================
   Panel SaaS Hostelería — hoja de estilos única, sin CDN ni fuentes externas.
   Diseño: barra lateral oscura, contenido claro, tipografía del sistema.
   ========================================================================== */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --ink: #172033;
    --ink-soft: #5a6579;
    --ink-faint: #8b95a7;
    --line: #e2e7ef;
    --sidebar: #101827;
    --sidebar-soft: #1b2638;
    --sidebar-ink: #c9d3e4;
    --primary: #3559e0;
    --primary-dark: #2948bd;
    --ok: #157a4b;
    --ok-bg: #e4f6ec;
    --warn: #9a5b00;
    --warn-bg: #fdf0d9;
    --danger: #b32222;
    --danger-bg: #fde8e8;
    --info: #1d5f96;
    --info-bg: #e5f1fb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 39, 0.06), 0 8px 24px rgba(16, 24, 39, 0.05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.45rem;
}

h2 {
    font-size: 1.05rem;
}

h3 {
    font-size: 1rem;
}

p {
    margin: 0 0 0.75rem;
}

p:last-child {
    margin-bottom: 0;
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0.1em 0.35em;
    word-break: break-word;
}

.mono {
    font-family: var(--mono);
    font-size: 0.86em;
    word-break: break-all;
}

.muted {
    color: var(--ink-soft);
}

.small {
    font-size: 0.82rem;
}

.text-danger {
    color: var(--danger);
}

.text-ok {
    color: var(--ok);
}

/* ---------- Estructura ---------------------------------------------------- */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    flex: 0 0 248px;
    width: 248px;
    height: 100vh;
    padding: 22px 16px;
    background: var(--sidebar);
    color: var(--sidebar-ink);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 18px;
    color: #fff;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand__mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #4f7cff, #7c5cff);
    color: #fff;
    font-size: 1rem;
    flex: 0 0 auto;
}

.brand__text {
    font-size: 0.98rem;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.nav__link {
    display: block;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--sidebar-ink);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav__link:hover {
    background: var(--sidebar-soft);
    color: #fff;
    text-decoration: none;
}

.nav__link.is-active {
    background: #26365b;
    color: #fff;
}

.sidebar__footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.who {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px 10px;
}

.who strong {
    color: #fff;
    font-size: 0.88rem;
}

.who span {
    color: #8fa0bd;
    font-size: 0.76rem;
}

.sidebar .btn--ghost {
    border-color: rgba(255, 255, 255, 0.18);
    color: #dbe4f3;
}

.sidebar .btn--ghost:hover {
    background: var(--sidebar-soft);
    color: #fff;
}

.main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 26px 30px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.topbar h1 {
    font-size: 1.5rem;
}

.topbar__scope { margin: 6px 0 0; color: var(--ink-soft); font-size: .88rem; overflow-wrap: anywhere; }
.account-context {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 0 1 auto;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.account-context span { color: var(--ink-soft); font-size: .78rem; }
.account-context strong { color: var(--ink); font-size: .88rem; }
.account-context--operator { border-color: #d5b477; background: #fff7e8; }
.access-intro p { margin: 8px 0 0; }
.access-steps { margin: 0; padding-left: 24px; }
.access-steps li { margin: 0 0 14px; }
.login__help { margin-top: 20px; font-size: .88rem; color: var(--ink-soft); }
.login__help summary { cursor: pointer; color: var(--ink); }
.login__help p { margin: 10px 0; }
@media (max-width: 620px) {
    .topbar { align-items: stretch; flex-direction: column; gap: 12px; }
    .account-context { align-self: flex-start; max-width: 100%; }
}

/* ---------- Acceso -------------------------------------------------------- */

.guest {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 10% 0%, #1b2a4a 0%, transparent 60%),
        radial-gradient(700px 500px at 100% 100%, #243a6b 0%, transparent 55%),
        var(--sidebar);
}

.login {
    width: 100%;
    max-width: 400px;
}

.login__card {
    padding: 30px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.login__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--ink);
    font-weight: 650;
}

.login__title {
    margin-bottom: 4px;
    font-size: 1.3rem;
}

.login__foot {
    margin-top: 18px;
    text-align: center;
}

/* ---------- Tarjetas y rejillas ------------------------------------------- */

.card {
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card--narrow {
    max-width: 640px;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-alt);
}

.card__head p {
    margin: 4px 0 0;
}

.card__body {
    padding: 20px;
}

.grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.inline {
    display: inline-flex;
    margin: 0;
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* ---------- Estadísticas -------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat__label {
    display: block;
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat__value {
    display: block;
    margin-top: 6px;
    font-size: 1.7rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.stat--ok .stat__value {
    color: var(--ok);
}

.stat--warn .stat__value {
    color: var(--warn);
}

.stat--danger .stat__value {
    color: var(--danger);
}

/* ---------- Tablas -------------------------------------------------------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.table th,
.table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-alt);
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fafcff;
}

.table--compact th,
.table--compact td {
    padding: 8px 10px;
}

.table--nested {
    font-size: 0.82rem;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
}

.row--detail > td {
    padding: 0 14px 12px;
    background: var(--surface);
}

.row--cancelled td {
    color: var(--ink-faint);
}

.row--cancelled td:first-child {
    text-decoration: line-through;
}

/* ---------- Listas de datos ----------------------------------------------- */

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 20px;
    margin: 0 0 16px;
}

.facts--wide {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.facts dt {
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.facts dd {
    margin: 3px 0 0;
    font-size: 0.92rem;
}

.errors {
    margin: 0;
    padding-left: 18px;
    color: var(--danger);
    font-size: 0.88rem;
}

.error-code {
    margin: 0;
    color: var(--danger);
    font-size: 2.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---------- Insignias ----------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 650;
    line-height: 1.6;
    white-space: nowrap;
}

.badge--ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge--warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.badge--danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge--info {
    background: var(--info-bg);
    color: var(--info);
}

.badge--neutral {
    background: #eceff5;
    color: #4b5568;
}

/* ---------- Formularios --------------------------------------------------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.85rem;
}

.field > span {
    color: var(--ink-soft);
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cfd7e3;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid rgba(53, 89, 224, 0.25);
    border-color: var(--primary);
}

.field input[readonly] {
    background: var(--surface-alt);
    color: var(--ink-soft);
}

.input--sm {
    padding: 6px 8px;
    border: 1px solid #cfd7e3;
    border-radius: 7px;
    font: inherit;
    font-size: 0.85rem;
    width: 100%;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox--inline {
    white-space: nowrap;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 12px;
}

.filters .field {
    min-width: 190px;
}

/* ---------- Botones ------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: #e9edf5;
    color: var(--ink);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
    text-decoration: none;
    filter: brightness(0.97);
}

.btn--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--primary-dark);
}

.btn--ghost {
    background: transparent;
    border-color: #cfd7e3;
    color: var(--ink);
}

.btn--ghost:hover {
    background: var(--surface-alt);
}

.btn--danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn--sm {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.btn--block {
    width: 100%;
}

/* ---------- Avisos -------------------------------------------------------- */

.flash {
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.flash--success {
    background: var(--ok-bg);
    border-color: #bfe6cf;
    color: #145c39;
}

.flash--error {
    background: var(--danger-bg);
    border-color: #f3c4c4;
    color: #8f1d1d;
}

.flash--warning {
    background: var(--warn-bg);
    border-color: #f0d9ac;
    color: #7c4900;
}

.flash--info {
    background: var(--info-bg);
    border-color: #c4ddf2;
    color: #164b78;
}

/* ---------- Adaptación a pantallas pequeñas ------------------------------- */

@media (max-width: 980px) {
    .shell {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        padding: 14px 16px;
    }

    .brand {
        padding-bottom: 12px;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .nav__link {
        padding: 7px 10px;
        font-size: 0.84rem;
    }

    .sidebar__footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 12px;
        padding-top: 12px;
    }

    .who {
        padding: 0;
    }

    .main {
        padding: 20px 16px 48px;
    }

    .grid--2 {
        grid-template-columns: 1fr;
    }

    .card__head {
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar h1 {
        font-size: 1.25rem;
    }

    .table th,
    .table td {
        padding: 9px 10px;
    }
}

/* --------------------------------------------------------------- reservas web */
.booking-public {
    max-width: 760px;
    margin: 0 auto;
}

.booking-hero {
    padding: 24px 4px 18px;
}

.booking-hero h1 {
    margin: 4px 0 8px;
    font-size: clamp(2rem, 4vw, 2.8rem);
}

.booking-hero p {
    color: var(--ink-soft);
}

.booking-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.booking-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.switch-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 24px;
    color: var(--ink-soft);
    font-weight: 600;
}

.booking-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

@media (max-width: 720px) {
    .booking-filter {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------------ planos */
.layout-editor-card .card__body {
    padding-top: 12px;
}

.layout-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.layout-toolbar__sep {
    width: 1px;
    height: 24px;
    background: var(--line);
    margin: 0 4px;
}

.layout-grid-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 600;
}

.layout-save {
    margin-left: auto;
}

.layout-shell {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) 260px;
    gap: 14px;
    align-items: start;
}

.layout-rooms,
.layout-inspector {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.layout-rooms h3,
.layout-inspector h3 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
}

.layout-room-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.layout-room {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.layout-room:hover {
    background: var(--surface);
}

.layout-room.is-active {
    border-color: var(--primary);
    background: var(--surface);
    color: var(--ink);
    font-weight: 700;
}

.layout-room small {
    color: var(--ink-faint);
}

.layout-workspace {
    min-width: 0;
}

.layout-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 1000 / 700;
    border: 1px solid #cfd7e3;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    overflow: hidden;
    touch-action: none;
}

.layout-canvas--grid {
    background-image:
        linear-gradient(to right, rgba(53, 89, 224, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(53, 89, 224, 0.08) 1px, transparent 1px);
    background-size: 5% 5%;
}

.layout-table {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transform: translate(-50%, -50%);
    min-width: 36px;
    min-height: 32px;
    padding: 2px;
    border: 2px solid #9fb1c8;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1;
    cursor: grab;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.layout-table strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.55rem, 1.1vw, 0.76rem);
}

.layout-table span {
    color: var(--ink-faint);
    font-size: clamp(0.5rem, 0.9vw, 0.66rem);
}

.layout-table.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(53, 89, 224, 0.18);
}

.layout-table.is-dragging {
    cursor: grabbing;
    z-index: 3;
}

.layout-table.shape-round {
    border-radius: 50%;
}

.layout-table.shape-rect {
    border-radius: 16px;
}

.layout-hint {
    margin: 8px 0 0;
}

.layout-inspector {
    min-height: 220px;
}

.layout-inspector .field {
    margin-bottom: 9px;
}

.layout-prop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.layout-prop-grid .field {
    margin-bottom: 0;
}

.layout-inspector .btn--danger {
    margin-top: 12px;
}

@media (max-width: 1100px) {
    .layout-shell {
        grid-template-columns: 150px minmax(0, 1fr) 220px;
    }
}

@media (max-width: 860px) {
    .layout-shell {
        grid-template-columns: 1fr;
    }

    .layout-room-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .layout-room {
        width: auto;
    }

    .layout-save {
        margin-left: 0;
    }
}

@media print {
    .sidebar,
    .page-actions,
    .btn,
    .flash {
        display: none !important;
    }

    .main {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border-color: #999;
    }
}
