/* ==========================================================================
   HERMES - Sistema de Administración de Condominios
   Diseño moderno, sin frameworks externos. Pensado para funcionar en LAN.
   Paleta: azul pizarra + acento verde, grises neutros.
   ========================================================================== */

:root {
    /* Paleta */
    --color-bg:        #f4f6f9;
    --color-surface:   #ffffff;
    --color-surface-2: #f8fafc;
    --color-border:    #e2e8f0;

    --color-primary:        #0f4c75;   /* azul pizarra (evolución del #0B5686) */
    --color-primary-dark:   #0a3556;
    --color-primary-light:  #3282b8;

    --color-accent:     #16a34a;       /* verde */
    --color-accent-dk:  #15803d;
    --color-danger:     #dc2626;
    --color-warning:    #d97706;
    --color-info:       #2563eb;

    --color-text:       #1e293b;
    --color-text-soft:  #475569;
    --color-text-mute:  #94a3b8;

    /* Tipografía */
    --font-sans: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Consolas', 'Courier New', monospace;

    /* Radios y sombras */
    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow:    0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);

    --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

/* ----- Reset ligero ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(50, 130, 184, .25), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(22, 163, 74, .18), transparent 45%),
        linear-gradient(135deg, #0a3556 0%, #0f4c75 60%, #3282b8 100%);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeUp .35s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-head {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: #fff;
    padding: 26px 28px 22px;
    text-align: center;
}
.login-head .logo {
    width: 56px; height: 56px;
    margin: 0 auto 10px;
    background: rgba(255, 255, 255, .12);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
}
.login-head h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.login-head p  { margin: 4px 0 0; font-size: 12px; opacity: .8; }

.login-body { padding: 26px 28px 12px; }
.login-body .alert { margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-soft);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.input, input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.input:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(50, 130, 184, .18);
}
textarea { resize: vertical; min-height: 80px; }

.login-footer {
    padding: 0 28px 22px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-accent  { background: var(--color-accent); color: #fff; }
.btn-accent:hover  { background: var(--color-accent-dk); text-decoration: none; }
.btn-danger  { background: var(--color-danger); color: #fff; }
.btn-danger:hover  { background: #b91c1c; text-decoration: none; }
.btn-ghost {
    background: var(--color-surface);
    color: var(--color-text-soft);
    border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-2); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ----- Alertas --------------------------------------------------------- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ==========================================================================
   DASHBOARD (reemplaza los <frameset>)
   ========================================================================== */
.dash {
    display: grid;
    grid-template-rows: 64px 1fr;
    grid-template-areas:
        "topbar"
        "main";
    min-height: 100vh;
}

/* ----- Topbar ---------------------------------------------------------- */
.topbar {
    grid-area: topbar;
    background: linear-gradient(90deg, var(--color-primary-dark), var(--color-primary));
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 14px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 30;
}

/* Botón hamburguesa (solo móvil) */
.btn-menu {
    display: none;            /* por defecto oculto; se muestra en móvil */
    flex: 0 0 auto;
    width: 40px; height: 40px;
    background: rgba(255, 255, 255, .12);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
}
.btn-menu .burger,
.btn-menu .burger::before,
.btn-menu .burger::after {
    content: '';
    display: block;
    width: 20px; height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.btn-menu .burger { position: relative; }
.btn-menu .burger::before { position: absolute; top: -6px; }
.btn-menu .burger::after  { position: absolute; top: 6px; }
.btn-menu:hover { background: rgba(255, 255, 255, .22); }

.topbar .context {
    display: flex; align-items: center; gap: 12px;
    font-size: 13px; opacity: .92;
    flex-wrap: wrap;
}
.topbar .context .chip {
    background: rgba(255, 255, 255, .12);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
}
.topbar .spacer { flex: 1; }

/* ----- Menú desplegable de la barra superior (escritorio) ------------- */
.topbar-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}
.dropdown { position: relative; }
.menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}
.menu-trigger:hover { background: rgba(255, 255, 255, .14); }
.menu-trigger .caret {
    font-size: 10px; opacity: .8;
    transition: transform var(--transition);
}
.dropdown.open .menu-trigger { background: rgba(255, 255, 255, .2); }
.dropdown.open .menu-trigger .caret { transform: rotate(180deg); }
.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 40;
}
.dropdown.open .menu-dropdown {
    display: block;
    animation: fadeIn .12s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ----- Menú de cuenta (avatar) tipo Google ---------------------------- */
.dropdown-account { margin-left: 6px; }
.account-trigger {
    background: transparent;
    border: 0;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    line-height: 0;
}
.account-trigger:hover { background: rgba(255, 255, 255, .18); }
.account-trigger .avatar {
    width: 36px; height: 36px;
    background: rgba(255, 255, 255, .18);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; text-transform: uppercase;
    color: #fff;
}
.dropdown-account .menu-dropdown.account-menu {
    right: 0;                 /* anclado a la derecha, bajo el avatar */
    left: auto;
    min-width: 260px;
    padding: 0;
}
/* Cabecera del menú: avatar grande + nombre + rol */
.account-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 22px 18px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.account-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #fff;
    font-size: 28px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    text-transform: uppercase;
}
.account-info { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.account-name {
    font-size: 15px; font-weight: 600;
    color: var(--color-text);
    max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-role { font-size: 12px; }
.account-company {
    font-size: 12px;
    color: var(--color-text-soft);
    font-weight: 500;
    max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-divider { height: 1px; background: var(--color-border); }

/* Contenedor del botón Salir: botón rojo centrado tipo Google */
.account-actions { padding: 14px 18px 18px; }
.btn-logout-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: var(--color-danger);
    color: #fff;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-logout-menu:hover {
    background: #b91c1c;
    text-decoration: none;
    box-shadow: var(--shadow);
}
.btn-logout-menu:active { transform: translateY(1px); }
.btn-logout-menu .icon { font-size: 16px; }

.topbar .user {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px;
    flex: 0 0 auto;
}
.topbar .user .avatar {
    width: 34px; height: 34px;
    background: rgba(255, 255, 255, .18);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; text-transform: uppercase;
}
.btn-logout {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background var(--transition);
}
.btn-logout:hover { background: rgba(255, 255, 255, .22); text-decoration: none; }

/* ----- Sidebar / Drawer (móvil) --------------------------------------- */
/* Por defecto es un panel lateral oculto (off-canvas). En móvil se abre
   como un drawer con botón hamburguesa y un fondo oscuro semitransparente. */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 35;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    max-width: 85vw;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 0 12px 18px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 36;
    box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: translateX(0); }
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 8px 12px;
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text);
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 1;
}
.sidebar-close {
    background: transparent;
    border: 0;
    color: var(--color-text-soft);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.sidebar-close:hover { background: var(--color-surface-2); }
.nav-group { margin-bottom: 18px; }
.nav-group .nav-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--color-text-mute);
    padding: 0 12px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius);
    color: var(--color-text-soft);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); text-decoration: none; }
.nav-item.active { background: rgba(15, 76, 117, .1); color: var(--color-primary); font-weight: 600; }
.nav-item .icon { font-size: 15px; width: 18px; text-align: center; }

/* ----- Main / iframe --------------------------------------------------- */
.main {
    grid-area: main;
    padding: 20px;
    overflow: hidden;
    display: flex;
}
.frame-shell {
    flex: 1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.frame-shell iframe {
    flex: 1;
    width: 100%;
    border: 0;
    background: var(--color-surface-2);
}
.frame-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-mute);
    text-align: center;
    padding: 40px;
}
.frame-welcome h2 { color: var(--color-text); font-weight: 600; margin: 0 0 8px; }
.frame-welcome p  { margin: 0; max-width: 420px; }

/* ==========================================================================
   PÁGINAS (contenido que carga dentro del iframe)
   ========================================================================== */
.page {
    padding: 18px 22px;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.page-head h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}
.page-head .subtitle {
    font-size: 12px;
    color: var(--color-text-mute);
    margin-top: 2px;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-head {
    background: var(--color-surface-2);
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text);
}
.card-body { padding: 16px; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

/* ----- Tablas ---------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--color-surface);
}
table.data thead th {
    background: var(--color-primary);
    color: #fff;
    text-align: left;
    font-weight: 600;
    padding: 10px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}
table.data thead th.center { text-align: center; }
table.data thead th.right  { text-align: right; }
table.data tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}
table.data tbody tr:nth-child(even) td { background: var(--color-surface-2); }
table.data tbody tr:hover td { background: #eef4fb; }
table.data td.center { text-align: center; }
table.data td.right  { text-align: right; }
table.data td.muted  { color: var(--color-text-mute); }
table.data tfoot td {
    padding: 10px 12px;
    background: var(--color-surface-2);
    font-weight: 700;
    border-top: 2px solid var(--color-primary);
    position: sticky;
    bottom: 0;
    z-index: 2;
}
table.data .zero { color: var(--color-text-mute); }
/* Pie de tabla: total alineado bajo cada columna numérica. */
table.data tfoot td.tfoot-label {
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--color-text-soft);
}
table.data tfoot td.tfoot-num {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-text);
    white-space: nowrap;
}

/* Tabla tipo "planilla" para capturas como cuotas */
table.grid { border-collapse: separate; border-spacing: 4px; }
table.grid th, table.grid td { padding: 4px; text-align: center; }
table.grid input { text-align: center; padding: 6px; }

/* ----- Modal de confirmación ----------------------------------------- */
/* Overlay que cubre toda la pantalla; la ventana flota centrada arriba. */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    transform: translateY(-12px);
    transition: transform var(--transition);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-body {
    padding: 22px 22px 18px;
    font-size: 14px;
    color: var(--color-text);
    text-align: center;
}
.modal-body .modal-icon {
    font-size: 28px;
    margin-bottom: 10px;
    display: block;
}
.modal-actions {
    display: flex;
    gap: 1px;
    border-top: 1px solid var(--color-border);
}
.modal-actions button {
    flex: 1;
    padding: 12px;
    border: 0;
    background: var(--color-surface);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition);
}
.modal-actions button:hover { background: var(--color-surface-2); }
.modal-actions .modal-confirm { color: var(--color-danger); }
.modal-actions .modal-confirm:hover { background: #fef2f2; }
.modal-actions .modal-cancel { color: var(--color-text-soft); }
.modal-actions .modal-cancel:hover { background: var(--color-surface-2); }

/* Tabla de Cuotas de Mantenimiento.
   Ancho de input suficiente para 6 dígitos y margenes holgados.
   table-layout:fixed + min-width evitan que las celdas se compriman;
   si el contenedor es mas angosto aparece scroll horizontal. */
table.cuotas-grid {
    table-layout: fixed;
    min-width: 1020px;   /* etiqueta + 12 meses con su ancho mínimo */
}
table.cuotas-grid th:first-child,
table.cuotas-grid td:first-child { width: 70px; }   /* columna ==/RECIBO/IMPORTE */
table.cuotas-grid th,
table.cuotas-grid td { width: 74px; }               /* cada mes */

/* Casilla de captura (recibo e importe).
   Ocupa TODO el ancho de la columna del mes. */
.cuota-input {
    width: 100%;
    padding: 7px 4px;
    font-size: 13px;
    text-align: center;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    box-sizing: border-box;
}
.cuota-input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(50, 130, 184, .18);
}

/* ----- Tabla con scroll interno (cabecera + pie fijos, body scrollea) ----
   La ventana muestra EXACTAMENTE 20 filas de datos. Si hay más, aparecen
   con scroll interno DENTRO de la tabla. Cabecera (thead) y totales (tfoot)
   quedan siempre visibles gracias a position:sticky.

   Altura calculada:
     cabecera ~36px + 20 filas × 37px + pie ~38px + bordes ≈ 814px
   Se define con variables para ajustarlo en un solo lugar. */
:root {
    --row-h:        37px;   /* alto de una fila del cuerpo */
    --row-count:    18;     /* filas de datos visibles       */
    --thead-h:      36px;   /* alto de la cabecera           */
    --tfoot-h:      38px;   /* alto del pie de totales       */
}
.scroll-table {
    overflow: auto;
    /* altura exacta = cabecera + N filas + pie (+ 2px de borde),
       pero nunca mayor que el alto disponible del iframe (menos cabeceras). */
    max-height: min(
        calc(var(--thead-h) + var(--row-h) * var(--row-count) + var(--tfoot-h) + 2px),
        calc(100vh - 160px)
    );
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.scroll-table table.data { margin: 0; }
.scroll-table table.data thead th {
    position: sticky;
    top: 0;
    z-index: 3;
}
/* En tablas con tfoot, el pie queda pegado abajo del area scrolleable. */
.scroll-table table.data tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 2;
}
/* Scrollbar discreto */
.scroll-table::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-table::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 5px;
}
.scroll-table::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ----- Formularios de captura ----------------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-soft);
    margin-bottom: 5px;
}
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.actions .spacer { flex: 1; }

/* ----- Badges ---------------------------------------------------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
}
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-user  { background: #dcfce7; color: #166534; }
.badge-off   { background: #fee2e2; color: #991b1b; }

/* ----- Mensajes de estado --------------------------------------------- */
.status-bar {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius);
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    margin-top: 14px;
}
.status-bar.error { background: var(--color-danger); }
.status-bar.success { background: var(--color-accent-dk); }

/* ----- Utilidades ------------------------------------------------------ */
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--color-text-mute); }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.flex { display: flex; }
.flex.between { justify-content: space-between; }
.gap { gap: 10px; }
body.no-scroll { overflow: hidden; }

/* ----- Responsive ------------------------------------------------------ */
/* Punto de ruptura: a partir de tablets/chicos el menú de la barra superior
   deja de caber y pasa a un drawer lateral con botón hamburguesa. */
@media (max-width: 1023px) {
    .btn-menu { display: inline-flex; }            /* aparece la hamburguesa */
    .topbar-menu { display: none; }                /* se ocultan los dropdowns */
    .main { padding: 12px; }
}

/* Teléfonos: simplificamos aún más la barra superior. */
@media (max-width: 600px) {
    .topbar { padding: 0 10px; gap: 8px; }
    .topbar .user .user-name { display: none; }    /* solo avatar + salir */
    .topbar .context .chip { padding: 4px 9px; font-size: 12px; }
    .main { padding: 8px; }
}
