/* ══════════════════════════════════════════════════════════════════
   Servimed IPS SAS · Design System v2.0 (adaptado a Historia Clínica)
   Tokens y componentes oficiales del documento maestro (AEHC).
   Regla de oro: nunca hardcodear hex; usar siempre las variables.
   ══════════════════════════════════════════════════════════════════ */

:root {
    /* ── Marca ── */
    --c-primary:       #0762B0;
    --c-primary-dark:  #0551A0;
    --c-primary-light: #3a8fd4;
    --c-primary-wash:  #e8f1fb;
    --c-accent:        #fcd13a;
    --c-accent-dark:   #e5b800;

    /* ── Semánticos ── */
    --c-success:       #28a745;
    --c-success-dark:  #1e7e34;
    --c-danger:        #dc3545;
    --c-danger-dark:   #b02a37;
    --c-warning:       #ffc107;

    /* ── Neutros ── */
    --c-bg:        #E3E4E5;
    --c-surface:   #ffffff;
    --c-surface-2: #f8f9fa;
    --c-border:    #dee2e6;
    --c-text-1:    #1a1f2e;
    --c-text-2:    #555b6e;
    --c-text-3:    #8a92a6;

    /* ── Espaciado ── */
    --sp-xs: 4px;
    --sp-sm: 8px;
    --sp-md: 16px;
    --sp-lg: 24px;
    --sp-xl: 32px;

    /* ── Radios ── */
    --r-sm:   4px;
    --r:      8px;
    --r-lg:   12px;
    --r-pill: 20px;

    /* ── Sombras ── */
    --sh-sm: 0 1px 3px rgba(0,0,0,.08);
    --sh:    0 2px 8px rgba(0,0,0,.10);
    --sh-lg: 0 4px 20px rgba(0,0,0,.14);

    /* ── Fuentes ── */
    --font: 'Inter', Arial, sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* ── Reset ligero ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    color: var(--c-text-1);
    background: var(--c-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { margin: 0; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════
   TOP NAVBAR
   ══════════════════════════════════════════════════════════════════ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-lg);
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    border-bottom: 3px solid var(--c-accent);
    color: #fff;
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: .04em;
    color: #fff;
}
.topbar__brand img {
    height: 34px;
    width: auto;
    background: #fff;
    padding: 3px 8px;
    border-radius: var(--r-sm);
}
.topbar__user {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    font-size: 13px;
    font-weight: 500;
}
.topbar__avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--c-accent);
    color: var(--c-primary-dark);
    display: grid; place-items: center;
    font-weight: 800; font-size: 13px;
}
.topbar a { color: #fff; }

/* Botón de usuario del topbar (menú desplegable con avatar) */
.topbar__user .menu__btn { padding: 5px 12px 5px 6px; gap: 9px; }
.topbar__user .menu__btn .topbar__avatar { width: 28px; height: 28px; font-size: 12px; }
.menu__btn-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Botón hamburguesa flotante (borde izquierdo) para abrir el sidebar */
.sidebar-fab {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1035;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    color: #fff;
    border: 2px solid var(--c-accent);
    border-left: none;
    border-radius: 0 var(--r) var(--r) 0;
    padding: 12px 11px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--sh);
    transition: padding .15s ease, background .15s ease;
}
.sidebar-fab:hover { padding-right: 16px; }
body.sidebar-open .sidebar-fab { opacity: 0; pointer-events: none; }
@media (max-width: 640px) {
    .menu__btn-name { max-width: 110px; }
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT / CONTENEDOR
   ══════════════════════════════════════════════════════════════════ */
.module-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--sp-lg);
}
.module-block {
    background: var(--c-surface);
    border-radius: var(--r);
    box-shadow: var(--sh-sm);
    overflow: hidden;
    margin-bottom: var(--sp-lg);
}

/* ── Module Header: blanco + borde amarillo inferior (nunca gradiente) ── */
.module-header {
    background: var(--c-surface);
    border-bottom: 3px solid var(--c-accent);
    padding: 20px 24px;
    border-radius: var(--r) var(--r) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
    flex-wrap: wrap;
}
.module-header__title {
    color: var(--c-primary);
    font-size: 17px;
    font-weight: 700;
    display: flex; align-items: center; gap: var(--sp-sm);
}
.module-header__subtitle {
    color: var(--c-text-3);
    font-size: 13px;
    margin-top: 2px;
}
.module-header__actions { display: flex; gap: var(--sp-sm); flex-wrap: wrap; }
.module-body { padding: var(--sp-lg); }

/* Sub-secciones dentro de un formulario largo */
.section-heading {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-primary);
    padding-bottom: var(--sp-xs);
    margin: var(--sp-lg) 0 var(--sp-md);
    border-bottom: 1px solid var(--c-border);
    display: flex; align-items: center; gap: var(--sp-sm);
}
.section-heading:first-child { margin-top: 0; }

/* ══════════════════════════════════════════════════════════════════
   BOTONES · jerarquía de 5 variantes, sin gradientes
   ══════════════════════════════════════════════════════════════════ */
.btn {
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 10px 18px;
    border: 1.5px solid transparent;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-sm);
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(7,98,176,.25); }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); color: #fff; text-decoration: none; }

.btn-outline { background: transparent; color: var(--c-primary); border-color: var(--c-primary); }
.btn-outline:hover { background: var(--c-primary-wash); color: var(--c-primary-dark); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--c-text-2); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text-1); text-decoration: none; }

.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: var(--c-success-dark); color: #fff; text-decoration: none; }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: var(--c-danger-dark); color: #fff; text-decoration: none; }

.btn-lg { padding: 13px 24px; font-size: 14px; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ══════════════════════════════════════════════════════════════════
   FORMULARIOS
   ══════════════════════════════════════════════════════════════════ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--sp-md);
}
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 12; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-6  { grid-column: span 6; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-12 { grid-column: span 12; }

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text-2);
    display: flex; align-items: center; gap: 6px;
}
.form-label .req { color: var(--c-danger); font-weight: 700; }
.form-label .unit { color: var(--c-text-3); font-weight: 500; }

.form-input,
.form-select,
.form-textarea {
    font-family: var(--font);
    font-size: 14px;
    color: var(--c-text-1);
    background: var(--c-surface);
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.form-textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(7,98,176,.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--c-text-3); }

/* Readonly / calculado */
.form-input--ro {
    background: var(--c-surface-2);
    color: var(--c-text-2);
    cursor: not-allowed;
    font-weight: 600;
}

/* ID / cédula en monoespaciada */
.form-input--mono { font-family: var(--mono); letter-spacing: .02em; }

/* Estados de validación */
.field.has-error .form-input,
.field.has-error .form-select,
.field.has-error .form-textarea {
    border-color: var(--c-danger);
    box-shadow: 0 0 0 3px rgba(220,53,69,.10);
}
.field.is-valid .form-input,
.field.is-valid .form-select,
.field.is-valid .form-textarea {
    border-color: var(--c-success);
}
.field-error {
    font-size: 11.5px;
    color: var(--c-danger);
    font-weight: 500;
    min-height: 14px;
    display: none;
}
.field.has-error .field-error { display: block; }
.field-hint { font-size: 11.5px; color: var(--c-text-3); }

/* ══════════════════════════════════════════════════════════════════
   TABLAS DE DATOS · cabecera azul siempre
   ══════════════════════════════════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    /* el recorte del contenedor redondea las puntas del encabezado azul */
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
/* Redondear las esquinas del encabezado para que acompañen al contenedor */
.data-table thead tr:first-child th:first-child { border-top-left-radius: var(--r-lg); }
.data-table thead tr:first-child th:last-child  { border-top-right-radius: var(--r-lg); }
.data-table thead th {
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: left;
    padding: 11px 14px;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-1);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--c-surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td a { color: var(--c-text-1); }
.data-table .cell-id { font-family: var(--mono); color: var(--c-text-2); font-size: 12px; }
.data-table .cell-actions { text-align: right; white-space: nowrap; }
.data-table .cell-actions .btn { margin-left: var(--sp-xs); }

/* ══════════════════════════════════════════════════════════════════
   BADGES & STATUS
   ══════════════════════════════════════════════════════════════════ */
.badge-pill {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--r-pill);
    font-size: 11.5px;
    font-weight: 600;
    background: var(--c-primary-wash);
    color: var(--c-primary-dark);
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.status--done       { color: var(--c-success-dark); }
.status--done::before       { background: var(--c-success); }
.status--pending    { color: var(--c-danger-dark); }
.status--pending::before    { background: var(--c-danger); }
.status--inprogress { color: var(--c-accent-dark); }
.status--inprogress::before { background: var(--c-warning); }

/* ══════════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: var(--sp-xl) var(--sp-lg);
    color: var(--c-text-3);
}
.empty-state__icon { font-size: 34px; opacity: .5; }
.empty-state__title { font-weight: 700; color: var(--c-text-2); margin-top: var(--sp-sm); }
.empty-state__text { font-size: 13px; margin-top: 4px; }

/* ══════════════════════════════════════════════════════════════════
   TOASTS · fixed top-right, auto-dismiss
   ══════════════════════════════════════════════════════════════════ */
#toastContainer {
    position: fixed;
    top: 68px;
    right: var(--sp-lg);
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
}
.toast {
    min-width: 260px;
    max-width: 380px;
    padding: 13px 16px;
    border-radius: var(--r);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--sh-lg);
    animation: toastIn .25s ease;
}
.toast.ok { background: var(--c-success); }
.toast.er { background: var(--c-danger); }
.toast.info { background: var(--c-primary); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ══════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(26,31,46,.55);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1070;
    padding: var(--sp-md);
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--c-surface);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-lg);
    width: 100%; max-width: 520px;
    overflow: hidden;
    animation: modalIn .25s ease;
}
@keyframes modalIn { from { transform: translateY(-24px) scale(.97); opacity: 0; } }
.modal__header {
    background: var(--c-primary);
    color: #fff;
    padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: 15px;
}
.modal__close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.modal__body { padding: var(--sp-lg); }
.modal__footer { padding: var(--sp-md) var(--sp-lg); display: flex; justify-content: flex-end; gap: var(--sp-sm); border-top: 1px solid var(--c-border); }

/* ══════════════════════════════════════════════════════════════════
   IMC / SEMÁFORO clínico (tarjeta de resultado calculado)
   ══════════════════════════════════════════════════════════════════ */
.metric-chip {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 14px;
    border-radius: var(--r);
    border: 1.5px solid var(--c-border);
    background: var(--c-surface-2);
    min-width: 120px;
}
.metric-chip__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-3); }
.metric-chip__value { font-size: 20px; font-weight: 800; color: var(--c-text-1); font-family: var(--mono); }
.metric-chip__note  { font-size: 11px; font-weight: 600; }
.metric-chip.is-low    { border-color: var(--c-warning); }
.metric-chip.is-low    .metric-chip__note { color: var(--c-accent-dark); }
.metric-chip.is-ok     { border-color: var(--c-success); }
.metric-chip.is-ok     .metric-chip__note { color: var(--c-success-dark); }
.metric-chip.is-high   { border-color: var(--c-danger); }
.metric-chip.is-high   .metric-chip__note { color: var(--c-danger-dark); }

/* ══════════════════════════════════════════════════════════════════
   AUTH · pantalla de login
   ══════════════════════════════════════════════════════════════════ */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: var(--c-bg);
}
.auth__aside {
    background: linear-gradient(150deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    color: #fff;
    padding: var(--sp-xl) 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    border-right: 3px solid var(--c-accent);
}
.auth__aside::after {
    content: '';
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: rgba(252,209,58,.10);
    bottom: -140px; right: -120px;
}
/* El logo institucional tiene fondo blanco sólido: se presenta en una
   tarjeta blanca redondeada (nunca con filtros que lo deformen). */
.auth__logo {
    height: 64px;
    width: auto;
    display: block;
    background: #fff;
    padding: 8px 14px;
    border-radius: var(--r);
    box-shadow: var(--sh-sm);
}
.auth__aside-content { position: relative; z-index: 1; }
.auth__headline { font-size: 30px; font-weight: 800; line-height: 1.2; margin-bottom: var(--sp-md); }
.auth__lead { font-size: 15px; color: rgba(255,255,255,.85); max-width: 380px; }
.auth__features { list-style: none; padding: 0; margin: var(--sp-lg) 0 0; display: flex; flex-direction: column; gap: var(--sp-sm); }
.auth__features li { display: flex; align-items: center; gap: var(--sp-sm); font-size: 14px; color: rgba(255,255,255,.9); }
.auth__features li::before { content: '✓'; color: var(--c-accent); font-weight: 800; }
.auth__meta { position: relative; z-index: 1; font-size: 12px; color: rgba(255,255,255,.6); }

.auth__main { display: flex; align-items: center; justify-content: center; padding: var(--sp-xl); }
.auth__card { width: 100%; max-width: 380px; }
.auth__title { font-size: 22px; font-weight: 800; color: var(--c-text-1); }
.auth__subtitle { font-size: 14px; color: var(--c-text-3); margin: 6px 0 var(--sp-xl); }

.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .form-input { padding-right: 42px; }
.input-affix__btn {
    position: absolute; right: 6px;
    background: none; border: none; cursor: pointer;
    color: var(--c-text-3); font-size: 13px; font-weight: 600;
    padding: 6px 8px; border-radius: var(--r-sm);
}
.input-affix__btn:hover { color: var(--c-primary); background: var(--c-primary-wash); }

.alert {
    padding: 11px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: var(--sp-md);
    border: 1px solid transparent;
}
.alert--danger  { background: #fdecee; color: var(--c-danger-dark); border-color: #f5c2c7; }
.alert--success { background: #e6f5ea; color: var(--c-success-dark); border-color: #badbc4; }
.alert--info    { background: var(--c-primary-wash); color: var(--c-primary-dark); border-color: #b9d6f2; }

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth__aside { display: none; }
    .col-2, .col-3, .col-4, .col-6, .col-8, .col-9 { grid-column: span 6; }
}
@media (max-width: 600px) {
    .module-container { padding: var(--sp-md); }
    .col-2, .col-3, .col-4, .col-6, .col-8, .col-9, .col-12 { grid-column: span 12; }
    .module-header { flex-direction: column; align-items: flex-start; }
    #toastContainer { left: var(--sp-md); right: var(--sp-md); }
    .toast { max-width: none; }
}

/* ══════════════════════════════════════════════════════════════════
   MENÚ DESPLEGABLE (topbar)
   ══════════════════════════════════════════════════════════════════ */
.menu { position: relative; }
.menu__btn {
    background: rgba(255,255,255,.12);
    border: 1.5px solid rgba(255,255,255,.35);
    color: #fff;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.menu__btn:hover { background: rgba(255,255,255,.2); }
.menu__btn .caret { font-size: 10px; transition: transform .15s; }
.menu.open .menu__btn .caret { transform: rotate(180deg); }
.menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 230px;
    background: var(--c-surface);
    border-radius: var(--r);
    box-shadow: var(--sh-lg);
    border: 1px solid var(--c-border);
    padding: 6px;
    display: none;
    z-index: 1060;
    animation: modalIn .2s ease;
}
.menu.open .menu__panel { display: block; }
.menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-1);
    text-decoration: none;
    cursor: pointer;
}
.menu__item:hover { background: var(--c-primary-wash); color: var(--c-primary-dark); text-decoration: none; }
.menu__item.is-active { background: var(--c-primary-wash); color: var(--c-primary-dark); font-weight: 700; }
/* El panel es blanco: los links NO heredan el blanco de `.topbar a` */
.topbar .menu__panel .menu__item { color: var(--c-text-1); }
.topbar .menu__panel .menu__item:hover,
.topbar .menu__panel .menu__item.is-active { color: var(--c-primary-dark); }
.menu__divider { height: 1px; background: var(--c-border); margin: 6px 4px; }

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR LATERAL (Design System: 280px, deslizable, borde amarillo)
   ══════════════════════════════════════════════════════════════════ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,31,46,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    z-index: 1040;
}
body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

.sidebar {
    position: fixed;
    top: 0;
    left: -284px;                 /* 280px + borde */
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
    border-right: 3px solid var(--c-accent);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: left .3s ease;
    box-shadow: var(--sh-lg);
}
body.sidebar-open .sidebar { left: 0; }

.sidebar__header {
    position: relative;
    background: var(--c-accent);
    color: var(--c-primary-dark);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 44px 14px 18px;
}
.sidebar__logo {
    height: 38px;
    width: auto;
    background: #fff;
    padding: 3px 6px;
    border-radius: var(--r-sm);
    flex: none;
}
.sidebar__title {
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .05em;
    text-transform: uppercase;
    line-height: 1.35;
}
.sidebar__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--c-primary-dark);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.sidebar__nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar__section {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
    padding: 16px 20px 6px;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,.82);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar__link:hover {
    background: rgba(252,209,58,.08);
    color: #fff;
    text-decoration: none;
}
.sidebar__link.is-active {
    background: rgba(252,209,58,.18);
    border-left-color: var(--c-accent);
    color: #fff;
    font-weight: 700;
}

.sidebar__footer {
    background: var(--c-accent);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    flex: none;
}
.sidebar__footer-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    color: var(--c-primary-dark);
    text-transform: uppercase;
}
.sidebar__footer-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-primary-dark);
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════════
   FILTER BAR · banda de búsqueda bajo el header (Design System)
   ══════════════════════════════════════════════════════════════════ */
.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) 160px 160px auto auto;
    gap: var(--sp-md);
    align-items: end;
    padding: var(--sp-md) var(--sp-lg);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}
@media (max-width: 900px) {
    .filter-bar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .filter-bar { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════
   TABLE FOOTER + PAGINACIÓN (Design System)
   ══════════════════════════════════════════════════════════════════ */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
    padding: var(--sp-md) var(--sp-lg);
    border-top: 1px solid var(--c-border);
    font-size: 12.5px;
    color: var(--c-text-3);
    flex-wrap: wrap;
}
.pagination { display: flex; gap: 4px; }
.pg-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text-2);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.pg-btn:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }
.pg-btn.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pg-btn.is-disabled { opacity: .45; pointer-events: none; }

/* ══════════════════════════════════════════════════════════════════
   FILA EXPANDIBLE (detalle desplegable en tablas)
   ══════════════════════════════════════════════════════════════════ */
.row-toggle .chev { display: inline-block; transition: transform .15s; font-size: 10px; }
.row-toggle.open .chev { transform: rotate(180deg); }
tr.detail-row { display: none; }
tr.detail-row.open { display: table-row; }
tr.detail-row > td {
    background: var(--c-surface-2);
    padding: var(--sp-lg);
    border-bottom: 2px solid var(--c-primary-wash);
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-md);
}
.detail-item { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r); padding: 12px 14px; }
.detail-item__label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-primary);
    margin-bottom: 4px;
}
.detail-item__value { font-size: 13px; color: var(--c-text-1); white-space: pre-wrap; word-break: break-word; }
.detail-item--full { grid-column: 1 / -1; }

/* Utilidades mínimas */
.u-mono { font-family: var(--mono); }
.u-muted { color: var(--c-text-3); }
.u-mt-0 { margin-top: 0; }
.u-flex { display: flex; }
.u-gap-sm { gap: var(--sp-sm); }
.u-gap-md { gap: var(--sp-md); }
.u-wrap { flex-wrap: wrap; }
.u-right { margin-left: auto; }
.u-center { text-align: center; }
.u-hidden { display: none !important; }
