* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* ============================================================
   SISTEMA DE TOOLTIPS DE AYUDA
   ============================================================ */

/* Contenedor inline que agrupa el título + el ícono ? */
.help-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* Ícono de ayuda */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: help;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.help-icon:hover {
    background: #E2001A;
    color: #fff;
}

/* Globo del tooltip */
.help-icon::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #f9fafb;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    width: max-content;
    max-width: 240px;
    white-space: normal;
    text-align: left;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Flechita del tooltip */
.help-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
}

.help-icon:hover::after,
.help-icon:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Variante hacia abajo (cuando el tooltip está cerca del borde superior) */
.help-icon.tip-down::after {
    bottom: auto;
    top: calc(100% + 8px);
}
.help-icon.tip-down::before {
    bottom: auto;
    top: calc(100% + 3px);
    border-top-color: transparent;
    border-bottom-color: #1f2937;
}


body {
    background: #f5f5f5;
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.5;
}

/* Main Header */
.main-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    width: 160px;
    height: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-logout {
    background: #E2001A;
    color: white;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-logout:hover {
    background: #c7001a;
}

.user-icon {
    width: 36px;
    height: 36px;
    background: #111827;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 2rem;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
    border-bottom: 1px solid #e5e7eb;
}

.nav-tab {
    padding: 1rem 0;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: #111827;
}

.nav-tab.active {
    color: #E2001A;
    border-bottom-color: #E2001A;
}

/* Content Wrapper */
.content-wrapper {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.breadcrumb {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: #6b7280;
    text-decoration: none;
    cursor: pointer;
}

.breadcrumb a:hover {
    color: #111827;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 0.9375rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Título de sección secundaria dentro de la página */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1.5rem;
}

/* Cards */
.content-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Module Visibility */
.module-content {
    display: none;
}

.module-content.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: #111827;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #374151;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

/* Buttons */
.btn-primary {
    background: #E2001A;
    color: white;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #c7001a;
}

.btn-action {
    background: none;
    border: none;
    color: #E2001A;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
}

.btn-action:hover {
    text-decoration: underline;
}

/* User Avatars */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #fee2e2;
    color: #991b1b;
}

.badge-editor {
    background: #dbeafe;
    color: #1e40af;
}

.badge-viewer {
    background: #f3f4f6;
    color: #4b5563;
}

/* Status */
.status-active {
    color: #16a34a;
    font-weight: 600;
}

.status-inactive {
    color: #6b7280;
    font-weight: 600;
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.search-bar .material-symbols-outlined {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.25rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-buttons button {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    transition: all 0.2s;
}

.pagination-buttons button:hover {
    background: #f9fafb;
}

.pagination-buttons button.active {
    background: #E2001A;
    color: white;
    border-color: #E2001A;
    font-weight: 600;
}

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid #e5e7eb;
    margin-top: 3rem;
    padding: 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-logo {
    width: 140px;
    height: auto;
}

.footer-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.footer-text {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.625;
    max-width: 18.75rem; /* 300px */
    text-align: left;
}

@media (max-width: 768px){
    .footer-text {
        font-size: 16px;
        text-align: center;
        line-height: 16px;
    }

    .text-gray-500{
        text-align: center;
    }

    .footer-title{
        text-align: center;
    }

    .h-7 {margin: auto;}

    .footer-links {
        align-items: center;
    }

    .footer-links a {
        justify-content: center;
    }

    .page-title {
        font-size: 1.5rem;
        text-align: center;
    }

    .section-title{text-align: center;}

    .page-subtitle{text-align: center;}
    .dash-label{text-align: center;}
    .dash-valor{text-align: center;}
}

/*--------------------------------------------------------------------------*/

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #E2001A;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.footer-links-bottom {
    display: flex;
    gap: 2rem;
}

.footer-links-bottom a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links-bottom a:hover {
    color: #E2001A;
}

/* Responsive */
@media (max-width: 768px) {
    .header-top,
    .nav-tabs,
    .content-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ============================================================
   BARRA DE TÍTULO DE PÁGINA
   ============================================================ */

/* Franja blanca con borde inferior — encabezado de cada página */
.barra-titulo {
    background: white;
    border-bottom: 1px solid #f3f4f6;
}

.barra-titulo-inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.25rem 1rem;
}

@media (min-width: 640px) {
    .barra-titulo-inner {
        padding: 2rem;
    }
}

/* Variante con botón de acción a la derecha */
.barra-titulo-inner.row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 640px) {
    .barra-titulo-inner.row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

/* ============================================================
   CONTENEDOR DE CONTENIDO DE PÁGINA
   ============================================================ */

.contenido-pagina {
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
    .contenido-pagina {
        padding: 2.5rem 2rem;
    }
}

/* Variante estrecha para formularios */
.contenido-pagina--angosto {
    max-width: 56rem;
}

/* ============================================================
   COLORES DE TEXTO UTILITARIOS
   ============================================================ */

.clr-dark    { color: #111827; }
.clr-success { color: #16a34a; }
.clr-warning { color: #eab308; }
.clr-muted   { color: #9ca3af; }

/* ============================================================
   CABECERAS DE TABLA
   ============================================================ */

.tabla-th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tabla-th--right {
    text-align: right;
}

/* ============================================================
   FORMULARIOS — etiquetas, campos y notas
   ============================================================ */

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: white;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    color: #374151;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #e30613;
    box-shadow: 0 0 0 3px rgb(227 6 19 / 0.15);
}

.form-input--mono {
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

.form-textarea {
    resize: none;
}

.form-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

.form-hint--success {
    color: #16a34a;
}

/* ============================================================
   TARJETAS INFORMATIVAS (info-cards)
   ============================================================ */

.info-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
}

.info-card-text {
    font-size: 0.75rem;
    color: #4b5563;
}

/* ============================================================
   CLASES UTILITARIAS — LAMET-TRACE
   ============================================================ */

/* Color corporativo rojo */
.clr-danger         { color: #e30613; }
.clr-danger:hover   { color: #c40510; }

/* Fondo corporativo rojo */
.bg-brand           { background-color: #e30613; }
.bg-brand:hover     { background-color: #c40510; }

/* Tamaños de iconos (Material Symbols) */
.icon-18 { font-size: 18px; }
.icon-20 { font-size: 20px; }
.icon-22 { font-size: 22px; }
.icon-24 { font-size: 24px; }
.icon-28 { font-size: 28px; }
.icon-64 { font-size: 64px; }

/* Contenedores con border-radius de 24px */
.rounded-card { border-radius: 24px; }

/* Cuerpo de tabla principal */
.tabla-body { font-size: 0.75rem; line-height: 0.8125rem; }

/* Paginación — botón página activa */
.pag-activo { background-color: #e30613; color: white; }

/* ============================================================
   TARJETAS DE ESTADÍSTICAS — compartidas entre páginas
   ============================================================ */

/* Etiqueta de la stat card */
.card-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    text-align: center;
}

/* Cuando card-label lleva el ícono de ayuda, forzar flex centrado */
.card-label.help-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Número principal de la stat card */
.card-valor {
    font-size: 1.875rem;
    font-weight: 700;
    text-align: center;
}

/* ============================================================
   MODALES — base scrollable (compartido entre páginas)
   Cada página puede sobreescribir con su selector específico.
   ============================================================ */

.equipo-modal-content,
.cert-modal-content,
.usr-modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

/* Header del modal: no se mueve al hacer scroll */
.equipo-modal-content > div:first-child,
.cert-modal-content   > div:first-child,
.usr-modal-content    > div:first-child {
    flex-shrink: 0;
}

/* Formulario: scroll interno si el contenido no cabe */
.equipo-modal-content > form,
.cert-modal-content   > form,
.usr-modal-content    > form {
    overflow-y: auto;
    flex: 1 1 auto;
}

/* Responsivo móvil: el overlay hace scroll, no el contenedor */
@media (max-width: 640px) {
    #modalEquipo,
    #modalCert,
    #modalUsuario {
        align-items: flex-start;
        overflow-y: auto;
        padding: 1.25rem 0;
    }

    #modalEquipo > div:first-child,
    #modalCert   > div:first-child,
    #modalUsuario > div:first-child {
        position: fixed;
    }

    .equipo-modal-content,
    .cert-modal-content,
    .usr-modal-content {
        max-height: none;
        overflow: visible;
        border-radius: 1.25rem;
        margin: 0 1rem;
        width: calc(100% - 2rem);
        max-width: 100%;
    }

    .equipo-modal-content > form,
    .cert-modal-content   > form,
    .usr-modal-content    > form {
        overflow-y: visible;
        padding: 1.25rem;
    }

    .equipo-modal-content > div:first-child,
    .cert-modal-content   > div:first-child,
    .usr-modal-content    > div:first-child {
        padding: 1.25rem;
        align-items: flex-start;
    }
}
