/* ============================================================
   ETNOTRACK — DESIGN SYSTEM
   Plataforma de gestion de cumplimiento etnico
   ============================================================ */

/* =================== 1. VARIABLES =================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand */
    --color-primary: #0E7AB8;
    --color-primary-dark: #0A5E8F;
    --color-primary-light: #E0F2FE;
    --color-accent: #0D9488;
    --color-accent-light: #CCFBF1;

    /* Semantic */
    --color-danger: #DC2626;
    --color-danger-light: #FEE2E2;
    --color-warning: #D97706;
    --color-warning-light: #FEF3C7;
    --color-success: #16A34A;
    --color-success-light: #DCFCE7;
    --color-info: #0284C7;
    --color-info-light: #DBEAFE;

    /* Neutrals */
    --color-dark: #0F172A;
    --color-surface: #F0F4F9;
    --color-card: #FFFFFF;
    --color-border: #E0E8F0;
    --color-text: #1E293B;
    --color-muted: #64748B;

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-bg: #0F172A;
    --sidebar-hover: #1E293B;
    --sidebar-active-bg: rgba(14,122,184,0.12);
    --sidebar-text: #94A3B8;
    --sidebar-text-hover: #F1F5F9;
    --sidebar-section: #475569;

    /* Topbar */
    --topbar-height: 56px;

    /* Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(15,23,42,0.04);
    --shadow: 0 2px 8px rgba(15,23,42,0.05);
    --shadow-md: 0 4px 14px rgba(15,23,42,0.06);
    --shadow-lg: 0 10px 24px rgba(15,23,42,0.08);

    /* Transitions */
    --transition: 180ms ease;
    --transition-slow: 300ms ease;
}

/* =================== 2. RESET & BASE =================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-surface);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-primary-dark);
}

/* =================== 3. SIDEBAR =================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-brand a {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
}

.sidebar-section-label {
    padding: 1.25rem 1rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    /* Title Case - no uppercase */
    letter-spacing: 0.1em;
    color: var(--sidebar-section);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
    border-left-color: rgba(14,122,184,0.3);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.sidebar-link.active i {
    color: var(--color-primary);
}

.sidebar-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link:hover i,
.sidebar-link.active i {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 0.75rem 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    color: #E2E8F0;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--sidebar-section);
    font-size: 0.65rem;
    /* Title Case - no uppercase */
    letter-spacing: 0.05em;
}

.sidebar-logout {
    color: var(--sidebar-text);
    font-size: 1rem;
    padding: 0.35rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.sidebar-logout:hover {
    color: var(--color-danger);
    background: rgba(220,38,38,0.1);
}

/* =================== 4. TOPBAR =================== */

.topbar-main {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--color-card);
    border-bottom: 1px solid #e3eaf3;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1020;
    box-shadow: 0 1px 4px rgba(15,23,42,0.03);
}

.topbar-breadcrumb {
    flex: 1;
}

.topbar-breadcrumb .breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
    font-size: 0.8125rem;
}

.topbar-breadcrumb .breadcrumb-item a {
    color: var(--color-muted);
}

.topbar-breadcrumb .breadcrumb-item.active {
    color: var(--color-text);
    font-weight: 500;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: none;
    background: none;
    color: var(--color-muted);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.topbar-icon-btn:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.topbar-icon-btn .notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--color-card);
}

/* Mobile topbar */
.topbar-mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--sidebar-bg);
    display: none;
    align-items: center;
    padding: 0 1rem;
    z-index: 1030;
}

.topbar-toggler {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.topbar-mobile-brand {
    flex: 1;
    text-align: center;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.topbar-mobile-logout {
    color: var(--sidebar-text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.topbar-mobile-logout:hover {
    color: var(--color-danger);
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* =================== 5. MAIN CONTENT =================== */

.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 1.75rem);
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: 2.5rem;
    min-height: 100vh;
    max-width: calc(var(--sidebar-width) + 1280px + 4rem);
}

/* =================== 6. CARDS =================== */

.card {
    border: 1px solid #e3eaf3;
    border-radius: var(--radius-xl);
    box-shadow: 0 2px 10px rgba(15,23,42,0.04);
    background: var(--color-card);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-header {
    background: #F1F5F9;
    border-bottom: 1px solid #e3eaf3;
    padding: 13px 22px;
    font-weight: 500;
    font-size: 14px;
    color: #1E293B;
}

.card-header i {
    color: #475569;
}

.card-header h5,
.card-header h6 {
    font-weight: inherit;
    font-size: inherit;
    color: inherit;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* KPI Cards */
.kpi-card {
    border: 1px solid #e3eaf3;
    border-radius: var(--radius-xl);
    background: var(--color-card);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 4px rgba(15,23,42,0.03);
    transition: box-shadow var(--transition), transform var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kpi-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.kpi-icon.teal { background: var(--color-accent-light); color: var(--color-accent); }
.kpi-icon.red { background: var(--color-danger-light); color: var(--color-danger); }
.kpi-icon.amber { background: var(--color-warning-light); color: var(--color-warning); }
.kpi-icon.green { background: var(--color-success-light); color: var(--color-success); }

.kpi-content {
    flex: 1;
    min-width: 0;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--color-muted);
    font-weight: 500;
}

/* =================== 7. BADGES =================== */

.badge-etno {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* Estado general */
.badge-pendiente { background: #F1F5F9; color: #64748B; }
.badge-en-curso, .badge-activo, .badge-en_curso, .badge-en_ejecucion { background: #DBEAFE; color: #1D4ED8; }
.badge-suspendido { background: #FEF3C7; color: #92400E; }
.badge-cerrado-acuerdo, .badge-cerrado_con_acuerdo { background: #DCFCE7; color: #166534; }
.badge-cerrado-sin-acuerdo, .badge-cerrado_sin_acuerdo { background: #FFEDD5; color: #9A3412; }
.badge-cerrado_con_seguimiento { background: #DBEAFE; color: #1D4ED8; }
.badge-vencido { background: #FEE2E2; color: #991B1B; }
.badge-cumplido, .badge-completada, .badge-aprobado, .badge-validado, .badge-realizada, .badge-acuerdo, .badge-definitiva {
    background: #DCFCE7; color: #166534;
}
.badge-cancelada, .badge-rechazado { background: #F1F5F9; color: #64748B; }
.badge-borrador { background: #F1F5F9; color: #64748B; }
.badge-en_revision, .badge-en_analisis, .badge-en_verificacion, .badge-preacuerdo {
    background: #DBEAFE; color: #1D4ED8;
}
.badge-en_subsanacion { background: #FEF3C7; color: #92400E; }

.badge-critico {
    background: var(--color-danger);
    color: #FFFFFF;
    animation: pulse-badge 1.5s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Riesgo */
.badge-riesgo-bajo { background: #DCFCE7; color: #166534; }
.badge-riesgo-medio { background: #FEF3C7; color: #92400E; }
.badge-riesgo-alto { background: #FFEDD5; color: #9A3412; }
.badge-riesgo-critico { background: #FEE2E2; color: #991B1B; }

/* Severidad */
.badge-sev-critica { background: var(--color-danger); color: #fff; animation: pulse-badge 1.5s infinite; }
.badge-sev-advertencia { background: #FEF3C7; color: #92400E; }
.badge-sev-info { background: #DBEAFE; color: #1D4ED8; }

/* Etapas */
.badge-etapa { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }

/* =================== 8. TABLES =================== */

.table-etno {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}

.table-etno thead th {
    background: #f8fbff;
    color: #3a4b5d;
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #dce5ef;
    border-top: none;
    white-space: nowrap;
}

.table-etno thead th:first-child {
    border-radius: 0;
}

.table-etno thead th:last-child {
    border-radius: 0;
}

.table-etno tbody td {
    padding: 0.8rem 0.85rem;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.table-etno tbody tr {
    transition: background var(--transition);
}

.table-etno tbody tr:hover {
    background: #f5f8fc;
}

.table-etno tbody tr:nth-child(even) {
    background: #fafbfd;
}

.table-etno tbody tr:nth-child(even):hover {
    background: #f5f8fc;
}

.table-etno tbody tr.row-vencido {
    background: #FFF5F5;
}

.table-etno tbody tr.row-vencido:hover {
    background: #FEE2E2;
}

/* Action buttons in tables */
.btn-accion {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #dce5ef;
    background: #fff;
    color: #4a5a6a;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    margin: 0 1px;
}

.btn-accion:hover {
    background: #f3f7fb;
    color: var(--color-primary);
    border-color: #cfd9e6;
}

.btn-accion.danger:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: #f5c6c6;
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14,122,184,0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius) !important;
    font-size: 0.8125rem;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--color-primary-light) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}

/* =================== 9. BUTTONS =================== */

.btn {
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8125rem;
    min-height: 40px;
    padding: 0.5rem 1.1rem;
    transition: all var(--transition);
}

.btn-sm {
    min-height: 34px;
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    border-radius: 8px;
}

.btn-primary {
    background: #1786d7;
    border-color: #1786d7;
}

.btn-primary:hover, .btn-primary:active {
    background: #0f76c1;
    border-color: #0f76c1;
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(23,134,215,0.15);
}

.btn-primary:disabled {
    background: #93c5e8;
    border-color: #93c5e8;
    opacity: 1;
}

.btn-outline-primary {
    border-color: #1786d7;
    color: #1786d7;
}

.btn-outline-primary:hover {
    background: #1786d7;
    border-color: #1786d7;
}

.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
}

.btn-outline-secondary {
    border-color: #d5dfeb;
    color: #4a5a6a;
}

.btn-outline-secondary:hover {
    background: #f5f8fc;
    border-color: #c5cfdb;
    color: var(--color-text);
}

.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
}

.btn-warning {
    background: var(--color-warning);
    border-color: var(--color-warning);
    color: #fff;
}

.btn-warning:hover { color: #fff; }

/* =================== 10. FORMS =================== */

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #233447;
    margin-bottom: 0.4rem;
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 2px;
}

.form-control, .form-select {
    border: 1px solid #d9e3ee;
    border-radius: 10px;
    font-size: 0.875rem;
    padding: 0.55rem 0.9rem;
    min-height: 44px;
    color: #1f2d3d;
    background-color: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control::placeholder, .form-select::placeholder {
    color: #8a97a8;
}

.form-control:hover, .form-select:hover {
    border-color: #c9d6e4;
}

.form-control:focus, .form-select:focus {
    border-color: #7aa7d9;
    box-shadow: 0 0 0 3px rgba(23,134,215,0.08);
    background-color: #fff;
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--color-danger);
    box-shadow: none;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
}

.invalid-feedback {
    color: var(--color-danger);
    font-size: 0.75rem;
    margin-top: 0.3rem;
}

textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

.form-text {
    color: #66768a;
    font-size: 0.78rem;
    line-height: 1.4;
    margin-top: 0.35rem;
}

.form-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary-light);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.form-section-title:first-child {
    margin-top: 0;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--color-surface);
}

.file-upload-area:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.file-upload-area i {
    font-size: 2rem;
    color: var(--color-muted);
    display: block;
    margin-bottom: 0.5rem;
}

.file-upload-area .upload-text {
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.file-upload-area .upload-text strong {
    color: var(--color-primary);
}

/* =================== 11. PAGE HEADER =================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header-title h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1f2d3d;
}

.page-header-title .count {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-muted);
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =================== 12. BREADCRUMB =================== */

.breadcrumb-etno {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
    flex-wrap: wrap;
}

.breadcrumb-etno li {
    display: flex;
    align-items: center;
}

.breadcrumb-etno li + li::before {
    content: "/";
    margin: 0 0.5rem;
    color: var(--color-border);
}

.breadcrumb-etno li a {
    color: var(--color-muted);
}

.breadcrumb-etno li a:hover {
    color: var(--color-primary);
}

.breadcrumb-etno li.active {
    color: var(--color-text);
    font-weight: 500;
}

/* =================== 13. TIMELINE / STEPPER =================== */

.stepper {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2rem;
    position: relative;
}

.stepper-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.stepper-step::before {
    content: '';
    position: absolute;
    top: 16px;
    left: -50%;
    right: 50%;
    height: 3px;
    background: var(--color-border);
}

.stepper-step:first-child::before {
    display: none;
}

.stepper-step.completed::before {
    background: var(--color-success);
}

.stepper-step.active::before {
    background: var(--color-primary);
}

.stepper-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 3px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-muted);
    position: relative;
    z-index: 2;
    transition: all var(--transition);
}

.stepper-step.completed .stepper-dot {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.stepper-step.active .stepper-dot {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(14,122,184,0.2);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(14,122,184,0.2); }
    50% { box-shadow: 0 0 0 8px rgba(14,122,184,0.1); }
}

.stepper-step.pending .stepper-dot {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-muted);
}

.stepper-label {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-muted);
    text-align: center;
    max-width: 100px;
    line-height: 1.3;
}

.stepper-step.active .stepper-label {
    color: var(--color-primary);
    font-weight: 600;
}

.stepper-step.completed .stepper-label {
    color: var(--color-success);
}

/* Vertical timeline */
.timeline {
    position: relative;
    padding: 0;
    list-style: none;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 16px;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-left: 48px;
    margin-bottom: 1.25rem;
}

.timeline-item .timeline-marker {
    position: absolute;
    left: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    z-index: 1;
}

.timeline-item.active .timeline-marker {
    background: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14,122,184,0.2);
}

.timeline-item.completed .timeline-marker {
    background: var(--color-success);
}

.timeline-content {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

/* =================== 14. DETAIL VIEW =================== */

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 0.2rem;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.detail-value:empty::after,
.detail-value .empty {
    content: '\2014';
    color: var(--color-border);
}

/* Tabs */
.nav-tabs-etno {
    border-bottom: 2px solid var(--color-border);
    gap: 0;
}

.nav-tabs-etno .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--color-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.65rem 1rem;
    transition: all var(--transition);
}

.nav-tabs-etno .nav-link:hover {
    color: var(--color-text);
    border-bottom-color: var(--color-border);
}

.nav-tabs-etno .nav-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

/* =================== 15. ALERTS & TOASTS =================== */

.alert {
    border-radius: var(--radius);
    font-size: 0.8125rem;
    border: none;
    padding: 0.75rem 1rem;
}

.alert-success {
    background: var(--color-success-light);
    color: #166534;
    border-left: 4px solid var(--color-success);
}

.alert-danger {
    background: var(--color-danger-light);
    color: #991B1B;
    border-left: 4px solid var(--color-danger);
}

.alert-warning {
    background: var(--color-warning-light);
    color: #92400E;
    border-left: 4px solid var(--color-warning);
}

.alert-info {
    background: var(--color-info-light);
    color: #075985;
    border-left: 4px solid var(--color-info);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1100;
}

.toast-etno {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s ease;
    min-width: 280px;
}

.toast-etno.success { background: var(--color-success); }
.toast-etno.error { background: var(--color-danger); }
.toast-etno.warning { background: var(--color-warning); }

@keyframes toast-in {
    from { transform: translateY(1rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* =================== 16. MODALS =================== */

.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15,23,42,0.12);
}

.modal-header {
    border-bottom: 1px solid #e3eaf3;
    padding: 1.1rem 1.5rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e3eaf3;
    padding: 0.85rem 1.5rem;
}

.modal-backdrop {
    backdrop-filter: blur(3px);
}

/* Delete confirmation */
.modal-delete-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-danger-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--color-danger);
}

/* =================== 17. PROGRESS =================== */

.progress {
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
}

.progress-bar {
    border-radius: var(--radius-full);
    background: var(--color-primary);
    transition: width 0.6s ease;
}

.progress-bar.bg-success { background: var(--color-success); }
.progress-bar.bg-warning { background: var(--color-warning); }
.progress-bar.bg-danger { background: var(--color-danger); }

/* =================== 18. CHECKLIST =================== */

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item.completed {
    opacity: 0.6;
}

.checklist-item.completed .checklist-text {
    text-decoration: line-through;
}

.checklist-check {
    color: var(--color-success);
    font-size: 1rem;
}

.checklist-pending {
    color: var(--color-border);
    font-size: 1rem;
}

.checklist-text {
    flex: 1;
    font-size: 0.8125rem;
}

.checklist-blocker {
    font-size: 0.7rem;
    color: var(--color-danger);
    font-weight: 500;
}

/* =================== 19. FEED / ACTIVITY =================== */

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8125rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    flex-shrink: 0;
}

.activity-text {
    flex: 1;
    color: var(--color-text);
    line-height: 1.4;
}

.activity-text strong {
    font-weight: 600;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--color-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* =================== 20. EMPTY STATE =================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-muted);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: var(--color-text);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}

/* =================== 21. LOGIN =================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(14,122,184,0.08);
    top: -200px;
    right: -200px;
}

.login-hero::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(13,148,136,0.06);
    bottom: -100px;
    left: -100px;
}

.login-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 400px;
}

.login-hero-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.75rem;
    color: #fff;
}

.login-hero h1 {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.login-hero p {
    color: rgba(255,255,255,0.6);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.login-form-side {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--color-card);
    flex-shrink: 0;
}

.login-form-container {
    width: 100%;
    max-width: 360px;
}

.login-form-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-form-container .login-subtitle {
    color: var(--color-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.login-form-container .form-control {
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
}

.login-form-container .btn-primary {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* =================== 22. ERROR PAGES =================== */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 2rem;
}

.error-page .error-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--color-border);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-page h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.error-page p {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
}

/* =================== 23. FILTERS =================== */

.filters-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters-bar .form-select {
    font-size: 0.8125rem;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    max-width: 180px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
}

.filter-chip .remove {
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.6;
}

.filter-chip .remove:hover {
    opacity: 1;
}

/* =================== 24. CRITICALITY BORDER =================== */

.criticality-border-alta,
.criticality-border-critica {
    border-left: 3px solid var(--color-danger);
}

.criticality-border-media {
    border-left: 3px solid var(--color-warning);
}

.criticality-border-baja {
    border-left: 3px solid var(--color-success);
}

/* =================== 25. UTILITIES =================== */

.text-muted { color: var(--color-muted) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.bg-surface { background: var(--color-surface); }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-xs { font-size: 0.7rem; }
.fs-sm { font-size: 0.8125rem; }
.fs-md { font-size: 0.875rem; }

.rounded-etno { border-radius: var(--radius); }

/* =================== 26. RESPONSIVE =================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .topbar-main {
        left: 0;
        display: none;
    }

    .topbar-mobile {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding-top: calc(var(--topbar-height) + 1rem);
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .login-hero {
        display: none;
    }

    .login-form-side {
        width: 100%;
    }

    .stepper {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .kpi-card {
        padding: 1rem;
    }

    .kpi-value {
        font-size: 1.35rem;
    }
}

@media (min-width: 992px) {
    .topbar-mobile {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn {
        flex: 1;
    }
}

/* =================== 27. SCROLLBAR =================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* =================== 28. TOOLTIP PREMIUM =================== */

.tooltip-inner {
    background-color: #243447;
    color: #fff;
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    max-width: 220px;
}

.tooltip .tooltip-arrow::before {
    border-top-color: #243447;
}

.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #243447;
}

/* =================== 29. DROPDOWN PREMIUM =================== */

.dropdown-menu {
    border: 1px solid #e3eaf3;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(15,23,42,0.08);
    padding: 0.35rem 0;
}

.dropdown-item {
    font-size: 0.8125rem;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    margin: 0 0.25rem;
    width: auto;
    transition: background var(--transition);
}

.dropdown-item:hover {
    background: #f5f8fc;
}

.dropdown-item:active {
    background: var(--color-primary-light);
    color: var(--color-text);
}

.dropdown-divider {
    border-color: #edf2f7;
    margin: 0.25rem 0;
}

/* =================== 30. FORM CHECK PREMIUM =================== */

.form-check-input {
    width: 1.15em;
    height: 1.15em;
    border: 1.5px solid #c9d6e4;
    border-radius: 4px;
    transition: all var(--transition);
}

.form-check-input:checked {
    background-color: #1786d7;
    border-color: #1786d7;
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(23,134,215,0.1);
    border-color: #7aa7d9;
}

/* =================== 31. SELECTION & FOCUS =================== */

::selection {
    background: rgba(23,134,215,0.12);
    color: var(--color-text);
}
