/* Font Face Definitions */
@font-face {
    font-family: 'Inter';
    src: url('../webfonts/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../webfonts/Inter-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../webfonts/Inter-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../webfonts/Inter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --primary-teal: #006da0;
    --primary-teal-dark: #005a85;
    --sidebar-width: 260px;
    --text-light: #ffffff;
    --bg-light: #f4f6f8;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);

    /* UI Theme Variables - Light (Default) */
    --body-bg: #f4f6f8;
    --card-bg: #ffffff;
    --text-main: #363636;
    --text-grey: #7a7a7a;
    --border-color: #ededed;
    --topbar-bg: #ffffff;
    --app-page-title-size: 1.65rem;
    --app-page-subtitle-size: 0.9rem;
    --app-page-body-size: 0.95rem;
    --app-page-table-head-size: 0.72rem;
}

[data-theme='dark'] {
    --body-bg: #121212;
    --card-bg: #1e1e1e;
    --text-main: #f5f5f5;
    --text-grey: #b5b5b5;
    --border-color: #333333;
    --topbar-bg: #1e1e1e;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* -----------------------------------------------
   Bulma overrides — theme-aware form elements
   ----------------------------------------------- */
.box,
.modal-card-body,
.modal-card-head,
.modal-card-foot {
    background-color: var(--card-bg);
    color: var(--text-main);
}

.box {
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.modal-card-head,
.modal-card-foot {
    border-color: var(--border-color);
}

.input,
.textarea,
.select select {
    background-color: var(--card-bg);
    color: var(--text-main);
    border-color: var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:hover,
.textarea:hover,
.select select:hover {
    border-color: var(--primary-teal);
}

.input:focus,
.textarea:focus,
.select select:focus,
.input:active,
.textarea:active,
.select select:active {
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 0.125em rgba(0, 109, 160, 0.2);
}

.select:not(.is-multiple):not(.is-loading)::after {
    border-color: var(--text-grey);
}

.label {
    color: var(--text-main);
}

.table {
    background-color: var(--card-bg);
    color: var(--text-main);
}

.table th {
    color: var(--text-grey);
    border-color: var(--border-color);
}

.table td {
    border-color: var(--border-color);
}

.table.is-hoverable tbody tr:not(.is-selected):hover {
    background-color: color-mix(in srgb, var(--primary-teal) 6%, var(--card-bg));
}

.title,
.subtitle {
    color: var(--text-main);
}

.notification {
    background-color: var(--card-bg);
    color: var(--text-main);
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background-color: var(--body-bg);
    color: var(--text-main);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Hierarchy */
h1,
h2,
h3,
.title,
.sidebar-brand {
    font-family: 'Inter', sans-serif !important;
    letter-spacing: -0.02em;
}

.tag,
.stat-number,
.badge,
.schedule-slot .status-tag {
    font-family: 'Inter', sans-serif !important;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Sidebar */
.main-sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-teal);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    color: white;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Mobile Sidebar State */
@media screen and (max-width: 1023px) {
    .main-sidebar {
        transform: translateX(-100%);
    }

    .main-sidebar.is-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }
}

.main-sidebar .logo-area {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* User info section */
.main-sidebar .user-info {
    margin-bottom: 0;
    font-size: 0.8rem;
}

.main-sidebar .user-info .email {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.sidebar-role-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    line-height: 1.4;
}

/* Section labels */
.sidebar-section-label {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.4);
    list-style: none;
}

.main-sidebar .menu-label {
    padding: 0 1.25rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 1rem;
}

/* Menu items */
.main-sidebar .menu-list {
    padding: 0.5rem 0;
    flex: 1;
}

.main-sidebar .menu-list a {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.6rem 1.25rem;
    border-radius: 0;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.main-sidebar .menu-list a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.3);
}

.main-sidebar .menu-list a.is-active {
    background-color: rgba(255, 255, 255, 0.12);
    color: white;
    font-weight: 600;
    border-left-color: white;
}

.main-sidebar .menu-list a.is-active-parent {
    color: white;
    font-weight: 600;
}

.main-sidebar .menu-list a .icon {
    font-size: 0.95rem;
    width: 1.25rem;
    text-align: center;
}

/* Submenu */
.sidebar-submenu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-submenu a {
    padding-left: 2.75rem !important;
    font-size: 0.8rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

.sidebar-submenu a:hover {
    color: white !important;
}

.sidebar-submenu a.is-active {
    color: white !important;
    font-weight: 600 !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-left-color: white !important;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    overflow: hidden;
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.is-active {
    display: block;
}

/* Topbar */
.topbar {
    background: var(--topbar-bg);
    padding: 0.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar .user-actions.buttons {
    flex-wrap: nowrap;
    margin-bottom: 0;
}

.search-bar {
    max-width: 400px;
    width: 100%;
}

/* Ensure Modal is on top of Sidebar */
.modal {
    z-index: 9999;
}

/* Dashboard Grid */
.dashboard-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem;
}

/* Shared module shell for core backoffice views */
.app-module {
    max-width: 1320px;
    margin: 0 auto;
    font-size: var(--app-page-body-size);
    line-height: 1.45;
    padding: 1.25rem;
}

.app-module-section .app-module {
    padding: 0;
}

.app-page-header {
    margin-bottom: 1.25rem !important;
}

.app-page-title.title,
.app-page-title {
    font-size: var(--app-page-title-size) !important;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem !important;
}

.app-page-subtitle {
    margin: 0;
    color: var(--text-grey);
    font-size: var(--app-page-subtitle-size);
    line-height: 1.35;
}

.app-module .label {
    font-size: 0.82rem;
}

.app-module .table th {
    font-size: var(--app-page-table-head-size);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-grey);
    font-weight: 700;
}

.app-module .table td {
    font-size: 0.9rem;
}

.units-mobile-view {
    display: none;
}

.units-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.units-mobile-card {
    margin-bottom: 0;
}

.units-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.units-mobile-actions .buttons {
    margin-bottom: 0;
}

.staff-mobile-view {
    display: none;
}

.staff-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.staff-mobile-card {
    margin-bottom: 0;
}

.staff-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.staff-mobile-actions .buttons {
    margin-bottom: 0;
}

.staff-mobile-line-clamp {
    overflow-wrap: anywhere;
}

.visitas-mobile-view {
    display: none;
}

.visitas-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.visitas-mobile-card {
    margin-bottom: 0;
}

.visitas-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.visitas-mobile-actions .buttons {
    margin-bottom: 0;
}

.visitas-filters-box {
    padding: 1rem;
}

.visitas-filter-actions {
    margin-bottom: 0 !important;
}

.residentes-mobile-view {
    display: none;
}

.residentes-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.residentes-mobile-card {
    margin-bottom: 0;
}

.residentes-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.residentes-filters-box {
    padding: 1rem;
}

.residentes-filter-actions {
    margin-bottom: 0 !important;
}

.resident-picker {
    position: relative;
}

.resident-picker-anchor {
    position: relative;
}

.resident-picker-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 80;
    display: none;
    max-height: min(260px, calc(100vh - 18rem));
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem;
    margin: 0;
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 0.6rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.resident-picker-menu.is-open {
    display: block;
}

/* Prevent modal body from clipping the resident picker floating menu */
.modal-card-body:has(.resident-picker-menu.is-open) {
    overflow: visible;
}

.resident-picker-option {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    border-radius: 0.5rem;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.resident-picker-option:hover,
.resident-picker-option:focus-visible {
    background: #f5f8fa;
    outline: none;
}

.resident-picker-option-code {
    font-weight: 600;
    min-width: 0;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resident-picker-option-building {
    color: #6f7a85;
    font-size: 0.75rem;
    min-width: 0;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.resident-picker-empty {
    display: none;
    margin: 0.25rem 0.25rem 0;
}

.resident-picker-selected {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    min-height: 1.4rem;
}

.resident-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid #d9e2ec;
    border-radius: 0.55rem;
    background: #f8fbfd;
}

.resident-picker-item + .resident-picker-item {
    margin-top: 0.4rem;
}

.resident-picker-item-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.resident-picker-item-label {
    font-size: 0.9rem;
    line-height: 1.25;
    font-weight: 600;
    color: #2a3440;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resident-picker-item-meta {
    font-size: 0.72rem;
    line-height: 1.2;
    color: #546071;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resident-picker-remove {
    flex-shrink: 0;
    min-width: 2rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    border-color: rgba(27, 39, 53, 0.15) !important;
    background: rgba(255, 255, 255, 0.68) !important;
}

.reservas-mobile-view {
    display: none;
}

.reservas-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.reservas-mobile-card {
    margin-bottom: 0;
}

.reservas-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.reservas-list-table td .button {
    white-space: nowrap;
}

.reservas-list-table tbody tr[data-reservation-id]:hover {
    background-color: var(--hover-bg, #f5f5f5);
}

.reservas-mobile-card[data-reservation-id]:active {
    opacity: 0.85;
}

.encomiendas-mobile-view {
    display: none;
}

.encomiendas-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.encomiendas-mobile-card {
    margin-bottom: 0;
}

.encomiendas-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.encomiendas-list-table td .button {
    white-space: nowrap;
}

.bitacora-mobile-view {
    display: none;
}

.bitacora-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.bitacora-mobile-card {
    margin-bottom: 0;
}

.bitacora-mobile-message {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bitacora-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.bitacora-mobile-actions .buttons {
    margin-bottom: 0 !important;
}

.finance-results-box {
    padding: 1.25rem;
}

.finance-mobile-view {
    display: none;
}

.finance-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.finance-mobile-card {
    margin-bottom: 0;
}

.finance-mobile-actions .buttons {
    margin-bottom: 0 !important;
}

/* ===== Cobranzas Mobile ===== */
.cobranzas-mobile-view {
    display: none;
}

.cobranzas-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.cobranzas-mobile-card {
    margin-bottom: 0;
}

.cobranzas-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* ===== Finance Report Mobile ===== */
.report-expenses-mobile-view {
    display: none;
}

.report-delinquent-mobile-view {
    display: none;
}

/* ===== Budget Mobile ===== */
.budget-mobile-view {
    display: none;
}

.budget-mobile-list {
    display: grid;
    gap: 0.75rem;
}

.budget-mobile-card {
    margin-bottom: 0;
}

.budget-mobile-meta .column {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.budget-mobile-actions .buttons {
    margin-bottom: 0 !important;
}

/* Budget needs card view at a higher breakpoint because the 15-col table needs ~1300px */
@media screen and (max-width: 1215px) {
    .budget-desktop-view {
        display: none;
    }

    .budget-mobile-view {
        display: block;
    }

    #budget-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #budget-module .app-page-header .level-left,
    #budget-module .app-page-header .level-right {
        width: 100%;
    }

    #budget-module .budget-header-right {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .budget-mobile-actions .buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .budget-mobile-actions .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #budget-module #modal-add-line .modal-card-foot,
    #budget-module #modal-edit-line .modal-card-foot {
        flex-wrap: wrap;
    }

    #budget-module #modal-add-line .modal-card-foot .button,
    #budget-module #modal-edit-line .modal-card-foot .button {
        width: 100%;
    }
}

@media screen and (max-width: 768px) {
    .app-module {
        padding: 0.75rem;
    }

    .app-page-title.title,
    .app-page-title {
        font-size: 1.4rem !important;
    }

    #units-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #units-module .app-page-header .level-left,
    #units-module .app-page-header .level-right,
    #units-module .app-page-header .level-item {
        width: 100%;
    }

    #units-module .app-page-header .buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    #units-module .app-page-header .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    .units-filter-controls {
        margin-bottom: 0.5rem !important;
    }

    .units-filter-controls .units-filter-col {
        width: 100%;
        min-width: 0 !important;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    .units-filter-actions {
        display: flex;
        width: 100%;
        gap: 0.5rem;
    }

    .units-filter-actions .control {
        flex: 1;
    }

    .units-filter-actions .button {
        width: 100%;
    }

    .units-desktop-view {
        display: none;
    }

    .units-mobile-view {
        display: block;
    }

    .units-mobile-actions .buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .units-mobile-actions .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #units-module .units-count {
        font-size: 0.82rem;
        padding: 0 0.25rem;
    }

    #units-module .units-pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #units-module .units-pagination .pagination-previous,
    #units-module .units-pagination .pagination-next {
        flex: 1 1 calc(50% - 0.25rem);
        margin: 0;
    }

    #units-module .units-pagination .pagination-list {
        flex: 1 1 100%;
        margin: 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    #staff-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #staff-module .app-page-header .level-left,
    #staff-module .app-page-header .level-right,
    #staff-module .app-page-header .level-item {
        width: 100%;
    }

    #staff-module .app-page-header .level-right .button {
        width: 100%;
    }

    .staff-desktop-view {
        display: none;
    }

    .staff-mobile-view {
        display: block;
    }

    .staff-mobile-actions .buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .staff-mobile-actions .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #visitas-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #visitas-module .app-page-header .level-left,
    #visitas-module .app-page-header .level-right,
    #visitas-module .app-page-header .level-item {
        width: 100%;
    }

    #visitas-module .app-page-header .buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    #visitas-module .app-page-header .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #visitas-module .visitas-filters-box {
        padding: 0.75rem;
    }

    #visitas-module .visitas-filter-controls {
        margin-bottom: 0 !important;
    }

    #visitas-module .visitas-filter-controls .column {
        width: 100%;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    #visitas-module .visitas-filter-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    #visitas-module .visitas-filter-actions .button {
        flex: 1;
        margin: 0 !important;
    }

    #reservas-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #reservas-module .app-page-header .level-left,
    #reservas-module .app-page-header .level-right,
    #reservas-module .app-page-header .level-item {
        width: 100%;
    }

    #reservas-module .app-page-header .level-right {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
    }

    #reservas-module .app-page-header .level-right .level-item {
        width: auto;
        flex: none;
    }

    #reservas-module .app-page-header .level-right .level-item:last-child {
        flex: 1;
    }

    #reservas-module .app-page-header .level-right .level-item:last-child .button {
        width: 100%;
    }

    #reservas-module .reservas-view-toggle {
        flex-wrap: nowrap;
    }

    .reservas-desktop-view {
        display: none;
    }

    .reservas-mobile-view {
        display: block;
    }

    .reservas-mobile-list {
        padding: 0.75rem !important;
    }

    .reservas-mobile-actions .button {
        width: 100%;
    }

    #encomiendas-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #encomiendas-module .app-page-header .level-left,
    #encomiendas-module .app-page-header .level-right,
    #encomiendas-module .app-page-header .level-item {
        width: 100%;
    }

    #encomiendas-module .app-page-header .level-right .button {
        width: 100%;
    }

    #encomiendas-module .encomiendas-filter-tags {
        margin-bottom: 0.75rem !important;
    }

    .encomiendas-desktop-view {
        display: none;
    }

    .encomiendas-mobile-view {
        display: block;
    }

    .encomiendas-mobile-list {
        padding: 0.75rem !important;
    }

    .encomiendas-mobile-actions .button {
        width: 100%;
    }

    #encomiendas-module .pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #encomiendas-module .pagination .pagination-previous,
    #encomiendas-module .pagination .pagination-next {
        flex: 1 1 calc(50% - 0.25rem);
        margin: 0;
    }

    #encomiendas-module .pagination .pagination-list {
        flex: 1 1 100%;
        margin: 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    #bitacora-module .bitacora-filters-box {
        padding: 0.75rem 0.75rem 0 !important;
    }

    #bitacora-module .bitacora-filter-controls {
        margin-bottom: 0 !important;
        gap: 0.5rem !important;
    }

    #bitacora-module .bitacora-filter-controls .column {
        width: 100%;
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
    }

    #bitacora-module .bitacora-filter-controls .field.is-horizontal {
        display: block;
    }

    #bitacora-module .bitacora-filter-controls .field-label {
        margin-right: 0;
        margin-bottom: 0.25rem;
        text-align: left;
    }

    #bitacora-module .bitacora-filter-controls .field-label .label {
        font-size: 0.75rem;
    }

    #bitacora-module .bitacora-filter-controls .field-body,
    #bitacora-module .bitacora-filter-controls .field,
    #bitacora-module .bitacora-filter-controls .control,
    #bitacora-module .bitacora-filter-controls .select,
    #bitacora-module .bitacora-filter-controls .select select,
    #bitacora-module .bitacora-filter-controls input {
        width: 100%;
    }

    .bitacora-desktop-view {
        display: none;
    }

    .bitacora-mobile-view {
        display: block;
    }

    .bitacora-mobile-list {
        padding: 0.75rem !important;
    }

    .bitacora-mobile-actions .buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .bitacora-mobile-actions .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #bitacora-module .pagination {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #bitacora-module .pagination .pagination-previous,
    #bitacora-module .pagination .pagination-next {
        flex: 1 1 calc(50% - 0.25rem);
        margin: 0;
    }

    #bitacora-module .pagination .pagination-list {
        flex: 1 1 100%;
        margin: 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    #finance-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #finance-module .app-page-header .level-left,
    #finance-module .app-page-header .level-right,
    #finance-module .app-page-header .level-item {
        width: 100%;
    }

    #finance-module .finance-header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    #finance-module .finance-header-actions .button {
        width: 100%;
        margin: 0 !important;
    }

    #finance-module .finance-period-nav {
        align-items: stretch;
        margin-bottom: 1rem !important;
    }

    #finance-module .finance-period-nav .level-left {
        width: 100%;
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        gap: 0.5rem;
        align-items: center;
    }

    #finance-module .finance-period-nav .level-item {
        width: 100%;
        margin-right: 0 !important;
    }

    #finance-module .finance-period-nav .button {
        width: 100%;
    }

    #finance-module .finance-period-nav .field,
    #finance-module .finance-period-nav .control,
    #finance-module .finance-period-nav .select,
    #finance-module .finance-period-nav .select select {
        width: 100%;
    }

    #finance-module .finance-stats {
        margin-bottom: 1rem !important;
    }

    #finance-module .finance-stats .column {
        width: 100%;
    }

    #finance-module .finance-results-box {
        padding: 0.75rem;
    }

    .finance-desktop-view {
        display: none;
    }

    .finance-mobile-view {
        display: block;
    }

    .finance-mobile-actions .buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .finance-mobile-actions .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #finance-module #modal-new-expense .modal-card-foot,
    #finance-module #modal-edit-expense .modal-card-foot {
        flex-wrap: wrap;
    }

    #finance-module #modal-new-expense .modal-card-foot .button,
    #finance-module #modal-edit-expense .modal-card-foot .button {
        width: 100%;
    }

    /* ===== Cobranzas Mobile Responsive ===== */
    #cobranzas-module .app-page-header {
        align-items: stretch;
        gap: 0.75rem;
    }

    #cobranzas-module .app-page-header .level-left,
    #cobranzas-module .app-page-header .level-right {
        width: 100%;
    }

    #cobranzas-module .cobranzas-period-nav {
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        gap: 0.5rem;
        align-items: center;
    }

    #cobranzas-module .cobranzas-period-nav .level-item {
        margin-right: 0 !important;
        justify-content: center;
    }

    #cobranzas-module .cobranzas-filter-controls {
        margin-bottom: 0 !important;
    }

    #cobranzas-module .cobranzas-filter-controls .column {
        width: 100%;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    .cobranzas-desktop-view {
        display: none;
    }

    .cobranzas-mobile-view {
        display: block;
    }

    /* ===== Finance Report Mobile Responsive ===== */
    #finance-report-module .finance-report-period-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    #finance-report-module .finance-report-period-nav .level-left,
    #finance-report-module .finance-report-period-nav .level-right {
        width: 100%;
    }

    #finance-report-module .finance-report-period-nav .level-right .select,
    #finance-report-module .finance-report-period-nav .level-right select {
        width: 100%;
    }

    .report-expenses-desktop-view {
        display: none;
    }

    .report-expenses-mobile-view {
        display: block;
    }

    .report-delinquent-desktop-view {
        display: none;
    }

    .report-delinquent-mobile-view {
        display: block;
    }

    #residentes-module .residentes-filters-box {
        padding: 0.75rem;
    }

    #residentes-module .residentes-filter-controls {
        margin-bottom: 0 !important;
    }

    #residentes-module .residentes-filter-controls .column {
        width: 100%;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    #residentes-module .residentes-filter-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    #residentes-module .residentes-filter-actions .button {
        flex: 1;
        margin: 0 !important;
    }

    .residentes-desktop-view {
        display: none;
    }

    .residentes-mobile-view {
        display: block;
    }

    .residentes-mobile-list {
        padding: 0.75rem !important;
    }

    .visitas-desktop-view {
        display: none;
    }

    .visitas-mobile-view {
        display: block;
    }

    .visitas-mobile-list {
        padding: 0.75rem !important;
    }

    .visitas-mobile-actions .buttons {
        display: block;
    }

    .visitas-mobile-actions .buttons .button {
        width: 100%;
        margin: 0 !important;
    }

    #visita-modal .modal-card,
    #qr-invitation-modal .modal-card {
        width: calc(100% - 1.5rem);
        margin: 0 auto;
        max-height: calc(100vh - 1.5rem);
    }

    #visita-modal .columns.is-mobile {
        display: block;
    }

    #visita-modal .columns.is-mobile .column {
        width: 100%;
    }

    #visita-modal .modal-card-foot {
        flex-direction: column-reverse;
    }

    #visita-modal .modal-card-foot .button {
        width: 100%;
    }
}

/* ===== Dashboard Stat Cards ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card.info .stat-icon {
    background: rgba(50, 152, 220, 0.1);
    color: #3298dc;
}

.stat-card.success .stat-icon {
    background: rgba(72, 199, 142, 0.1);
    color: #48c78e;
}

.stat-card.danger .stat-icon {
    background: rgba(241, 70, 104, 0.1);
    color: #f14668;
}

.stat-card.warning .stat-icon {
    background: rgba(255, 183, 0, 0.12);
    color: #ffb700;
}

/* Glow animation for stat cards with pending items */
.stat-card-glow .stat-card {
    animation: stat-glow 2s ease-in-out infinite;
}

@keyframes stat-glow {
    0%, 100% {
        box-shadow: var(--card-shadow);
    }
    50% {
        box-shadow: 0 0 12px rgba(255, 183, 0, 0.4), 0 0 24px rgba(255, 183, 0, 0.15);
    }
}

[data-theme='dark'] .stat-card-glow .stat-card {
    animation: stat-glow-dark 2s ease-in-out infinite;
}

@keyframes stat-glow-dark {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 12px rgba(255, 183, 0, 0.5), 0 0 24px rgba(255, 183, 0, 0.2);
    }
}

.stat-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-grey);
    font-weight: 700;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--text-grey);
}

/* ===== Resident Unit Info Boxes ===== */
.unit-info-box {
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color, #e8e8e8);
    transition: box-shadow 0.2s;
}

.unit-info-box:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ===== Dashboard Action Cards ===== */
.action-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    height: 100%;
    width: 100%;
    box-shadow: var(--card-shadow);
    color: inherit;
    text-decoration: none;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    border-color: var(--primary-teal);
    color: inherit;
}

.action-card:active {
    transform: scale(0.98);
}

.action-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.action-content {
    min-width: 0;
}

.action-content p {
    line-height: 1.3;
    margin-bottom: 0;
}

@media screen and (max-width: 768px) {
    .action-card {
        flex-direction: column;
        text-align: center;
        padding: 1rem 0.5rem;
    }
}

/* ===== Dashboard Hero Card (Admin) ===== */
.dash-hero-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-teal);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
}

.dash-hero-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(0, 109, 160, 0.1);
    color: var(--primary-teal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ===== Dashboard News Cards ===== */
.dash-news-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: var(--card-shadow);
    border-left: 3px solid var(--primary-teal);
    transition: transform 0.15s ease;
}

.dash-news-card:hover {
    transform: translateX(3px);
}

.dash-news-info {
    border-left-color: #3298dc;
}

.dash-news-success {
    border-left-color: #48c78e;
}

.dash-news-warning {
    border-left-color: #ffdd57;
}

.dash-news-danger {
    border-left-color: #f14668;
}

/* ===== Dashboard Section Card (shared wrapper) ===== */
.dash-section-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.dash-section-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

/* ===== Dashboard Promo Card ===== */
.dash-promo-card {
    background: var(--primary-teal);
    color: white;
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

/* ===== Dashboard Dark Mode ===== */
[data-theme='dark'] .stat-card:hover,
[data-theme='dark'] .action-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

[data-theme='dark'] .dash-news-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.widget-content {
    padding: 1rem 1.5rem;
}

.widget-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f9f9f9;
}

.widget-item:last-child {
    border-bottom: none;
}

.widget-item .avatar {
    width: 40px;
    height: 40px;
    background: #e1e4e8;
    border-radius: 50%;
    margin-right: 1rem;
}

.widget-item .info {
    flex-grow: 1;
}

.widget-item .name {
    font-weight: 600;
    font-size: 0.9rem;
}

.widget-item .meta {
    font-size: 0.8rem;
    color: #8898aa;
}

/* Utility */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Vertical align for tables */
.table.is-vcentered td,
.table.is-vcentered th {
    vertical-align: middle;
}

/* ===== Colillas Card ===== */
.colilla-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s ease;
}

.colilla-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Status left-border accent */
.colilla-card.colilla-success {
    border-left: 3px solid hsl(141, 53%, 53%);
}

.colilla-card.colilla-danger {
    border-left: 3px solid hsl(348, 86%, 61%);
}

.colilla-card.colilla-warning {
    border-left: 3px solid hsl(44, 100%, 77%);
}

/* Colilla header */
.colilla-header {
    background-color: var(--card-bg);
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: none;
    box-shadow: none;
}

.colilla-header .card-header-title {
    color: var(--text-main);
    padding: 0.75rem 1rem;
}

.colilla-header .card-header-icon {
    color: var(--text-grey);
    padding: 0.75rem 1rem;
}

.colilla-header:hover {
    background-color: var(--primary-teal);
}

.colilla-header:hover .card-header-title,
.colilla-header:hover .card-header-title p,
.colilla-header:hover .card-header-icon,
.colilla-header:hover .card-header-icon span {
    color: white !important;
}

.colilla-header:hover .tag {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

/* Status dot */
.colilla-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.colilla-status-dot.is-success {
    background-color: hsl(141, 53%, 53%);
}

.colilla-status-dot.is-danger {
    background-color: hsl(348, 86%, 61%);
}

.colilla-status-dot.is-warning {
    background-color: hsl(44, 100%, 77%);
}

/* Chevron rotation */
.colilla-chevron {
    transition: transform 0.25s ease;
}

.colilla-card.is-active .colilla-chevron {
    transform: rotate(180deg);
}

/* Expandable detail panel */
.colilla-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.colilla-card.is-active .colilla-detail {
    max-height: 300px;
}

.colilla-detail .card-content {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* Dark mode overrides */
[data-theme='dark'] .colilla-card {
    border-color: var(--border-color);
}

[data-theme='dark'] .colilla-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .colilla-detail .card-content {
    border-top-color: var(--border-color);
}

/* Resident Grouped Accordion */
.resident-group-header .resident-chevron,
.resident-group .resident-chevron {
    transition: transform 0.25s ease;
}

.resident-group-header.is-active .resident-chevron,
.resident-group.is-active .resident-chevron {
    transform: rotate(180deg);
}

/* Desktop sub-rows: hidden by default, shown via hyperscript .is-visible */
tr.resident-subrows {
    display: none;
}

tr.resident-subrows.is-visible {
    display: table-row;
}

.resident-subtable {
    background-color: var(--card-bg);
}

.resident-subtable tr td {
    border-top: 1px dashed var(--border-color) !important;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Mobile accordion */
.resident-units-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.resident-group.is-active .resident-units-detail {
    max-height: 1000px;
}

/* Subtle hover on expandable header rows */
tr.resident-group-header {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

tr.resident-group-header:hover {
    background-color: color-mix(in srgb, var(--primary-teal) 8%, var(--card-bg));
}

/* Sidebar Menu Transitions */
.menu-list a {
    transition: all 0.2s ease;
}

/* Chevron Rotation */
.menu-chevron {
    transition: transform 0.3s ease;
}

.menu-chevron.is-rotated {
    transform: rotate(-90deg);
}



/* Table Tags - Uniform Sizing */
.table .tag {
    min-width: 80px;
    justify-content: center;
    font-weight: 500;
}

.table .tag.is-light {
    min-width: 60px;
}

/* Estado tags (Status) - wider for text */
.table tbody tr td:nth-child(2) .tag {
    min-width: 110px;
}

/* Unidad tags - smaller, centered */
.table .tag.is-info.is-light {
    min-width: 50px;
    font-weight: 600;
}

/* Invitados y Finalizado tags */
.table .tag.is-success,
.table .tag.is-light {
    min-width: 70px;
}

/* Icon spacing in tags */
.tag i {
    margin-right: 0.4em;
}

/* Icon spacing in buttons */
.button .icon+span,
.button span+.icon {
    margin-left: 0.25em;
}

/* Contabilidad table - Better vertical alignment */
.table td {
    vertical-align: middle;
    padding: 0.75rem;
}

/* Center specific columns in contabilidad tables */
.table tbody tr td:nth-child(4),
/* Cheque */
.table tbody tr td:nth-child(5),
/* Conciliado */
.table tbody tr td:nth-child(6),
/* Pagado */
.table tbody tr td:nth-child(9),
/* N° Recaudad */
.table tbody tr td:nth-child(10) {
    /* Actions */
    text-align: center;
}

/* Right align money column */
.table tbody tr td:nth-child(8) {
    /* Monto */
    text-align: right;
}

/* Footer totals alignment */
.table tfoot tr td:nth-child(8) {
    text-align: right;
}

/* Fix for dropdown menus being clipped by table containers */
.table-container {
    overflow: visible !important;
}

.box {
    overflow: visible !important;
}

/* Budget table needs scroll containment — override the dropdown fix above */
#budget-module .budget-desktop-view .table-container {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

#budget-module .budget-desktop-view .box {
    overflow: hidden !important;
}

/* Ensure dropdown menus are always on top */
.dropdown-menu {
    z-index: 1000 !important;
}

/* Fix for Topbar alignment */
.topbar {
    height: 64px;
    z-index: 100;
}

.topbar .search-bar-container {
    display: flex;
    align-items: center;
}

.topbar .user-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Modal z-index fix */
.modal {
    z-index: 2000 !important;
}

.modal.is-active {
    display: flex !important;
}

/* Reservas Calendar Specialized Styles */
.reservas-calendar-box {
    padding: 1.25rem;
}

.calendar-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.calendar-title-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calendar-title-nav h3 {
    margin: 0 0.25rem;
    white-space: nowrap;
    min-width: 160px;
    text-align: center;
}

.calendar-filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.reservas-view-toggle {
    margin-bottom: 0 !important;
}

.reservas-filter-tag {
    transition: all 0.15s ease;
    opacity: 0.65;
}

.reservas-filter-tag:hover {
    opacity: 0.85;
}

.reservas-filter-tag.is-active {
    opacity: 1;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reservation-slots-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

#reservation-overlap-warning {
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
}

#reservation-slots-info p {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(100px, 1fr)) !important;
    background-color: #f0f0f0;
    gap: 1px;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Agenda View for Responsive (< 1100px) */
@media screen and (max-width: 1100px) {
    .calendar-grid {
        display: block !important;
        background-color: transparent;
        border: none;
        gap: 0;
    }

    .day-header,
    .calendar-empty-cell {
        display: none !important;
    }

    .calendar-day-cell {
        display: block !important;
        width: 100% !important;
        min-height: auto !important;
        margin-bottom: 1.25rem;
        border: 1px solid #e1e4e8 !important;
        border-radius: 12px !important;
        padding: 1.5rem !important;
        background: white !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    }

    .calendar-day-cell .day-number {
        text-align: left !important;
        font-size: 1.4rem !important;
        border-bottom: 2px solid #f8fafb;
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #2d3748 !important;
    }

    .calendar-day-cell .day-number::after {
        content: attr(data-day-name);
        font-size: 0.95rem;
        color: #718096;
        text-transform: uppercase;
        font-weight: 600;
        letter-spacing: 0.05em;
    }

    .day-status-details {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem;
        padding-top: 0.5rem;
    }

    .schedule-slot,
    .mudanza-slot {
        padding: 0.5rem 0;
        border-bottom: 1px dashed #edf2f7;
    }

    .schedule-slot:last-child,
    .mudanza-slot:last-child {
        border-bottom: none;
    }
}


@media screen and (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(7, 120px) !important;
        /* Fuerza un ancho mínimo por columna */
    }
}

.day-header {
    background-color: #fafafa;
    padding: 10px 5px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #7a7a7a;
    text-transform: uppercase;
}

.calendar-day-cell {
    background-color: #fff;
    min-height: 120px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.calendar-day-cell.is-past-disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background-color: #f5f5f5;
    box-shadow: none;
}

.calendar-day-cell:active,
.is-clicking-day {
    background-color: #f0f7ff !important;
    transform: scale(0.97);
    transition: all 0.1s ease;
}

/* Pulse Animation for Today highlighting */
@keyframes today-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 199, 142, 0.6);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(72, 199, 142, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(72, 199, 142, 0);
    }
}

.is-highlight-today {
    animation: today-pulse 1.5s ease-out;
    border-color: #48c78e !important;
    z-index: 10;
}



.calendar-day-cell:hover {
    background-color: #f9f9f9;
    z-index: 5;
    box-shadow: inset 0 0 0 2px #3298dc;
}

@keyframes modal-date-fade {
    0% {
        box-shadow: 0 0 0 0 rgba(50, 152, 220, 0.45);
        background-color: #e8f4ff;
    }

    100% {
        box-shadow: 0 0 0 12px rgba(50, 152, 220, 0);
        background-color: #ffffff;
    }
}

#create-reservation-form .input.is-modal-date-highlight {
    border-color: #3298dc;
    background-color: #e8f4ff;
}

#create-reservation-form .input.is-modal-date-highlight-fade {
    animation: modal-date-fade 1.2s ease-out;
}

.calendar-day-cell.is-past-disabled:hover {
    background-color: #f5f5f5;
    box-shadow: none;
}

.calendar-day-cell.is-today {
    background-color: #effaf3;
}

.calendar-day-cell.is-today .day-number {
    color: #48c78e;
    font-weight: 800;
}

.calendar-day-cell .day-number {
    text-align: right;
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a4a4a;
}

.calendar-day-cell.is-occupied {
    background-color: #fefefe;
}

.calendar-empty-cell {
    background-color: #fcfcfc;
}

/* Responsive Mobile Lists for Headers and Switchers */
@media screen and (max-width: 1100px) {

    .app-page-header.level.is-mobile {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .app-page-header.level.is-mobile .level-left,
    .app-page-header.level.is-mobile .level-right,
    .app-page-header.level.is-mobile .level-item {
        width: 100%;
    }

    .app-page-header.level.is-mobile .level-right {
        margin-left: 0 !important;
        margin-top: 0.5rem;
    }

    /* Transform level into a vertical list */
    .level:not(.is-mobile) {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .level:not(.is-mobile) .level-left,
    .level:not(.is-mobile) .level-right {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .level:not(.is-mobile) .level-right {
        margin-top: 1rem;
    }

    /* Buttons in switcher should be full width lists on mobile */
    .buttons.has-addons {
        flex-direction: row !important;
        /* Keep internal addons together */
        justify-content: center !important;
        width: auto !important;
        margin-bottom: 0 !important;
    }

    /* Switcher level needs to be special */
    .level-left .buttons.has-addons {
        flex-direction: column !important;
        width: 100% !important;
    }

    .level-left .buttons.has-addons .button {
        width: 100% !important;
        justify-content: flex-start !important;
        margin-bottom: 2px !important;
        border-radius: 6px !important;
    }

    /* Calendar Header Mobile */
    .calendar-header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .calendar-title-nav {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .calendar-title-nav h3 {
        font-size: 1.3rem !important;
        font-weight: 700 !important;
        min-width: auto;
    }

    .calendar-filter-group {
        width: 100%;
    }

    .calendar-filter-group .field,
    .calendar-filter-group .control,
    .calendar-filter-group .select,
    .calendar-filter-group .select select {
        width: 100% !important;
    }

    .reservas-calendar-box {
        padding: 1rem;
    }

    .breadcrumb ul {
        justify-content: center;
    }
}

@media screen and (max-width: 420px) {
    .app-module {
        padding: 0.5rem;
    }

    .app-page-header .app-page-title,
    .app-page-header .app-page-title.title {
        font-size: 1.2rem !important;
    }

    .app-page-header .breadcrumb ul {
        flex-wrap: wrap;
        gap: 0.25rem 0.5rem;
        justify-content: flex-start;
    }

    .app-page-header .buttons:not(.has-addons) {
        display: flex !important;
        flex-direction: column !important;
        width: 100%;
        gap: 0.5rem;
    }

    .app-page-header .buttons:not(.has-addons) .button {
        width: 100%;
        margin: 0 !important;
    }

    #units-module .app-page-header .buttons,
    #staff-module .app-page-header .buttons,
    #visitas-module .app-page-header .buttons,
    #reservas-module .app-page-header .buttons {
        grid-template-columns: 1fr !important;
    }

    #visitas-module .visitas-filter-actions {
        flex-direction: column;
    }

    #visitas-module .visitas-filter-actions .button {
        width: 100%;
    }

    #visitas-module .visitas-mobile-meta .column.is-half {
        width: 100%;
    }

    #residentes-module .residentes-filter-actions {
        flex-direction: column;
    }

    #residentes-module .residentes-filter-actions .button {
        width: 100%;
    }

    #residentes-module .residentes-mobile-meta .column.is-half {
        width: 100%;
    }

    #reservas-module .app-page-header .level-right {
        flex-direction: column;
        gap: 0.5rem;
    }

    #reservas-module .app-page-header .level-right .level-item {
        width: 100% !important;
        flex: none !important;
    }

    #reservas-module .reservas-view-toggle {
        width: 100%;
        justify-content: center;
    }

    #reservas-module .reservas-view-toggle .button {
        flex: 1;
    }

    #reservas-module .app-page-header .level-right .level-item:last-child .button {
        width: 100%;
    }

    #reservas-module .reservas-mobile-meta .column.is-half {
        width: 100%;
    }

    #encomiendas-module .encomiendas-mobile-meta .column.is-half {
        width: 100%;
    }

    #bitacora-module .bitacora-mobile-meta .column.is-half {
        width: 100%;
    }

    #bitacora-module .bitacora-mobile-actions .buttons {
        grid-template-columns: 1fr;
    }

    #finance-module .finance-header-actions {
        grid-template-columns: 1fr;
    }

    #finance-module .finance-period-nav .level-left {
        grid-template-columns: 1fr;
    }

    #finance-module .finance-mobile-actions .buttons {
        grid-template-columns: 1fr;
    }

    #cobranzas-module .cobranzas-mobile-meta .column.is-half {
        width: 100%;
    }

    #cobranzas-module .cobranzas-summary-cards .column {
        width: 50%;
    }

    #budget-module .budget-mobile-actions .buttons {
        grid-template-columns: 1fr;
    }

    #budget-module .budget-mobile-meta .column.is-half {
        width: 100%;
    }

    #budget-module .budget-header-right {
        flex-direction: column;
        align-items: stretch;
    }

    #finance-report-module .finance-report-period-nav .field.has-addons {
        width: 100%;
        display: flex;
    }

    #finance-report-module .finance-report-period-nav .field.has-addons .control:nth-child(2) {
        flex: 1;
    }
}


/* Topbar Mobile Alignment */
@media screen and (max-width: 1023px) {
    .topbar {
        padding: 0 0.75rem !important;
        gap: 0.25rem;
    }

    .topbar .user-actions {
        gap: 0.15rem !important;
    }

    .topbar .user-actions .button {
        width: 32px !important;
        height: 32px !important;
    }

    .topbar .button.is-text {
        padding-left: 0;
        padding-right: 0.5rem;
    }

    /* Mobile context switcher dropdown positioning */
    .context-switcher-mobile .dropdown-menu {
        left: -0.5rem;
    }
}

/* iPhone SE and very small screens (320px) */
@media screen and (max-width: 374px) {
    .topbar {
        padding: 0 0.4rem !important;
    }

    .topbar .user-actions {
        gap: 0.1rem !important;
    }

    .topbar .user-actions .button {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.8rem;
    }

    .context-switcher-btn {
        padding: 0.25rem 0.4rem;
        gap: 0.3rem;
    }

    .context-switcher-btn-icon {
        width: 1.2rem;
        height: 1.2rem;
        font-size: 0.5rem;
    }

    .context-switcher-btn-community {
        font-size: 0.55rem;
    }

    .context-switcher-btn-role {
        font-size: 0.7rem;
    }

    .context-switcher-mobile .dropdown-menu {
        left: -0.25rem;
        min-width: calc(100vw - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
    }

    .context-switcher-item {
        font-size: 0.8rem;
        padding: 0.45rem 0.75rem;
    }
}

/* Fix for vertical text in screenshots */
.title.is-5 {
    min-width: fit-content;
}

/* Improved spacing for icons in topbar */
.topbar .icon {
    margin: 0 0.5rem;
}

/* Search bar on mobile (if visible) */
.topbar .search-bar-container.is-flex-mobile {
    margin-right: 0.5rem;
    flex: 1;
}

/* Improved Topbar layout */
.topbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    height: 70px !important;
    padding: 0 1.5rem !important;
}

.topbar .is-flex {
    flex-wrap: nowrap !important;
}

.topbar .field {
    margin-bottom: 0 !important;
}

/* Ensure action dropdowns are always on top and visible */
.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
}

/* ── Context Switcher: Mobile trigger button ── */
.context-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    background: var(--card-bg, #f8f8f8);
    cursor: pointer;
    max-width: 100%;
    font-family: inherit;
    font-size: inherit;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.context-switcher-btn:active {
    background: var(--hover-bg, #efefef);
}

.context-switcher-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 6px;
    background: var(--primary, hsl(217, 71%, 53%));
    color: #fff;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.context-switcher-btn-community {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.55;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.context-switcher-btn-role {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.context-switcher-btn-chevron {
    font-size: 0.45rem;
    opacity: 0.35;
    flex-shrink: 0;
    margin-left: 0.1rem;
}

/* ── Context Switcher: Dropdown items ── */
.context-switcher-section {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.4;
    padding: 0.5rem 1rem 0.25rem;
    margin: 0;
}

.context-switcher-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-color, #363636);
    transition: background-color 0.15s ease;
    border-radius: 4px;
    margin: 0 0.35rem;
}

.context-switcher-item:hover {
    background: var(--hover-bg, #f5f5f5);
    color: var(--text-color, #363636);
}

.context-switcher-item.is-current {
    background: var(--primary-light, hsl(217, 71%, 96%));
    font-weight: 600;
}

.context-switcher-item.is-current:hover {
    background: var(--primary-light, hsl(217, 71%, 96%));
}

.context-switcher-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    font-size: 0.75rem;
    opacity: 0.5;
}

.context-switcher-item.is-current .context-switcher-item-icon {
    opacity: 1;
    color: var(--primary, hsl(217, 71%, 53%));
}

.context-switcher-item-label {
    flex: 1;
}

.context-switcher-item-check {
    font-size: 0.65rem;
    color: var(--primary, hsl(217, 71%, 53%));
}

/* ── Context Switcher: Desktop dropdown polish ── */
.context-switcher .dropdown-item {
    transition: background-color 0.15s ease;
    border-radius: 4px;
    margin: 0 0.25rem;
}

.context-switcher .dropdown-item:hover:not(.is-active) {
    background-color: var(--hover-bg, #f5f5f5);
}

.context-switcher .dropdown-item.is-active {
    background-color: var(--primary-light, hsl(217, 71%, 96%));
    color: var(--text-color, #363636);
}

/* Fix for table rows vertical alignment */
.table td {
    vertical-align: middle !important;
}

/* Modal z-index and display (consolidated) */

/* Ensure the content area has enough scrolling space */
.main-content {
    overflow: hidden;
    height: 100vh;
}

.dashboard-container {
    height: calc(100vh - 70px);
    overflow-y: auto;
}

/* Global Fixes for UI Inconsistencies */

/* Topbar - Force horizontal and middle alignment */
.topbar {
    height: 64px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 1.5rem !important;
    background: var(--topbar-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
    flex-wrap: nowrap !important;
}

.topbar .is-flex {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
}

.topbar .field {
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.topbar .user-actions {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    gap: 0.5rem !important;
}

/* Ensure icon buttons in topbar are equal sized and aligned */
.topbar .user-actions .button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Community selector dropdown matches trigger button width */
.topbar .dropdown {
    position: relative;
}

.topbar .dropdown .dropdown-menu {
    min-width: 100%;
}

/* Ensure dropdowns are not cut off by table scroll or box overflow */
.table-container,
.box {
    overflow: visible !important;
}

/* Fix dropdown menu positioning */
.dropdown-menu {
    min-width: 160px;
    z-index: 1000 !important;
}

/* Modal backdrop fix */
.modal-background {
    background-color: rgba(10, 10, 10, 0.6) !important;
}

/* Fix for Level alignment in headers */
.level.is-mobile {
    display: flex !important;
}

.level.is-mobile .level-left,
.level.is-mobile .level-right {
    display: flex !important;
    align-items: center !important;
}

.level.is-mobile .level-left {
    flex-shrink: 1;
}

.level.is-mobile .level-right {
    flex-shrink: 0;
    margin-left: 1rem;
}
/* Dropdown Hover Stability Fix */
.dropdown.is-hoverable .dropdown-menu {
    display: none;
    top: 100%;
    margin-top: -5px; /* Reducir gap visual */
    padding-top: 5px; /* Zona segura invisible */
}

.dropdown.is-hoverable:hover .dropdown-menu {
    display: block;
}

/* Puente invisible para evitar que se cierre al mover el mouse */
.dropdown.is-hoverable:hover .dropdown-menu::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
    z-index: 100;
}

/* Pricing Update Animation */
@keyframes pulse-text {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); color: var(--primary-teal); }
  100% { transform: scale(1); }
}
.pulse-text { animation: pulse-text 0.3s ease-in-out; }

/* ===== Searchable Unit Selector ===== */
.unit-search-selector {
    position: relative;
}

.unit-search-count {
    position: absolute;
    right: 0;
    margin-top: 0.25rem;
    font-size: 0.65rem !important;
    opacity: 0.7;
}

.unit-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 2px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* Prevent modal body from clipping the absolute-positioned dropdown */
.modal-card-body:has(.unit-search-dropdown.is-active) {
    overflow: visible;
}

.unit-search-dropdown.is-active {
    display: block;
}

.unit-search-results {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.unit-search-results::-webkit-scrollbar {
    width: 6px;
}

.unit-search-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.unit-search-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    transition: background-color 0.1s ease;
}

.unit-search-item:hover,
.unit-search-item.is-active {
    background-color: hsl(217, 71%, 96%);
}

.unit-search-empty {
    padding: 0.5rem 0.75rem;
    text-align: center;
    color: var(--text-grey);
    font-size: 0.8rem;
}

[data-theme='dark'] .unit-search-item:hover,
[data-theme='dark'] .unit-search-item.is-active {
    background-color: #2a2a2a;
}

[data-theme='dark'] .unit-search-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===== Visit Parking Spot Selector ===== */
.visit-parking-selector {
    position: relative;
}

.parking-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.parking-search-dropdown.is-active {
    display: block;
}

.modal-card-body:has(.parking-search-dropdown.is-active) {
    overflow: visible;
}

.parking-search-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-main);
    transition: background-color 0.1s ease;
}

.parking-search-item:hover {
    background-color: hsl(217, 71%, 96%);
}

.parking-search-item.is-reserved {
    font-weight: 600;
}

.parking-group-header {
    padding: 4px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-grey);
    background: var(--body-bg);
}

.parking-search-empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-grey);
    font-size: 0.875rem;
}

[data-theme='dark'] .parking-search-item:hover {
    background-color: #2a2a2a;
}

[data-theme='dark'] .parking-search-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Command Palette */
.search-result-item {
    border-left: 4px solid transparent;
    transition: all 0.1s ease;
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.is-selected {
    background-color: #f5f9ff;
    border-left-color: var(--primary-teal);
}

[data-theme='dark'] .search-result-item:hover,
[data-theme='dark'] .search-result-item.is-selected {
    background-color: #2a2a2a;
}

[data-theme='dark'] #search-results-dropdown {
    border-color: #444 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

/* Mobile Search Modal */
.mobile-search-modal-content {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    padding: 0.75rem;
}

.mobile-search-results {
    max-height: 65vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-search-results::-webkit-scrollbar {
    width: 4px;
}

.mobile-search-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

@media screen and (min-width: 769px) {
    .mobile-search-modal-content {
        max-width: 500px;
        margin: 2rem auto;
    }
}

[data-theme='dark'] #mobile-search-modal .box {
    border-color: #444;
}

/* ===== Dashboard Table Headers ===== */
.dash-table-th {
    color: var(--text-grey);
}

/* ===== Bitacora Table Styles ===== */
.bitacora-table thead tr {
    background-color: var(--body-bg);
}

.bitacora-table th {
    color: var(--text-grey);
}

/* ===== Auth Pages ===== */
.login-hero {
    background: linear-gradient(135deg, rgba(0, 109, 160, 0.4), rgba(0, 0, 0, 0.6)),
        url('/static/img/login-bg.png') center/cover no-repeat;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.4s ease-out; }

/* password visibility toggle */
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #7a7a7a;
    z-index: 2;
}
.password-toggle:hover { color: #363636; }
.password-wrapper { position: relative; }

/* ===== Apart-hotel modals ===== */
.apart-hotel-modal-card {
    max-width: 700px;
    width: 95%;
}

@media screen and (max-width: 768px) {
    .apart-hotel-modal-card {
        max-width: 100%;
        width: 100%;
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
    }
    .apart-hotel-modal-card .modal-card-body {
        flex-grow: 1;
    }
}

/* =========================
   Impersonation Banner
   ========================= */
.impersonation-banner {
    background: linear-gradient(135deg, #ff6b35, #e55a2b);
    color: white;
    padding: 0.5rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

[data-theme='dark'] .impersonation-banner {
    background: linear-gradient(135deg, #cc5528, #b34820);
}
