/* =====================================================================
   Duerme Aquí — hoja de estilos principal
   Construida sobre Bootstrap 5.3. Tema claro y oscuro.
   ===================================================================== */

:root {
    --s-primary:        #2563eb;
    --s-primary-rgb:    37, 99, 235;
    --s-primary-dark:   #1d4ed8;
    --s-primary-soft:   #eff4ff;
    /* El azul corporativo sobre fondo claro. En oscuro se aclara:
       como texto no tiene contraste suficiente. Como FONDO de boton
       se sigue usando --s-primary, que ahi si funciona. */
    --s-link:           #2563eb;
    --s-accent:         #0ea5e9;

    --s-bg:             #f4f6fb;
    --s-surface:        #ffffff;
    --s-surface-2:      #f8fafc;
    --s-border:         #e5e9f0;
    --s-border-strong:  #d4dae4;

    --s-text:           #111a2b;
    --s-text-soft:      #5b6779;
    --s-text-muted:     #8792a5;

    --s-success:        #12a150;
    --s-warning:        #d97706;
    --s-danger:         #dc2626;
    --s-info:           #0891b2;

    --s-sidebar-w:      262px;
    --s-topbar-h:       60px;
    --s-radius:         12px;
    --s-radius-sm:      8px;
    --s-radius-lg:      18px;
    --s-shadow-xs:      0 1px 2px rgba(16, 24, 40, .05);
    --s-shadow-sm:      0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --s-shadow:         0 4px 14px rgba(16, 24, 40, .07);
    --s-shadow-lg:      0 12px 34px rgba(16, 24, 40, .12);
    --s-font:           'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

[data-theme="dark"] {
    --s-bg:             #0d1117;
    --s-surface:        #161b24;
    --s-surface-2:      #1c222d;
    --s-border:         #262d3a;
    --s-border-strong:  #333c4d;
    --s-text:           #e6edf6;
    --s-text-soft:      #9aa6b9;
    --s-text-muted:     #8b98ac;
    --s-primary-soft:   #17233d;
    --s-link:           #7aa7ff;
    --s-shadow-sm:      0 1px 3px rgba(0, 0, 0, .4);
    --s-shadow:         0 4px 14px rgba(0, 0, 0, .35);
    --s-shadow-lg:      0 12px 34px rgba(0, 0, 0, .5);
}

* { -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--s-font);
    background: var(--s-bg);
    color: var(--s-text);
    font-size: .9375rem;
    line-height: 1.55;
}

a { color: var(--s-link); text-decoration: none; }
a:hover { color: var(--s-primary-dark); }
hr { border-color: var(--s-border); opacity: 1; }

::selection { background: rgba(var(--s-primary-rgb), .18); }

/* ---------- Scrollbars ------------------------------------------- */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--s-border-strong); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: var(--s-text-muted); }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--s-sidebar-w);
    flex: 0 0 var(--s-sidebar-w);
    background: var(--s-surface);
    border-right: 1px solid var(--s-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transition: transform .25s ease;
}

.app-sidebar__brand {
    height: var(--s-topbar-h);
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--s-border);
    flex: 0 0 auto;
}
.app-sidebar__brand .logo-mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: linear-gradient(135deg, var(--s-primary), var(--s-accent));
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .95rem;
    flex: 0 0 auto;
}
.app-sidebar__brand .brand-text { font-weight: 700; letter-spacing: -.02em; color: var(--s-text); font-size: 1.02rem; }
.app-sidebar__brand .brand-sub { font-size: .68rem; color: var(--s-text-muted); text-transform: uppercase; letter-spacing: .08em; }

.app-sidebar__nav { overflow-y: auto; padding: .75rem .65rem 1.5rem; flex: 1 1 auto; }

.nav-group-label {
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
    color: var(--s-text-muted); padding: .95rem .6rem .35rem;
}

.app-sidebar .nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .62rem; border-radius: var(--s-radius-sm);
    color: var(--s-text-soft); font-weight: 500; font-size: .875rem;
    margin-bottom: 1px; transition: background .14s, color .14s;
}
.app-sidebar .nav-link i { font-size: 1.02rem; width: 1.25rem; text-align: center; flex: 0 0 auto; }
.app-sidebar .nav-link:hover { background: var(--s-surface-2); color: var(--s-text); }
.app-sidebar .nav-link.active {
    background: var(--s-primary-soft); color: var(--s-link); font-weight: 600;
}
.app-sidebar .nav-link .badge { margin-left: auto; font-size: .68rem; }
.app-sidebar .nav-link.is-locked { opacity: .55; }
.app-sidebar .nav-link.is-locked:hover { background: transparent; cursor: pointer; }
/* Sub-entrada de un modulo con varias pantallas (p. ej. Chatbot IA) */
.app-sidebar .nav-link--sub { padding-left: 2.1rem; font-size: .84rem; opacity: .85; }
.app-sidebar .nav-link--sub i { font-size: .9rem; }
.app-sidebar .nav-link--sub.active { opacity: 1; }

.app-main {
    flex: 1 1 auto;
    margin-left: var(--s-sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: var(--s-topbar-h);
    background: var(--s-surface);
    border-bottom: 1px solid var(--s-border);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.1rem;
    position: sticky; top: 0; z-index: 1030;
}

.app-content { padding: 1.35rem; flex: 1 1 auto; }
@media (min-width: 1400px) { .app-content { padding: 1.6rem 2rem; } }

.app-footer {
    padding: 1rem 1.35rem 1.6rem;
    color: var(--s-text-muted);
    font-size: .8rem;
    border-top: 1px solid var(--s-border);
}

/* Banner de impersonacion del superadmin */
.impersonation-bar {
    background: linear-gradient(90deg, #7c3aed, #2563eb);
    color: #fff; font-size: .82rem; font-weight: 500;
    padding: .45rem 1.1rem; display: flex; align-items: center; gap: .6rem;
}
.impersonation-bar .btn { --bs-btn-padding-y: .12rem; --bs-btn-padding-x: .6rem; font-size: .78rem; }

/* ---------- Responsive ------------------------------------------- */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--s-shadow-lg); }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(9, 14, 24, .45); z-index: 1035;
    }
    .app-main { margin-left: 0; }
    .app-content { padding: 1rem .85rem 5rem; }
}

/* Barra inferior movil */
.mobile-tabbar {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1039;
    background: var(--s-surface); border-top: 1px solid var(--s-border);
    padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom));
}
.mobile-tabbar a {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    padding: .35rem .2rem; color: var(--s-text-muted); font-size: .66rem; font-weight: 500;
    border-radius: var(--s-radius-sm);
}
.mobile-tabbar a i { font-size: 1.22rem; }
.mobile-tabbar a.active { color: var(--s-link); }
@media (max-width: 991.98px) { .mobile-tabbar { display: flex; } }

/* =====================================================================
   COMPONENTES
   ===================================================================== */
.card {
    background: var(--s-surface);
    border: 1px solid var(--s-border);
    border-radius: var(--s-radius);
    box-shadow: var(--s-shadow-xs);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--s-border);
    padding: .85rem 1.1rem;
    font-weight: 600;
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6 { margin: 0; }
.card-body { padding: 1.1rem; }
.card-footer { background: var(--s-surface-2); border-top: 1px solid var(--s-border); padding: .75rem 1.1rem; }

.page-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.15rem; }
.page-head h1 { font-size: 1.42rem; font-weight: 700; letter-spacing: -.021em; margin: 0; }
.page-head .lead-sub { color: var(--s-text-soft); font-size: .875rem; margin: .15rem 0 0; }
.page-head__actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 575.98px) {
    .page-head__actions { margin-left: 0; width: 100%; }
    .page-head__actions .btn { flex: 1 1 auto; }
}

/* ---------- Tarjetas de estadistica ------------------------------ */
.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
    font-size: 1.12rem; flex: 0 0 auto;
}
.stat-card .stat-value { font-size: 1.62rem; font-weight: 700; letter-spacing: -.028em; line-height: 1.15; }
.stat-card .stat-label { font-size: .775rem; color: var(--s-text-muted); text-transform: uppercase; letter-spacing: .055em; font-weight: 600; }
.stat-card .stat-meta { font-size: .78rem; color: var(--s-text-soft); }

.tint-primary { background: rgba(37, 99, 235, .11); color: #2563eb; }
.tint-success { background: rgba(18, 161, 80, .12);  color: #12a150; }
.tint-warning { background: rgba(217, 119, 6, .13);  color: #d97706; }
.tint-danger  { background: rgba(220, 38, 38, .12);  color: #dc2626; }
.tint-info    { background: rgba(8, 145, 178, .12);  color: #0891b2; }
.tint-purple  { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.tint-slate   { background: rgba(100, 116, 139, .14); color: #64748b; }

/* ---------- Tablas ------------------------------------------------ */
.table { --bs-table-bg: transparent; color: var(--s-text); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .62rem .75rem; border-bottom-color: var(--s-border); }
.table > thead th {
    font-size: .715rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--s-text-muted); font-weight: 600; background: var(--s-surface-2);
    border-bottom: 1px solid var(--s-border); white-space: nowrap;
}
.table > tbody > tr:hover > * { background: var(--s-surface-2); }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tablas en movil: cada fila se convierte en tarjeta */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack tbody tr {
        display: block; background: var(--s-surface);
        border: 1px solid var(--s-border); border-radius: var(--s-radius);
        margin-bottom: .65rem; padding: .5rem .2rem;
    }
    .table-stack tbody td {
        display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        border: 0 !important; padding: .32rem .75rem !important; text-align: right;
    }
    .table-stack tbody td::before {
        content: attr(data-label);
        font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
        color: var(--s-text-muted); font-weight: 600; text-align: left; flex: 0 0 auto;
    }
    .table-stack tbody td[data-label=""]::before { content: none; }
}

/* ---------- Formularios ------------------------------------------ */
.form-label { font-size: .8rem; font-weight: 600; color: var(--s-text-soft); margin-bottom: .3rem; }
.form-control, .form-select {
    background: var(--s-surface); border-color: var(--s-border-strong); color: var(--s-text);
    border-radius: var(--s-radius-sm); padding: .48rem .7rem; font-size: .89rem;
}
.form-control:focus, .form-select:focus {
    background: var(--s-surface); color: var(--s-text);
    border-color: var(--s-primary); box-shadow: 0 0 0 3px rgba(var(--s-primary-rgb), .14);
}
.form-control::placeholder { color: var(--s-text-muted); }
.form-control:disabled, .form-control[readonly] { background: var(--s-surface-2); }
.form-text { font-size: .78rem; color: var(--s-text-muted); }
.input-group-text { background: var(--s-surface-2); border-color: var(--s-border-strong); color: var(--s-text-soft); font-size: .85rem; }
.form-check-input:checked { background-color: var(--s-primary); border-color: var(--s-primary); }
.form-switch .form-check-input { width: 2.1em; height: 1.15em; }

fieldset.form-section { border: 0; margin-bottom: 1.6rem; }
fieldset.form-section > legend {
    font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--s-text-muted); border-bottom: 1px solid var(--s-border);
    padding-bottom: .45rem; margin-bottom: .9rem; float: none; width: 100%;
}

/* ---------- Botones ----------------------------------------------- */
.btn { border-radius: var(--s-radius-sm); font-weight: 500; font-size: .875rem; padding: .46rem .85rem; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-lg { padding: .65rem 1.3rem; font-size: .98rem; }
.btn-primary {
    --bs-btn-bg: var(--s-primary); --bs-btn-border-color: var(--s-primary);
    --bs-btn-hover-bg: var(--s-primary-dark); --bs-btn-hover-border-color: var(--s-primary-dark);
    --bs-btn-active-bg: var(--s-primary-dark); --bs-btn-disabled-bg: var(--s-primary);
    box-shadow: 0 1px 2px rgba(var(--s-primary-rgb), .3);
}
.btn-outline-secondary {
    --bs-btn-color: var(--s-text-soft); --bs-btn-border-color: var(--s-border-strong);
    --bs-btn-hover-bg: var(--s-surface-2); --bs-btn-hover-color: var(--s-text);
    --bs-btn-hover-border-color: var(--s-border-strong);
}
.btn-light { --bs-btn-bg: var(--s-surface-2); --bs-btn-border-color: var(--s-border); --bs-btn-color: var(--s-text); }
.btn-icon { width: 2rem; height: 2rem; padding: 0; display: inline-grid; place-items: center; }

/* ---------- Badges ------------------------------------------------ */
.badge { font-weight: 600; font-size: .715rem; padding: .32em .6em; border-radius: 6px; letter-spacing: .01em; }
.badge.text-bg-secondary { background: var(--s-border-strong) !important; color: var(--s-text) !important; }
.badge-soft { background: var(--s-surface-2); color: var(--s-text-soft); border: 1px solid var(--s-border); }

/* ---------- Avatares ---------------------------------------------- */
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
    background: var(--s-primary-soft); color: var(--s-link); font-weight: 600; font-size: .78rem;
    flex: 0 0 auto; text-transform: uppercase;
}
.avatar-sm { width: 27px; height: 27px; font-size: .68rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }

/* ---------- Listas / timeline ------------------------------------- */
.list-group-item { background: var(--s-surface); border-color: var(--s-border); color: var(--s-text); }

.timeline { position: relative; padding-left: 1.55rem; }
.timeline::before {
    content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
    width: 2px; background: var(--s-border);
}
.timeline-item { position: relative; padding-bottom: 1.05rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -1.55rem; top: 5px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--s-surface); border: 2px solid var(--s-primary);
}
.timeline-item.is-muted::before { border-color: var(--s-border-strong); }

/* ---------- Estado vacio ------------------------------------------ */
.empty-state { text-align: center; padding: 2.8rem 1rem; color: var(--s-text-muted); }
.empty-state i { font-size: 2.6rem; opacity: .35; display: block; margin-bottom: .7rem; }
.empty-state h5 { color: var(--s-text-soft); font-size: 1rem; font-weight: 600; }

/* ---------- Modales / offcanvas ----------------------------------- */
.modal-content { background: var(--s-surface); border: 1px solid var(--s-border); border-radius: var(--s-radius-lg); }
.modal-header, .modal-footer { border-color: var(--s-border); }
.offcanvas { background: var(--s-surface); color: var(--s-text); }
.dropdown-menu {
    background: var(--s-surface); border-color: var(--s-border);
    box-shadow: var(--s-shadow-lg); border-radius: var(--s-radius); padding: .35rem;
}
.dropdown-item { color: var(--s-text); border-radius: var(--s-radius-sm); padding: .44rem .65rem; font-size: .875rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--s-surface-2); color: var(--s-text); }
.dropdown-divider { border-color: var(--s-border); }
.dropdown-header { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--s-text-muted); font-weight: 600; }

/* ---------- Alertas ----------------------------------------------- */
.alert { border-radius: var(--s-radius); border: 1px solid transparent; font-size: .875rem; padding: .75rem 1rem; }
.alert-success { background: rgba(18,161,80,.1);  border-color: rgba(18,161,80,.22);  color: #0b7a3c; }
.alert-danger  { background: rgba(220,38,38,.09); border-color: rgba(220,38,38,.22);  color: #b91c1c; }
.alert-warning { background: rgba(217,119,6,.1);  border-color: rgba(217,119,6,.24);  color: #b45309; }
.alert-info    { background: rgba(8,145,178,.1);  border-color: rgba(8,145,178,.22);  color: #0e7490; }
[data-theme="dark"] .alert-success { color: #4ade80; }
[data-theme="dark"] .alert-danger  { color: #fca5a5; }
[data-theme="dark"] .alert-warning { color: #fcd34d; }
[data-theme="dark"] .alert-info    { color: #7dd3fc; }

/* Las utilidades de color de Bootstrap (.text-danger, .text-success...) usan
   el color puro de la paleta, pensado para fondo claro. Sobre fondo oscuro se
   quedan cortas de contraste, asi que se aclaran igual que las alertas. */
[data-theme="dark"] .text-danger  { color: #fca5a5 !important; }
[data-theme="dark"] .text-success { color: #4ade80 !important; }
[data-theme="dark"] .text-warning { color: #fcd34d !important; }
[data-theme="dark"] .text-info    { color: #7dd3fc !important; }
[data-theme="dark"] .text-primary { color: #7aa7ff !important; }
[data-theme="dark"] .text-muted   { color: var(--s-text-muted) !important; }

/* Los botones "outline" pintan el texto con el color puro de la paleta de
   Bootstrap (#0d6efd, #dc3545...), pensado para fondo claro. Sobre oscuro se
   aclaran; el fondo al pasar el raton sigue siendo el color solido. */
[data-theme="dark"] .btn-outline-primary   { --bs-btn-color: #7aa7ff; --bs-btn-border-color: #3d6bb5; }
[data-theme="dark"] .btn-outline-danger    { --bs-btn-color: #fca5a5; --bs-btn-border-color: #a34848; }
[data-theme="dark"] .btn-outline-success   { --bs-btn-color: #4ade80; --bs-btn-border-color: #3d8f57; }
[data-theme="dark"] .btn-outline-warning   { --bs-btn-color: #fcd34d; --bs-btn-border-color: #a3822d; }
[data-theme="dark"] .btn-outline-info      { --bs-btn-color: #7dd3fc; --bs-btn-border-color: #3f7f9c; }
[data-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--s-text-soft); --bs-btn-border-color: var(--s-border-strong); }

/* ---------- Pestanas ---------------------------------------------- */
.nav-tabs { border-bottom: 1px solid var(--s-border); gap: .15rem; }
.nav-tabs .nav-link {
    border: 0; border-bottom: 2px solid transparent; color: var(--s-text-soft);
    font-weight: 500; font-size: .875rem; padding: .55rem .85rem; border-radius: 0;
}
.nav-tabs .nav-link:hover { border-bottom-color: var(--s-border-strong); color: var(--s-text); }
.nav-tabs .nav-link.active {
    background: transparent; color: var(--s-link);
    border-bottom-color: var(--s-primary); font-weight: 600;
}
.nav-pills .nav-link { color: var(--s-text-soft); font-size: .85rem; border-radius: var(--s-radius-sm); }
.nav-pills .nav-link.active { background: var(--s-primary); }

/* =====================================================================
   PLANIFICADOR / CALENDARIO
   ===================================================================== */
.planner { overflow: auto; border: 1px solid var(--s-border); border-radius: var(--s-radius); background: var(--s-surface); }
.planner table { border-collapse: separate; border-spacing: 0; min-width: max-content; margin: 0; }
.planner th, .planner td { border-right: 1px solid var(--s-border); border-bottom: 1px solid var(--s-border); }

.planner .col-unit {
    position: sticky; left: 0; z-index: 3; background: var(--s-surface);
    min-width: 176px; max-width: 176px; padding: .4rem .65rem;
    box-shadow: 1px 0 0 var(--s-border);
}
.planner thead th {
    position: sticky; top: 0; z-index: 4; background: var(--s-surface-2);
    font-size: .68rem; font-weight: 600; color: var(--s-text-soft);
    text-align: center; padding: .28rem .1rem; min-width: 42px; white-space: nowrap;
}
.planner thead th.col-unit { z-index: 5; text-align: left; font-size: .72rem; }
.planner thead th.is-weekend { background: var(--s-primary-soft); }
.planner thead th.is-today { background: var(--s-primary); color: #fff; }
.planner thead th small { display: block; font-size: .62rem; font-weight: 500; opacity: .75; }

.planner tbody td.day { height: 38px; padding: 0; position: relative; background: var(--s-surface); }
.planner tbody td.day.is-weekend { background: var(--s-surface-2); }
.planner tbody td.day.is-today { box-shadow: inset 2px 0 0 var(--s-primary); }
.planner tbody td.day.is-past { background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(128,140,160,.07) 4px, rgba(128,140,160,.07) 8px); }

.planner .unit-name { font-weight: 600; font-size: .8rem; line-height: 1.2; }
.planner .unit-type { font-size: .7rem; color: var(--s-text-muted); }

.res-bar {
    position: absolute; top: 4px; bottom: 4px; left: 2px;
    border-radius: 7px; padding: 0 .45rem; color: #fff;
    font-size: .715rem; font-weight: 600; line-height: 30px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer; z-index: 2; box-shadow: var(--s-shadow-xs);
    transition: filter .13s, transform .13s;
}
.res-bar:hover { filter: brightness(1.07); transform: translateY(-1px); z-index: 6; }
.res-bar.status-pending     { background: linear-gradient(135deg, #f59e0b, #d97706); }
.res-bar.status-confirmed   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.res-bar.status-checked_in,
.res-bar.status-in_house    { background: linear-gradient(135deg, #10b981, #059669); }
.res-bar.status-checked_out { background: linear-gradient(135deg, #94a3b8, #64748b); }
.res-bar.status-block       { background: repeating-linear-gradient(45deg, #64748b, #64748b 6px, #475569 6px, #475569 12px); }
.res-bar .bar-meta { font-weight: 500; opacity: .88; }
.res-bar.is-unpaid::after {
    content: ''; position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    width: 7px; height: 7px; border-radius: 50%; background: #fecaca;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, .55);
}

/* ---------- Vista mensual ---------------------------------------- */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--s-border); border: 1px solid var(--s-border); border-radius: var(--s-radius); overflow: hidden; }
.month-grid .dow { background: var(--s-surface-2); padding: .4rem; text-align: center; font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--s-text-muted); letter-spacing: .05em; }
.month-grid .day-cell { background: var(--s-surface); min-height: 96px; padding: .35rem .4rem; }
.month-grid .day-cell.is-other { background: var(--s-surface-2); opacity: .6; }
.month-grid .day-cell.is-today .day-num { background: var(--s-primary); color: #fff; }
.month-grid .day-num { font-size: .76rem; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.month-grid .occ-pill { font-size: .66rem; border-radius: 5px; padding: .08rem .3rem; margin-top: .18rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================================
   ADD-ONS
   ===================================================================== */
.addon-card { height: 100%; transition: box-shadow .16s, transform .16s, border-color .16s; }
.addon-card:hover { box-shadow: var(--s-shadow); transform: translateY(-2px); }
.addon-card.is-locked { border-style: dashed; }
.addon-card.is-locked .addon-icon { filter: grayscale(1); opacity: .55; }
.addon-card.is-active { border-color: rgba(18, 161, 80, .4); }
.addon-icon {
    width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
    font-size: 1.32rem; background: var(--s-primary-soft); color: var(--s-link);
}
.addon-lock {
    position: absolute; top: .7rem; right: .7rem;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--s-surface-2); color: var(--s-text-muted);
    display: grid; place-items: center; font-size: .8rem; border: 1px solid var(--s-border);
}

/* =====================================================================
   MOTOR DE RESERVAS / PAGINA PUBLICA
   ===================================================================== */
.pub-body { background: #fff; color: #10131a; font-family: var(--s-font); }
.pub-nav {
    position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .93);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid #ecf0f5;
}
.pub-nav .nav-link { color: #4a5568; font-weight: 500; font-size: .9rem; }
.pub-nav .nav-link:hover { color: var(--pub-primary, #2563eb); }

.pub-hero { position: relative; min-height: 460px; display: flex; align-items: center; color: #fff; overflow: hidden; }
.pub-hero__bg { position: absolute; inset: 0; background-size: cover; background-position: center; transform: scale(1.04); }
.pub-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,14,26,.35) 0%, rgba(8,14,26,.72) 100%); }
.pub-hero__content { position: relative; z-index: 2; width: 100%; }
.pub-hero h1 { font-size: clamp(1.9rem, 4.4vw, 3.2rem); font-weight: 800; letter-spacing: -.033em; text-shadow: 0 2px 22px rgba(0,0,0,.35); }
.pub-hero p.lead { font-size: clamp(.98rem, 1.6vw, 1.16rem); max-width: 42rem; opacity: .95; }

.search-box {
    background: #fff; border-radius: 16px; box-shadow: 0 14px 44px rgba(16,24,40,.18);
    padding: 1.05rem; color: #10131a;
}
.search-box .form-label { color: #6b7688; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.search-box .form-control, .search-box .form-select { border-radius: 10px; }

.room-card { border: 1px solid #e9edf3; border-radius: 14px; overflow: hidden; background: #fff; transition: box-shadow .18s, transform .18s; height: 100%; }
.room-card:hover { box-shadow: 0 10px 30px rgba(16,24,40,.1); transform: translateY(-2px); }
.room-card__img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: #eef1f6; }
.room-card__body { padding: 1rem 1.1rem 1.15rem; }
.room-feature { font-size: .78rem; color: #5b6779; display: inline-flex; align-items: center; gap: .3rem; }
.price-tag { font-size: 1.5rem; font-weight: 800; letter-spacing: -.028em; color: var(--pub-primary, #2563eb); }
.price-tag small { font-size: .75rem; font-weight: 500; color: #7a8698; letter-spacing: 0; }

.engine-steps { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; font-size: .82rem; }
.engine-steps .step { display: flex; align-items: center; gap: .42rem; color: #8b95a6; font-weight: 500; }
.engine-steps .step .num {
    width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center;
    background: #eef1f6; font-size: .76rem; font-weight: 700; color: #8b95a6;
}
.engine-steps .step.is-active { color: var(--pub-primary, #2563eb); }
.engine-steps .step.is-active .num { background: var(--pub-primary, #2563eb); color: #fff; }
.engine-steps .step.is-done { color: #12a150; }
.engine-steps .step.is-done .num { background: #12a150; color: #fff; }
.engine-steps .sep { color: #cdd5e0; }

.summary-sticky { position: sticky; top: 84px; }

.pub-footer { background: #0f1723; color: #97a3b6; padding: 2.6rem 0 1.6rem; margin-top: 3.5rem; font-size: .875rem; }
.pub-footer a { color: #cbd5e1; }
.pub-footer a:hover { color: #fff; }
.pub-footer h6 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .8rem; }

/* =====================================================================
   UTILIDADES
   ===================================================================== */
.text-soft { color: var(--s-text-soft) !important; }
.text-dim  { color: var(--s-text-muted) !important; }
.fs-7 { font-size: .8rem !important; }
.fs-8 { font-size: .72rem !important; }
.fw-semibold { font-weight: 600 !important; }
.cursor-pointer { cursor: pointer; }
.border-soft { border-color: var(--s-border) !important; }
.bg-surface { background: var(--s-surface) !important; }
.bg-surface-2 { background: var(--s-surface-2) !important; }
.rounded-xl { border-radius: var(--s-radius-lg) !important; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { background: var(--s-surface-2); height: .5rem; border-radius: 99px; }
.progress-bar { border-radius: 99px; }

.divider-text {
    display: flex; align-items: center; gap: .75rem; color: var(--s-text-muted);
    font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
    margin: 1.1rem 0;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--s-border); }

.kv-list { display: grid; gap: .1rem; }
.kv-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .34rem 0; border-bottom: 1px dashed var(--s-border); }
.kv-list > div:last-child { border-bottom: 0; }
.kv-list dt, .kv-list .k { color: var(--s-text-muted); font-size: .82rem; font-weight: 500; }
.kv-list dd, .kv-list .v { margin: 0; font-size: .87rem; font-weight: 500; text-align: right; }

/* Impresion */
@media print {
    .app-sidebar, .app-topbar, .app-footer, .mobile-tabbar, .page-head__actions,
    .no-print, .impersonation-bar { display: none !important; }
    .app-main { margin-left: 0; }
    .app-content { padding: 0; }
    .card { border: 1px solid #ddd; box-shadow: none; }
    body { background: #fff; }
}

/* Login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-wrap { grid-template-columns: 1.05fr .95fr; } }
.auth-side {
    background: linear-gradient(150deg, #1e3a8a 0%, #2563eb 45%, #0ea5e9 100%);
    color: #fff; padding: 3rem; display: none; position: relative; overflow: hidden;
}
@media (min-width: 992px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-side::before {
    content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
    background: rgba(255,255,255,.07); top: -150px; right: -170px;
}
.auth-side::after {
    content: ''; position: absolute; width: 330px; height: 330px; border-radius: 50%;
    background: rgba(255,255,255,.05); bottom: -110px; left: -90px;
}
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-form__inner { width: 100%; max-width: 396px; }
.auth-feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.1rem; position: relative; z-index: 2; }
.auth-feature i { font-size: 1.05rem; opacity: .9; margin-top: .15rem; }

/* Los campos de fecha de flatpickr heredan el ancho de su contenedor */
input.flatpickr-input.form-control,
input.form-control.flatpickr-input[readonly] { width: 100%; background: var(--s-surface); }
.flatpickr-calendar { font-family: var(--s-font); font-size: .85rem; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--s-primary); border-color: var(--s-primary); }
.flatpickr-day.inRange { background: var(--s-primary-soft); border-color: var(--s-primary-soft); box-shadow: -5px 0 0 var(--s-primary-soft), 5px 0 0 var(--s-primary-soft); }

/* Importes largos en pantallas estrechas */
@media (max-width: 575.98px) {
    .stat-card .stat-value { font-size: 1.28rem; word-break: break-word; }
    .stat-card .stat-label { font-size: .7rem; }
    .page-head h1 { font-size: 1.24rem; }
    .card-body { padding: .9rem; }
    .card-header { padding: .7rem .9rem; }
    .kv-list dd, .kv-list .v { font-size: .82rem; }
    .modal-dialog { margin: .5rem; }
}

/* Tablas apiladas: separador visual por fila */
@media (max-width: 767.98px) {
    .table-stack tbody tr { box-shadow: var(--s-shadow-xs); }
    .table-stack tbody td:first-child { padding-top: .5rem !important; }
    .table-stack tbody td:last-child { padding-bottom: .5rem !important; }
    .table-stack tbody td .btn-group { margin-left: auto; }
}

/* Calendario de fecha comodo en pantallas tactiles */
@media (max-width: 575.98px) {
    .flatpickr-calendar { width: calc(100vw - 2rem) !important; max-width: 320px; }
    .flatpickr-day { max-width: none; height: 38px; line-height: 38px; }
}

/* =====================================================================
   Widget de chat de la pagina publica (add-on Chatbot IA)
   ===================================================================== */
.schat { position: fixed; bottom: 18px; z-index: 1080; font-size: .92rem; }
.schat--right { right: 18px; }
.schat--left  { left: 18px; }

.schat__fab {
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--schat-color); color: #fff; font-size: 1.35rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.24); cursor: pointer;
  display: grid; place-items: center; transition: transform .18s ease, box-shadow .18s ease;
}
.schat__fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.schat__fab-close { display: none; }
.schat.is-open .schat__fab-open { display: none; }
.schat.is-open .schat__fab-close { display: block; }

.schat__panel {
  position: absolute; bottom: 70px; width: 370px; max-width: calc(100vw - 36px);
  height: 520px; max-height: calc(100vh - 120px);
  background: #fff; border: 1px solid #e3e8ef; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15,23,42,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.schat--right .schat__panel { right: 0; }
.schat--left  .schat__panel { left: 0; }

.schat__head {
  display: flex; align-items: center; gap: .65rem; padding: .75rem .9rem;
  background: var(--schat-color); color: #fff; flex: 0 0 auto;
}
.schat__avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.2); flex: 0 0 auto; }
.schat__name { font-weight: 600; line-height: 1.1; }
.schat__status { font-size: .72rem; opacity: .9; display: flex; align-items: center; gap: .3rem; }
.schat__dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.schat__close { margin-left: auto; background: transparent; border: 0; color: #fff; font-size: 1.05rem;
  opacity: .85; cursor: pointer; }
.schat__close:hover { opacity: 1; }

.schat__log { flex: 1 1 auto; overflow-y: auto; padding: .9rem; display: flex;
  flex-direction: column; gap: .5rem; background: #f7f9fc; }
.schat__row { display: flex; }
.schat__row--user { justify-content: flex-end; }
.schat__bubble { max-width: 82%; padding: .55rem .75rem; border-radius: 14px;
  background: #fff; border: 1px solid #e3e8ef; line-height: 1.45; white-space: pre-wrap;
  word-break: break-word; }
.schat__row--user .schat__bubble { background: var(--schat-color); color: #fff; border-color: transparent; }

.schat__typing { display: flex; gap: 4px; align-items: center; padding: .7rem .8rem; }
.schat__typing span { width: 6px; height: 6px; border-radius: 50%; background: #9aa5b5;
  animation: schatBlink 1.2s infinite ease-in-out; }
.schat__typing span:nth-child(2) { animation-delay: .18s; }
.schat__typing span:nth-child(3) { animation-delay: .36s; }
@keyframes schatBlink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.schat__suggest { display: flex; gap: .35rem; flex-wrap: wrap; padding: .5rem .9rem 0; flex: 0 0 auto; }
.schat__suggest button { border: 1px solid #dbe2ec; background: #fff; border-radius: 999px;
  padding: .22rem .6rem; font-size: .76rem; color: #475569; cursor: pointer; }
.schat__suggest button:hover { border-color: var(--schat-color); color: var(--schat-color); }

.schat__form { display: flex; gap: .4rem; padding: .7rem .9rem .3rem; flex: 0 0 auto; }
.schat__form input { flex: 1 1 auto; border: 1px solid #dbe2ec; border-radius: 999px;
  padding: .5rem .85rem; outline: 0; font-size: .9rem; min-width: 0; }
.schat__form input:focus { border-color: var(--schat-color); }
.schat__form button { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: var(--schat-color); color: #fff; cursor: pointer; }
.schat__legal { font-size: .66rem; color: #94a3b8; text-align: center; padding: .25rem .9rem .6rem; }

@media (max-width: 480px) {
  .schat { bottom: 14px; }
  .schat--right { right: 14px; }
  .schat--left { left: 14px; }
  .schat__panel { width: calc(100vw - 28px); height: min(78vh, 560px); }
}
