:root {
    /* --- COLOR PALETTE (USER DEFINED) --- */
    --primary: #6b4eff;
    /* Índigo vivido (Buttons, Highlights) */
    --primary-pastel: #8b68ff;
    /* Índigo pastel */
    --primary-light: #b4a2ff;
    /* Índigo claro (Soft Accents) */
    --primary-dark: #241057;
    /* Violeta oscuro (Main Background) */

    --secondary: #00b6fc;
    /* Celeste vivido oscuro */
    --secondary-light: #00c4fc;
    /* Celeste vivido claro */
    --cyan-vivid: #00ebff;
    /* Cian vivido (Glows / Active States) */
    --cyan-dim: #115d8c;
    /* Celeste (Muted) */

    --text-main: #2c2a29;
    /* Negro (Text on White) */
    --text-light: #ffffff;
    /* Blanco (Text on Dark) */

    --bg-glass: rgba(255, 255, 255, 0.1);
    --bg-card: #ffffff;

    /* --- SPACING & UI --- */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 15px rgba(107, 78, 255, 0.4);

    --nav-height: 60px;
    --bottom-nav-height: 70px;
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
}

body {
    background-color: #f0f2f5;
    /* Fallback Light Mode */
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-main);
    overflow: hidden;
    overscroll-behavior: none;
    /* App Shell */
}

html { overscroll-behavior: none; }

/* --- LIGHT MODE: FORM FOCUS --- */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(107, 78, 255, 0.15);
}

/* --- DARK MODE --- */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.premium-dark {
    background: #121218;
    color: #e0e0e0;
}

body.premium-dark .main-content {
    background: #121218;
}

body.premium-dark .sidebar {
    background: #0d0d14 !important;
    border-right-color: #1e1e2e !important;
}

body.premium-dark #mobile-header {
    background: #0d0d14 !important;
}

body.premium-dark .card-custom,
body.premium-dark .card-premium {
    background: #1e1e2e !important;
    color: #e0e0e0;
    border-color: #2a2a3a;
}

body.premium-dark .bg-white {
    background-color: #1e1e2e !important;
    color: #e0e0e0;
}

body.premium-dark .bg-light {
    background-color: #16161e !important;
    color: #e0e0e0;
}

body.premium-dark h1,
body.premium-dark h2,
body.premium-dark h3,
body.premium-dark h4,
body.premium-dark h5,
body.premium-dark h6 {
    color: #f0f0f0;
}

body.premium-dark .text-muted {
    color: #9a9aae !important;
}

body.premium-dark small {
    color: #8a8a9e;
}

body.premium-dark .form-control,
body.premium-dark .form-select {
    background-color: #16161e;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .form-control:focus,
body.premium-dark .form-select:focus {
    background-color: #1a1a24;
    border-color: var(--primary);
    color: #e0e0e0;
    box-shadow: 0 0 0 0.2rem rgba(107, 78, 255, 0.25);
}

body.premium-dark .form-control::placeholder {
    color: #5a5a6e;
}

body.premium-dark .form-label {
    color: #9a9aae;
}

body.premium-dark .table {
    color: #e0e0e0;
    --bs-table-bg: #1e1e2e;
    --bs-table-striped-bg: #22222e;
    --bs-table-hover-bg: #262636;
    border-color: #2a2a3a;
}

body.premium-dark .table thead {
    background-color: #16161e;
}

body.premium-dark .table-light {
    --bs-table-bg: #16161e;
    --bs-table-color: #e0e0e0;
    border-color: #2a2a3a;
}

body.premium-dark .table td,
body.premium-dark .table th {
    border-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .table thead th {
    color: #b0b0c0;
}

body.premium-dark .table td strong {
    color: #e0e0e0;
}

body.premium-dark .table .small,
body.premium-dark .table small {
    color: #b0b0c0;
}

body.premium-dark .acciones-celda .btn {
    border-color: #3a3a4a;
}

/* Alert components in dark mode */
body.premium-dark .alert {
    background-color: #1e1e2e;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .alert-success {
    background-color: #1a2a1a;
    border-color: #2a4a2a;
    color: #4ade80;
}

body.premium-dark .alert-light {
    background-color: #1e1e2e !important;
    border-color: #2a2a3a !important;
    color: #e0e0e0 !important;
}

/* List group items in dark mode */
body.premium-dark .list-group-item {
    background-color: #1e1e2e;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .list-group-item-action:hover {
    background-color: #262636;
}

body.premium-dark .modal-content {
    background-color: #1e1e2e;
    color: #e0e0e0;
    border-color: #2a2a3a;
}

body.premium-dark .modal-header {
    border-bottom-color: #2a2a3a;
}

body.premium-dark .modal-footer {
    border-top-color: #2a2a3a;
}

body.premium-dark .nav-link {
    color: #b0b0c0;
}

body.premium-dark .nav-link.active {
    color: var(--cyan-vivid) !important;
}

body.premium-dark .nav-link:hover {
    color: #ffffff;
}

body.premium-dark .sidebar .nav-link.text-warning {
    color: #ffc107 !important;
}

body.premium-dark .nav-tabs {
    border-bottom-color: #2a2a3a;
}

body.premium-dark .nav-tabs .nav-link {
    color: #9a9aae;
}

body.premium-dark .nav-tabs .nav-link.active {
    background-color: #1e1e2e;
    border-color: #2a2a3a #2a2a3a #1e1e2e;
    color: #e0e0e0;
}

body.premium-dark .nav-pills .nav-link.active {
    background-color: var(--primary);
}

body.premium-dark .dropdown-menu {
    background-color: #1e1e2e;
    border-color: #2a2a3a;
}

body.premium-dark .dropdown-item {
    color: #e0e0e0;
}

body.premium-dark .dropdown-item:hover {
    background-color: #262636;
}

body.premium-dark .card {
    background-color: #1e1e2e;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .card-header {
    background-color: #16161e;
    border-bottom-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .btn-outline-secondary {
    border-color: #3a3a4a;
    color: #b0b0c0;
}

body.premium-dark .btn-outline-secondary:hover {
    background-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary-light);
}

body.premium-dark .btn-light {
    background-color: #2a2a3a;
    color: #e0e0e0;
    border-color: #3a3a4a;
}

body.premium-dark .alert-info {
    background-color: rgba(0, 182, 252, 0.1);
    color: var(--secondary-light);
}

body.premium-dark .alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

body.premium-dark .alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #ff6b6b;
}

body.premium-dark .border-start {
    border-color: inherit !important;
}

body.premium-dark .text-dark {
    color: #e0e0e0 !important;
}

/* Badge dark mode — bg-light combos */
body.premium-dark .badge.bg-light {
    background-color: #2a2a3a !important;
    color: #e0e0e0 !important;
}

/* Badge bg-warning text-dark — keep dark text on yellow */
body.premium-dark .badge.bg-warning.text-dark {
    color: #000 !important;
}

body.premium-dark .text-secondary {
    color: #9a9aae !important;
}

/* Keep cards dark mode */
body.premium-dark .keep-card {
    background: #1e1e2e;
    border-color: #2a2a3a;
}

body.premium-dark .keep-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
    border-color: #3a3a4a;
}

body.premium-dark .keep-title { color: #e0e0e0; }
body.premium-dark .keep-desc { color: #9a9aae; }
body.premium-dark .keep-checklist li { color: #b0b0c0; }
body.premium-dark .keep-label { background: rgba(255,255,255,0.08); color: #b0b0c0; }
body.premium-dark .keep-footer { color: #6a6a7e; }
body.premium-dark .keep-footer-actions button { color: #9a9aae; }
body.premium-dark .keep-filter-pill { background: #1e1e2e; border-color: #2a2a3a; color: #9a9aae; }
body.premium-dark .keep-filter-pill:hover { background: #262636; }
body.premium-dark .keep-filter-pill.active { background: var(--primary); color: #fff; }

/* Keep priority dark mode */
body.premium-dark .keep-card.prio-alta { background: #2a1a1a; border-color: #4a2a2a; }
body.premium-dark .keep-card.prio-media { background: #2a2a1a; border-color: #4a4a2a; }
body.premium-dark .keep-card.prio-baja { background: #1a2a1a; border-color: #2a4a2a; }

/* Scrollbar dark mode */
body.premium-dark ::-webkit-scrollbar { width: 8px; }
body.premium-dark ::-webkit-scrollbar-track { background: #121218; }
body.premium-dark ::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 4px; }
body.premium-dark ::-webkit-scrollbar-thumb:hover { background: #3a3a4a; }

/* Profile tema buttons active state */
body.premium-dark .perfil-tema-btn.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Bottom nav dark mode */
body.premium-dark .bottom-nav {
    background: #0d0d14;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

/* --- Module cards (procesos, clientes, tareas, eventos, usuarios) --- */
body.premium-dark .client-card-full,
body.premium-dark .proc-card-full,
body.premium-dark .task-card-full,
body.premium-dark .evt-card-full,
body.premium-dark .user-card-full {
    background: #1e1e2e !important;
    color: #e0e0e0;
    border-color: #2a2a3a;
}

/* Process card dark mode accent */
body.premium-dark .proc-card-full {
    border-left: 3px solid var(--primary);
}

body.premium-dark .proc-meta .badge {
    background-color: #262636 !important;
    color: #b0b0c0 !important;
    border-color: #3a3a4a !important;
}

body.premium-dark .proc-partes .parte-dte {
    background: #1a2a1a;
    border-left-color: #4ade80;
}

body.premium-dark .proc-partes .parte-ddo {
    background: #2a1a1a;
    border-left-color: #f87171;
}

/* Card stat headings */
body.premium-dark .card-custom h6.text-secondary {
    color: #9a9aae !important;
}

/* --- Input group (search buttons) --- */
body.premium-dark .input-group-text {
    background-color: #1e1e2e;
    border-color: #2a2a3a;
    color: #9a9aae;
}

/* --- Sidebar nav active/hover in dark mode --- */
body.premium-dark .sidebar .nav-link:hover,
body.premium-dark .sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

/* --- Light gray backgrounds (financials, credentials, boxes) --- */
body.premium-dark .client-financials,
body.premium-dark .user-credentials,
body.premium-dark .parte-box {
    background: #16161e !important;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

/* --- Modal body default backgrounds --- */
body.premium-dark .modal-body {
    background-color: #1e1e2e;
    color: #e0e0e0;
}

body.premium-dark .modal-body.bg-light {
    background-color: #16161e !important;
}

/* --- Card headers inside modals (bg-white override) --- */
body.premium-dark .card-header.bg-white {
    background-color: #16161e !important;
    color: #e0e0e0 !important;
    border-bottom-color: #2a2a3a;
}

body.premium-dark .card-header.bg-white.text-success {
    color: #4ade80 !important;
}

/* --- Readonly / disabled form controls --- */
body.premium-dark .form-control[readonly],
body.premium-dark .form-control:disabled {
    background-color: #12121a !important;
    color: #8a8a9e;
    border-color: #2a2a3a;
}

/* --- Table responsive containers with bg-white --- */
body.premium-dark .table-responsive.bg-white,
body.premium-dark .table-responsive.border {
    background-color: #1e1e2e !important;
    border-color: #2a2a3a !important;
}

/* --- Border utility in dark mode --- */
body.premium-dark .border {
    border-color: #2a2a3a !important;
}

body.premium-dark .border-bottom {
    border-bottom-color: #2a2a3a !important;
}

/* --- Badge bg-white in dark mode --- */
body.premium-dark .badge.bg-white {
    background-color: #2a2a3a !important;
    color: #e0e0e0 !important;
}

/* --- Accordion / collapse in dark mode --- */
body.premium-dark .accordion-item {
    background-color: #1e1e2e;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

body.premium-dark .accordion-button {
    background-color: #16161e;
    color: #e0e0e0;
    border-color: #2a2a3a;
}

body.premium-dark .accordion-button:not(.collapsed) {
    background-color: #1a1a28;
    color: var(--primary-light);
}

/* --- Generic white bg overrides (catch-all) --- */
body.premium-dark [style*="background-color: #e9ecef"],
body.premium-dark [style*="background:#f8f9fa"],
body.premium-dark [style*="background-color: #f8f9fa"] {
    background-color: #16161e !important;
    color: #e0e0e0;
}

body.premium-dark .bg-light.p-2,
body.premium-dark .bg-light.p-3 {
    background-color: #16161e !important;
}

/* --- Card shadow adjustments for dark mode --- */
body.premium-dark .card-custom {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* --- Calendar specific dark mode --- */
body.premium-dark .cal-cell {
    background: #1e1e2e;
    color: #e0e0e0;
}

body.premium-dark .cal-cell:hover {
    background: #262636;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.premium-dark .cal-empty {
    background: transparent;
}

body.premium-dark .cal-today {
    background: #1a2240 !important;
    border-color: #3B82F6;
}

body.premium-dark .cal-selected {
    background: #1e1a3a !important;
    border-color: #6366F1;
}

body.premium-dark .cal-festivo {
    background: #2a1a1a !important;
}

body.premium-dark .cal-title {
    color: #e0e0e0;
}

body.premium-dark .cal-day-name {
    color: #6a6a7e;
}

body.premium-dark .cal-num {
    color: #e0e0e0;
}

body.premium-dark .cal-weekend .cal-num {
    color: #6a6a7e;
}

body.premium-dark .cal-festivo .cal-num {
    color: #ff6b6b;
}

body.premium-dark .cal-today .cal-num {
    color: #60a5fa;
}

body.premium-dark .cal-panel-header {
    border-bottom-color: #2a2a3a;
}

body.premium-dark .cal-event-item {
    background: #16161e;
}

body.premium-dark .cal-event-item:hover {
    background: #1a1a28;
}

body.premium-dark .cal-legend {
    border-top-color: #2a2a3a;
}

body.premium-dark .cal-event-bar {
    filter: brightness(0.85);
}

body.premium-dark .cal-count {
    background: #818cf8;
}

body.premium-dark .cal-view-btn {
    background: #1e1e2e;
    color: #aaa;
    border-color: #2a2a3a;
}

body.premium-dark .cal-view-btn.active {
    background: #3B82F6;
    color: #fff;
}

body.premium-dark .cal-week-col {
    background: #1e1e2e;
}

body.premium-dark .cal-week-col.cal-today-col {
    background: #1a2240;
    border-color: #3B82F6;
}

body.premium-dark .cal-week-col.cal-weekend-col {
    background: #1a1a24;
}

body.premium-dark .cal-week-day-header {
    border-bottom-color: #2a2a3a;
    color: #aaa;
}

body.premium-dark .cal-hour-row {
    border-bottom-color: #2a2a3a;
}

body.premium-dark .cal-hour-label {
    color: #6a6a7e;
}

body.premium-dark .cal-day-allday {
    background: #1a1a28;
}

body.premium-dark .cal-popover {
    background: #1e1e2e;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

body.premium-dark .cal-popover-title {
    color: #e0e0e0;
}

body.premium-dark .cal-popover-actions {
    border-top-color: #2a2a3a;
}

/* --- Tareas R43: dark mode --- */
body.premium-dark .tareas-view-btn {
    background: #1e1e2e;
    color: #aaa;
    border-color: #2a2a3a;
}

body.premium-dark .tareas-view-btn.active {
    background: #F59E0B;
    color: #fff;
}

body.premium-dark .kanban-col {
    background: #1e1e2e;
}

body.premium-dark .kanban-col.drag-over {
    background: #1a2240;
    border-color: #3B82F6;
}

body.premium-dark .kanban-col-pendiente .kanban-col-header {
    background: #422006;
    color: #FDE68A;
}

body.premium-dark .kanban-col-completada .kanban-col-header {
    background: #064E3B;
    color: #6EE7B7;
}

body.premium-dark .kanban-col-archivada .kanban-col-header {
    background: #1F2937;
    color: #9CA3AF;
}

body.premium-dark .tareas-filters {
    background: #16161e;
}

body.premium-dark .prio-filter-pill {
    background: #1e1e2e;
    border-color: #2a2a3a;
    color: #aaa;
}

body.premium-dark .kanban-archivada-toggle {
    color: #6a6a7e;
}

/* Dashboard v5 dark mode */
body.premium-dark .dash-kpi-fin { background: #1e1e2e; }
body.premium-dark .dash-kpi-fin .dash-kpi-label { color: #888; }
body.premium-dark .dash-meta-mini { background: #16161e; }
body.premium-dark .dash-meta-mini-bar { background: #2a2a3a; }
body.premium-dark .dash-mini-progress { background: #2a2a3a; }
body.premium-dark .dash-activity-item { border-bottom-color: #2a2a3a; }
body.premium-dark .dash-activity-item:hover { background: #1e1e2e; }
body.premium-dark .dash-activity-time { color: #666; }
body.premium-dark .dash-activity-text { color: #ddd; }
body.premium-dark .dash-alerta-action { background: #1e1e2e; border-color: #2a2a3a; color: #aaa; }

/* Chatbot dark mode */
body.premium-dark .chat-disclaimer { background:#422006; color:#FDE68A; border-color:#92400E; }
body.premium-dark .chat-sugerencia { background:#1e1e2e; color:#818CF8; border-color:#2a2a3a; }
body.premium-dark .chat-sugerencia:hover { background:#4F46E5; color:#fff; }
body.premium-dark .chat-textarea { background:#16161e; border-color:#2a2a3a; color:#e0e0e0; }

/* ===== LOGIN GLASSMORPHISM ===== */
#login-screen {
    color: #ffffff;
}

/* Orbes decorativos estáticos */
.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
}
.login-orb-1 {
    width: 350px; height: 350px;
    background: #6b4eff;
    top: -10%; left: -8%;
}
.login-orb-2 {
    width: 280px; height: 280px;
    background: #00b6fc;
    bottom: -5%; right: -5%;
}
.login-orb-3 {
    width: 200px; height: 200px;
    background: #8b68ff;
    top: 50%; left: 60%;
    transform: translate(-50%, -50%);
}

/* Subtítulo */
.login-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 400;
}

/* Divider con líneas */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

/* Inputs glass */
#login-screen .form-control {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}
#login-screen .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
#login-screen .form-control:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(107, 78, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(107, 78, 255, 0.2), 0 0 20px rgba(107, 78, 255, 0.15);
    color: #ffffff;
}

/* OTP input especial */
#txtCodigoOTP {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
    color: #ffffff !important;
}
#txtCodigoOTP:focus {
    border-color: rgba(107, 78, 255, 0.7) !important;
    box-shadow: 0 0 0 3px rgba(107, 78, 255, 0.25), 0 0 24px rgba(107, 78, 255, 0.2) !important;
}

/* Botón primario glass — cyan */
.btn-login-primary {
    background: linear-gradient(135deg, #00b6fc 0%, #00d4ff 100%);
    border: none;
    color: #ffffff;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 182, 252, 0.35);
}
.btn-login-primary:hover {
    background: linear-gradient(135deg, #00c4fc 0%, #00ebff 100%);
    box-shadow: 0 6px 20px rgba(0, 182, 252, 0.5);
    transform: translateY(-1px);
    color: #ffffff;
}
.btn-login-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 182, 252, 0.3);
}

/* Text links dentro del login */
#login-screen .btn-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.2s;
}
#login-screen .btn-link:hover {
    color: #ffffff;
}
#login-screen .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}
#login-screen .small.text-muted,
#login-screen p.small.text-muted {
    color: rgba(255, 255, 255, 0.55) !important;
}

/* Toggle admin button */
#btnToggleAdmin {
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 0.75rem;
}
#btnToggleAdmin:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Links legales */
.login-legal-link {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    transition: color 0.2s;
}
.login-legal-link:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* Google button container */
#login-screen .g_id_signin {
    display: flex;
    justify-content: center;
}

/* Responsive login */
@media (max-width: 374.98px) {
    .login-box {
        padding: 28px 20px 24px !important;
        border-radius: 20px !important;
    }
    .login-orb-1 { width: 250px; height: 250px; }
    .login-orb-2 { width: 180px; height: 180px; }
    .login-orb-3 { display: none; }
}
@media (max-height: 600px) {
    .login-box {
        padding: 24px 28px 20px !important;
    }
    .login-logo { width: 70px !important; margin-bottom: 8px !important; }
    .login-subtitle { margin-bottom: 12px !important; }
}

/* --- COMPONENTS: CARDS --- */
.card-premium {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.card-custom {
    transition: transform 0.2s, box-shadow 0.2s;
}

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

body.premium-dark .card-premium:hover,
body.premium-dark .card-custom:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* --- COMPONENTS: BUTTONS --- */
.btn-premium {
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(107, 78, 255, 0.3);
    transition: 0.3s;
}

.btn-premium:hover {
    box-shadow: var(--shadow-glow);
    filter: brightness(1.1);
}

/* --- SIDEBAR NAV POLISH --- */
.sidebar .nav-link {
    transition: color 0.2s, background-color 0.2s;
    border-radius: var(--radius-sm);
}

.sidebar .nav-link:hover {
    background: rgba(107, 78, 255, 0.08);
}

.sidebar .nav-link.active {
    background: rgba(107, 78, 255, 0.12);
    color: var(--primary);
    font-weight: 600;
}

/* --- TOUCH TARGETS --- */
.btn-sm {
    min-height: 36px;
}

/* --- BADGE PULSE ANIMATION --- */
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.sidebar .badge {
    animation: badge-pulse 2s ease-in-out infinite;
    font-size: 0.65rem;
    padding: 0.2em 0.5em;
    border-radius: 10px;
}

/* --- LAYOUT: APP SHELL --- */
#app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 90px;
    /* Space for Bottom Nav */
}

/* --- COMPONENTS: BOTTOM NAV (MOBILE) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #aaa;
    font-size: 0.75rem;
    text-decoration: none;
    transition: 0.2s;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary);
}

/* --- STATUS BADGES --- */
.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-active {
    background: rgba(46, 204, 113, 0.15);
    color: #27ae60;
}

.status-warn {
    background: rgba(241, 196, 15, 0.15);
    color: #d35400;
}

.status-danger {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

body.premium-dark .status-active {
    background: rgba(46, 204, 113, 0.2);
    color: #4ade80;
}

body.premium-dark .status-warn {
    background: rgba(241, 196, 15, 0.2);
    color: #fbbf24;
}

body.premium-dark .status-danger {
    background: rgba(231, 76, 60, 0.2);
    color: #f87171;
}

/* --- RESPONSIVE TYPOGRAPHY --- */
h1,
h2,
h3 {
    font-weight: 700;
    color: var(--primary-dark);
}

small {
    color: #666;
}

@media (min-width: 768px) {

    /* Desktop Sidebar adjustment */
    .bottom-nav {
        display: none;
    }

    #main-content {
        padding-left: 280px;
        padding-bottom: 20px;
    }
}

/* ============================================
   KEEP-STYLE TAREAS (Google Keep Inspired)
   ============================================ */

/* --- Grid Masonry Layout --- */
.keep-grid {
    column-count: 3;
    column-gap: 16px;
}

@media (max-width: 991px) {
    .keep-grid { column-count: 2; }
}

@media (max-width: 575px) {
    .keep-grid { column-count: 1; }
}

/* --- Tarjeta Keep --- */
.keep-card {
    break-inside: avoid;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.keep-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border-color: #ccc;
}

/* Prioridad backgrounds */
.keep-card.prio-alta { background: #fce4e4; border-color: #f5c6c6; }
.keep-card.prio-media { background: #fff9e6; border-color: #faeab8; }
.keep-card.prio-baja { background: #e8f5e9; border-color: #c8e6c9; }

/* Custom Keep colors */
.keep-card[data-color="coral"] { background: #faafa8; border-color: #f0938a; }
.keep-card[data-color="peach"] { background: #f39f76; border-color: #e88e63; }
.keep-card[data-color="sand"] { background: #fff8b8; border-color: #f5ec9e; }
.keep-card[data-color="mint"] { background: #e2f6d3; border-color: #c8e8b2; }
.keep-card[data-color="sage"] { background: #b4ddd3; border-color: #98ccbf; }
.keep-card[data-color="fog"] { background: #d3e0ea; border-color: #b8ccd9; }
.keep-card[data-color="storm"] { background: #aeccdc; border-color: #92b8cc; }
.keep-card[data-color="dusk"] { background: #d3bfdb; border-color: #c1a7cc; }
.keep-card[data-color="blossom"] { background: #f6e2dd; border-color: #eacdc5; }
.keep-card[data-color="clay"] { background: #e9e3d4; border-color: #d9d0bc; }

/* --- Pin Icon --- */
.keep-pin {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.15s;
    background: none;
    border: none;
    font-size: 1rem;
    color: #5f6368;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    z-index: 2;
}

.keep-card:hover .keep-pin,
.keep-pin.pinned {
    opacity: 1;
}

.keep-pin.pinned { color: var(--primary); }
.keep-pin:hover { background: rgba(0,0,0,0.06); }
body.premium-dark .keep-pin:hover { background: rgba(255,255,255,0.1); }

/* --- Card Title --- */
.keep-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    padding-right: 28px;
    color: #202124;
    word-break: break-word;
}

/* --- Card Description --- */
.keep-desc {
    font-size: 0.8rem;
    color: #5f6368;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Checklist Preview --- */
.keep-checklist {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
}

.keep-checklist li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 2px 0;
    color: #3c4043;
}

.keep-checklist li.completed {
    text-decoration: line-through;
    color: #9aa0a6;
}

.keep-checklist li input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.keep-checklist-more {
    font-size: 0.75rem;
    color: #9aa0a6;
    padding-left: 22px;
}

/* --- Labels Pills --- */
.keep-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.keep-label {
    display: inline-block;
    background: rgba(0,0,0,0.06);
    color: #3c4043;
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

/* --- Card Footer --- */
.keep-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: #80868b;
    padding-top: 6px;
}

.keep-footer-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.keep-card:hover .keep-footer-actions { opacity: 1; }

.keep-footer-actions button {
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    font-size: 0.8rem;
}

.keep-footer-actions button:hover { background: rgba(0,0,0,0.06); }

body.premium-dark .keep-section-title {
    color: #9a9aae;
}

/* --- Filter Pills --- */
.keep-filter-pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #dadce0;
    background: #fff;
    color: #5f6368;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    margin-right: 6px;
    margin-bottom: 6px;
}

.keep-filter-pill:hover { background: #f1f3f4; }

.keep-filter-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* --- Color Picker Swatches --- */
.keep-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.keep-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.keep-color-swatch:hover { transform: scale(1.15); }
.keep-color-swatch.selected { border-color: #333; }
.keep-color-swatch[data-color="none"] { background: #fff; border-color: #dadce0; }
.keep-color-swatch[data-color="coral"] { background: #faafa8; }
.keep-color-swatch[data-color="peach"] { background: #f39f76; }
.keep-color-swatch[data-color="sand"] { background: #fff8b8; }
.keep-color-swatch[data-color="mint"] { background: #e2f6d3; }
.keep-color-swatch[data-color="sage"] { background: #b4ddd3; }
.keep-color-swatch[data-color="fog"] { background: #d3e0ea; }
.keep-color-swatch[data-color="storm"] { background: #aeccdc; }
.keep-color-swatch[data-color="dusk"] { background: #d3bfdb; }
.keep-color-swatch[data-color="blossom"] { background: #f6e2dd; }
.keep-color-swatch[data-color="clay"] { background: #e9e3d4; }

body.premium-dark .keep-color-swatch.selected { border-color: #e0e0e0; }
body.premium-dark .keep-color-swatch[data-color="none"] { background: #2a2a3a; border-color: #3a3a4a; }

/* --- Section headers --- */
.keep-section-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5f6368;
    margin-bottom: 10px;
    padding-left: 4px;
}

/* --- Modal Keep Subtareas --- */
.keep-modal-subtarea-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f4;
}

.keep-modal-subtarea-item input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.88rem;
    background: transparent;
}

.keep-modal-subtarea-item .btn-remove-sub {
    background: none;
    border: none;
    color: #9aa0a6;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.keep-modal-subtarea-item:hover .btn-remove-sub { opacity: 1; }

body.premium-dark .keep-modal-subtarea-item {
    border-bottom-color: #2a2a3a;
}

body.premium-dark .keep-modal-subtarea-item input[type="text"] {
    color: #e0e0e0;
}

/* --- Modal etiqueta pills --- */
.keep-modal-etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 12px;
    margin: 2px;
}

.keep-modal-etiqueta .remove-etiqueta {
    cursor: pointer;
    font-weight: bold;
    margin-left: 2px;
}

/* --- Batch Update --- */
#btnBatchUpdate:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

#batchProgressLog div {
    padding: 4px 6px;
    border-bottom: 1px solid #eee;
}

#batchProgressLog div:last-child {
    border-bottom: none;
}

body.premium-dark #batchProgressLog div {
    border-bottom-color: #2a2a3a;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    pointer-events: none;
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(110%);
    transition: transform 0.3s ease;
    pointer-events: auto;
}

.app-toast.show {
    transform: translateX(0);
}

.app-toast i:first-child {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-warning {
    background: #f59e0b;
    color: #1a1a1a;
}

.toast-info {
    background: var(--primary);
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    margin-left: auto;
    opacity: 0.7;
    padding: 0 2px;
    font-size: 14px;
}

.toast-close:hover {
    opacity: 1;
}

body.premium-dark .toast-warning {
    background: #d97706;
    color: #fff;
}

/* --- CONFIRM / PROMPT DIALOG --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.confirm-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px 24px 20px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.confirm-overlay.show .confirm-box {
    transform: scale(1);
}

.confirm-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.confirm-icon-danger {
    color: #ef4444;
}

.confirm-icon-warning {
    color: #f59e0b;
}

.confirm-icon-info {
    color: var(--primary);
}

.confirm-msg {
    font-size: 15px;
    color: #374151;
    margin-bottom: 20px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 100px;
}

.confirm-input {
    margin-bottom: 16px;
}

body.premium-dark .confirm-box {
    background: #1e1e2e;
}

body.premium-dark .confirm-msg {
    color: #e5e7eb;
}

body.premium-dark .confirm-input {
    background-color: #16161e;
    border-color: #2a2a3a;
    color: #e0e0e0;
}

/* --- EMPTY STATES --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--primary);
    opacity: 0.3;
    margin-bottom: 12px;
    display: block;
}

.empty-state .empty-title {
    color: #6b7280;
    font-size: 15px;
    margin: 0;
}

.empty-state .empty-sub {
    color: #9ca3af;
    font-size: 13px;
    margin: 6px 0 0;
}

td .empty-state {
    padding: 20px 10px;
}

td .empty-state i {
    font-size: 36px;
    margin-bottom: 8px;
}

body.premium-dark .empty-state .empty-title {
    color: #9ca3af;
}

body.premium-dark .empty-state .empty-sub {
    color: #6b7280;
}

/* === SKELETON LOADING === */
.skeleton {
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 120px;
    margin-bottom: 12px;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }

body.premium-dark .skeleton {
    background: linear-gradient(90deg, #2a2a3e 25%, #35354d 50%, #2a2a3e 75%);
    background-size: 200% 100%;
}

/* === INLINE FORM VALIDATION === */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.form-control.is-invalid,
.form-select.is-invalid {
    animation: shake 0.3s ease-in-out;
}

.input-group ~ .invalid-feedback {
    display: block;
}

body.premium-dark .form-control.is-invalid,
body.premium-dark .form-select.is-invalid {
    border-color: #ef4444;
}

body.premium-dark .invalid-feedback {
    color: #f87171;
}

/* === SCROLL-TO-TOP BUTTON === */
.scroll-top-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    box-shadow: 0 4px 12px rgba(107, 78, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    transform: scale(1.1);
}

@media (min-width: 768px) {
    .scroll-top-btn {
        bottom: 30px;
    }
}

body.premium-dark .scroll-top-btn {
    box-shadow: 0 4px 12px rgba(139, 104, 255, 0.4);
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- PRINT STYLES --- */
@media print {
    .sidebar, #mobile-header, #sidebar-overlay, .bottom-nav,
    .scroll-top-btn, #toast-container, .btn, .sort-toolbar,
    .confirm-overlay, .modal, .keep-filter-pill,
    .keep-color-picker, .dropdown-menu {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 10px !important;
        overflow: visible !important;
    }
    .card-custom, .card-premium {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
    body, body.premium-dark {
        background: white !important;
        color: #000 !important;
    }
}

/* === NOTIFICATION CENTER (R47) === */
.notif-bell-container {
    position: relative;
    display: inline-block;
    margin-top: 8px;
}
.notif-bell-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    padding: 6px 10px;
    border-radius: 50%;
    transition: background 0.2s;
}
.notif-bell-btn:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}
.notif-bell-btn-mobile {
    background: none;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    padding: 6px 10px;
    margin-right: 8px;
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    animation: notif-pulse 2s ease-in-out infinite;
}
@keyframes notif-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.notif-dropdown {
    position: fixed;
    top: 60px;
    left: calc(var(--sidebar-width, 250px) + 10px);
    width: 360px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    z-index: 9999;
    overflow: hidden;
    color: #333;
}
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}
.notif-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-dropdown-list {
    max-height: 380px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item-unread { background: #eff6ff; }
.notif-item-unread:hover { background: #dbeafe; }
.notif-item-read { opacity: 0.7; }
.notif-item-icon {
    flex-shrink: 0;
    width: 32px;
    margin-right: 10px;
    padding-top: 2px;
    font-size: 1rem;
}
.notif-item-content { flex-grow: 1; min-width: 0; }
.notif-item-title {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 2px;
}
.notif-item-msg {
    font-size: 0.75rem;
    color: #555;
    white-space: normal;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-item-time {
    font-size: 0.65rem;
    color: #999;
    margin-top: 3px;
}
.notif-empty {
    text-align: center;
    padding: 30px;
    color: #999;
}
.notif-empty i { font-size: 2rem; margin-bottom: 8px; }
.notif-empty p { font-size: 0.85rem; margin: 0; }

@media (max-width: 768px) {
    .notif-dropdown {
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 70vh;
    }
}

/* Dark mode notificaciones */
body.premium-dark .notif-dropdown {
    background: #1e293b;
    color: #e2e8f0;
}
body.premium-dark .notif-dropdown-header { border-color: #334155; }
body.premium-dark .notif-item { border-color: #334155; }
body.premium-dark .notif-item:hover { background: #334155; }
body.premium-dark .notif-item-unread { background: #1e3a5f; }
body.premium-dark .notif-item-unread:hover { background: #264a6f; }
body.premium-dark .notif-item-msg { color: #94a3b8; }
body.premium-dark .notif-item-time { color: #64748b; }
body.premium-dark .notif-empty { color: #64748b; }

/* ============================================================
   BOTTOM NAVIGATION — Mobile (Android / Play Store)
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: #ffffff;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    z-index: 1040;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid #e9ecef;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 48px;
    min-width: 48px;
    padding: 8px 4px 6px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    user-select: none;
    position: relative;
}
.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 3px;
    transition: transform 0.15s ease;
}
.bottom-nav-item.active {
    color: var(--primary);
    font-weight: 700;
}
.bottom-nav-item.active i {
    transform: scale(1.1);
}
.bottom-nav-item:active {
    background: rgba(107, 78, 255, 0.06);
}

/* Dark mode bottom nav */
body.premium-dark .bottom-nav {
    background: #0d0d14;
    border-top-color: #1e1e2e;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.5);
}
body.premium-dark .bottom-nav-item {
    color: #555;
}
body.premium-dark .bottom-nav-item.active {
    color: var(--primary-pastel);
}
body.premium-dark .bottom-nav-item:active {
    background: rgba(107, 78, 255, 0.12);
}

/* Hide bottom nav on desktop */
@media (min-width: 768px) {
    .bottom-nav { display: none !important; }
}

/* ============================================================
   TOUCH TARGET IMPROVEMENTS — Mobile
   ============================================================ */
@media (max-width: 768px) {
    /* Sidebar nav links — bigger touch targets */
    .nav-link {
        padding: 14px 25px;
        min-height: 48px;
    }

    /* Buttons — minimum 44px height */
    .btn {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 38px;
        padding: 6px 14px;
    }

    /* Table action buttons */
    .table .btn-sm,
    .table .btn-outline-primary,
    .table .btn-outline-danger {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }

    /* Form controls — slightly taller */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Cards — better spacing */
    .card-body {
        padding: 1rem;
    }

    /* Scroll top button — above bottom nav */
    .scroll-top-btn {
        bottom: calc(var(--bottom-nav-height) + 16px) !important;
    }
}

/* ============================================================
   RESPONSIVE IMPROVEMENTS — Multi-device
   ============================================================ */

/* --- Charts: altura responsive por dispositivo --- */
@media (max-width: 575.98px) {
    .card-custom [style*="height: 300px"],
    .card-custom [style*="height:300px"] {
        height: 200px !important;
    }
    .card-custom [style*="height: 220px"],
    .card-custom [style*="height:220px"],
    .card-custom [style*="height: 200px"],
    .card-custom [style*="height:200px"] {
        height: 160px !important;
    }
    #dso-value.display-4 {
        font-size: 2rem !important;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .card-custom [style*="height: 300px"],
    .card-custom [style*="height:300px"] {
        height: 220px !important;
    }
    .card-custom [style*="height: 220px"],
    .card-custom [style*="height:220px"] {
        height: 180px !important;
    }
}

@media (min-width: 1200px) {
    .card-custom [style*="height: 300px"],
    .card-custom [style*="height:300px"] {
        height: 360px !important;
    }
    .card-custom [style*="height: 220px"],
    .card-custom [style*="height:220px"] {
        height: 260px !important;
    }
    .dash-kpi-fin .dash-kpi-value {
        font-size: 1.6rem;
    }
}

/* --- KPI cards + Finanzas columns: tablet layout (768-991px) --- */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* KPI cards 4-up en tablets */
    #view-finanzas .col-6.col-lg-3 {
        flex: 0 0 auto;
        width: 25%;
    }
    #view-finanzas .col-6.col-lg-4 {
        flex: 0 0 auto;
        width: 33.333%;
    }
    /* Finanzas chart sections side-by-side en tablets */
    #view-finanzas .col-lg-7 {
        flex: 0 0 auto;
        width: 58.333%;
    }
    #view-finanzas .col-lg-5 {
        flex: 0 0 auto;
        width: 41.667%;
    }
    #view-finanzas .col-lg-6 {
        flex: 0 0 auto;
        width: 50%;
    }
    /* Gastos tab columns */
    #tab-gastos .col-lg-7 {
        flex: 0 0 auto;
        width: 58.333%;
    }
    #tab-gastos .col-lg-5 {
        flex: 0 0 auto;
        width: 41.667%;
    }
    #tab-gastos .col-lg-6 {
        flex: 0 0 auto;
        width: 50%;
    }
}

/* --- Landscape phone: bottom nav compacto --- */
@media (max-height: 500px) and (orientation: landscape) {
    .bottom-nav {
        height: 52px;
    }
    .bottom-nav-item {
        min-height: 52px;
        padding: 4px;
        font-size: 0.55rem;
    }
    .bottom-nav-item i {
        font-size: 1rem;
        margin-bottom: 1px;
    }
    #main-content {
        padding-bottom: 68px;
    }
    .scroll-top-btn {
        bottom: calc(52px + 12px) !important;
    }
}

/* --- Celulares muy pequenos (320-374px) --- */
@media (max-width: 374.98px) {
    /* KPI fonts mas pequenos */
    .col-6 .fs-4.fw-bold {
        font-size: 1.1rem !important;
    }
    .dash-kpi-fin .dash-kpi-value {
        font-size: 1.1rem;
    }
    h3 {
        font-size: 1.15rem;
    }
    /* Card padding reducido */
    .card-custom.p-3 {
        padding: 0.75rem !important;
    }
    #view-finanzas .p-3,
    #view-clientes .p-3,
    #view-procesos .p-3 {
        padding: 0.75rem !important;
    }
    /* Main content padding lateral */
    #main-content {
        padding-left: 12px;
        padding-right: 12px;
    }
    /* Calendario: ocultar barras evento, reducir celdas */
    .cal-cell {
        min-height: 36px !important;
        padding: 2px !important;
    }
    .cal-num {
        font-size: 0.65rem !important;
    }
    .cal-event-bar {
        display: none;
    }
    /* Gastos table: ocultar Proveedor y Cliente */
    #tabla-gastos th:nth-child(4),
    #tabla-gastos td:nth-child(4),
    #tabla-gastos th:nth-child(5),
    #tabla-gastos td:nth-child(5) {
        display: none;
    }
    /* Rentabilidad table: ocultar Gastos */
    #tabla-rentabilidad th:nth-child(3),
    #tabla-rentabilidad td:nth-child(3) {
        display: none;
    }
}