:root {
    /* Paleta Corporativa Kuantiz */
    --bg-body: #0f172a;       
    --bg-sidebar: #0b1120;
    --bg-header: #1e293b;
    --bg-card: #1e293b;       
    --bg-input: #334155;
    --bg-hover: #374151;
    --border-color: #334155;
    
    --primary: #3b82f6;       
    --primary-hover: #2563eb; 
    
    --text-main: #f8fafc;     
    --text-muted: #94a3b8;    
    
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --sidebar-width: 280px; 
    --header-height: 80px;
    --radius: 12px;
}

body {
    margin: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body); color: var(--text-main); line-height: 1.6;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
* { box-sizing: border-box; }
img { max-width: 100%; display: block; }

/* Utilidades */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* --- Botones --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border-radius: var(--radius);
    font-weight: 600; border: none; cursor: pointer;
    font-size: 0.95rem; transition: all 0.2s; gap: 8px; text-decoration: none;
}
.btn-primary { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%); 
    color: white; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6); }

/* Nuevo Botón Secundario (Gris/Slate) para "Configurar" */
.btn-secondary {
    background: #334155; color: white; border: 1px solid #475569;
}
.btn-secondary:hover { background: #475569; border-color: #64748b; }

.btn:disabled { 
    opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none; 
    background: #333; color: #888;
}

.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* Botón Hamburguesa */
.mobile-menu-btn {
    display: none; background: transparent; border: 1px solid var(--border-color);
    color: white; border-radius: 8px; padding: 8px; cursor: pointer; margin-right: 15px;
}

.topbar .btn-outline { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.05); color: #fff; }
.topbar .btn-outline:hover { background: rgba(255,255,255,0.2); border-color: #fff; }

/* Inputs */
.form-section { margin-bottom: 30px; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.form-section h3 { margin-bottom: 15px; font-size: 1.2rem; border-left: 4px solid var(--primary); padding-left: 10px; }
.form-group { margin-bottom: 1.5rem; text-align: left; }
label { display: block; margin-bottom: 0.5rem; color: #cbd5e1; font-size: 0.9rem; font-weight: 500; }
input, select, textarea {
    width: 100%; padding: 12px 16px; background-color: #0f172a; 
    border: 1px solid var(--border-color); border-radius: var(--radius);
    color: white; font-size: 1rem;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
.alert { padding: 15px; border-radius: var(--radius); margin-bottom: 20px; }
.alert-success { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid var(--danger); }

/* Password Wrapper */
.password-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.password-wrapper input { padding-right: 45px; }
.toggle-icon {
    position: absolute; right: 15px; cursor: pointer; color: var(--text-muted);
    z-index: 100; display: flex; align-items: center; height: 100%;
}
.toggle-icon:hover { color: white; }
.toggle-icon svg { width: 22px; height: 22px; }

/* Password Validation */
.pwd-validation-list { list-style: none; padding: 0; margin: 10px 0; font-size: 0.85rem; color: var(--text-muted); }
.pwd-validation-list li { margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.pwd-validation-list li.valid { color: var(--success); font-weight: 500; }
.pwd-validation-list li::before { content: '•'; font-weight: bold; margin-right: 5px; }
.pwd-validation-list li.valid::before { content: '✓'; color: var(--success); }

/* Mini Stats (Para Dashboard CEO) */
.mini-stats-container { display: flex; gap: 15px; margin-top: 10px; flex-wrap: wrap; }
.mini-stat { font-size: 0.75rem; background: rgba(255,255,255,0.05); padding: 4px 8px; border-radius: 6px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.mini-stat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.mini-stat-dot.ok { background: var(--success); box-shadow: 0 0 5px var(--success); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; position: relative; }
.sidebar { 
    width: var(--sidebar-width); background-color: var(--bg-sidebar); 
    border-right: 1px solid var(--border-color); display: flex; flex-direction: column; 
    position: fixed; height: 100vh; z-index: 1000; transition: transform 0.3s ease-in-out;
}
.sidebar-header { height: 130px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border-color); padding: 20px; }
.sidebar-logo { max-height: 100%; width: auto; max-width: 220px; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.3)); }
.sidebar-nav { padding: 20px 15px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted); border-radius: var(--radius); margin-bottom: 6px; font-weight: 500; transition: 0.2s; }
.nav-item:hover, .nav-item.active { background-color: rgba(59, 130, 246, 0.1); color: var(--primary); border-left: 3px solid var(--primary); }
.nav-item svg { width: 22px; height: 22px; }

.main-content { 
    flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; 
    width: calc(100% - var(--sidebar-width));
}
.topbar { 
    height: var(--header-height); background-color: var(--bg-header); 
    border-bottom: 1px solid var(--border-color); display: flex; 
    align-items: center; justify-content: space-between; padding: 0 40px; 
    position: sticky; top: 0; z-index: 90; 
}

/* Header User */
.user-area { display: flex; align-items: center; gap: 15px; }
.header-avatar-container { width: 50px; height: 50px; min-width: 50px; border-radius: 50%; overflow: hidden; border: 2px solid var(--primary); background: #000; display: flex; align-items: center; justify-content: center; }
.header-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.header-initials { font-size: 1.2rem; font-weight: 700; color: white; }
.user-info { text-align: left; line-height: 1.3; margin-right: 15px; }
.user-name { display: block; font-weight: 600; color: white; font-size: 0.9rem; }
.user-role { display: block; font-size: 0.7rem; color: var(--primary); text-transform: uppercase; }
.last-login-badge { font-size: 0.7rem; color: var(--text-muted); display: block; }

.page-content { padding: 40px; flex: 1; }
.card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 30px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2); }

/* Images Profile */
.profile-img-preview { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; border: 3px solid var(--primary); margin-bottom: 15px; background: #000; }
.signature-img-preview { max-width: 100%; max-height: 120px; object-fit: contain; border: 1px dashed var(--border-color); padding: 10px; margin-bottom: 15px; background: rgba(255,255,255,0.05); border-radius: 8px; }

/* Login */
.auth-layout {
    display: flex; min-height: 100vh; align-items: center; justify-content: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    padding: 20px; width: 100%;
}
.auth-card {
    width: 100%; max-width: 440px; margin: 0 auto;
    background: rgba(30, 41, 59, 0.7); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 20px;
    padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    text-align: center; display: flex; flex-direction: column; align-items: center;
}
.auth-card > div, .auth-card > form { width: 100%; }
.auth-logo { width: 220px; height: 220px; object-fit: contain; margin: 0 auto 1.5rem auto; display: block; }

@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    .sidebar { transform: translateX(-100%); box-shadow: 5px 0 25px rgba(0,0,0,0.7); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .topbar { padding: 0 15px; }
    .hidden-mobile { display: none; }
    .page-content { padding: 20px 15px; }
    .auth-card { width: 95%; padding: 25px 20px; }
    .flex.md\:flex-row { flex-direction: column; }
    .metrics-grid { grid-template-columns: 1fr; }
}