:root {
    --asis-primary: #1F3864;
    --asis-accent: #2E75B6;
    --asis-success: #548235;
    --asis-success-bg: #E2EFDA;
    --asis-danger: #C00000;
    --asis-danger-bg: #FCE4EC;
    --asis-warning: #ED7D31;
    --asis-warning-bg: #FFF2CC;
    --asis-muted: #D9D9D9;
    --asis-bg: #f0f4f8;
    --asis-card: #ffffff;
    --asis-text: #1a1a2e;
    --asis-text-muted: #64748b;
    --asis-radius: 10px;
    --asis-shadow: 0 2px 12px rgba(31, 56, 100, 0.08);
    --sidebar-width: 240px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--asis-bg);
    color: var(--asis-text);
    line-height: 1.5;
}

/* ─── LAYOUT ─── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--asis-primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 { font-size: 16px; font-weight: 700; }
.sidebar-header p { font-size: 11px; opacity: 0.7; margin-top: 4px; }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.15); color: white; font-weight: 600; }
.nav-item .icon { font-size: 18px; width: 24px; text-align: center; }

.nav-badge {
    position: absolute;
    right: 16px;
    background: #FF0000;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-footer a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.16s ease;
}

.sidebar-footer a:hover { color: white; }

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.btn-logout svg { flex: 0 0 auto; }
.btn-logout:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
.btn-logout:active { transform: scale(0.98); }

/* ─── MAIN CONTENT ─── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 22px; color: var(--asis-primary); }

/* ─── CARDS ─── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--asis-card);
    border-radius: var(--asis-radius);
    padding: 20px;
    box-shadow: var(--asis-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue { background: rgba(46,117,182,0.1); }
.stat-icon.green { background: var(--asis-success-bg); }
.stat-icon.orange { background: var(--asis-warning-bg); }
.stat-icon.red { background: var(--asis-danger-bg); }

.stat-info h3 { font-size: 24px; font-weight: 700; line-height: 1; }
.stat-info p { font-size: 12px; color: var(--asis-text-muted); margin-top: 4px; }

/* ─── TABLES ─── */
.table-card {
    background: var(--asis-card);
    border-radius: var(--asis-radius);
    box-shadow: var(--asis-shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f6;
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h2 { font-size: 16px; font-weight: 600; }

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.table-actions input,
.table-actions select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: white;
}

.table-actions input:focus,
.table-actions select:focus {
    outline: none;
    border-color: var(--asis-accent);
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--asis-text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

tbody tr:hover { background: #f8fafc; }

/* ─── BADGES ─── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-programada { background: rgba(46,117,182,0.1); color: var(--asis-accent); }
.badge-concluida { background: #f1f5f9; color: #888; }
.badge-cancelada { background: var(--asis-danger-bg); color: var(--asis-danger); }
.badge-activo { background: var(--asis-success-bg); color: var(--asis-success); }
.badge-inactivo { background: #f1f5f9; color: #888; }
.badge-separado { background: #fce4ec; color: #b71c1c; font-weight: 700; }
.badge-a-tiempo { background: var(--asis-success-bg); color: var(--asis-success); }
.badge-tardanza { background: var(--asis-warning-bg); color: var(--asis-warning); }
.badge-falta { background: var(--asis-danger-bg); color: var(--asis-danger); }
.badge-pendiente { background: var(--asis-danger-bg); color: var(--asis-danger); }
.badge-notificado { background: var(--asis-warning-bg); color: var(--asis-warning); }
.badge-archivado { background: #f1f5f9; color: #888; }
.badge-justificada { background: #e8f0fe; color: var(--asis-accent); }

/* ─── BUTTONS ─── */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--asis-accent); color: white; }
.btn-primary:hover { background: var(--asis-primary); }
.btn-success { background: var(--asis-success); color: white; }
.btn-success:hover { background: #476e2d; }
.btn-danger { background: var(--asis-danger); color: white; }
.btn-danger:hover { background: #a00000; }
.btn-warning { background: var(--asis-warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--asis-accent); padding: 5px 8px; }
.btn-ghost:hover { background: rgba(46,117,182,0.1); }

/* ─── MODAL ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: var(--asis-radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #eef2f6;
}

.modal-header h2 { font-size: 17px; color: var(--asis-primary); }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--asis-text-muted);
    padding: 4px;
}

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #eef2f6;
}

/* ─── FORMS ─── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--asis-text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--asis-accent);
    box-shadow: 0 0 0 3px rgba(46,117,182,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

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

/* ─── PAGINATION ─── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}

.pagination button:hover { background: #f8fafc; }
.pagination button.active { background: var(--asis-accent); color: white; border-color: var(--asis-accent); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ─── TOAST ─── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--asis-radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.toast.active { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--asis-success); }
.toast.error { background: var(--asis-danger); }
.toast.warning { background: var(--asis-warning); }

/* ─── SECTION PANELS ─── */
.section-panel { display: none; }
.section-panel.active { display: block; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
}
