/* ══════════════════════════════════════════════════════════════
   SG-SST Platform — Stylesheet v1.0
   MAS CONSULTA SAS · 2026
   Responsive: Mobile-first (480 → 768 → 1024+)
   ══════════════════════════════════════════════════════════════ */

:root {
    --primary: #1A5276;
    --primary-light: #2980B9;
    --primary-dark: #0E3A5C;
    --accent: #E74C3C;
    --accent-light: #FF6B6B;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #C0392B;
    --info: #3498DB;

    --bg: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1A2332;
    --bg-sidebar-hover: #243447;
    --bg-sidebar-active: #2C4158;

    --text: #2C3E50;
    --text-light: #7F8C8D;
    --text-white: #ECF0F1;
    --border: #DCE1E8;

    --sidebar-width: 260px;
    --sidebar-collapsed: 60px;
    --topbar-height: 56px;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #B0BEC5; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ══════════════════════════════════════════
   LOGIN SCREEN — Split layout with hero
   ══════════════════════════════════════════ */
.login-screen {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}

/* Animated particles */
.login-bg-particles { position: absolute; inset: 0; pointer-events: none; }
.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    animation: float 15s infinite ease-in-out;
}
.p1 { width: 80px; height: 80px; top: 10%; left: 10%; animation-delay: 0s; }
.p2 { width: 120px; height: 120px; top: 60%; left: 75%; animation-delay: -3s; }
.p3 { width: 60px; height: 60px; top: 30%; left: 50%; animation-delay: -6s; }
.p4 { width: 100px; height: 100px; top: 80%; left: 20%; animation-delay: -9s; }
.p5 { width: 40px; height: 40px; top: 15%; left: 80%; animation-delay: -12s; }
.p6 { width: 70px; height: 70px; top: 50%; left: 35%; animation-delay: -4s; }
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-30px) rotate(120deg); }
    66% { transform: translateY(15px) rotate(240deg); }
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* Hero panel (left) */
.login-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: white;
    position: relative;
    z-index: 1;
}
.hero-content { max-width: 480px; }
.hero-badge {
    width: 72px; height: 72px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; margin-bottom: 20px;
    backdrop-filter: blur(10px);
}
.hero-content h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.hero-content > p { font-size: 14px; opacity: 0.8; margin-bottom: 24px; }
.hero-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    margin-bottom: 28px;
}
.hero-stat {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.1);
    padding: 10px 14px; border-radius: 10px;
    font-size: 12px; backdrop-filter: blur(5px);
}
.hero-stat i { font-size: 16px; }
.hero-features { display: flex; flex-direction: column; gap: 8px; }
.hero-features div {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; opacity: 0.9;
}
.hero-features i { color: #2ECC71; font-size: 14px; }

/* Login panel (right) */
.login-panel {
    width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.97);
    padding: 32px;
    position: relative;
    z-index: 1;
    box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}
.login-card {
    width: 100%;
    max-width: 400px;
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo i {
    font-size: 42px;
    color: var(--primary);
    margin-bottom: 8px;
    display: block;
}
.login-logo h1 {
    font-size: 24px;
    color: var(--primary-dark);
    font-weight: 700;
}
.login-logo p {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 4px;
}
.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
}
.login-links a {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 12px;
    display: flex; align-items: center; gap: 4px;
}
.login-links a:hover { text-decoration: underline; }
.login-footer {
    margin-top: 24px;
    color: rgba(0,0,0,0.4);
    font-size: 12px;
    text-align: center;
}

/* Access mode selector */
.access-selector .btn.active-mode {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

/* Mobile: stack login */
@media (max-width: 900px) {
    .login-screen { flex-direction: column; }
    .login-hero { display: none; }
    .login-panel {
        width: 100%; min-height: 100vh;
        padding: 20px;
    }
}

/* ══════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════ */
.form-group {
    margin-bottom: 16px;
    flex: 1;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text);
}
.form-group label i {
    margin-right: 6px;
    color: var(--primary-light);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.15);
}
.form-group textarea {
    min-height: 80px;
    resize: vertical;
}
.form-row {
    display: flex;
    gap: 12px;
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header i {
    font-size: 24px;
    color: var(--accent-light);
}
.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.user-avatar i { font-size: 28px; opacity: 0.8; }
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-info span {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-info small { opacity: 0.6; font-size: 11px; }

.sidebar-tenant {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.05);
    font-size: 12px;
    opacity: 0.7;
}

.sidebar-menu {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.sidebar-menu li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    border-left: 3px solid transparent;
}
.sidebar-menu li:hover {
    background: var(--bg-sidebar-hover);
}
.sidebar-menu li.active {
    background: var(--bg-sidebar-active);
    border-left-color: var(--accent-light);
    font-weight: 500;
}
.sidebar-menu li i { width: 20px; text-align: center; opacity: 0.7; }
.sidebar-menu li.active i { opacity: 1; }
.sidebar-menu li.sidebar-divider {
    padding: 16px 20px 4px 20px;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    font-weight: 700;
    border-left: 3px solid transparent;
    cursor: default;
    gap: 0;
}
.sidebar-menu li.sidebar-divider:hover { background: transparent; }
.sidebar-menu li.sidebar-divider span { opacity: 1; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(231,76,60,0.15);
    color: var(--accent-light);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}
.btn-logout:hover { background: rgba(231,76,60,0.3); }

/* ══════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}
.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar h2 { font-size: 16px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.hamburger {
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    color: var(--text);
}

.content-area {
    padding: 24px;
    max-width: 1400px;
}

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h3 i { color: var(--primary-light); }

/* ══════════════════════════════════════════
   DASHBOARD GRID
   ══════════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}
.stat-icon.blue { background: linear-gradient(135deg, #2980B9, #3498DB); }
.stat-icon.red { background: linear-gradient(135deg, #C0392B, #E74C3C); }
.stat-icon.green { background: linear-gradient(135deg, #27AE60, #2ECC71); }
.stat-icon.orange { background: linear-gradient(135deg, #E67E22, #F39C12); }
.stat-icon.purple { background: linear-gradient(135deg, #8E44AD, #9B59B6); }
.stat-info h4 { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-info p { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ══════════════════════════════════════════
   TABLES — Professional styling
   ══════════════════════════════════════════ */
.table-wrapper, .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
table, .table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
thead {
    background: var(--bg);
}
thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #7F8C8D;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
tbody tr {
    transition: background 0.15s ease;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(41,128,185,0.06); cursor: pointer; }
tbody tr:nth-child(even) { background: rgba(26,82,118,0.02); }
tbody tr:nth-child(even):hover { background: rgba(41,128,185,0.08); }

/* Table footer / pagination inside table */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-light);
}

/* ══════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════ */
.prog { display: flex; align-items: center; gap: 7px; min-width: 100px; }
.prog-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.prog-lbl { font-size: 11px; color: var(--text-light); min-width: 32px; text-align: right; font-weight: 600; }

/* ══════════════════════════════════════════
   KPI CARDS — Professional dashboard cards
   ══════════════════════════════════════════ */
.kpi-grid { display: grid; gap: 16px; margin-bottom: 24px; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-6 { grid-template-columns: repeat(6, 1fr); }

.kpi-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.kpi-stripe {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
}
.kpi-card .kpi-lbl {
    font-size: 10px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 700;
    margin-bottom: 8px;
}
.kpi-card .kpi-val {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}
.kpi-card .kpi-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 6px;
}
.kpi-card .kpi-ico {
    position: absolute;
    right: 16px;
    bottom: 12px;
    font-size: 32px;
    opacity: 0.08;
}

/* Dashboard sections */
.dash-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.dash-section-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.dash-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
}
.dash-card-header i { color: var(--primary-light); margin-right: 8px; }
.dash-card-body { padding: 18px; }

/* Donut chart container */
.donut-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}
.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}
.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Timeline items */
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

/* ══════════════════════════════════════════
   BADGES & TAGS — Enhanced
   ══════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.badge-success { background: #D5F5E3; color: #15803D; }
.badge-danger { background: #FEE2E2; color: #B91C1C; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1D4ED8; }
.badge-primary { background: #D4E6F1; color: #1A5276; }
.badge-gray { background: #F3F4F6; color: #6B7280; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }
.badge-teal { background: #CCFBF1; color: #0E7490; }

.risk-no-aceptable { background: #DC2626; color: white; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.risk-no-aceptable-control { background: #EA580C; color: white; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.risk-mejorable { background: #F59E0B; color: #1C1917; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.risk-aceptable { background: #16A34A; color: white; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }

/* Toggle switch for permissions */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    display: inline-block;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #CBD5E1;
    border-radius: 22px;
    transition: 0.3s;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Permission matrix table */
.perm-table th { font-size: 9px; letter-spacing: 1px; text-align: center; }
.perm-table td { text-align: center; padding: 8px 6px; }
.perm-table td:first-child { text-align: left; font-weight: 600; }

/* ══════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}
.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.modal-close {
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }

/* ══════════════════════════════════════════
   ALERTS / TOASTS
   ══════════════════════════════════════════ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 13px;
}
.alert-danger { background: #FADBD8; color: #922B21; border-left: 4px solid #C0392B; }
.alert-success { background: #D5F5E3; color: #1E8449; border-left: 4px solid #27AE60; }
.alert-warning { background: #FEF9E7; color: #9A7D0A; border-left: 4px solid #F39C12; }
.alert-info { background: #D6EAF8; color: #1B4F72; border-left: 4px solid #3498DB; }

.toast-container {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}
.toast-success { background: #27AE60; color: white; }
.toast-error { background: #C0392B; color: white; }
.toast-info { background: #3498DB; color: white; }

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

/* ══════════════════════════════════════════
   CHATBOT
   ══════════════════════════════════════════ */
.chat-container {
    max-width: 700px;
    margin: 0 auto;
}
.chat-messages {
    overflow-y: auto;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 0;
}
.chat-msg {
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
}
.chat-msg.user .bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.chat-msg.bot .bubble { background: white; border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
}
.chat-input input { flex: 1; }
.chat-chip {
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.chat-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}
.chat-chip i { margin-right: 3px; font-size: 10px; }

/* ══════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
}
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════
   TOOLBAR
   ══════════════════════════════════════════ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar input, .toolbar select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
}
.toolbar input:focus, .toolbar select:focus {
    outline: none;
    border-color: var(--primary-light);
}

/* ══════════════════════════════════════════
   PHVA CHART (Autoevaluacion)
   ══════════════════════════════════════════ */
.phva-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.phva-card {
    padding: 16px;
    border-radius: var(--radius);
    text-align: center;
}
.phva-card.planear { background: #D6EAF8; border: 2px solid #3498DB; }
.phva-card.hacer { background: #D5F5E3; border: 2px solid #27AE60; }
.phva-card.verificar { background: #FEF9E7; border: 2px solid #F39C12; }
.phva-card.actuar { background: #FADBD8; border: 2px solid #E74C3C; }
.phva-card h4 { font-size: 14px; margin-bottom: 8px; }
.phva-card .score { font-size: 28px; font-weight: 700; }

/* ══════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 13px; }

/* ══════════════════════════════════════════
   LOADING
   ══════════════════════════════════════════ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET (768px)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .topbar { display: flex; }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid-4, .kpi-grid-6 { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid-3 { grid-template-columns: 1fr; }
    .dash-section, .dash-section-3 { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .modal-content { max-width: 95%; }
    .phva-grid { grid-template-columns: 1fr; }
    .card-header { flex-direction: column; align-items: flex-start; }
    .donut-container { flex-direction: column; }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE (480px)
   ══════════════════════════════════════════ */
@media (max-width: 480px) {
    html { font-size: 13px; }
    .login-card { padding: 24px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .kpi-grid-4, .kpi-grid-6, .kpi-grid-3 { grid-template-columns: 1fr; }
    .stat-card { padding: 14px; }
    .stat-icon { width: 40px; height: 40px; font-size: 16px; }
    .stat-info h4 { font-size: 18px; }
    .kpi-card .kpi-val { font-size: 24px; }
    .btn { padding: 8px 14px; font-size: 13px; }
    .btn-group { flex-direction: column; }
    .toolbar { flex-direction: column; }
    .toolbar input, .toolbar select { width: 100%; }
    table { font-size: 12px; }
    th, td { padding: 8px 10px; }
    .chat-msg .bubble { max-width: 90%; }
}

/* ══════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════ */
@media print {
    .sidebar, .topbar, .btn, .toolbar { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
