/* =============================================================================
   SISTEMA DE GESTIÓN DE AUDITORÍAS
   Paleta DTI navy/orange (gobernanza TI)
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Paleta DTI Gobernanza */
    --color-navy: #2D2D2D;
    --color-primary: #333333;
    --color-primary-dark: #1E1E1E;
    --color-accent: #FFD300;        /* Naranja DTI */
    --color-accent-soft: #FFF4B8;
    --color-accent-dark: #D4AF00;

    --color-success: #059669;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-info: #0891b2;

    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;
    --color-bg: #f8fafc;
    --color-bg-alt: #f1f5f9;
    --color-surface: #ffffff;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);

    --transition: all .15s ease;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--color-text); }

/* =============================================================================
   LAYOUT PRINCIPAL
   ========================================================================= */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--color-navy);
    color: #cbd5e1;
    padding: 14px 0 10px;          /* v16.3: era 24px 0; gana ~24px vertical */
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
/* v16.3 — Scrollbar discreta cuando el menú no quepa (Webkit + Firefox) */
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.30); }

.sidebar__brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;             /* v16.3: era 20px */
}
.sidebar__brand h1 {
    color: #fff;
    font-size: 18px;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.sidebar__brand p {
    color: #94a3b8;
    font-size: 12px;
    margin: 0;
}

.sidebar__section-title {
    padding: 0 24px 6px;            /* v16.3: era 0 24px 8px */
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 700;
    margin-top: 10px;               /* v16.3: era 16px */
}

.sidebar__nav {
    list-style: none;
    margin: 0 0 4px;                /* v16.3: era 0 0 8px */
    padding: 0;
}
.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 24px;              /* v16.3: era 10px 24px */
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: var(--transition);
}
.sidebar__nav a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}
.sidebar__nav a.active {
    background: rgba(255, 211, 0, 0.2);
    color: #fff;
    border-left-color: var(--color-accent);
}
.sidebar__nav svg { flex-shrink: 0; opacity: 0.85; }

/* Main wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main {
    padding: 24px 32px;
    flex: 1;
}

/* =============================================================================
   TOPBAR
   ========================================================================= */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    min-height: 62px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar__left { flex: 1; max-width: 520px; }
.topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Búsqueda global */
.search-global {
    position: relative;
    width: 100%;
    max-width: 480px;
}
.search-global__input {
    width: 100%;
    padding: 9px 14px 9px 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}
.search-global__input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 211, 0, 0.2);
}
.search-global__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}
.search-global__shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--color-text-light);
    background: var(--color-bg-alt);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 480px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}
.search-results.open { display: block; }
.search-results__section-title {
    padding: 10px 14px 4px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
    letter-spacing: 0.08em;
}
.search-results__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 13px;
    border-left: 3px solid transparent;
}
.search-results__item:hover {
    background: var(--color-bg-alt);
    border-left-color: var(--color-accent);
    text-decoration: none;
}
.search-results__code {
    font-weight: 600;
    color: var(--color-navy);
}
.search-results__desc {
    color: var(--color-text-muted);
    font-size: 12px;
    flex: 1;
}
.search-results__empty {
    padding: 20px;
    color: var(--color-text-muted);
    text-align: center;
    font-size: 13px;
}

/* Botones de topbar */
.topbar-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar-btn:hover {
    background: var(--color-bg-alt);
    color: var(--color-navy);
}

.avatar-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}
.avatar-btn:hover { transform: scale(1.05); }

/* Avatar */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    background: var(--color-navy);
    flex-shrink: 0;
}
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.avatar--xl { width: 80px; height: 80px; font-size: 26px; }

/* Dropdown */
.topbar-menu { position: relative; }

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease, visibility 0s .15s;
    z-index: 100;
}
.dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .15s ease, transform .15s ease, visibility 0s;
}

.dropdown__header {
    padding: 10px 16px;
}
.dropdown__header strong { display: block; color: var(--color-navy); font-size: 13px; }
.dropdown__header small { color: var(--color-text-muted); font-size: 11px; }

.dropdown__user-header {
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}
.dropdown__user-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
}
.dropdown__user-email {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-bottom: 6px;
    word-break: break-all;
}

.dropdown__divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

.dropdown__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}
.dropdown__item:hover {
    background: var(--color-bg-alt);
    text-decoration: none;
}
.dropdown__item svg { flex-shrink: 0; color: var(--color-text-muted); }
.dropdown__item:hover svg { color: var(--color-accent); }
.dropdown__item small { display: block; color: var(--color-text-muted); font-size: 11px; }

.dropdown__item--danger { color: var(--color-danger); }
.dropdown__item--danger svg { color: var(--color-danger); }

/* =============================================================================
   PAGE HEADER
   ========================================================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-header h2 {
    font-size: 22px;
    color: var(--color-navy);
    margin-bottom: 2px;
}
.page-header p {
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 0;
}
.page-title {
    font-size: 22px;
    color: var(--color-navy);
    margin: 0 0 2px;
}
.page-subtitle {
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 0;
}

/* =============================================================================
   CARDS
   ========================================================================= */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.card__header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--color-border);
    background: #fafbfc;
}
.card__header h3, .card__title {
    font-size: 15px;
    color: var(--color-navy);
    font-weight: 600;
}

.card__body { padding: 20px; }
.card__footer {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* =============================================================================
   KPI CARDS
   ========================================================================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-border);
}
.kpi-card--primary::before { background: var(--color-navy); }
.kpi-card--info::before    { background: var(--color-info); }
.kpi-card--success::before { background: var(--color-success); }
.kpi-card--warning::before { background: var(--color-warning); }
.kpi-card--danger::before  { background: var(--color-danger); }

.kpi-card__label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.kpi-card__value {
    font-size: 30px;
    font-weight: 800;
    color: var(--color-navy);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.kpi-card__footer {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

/* =============================================================================
   TABLAS
   ========================================================================= */
.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table thead th {
    background: #fafbfc;
    color: var(--color-text-muted);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--color-bg-alt); }

.table--hover tbody tr { cursor: pointer; }
.row-clickable { cursor: pointer; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-xs     { font-size: 11px; }
.text-muted  { color: var(--color-text-muted); }
.nowrap      { white-space: nowrap; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
    font-style: italic;
}
.cell-title { font-weight: 500; color: var(--color-text); }

/* =============================================================================
   BADGES
   ========================================================================= */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.4;
}
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--warning { background: #fed7aa; color: #9a3412; }
.badge--success { background: #d1fae5; color: #065f46; }

.tipo-interna  { background: #dbeafe; color: #1e40af; }
.tipo-externa  { background: #FFF4B8; color: #806700; }

.estado-planificada   { background: #e0e7ff; color: #3730a3; }
.estado-en-curso      { background: #fed7aa; color: #9a3412; }
.estado-finalizada    { background: #d1fae5; color: #065f46; }
.estado-cerrada       { background: #e5e7eb; color: #374151; }
.estado-abierto       { background: #fee2e2; color: #991b1b; }
.estado-en-seguimiento { background: #fed7aa; color: #9a3412; }
.estado-cerrado       { background: #d1fae5; color: #065f46; }

.estado-no-enviada            { background: #fee2e2; color: #991b1b; }
.estado-solicitada-al-encargado { background: #fed7aa; color: #9a3412; }
.estado-enviada               { background: #dbeafe; color: #1e40af; }
.estado-recibida              { background: #d1fae5; color: #065f46; }
.estado-no-aplica             { background: #e5e7eb; color: #374151; }

.sev-alta   { background: #fee2e2; color: #991b1b; }
.sev-media  { background: #fed7aa; color: #9a3412; }
.sev-baja   { background: #d1fae5; color: #065f46; }

.rol-admin    { background: var(--color-accent); color: #1E1E1E; }
.rol-auditor  { background: var(--color-navy); color: #fff; }
.rol-consulta { background: #DDDDDD; color: #2D2D2D; }

/* =============================================================================
   FORMULARIOS
   ========================================================================= */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.form-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 900px) {
    .form-grid-two { grid-template-columns: 1fr; }
}

.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    font-size: 14px;
    color: var(--color-text);
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(255, 211, 0, 0.2);
}

.form-group input:disabled {
    background: var(--color-bg-alt);
    cursor: not-allowed;
    color: var(--color-text-muted);
}

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

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
    text-transform: none;
    font-weight: normal;
    letter-spacing: 0;
}

.form-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; }
.form-check label { text-transform: none; font-weight: normal; letter-spacing: 0; color: var(--color-text); font-size: 14px; display: inline; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
    flex-wrap: wrap;
}
.form-actions-inline { display: flex; align-items: center; gap: 16px; }

.filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}
@media (max-width: 960px) {
    .filters { grid-template-columns: 1fr 1fr; }
}
.filters__item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}
.filters__item input,
.filters__item select {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    font-size: 13px;
    font-family: inherit;
}
.filters__actions { display: flex; gap: 8px; }

/* Selector + botón + agregar */
.select-with-add { display: flex; gap: 8px; }
.select-with-add select { flex: 1; }

/* =============================================================================
   BOTONES
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.3;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:focus { outline: none; }

.btn--primary {
    background: var(--color-navy);
    color: #fff;
    border-color: var(--color-navy);
}
.btn--primary:hover { background: var(--color-primary-dark); color: #fff; }

.btn--accent {
    background: var(--color-accent);
    color: #1E1E1E;
    border-color: var(--color-accent);
    font-weight: 600;
}
.btn--accent:hover { background: var(--color-accent-dark); color: #1E1E1E; }

.btn--outline {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-strong);
}
.btn--outline:hover { background: var(--color-bg-alt); color: var(--color-navy); }

.btn--danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn--danger:hover { background: #b91c1c; color: #fff; }

.btn--success {
    background: var(--color-success);
    color: #fff;
    border-color: var(--color-success);
}
.btn--success:hover { background: #047857; color: #fff; }

.btn--sm { padding: 5px 11px; font-size: 12px; }
.btn--lg { padding: 11px 22px; font-size: 15px; }
.btn--block { width: 100%; }

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* =============================================================================
   PROGRESS
   ========================================================================= */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress {
    flex: 1;
    height: 8px;
    background: var(--color-bg-alt);
    border-radius: 999px;
    overflow: hidden;
    min-width: 80px;
}
.progress__bar {
    height: 100%;
    background: var(--color-navy);
    transition: width .3s ease;
    border-radius: 999px;
}
.progress__bar--success { background: var(--color-success); }
.progress__bar--warning { background: var(--color-warning); }
.progress__bar--danger  { background: var(--color-danger); }
.progress-wrap span { font-size: 11px; color: var(--color-text-muted); font-weight: 600; min-width: 32px; text-align: right; }

/* =============================================================================
   ALERTAS
   ========================================================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert--success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert--danger,
.alert--error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert--warning { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.alert--info    { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }

/* =============================================================================
   INFO GRID
   ========================================================================= */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: var(--color-bg);
    border-radius: var(--radius);
    border-left: 3px solid var(--color-accent);
}
.info-item__label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
}
.info-item__value { color: var(--color-text); font-weight: 500; font-size: 14px; }

/* =============================================================================
   TABS
   ========================================================================= */
.tabs { margin-top: 16px; }
.tabs__nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
    overflow-x: auto;
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: var(--transition);
    font-family: inherit;
}
.tab-btn:hover { color: var(--color-navy); }
.tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* =============================================================================
   MODAL
   ========================================================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45, 45, 45, 0.55);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 20px;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}
.modal.open { display: flex; }
.modal__content {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}
.modal__content h3 {
    margin: 0 0 16px;
    color: var(--color-navy);
    font-size: 17px;
}

/* =============================================================================
   GRID 2 COLS
   ========================================================================= */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.gap-2 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* =============================================================================
   CHART
   ========================================================================= */
.chart-container {
    position: relative;
    width: 100%;
}

/* =============================================================================
   TABLA: forms inline
   ========================================================================= */
.inline-status-form select {
    min-width: 160px;
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
}
.inline-edit-form { display: flex; gap: 6px; align-items: center; }
.inline-edit-form input {
    flex: 1;
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}
.table-input {
    width: 100%;
    padding: 5px 9px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    font-family: inherit;
}
.table-input:focus {
    background: #fff;
    border-color: var(--color-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 211, 0, 0.2);
}

/* =============================================================================
   ADJUNTOS
   ========================================================================= */
.attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 12px;
}
.attachment-item svg { color: var(--color-accent); flex-shrink: 0; }
.attachment-item__name { flex: 1; color: var(--color-text); font-weight: 500; text-decoration: none; }
.attachment-item__name:hover { color: var(--color-accent); text-decoration: underline; }
.attachment-item__meta { color: var(--color-text-muted); font-size: 11px; }
.attachment-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--color-bg-alt);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius);
}
.attachment-upload input[type="file"] { flex: 1; font-size: 12px; }

/* =============================================================================
   LOGIN
   ========================================================================= */
.login-body {
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
}
.login-wrapper { width: 100%; max-width: 440px; }
.login-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.login-brand {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}
.login-brand h1 {
    font-size: 22px;
    color: var(--color-navy);
    margin-bottom: 6px;
}
.login-brand p {
    color: var(--color-text-muted);
    font-size: 13px;
    margin: 0;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 11px;
}

/* =============================================================================
   PERFIL
   ========================================================================= */
.profile-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
}
.profile-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-navy);
}
.color-palette {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    max-width: 320px;
}
.color-swatch {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
    border: 3px solid transparent;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch input[type="radio"] { position: absolute; opacity: 0; }
.color-swatch .color-check { color: #fff; font-weight: 700; opacity: 0; font-size: 18px; }
.color-swatch:has(input:checked) { border-color: var(--color-navy); }
.color-swatch:has(input:checked) .color-check { opacity: 1; }

/* =============================================================================
   PAGINACIÓN
   ========================================================================= */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-decoration: none;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.pagination a:hover { background: var(--color-bg-alt); text-decoration: none; }
.pagination .current {
    background: var(--color-navy);
    color: #fff;
    border-color: var(--color-navy);
    font-weight: 600;
}
.pagination .disabled { color: var(--color-text-light); pointer-events: none; }
.pagination-info {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 12px;
    margin-top: 8px;
}

/* =============================================================================
   PÁGINA DE ERROR
   ========================================================================= */
.error-page { text-align: center; padding: 80px 20px; max-width: 500px; margin: 0 auto; }
.error-page__code {
    font-size: 96px;
    font-weight: 800;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 12px;
}
.error-page__title { font-size: 22px; color: var(--color-navy); margin-bottom: 10px; }
.error-page__desc { color: var(--color-text-muted); margin-bottom: 24px; }

/* =============================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 768px) {
    .sidebar { width: 80px; }
    .sidebar__brand h1, .sidebar__brand p, .sidebar__section-title,
    .sidebar__nav a span:not(.sidebar-icon) { display: none; }
    .sidebar__nav a { justify-content: center; padding: 12px; }
    .main { padding: 16px; }
    .topbar { padding: 10px 16px; }
    .topbar__left { max-width: none; }
    .page-header h2 { font-size: 18px; }
    .kpi-card__value { font-size: 22px; }
    .dropdown { right: -10px; }
}

/* =============================================================================
   FLATPICKR: estilos alineados a paleta DTI
   ========================================================================= */
.flatpickr-calendar {
    font-family: 'Inter', sans-serif !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--color-border) !important;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after { border-bottom-color: #fff !important; }
.flatpickr-months,
.flatpickr-current-month,
.flatpickr-current-month .cur-month,
.flatpickr-current-month input.cur-year,
.flatpickr-weekdays,
.flatpickr-weekday {
    color: var(--color-navy) !important;
    font-weight: 600 !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: #1E1E1E !important;
    font-weight: 600 !important;
}
.flatpickr-day.today {
    border-color: var(--color-accent) !important;
    color: var(--color-navy) !important;
}
.flatpickr-day:hover {
    background: var(--color-bg-alt) !important;
}
.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: var(--color-accent) !important;
}

/* =============================================================================
   SUBMENÚ HORIZONTAL (dentro de módulos)
   ========================================================================= */
.subnav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 24px;
    overflow-x: auto;
    padding: 0;
}
.subnav__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all .15s ease;
}
.subnav__item:hover {
    color: var(--color-navy);
    text-decoration: none;
}
.subnav__item.active {
    color: var(--color-navy);
    border-bottom-color: var(--color-accent);
    font-weight: 600;
}
.subnav__item.active svg { color: var(--color-accent); }

/* =============================================================================
   MOSAICO DE AUDITORÍAS
   ========================================================================= */
.mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.mosaic__card {
    position: relative;
    min-height: 240px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    background-size: cover;
    background-position: center;
    background-color: var(--color-navy);
    box-shadow: var(--shadow-md);
    transition: transform .2s ease, box-shadow .2s ease;
    display: block;
    /* Gradiente por defecto DTI negro + acento amarillo */
    background-image: linear-gradient(135deg, #1E1E1E 0%, #2D2D2D 55%, #4a4a0a 100%);
}
.mosaic__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    text-decoration: none;
    color: #fff;
}

/* Overlay oscuro cuando hay imagen de fondo */
.mosaic__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.85) 0%, rgba(45, 45, 45, 0.65) 60%, rgba(45, 45, 45, 0.75) 100%);
    z-index: 1;
}

/* Patrón geométrico sutil cuando NO hay imagen (líneas diagonales amarillas) */
.mosaic__bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent 0, transparent 20px,
            #FFD300 20px, #FFD300 21px
        );
    z-index: 1;
}

/* Tarjeta "Todas las auditorías" - más destacada con acento amarillo */
.mosaic__card--all {
    background-image: linear-gradient(135deg, #FFD300 0%, #D4AF00 55%, #8a7000 100%);
    color: #1E1E1E;
}
.mosaic__card--all:hover { color: #1E1E1E; }
.mosaic__card--all .mosaic__bg-pattern {
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent 0, transparent 20px,
            #2D2D2D 20px, #2D2D2D 21px
        );
    opacity: 0.12;
}

.mosaic__content {
    position: relative;
    z-index: 2;
    padding: 24px 24px 22px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mosaic__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    opacity: 0.85;
    margin-bottom: 6px;
}

.mosaic__title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
    line-height: 1.15;
}

.mosaic__year {
    font-size: 54px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.mosaic__stats { display: flex; gap: 16px; margin-top: auto; margin-bottom: 10px; }

.mosaic__stat {
    display: flex;
    flex-direction: column;
}
.mosaic__stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}
.mosaic__stat-label {
    font-size: 11px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mosaic__footer-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.mosaic__chip {
    display: inline-block;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    backdrop-filter: blur(4px);
}
.mosaic__chip--success {
    background: rgba(5, 150, 105, 0.85);
}
.mosaic__chip--warning {
    background: rgba(255, 211, 0, 0.85);
    color: #1E1E1E;
}

.mosaic__card--all .mosaic__chip {
    background: rgba(0, 0, 0, 0.15);
    color: #1E1E1E;
}

.mosaic__arrow {
    position: absolute;
    bottom: 22px;
    right: 22px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    backdrop-filter: blur(4px);
}
.mosaic__card:hover .mosaic__arrow {
    background: var(--color-accent);
    color: #1E1E1E;
    transform: translateX(4px);
}
.mosaic__card--all .mosaic__arrow {
    background: rgba(30, 30, 30, 0.15);
    color: #1E1E1E;
}
.mosaic__card--all:hover .mosaic__arrow {
    background: #1E1E1E;
    color: #FFD300;
}

/* Estado vacío del mosaico */
.mosaic__empty {
    grid-column: 1 / -1;
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 60px 24px;
    text-align: center;
    color: var(--color-text-muted);
}
.mosaic__empty svg {
    color: var(--color-border-strong);
    margin-bottom: 16px;
}
.mosaic__empty h3 {
    color: var(--color-navy);
    margin-bottom: 8px;
    font-size: 18px;
}
.mosaic__empty p {
    margin-bottom: 20px;
    font-size: 14px;
}

/* =============================================================================
   BANNER DE AÑO (vista por_anio)
   ========================================================================= */
.anio-banner {
    position: relative;
    min-height: 180px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    color: #fff;
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
    background-image: linear-gradient(135deg, #1E1E1E 0%, #2D2D2D 55%, #4a4a0a 100%);
}
.anio-banner--default { /* mismo gradiente que por defecto, explícito para claridad */ }
.anio-banner__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.75) 0%, rgba(45, 45, 45, 0.55) 100%);
    z-index: 1;
}
.anio-banner__content {
    position: relative;
    z-index: 2;
    padding: 34px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.anio-banner__year {
    font-size: 68px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #FFD300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.anio-banner__info {
    font-size: 18px;
    font-weight: 500;
    opacity: 0.95;
    letter-spacing: 0.02em;
}
.anio-banner__actions {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    display: flex;
    gap: 8px;
}
.anio-banner__actions .btn {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
}
.anio-banner__actions .btn:hover {
    background: #fff;
}

/* =============================================================================
   KPI CARD: estado activo (filtro aplicado)
   ========================================================================= */
.kpi-card--active {
    outline: 3px solid var(--color-accent);
    outline-offset: -3px;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal: ancho para plan de acción */
#modal-avance .modal__content { max-width: 520px; }
#modal-avance input[type="range"] {
    accent-color: var(--color-accent);
    height: 6px;
}

/* =============================================================================
   CAMPANA DE NOTIFICACIONES
   ========================================================================= */
.topbar-btn--notif {
    position: relative;
}
.notif-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-accent);
    color: #1E1E1E;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff;
    line-height: 1;
}
.notif-badge--danger {
    background: var(--color-danger);
    color: #fff;
    animation: notif-pulse 2s ease-in-out infinite;
}
@keyframes notif-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.dropdown--notif {
    min-width: 380px;
    max-width: 420px;
    max-height: 480px;
    overflow-y: auto;
}
#notif-list { display: flex; flex-direction: column; }
.notif-loading, .notif-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}
.notif-empty svg { color: var(--color-success); margin-bottom: 10px; }

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: background .12s ease;
    border-left: 3px solid transparent;
}
.notif-item:hover {
    background: var(--color-bg-alt);
    text-decoration: none;
}
.notif-item--danger { border-left-color: var(--color-danger); }
.notif-item--warning { border-left-color: var(--color-warning); }

.notif-item__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}
.notif-item--danger .notif-item__icon { background: #fee2e2; color: var(--color-danger); }
.notif-item--warning .notif-item__icon { background: #fef3c7; color: var(--color-warning); }

.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 2px;
    line-height: 1.3;
}
.notif-item__desc {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 3px;
}
.notif-item__context {
    font-size: 11px;
    color: var(--color-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================================
   POP-UP DE NOTIFICACIÓN (esquina inferior derecha, discreto)
   ========================================================================= */
.notif-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 380px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 40px 16px 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 12px;
    z-index: 900;
    animation: notif-popup-in .3s ease;
    border-left: 4px solid var(--color-warning);
}
.notif-popup--alta { border-left-color: var(--color-danger); }
.notif-popup--media { border-left-color: var(--color-warning); }

@keyframes notif-popup-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.notif-popup__close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notif-popup__close:hover { background: var(--color-bg-alt); color: var(--color-text); }

.notif-popup__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef3c7;
    color: var(--color-warning);
}
.notif-popup--alta .notif-popup__icon { background: #fee2e2; color: var(--color-danger); }

.notif-popup__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 2px;
}
.notif-popup__desc { font-size: 12px; color: var(--color-text-muted); }
.notif-popup__more {
    font-size: 11px;
    color: var(--color-accent-dark);
    margin-top: 4px;
    font-weight: 600;
}

/* =========================================================================
   DASHBOARD EDICION 2026 - Panel ejecutivo (navy / gris / amarillo)
   ========================================================================= */

.dash-header {
    align-items: flex-end;
    margin-bottom: 12px;
}
.dash-header__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.dash-window-picker {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
}
.form-select--sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #C4C8D0;
    background: #fff;
}

/* Seccion draggable */
.dash-section {
    position: relative;
    margin-top: 18px;
    padding-left: 14px;
    transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}
.dash-section__handle {
    position: absolute;
    left: -2px;
    top: 12px;
    color: #8A8F9A;
    cursor: grab;
    opacity: 0.45;
    transition: opacity 120ms ease;
}
.dash-section:hover .dash-section__handle { opacity: 1; }
.dash-section--dragging {
    opacity: 0.55;
    transform: scale(0.995);
    box-shadow: 0 10px 24px rgba(27, 42, 78, 0.15);
    background: #fff;
    border-radius: 12px;
}
.dash-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 2px 10px 2px;
}
.dash-section__header h3 {
    margin: 0;
    font-size: 15px;
    color: #1B2A4E;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* KPI row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}
.kpi-tile {
    position: relative;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(27, 42, 78, 0.08);
    box-shadow: 0 4px 10px rgba(27, 42, 78, 0.04);
    overflow: hidden;
}
.kpi-tile::before {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 4px;
}
.kpi-tile--navy::before   { background: #1B2A4E; }
.kpi-tile--yellow::before { background: #FFD300; }
.kpi-tile--gray::before   { background: #8A8F9A; }
.kpi-tile--danger::before { background: #C62828; }
.kpi-tile__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8A8F9A;
    font-weight: 600;
}
.kpi-tile__value {
    font-size: 28px;
    font-weight: 700;
    color: #1B2A4E;
    line-height: 1.1;
    margin-top: 4px;
}
.kpi-tile__unit {
    font-size: 16px;
    color: #8A8F9A;
    margin-left: 2px;
}
.kpi-tile__sub {
    font-size: 12px;
    color: #555555;
    margin-top: 2px;
}

/* Netflix-style scroll horizontal */
.hscroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 12px 2px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.hscroll::-webkit-scrollbar { height: 8px; }
.hscroll::-webkit-scrollbar-track { background: transparent; }
.hscroll::-webkit-scrollbar-thumb {
    background: rgba(27, 42, 78, 0.25);
    border-radius: 4px;
}
.hscroll__empty {
    padding: 18px;
    color: #8A8F9A;
    font-style: italic;
}
.hscroll__card {
    flex: 0 0 340px;
    min-width: 340px;
    max-width: 380px;
    background: #fff;
    border: 1px solid rgba(27, 42, 78, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    scroll-snap-align: start;
    box-shadow: 0 2px 6px rgba(27, 42, 78, 0.04);
}
.hscroll__title {
    font-size: 13px;
    font-weight: 600;
    color: #1B2A4E;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(27, 42, 78, 0.12);
}
.hscroll__card--list {
    flex: 0 0 300px;
    min-width: 300px;
}
.hscroll__card--stats .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 2px;
    border-bottom: 1px solid rgba(27, 42, 78, 0.06);
    font-size: 13px;
}
.hscroll__card--stats .stat-row:last-child { border-bottom: none; }
.hscroll__card--stats .stat-row strong { color: #1B2A4E; font-weight: 700; }
.hscroll__card--stats .stat-row--danger strong { color: #C62828; }

/* Ranking listas */
.ranked-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: rank;
}
.ranked-list__item {
    display: grid;
    grid-template-columns: 26px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 2px;
    border-bottom: 1px solid rgba(27, 42, 78, 0.05);
    font-size: 13px;
}
.ranked-list__item:last-child { border-bottom: none; }
.ranked-list__pos {
    background: #1B2A4E;
    color: #FFD300;
    border-radius: 999px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.ranked-list__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #2D2D2D;
}
.ranked-list__value {
    color: #1B2A4E;
    font-weight: 700;
}
.ranked-list__empty {
    color: #8A8F9A;
    font-style: italic;
    padding: 6px 2px;
}

/* Insights card */
.insight-card {
    flex: 0 0 320px;
    min-width: 320px;
    max-width: 360px;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(27, 42, 78, 0.08);
    box-shadow: 0 2px 6px rgba(27, 42, 78, 0.05);
    position: relative;
    scroll-snap-align: start;
}
.insight-card__level {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
}
.insight-card--ok .insight-card__level      { background: #E8F5E9; color: #1B5E20; }
.insight-card--info .insight-card__level    { background: #E3F2FD; color: #1565C0; }
.insight-card--alerta .insight-card__level  { background: #FFF8E1; color: #B7950B; }
.insight-card--critico .insight-card__level { background: #FFEBEE; color: #C62828; }

.insight-card--ok       { border-left: 3px solid #1B5E20; }
.insight-card--info     { border-left: 3px solid #1565C0; }
.insight-card--alerta   { border-left: 3px solid #FFD300; }
.insight-card--critico  { border-left: 3px solid #C62828; }

.insight-card__title {
    font-size: 14px;
    font-weight: 700;
    color: #1B2A4E;
    margin-bottom: 4px;
}
.insight-card__body {
    font-size: 12.5px;
    color: #555555;
    line-height: 1.4;
}

/* =============================================================================
   SIDEBAR COLAPSABLE + LENGUETA FLOTANTE (v4 2026)
   ========================================================================= */

/* Posicion del boton "ocultar" dentro del sidebar (esquina superior derecha).
   El .sidebar debe ser position:relative para que el boton absoluto
   se posicione dentro del aside y no respecto al body. */
.sidebar { position: relative; }
.sidebar-toggle {
    position: absolute;
    top: 10px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    z-index: 3;
}
.sidebar-toggle:hover {
    background: rgba(255, 211, 0, 0.18);
    color: #FFD300;
}

/* Lengueta flotante: SIEMPRE oculta por defecto, solo aparece cuando
   el body tiene la clase .sidebar-collapsed. */
.sidebar-reopener {
    position: fixed;
    top: 14px;
    left: 0;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 12px 7px 10px;
    background: var(--color-navy);
    color: #FFD300;
    border: 1px solid rgba(255, 211, 0, 0.3);
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 500;
    transition: transform 0.15s, background 0.15s;
}
.sidebar-reopener:hover {
    background: #16213E;
    transform: translateX(2px);
}
.sidebar-reopener svg { display: block; }

/* Estado COLAPSADO: sidebar oculto + lengueta visible */
body.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
}
body.sidebar-collapsed .sidebar-reopener {
    display: inline-flex;
}

/* Transicion suave al colapsar/expandir */
.sidebar {
    transition: width 0.2s ease-in-out, padding 0.2s ease-in-out;
}

/* En pantallas < 900px el sidebar ya esta oculto por defecto; la lengueta
   tambien aparece para poder abrirlo como overlay. */
@media (max-width: 900px) {
    .sidebar-toggle { display: none; }
}


/* =============================================================================
   ALERT BANNER COLAPSABLE (v4 2026)
   Banner amarillo/rojo con boton +/- para minimizar/maximizar. Estado
   persistido en localStorage via data-alert-key.
   ========================================================================= */
.alert-banner {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 4px solid #D97706;
    background: #FEF3C7;
    transition: padding 0.15s ease;
}
.alert-banner--danger  { background: #FEE2E2; border-left-color: #DC2626; }
.alert-banner--warning { background: #FEF3C7; border-left-color: #D97706; }

.alert-banner__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.alert-banner__title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.alert-banner__toggle {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.55);
    color: #111;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    padding: 0;
}
.alert-banner__toggle:hover { background: rgba(255, 255, 255, 0.9); }
.alert-banner__sign { display: block; line-height: 1; margin-top: -2px; }

.alert-banner__body {
    margin-top: 2px;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.2s ease, opacity 0.15s ease, margin-top 0.15s ease;
}
.alert-banner--collapsed .alert-banner__body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}
.alert-banner--collapsed { padding: 6px 16px; }

/* =========================================================================
   TASK ADD FORM — mismo estilo que resto del sistema, sin rectángulos duros
   ========================================================================= */
.task-add {
    margin-top: 20px;
    padding: 18px 0 4px 0;
    border-top: 1px solid var(--color-border);
}
.task-add .form-group { margin-bottom: 12px; }
.task-add .form-grid,
.task-add .form-grid-two { margin-bottom: 4px; }
.task-add .form-actions { margin-top: 6px; }

/* View Transitions desactivadas (v4): el fade de 180ms agregaba latencia
   perceptual a cada navegacion. La barra de progreso superior ya da
   feedback visual suficiente. Si en el futuro se quiere activar de nuevo,
   restaurar este bloque y volver a poner <meta name="view-transition"> en base.html. */

/* Cursor "pensando" durante navegacion (lo activa perf_navigation.js) */
body.sga-navigating { cursor: progress; }
