/* SIS Informes — RIS Carabaya | Autores: Dennis S. Quispe M. y Wilber Choque C. */
/* ==========================================================================
   Modern Enterprise UI - RIS Carabaya Establishment Portal & Login
   Inspirado en Microsoft 365, Notion & GitHub
   ========================================================================== */

:root {
    --ui-slate-50: #f8fafc;
    --ui-slate-100: #f1f5f9;
    --ui-slate-200: #e2e8f0;
    --ui-slate-300: #cbd5e1;
    --ui-slate-400: #94a3b8;
    --ui-slate-500: #64748b;
    --ui-slate-600: #475569;
    --ui-slate-700: #334155;
    --ui-slate-800: #1e293b;
    --ui-slate-900: #0f172a;

    --ui-primary: #2563eb;
    --ui-primary-hover: #1d4ed8;
    --ui-primary-light: #eff6ff;
    --ui-success: #10b981;
    --ui-success-bg: #ecfdf5;
    --ui-warning: #f59e0b;
    --ui-danger: #ef4444;
    --ui-danger-bg: #fef2f2;
    
    --font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
    
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background-color: var(--ui-slate-50);
    color: var(--ui-slate-800);
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   MODERN LOGIN SCREEN
   -------------------------------------------------------------------------- */
.login-body {
    background: radial-gradient(ellipse at 18% 12%, #3f3f46 0%, transparent 48%),
                radial-gradient(ellipse at 86% 88%, #2a2a2e 0%, transparent 50%),
                linear-gradient(160deg, #1a1a1d 0%, #2c2c30 52%, #1f1f23 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
}

.login-card {
    background: #ffffff;
    width: 100%;
    max-width: 414px;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10;
    padding: 0 37px 51px;
    text-align: center;
}

.login-card-avatar {
    width: 129px;
    height: 129px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -64px auto 0;
    box-shadow: 0 15px 30px -8px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.15);
    border: 4px solid #ffffff;
    overflow: hidden;
}

.login-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.login-card-body h2 { font-size: 24px; font-weight: 800; color: var(--ui-slate-900); letter-spacing: -0.3px; margin-top: 20px; }
.login-card-subtitle { font-size: 14px; color: var(--ui-slate-500); font-weight: 500; margin-bottom: 30px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.input-pill {
    display: flex;
    align-items: stretch;
    background: var(--ui-slate-50);
    border: 1px solid var(--ui-slate-200);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.input-pill:focus-within {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #ffffff;
}

.input-icon-chip {
    width: 51px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ui-slate-100);
    color: var(--ui-slate-500);
    font-size: 16px;
    border-right: 1px solid var(--ui-slate-200);
}

.input-pill:focus-within .input-icon-chip {
    color: var(--ui-primary);
    border-right-color: var(--ui-slate-200);
}

.input-pill input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 14px 16px;
    font-size: 15.5px;
    font-family: inherit;
    color: var(--ui-slate-900);
}

.input-pill input:focus { outline: none; }

/* Edge/Chrome en Windows dibujan su propio ojo dentro de type=password.
   Sin esto se ven dos ojos: el nativo y el botón .password-toggle. */
.input-pill input[type="password"]::-ms-reveal,
.input-pill input[type="password"]::-ms-clear,
.password-field input[type="password"]::-ms-reveal,
.password-field input[type="password"]::-ms-clear,
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-strong-password-auto-fill-button {
    display: none !important;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    appearance: none;
}

.password-toggle {
    width: 48px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--ui-slate-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.password-toggle:hover { color: var(--ui-primary); }
.password-field {
    position: relative;
}
.password-field input {
    padding-right: 42px;
}
.password-field .password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.login-card-btn-wrap { margin-top: 25px; }

.btn-floating {
    width: 100%;
    border: none;
    padding: 15px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ui-primary) 0%, #1e40af 100%);
    color: #ffffff;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 0 15px 25px -8px rgba(37, 99, 235, 0.55);
    transition: all 0.2s;
}

.btn-floating:hover { background: var(--ui-primary-hover); transform: translateY(-2px); box-shadow: 0 18px 28px -8px rgba(37, 99, 235, 0.65); }

.login-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.login-alert-error { background: var(--ui-danger-bg); color: #b91c1c; border: 1px solid #fecaca; }
.login-alert-info { background: var(--ui-primary-light); color: #1d4ed8; border: 1px solid #bfdbfe; }

.login-page-footer {
    margin-top: 24px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Responsive Login */
@media (max-width: 480px) {
    .login-card {
        max-width: 100%;
        padding: 0 22px 36px;
    }
    .login-card-avatar {
        width: 92px;
        height: 92px;
        margin-top: -46px;
    }
}

/* --------------------------------------------------------------------------
   MODERN NAVBAR (Portal Establecimiento)
   -------------------------------------------------------------------------- */
.navbar {
    height: 72px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

.navbar-left { display: flex; align-items: center; gap: 48px; }
.brand-logo { font-size: 20px; font-weight: 800; color: var(--ui-slate-900); text-decoration: none; letter-spacing: -0.5px; display: flex; align-items: center; gap: 10px; }
.nav-links { display: flex; gap: 32px; }
.nav-item {
    text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ui-slate-500); padding: 24px 0; position: relative; display: inline-flex; align-items: center; gap: 8px;
}
.nav-item:hover, .nav-item.active { color: var(--ui-slate-900); }
.nav-item.active::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background-color: var(--ui-primary); border-radius: 3px 3px 0 0; }
.navbar-right { display: flex; align-items: center; gap: 20px; }
.icon-btn { background: none; border: none; font-size: 20px; color: var(--ui-slate-500); cursor: pointer; transition: color 0.2s; }
.icon-btn:hover { color: var(--ui-slate-900); }

/* Dropdowns */
.dropdown-wrapper { position: relative; }
.user-profile-trigger {
    display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 12px; border-radius: 30px; border: 1px solid var(--ui-slate-200); background: #fff;
}
.user-avatar img { width: 32px; height: 32px; border-radius: 50%; }
.user-info-text { display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 600; color: var(--ui-slate-900); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--ui-slate-500); }
.dropdown-menu {
    position: absolute; top: 100%; right: 0; background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); border: 1px solid var(--ui-slate-100); min-width: 240px; padding: 8px 0; z-index: 1050; margin-top: 10px;
}
.dropdown-header, .user-dropdown-header { padding: 12px 20px; }
.dropdown-divider { border-top: 1px solid var(--ui-slate-100); margin: 8px 0; }
.dropdown-link { display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: 14px; color: var(--ui-slate-700); text-decoration: none; background: transparent; border: none; width: 100%; cursor: pointer; }
.dropdown-link:hover { background: var(--ui-slate-50); color: var(--ui-primary); }

/* --------------------------------------------------------------------------
   ESTABLISHMENT PORTAL DASHBOARD (The missing classes)
   -------------------------------------------------------------------------- */
.dashboard-container {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 24px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 40px;
}

/* LEFT SIDEBAR (STEPPER) */
.sidebar-left, .sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-header {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--ui-slate-200);
}

.sidebar-header h3 { font-size: 18px; font-weight: 700; color: var(--ui-slate-900); margin-bottom: 12px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ui-slate-600); margin-bottom: 8px; }
.progress-bar-container { height: 8px; background: var(--ui-slate-100); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--ui-primary); border-radius: 4px; transition: width 0.3s; }

.stepper {
    list-style: none;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--ui-slate-200);
}
.stepper-item { display: flex; gap: 16px; margin-bottom: 24px; position: relative; }
.stepper-item:last-child { margin-bottom: 0; }
.stepper-item::after { content: ''; position: absolute; left: 15px; top: 32px; bottom: -24px; width: 2px; background: var(--ui-slate-200); z-index: 1; }
.stepper-item:last-child::after { display: none; }
.stepper-item.completed::after { background: var(--ui-primary); }

.step-icon {
    width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; z-index: 2; position: relative; background: #fff; border: 2px solid var(--ui-slate-300); color: var(--ui-slate-500);
}
.stepper-item.completed .step-icon { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
.stepper-item.active .step-icon { border-color: var(--ui-primary); color: var(--ui-primary); }

.step-content { flex: 1; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.step-title { font-size: 15px; font-weight: 600; color: var(--ui-slate-900); }
.step-date, .step-status { font-size: 12.5px; color: var(--ui-slate-500); }
.step-badge { display: inline-block; padding: 4px 10px; background: var(--ui-primary-light); color: var(--ui-primary); font-size: 11px; font-weight: 700; border-radius: 20px; align-self: flex-start; margin-top: 4px; }

/* MAIN CONTENT */
.main-content { display: flex; flex-direction: column; gap: 24px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.breadcrumb { font-size: 13px; font-weight: 600; color: var(--ui-slate-500); margin-bottom: 8px; display: flex; gap: 8px; }
.breadcrumb .current { color: var(--ui-slate-900); }
.main-title { font-size: 28px; font-weight: 800; color: var(--ui-slate-900); letter-spacing: -0.5px; }
.subtitle { font-size: 15px; color: var(--ui-slate-500); }

/* TAB NAVIGATION */
.tab-navigation {
    display: flex; gap: 8px; border-bottom: 1px solid var(--ui-slate-200); padding-bottom: 0;
}
.tab-item {
    padding: 12px 24px; font-size: 14px; font-weight: 600; color: var(--ui-slate-600); text-decoration: none; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.tab-item:hover { color: var(--ui-slate-900); }
.tab-item.active { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }

/* ALERT CARDS */
.alert-card-green {
    background: var(--ui-success-bg);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.alert-icon { font-size: 24px; color: var(--ui-success); }
.alert-content h4 { font-size: 16px; font-weight: 700; color: #064e3b; margin-bottom: 8px; }
.alert-content p { font-size: 14px; color: #065f46; margin-bottom: 16px; }
.btn-dark-green { background: #059669; color: #fff; padding: 8px 16px; border-radius: var(--radius-md); font-weight: 600; font-size: 13px; border: none; cursor: pointer; }
.btn-dark-green:hover { background: #047857; }

/* UPLOAD ZONE */
.upload-zone-card {
    background: #fff;
    border: 1px dashed var(--ui-slate-300);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.upload-cloud-icon { font-size: 48px; color: var(--ui-primary); margin-bottom: 16px; }
.upload-zone-card h3 { font-size: 20px; font-weight: 700; color: var(--ui-slate-900); margin-bottom: 8px; }
.upload-instructions { font-size: 14px; color: var(--ui-slate-500); margin-bottom: 24px; }
.hidden-file-input { display: none; }
.btn-upload { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; font-size: 15px; }

/* CATEGORY SELECTOR */
.category-selector-group {
    display: flex; gap: 16px; justify-content: center; margin-bottom: 24px;
}
.category-option input { display: none; }
.category-card {
    display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 2px solid var(--ui-slate-200); border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s; width: 220px; text-align: center; color: var(--ui-slate-600);
}
.category-card i { font-size: 24px; }
.category-card strong { font-size: 14px; font-weight: 600; }
.category-option input:checked + .category-card { border-color: var(--ui-primary); background: var(--ui-primary-light); color: var(--ui-primary); box-shadow: 0 4px 6px rgba(37, 99, 235, 0.1); }

/* KPI CARDS GRID */
.kpi-cards-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.kpi-card {
    background: #fff; border: 1px solid var(--ui-slate-200); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm);
}
.kpi-icon-wrapper { width: 40px; height: 40px; background: var(--ui-slate-50); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--ui-slate-600); font-size: 18px; flex-shrink: 0; }
.kpi-data { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 11px; font-weight: 700; color: var(--ui-slate-500); text-transform: uppercase; }
.kpi-value { font-size: 15px; font-weight: 700; color: var(--ui-slate-900); }
.status-pill { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.blue-pill { background: var(--ui-primary-light); color: var(--ui-primary); }

/* WIDGETS RIGHT SIDEBAR */
.widget-card { background: #fff; border: 1px solid var(--ui-slate-200); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.widget-unit { display: flex; flex-direction: column; gap: 16px; }
.unit-icon { width: 48px; height: 48px; background: #fff7ed; color: #ea580c; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.unit-title { font-size: 16px; font-weight: 700; color: var(--ui-slate-900); }
.unit-label { font-size: 12px; font-weight: 600; color: var(--ui-slate-500); }
.unit-details .detail-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--ui-slate-100); }
.unit-details .detail-label { color: var(--ui-slate-500); }
.unit-details .detail-value { font-weight: 600; color: var(--ui-slate-800); }

.widget-header h3 { font-size: 16px; font-weight: 700; color: var(--ui-slate-900); margin-bottom: 16px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ui-slate-100); }
.file-item:last-child { border-bottom: none; }
.file-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pdf-icon { background: #fef2f2; color: #dc2626; }
.docx-icon { background: var(--ui-primary-light); color: var(--ui-primary); }
.file-details { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-size: 14px; font-weight: 600; color: var(--ui-slate-900); }
.doc-category-pill { font-size: 10px; font-weight: 600; color: var(--ui-slate-500); background: var(--ui-slate-100); padding: 2px 6px; border-radius: 4px; display: inline-block; align-self: flex-start; }
.file-meta { font-size: 11px; color: var(--ui-slate-400); }
.btn-icon-dots { color: var(--ui-slate-400); text-decoration: none; padding: 4px; transition: color 0.2s; }
.btn-icon-dots:hover { color: var(--ui-primary); }

.widget-hitos-dark { background: var(--ui-slate-900); color: #fff; border: none; }
.widget-hitos-dark h3 { color: #fff; }
.hitos-list { list-style: none; display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.hito-item { display: flex; gap: 12px; }
.hito-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; }
.green-dot { background: var(--ui-success); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2); }
.hito-content { display: flex; flex-direction: column; gap: 4px; }
.hito-content strong { font-size: 14px; font-weight: 600; }
.hito-date { font-size: 12px; color: var(--ui-slate-400); }

/* Buttons & Utilities */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.2); opacity: 0; transition: opacity 0.3s;
}
.btn:active::after { opacity: 1; transition: 0s; }

.btn-primary { 
    background: linear-gradient(135deg, var(--ui-primary) 0%, #3b82f6 100%); 
    color: #fff; 
    padding: 14px 28px; 
    border-radius: var(--radius-md); 
    font-size: 15px; 
    font-weight: 600; 
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255,255,255,0.2); 
}
.btn-primary:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255,255,255,0.2); 
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

.btn-dark-green { 
    background: linear-gradient(135deg, #059669 0%, #10b981 100%); 
    color: #fff; 
    padding: 12px 24px; 
    border-radius: var(--radius-md); 
    font-weight: 600; 
    font-size: 14px; 
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-dark-green:hover { 
    background: linear-gradient(135deg, #047857 0%, #059669 100%); 
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-outline-secondary { 
    background: #fff; 
    border: 1px solid var(--ui-slate-300); 
    color: var(--ui-slate-700); 
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.btn-outline-secondary:hover { 
    background: var(--ui-slate-50); 
    border-color: var(--ui-slate-400); 
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--ui-slate-900);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.modal-card { background: #fff; border-radius: var(--radius-xl); width: 100%; max-width: 600px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { padding: 24px; border-bottom: 1px solid var(--ui-slate-100); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--ui-slate-900); }
.close-btn { background: none; border: none; font-size: 24px; color: var(--ui-slate-400); cursor: pointer; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--ui-slate-100); display: flex; justify-content: flex-end; }
