/* ==========================================================================
   Portal de Sistemas · Labocenter S.A
   Hoja de estilos principal (reemplaza a custom.css, login.css y sidebar.css).
   Base: Bootstrap 5.3. Aqui solo van los tokens de diseno y los componentes
   propios del Portal.
   ========================================================================== */

:root {
    --lc-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --lc-bg: #f3f5f9;
    --lc-surface: #ffffff;
    --lc-border: #e3e8ef;
    --lc-text: #1d2939;
    --lc-muted: #667085;
    --lc-primary: #0d6efd;
    --lc-primary-soft: rgba(13, 110, 253, 0.1);
    --lc-sidebar: #0b2e4f;
    --lc-sidebar-2: #0e3a63;
    --lc-sidebar-text: #ffffff;
    --lc-sidebar-muted: #9fb8d0;
    --lc-sidebar-width: 280px;
    --lc-sidebar-mini: 72px;
    --lc-topbar-height: 64px;
    --lc-radius: 0.85rem;
    --lc-radius-sm: 0.55rem;
    --lc-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --lc-shadow: 0 6px 20px rgba(16, 24, 40, 0.08);

    --bs-body-font-family: var(--lc-font);
    --bs-body-color: var(--lc-text);
    --bs-border-color: var(--lc-border);
}

body {
    font-family: var(--lc-font);
    background: var(--lc-bg);
    color: var(--lc-text);
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------- Layout */
.portal {
    display: flex;
    min-height: 100vh;
}

.portal-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.portal-content {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem clamp(1rem, 2.5vw, 2rem) 2rem;
    animation: lcAparecer 0.25s ease;
}

.portal-footer {
    padding: 1rem clamp(1rem, 2.5vw, 2rem);
    font-size: 0.78rem;
    color: var(--lc-muted);
    text-align: center;
}

@keyframes lcAparecer {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- Sidebar */
.sidebar-bg {
    background: linear-gradient(180deg, var(--lc-sidebar) 0%, var(--lc-sidebar-2) 100%);
    color: var(--lc-sidebar-text);
}

#sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--lc-sidebar-width);
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Con el boton del menu (escritorio) el sidebar queda angosto, solo con los
   iconos (el nombre aparece al pasar el mouse). Se recuerda en localStorage. */
#sidebar { transition: width 0.22s ease; }
body.sidebar-oculto #sidebar { width: var(--lc-sidebar-mini); overflow-x: hidden; }
body.sidebar-oculto #sidebar .texto,
body.sidebar-oculto #sidebar .sidebar-grupo-titulo > *,
body.sidebar-oculto #sidebar .sidebar-pie { display: none; }
body.sidebar-oculto #sidebar .sidebar-marca { justify-content: center; padding: 0 0.5rem; }
body.sidebar-oculto #sidebar .sidebar-logo { padding: 4px 5px; height: 34px; }
body.sidebar-oculto #sidebar .sidebar-logo img { height: 24px; width: 48px; object-fit: cover; object-position: left center; }
body.sidebar-oculto #sidebar .sidebar-nav { padding: 0.75rem 0.55rem; }
body.sidebar-oculto #sidebar .sidebar-link { justify-content: center; padding: 0.6rem 0; gap: 0; }
body.sidebar-oculto #sidebar .sidebar-link i { font-size: 1.15rem; width: auto; }
body.sidebar-oculto #sidebar .sidebar-grupo { margin-top: 0.5rem; }
body.sidebar-oculto #sidebar .sidebar-grupo-titulo { height: 1px; padding: 0; margin: 0.5rem 0.4rem; background: rgba(255, 255, 255, 0.14); pointer-events: none; }
body.sidebar-oculto #sidebar .collapse:not(.show) { display: block; }

.sidebar-marca {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--lc-topbar-height);
    padding: 0 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-marca:hover { color: #fff; }

/* El logo es horizontal (atomo + texto): va en una pastilla blanca para que se lea */
.sidebar-logo {
    height: 42px;
    padding: 5px 9px;
    border-radius: 10px;
    background: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sidebar-logo img {
    height: 32px;
    width: auto;
}

.sidebar-marca .titulo { font-weight: 700; font-size: 0.9rem; line-height: 1.15; }
.sidebar-marca .subtitulo { font-size: 0.72rem; color: var(--lc-sidebar-muted); letter-spacing: 0.04em; }

.sidebar-nav { padding: 0.75rem 0.7rem 1rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    margin: 1px 0;
    border-radius: var(--lc-radius-sm);
    color: rgba(255, 255, 255, 0.86);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; color: var(--lc-sidebar-muted); transition: color 0.15s ease; }
.sidebar-link:hover, .sidebar-link:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-link:hover i { color: #fff; }

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.35), rgba(13, 110, 253, 0.12));
    color: #fff;
    box-shadow: inset 3px 0 0 #4d94ff;
}

.sidebar-link.active i { color: #8ec5ff; }

.sidebar-grupo { margin-top: 0.85rem; }

.sidebar-grupo-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.35rem 0.75rem;
    border: 0;
    background: none;
    color: var(--lc-sidebar-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border-radius: var(--lc-radius-sm);
}

.sidebar-grupo-titulo:hover { color: #fff; }
.sidebar-grupo-titulo .bi-chevron-down { transition: transform 0.2s ease; font-size: 0.7rem; }
.sidebar-grupo-titulo.collapsed .bi-chevron-down { transform: rotate(-90deg); }

.sidebar-pie {
    margin-top: auto;
    padding: 0.9rem 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    color: var(--lc-sidebar-muted);
}

.offcanvas.sidebar-bg { --bs-offcanvas-width: min(320px, 88vw); }
.offcanvas.sidebar-bg .btn-close { filter: invert(1) grayscale(1) brightness(2); }
/* Cabecera del menu en celular: la X va en un boton redondo visible, sin tapar la marca */
.offcanvas-cabecera { position: relative; padding-right: 3.25rem; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.offcanvas-cabecera .sidebar-marca { border-bottom: 0; min-width: 0; gap: .6rem; padding-left: 1rem; }
.offcanvas-cabecera .sidebar-logo { height: 36px; padding: 4px 7px; }
.offcanvas-cabecera .sidebar-logo img { height: 26px; }
.offcanvas-cabecera .sidebar-marca .texto { min-width: 0; }
.offcanvas-cabecera .sidebar-marca .titulo, .offcanvas-cabecera .sidebar-marca .subtitulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-cerrar-menu {
    position: absolute; top: 50%; right: .75rem; transform: translateY(-50%);
    width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .12); color: #fff; font-size: 1rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.btn-cerrar-menu:hover, .btn-cerrar-menu:focus-visible { background: rgba(255, 255, 255, .25); color: #fff; outline: none; }

/* --------------------------------------------------------------- Topbar */
.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--lc-topbar-height);
    padding: 0 clamp(0.75rem, 2vw, 1.5rem);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--lc-border);
}

.btn-icono {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--lc-radius-sm);
    border: 1px solid var(--lc-border);
    background: var(--lc-surface);
    color: var(--lc-text);
    font-size: 1.15rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-icono:hover { background: var(--lc-bg); border-color: #cfd6e0; }

.topbar-titulo { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-reloj {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #fdecec;
    color: #d92d20;
    font-weight: 600;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.usuario-menu {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: none;
    color: var(--lc-text);
}

.usuario-menu:hover, .usuario-menu[aria-expanded="true"] { background: var(--lc-bg); border-color: var(--lc-border); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, #2e6ff2, #0b2e4f);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }

.usuario-menu .nombre { font-weight: 600; font-size: 0.85rem; line-height: 1.1; }
.usuario-menu .rol { font-size: 0.7rem; color: var(--lc-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.dropdown-menu { border-color: var(--lc-border); box-shadow: var(--lc-shadow); border-radius: var(--lc-radius); padding: 0.4rem; }
.dropdown-item { border-radius: var(--lc-radius-sm); padding: 0.5rem 0.75rem; font-size: 0.9rem; }

/* --------------------------------------------------------------- Encabezado de pagina */
.breadcrumb { font-size: 0.82rem; margin-bottom: 0.75rem; --bs-breadcrumb-divider-color: #a3adbb; }
.breadcrumb a { color: var(--lc-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--lc-primary); }
.breadcrumb-item.active { color: var(--lc-text); font-weight: 500; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.page-header .icono {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--lc-primary-soft);
    color: var(--lc-primary);
    font-size: 1.35rem;
    flex-shrink: 0;
}

.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.page-header p { margin: 0.15rem 0 0; color: var(--lc-muted); font-size: 0.9rem; }

/* --------------------------------------------------------------- Tarjetas */
.card {
    --bs-card-border-color: var(--lc-border);
    --bs-card-border-radius: var(--lc-radius);
    --bs-card-inner-border-radius: calc(var(--lc-radius) - 1px);
    box-shadow: var(--lc-shadow-sm);
}

.card-header { background: var(--lc-surface); padding: 0.9rem 1.15rem; }
.card-body { padding: 1.15rem; }

.card-titulo { font-size: 1rem; font-weight: 600; margin: 0; }
.card-subtitulo { font-size: 0.82rem; color: var(--lc-muted); margin: 0.15rem 0 0; }

/* Barra superior de listados: busqueda + contador */
.tabla-barra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
}

.buscador {
    position: relative;
    flex: 1 1 260px;
    max-width: 380px;
}

.buscador i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--lc-muted); pointer-events: none; }
.buscador .form-control { padding-left: 2.1rem; }

/* --------------------------------------------------------------- Tablas */
.table { --bs-table-color: var(--lc-text); margin-bottom: 0; }
.table > thead th {
    background: #f8fafc;
    color: var(--lc-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom-width: 1px;
    white-space: nowrap;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.table > :not(caption) > * > * { padding-left: 1rem; padding-right: 1rem; }
.table-sm > :not(caption) > * > * { padding: 0.45rem 0.75rem; }
.table-sm { font-size: 0.86rem; }
.table-sm > thead th { padding-top: 0.55rem; padding-bottom: 0.55rem; font-size: 0.68rem; }
.table-sm .icono-color { width: 28px; height: 28px; border-radius: 8px; font-size: 0.85rem; }
.table-sm .avatar-sm { width: 28px; height: 28px; font-size: 0.68rem; }
.table-sm .acciones .btn { width: 30px; height: 30px; font-size: 0.85rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f6f9ff; }
.card > .table-responsive:last-child .table tr:last-child td { border-bottom: 0; }

.celda-principal { font-weight: 600; }
.celda-secundaria { font-size: 0.8rem; color: var(--lc-muted); }

.acciones { white-space: nowrap; text-align: end; }
.acciones .btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: var(--lc-radius-sm); }

/* Pie de tabla con paginacion */
.tabla-pie {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--lc-border);
    background: #fbfcfe;
    border-radius: 0 0 var(--lc-radius) var(--lc-radius);
}

.tabla-pie-info { font-size: 0.8rem; color: var(--lc-muted); }
.pagination-sm .page-link { min-width: 32px; text-align: center; border-color: var(--lc-border); color: var(--lc-text); }
.pagination-sm .page-item.active .page-link { background: var(--lc-primary); border-color: var(--lc-primary); color: #fff; }
.pagination-sm .page-item.disabled .page-link { color: #b6c0cd; background: transparent; }
.pagination-sm .page-link:focus { box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15); }

/* Estados vacios */
.vacio {
    padding: 2.75rem 1rem;
    text-align: center;
    color: var(--lc-muted);
}

.vacio i { font-size: 2.2rem; display: block; margin-bottom: 0.6rem; color: #b6c0cd; }
.vacio .titulo { font-weight: 600; color: var(--lc-text); }

/* --------------------------------------------------------------- Insignias */
.badge { font-weight: 600; letter-spacing: 0.01em; }

.estado {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.estado::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.estado-ok { background: #e7f6ec; color: #18794e; }
.estado-off { background: #eef1f5; color: #5d6b7e; }
.estado-alerta { background: #fdecec; color: #b42318; }
.estado-aviso { background: #fff4e0; color: #a15c07; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #344054;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.icono-color {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

/* --------------------------------------------------------------- Formularios */
.form-label { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.35rem; color: #344054; }
.form-label.requerido::after { content: " *"; color: #d92d20; }
.form-text { font-size: 0.78rem; }

.form-control, .form-select {
    border-color: #d0d7e2;
    border-radius: var(--lc-radius-sm);
    color: var(--lc-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: #b4bfcd; }

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.14);
}

.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: #f3f5f8; color: var(--lc-muted); }
.form-control::placeholder { color: #98a2b3; }

/* Tamano compacto (form-control-sm / form-select-sm) */
.form-control-sm, .form-select-sm { font-size: 0.84rem; min-height: calc(1.5em + 0.7rem + 2px); }
.form-control-sm { padding: 0.35rem 0.7rem; border-radius: var(--lc-radius-sm); }

/* Select: flecha propia, mas espacio para el texto y opciones legibles */
.form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23667085' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='m4 6 4 4 4-4'/%3e%3c/svg%3e");
    background-size: 14px 14px;
    background-position: right 0.65rem center;
    padding-right: 2.1rem;
    cursor: pointer;
    text-overflow: ellipsis;
}

.form-select-sm { padding: 0.35rem 2rem 0.35rem 0.7rem; border-radius: var(--lc-radius-sm); }
.form-select:focus { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%230d6efd' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='m4 6 4 4 4-4'/%3e%3c/svg%3e"); }
.form-select option { padding: 0.35rem; }
.form-select option:checked { font-weight: 600; }

.input-group-text { background: #f8fafc; border-color: #d0d7e2; color: var(--lc-muted); }
.input-group-sm > .input-group-text { font-size: 0.84rem; padding: 0.35rem 0.6rem; }
.input-group > .form-control, .input-group > .btn { border-radius: 0 var(--lc-radius-sm) var(--lc-radius-sm) 0; }
.input-group > .form-control:not(:last-child) { border-radius: 0; }
.input-group-sm > .btn { padding: 0.3rem 0.6rem; }

/* Bloque de formulario en dos columnas: titulo/ayuda a la izquierda, campos a la derecha */
.form-seccion { padding: 1.4rem 0; border-top: 1px solid var(--lc-border); }
.form-seccion:first-of-type { border-top: 0; padding-top: 0.25rem; }
.form-seccion h2 { font-size: 0.98rem; font-weight: 600; margin-bottom: 0.25rem; }
.form-seccion .ayuda { font-size: 0.82rem; color: var(--lc-muted); margin-bottom: 0.75rem; }

.form-acciones {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 0.9rem 1.15rem;
    margin: 0 -1.15rem -1.15rem;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--lc-border);
    border-radius: 0 0 var(--lc-radius) var(--lc-radius);
}

.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-top: 0.1em; cursor: pointer; }
.form-switch .form-check-label { cursor: pointer; }
.opcion-switch { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.75rem 0.9rem; border: 1px solid var(--lc-border); border-radius: var(--lc-radius-sm); }
.opcion-switch .form-check-input { flex-shrink: 0; margin-left: 0; }
.opcion-switch .titulo { font-weight: 600; font-size: 0.88rem; }
.opcion-switch .detalle { font-size: 0.78rem; color: var(--lc-muted); }

/* Selector de color (radios con muestras) */
.selector-color { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.selector-color input { position: absolute; opacity: 0; pointer-events: none; }
.selector-color label {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #fff;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
    transition: transform 0.12s ease;
}

.selector-color label:hover { transform: translateY(-2px); }
.selector-color label i { opacity: 0; font-size: 1.1rem; }
.selector-color input:checked + label { border-color: var(--lc-text); }
.selector-color input:checked + label i { opacity: 1; }
.selector-color input:focus-visible + label { outline: 3px solid rgba(13, 110, 253, 0.4); outline-offset: 2px; }

/* Selector de icono */
.selector-icono { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 0.35rem; max-height: 196px; overflow-y: auto; padding: 0.5rem; border: 1px solid var(--lc-border); border-radius: var(--lc-radius-sm); background: #fbfcfe; }
.selector-icono button { height: 42px; border: 1px solid transparent; border-radius: 8px; background: none; font-size: 1.15rem; color: #344054; }
.selector-icono button:hover { background: #fff; border-color: var(--lc-border); }
.selector-icono button.activo { background: var(--lc-primary-soft); color: var(--lc-primary); border-color: rgba(13, 110, 253, 0.35); }

/* Vista previa en vivo (enlaces y categorias) */
.vista-previa { position: sticky; top: calc(var(--lc-topbar-height) + 1rem); }

/* Columna lateral con varias tarjetas (formulario de enlace): se fija como un
   bloque y solo si cabe en la pantalla; asi ninguna tarjeta se monta sobre otra. */
.lateral-fija .vista-previa { position: static; }
@media (min-width: 1200px) and (min-height: 820px) {
    .lateral-fija { position: sticky; top: calc(var(--lc-topbar-height) + 1rem); }
}
.vista-previa .etiqueta { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lc-muted); font-weight: 700; margin-bottom: 0.6rem; }

/* Medidor de contrasena */
.medidor { height: 4px; border-radius: 4px; background: #eef1f5; overflow: hidden; margin-top: 0.4rem; }
.medidor span { display: block; height: 100%; width: 0; transition: width 0.2s ease, background-color 0.2s ease; }

/* --------------------------------------------------------------- Inicio (Mis sistemas) */
.bienvenida {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--lc-radius) + 0.25rem);
    padding: clamp(1.25rem, 3vw, 2rem);
    margin-bottom: 1.5rem;
    color: #fff;
    background: radial-gradient(circle at 85% 20%, rgba(77, 148, 255, 0.45), transparent 45%),
                linear-gradient(135deg, var(--lc-sidebar) 0%, #164a7c 100%);
    box-shadow: var(--lc-shadow);
}

.bienvenida h1 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); font-weight: 700; margin: 0 0 0.25rem; }
.bienvenida p { margin: 0; color: rgba(255, 255, 255, 0.78); }
.bienvenida .buscador { max-width: 420px; margin-top: 1.1rem; }
.bienvenida .buscador .form-control { border: 0; padding-top: 0.65rem; padding-bottom: 0.65rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); }

.categoria-titulo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 1.6rem 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--lc-muted);
}

.categoria-titulo::after { content: ""; flex: 1; height: 1px; background: var(--lc-border); }

.enlace-tarjeta {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    height: 100%;
    padding: 1rem;
    border-radius: var(--lc-radius);
    background: var(--lc-surface);
    border: 1px solid var(--lc-border);
    box-shadow: var(--lc-shadow-sm);
    color: var(--lc-text);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.enlace-tarjeta:hover, .enlace-tarjeta:focus-visible {
    transform: translateY(-3px);
    box-shadow: var(--lc-shadow);
    border-color: #c7d2e0;
    color: var(--lc-text);
}

.enlace-tarjeta .icono-color { width: 46px; height: 46px; border-radius: 12px; font-size: 1.25rem; }
.enlace-tarjeta .nombre { font-weight: 600; line-height: 1.2; }
.enlace-tarjeta .subtitulo { font-size: 0.8rem; color: var(--lc-muted); }
.enlace-tarjeta .bi-arrow-up-right { margin-left: auto; color: #a3adbb; transition: color 0.15s ease, transform 0.15s ease; }
.enlace-tarjeta:hover .bi-arrow-up-right { color: var(--lc-primary); transform: translate(2px, -2px); }

/* --------------------------------------------------------------- Permisos */
.matriz th.rol, .matriz td.marca { text-align: center; min-width: 7.5rem; }
.matriz .form-check-input { width: 1.2em; height: 1.2em; cursor: pointer; }
.matriz tr.grupo td { background: #f8fafc; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--lc-muted); }
.matriz .sticky-col { position: sticky; left: 0; background: var(--lc-surface); z-index: 1; min-width: 220px; }
.matriz tr.grupo td.sticky-col { background: #f8fafc; }

.nav-pills-portal .nav-link { color: var(--lc-muted); font-weight: 600; border-radius: var(--lc-radius-sm); padding: 0.35rem 0.8rem; font-size: 0.84rem; }
.nav-pills-portal .nav-link.active { background: var(--lc-surface); color: var(--lc-primary); box-shadow: var(--lc-shadow-sm); }
.nav-pills-portal { background: #e9edf3; padding: 0.3rem; border-radius: calc(var(--lc-radius-sm) + 0.2rem); display: inline-flex; flex-wrap: wrap; }

/* --------------------------------------------------------------- Auditoria */
.detalle-auditoria > td { background: #f8fafc !important; padding: 0.75rem 1rem 1rem !important; }
.detalle-caja { background: var(--lc-surface); border: 1px solid var(--lc-border); border-radius: var(--lc-radius-sm); padding: 0.85rem 1rem; }
.detalle-titulo { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--lc-muted); margin-bottom: 0.6rem; }
.tabla-detalle > thead th { background: transparent; }
.tabla-detalle td { vertical-align: top; }
.valor-antes, .valor-despues { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 6px; word-break: break-word; }
.valor-antes { background: #fdecec; color: #912018; text-decoration: line-through; text-decoration-color: rgba(145, 32, 24, 0.45); }
.valor-despues { background: #e7f6ec; color: #085d3a; font-weight: 500; }
.lista-detalle { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.5rem 1.25rem; }
.lista-detalle dt { font-size: 0.72rem; font-weight: 600; color: var(--lc-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lista-detalle dd { margin: 0; font-size: 0.86rem; word-break: break-word; }
[aria-expanded="true"] > .bi-chevron-down { transform: rotate(180deg); display: inline-block; }

/* En pantallas angostas la tabla se desplaza: el detalle queda fijo a la izquierda y del ancho visible */
@media (max-width: 991.98px) {
    .detalle-auditoria .detalle-caja { position: sticky; left: 1rem; max-width: calc(100vw - 4rem); }
}

/* --------------------------------------------------------------- Avisos (toasts) */
.toast-container { z-index: 1090; }
.toast { border: 0; border-radius: var(--lc-radius); box-shadow: var(--lc-shadow); overflow: hidden; }
.toast .toast-body { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.85rem 1rem; font-size: 0.9rem; }
.toast .toast-body > i { font-size: 1.15rem; line-height: 1.2; }
.toast-success { border-left: 4px solid #12b76a; }
.toast-success .toast-body > i { color: #12b76a; }
.toast-danger { border-left: 4px solid #f04438; }
.toast-danger .toast-body > i { color: #f04438; }
.toast-warning { border-left: 4px solid #f79009; }
.toast-warning .toast-body > i { color: #f79009; }
.toast-info { border-left: 4px solid var(--lc-primary); }
.toast-info .toast-body > i { color: var(--lc-primary); }

/* --------------------------------------------------------------- Modal de sesion */
.modal-content { border: 0; border-radius: calc(var(--lc-radius) + 0.15rem); box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25); }
.sesion-reloj {
    width: 96px;
    height: 96px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(#f79009 calc(var(--p, 100) * 1%), #fdecc8 0);
}

.sesion-reloj span {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- Login */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--lc-surface); }

.auth-marca {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 5vw, 3.5rem);
    color: #fff;
    background: radial-gradient(circle at 80% 10%, rgba(77, 148, 255, 0.4), transparent 40%),
                radial-gradient(circle at 10% 90%, rgba(46, 163, 220, 0.3), transparent 45%),
                linear-gradient(150deg, var(--lc-sidebar) 0%, #123f6b 100%);
}

.auth-marca .logo-chip { display: inline-flex; padding: 0.7rem 1rem; background: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); }
.auth-marca .logo-chip img { height: 46px; width: auto; }
.auth-marca h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700; line-height: 1.15; margin: 2.5rem 0 0.75rem; letter-spacing: -0.02em; }
.auth-marca p { color: rgba(255, 255, 255, 0.78); max-width: 34rem; }
.auth-marca ul { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 0.8rem; }
.auth-marca li { display: flex; gap: 0.7rem; align-items: center; color: rgba(255, 255, 255, 0.9); }
.auth-marca li i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); }
.auth-marca .pie { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }

.auth-form-wrap { display: grid; place-items: center; padding: clamp(1.5rem, 5vw, 3rem); }
.auth-form { width: 100%; max-width: 400px; animation: lcAparecer 0.35s ease; }
.auth-form h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.auth-form .btn-primary { padding: 0.45rem; font-weight: 600; border-radius: var(--lc-radius-sm); }
.auth-logo-movil { display: none; height: 44px; margin-bottom: 1.5rem; }

/* --------------------------------------------------------------- Paginas de error */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; text-align: center; background: var(--lc-bg); }
.error-page .codigo { font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; line-height: 1; letter-spacing: -0.04em; background: linear-gradient(135deg, var(--lc-sidebar), var(--lc-primary)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 991.98px) {
    .topbar-titulo { font-size: 0.95rem; }
}

@media (max-width: 767.98px) {
    .page-header h1 { font-size: 1.2rem; }
    .page-header .icono { width: 42px; height: 42px; font-size: 1.15rem; }
    .page-header .acciones-pagina { width: 100%; }
    .page-header .acciones-pagina .btn { width: 100%; }
    .buscador { max-width: none; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-marca { display: none; }
    .auth-logo-movil { display: block; }
    .form-acciones .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- Colores extra
   Bootstrap solo trae primary/info/success/warning/danger/secondary/dark. Estos
   completan la paleta de categorias y enlaces (ver Ui::COLORES); son tonos con
   buen contraste para el icono blanco. */
.bg-navy   { background-color: #0b2e4f !important; }
.bg-indigo { background-color: #5b21b6 !important; }
.bg-teal   { background-color: #0d9488 !important; }
.bg-lime   { background-color: #4d7c0f !important; }
.bg-orange { background-color: #ea580c !important; }
.bg-pink   { background-color: #db2777 !important; }
.bg-purple { background-color: #9333ea !important; }
.bg-brown  { background-color: #8b5a3c !important; }

/* --------------------------------------------------------------- Utilidades */
.min-w-0 { min-width: 0; }
.chip.text-bg-dark { color: #fff !important; }
.nav-tabs .nav-link { color: var(--lc-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; padding: 0.45rem 0.8rem; font-size: 0.84rem; }
.nav-tabs .nav-link.active { color: var(--lc-primary); border-bottom-color: var(--lc-primary); background: none; }
.nav-tabs { border-bottom: 1px solid var(--lc-border); }
