/* ============================================================
   X-GPS ERP - Estilos Globales
   ============================================================ */

:root {
    --erp-primary: #4f46e5;
    --erp-primary-light: #6366f1;
    --erp-primary-dark: #4338ca;
    --erp-bg: #f1f5f9;
    --erp-text: #1e293b;
    --erp-text-muted: #64748b;
    --erp-border: #e2e8f0;
    --erp-sidebar-width: 260px;      /* conservado por compatibilidad, ya no se usa */
    --erp-topbar-height: 64px;
}

* { box-sizing: border-box; }

body.erp-body {
    background: var(--erp-bg);
    font-family: 'Figtree', system-ui, sans-serif;
    margin: 0;
    color: var(--erp-text);
}

/* ============================================================
   TOPBAR (reemplaza al sidebar) — colores originales del sidebar
   ============================================================ */
.erp-topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
    height: var(--erp-topbar-height);
    background: linear-gradient(90deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(30, 27, 75, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    color: #ffffff;
}

.erp-topbar-logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    padding-right: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    height: 40px;
}
.erp-topbar-logo h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1;
    background: linear-gradient(135deg, #a5b4fc, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.erp-topbar-logo p {
    margin: 3px 0 0;
    font-size: 9.5px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1;
}

.erp-topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.erp-topnav::-webkit-scrollbar { display: none; }

.erp-topnav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
    height: 40px;
}
.erp-topnav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}
.erp-topnav-item.active {
    background: linear-gradient(135deg, var(--erp-primary), var(--erp-primary-dark));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}
.erp-topnav-item .erp-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.15s ease;
}
.erp-topnav-item:hover .erp-nav-icon { color: #ffffff; }
.erp-topnav-item.active .erp-nav-icon,
.erp-topnav-item.active:hover .erp-nav-icon { color: #ffffff; }

.erp-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   USUARIO — dropdown en el topbar (tema oscuro)
   ============================================================ */
.erp-topbar-user {
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
}
.erp-user-dropdown { position: relative; }
.erp-user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.erp-user-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}
.erp-user-toggle .erp-avatar {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.erp-user-toggle .erp-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}
.erp-user-toggle .erp-user-name {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.erp-user-toggle .erp-caret {
    color: rgba(255, 255, 255, 0.6);
    transition: transform 0.2s ease;
}
.erp-user-dropdown.open .erp-caret { transform: rotate(180deg); }

.erp-user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    background: #1e1b4b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 6px;
    z-index: 200;
}
.erp-user-dropdown.open .erp-user-menu { display: block; }
.erp-user-menu .erp-user-email {
    margin: 0;
    padding: 10px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    word-break: break-all;
}
.erp-logout {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-top: 4px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.erp-logout:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
}

/* Avatar base (fallback para otros usos fuera del topbar) */
.erp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #78350f;
    font-size: 16px;
    flex-shrink: 0;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.erp-main {
    padding: 32px;
    width: 100%;
    min-height: calc(100vh - var(--erp-topbar-height));
}
.erp-page-header { margin-bottom: 28px; }
.erp-page-title { font-size: 28px; font-weight: 800; color: var(--erp-text); margin: 0 0 6px; }
.erp-page-subtitle { font-size: 14px; color: var(--erp-text-muted); margin: 0; }

/* ============================================================
   CARDS
   ============================================================ */
.erp-card {
    background: white; border-radius: 16px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.04);
    border: 1px solid var(--erp-border); margin-bottom: 20px;
}
.erp-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--erp-border);
    flex-wrap: wrap; gap: 12px;
}
.erp-card-title { font-size: 18px; font-weight: 700; color: var(--erp-text); margin: 0; }

/* ============================================================
   STATS / KPI CARDS
   ============================================================ */
.erp-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }

.erp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 1100px) { .erp-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 650px) { .erp-kpi-grid { grid-template-columns: 1fr; } }

.erp-stat-card {
    background: white; border-radius: 16px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid var(--erp-border);
    position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
}
.erp-stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 6px; height: 100%; }
.erp-stat-card.indigo::before { background: linear-gradient(180deg, #6366f1, #4f46e5); }
.erp-stat-card.emerald::before { background: linear-gradient(180deg, #10b981, #059669); }
.erp-stat-card.amber::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.erp-stat-card.rose::before { background: linear-gradient(180deg, #f43f5e, #e11d48); }
.erp-stat-card.sky::before { background: linear-gradient(180deg, #0ea5e9, #0284c7); }
.erp-stat-card.red::before { background: linear-gradient(180deg, #ef4444, #dc2626); }

.erp-stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 8px; }
.erp-stat-card.indigo .erp-stat-icon { background: #eef2ff; }
.erp-stat-card.emerald .erp-stat-icon { background: #ecfdf5; }
.erp-stat-card.amber .erp-stat-icon { background: #fffbeb; }
.erp-stat-card.rose .erp-stat-icon { background: #fff1f2; }
.erp-stat-card.sky .erp-stat-icon { background: #e0f2fe; }
.erp-stat-card.red .erp-stat-icon { background: #fee2e2; }

.erp-stat-label { font-size: 12px; font-weight: 600; color: var(--erp-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 0; }
.erp-stat-value { font-size: 32px; font-weight: 800; color: var(--erp-text); margin: 0; line-height: 1; }

/* ============================================================
   BOTONES
   ============================================================ */
.erp-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: 10px; font-size: 14px;
    font-weight: 600; cursor: pointer; border: none;
    text-decoration: none; transition: all 0.2s; font-family: inherit;
}
.erp-btn-primary { background: linear-gradient(135deg, var(--erp-primary-light), var(--erp-primary-dark)); color: white; box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.erp-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(79,70,229,0.4); }
.erp-btn-secondary { background: white; color: var(--erp-text); border: 1px solid var(--erp-border); }
.erp-btn-secondary:hover { background: #f8fafc; }
.erp-btn-edit { background: #fef3c7; color: #92400e; padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.erp-btn-edit:hover { background: #fde68a; }
.erp-btn-delete { background: #fee2e2; color: #991b1b; padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.erp-btn-delete:hover { background: #fecaca; }
.erp-btn-sm { padding: 8px 14px; font-size: 13px; height: 38px; white-space: nowrap; flex-shrink: 0; }

/* ============================================================
   TABLAS
   ============================================================ */
.erp-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--erp-border); }
.erp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.erp-table thead { background: linear-gradient(135deg, #f8fafc, #f1f5f9); }
.erp-table th { padding: 14px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--erp-text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--erp-border); }
.erp-table td { padding: 14px 16px; border-bottom: 1px solid var(--erp-border); color: var(--erp-text); }
.erp-table tbody tr { transition: background 0.15s; }
.erp-table tbody tr:hover { background: #f8fafc; }
.erp-table tbody tr:last-child td { border-bottom: none; }
.erp-empty { text-align: center; padding: 40px 20px; color: var(--erp-text-muted); font-style: italic; }

/* ============================================================
   FORMULARIOS (GRID 3 COLUMNAS RESPONSIVE)
   ============================================================ */
.erp-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 20px;
    margin-bottom: 8px;
}
@media (max-width: 1100px) { .erp-form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .erp-form-grid { grid-template-columns: 1fr; } }

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

.erp-form-group { display: flex; flex-direction: column; gap: 6px; }
.erp-form-group textarea.erp-input {
    resize: vertical;
    min-height: 68px;
    font-family: inherit;
    line-height: 1.5;
}

.erp-label { font-size: 13px; font-weight: 600; color: var(--erp-text); }
.erp-input {
    padding: 12px 14px; border: 2px solid var(--erp-border); border-radius: 10px;
    font-size: 14px; font-family: inherit; color: var(--erp-text);
    transition: all 0.2s; background: white; width: 100%;
}
.erp-input:focus { outline: none; border-color: var(--erp-primary-light); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.erp-input::placeholder { color: #94a3b8; }
.erp-error { color: #ef4444; font-size: 12px; font-weight: 500; }

.erp-form-actions {
    display: flex; gap: 12px; margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--erp-border); flex-wrap: wrap;
}

/* Títulos de sección dentro de formularios */
.erp-form-section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--erp-primary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 28px 0 16px;
    padding-top: 20px;
    border-top: 1px solid var(--erp-border);
}
.erp-form-section-title:first-child,
.erp-form-section-title:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* ============================================================
   CHECK GRID (opciones tipo tarjeta)
   ============================================================ */
.erp-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
@media (min-width: 1101px) { .erp-check-grid { grid-template-columns: repeat(3, 1fr); } }

.erp-check-card {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px; background: white;
    border: 2px solid var(--erp-border); border-radius: 10px;
    cursor: pointer; transition: all 0.15s;
}
.erp-check-card:hover { border-color: var(--erp-primary-light); background: #f8fafc; }
.erp-check-card input {
    margin-top: 2px; width: 18px; height: 18px;
    accent-color: var(--erp-primary); flex-shrink: 0;
}
.erp-check-card strong { display: block; font-size: 13px; color: var(--erp-text); }
.erp-check-card span { font-size: 11px; color: var(--erp-text-muted); display: block; margin-top: 2px; line-height: 1.4; }

/* Panel de servicios (checkboxes) */
.erp-servicios-panel {
    background: #f8fafc; border: 1px solid var(--erp-border);
    border-radius: 10px; padding: 14px;
    max-height: 280px; overflow-y: auto;
}
.erp-servicio-check {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; transition: background 0.15s;
}
.erp-servicio-check:hover { background: #eef2ff; }
.erp-servicio-check input {
    width: 16px; height: 16px;
    accent-color: var(--erp-primary); flex-shrink: 0;
}

/* Checkboxes de la matriz de permisos */
.erp-check-wrap {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; width: 24px; height: 24px;
}
.erp-check-wrap input[type="checkbox"] {
    position: absolute; opacity: 0; width: 100%; height: 100%;
    cursor: pointer; margin: 0; z-index: 2;
}
.erp-check-visual {
    width: 22px; height: 22px;
    border: 2px solid #cbd5e1; border-radius: 6px;
    background: white; transition: all 0.15s;
    position: relative; display: inline-block;
}
.erp-check-wrap input:checked + .erp-check-visual {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    border-color: #4f46e5;
}
.erp-check-wrap input:checked + .erp-check-visual::after {
    content: ''; position: absolute; left: 6px; top: 2px;
    width: 6px; height: 11px;
    border: solid white; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.erp-check-wrap input:focus + .erp-check-visual {
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* ============================================================
   ALERTS
   ============================================================ */
.erp-alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.erp-alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.erp-alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.erp-welcome { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%); color: white; padding: 36px; border-radius: 20px; margin-bottom: 24px; position: relative; overflow: hidden; box-shadow: 0 10px 30px rgba(79,70,229,0.3); }
.erp-welcome::after { content: ''; position: absolute; top: -50%; right: -10%; width: 400px; height: 400px; background: radial-gradient(circle, rgba(251,191,36,0.15), transparent 70%); border-radius: 50%; }
.erp-welcome h2 { font-size: 26px; font-weight: 800; margin: 0 0 8px; position: relative; z-index: 1; }
.erp-welcome p { font-size: 15px; margin: 0; opacity: 0.9; position: relative; z-index: 1; }

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.erp-quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .erp-quick-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .erp-quick-grid { grid-template-columns: 1fr; } }
.erp-quick-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 24px 16px; border-radius: 14px;
    text-decoration: none; color: white; font-weight: 600;
    font-size: 14px; transition: all 0.2s; text-align: center;
}
.erp-quick-btn:hover { transform: translateY(-2px); }
.erp-quick-btn.indigo { background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 6px 16px rgba(79,70,229,0.3); }
.erp-quick-btn.emerald { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 6px 16px rgba(16,185,129,0.3); }
.erp-quick-btn.amber { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 6px 16px rgba(245,158,11,0.3); }
.erp-quick-btn.rose { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 6px 16px rgba(244,63,94,0.3); }
.erp-quick-icon { font-size: 32px; line-height: 1; }

/* ============================================================
   CHARTS
   ============================================================ */
.erp-charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 900px) { .erp-charts-grid { grid-template-columns: 1fr; } }
.erp-chart-container { position: relative; height: 280px; }

/* ============================================================
   LISTS
   ============================================================ */
.erp-lists-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 900px) { .erp-lists-grid { grid-template-columns: 1fr; } }
.erp-list-empty { text-align: center; padding: 36px 20px; color: var(--erp-text-muted); font-style: italic; font-size: 13px; }
.erp-link { font-size: 13px; color: var(--erp-primary); text-decoration: none; font-weight: 600; background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.erp-link:hover { text-decoration: underline; }

/* ============================================================
   LOGIN / AUTH
   ============================================================ */
.auth-wrapper { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; font-family: 'Figtree', system-ui, sans-serif; }

.auth-brand { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%); color: white; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand::before { content: ''; position: absolute; top: -10%; right: -20%; width: 500px; height: 500px; background: radial-gradient(circle, rgba(251,191,36,0.15), transparent 70%); border-radius: 50%; }
.auth-brand::after { content: ''; position: absolute; bottom: -15%; left: -15%; width: 400px; height: 400px; background: radial-gradient(circle, rgba(99,102,241,0.25), transparent 70%); border-radius: 50%; }
.auth-brand-header { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.auth-brand-logo { width: 52px; height: 52px; background: linear-gradient(135deg, #fbbf24, #f59e0b); border-radius: 14px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(251,191,36,0.4); color: #78350f; }
.auth-brand-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: 0.5px; }
.auth-brand-subtitle { font-size: 11px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 2px; margin: 2px 0 0; }

.auth-brand-content { position: relative; z-index: 1; }
.auth-brand-content h2 { font-size: 40px; font-weight: 800; line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.5px; }
.auth-brand-content h2 span { color: #fbbf24; }
.auth-brand-content p { font-size: 16px; color: rgba(255,255,255,0.8); line-height: 1.6; margin: 0; max-width: 400px; }

.auth-features { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; margin-top: 32px; }
.auth-feature { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,0.9); }
.auth-feature-icon { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; color: #fbbf24; flex-shrink: 0; }

.auth-brand-footer { position: relative; z-index: 1; font-size: 12px; color: rgba(255,255,255,0.4); }

.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: #f8fafc; }
.auth-form-box { width: 100%; max-width: 420px; }
.auth-form-header { margin-bottom: 32px; }
.auth-form-header h1 { font-size: 28px; font-weight: 800; color: #1e293b; margin: 0 0 8px; }
.auth-form-header p { font-size: 14px; color: #64748b; margin: 0; }

.auth-field { margin-bottom: 20px; }
.auth-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 8px; }

.auth-input-wrap { position: relative; }
.auth-input { width: 100%; padding: 13px 16px 13px 44px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 14px; font-family: inherit; color: #1e293b; background: white; transition: all 0.2s; }
.auth-input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.auth-input::placeholder { color: #94a3b8; }
.auth-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; transition: color 0.2s; }
.auth-input:focus + .auth-input-icon, .auth-input-wrap:focus-within .auth-input-icon { color: #4f46e5; }

.auth-error { color: #ef4444; font-size: 12px; font-weight: 500; margin-top: 6px; display: flex; align-items: center; gap: 4px; }

.auth-row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.auth-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; cursor: pointer; }
.auth-checkbox input { width: 16px; height: 16px; accent-color: #4f46e5; cursor: pointer; }
.auth-link { font-size: 13px; color: #4f46e5; text-decoration: none; font-weight: 600; }
.auth-link:hover { color: #4338ca; text-decoration: underline; }

.auth-btn { width: 100%; padding: 14px; background: linear-gradient(135deg, #6366f1, #4338ca); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(79,70,229,0.35); display: flex; align-items: center; justify-content: center; gap: 8px; font-family: inherit; }
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,0.45); }

/* Tamaños fijos de SVGs del login */
.auth-brand-logo svg { width: 26px !important; height: 26px !important; display: inline-block !important; }
.auth-feature-icon svg { width: 16px !important; height: 16px !important; display: inline-block !important; }
.auth-label svg { width: 15px !important; height: 15px !important; color: #4f46e5; display: inline-block !important; vertical-align: middle; }
.auth-input-icon svg { width: 18px !important; height: 18px !important; display: block !important; }
.auth-btn svg { width: 18px !important; height: 18px !important; display: inline-block !important; vertical-align: middle; }
.auth-error svg { width: 13px !important; height: 13px !important; display: inline-block !important; vertical-align: middle; }

/* ============================================================
   LANZADOR DE MÓDULOS (Dashboard y Categoría)
   ============================================================ */
.erp-lanzador-section { margin-bottom: 32px; }

.erp-lanzador-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.erp-lanzador-header-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; }
.erp-lanzador-header-icon.emerald { background: linear-gradient(135deg, #10b981, #059669); }
.erp-lanzador-header-icon.indigo  { background: linear-gradient(135deg, #6366f1, #4338ca); }
.erp-lanzador-header-icon.amber   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.erp-lanzador-header-icon.sky     { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.erp-lanzador-header-icon.rose    { background: linear-gradient(135deg, #f43f5e, #e11d48); }

.erp-lanzador-title { font-size: 18px; font-weight: 800; color: var(--erp-text); margin: 0; flex: 1; }
.erp-lanzador-vertodos { font-size: 13px; color: var(--erp-primary); font-weight: 600; text-decoration: none; }
.erp-lanzador-vertodos:hover { text-decoration: underline; }

.erp-lanzador-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }

.erp-lanzador-card {
    background: white; border: 1px solid var(--erp-border); border-radius: 14px;
    padding: 20px 14px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    text-align: center; text-decoration: none; transition: all 0.2s;
    cursor: pointer; position: relative; overflow: hidden;
}
.erp-lanzador-card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; opacity: 0; transition: opacity 0.2s; }
.erp-lanzador-card.emerald::after { background: linear-gradient(90deg, #10b981, #059669); }
.erp-lanzador-card.indigo::after  { background: linear-gradient(90deg, #6366f1, #4338ca); }
.erp-lanzador-card.amber::after   { background: linear-gradient(90deg, #f59e0b, #d97706); }
.erp-lanzador-card.sky::after     { background: linear-gradient(90deg, #0ea5e9, #0284c7); }
.erp-lanzador-card.rose::after    { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.erp-lanzador-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); border-color: transparent; }
.erp-lanzador-card:hover::after { opacity: 1; }

.erp-lanzador-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; transition: transform 0.2s; }
.erp-lanzador-card:hover .erp-lanzador-icon { transform: scale(1.08); }
.erp-lanzador-icon.emerald { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.erp-lanzador-icon.indigo  { background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 4px 12px rgba(79,70,229,0.3); }
.erp-lanzador-icon.amber   { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
.erp-lanzador-icon.sky     { background: linear-gradient(135deg, #0ea5e9, #0284c7); box-shadow: 0 4px 12px rgba(14,165,233,0.3); }
.erp-lanzador-icon.rose    { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 4px 12px rgba(244,63,94,0.3); }

.erp-lanzador-name { font-size: 13px; font-weight: 600; color: var(--erp-text); line-height: 1.3; }

/* ============================================================
   DASHBOARD HÍBRIDO (Hero + Buscador + Accesos)
   ============================================================ */
.erp-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 60%, #6366f1 100%);
    border-radius: 18px; padding: 28px 32px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
    gap: 24px; color: white; position: relative; overflow: hidden;
    box-shadow: 0 10px 30px rgba(79,70,229,0.25); flex-wrap: wrap;
}
.erp-hero::after {
    content: ''; position: absolute; top: -50%; right: -10%;
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(251,191,36,0.18), transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.erp-hero-left { position: relative; z-index: 1; }
.erp-hero-fecha { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.6); margin: 0 0 6px; font-weight: 600; }
.erp-hero-saludo { font-size: 26px; font-weight: 800; margin: 0 0 4px; line-height: 1.1; }
.erp-hero-sub { font-size: 14px; color: rgba(255,255,255,0.75); margin: 0; }
.erp-hero-right { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.erp-hero-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 18px; border-radius: 10px;
    font-size: 13px; font-weight: 700; text-decoration: none;
    color: white; transition: all 0.2s;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
}
.erp-hero-btn:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }
.erp-hero-btn.indigo { background: rgba(99,102,241,0.35); border-color: rgba(99,102,241,0.5); }
.erp-hero-btn.indigo:hover { background: rgba(99,102,241,0.55); }
.erp-hero-btn.emerald { background: rgba(16,185,129,0.35); border-color: rgba(16,185,129,0.5); }
.erp-hero-btn.emerald:hover { background: rgba(16,185,129,0.55); }
.erp-hero-btn.amber { background: rgba(245,158,11,0.35); border-color: rgba(245,158,11,0.5); }
.erp-hero-btn.amber:hover { background: rgba(245,158,11,0.55); }

@media (max-width: 700px) {
    .erp-hero { padding: 24px 20px; }
    .erp-hero-saludo { font-size: 20px; }
    .erp-hero-right { width: 100%; }
    .erp-hero-btn { flex: 1; justify-content: center; }
}

/* Buscador del dashboard */
.erp-search-wrap { position: relative; margin-bottom: 20px; z-index: 50; }
.erp-search-box {
    position: relative; display: flex; align-items: center;
    background: white; border: 2px solid var(--erp-border); border-radius: 14px;
    padding: 4px 18px 4px 16px; transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); color: #94a3b8;
}
.erp-search-box:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.12), 0 4px 12px rgba(0,0,0,0.05);
    color: #4f46e5;
}
.erp-search-box input {
    flex: 1; border: none; outline: none; padding: 14px 12px;
    font-size: 15px; font-family: inherit; color: var(--erp-text); background: transparent;
}
.erp-search-box input::placeholder { color: #94a3b8; }
.erp-search-kbd {
    padding: 3px 8px; background: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: 6px; font-size: 11px; font-family: inherit; color: #64748b;
    font-weight: 600; white-space: nowrap;
}

.erp-search-results {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: white; border: 1px solid var(--erp-border); border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    max-height: 400px; overflow-y: auto; z-index: 100; padding: 8px;
}
.erp-search-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 10px;
    text-decoration: none; color: var(--erp-text);
    transition: background 0.15s;
}
.erp-search-item:hover { background: #f8fafc; }
.erp-search-item-name { flex: 1; font-size: 14px; font-weight: 600; }
.erp-search-item-arrow { color: #94a3b8; font-size: 16px; }
.erp-search-empty { padding: 24px; text-align: center; color: var(--erp-text-muted); font-style: italic; font-size: 13px; }

.erp-search-dot {
    width: 12px; height: 12px; border-radius: 50%;
    flex-shrink: 0; display: inline-block;
}
.erp-search-dot.emerald { background: #10b981; }
.erp-search-dot.indigo  { background: #6366f1; }
.erp-search-dot.amber   { background: #f59e0b; }
.erp-search-dot.sky     { background: #0ea5e9; }
.erp-search-dot.rose    { background: #f43f5e; }

/* Secciones del dashboard */
.erp-dash-section {
    background: white; border-radius: 16px; border: 1px solid var(--erp-border);
    padding: 24px; margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ============================================================
   TILES (tarjetas de módulos)
   ============================================================ */
.erp-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.erp-tile {
    background: white; border: 1px solid var(--erp-border); border-radius: 14px;
    padding: 18px 14px; display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--erp-text); transition: all 0.2s;
    position: relative; overflow: hidden;
}
.erp-tile::after {
    content: ''; position: absolute; left: 0; bottom: 0;
    height: 3px; width: 100%; opacity: 0; transition: opacity 0.2s;
}
.erp-tile.emerald::after { background: linear-gradient(90deg, #10b981, #059669); }
.erp-tile.indigo::after  { background: linear-gradient(90deg, #6366f1, #4338ca); }
.erp-tile.amber::after   { background: linear-gradient(90deg, #f59e0b, #d97706); }
.erp-tile.sky::after     { background: linear-gradient(90deg, #0ea5e9, #0284c7); }
.erp-tile.rose::after    { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.erp-tile:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); border-color: transparent; }
.erp-tile:hover::after { opacity: 1; }

.erp-tile-icon {
    width: 44px; height: 44px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0; transition: transform 0.2s;
}
.erp-tile:hover .erp-tile-icon { transform: scale(1.08); }
.erp-tile-icon.emerald { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 10px rgba(16,185,129,0.25); }
.erp-tile-icon.indigo  { background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 4px 10px rgba(79,70,229,0.25); }
.erp-tile-icon.amber   { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 10px rgba(245,158,11,0.25); }
.erp-tile-icon.sky     { background: linear-gradient(135deg, #0ea5e9, #0284c7); box-shadow: 0 4px 10px rgba(14,165,233,0.25); }
.erp-tile-icon.rose    { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 4px 10px rgba(244,63,94,0.25); }

.erp-tile-name { font-size: 13px; font-weight: 600; line-height: 1.3; }

/* Cabecera de panel (título con icono + count) */
.erp-panel-pane-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--erp-border);
    flex-wrap: wrap; gap: 12px;
}
.erp-panel-pane-title-wrap { display: flex; align-items: center; gap: 12px; }
.erp-panel-pane-icon {
    width: 42px; height: 42px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.erp-panel-pane-icon.emerald { background: linear-gradient(135deg, #10b981, #059669); }
.erp-panel-pane-icon.indigo  { background: linear-gradient(135deg, #6366f1, #4338ca); }
.erp-panel-pane-icon.amber   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.erp-panel-pane-icon.sky     { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.erp-panel-pane-icon.rose    { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.erp-panel-pane-title { font-size: 20px; font-weight: 800; color: var(--erp-text); margin: 0; }
.erp-panel-pane-count { font-size: 12px; font-weight: 600; color: var(--erp-text-muted); background: #f1f5f9; padding: 5px 12px; border-radius: 20px; }

/* ============================================================
   BITÁCORA - BARRA DE FILTROS COMPACTA
   ============================================================ */
.erp-bitacora-bar-card { padding: 14px 18px; margin-bottom: 20px; }
.erp-bitacora-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.erp-input-sm { padding: 8px 12px; font-size: 13px; height: 38px; width: auto; min-width: 0; border-width: 1.5px; }
.erp-bitacora-bar select.erp-input-sm { min-width: 170px; }
.erp-bitacora-bar input[type="date"].erp-input-sm { min-width: 145px; }
.erp-input-buscar { flex: 1; min-width: 200px !important; }

@media (max-width: 900px) {
    .erp-bitacora-bar { gap: 6px; }
    .erp-bitacora-bar select.erp-input-sm,
    .erp-bitacora-bar input[type="date"].erp-input-sm { flex: 1; min-width: 130px; }
    .erp-input-buscar { width: 100%; order: 99; }
}

/* ============================================================
   MATRIZ DE PERMISOS (roles/edit)
   ============================================================ */
.erp-permisos-tabla { overflow-x: auto; border-radius: 12px; border: 1px solid var(--erp-border); }
.erp-permisos-tabla .erp-table th { background: #f8fafc; }
.erp-permisos-tabla .erp-table td { padding: 12px 16px; vertical-align: middle; }
.erp-permisos-tabla .erp-table tbody tr:hover { background: #f8fafc; }
.erp-permisos-acciones-rapidas { display: flex; gap: 8px; }
.erp-permisos-acciones-rapidas .erp-btn { padding: 8px 14px; font-size: 12px; }

/* ============================================================
   MODAL DE INACTIVIDAD (auto-logout)
   ============================================================ */
.inactivity-modal {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.inactivity-modal-box {
    background: white; border-radius: 20px; padding: 40px 32px;
    max-width: 420px; width: 100%; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: popIn 0.3s ease;
}
.inactivity-modal-icon { font-size: 56px; margin-bottom: 16px; }
.inactivity-modal-box h3 { font-size: 22px; font-weight: 800; color: var(--erp-text); margin: 0 0 12px; }
.inactivity-modal-box p { font-size: 15px; color: var(--erp-text-muted); margin: 0 0 24px; line-height: 1.5; }
.inactivity-modal-box strong { color: #dc2626; font-size: 20px; }
.inactivity-modal-box button {
    padding: 14px 28px; background: linear-gradient(135deg, #6366f1, #4338ca);
    color: white; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 14px rgba(79,70,229,0.35); transition: all 0.2s;
}
.inactivity-modal-box button:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,0.45); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* ============================================================
   RESPONSIVE GLOBAL
   ============================================================ */
@media (max-width: 900px) {
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-form-side { padding: 32px 20px; }

    /* Topbar responsive */
    .erp-topbar { padding: 0 12px; gap: 10px; }
    .erp-topbar-logo { padding-right: 12px; }
    .erp-topbar-logo h1 { font-size: 14px; }
    .erp-topbar-logo p { display: none; }
    .erp-topnav-item { padding: 8px 10px; font-size: 12.5px; }
    .erp-user-toggle .erp-user-info { display: none; }
    .erp-user-toggle { padding: 6px; }
    .erp-main { padding: 20px; }
}

@media (max-width: 520px) {
    .erp-topnav-item span:not(.erp-nav-icon) {
        display: none;
    }
    .erp-topnav-item { padding: 8px; }
}
/* ============================================================
   PALETA EXTENDIDA — Iconos lanzador (13 colores nuevos)
   ============================================================ */
.erp-lanzador-icon.violet  { background: linear-gradient(135deg, #8b5cf6, #7c3aed); box-shadow: 0 4px 12px rgba(139,92,246,0.3); }
.erp-lanzador-icon.orange  { background: linear-gradient(135deg, #f97316, #ea580c); box-shadow: 0 4px 12px rgba(249,115,22,0.3); }
.erp-lanzador-icon.cyan    { background: linear-gradient(135deg, #06b6d4, #0891b2); box-shadow: 0 4px 12px rgba(6,182,212,0.3); }
.erp-lanzador-icon.teal    { background: linear-gradient(135deg, #14b8a6, #0d9488); box-shadow: 0 4px 12px rgba(20,184,166,0.3); }
.erp-lanzador-icon.blue    { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.erp-lanzador-icon.fuchsia { background: linear-gradient(135deg, #d946ef, #c026d3); box-shadow: 0 4px 12px rgba(217,70,239,0.3); }
.erp-lanzador-icon.pink    { background: linear-gradient(135deg, #ec4899, #db2777); box-shadow: 0 4px 12px rgba(236,72,153,0.3); }
.erp-lanzador-icon.lime    { background: linear-gradient(135deg, #84cc16, #65a30d); box-shadow: 0 4px 12px rgba(132,204,22,0.3); }
.erp-lanzador-icon.green   { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
.erp-lanzador-icon.purple  { background: linear-gradient(135deg, #a855f7, #9333ea); box-shadow: 0 4px 12px rgba(168,85,247,0.3); }
.erp-lanzador-icon.red     { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.erp-lanzador-icon.yellow  { background: linear-gradient(135deg, #eab308, #ca8a04); box-shadow: 0 4px 12px rgba(234,179,8,0.3); }
.erp-lanzador-icon.slate   { background: linear-gradient(135deg, #64748b, #475569); box-shadow: 0 4px 12px rgba(100,116,139,0.3); }