* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Secretaría de Seguridad - Paleta institucional 2026 */
    --navy-deep: #ffffff;         /* principal */
    --navy-institutional: #0F3D63;/* header / sidebar */
    --navy-operational: #1B5E8C;  /* accents */
    --steel-gray: #2F3E46;
    --bg: #F1F4F6;                /* general background */
    --surface: #ffffff;           /* cards and surfaces */
    --green-ok: #1E7F4F;          /* cumplimiento */
    --red-alert: #A12622;         /* alerta */
    --gold: #A98C2C;              /* institucional discreto */
    --text: #0F172A;
    --text-secondary: #64748b;
    --border: #d9dde0;
}

body {
    font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Login Page - Modern Premium Design */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: url('/fondito.jpeg') no-repeat center center;
    background-size: cover;
}

/* Background overlay with blur */
.login-background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
}

/* Loading spinner */
.login-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.login-loader p {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.login-container {
    width: 100%;
    max-width: 480px;
    padding: 0;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Static circular logo container */
.login-logo-container {
    animation: logoFadeIn 1s ease-out 0.3s both;
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Simplified logo layout: show actual logo image without decorative circle */
.login-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
    animation: logoFadeIn 1s ease-out 0.3s both;
}

.login-logo-static {
    width: 220px;
    height: auto;
    max-height: 220px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
    display: block;
}

/* Removed separate user avatar (design simplified) */
/* The login page no longer shows the small user avatar under the logo; the logo image is used directly. */

.login-avatar svg {
    width: 48px;
    height: 48px;
    color: white;
}

/* Small user-style button on login, matches navbar-user-info visual language */
.login-user-button {
    margin-top: 12px;
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    /* Updated: Deep institutional blue gradient similar to reference */
    background: linear-gradient(135deg, #0F3D63 0%, #0B5A8C 40%, #0F78B3 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.2,0.9,0.2,1);
    box-shadow: 0 8px 22px rgba(11,61,99,0.20);
    margin-left: auto;
    margin-right: auto;
    text-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.login-user-button:hover {
    background: linear-gradient(135deg, #0B5A8C 0%, #0F78B3 60%, #2B9CE0 100%);
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(11,61,99,0.26);
}

/* Modern form */
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: formFadeIn 0.8s ease-out 0.9s both;
}

@keyframes formFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group-modern {
    position: relative;
}

.input-modern {
    width: 50%;
    padding: 18px 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 60px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #ffffff;
    transition: all 0.4s ease;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    margin-left: auto;
    margin-right: auto;
    display: block;
}

/* Ensure the password input leaves space for the eye toggle when inside the password-group */
.password-group .input-modern {
    width: 100%;
    padding-right: 48px; /* room for the toggle */
    box-sizing: border-box;
}

.input-modern::placeholder {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 400;
    font-size: 15px;
}

.input-modern:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.8);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 0 0 5px rgba(59, 130, 246, 0.2),
        0 8px 30px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
}

/* Password group with eye toggle */
.password-group {
    /* make the password group match the input width so the absolute toggle sits at the input's right */
    position: relative;
    width: 50%;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.password-toggle {
    position: absolute;
    /* sit at the inner-right edge of the centered password input box */
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.password-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.password-toggle svg {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.password-toggle:hover svg {
    color: #ffffff;
}

/* Error message - reduced size variant */
.error-message-modern {
    width: 50%;
    margin: 12px auto 0 auto;
    padding: 8px 12px;
    background: rgba(254, 202, 202, 0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fee2e2;
    border-radius: 32px;
    font-size: 12px;
    border: 1.5px solid rgba(254, 226, 226, 0.28);
    font-weight: 600;
    text-align: center;
    animation: shake 0.45s ease;
    box-shadow:
        0 3px 12px rgba(239, 68, 68, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    display: inline-block;
    max-width: 320px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Responsive */
@media (max-width: 480px) {
    .logo-circle {
        width: 360px;
        height: 360px;
    }
    
    .login-avatar {
        width: 75px;
        height: 75px;
    }
    
    .login-avatar svg {
        width: 40px;
        height: 40px;
    }
    
    .login-container {
        max-width: 100%;
        padding: 0 20px;
        gap: 24px;
    }
    
    .input-modern {
        padding: 16px 22px;
        font-size: 15px;
    }
}

/* Dashboard */
.navbar {
    background: linear-gradient(135deg, #0a2a4a 0%, #0f3a63 100%);
    color: white;
    border-bottom: 1px solid rgba(184, 124, 77, 0.3);
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 20px 20px;
    position: relative;
    overflow: hidden;
}

/* Mobile hamburger & popup menu */
#hamburgerBtn { display: none; }

/* Mobile popup menu styles */
.mobile-menu-popup {
    position: fixed;
    top: 70px;
    right: 16px;
    width: 88%;
    max-width: 360px;
    background: white;
    color: #0f172a;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(2,6,23,0.2);
    z-index: 120000;
    overflow: hidden;
    border: 1px solid #e6eef8;
    transform-origin: top right;
    animation: scaleIn 0.18s ease-out;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, #f8fafc, #ffffff);
    border-bottom: 1px solid #eef4fb;
    font-weight: 700;
}

.mobile-menu-header button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.mobile-menu-popup ul {
    list-style: none;
    padding: 8px;
    margin: 0;
}

.mobile-menu-popup .mobile-menu-item {
    padding: 12px 14px;
    border-radius: 8px;
    margin: 6px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.14s ease, transform 0.12s ease;
    color: #0f172a;
    font-weight: 600;
}

.mobile-menu-popup .mobile-menu-item:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

/* Show hamburger on narrow screens and hide sidebar */
@media (max-width: 900px) {
    #hamburgerBtn { display: inline-flex; }
    .sidebar { display: none; }
    .notification-bell-container { margin-right: 8px; }
    .navbar-user-info { display: none; } /* conserve space */
}

/* Ensure popup accessible on small screens */
@media (max-width: 480px) {
    .mobile-menu-popup { top: 64px; right: 8px; width: 94%; max-width: 340px; }
}

/* Animated rust-colored top line */
.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%,
        #b87c4d 20%,
        #d8b45d 50%,
        #b87c4d 80%,
        transparent 100%);
    animation: lineaBrillo 3s infinite;
}

/* Subtle particle effect */
.navbar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(184, 124, 77, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

@keyframes lineaBrillo {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: logoGifLike 2s ease-in-out infinite;
}

@keyframes logoGifLike {
    0% {
        transform: rotate(0deg) scale(1);
    }
    10% {
        transform: rotate(-8deg) scale(1.08);
    }
    20% {
        transform: rotate(8deg) scale(1.12);
    }
    30% {
        transform: rotate(-6deg) scale(1.1);
    }
    40% {
        transform: rotate(6deg) scale(1.08);
    }
    50% {
        transform: rotate(0deg) scale(1.15);
    }
    60% {
        transform: rotate(-4deg) scale(1.1);
    }
    70% {
        transform: rotate(4deg) scale(1.08);
    }
    80% {
        transform: rotate(-2deg) scale(1.05);
    }
    90% {
        transform: rotate(2deg) scale(1.02);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

.navbar-brand h1 {
    font-size: 32px;
    font-weight: 700;
    color: white;
    position: relative;
    display: inline-block;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.navbar-brand h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 60px;
    height: 3px;
    background: #b87c4d;
    transition: width 0.3s ease;
}

.navbar-brand:hover h1::after {
    width: 100%;
}

@keyframes textShine {
    0% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
    100% {
        background-position: 0% center;
    }
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.navbar-user-info:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.navbar-user-info:hover .user-avatar {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.navbar-user span {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.btn-logout {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-logout:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-logout:active {
    transform: translateY(0);
}

.dashboard-container {
    display: flex;
    height: calc(100vh - 65px);
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--navy-institutional), rgba(11,61,99,0.98));
    color: #e6f0fb;
    border-right: 1px solid rgba(255,255,255,0.04);
    padding: 20px 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    padding: 12px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    color: rgba(230,240,251,0.95);
    font-size: 14px;
    transition: background 0.18s ease;
    border-radius: 4px 0 0 4px;
    margin: 6px 8px;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 0 4px 4px 0;
    transition: height 0.3s ease;
}

.nav-item:hover {
    background: linear-gradient(90deg, #f0f9ff 0%, transparent 100%);
    color: var(--text);
    padding-left: 28px;
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
    color: var(--gold);
    border-right: 3px solid var(--gold);
    font-weight: 700;
}

.nav-item.active::before {
    height: 100%;
}

.nav-icon {
    font-size: 18px;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.view h2 {
    font-size: 28px;
    margin-bottom: 24px;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-title {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #0F2C59 0%, #1B5E8C 50%, #0F2C59 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    animation: titleGradient 3s ease infinite;
    text-shadow: 0 2px 4px rgba(15, 44, 89, 0.1);
}

@keyframes titleGradient {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
}

.dashboard-filters {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Row 1: Strategic KPI Cards - Clean Governmental Style */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    border: 2px solid #eef2f6;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Animated rust-colored gradient border */
.kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 3px;
    background: linear-gradient(135deg, #b87c4d, #d8b45d, #b87c4d);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.kpi-card:hover::before {
    opacity: 1;
}

/* Rust-colored bottom line */
.kpi-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, #b87c4d, #d8b45d);
    transform: translateX(-50%);
    transition: width 0.4s ease;
}

.kpi-card:hover::after {
    width: 90%;
}

.kpi-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 40px -15px rgba(184, 124, 77, 0.3);
    border-color: transparent;
}

.kpi-icon-minimal {
    font-size: 20px;
    color: #6b7280;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.kpi-card:hover .kpi-icon-minimal {
    color: #b87c4d;
    transform: scale(1.15);
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    font-family: 'Inter', -apple-system, sans-serif;
    transition: all 0.3s ease;
}

.kpi-card:hover .kpi-value {
    color: #b87c4d;
    transform: scale(1.1);
}

.kpi-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
    padding-bottom: 5px;
}

.kpi-label::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #b87c4d;
    transition: width 0.3s ease;
}

.kpi-card:hover .kpi-label {
    color: #b87c4d;
}

.kpi-card:hover .kpi-label::after {
    width: 100%;
}

/* Row 2: Project Status Overview - Clean Section */
.status-overview-section {
    margin-bottom: 24px;
}

.status-card-clean {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 2px solid #eef2f6;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.status-card-clean:hover {
    box-shadow: 0 20px 30px -10px rgba(184, 124, 77, 0.2);
    transform: translateY(-5px);
}

.section-title-clean {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #0F2C59;
    padding-bottom: 8px;
}

/* Row 3: Strategic Tracking - Two Columns */
.strategic-tracking-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.tracking-left,
.tracking-right {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 2px solid #eef2f6;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tracking-left:hover,
.tracking-right:hover {
    box-shadow: 0 20px 30px -10px rgba(184, 124, 77, 0.2);
    transform: translateY(-5px);
}

/* Critical Projects Table */
#criticalProjectsTable {
    overflow-x: auto;
}

#criticalProjectsTable table {
    width: 100%;
    border-collapse: collapse;
}

#criticalProjectsTable thead {
    background: #f9fafb;
}

#criticalProjectsTable th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
}

#criticalProjectsTable td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    color: #374151;
}

#criticalProjectsTable tbody tr {
    transition: all 0.3s ease;
}

#criticalProjectsTable tbody tr:hover {
    background: rgba(184, 124, 77, 0.05);
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#criticalProjectsTable tbody tr:hover td:first-child {
    border-left: 4px solid #b87c4d;
    padding-left: 8px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .strategic-tracking-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Legacy chart containers (keep for other views) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
    border-color: var(--primary-light);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.chart-container {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chart-container h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text);
}

.btn-primary, .btn-secondary {
    /* Larger touch targets for mobile friendliness */
    padding: 14px 28px;
    min-height: 44px;         /* ensures 44x44 minimum tap size */
    min-width: 44px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    touch-action: manipulation; /* improve responsiveness on touch devices */
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* reduce tap flash */
}

/* Ensure icon-style buttons and small inline controls meet touch minimums */
.btn-icon {
    padding: 10px 12px;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    touch-action: manipulation;
}

/* Make password visibility toggle easier to tap */
.password-toggle {
    padding: 10px;
    min-height: 44px;
    min-width: 44px;
    border-radius: 10px;
    right: 8px;
}

/* Login primary button larger and touch friendly */
.login-user-button {
    padding: 14px 26px;
    min-height: 48px;
    min-width: 160px;
    font-size: 16px;
    border-radius: 28px;
    touch-action: manipulation;
}

/* Mobile: increase spacing between stacked touch elements */
@media (max-width: 480px) {
    .btn-primary, .btn-secondary {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 50px;
        width: 100%;
    }

    .btn-icon {
        padding: 12px;
        min-height: 48px;
        min-width: 48px;
    }

    .password-group, .form-group-modern, .form-group {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .input-modern {
        width: 100%;
        padding: 16px 20px;
    }

    /* Ensure nav items are easy to tap on mobile */
    .nav-item {
        padding: 14px 18px;
        font-size: 16px;
    }

    .mobile-menu-popup .mobile-menu-item {
        padding: 16px 18px;
        font-size: 16px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    transform: translateY(0);
}

.data-table {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.15s ease;
}

.modal-content {
    background: var(--surface);
    padding: 32px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    padding: 0;
}

.modal-close:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.05);
}

.modal-close:active {
    transform: scale(0.98);
    background: rgba(0, 0, 0, 0.1);
}

.btn-modal-close {
    min-width: 160px;
    max-width: 220px;
    padding: 12px 32px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-modal-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.35);
}

.btn-modal-close:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.reports-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: #2563eb;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--bg);
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

table tbody tr {
    transition: all 0.3s ease;
}

table tbody tr:hover {
    background: linear-gradient(90deg, #f0f9ff 0%, transparent 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.08);
}

table td {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* Unified badge base for modern, accessible state chips */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    min-height: 28px;
    line-height: 1;
    border-radius: 999px; /* fully rounded pill */
    font-size: 12px;
    font-weight: 700; /* bold text per design */
    letter-spacing: -0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 4px 10px rgba(2, 6, 23, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: #0f172a;
    white-space: nowrap;
}

/* Hover affordance */
.badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.08);
}

/* State-specific badges (projects module) */
/* Pendiente - Yellow (not started) */
.badge-pendiente {
    background: linear-gradient(180deg, #fff7cc 0%, #fff0a6 100%); /* soft yellow background */
    color: #6b4a00; /* dark yellow text for contrast */
    border: 1px solid rgba(107,74,0,0.10);
    box-shadow: 0 6px 18px rgba(107,74,0,0.06);
    font-weight: 700;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
}

/* Proceso - Blue (in execution) */
.badge-proceso {
    background: linear-gradient(180deg, #e7f0ff 0%, #d0e4ff 100%); /* soft blue background */
    color: #073165; /* dark blue text for contrast */
    border: 1px solid rgba(7,49,101,0.10);
    box-shadow: 0 6px 18px rgba(7,49,101,0.06);
    font-weight: 700;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
}

/* Pausado - Grey (temporarily stopped) */
.badge-pausado {
    background: linear-gradient(180deg, #f3f4f6 0%, #eaedf0 100%); /* light grey background */
    color: #374151; /* dark grey text */
    border: 1px solid rgba(55,65,81,0.08);
    box-shadow: 0 6px 18px rgba(15,23,42,0.04);
    font-weight: 700;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
}

/* Realizado - Green (completed) */
.badge-realizado {
    background: linear-gradient(180deg, #e9fff0 0%, #c9f8db 100%); /* soft green background */
    color: #064e3b; /* dark green text */
    border: 1px solid rgba(6,78,59,0.08);
    box-shadow: 0 6px 18px rgba(6,78,59,0.06);
    font-weight: 700;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
}

/* Cancelado - Red (annulled) */
.badge-cancelado {
    background: linear-gradient(180deg, #fff1f1 0%, #ffd6d6 100%); /* soft red background */
    color: #7a1b1b; /* dark red text */
    border: 1px solid rgba(122,27,27,0.08);
    box-shadow: 0 6px 18px rgba(122,27,27,0.06);
    font-weight: 700;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
}

/* Ensure uniform size across module components */
.phase-badge, .badge, .badge-pendiente, .badge-proceso, .badge-pausado, .badge-realizado, .badge-cancelado {
    min-width: 84px;
    text-align: center;
    padding-left: 10px;
    padding-right: 10px;
}

/* Small responsive tweak */
@media (max-width: 480px) {
    .badge {
        min-width: 68px;
        font-size: 11px;
    }
}

.config-section {
    margin-bottom: 48px;
}

.config-section h3 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text);
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 300px;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast.info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification Bell Styles */
.btn-notification-bell:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-notification-bell:active {
    transform: translateY(0);
}

.notification-dropdown {
    animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.notification-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    gap: 12px;
    align-items: start;
}

.notification-item:hover {
    background: linear-gradient(90deg, #f0f9ff 0%, transparent 100%);
}

.notification-item.unread {
    background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
}

.notification-item.unread::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.notification-item.read::before {
    content: '';
    width: 8px;
    height: 8px;
    background: transparent;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.btn-group {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-cancel {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.btn-cancel:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.btn-cancel:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.action-btns {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-edit {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.btn-edit:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.btn-delete {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

.btn-view {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
}

.btn-view:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-icon:active {
    transform: translateY(0);
}

/* SweetAlert2 Custom Styles */
.swal-custom-popup {
    border-radius: 16px !important;
    padding: 24px !important;
}

.swal-custom-confirm {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2) !important;
}

.swal-custom-confirm:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

.swal-custom-cancel {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    color: #0f172a !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.swal-custom-cancel:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .toast-container {
        right: 12px;
        left: 12px;
    }
    
    .toast {
        min-width: auto;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .dashboard-filters {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .kpi-value {
        font-size: 36px;
    }
    
    .status-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-title {
        font-size: 24px;
    }
}