:root {
    --app-bg: #f8fafc;
    --sidebar-dark: #0f172a;
    --primary-accent: #3b82f6;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--app-bg);
    color: #1e293b;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex; align-items: center; justify-content: center;
}
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .nav-link {
    color: #94a3b8; padding: 0.75rem 1.25rem; border-radius: 0.65rem;
    margin-bottom: 0.35rem; font-weight: 500; transition: all 0.2s ease;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: #fff; background-color: rgba(255, 255, 255, 0.12); }
.card-custom {
    border: none; border-radius: 1rem; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    background: #fff; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.urgent-tag { animation: pulse 2s infinite; }
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(0.97); }
    100% { opacity: 1; transform: scale(1); }
}
.mobile-topbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 1020; border-bottom: 1px solid #e2e8f0;
}
.mobile-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid #e2e8f0;
    display: flex; justify-content: space-around; align-items: center;
    z-index: 1030; padding-bottom: var(--safe-bottom);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}
.mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #64748b; font-size: 0.68rem; font-weight: 500; text-decoration: none;
    flex: 1; padding: 4px 0; transition: color 0.15s ease;
}
.mobile-nav-item i { font-size: 1.25rem; margin-bottom: 2px; }
.mobile-nav-item.active { color: #2563eb; font-weight: 700; }
.mobile-fab-wrap { flex: 1; display: flex; justify-content: center; align-items: center; }
.mobile-fab {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff; border: 4px solid #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; margin-top: -24px; cursor: pointer; transition: transform 0.15s ease;
}
.mobile-fab:active { transform: scale(0.92); }
.chips-scroll {
    display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px 0;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }
.chip-pill {
    white-space: nowrap; padding: 6px 14px; border-radius: 50px;
    background: #fff; border: 1px solid #e2e8f0; color: #475569;
    font-size: 0.8rem; font-weight: 600; text-decoration: none;
    display: inline-flex; align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02); transition: all 0.2s ease;
}
.chip-pill.active { background: #2563eb; color: #fff; border-color: #2563eb; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.28); }
.mobile-task-card, .mobile-user-card {
    background: #fff; border-radius: 0.9rem; border: 1px solid #edf2f7;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02); transition: transform 0.15s ease;
}
.mobile-task-card:active, .mobile-user-card:active { transform: scale(0.99); }
.mobile-task-card.task-done { opacity: 0.7; background: #f8fafc; }
.touch-action-btn {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.day-tab-pill {
    flex: 1; min-width: 65px; text-align: center; padding: 8px 4px; border-radius: 0.75rem;
    font-size: 0.78rem; font-weight: 600; background: #fff; border: 1px solid #e2e8f0;
    color: #475569; cursor: pointer; transition: all 0.2s ease;
}
.day-tab-pill.active { background: #2563eb; color: #fff; border-color: #2563eb; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25); }
/* Modales tipo "bottom sheet" en móvil */
@media (max-width: 767.98px) {
    .app-main-content { padding-bottom: 95px !important; }
    .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; }
    .modal-content {
        border-bottom-left-radius: 0; border-bottom-right-radius: 0;
        border-top-left-radius: 1.5rem; border-top-right-radius: 1.5rem;
        max-height: 88vh; overflow-y: auto; border: none;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    }
    .modal-header { padding: 1.25rem 1.5rem 0.75rem; border-bottom: 1px solid #f1f5f9; }
    .modal-body { padding: 1.25rem 1.5rem; }
}
/* Impresión: solo la zona marcada */
@media print {
    body * { visibility: hidden; }
    #zonaImpresion, #zonaImpresion * { visibility: visible; }
    #zonaImpresion { position: absolute; inset: 0; padding: 2rem; }
}
/* --- Estilos propios de esta app debajo de esta línea --- */

/* Cifras de las tarjetas KPI: que quepan en móvil */
.kpi-num { font-size: clamp(1.05rem, 4.2vw, 1.6rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.min-w-0 { min-width: 0; }
.punto-color { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.icono-cuenta {
    width: 36px; height: 36px; border-radius: 50%; background: #f1f5f9;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.input-importe { max-width: 150px; font-variant-numeric: tabular-nums; }
.table td, .table th { font-variant-numeric: tabular-nums; }

/* Gráfico SVG (finanzas/_grafico.html) */
.grafico-wrap { display: flex; gap: 8px; align-items: stretch; }
.grafico-svg { width: 100%; height: 220px; display: block; overflow: visible; }
.grafico-eje-y {
    display: flex; flex-direction: column; justify-content: space-between;
    font-size: 0.68rem; text-align: right; padding-bottom: 22px; white-space: nowrap;
}
.grafico-eje-x { font-size: 0.68rem; margin-top: 4px; }
.grafico-guia { stroke: #edf2f7; stroke-width: 1; vector-effect: non-scaling-stroke; }
.grafico-cero { stroke: #ef4444; stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.grafico-area { fill: rgba(37, 99, 235, 0.08); }
.grafico-linea { fill: none; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.grafico-principal { stroke: #2563eb; }
.grafico-prevision { stroke: #f59e0b; stroke-dasharray: 6 5; }
.leyenda { display: inline-block; width: 18px; height: 0; border-top: 3px solid #2563eb; vertical-align: middle; }
.leyenda-prevision { border-top: 3px dashed #f59e0b; }
@media (max-width: 767.98px) {
    .grafico-svg { height: 170px; }
}

/* Doble factor: clave y códigos legibles para copiarlos a mano */
.clave-2fa {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #f1f5f9; border: 1px dashed #cbd5e1; color: #1e293b;
    letter-spacing: 0.08em; font-size: 1.05rem; word-break: break-all;
}
.codigo-2fa { letter-spacing: 0.3em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.clave-2fa .grupo-clave { display: inline-block; margin: 0 0.3em; }
