/* Estilos personalizados para un mejor aspecto */
body {
    font-family: 'Inter', sans-serif;
}

body.local-training-mode #user-management-tab,
body.local-training-mode #profile-change-password,
body.local-training-mode #client-assignment-section { display: none !important; }
.auth-recovery-action { min-height: 44px; padding: 0.6rem 0.9rem; border: 1px solid var(--ui-primary); border-radius: 0.375rem; background: transparent; color: var(--ui-primary); font: inherit; font-weight: 600; cursor: pointer; }
.auth-recovery-action:hover { background: var(--ui-primary); color: #fff; }
.auth-recovery-action[hidden] { display: none; }

:focus-visible { outline: 2px solid #302f69; outline-offset: 3px; }
button { touch-action: manipulation; }
.skip-link { position: absolute; left: 1rem; top: -5rem; background: white; padding: 0.75rem; z-index: 100; }
.skip-link:focus { top: 1rem; }
td { font-variant-numeric: tabular-nums; }
select { background-color: white; color: #1f2937; }
#standards-management-list > div, #user-list > div, #client-list > div { content-visibility: auto; contain-intrinsic-size: auto 96px; }
[role="dialog"] { overscroll-behavior: contain; padding: 1rem; }
@media (max-width: 480px) {
    select[id*="month"], select[id*="year"] { font-size: 0.875rem; padding-left: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.tab-button.active {
    border-bottom-color: #302f69;
    color: #302f69;
    font-weight: 600;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Animación suave para la aparición de elementos */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Estilo para comportamientos marcados como N/A */
.behavior-na .behavior-label {
    text-decoration: line-through;
    color: #9ca3af; /* gray-400 */
}

/* Marca con una X los comportamientos seleccionados como no cumplidos */
.behavior-unmet-checkbox {
    -webkit-appearance: none;
    appearance: none;
    display: inline-grid;
    flex: 0 0 auto;
    place-content: center;
    width: 1rem;
    height: 1rem;
    padding: 0;
    color: #111827;
    background-color: #fff;
    background-image: none;
    border: 1px solid #6b7280;
    border-radius: 0.125rem;
    cursor: pointer;
}

.behavior-unmet-checkbox:checked {
    color: #111827;
    background-color: #fff;
    background-image: none;
    border-color: #6b7280;
}

.behavior-unmet-checkbox::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    background-image:
        linear-gradient(45deg, transparent 42%, currentColor 43%, currentColor 57%, transparent 58%),
        linear-gradient(-45deg, transparent 42%, currentColor 43%, currentColor 57%, transparent 58%);
    transform: scale(0);
}

.behavior-unmet-checkbox:checked::after {
    transform: scale(1);
}

.behavior-unmet-checkbox:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.behavior-unmet-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Evita doble flecha en los campos con datalist del formulario */
#employee-name::-webkit-calendar-picker-indicator,
#branch-name::-webkit-calendar-picker-indicator,
#area-name::-webkit-calendar-picker-indicator,
#analysis-type::-webkit-calendar-picker-indicator {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Fuerza una sola flecha (la personalizada con SVG) en los mini-selects */
#employee-select,
#branch-select,
#area-select,
#analysis-type-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
}

#employee-select::-ms-expand,
#branch-select::-ms-expand,
#area-select::-ms-expand,
#analysis-type-select::-ms-expand {
    display: none;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Navegación por pestañas: scroll horizontal en móvil */
.tabs-nav-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.tabs-nav-container::-webkit-scrollbar {
    height: 4px;
}

.tabs-nav-container::-webkit-scrollbar-track {
    background: transparent;
}

.tabs-nav-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.tabs-nav-container nav {
    min-width: max-content;
}

/* Tabs: mejor aspecto táctil en móvil */
@media (max-width: 768px) {
    .tab-button {
        font-size: 0.8rem;
        padding: 0.65rem 0.75rem !important;
        white-space: nowrap;
    }
}

/* Header responsive */
@media (max-width: 640px) {
    /* Botones de exportación en columna */
    .export-buttons-row {
        flex-direction: column;
        align-items: stretch;
    }

    .export-buttons-row h2 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .export-buttons-row .flex {
        justify-content: flex-start;
    }

}

/* Tablas responsive: fuente más pequeña en móvil */
@media (max-width: 640px) {
    table th,
    table td {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Filtros: mejorar layout en móvil */
@media (max-width: 480px) {
    .filter-grid {
        grid-template-columns: 1fr !important;
    }
}

/* El panel se desplaza dentro del diálogo incluso con poca altura disponible. */
[role="dialog"] > div {
    min-width: 0;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}

/* ==========================================
   RESPONSIVE AVANZADO
   ========================================== */

/* Charts: reducir altura máxima en móvil para no dominar la pantalla */
@media (max-width: 640px) {
    .chart-container {
        max-height: 380px !important;
        overflow-x: auto;
    }
}

/* Export button rows: stack vertical en móvil */
@media (max-width: 640px) {
    .export-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    .export-row .flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Standard form radios: wrap en pantallas pequeñas */
@media (max-width: 540px) {
    .standard-score-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .standard-score-options {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Management item buttons: wrap en móvil */
@media (max-width: 600px) {
    .management-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .management-item-buttons {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* Compliance threshold: wrap en móvil */
@media (max-width: 640px) {
    .compliance-threshold-row {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .compliance-threshold-row span {
        flex-basis: 100%;
    }
}

/* User / client list items: wrap en móvil */
@media (max-width: 480px) {
    .list-item-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .list-item-row .item-actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
}

/* Sección de estándares: botones en fila que envuelve */
@media (max-width: 480px) {
    .standards-actions-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .standards-actions-row input[type="text"] {
        width: 100%;
        flex: none;
    }
}

/* ==========================================
   SISTEMA VISUAL · EMPRESA EN LÍNEA
   Interfaz serena para seguimiento operativo
   ========================================== */

:root {
    color-scheme: light;
    --ui-canvas: #f5f5f8;
    --ui-surface: #ffffff;
    --ui-surface-muted: #f8f8fb;
    --ui-ink: #2b2b3c;
    --ui-muted: #626477;
    --ui-border: #dedee8;
    --ui-primary: #302f69;
    --ui-primary-fill: #302f69;
    --ui-primary-hover-fill: #242451;
    --ui-primary-contrast: #302f69;
    --ui-primary-hover: #242451;
    --ui-primary-soft: #f0f0f7;
    --ui-accent: #666891;
    --ui-accent-ink: #44456f;
    --ui-danger: #9a453d;
    --ui-shadow: 0 8px 24px rgba(39, 39, 88, 0.055), 0 1px 3px rgba(39, 39, 88, 0.04);
}

/* Notificaciones REID: mensajes breves, claros y de baja intensidad visual. */
.tk[data-theme="reid"] {
    --tk-bg: var(--ui-surface);
    --tk-fg: var(--ui-ink);
    --tk-muted: var(--ui-muted);
    --tk-border: var(--ui-border);
    --tk-shadow: 0 12px 30px rgba(39, 39, 88, 0.12), 0 1px 3px rgba(39, 39, 88, 0.06);
    --tk-radius: 0.65rem;
    --tk-width: 25rem;
    --tk-gap: 0.6rem;
    --tk-inset: 1rem;
    --tk-font: 'Inter', sans-serif;
    --tk-size: 0.9rem;
    --tk-success: #4d654f;
    --tk-error: #963e45;
    --tk-warning: #82612a;
    --tk-info: var(--ui-primary);
    --tk-accent: var(--ui-primary);
    --tk-action-bg: var(--ui-primary);
    --tk-action-fg: #ffffff;
    --tk-z: 60;
    --tk-duration: 0.18s;
    --tk-exit: 0.12s;
    --tk-stack-offset: 0.5rem;
    --tk-stack-scale: 0.025;
}

.tk[data-theme="reid"] .tk-toast {
    min-width: 0;
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
}

.tk[data-theme="reid"] .tk-close {
    width: 44px;
    height: 44px;
    margin-left: 0.1rem;
}

.tk[data-theme="reid"][data-position^="bottom"] {
    bottom: max(var(--tk-inset), env(safe-area-inset-bottom));
}

.tk[data-theme="reid"][data-position$="right"] {
    right: max(var(--tk-inset), env(safe-area-inset-right));
}

body {
    background-color: var(--ui-canvas);
    color: var(--ui-ink);
    font-family: 'Inter', sans-serif;
    line-height: 1.55;
}

body.bg-gray-100,
#loading-view,
#auth-view {
    background-color: var(--ui-canvas);
}

#loading-view .border-blue-600 {
    border-color: var(--ui-primary);
}

.loading-brand-logo {
    display: block;
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    object-fit: contain;
}

:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
}

#main-dashboard.container {
    max-width: none;
    padding-top: 1.75rem;
    padding-bottom: 2rem;
}

.dashboard-header {
    margin-bottom: 1.1rem;
    padding: 0.45rem 0 1.1rem;
    border-bottom: 1px solid var(--ui-border);
}

.dashboard-header-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
}

.dashboard-brand-row {
    display: flex;
    flex: 0 0 auto;
    max-width: 100%;
    min-width: 0;
    align-items: center;
    gap: 1.1rem;
}

.dashboard-brand-logo {
    width: min(100%, 18rem);
    height: auto;
    flex: 0 0 auto;
    object-fit: contain;
}

.dashboard-heading-divider {
    width: 1px;
    height: 2.1rem;
    flex: 0 0 1px;
    background: var(--ui-border);
}

.dashboard-title {
    min-width: 0;
    margin: 0;
    color: var(--ui-ink);
    font-size: clamp(1.2rem, 1.65vw, 1.5rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
    text-wrap: balance;
}

.dashboard-session-row {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem 1rem;
}

.dashboard-welcome {
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.88rem;
    white-space: normal;
    min-width: 0;
    overflow-wrap: anywhere;
}

#user-greeting {
    color: var(--ui-ink);
    font-weight: 600;
}

#active-client-indicator {
    display: grid;
    flex: 0 0 auto;
    min-width: 0;
    max-width: min(26rem, 35vw);
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.2rem 0.75rem;
    border: 1px solid var(--ui-primary);
    border-left: 4px solid var(--ui-primary-hover);
    background-color: var(--ui-primary-fill);
    border-radius: 0.55rem;
    box-shadow: 0 4px 14px rgba(48, 47, 105, 0.14);
    padding: 0.5rem 0.55rem 0.5rem 0.8rem;
    color: #ffffff;
    font-size: 0.9rem;
}

#active-client-indicator.hidden {
    display: none;
}

#active-client-indicator:not(.hidden) {
    display: grid;
}

.dashboard-client-copy {
    display: grid;
    min-width: 0;
    gap: 0.12rem;
}

.dashboard-client-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    line-height: 1.3;
    text-transform: uppercase;
    white-space: nowrap;
}

.dashboard-client-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

#active-client-name {
    display: block;
    min-width: 0;
    color: #ffffff;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

#change-client-btn {
    grid-column: 2;
    grid-row: 1;
    min-height: 44px;
    margin: 0;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 0.45rem;
    background: #ffffff;
    color: var(--ui-primary);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

#change-client-btn:hover {
    border-color: #ffffff;
    background: #e9e8f2;
}

#change-client-btn:focus-visible,
#logout-btn:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
}

#client-selector-modal {
    background-color: rgba(25, 26, 42, 0.64);
    backdrop-filter: blur(2px);
}

#client-selector-modal .client-selector-panel {
    width: 100%;
    max-width: 31rem;
    max-height: min(88vh, 44rem);
    overflow-y: auto;
    padding: 1.55rem;
    border: 1px solid var(--ui-border);
    border-top: 4px solid var(--ui-primary);
    border-radius: 0.65rem;
    background: var(--ui-surface);
    box-shadow: 0 24px 64px rgba(20, 20, 40, 0.24);
    overscroll-behavior: contain;
}

.client-selector-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--ui-border);
}

.client-selector-brand img {
    width: min(11.25rem, 58%);
    height: auto;
    flex: 0 1 auto;
}

.client-selector-brand span {
    padding-left: 0.75rem;
    border-left: 1px solid var(--ui-border);
    color: var(--ui-muted);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.045em;
    line-height: 1.4;
    text-transform: uppercase;
}

.client-selector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
}

.client-selector-eyebrow {
    margin: 0 0 0.3rem;
    color: var(--ui-primary);
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    line-height: 1.3;
    text-transform: uppercase;
}

#client-selector-title {
    margin: 0;
    color: var(--ui-ink);
    font-size: clamp(1.35rem, 3.5vw, 1.6rem);
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.25;
    text-wrap: balance;
}

.client-selector-close {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
    background: var(--ui-surface);
    color: var(--ui-muted);
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.client-selector-close svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.7;
}

.client-selector-close:hover {
    border-color: var(--ui-primary);
    background: var(--ui-primary-soft);
    color: var(--ui-primary);
}

.client-selector-close:focus-visible,
.client-selector-logout:focus-visible,
.client-option-btn:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
}

.client-selector-intro {
    margin: 0 0 1.2rem;
    color: var(--ui-muted);
    font-size: 0.94rem;
    line-height: 1.55;
}

.client-selector-list-heading {
    margin: 0;
    padding-bottom: 0.55rem;
    color: var(--ui-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
}

.client-selector-options {
    display: grid;
    max-height: min(24rem, 42vh);
    gap: 0;
    overflow-y: auto;
    margin: 0 0 1.2rem;
    padding: 0;
    border-block: 1px solid var(--ui-border);
    overscroll-behavior: contain;
}

.client-option-btn {
    display: flex;
    width: 100%;
    min-height: 4.75rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 0.75rem;
    border: 0;
    border-bottom: 1px solid var(--ui-border);
    border-radius: 0;
    background: transparent;
    color: var(--ui-ink);
    text-align: left;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.client-option-btn:hover {
    background: var(--ui-primary-soft);
}

.client-option-btn:last-child {
    border-bottom: 0;
}

.client-option-btn.is-active {
    padding-left: calc(0.75rem - 2px);
    border-bottom: 1px solid var(--ui-border);
    border-left-width: 3px;
    background: var(--ui-primary-soft);
    box-shadow: none;
}

.client-option-btn.is-active:hover {
    background: #e8e8f2;
}

.client-option-copy {
    display: grid;
    min-width: 0;
    gap: 0.22rem;
}

.client-option-name {
    color: var(--ui-ink);
    font-size: 0.96rem;
    font-weight: 650;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.client-option-btn.is-active .client-option-name {
    color: var(--ui-primary);
}

.client-option-description {
    color: var(--ui-muted);
    font-size: 0.84rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.client-option-status {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.3rem;
    padding: 0.36rem 0.5rem;
    border-radius: 0.3rem;
    background: var(--ui-primary-fill);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.client-option-action {
    flex: 0 0 auto;
    color: var(--ui-primary);
    font-size: 0.79rem;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(48, 47, 105, 0.35);
    text-underline-offset: 0.2rem;
    white-space: nowrap;
}

.client-option-status svg {
    width: 0.9rem;
    height: 0.9rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.client-selector-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ui-border);
}

.client-selector-help {
    flex: 1 1 12rem;
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.client-selector-logout {
    min-height: 44px;
    flex: 0 0 auto;
    padding: 0.45rem 0.55rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: var(--ui-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 0.2rem;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
}

.client-selector-logout:hover {
    background: var(--ui-primary-soft);
    color: var(--ui-primary);
}

.client-selector-options > .client-selector-empty {
    padding: 1.25rem;
    border: 1px dashed var(--ui-border);
    border-radius: 0.6rem;
    color: var(--ui-muted);
    text-align: center;
}

.client-selector-empty .client-selector-create {
    min-height: 44px;
    border-radius: 0.45rem;
    background: var(--ui-primary-fill);
    color: white;
    font-weight: 600;
}

.client-selector-empty .client-selector-create:hover {
    background: var(--ui-primary-hover-fill);
}

#logout-btn {
    min-height: 40px;
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
    background: var(--ui-surface);
    box-shadow: none;
    color: var(--ui-ink);
    font-weight: 500;
    padding: 0.45rem 0.75rem;
    white-space: nowrap;
    transition: background-color 140ms ease, border-color 140ms ease;
}

#logout-btn:hover {
    background: var(--ui-surface-muted);
    border-color: #c7c7d6;
}

.tabs-nav-container {
    overflow: visible;
    border: 1px solid var(--ui-border);
    border-radius: 0.8rem;
    background: var(--ui-surface);
    box-shadow: 0 1px 2px rgba(35, 49, 54, 0.035);
    padding: 0.35rem;
    scrollbar-color: #bcc7c3 transparent;
}

.tabs-nav-container nav {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
}

.tabs-nav-container nav > .tab-button {
    min-height: 42px;
    margin-left: 0;
    border: 0;
    border-radius: 0.55rem;
    padding: 0.6rem 0.7rem !important;
    color: var(--ui-muted);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.tabs-nav-container nav > .tab-button:hover:not(.active) {
    background-color: var(--ui-surface-muted);
    color: var(--ui-ink);
}

.tab-button.active {
    border-bottom-color: transparent;
    background-color: var(--ui-primary-soft);
    box-shadow: inset 0 -2px var(--ui-accent);
    color: var(--ui-primary);
    font-weight: 600;
}

.tabs-nav-container nav > [data-view="client-management"] {
    margin-left: auto !important;
    border-left: 1px solid var(--ui-border);
    border-radius: 0;
    padding-left: 1rem !important;
}

#dashboard-content {
    scroll-margin-top: 1rem;
}

#dashboard-content .view > .bg-white {
    border: 1px solid var(--ui-border);
    border-radius: 0.9rem;
    box-shadow: var(--ui-shadow);
}

#dashboard-content .view > .bg-white h2,
#dashboard-content .view > .bg-white h3 {
    color: var(--ui-ink);
    text-wrap: balance;
}

#dashboard-content [class~="bg-gray-50"] {
    background-color: var(--ui-surface-muted);
}

#dashboard-content [class~="bg-blue-50"],
#dashboard-content [class~="bg-blue-100"] {
    background-color: var(--ui-primary-soft);
}

#dashboard-content [class~="border-blue-200"],
#dashboard-content [class~="border-blue-300"],
#dashboard-content [class~="border-blue-400"] {
    border-color: #dedeee;
}

#dashboard-content [class~="text-blue-400"],
#dashboard-content [class~="text-blue-500"],
#dashboard-content [class~="text-blue-600"],
#dashboard-content [class~="text-blue-700"],
#dashboard-content [class~="text-blue-800"],
#dashboard-content [class~="text-blue-900"] {
    color: var(--ui-primary);
}

#dashboard-content button,
#auth-view button {
    min-height: 40px;
    border-radius: 0.55rem;
    font-weight: 500;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

#dashboard-content button.bg-blue-600,
#dashboard-content button.bg-blue-500,
#dashboard-content button.bg-green-600,
#auth-button {
    border: 1px solid var(--ui-primary);
    background-color: var(--ui-primary-fill);
    box-shadow: 0 1px 2px rgba(35, 49, 54, 0.08);
    color: #ffffff;
}

#dashboard-content button.bg-blue-600:hover,
#dashboard-content button.bg-blue-500:hover,
#dashboard-content button.bg-green-600:hover,
#auth-button:hover:not(:disabled) {
    border-color: var(--ui-primary-hover);
    background-color: var(--ui-primary-hover-fill);
}

#dashboard-content button[id^="export-"] {
    min-height: 40px;
    border: 1px solid var(--ui-border);
    background: var(--ui-surface);
    box-shadow: none;
    color: var(--ui-primary);
}

#dashboard-content button[id^="export-"]:hover {
    border-color: #c2c2db;
    background: var(--ui-surface-muted);
}

#dashboard-content input:not([type="radio"]):not([type="checkbox"]),
#dashboard-content textarea,
#dashboard-content select,
#auth-view input {
    min-width: 0;
    border-color: var(--ui-border);
    border-radius: 0.55rem;
    background-color: var(--ui-surface);
    color: var(--ui-ink);
    box-shadow: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

#dashboard-content input:focus,
#dashboard-content textarea:focus,
#dashboard-content select:focus,
#auth-view input:focus {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px rgba(48, 47, 105, 0.14);
}

/* Listas editables del formulario de registro */
#dashboard-content .reid-combobox {
    position: relative;
    min-width: 0;
}

#dashboard-content .reid-combobox.is-open {
    z-index: 40;
}

#dashboard-content .reid-combobox-controls {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    min-width: 0;
}

#dashboard-content .reid-combobox-input {
    min-height: 44px;
    flex: 1 1 auto;
    width: 1%;
    padding-right: 0.8rem;
}

#dashboard-content .reid-combobox-input:focus:not(:focus-visible) {
    border-color: var(--ui-border);
    box-shadow: none;
}

#dashboard-content .reid-combobox-input:focus-visible {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 3px rgba(48, 47, 105, 0.14);
}

#dashboard-content .reid-combobox-toggle {
    display: inline-grid;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    place-items: center;
    border: 1px solid var(--ui-border);
    border-radius: 0.55rem;
    background: var(--ui-surface);
    color: var(--ui-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#dashboard-content .reid-combobox-toggle:hover {
    border-color: #c2c2db;
    background: var(--ui-surface-muted);
    color: var(--ui-primary);
}

#dashboard-content .reid-combobox-toggle:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
}

#dashboard-content .reid-combobox-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    transition: transform 150ms ease;
}

#dashboard-content .reid-combobox.is-open .reid-combobox-toggle svg {
    transform: rotate(180deg);
}

#dashboard-content .reid-combobox-menu {
    position: relative;
    margin-top: 0.4rem;
    width: 100%;
    max-width: calc(100vw - 2rem);
    max-height: min(18rem, 45vh);
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface);
    box-shadow: 0 10px 26px rgba(27, 31, 54, 0.13), 0 2px 5px rgba(27, 31, 54, 0.06);
}

#dashboard-content .reid-combobox-menu[hidden],
#dashboard-content .reid-combobox-source[hidden] {
    display: none;
}

#dashboard-content .reid-combobox-menu-heading {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid #ececf2;
    padding: 0.55rem 0.8rem;
    color: var(--ui-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.015em;
}

#dashboard-content .reid-combobox-count {
    flex: 0 0 auto;
    color: var(--ui-muted);
    font-size: 0.7rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

#dashboard-content .reid-combobox-options {
    max-height: min(14rem, 37vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.25rem;
    scrollbar-color: #c5c5d7 transparent;
    scrollbar-width: thin;
}

#dashboard-content .reid-combobox-option {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-left: 2px solid transparent;
    border-radius: 0.35rem;
    padding: 0.55rem 0.65rem;
    color: var(--ui-ink);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    font-size: 0.9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

#dashboard-content .reid-combobox-option:hover,
#dashboard-content .reid-combobox-option[aria-selected="true"] {
    border-left-color: var(--ui-primary);
    background: #f4f4fa;
}

#dashboard-content .reid-combobox-option:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: -2px;
}

#dashboard-content .reid-combobox-option-check {
    flex: 0 0 auto;
    color: var(--ui-primary);
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0;
}

#dashboard-content .reid-combobox-option[data-current="true"] .reid-combobox-option-check {
    opacity: 1;
}

#dashboard-content .reid-combobox-empty {
    margin: 0;
    padding: 0.85rem;
    color: var(--ui-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
    #dashboard-content .reid-combobox-toggle,
    #dashboard-content .reid-combobox-toggle svg,
    #dashboard-content .reid-combobox-option {
        transition: none;
    }
}

#dashboard-content label {
    color: var(--ui-ink);
    font-weight: 500;
}

#dashboard-content input[type="checkbox"],
#dashboard-content input[type="radio"] {
    accent-color: var(--ui-primary);
}

#dashboard-content .filter-grid > div {
    min-width: 0;
}

@media (min-width: 1440px) {
    #dashboard-content .filter-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(20rem, 1.25fr);
    }
}

@media (min-width: 768px) and (max-width: 1439px) {
    #dashboard-content .filter-grid .filter-month-year {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    #dashboard-content .filter-month-year-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

#dashboard-content .filter-grid select[id*="month"],
#dashboard-content .filter-grid select[id*="year"] {
    padding-left: 0.55rem;
    padding-right: 0.35rem;
    font-size: 0.82rem;
}

#dashboard-content [class~="bg-red-50"] {
    background-color: #faf4f2;
}

#dashboard-content [class~="bg-red-100"] {
    background-color: #f4e8e5;
}

#dashboard-content [class~="text-red-500"],
#dashboard-content [class~="text-red-600"],
#dashboard-content [class~="text-red-700"],
#dashboard-content [class~="text-red-800"] {
    color: var(--ui-danger);
}

#dashboard-content [class~="text-green-500"],
#dashboard-content [class~="text-green-600"],
#dashboard-content [class~="text-green-700"] {
    color: #456a53;
}

#dashboard-content [class~="bg-green-50"] {
    background-color: #f2f6f2;
}

#dashboard-content [class~="bg-green-100"] {
    background-color: #e9f0e9;
}

#dashboard-content [class~="border-green-200"] {
    border-color: #d8e5d8;
}

#behavior-detail-non-compliance-detail {
    border: 1px solid var(--ui-border);
    border-left: 3px solid var(--ui-danger);
    border-radius: 0.65rem;
    background: var(--ui-surface);
    padding: 1.25rem;
}

#dashboard-content table {
    color: var(--ui-ink);
}

#dashboard-content table thead:not([class~="bg-red-100"]) {
    background-color: var(--ui-surface-muted);
}

#dashboard-content table thead th {
    color: var(--ui-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.055em;
}

#dashboard-content table tbody tr {
    border-color: var(--ui-border);
}

#dashboard-content table tbody tr:hover td {
    background-color: #f8f8fb;
}

#dashboard-content td {
    color: #46545b;
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(15rem, 0.88fr) minmax(22rem, 1.12fr);
    width: min(100%, 58rem);
    max-width: 58rem;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 0.95rem;
    box-shadow: 0 18px 48px rgba(34, 35, 67, 0.09);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: clamp(2rem, 4vw, 3rem);
    border-right: 1px solid var(--ui-border);
    background: var(--ui-surface-muted);
    text-align: left;
}

.auth-brand-logo {
    display: block;
    width: min(100%, 19rem);
    height: auto;
    object-fit: contain;
    object-position: left center;
}

.auth-kicker,
.auth-section-label {
    margin: 2.25rem 0 0;
    color: var(--ui-primary);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.11em;
    line-height: 1.4;
    text-transform: uppercase;
}

.auth-brand-copy {
    margin-top: 0.85rem;
}

.auth-brand-copy h2 {
    margin: 0;
    color: var(--ui-ink);
    font-size: clamp(1.55rem, 2.6vw, 1.9rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.25;
    text-wrap: balance;
}

.auth-brand-copy p,
.auth-intro,
.auth-note {
    color: var(--ui-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.auth-brand-copy p {
    max-width: 25rem;
    margin: 0.8rem 0 0;
}

.auth-brand-footnote {
    margin: auto 0 0;
    padding-top: 2rem;
    color: var(--ui-muted);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    line-height: 1.5;
}

.auth-access {
    display: grid;
    align-content: center;
    padding: clamp(2rem, 4vw, 3.25rem);
    background: var(--ui-surface);
}

.auth-theme-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.25rem;
}

.theme-toggle {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
    background: var(--ui-surface);
    color: var(--ui-ink);
    padding: 0.5rem 0.7rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.theme-toggle:hover {
    border-color: var(--ui-primary-contrast);
    background: var(--ui-primary-soft);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--ui-primary-contrast);
    outline-offset: 2px;
}

.theme-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.theme-toggle svg[hidden] {
    display: none;
}

.theme-toggle--compact {
    width: 44px;
    padding: 0.5rem;
}

#auth-view button.theme-toggle {
    min-height: 44px;
    border-radius: 0.5rem;
}

.auth-access .auth-section-label {
    margin: 0;
}

.auth-access-heading h1 {
    margin: 0.6rem 0 0;
    color: var(--ui-ink);
    font-size: clamp(1.7rem, 3vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.2;
    text-wrap: balance;
}

.auth-intro {
    margin: 0.75rem 0 0;
}

.auth-form {
    display: grid;
    gap: 1.2rem;
    margin-top: 1.8rem;
}

.auth-field {
    display: grid;
    gap: 0.45rem;
}

.auth-label {
    color: var(--ui-ink);
    font-size: 0.9rem;
    font-weight: 500;
}

#auth-view .auth-input {
    min-height: 50px;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

#auth-view .auth-input:focus-visible {
    border-color: var(--ui-primary);
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(48, 47, 105, 0.1);
}

#auth-view .auth-input::placeholder {
    color: #77798a;
    opacity: 1;
}

#auth-error:not(:empty) {
    padding: 0.7rem 0.8rem;
    border-left: 3px solid #a63f48;
    border-radius: 0.2rem;
    background: #fbf1f1;
    color: #812d35;
    line-height: 1.45;
}

#auth-view #auth-button:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(48, 47, 105, 0.16);
}

#auth-view #auth-button {
    min-height: 50px;
}

.user-role-toggle {
    min-height: 44px;
    gap: 0.5rem;
}

.user-role-toggle input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    accent-color: var(--ui-primary);
}

.user-role-toggle label {
    display: flex;
    min-height: 44px;
    align-items: center;
    cursor: pointer;
}

#auth-button {
    min-height: 48px;
    font-size: 0.95rem;
    font-weight: 600;
}

#auth-button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.auth-note {
    margin: 0.15rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--ui-border);
}

@media (max-width: 819px) {
    #auth-view {
        align-items: flex-start;
        padding-top: clamp(1.25rem, 5vh, 2.5rem);
        padding-bottom: clamp(1.25rem, 5vh, 2.5rem);
    }

    .auth-panel {
        grid-template-columns: minmax(0, 1fr);
        max-width: 32rem;
    }

    .auth-brand {
        padding: 1.5rem 1.5rem 1.35rem;
        border-right: 0;
        border-bottom: 1px solid var(--ui-border);
    }

    .auth-brand-logo {
        width: min(100%, 18rem);
    }

    .auth-kicker {
        margin-top: 1.15rem;
    }

    .auth-brand-copy {
        margin-top: 0.5rem;
    }

    .auth-brand-copy h2 {
        max-width: 25rem;
        font-size: 1.35rem;
    }

    .auth-brand-copy p {
        margin-top: 0.4rem;
        font-size: 0.84rem;
    }

    .auth-brand-footnote {
        display: none;
    }

    .auth-access {
        padding: 1.75rem 1.5rem 1.5rem;
    }

    .auth-access-heading h1 {
        font-size: 1.7rem;
    }

    .auth-form {
        gap: 1.05rem;
        margin-top: 1.35rem;
    }
}

#dashboard-content > footer {
    border-top: 1px solid var(--ui-border);
    color: var(--ui-muted);
}

.fade-in {
    animation: fadeIn 180ms ease-out both;
}

@keyframes fadeIn {
    from { opacity: 0.75; }
    to { opacity: 1; }
}

@media (min-width: 1200px) {
    .tabs-nav-container nav > [data-view="client-management"] {
        margin-left: auto !important;
    }
}

@media (max-width: 1199px) {
    .tabs-nav-container {
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .tabs-nav-container nav {
        flex-wrap: nowrap;
        min-width: max-content;
    }

    .tabs-nav-container nav > [data-view="client-management"] {
        margin-left: 0 !important;
        border-left: 0;
        padding-left: 0.7rem !important;
    }
}

@media (max-width: 640px) {
    #main-dashboard.container {
        padding: 1rem;
    }

    #dashboard-content .view > .bg-white {
        padding: 1rem;
    }

    #dashboard-content table th,
    #dashboard-content table td {
        padding: 0.65rem 0.75rem;
    }

    #dashboard-content button:not(.tab-button),
    #auth-button {
        min-height: 44px;
    }

    .tabs-nav-container nav > .tab-button {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fade-in {
        animation: none;
    }

    .theme-toggle,
    #auth-view button.theme-toggle {
        transition: none;
    }
}

/* Comportamientos: resumen y tabla con jerarquía sobria y propia del panel. */
#by-behavior-detail-view .behavior-date-comparison {
    padding: 1rem 1.1rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface-muted);
}

#by-behavior-detail-view .behavior-comparison-title {
    margin: 0 0 0.75rem;
    color: var(--ui-ink);
    font-size: 0.875rem;
    font-weight: 600;
}

#by-behavior-detail-view .behavior-date-comparison label {
    color: var(--ui-muted);
}

#by-behavior-detail-view .behavior-date-comparison select {
    border-color: var(--ui-border);
    box-shadow: none;
}

#by-behavior-detail-view .behavior-report-heading h2 {
    margin: 0;
    color: var(--ui-ink);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    text-wrap: balance;
}

#by-behavior-detail-view .behavior-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-block: 1px solid var(--ui-border);
}

#by-behavior-detail-view .behavior-metric {
    min-width: 0;
    padding: 1rem 1.25rem;
}

#by-behavior-detail-view .behavior-metric + .behavior-metric {
    border-left: 1px solid var(--ui-border);
}

#by-behavior-detail-view .behavior-metric-label {
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

#by-behavior-detail-view .behavior-metric-value {
    margin: 0.2rem 0 0;
    color: var(--ui-primary);
    font-size: 1.55rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

#by-behavior-detail-view .behavior-metric-value.is-good,
#by-behavior-detail-view .behavior-compliance.is-good {
    color: #456a53;
}

#by-behavior-detail-view .behavior-metric-value.is-warning,
#by-behavior-detail-view .behavior-compliance.is-warning {
    color: #826b36;
}

#by-behavior-detail-view .behavior-metric-value.is-alert,
#by-behavior-detail-view .behavior-compliance.is-alert,
#by-behavior-detail-view .behavior-number.has-issues {
    color: var(--ui-danger);
}

#by-behavior-detail-view .behavior-empty-summary {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem 1.25rem;
    color: var(--ui-muted);
    font-size: 0.9rem;
}

#by-behavior-detail-view .behavior-table-shell {
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface);
}

#by-behavior-detail-view .behavior-table-heading {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ui-border);
}

#by-behavior-detail-view .behavior-table-heading h3 {
    margin: 0;
    color: var(--ui-ink);
    font-size: 1rem;
    font-weight: 600;
}

#by-behavior-detail-view .behavior-table-heading p {
    margin: 0.2rem 0 0;
    color: var(--ui-muted);
    font-size: 0.85rem;
}

#by-behavior-detail-view .behavior-table {
    width: 100%;
    min-width: 48rem;
}

#by-behavior-detail-view .behavior-table-head th {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    white-space: nowrap;
}

#by-behavior-detail-view .behavior-table-row td {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    background: var(--ui-surface);
    transition: background-color 140ms ease;
}

#by-behavior-detail-view .behavior-table-row:hover td {
    background: var(--ui-surface-muted);
}

#by-behavior-detail-view .behavior-name-cell {
    min-width: 15rem;
}

#by-behavior-detail-view .behavior-name {
    color: var(--ui-ink);
    font-size: 0.9rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

#by-behavior-detail-view .behavior-number-cell,
#by-behavior-detail-view .behavior-action-cell {
    text-align: center;
}

#by-behavior-detail-view .behavior-number,
#by-behavior-detail-view .behavior-compliance {
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

#by-behavior-detail-view .behavior-compliance {
    color: var(--ui-ink);
    font-weight: 600;
}

#by-behavior-detail-view .behavior-detail-action,
#by-behavior-detail-view .behavior-detail-close {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--ui-primary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

#by-behavior-detail-view .behavior-detail-action {
    padding: 0.45rem 0.6rem;
}

#by-behavior-detail-view .behavior-detail-action span {
    margin-left: 0.2rem;
    color: var(--ui-muted);
    font-variant-numeric: tabular-nums;
}

#by-behavior-detail-view .behavior-detail-action:hover,
#by-behavior-detail-view .behavior-detail-close:hover {
    border-color: var(--ui-border);
    background: var(--ui-primary-soft);
}

#by-behavior-detail-view .behavior-detail-action:focus-visible,
#by-behavior-detail-view .behavior-detail-close:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
}

#by-behavior-detail-view .behavior-no-issues {
    color: var(--ui-muted);
    font-size: 0.82rem;
}

#by-behavior-detail-view .behavior-empty-table {
    padding: 2rem 1rem;
    color: var(--ui-muted);
    text-align: center;
}

#by-behavior-detail-view .behavior-noncompliance-detail {
    padding: 1.25rem;
}

#by-behavior-detail-view #behavior-detail-non-compliance-title {
    min-width: 0;
    color: var(--ui-ink);
    font-size: 1rem;
    overflow-wrap: anywhere;
}

#by-behavior-detail-view .behavior-detail-close {
    flex-shrink: 0;
    padding: 0.4rem 0.65rem;
    border-color: var(--ui-border);
}

#by-behavior-detail-view .behavior-detail-table-wrap {
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
}

#by-behavior-detail-view .behavior-detail-table-wrap table {
    width: 100%;
    min-width: 44rem;
}

#by-behavior-detail-view .behavior-detail-table-head {
    background: var(--ui-surface-muted);
}

#by-behavior-detail-view .behavior-detail-table-head th {
    color: var(--ui-muted);
    white-space: nowrap;
}

#by-behavior-detail-view #behavior-detail-non-compliance-body tr {
    border-color: var(--ui-border);
}

@media (max-width: 767px) {
    #by-behavior-detail-view .behavior-metrics {
        grid-template-columns: minmax(0, 1fr);
    }

    #by-behavior-detail-view .behavior-metric {
        padding: 0.8rem 0.25rem;
    }

    #by-behavior-detail-view .behavior-metric + .behavior-metric {
        border-top: 1px solid var(--ui-border);
        border-left: 0;
    }

    #by-behavior-detail-view .behavior-report-heading {
        align-items: stretch;
    }

    #by-behavior-detail-view .behavior-export-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #by-behavior-detail-view .behavior-export-actions button {
        justify-content: center;
        padding-right: 0.6rem;
        padding-left: 0.6rem;
        font-size: 0.78rem;
    }
}

.monitoring-verification-label {
    display: flex;
    min-height: 2.75rem;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.5rem;
}

.monitoring-verification-label input {
    flex: 0 0 auto;
}

.monitoring-verification-label .verification-attribution,
.monitoring-verification-label .verification-self-note {
    box-sizing: border-box;
    flex: 0 0 calc(100% - 1.75rem);
    margin-left: 1.75rem;
    overflow-wrap: anywhere;
    font-size: 0.75rem;
    line-height: 1.25rem;
}

.monitoring-verification-label .verification-attribution {
    color: #4b5563;
}

.monitoring-verification-label .verification-self-note {
    color: #6b7280;
}

/* Tablas del panel: tratamiento compartido y sobrio como en Comportamientos. */
#dashboard-content .dashboard-table-shell {
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface);
}

#dashboard-content .dashboard-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #c8c8d8 transparent;
    scrollbar-width: thin;
}

#dashboard-content .dashboard-table-scroll:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: -2px;
}

#dashboard-content table.dashboard-data-table {
    width: 100%;
    min-width: 44rem;
    border-collapse: collapse;
    color: var(--ui-ink);
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--monitoring-summary {
    min-width: 58rem;
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--standard-summary {
    min-width: 44rem;
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--branch-summary {
    min-width: 48rem;
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--collaborator-summary {
    min-width: 52rem;
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--non-compliance {
    min-width: 60rem;
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--detail {
    min-width: 48rem;
}

#dashboard-content table.dashboard-data-table.behavior-table {
    min-width: 48rem;
}

#dashboard-content table.dashboard-data-table thead {
    border-bottom: 1px solid var(--ui-border);
    background: var(--ui-surface-muted);
}

#dashboard-content table.dashboard-data-table thead th {
    padding: 0.8rem 1rem;
    color: var(--ui-muted);
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.055em;
    line-height: 1.4;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

#dashboard-content table.dashboard-data-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--ui-border);
    background: var(--ui-surface);
    color: var(--ui-ink);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    vertical-align: middle;
}

#dashboard-content table.dashboard-data-table tbody tr:last-child td {
    border-bottom: 0;
}

#dashboard-content table.dashboard-data-table tbody tr:hover td {
    background: var(--ui-surface-muted);
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--monitoring-summary th:nth-child(n+3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--monitoring-summary td:nth-child(n+3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--standard-summary th:not(:first-child),
#dashboard-content table.dashboard-data-table.dashboard-data-table--standard-summary td:not(:first-child),
#dashboard-content table.dashboard-data-table.dashboard-data-table--branch-summary th:nth-child(3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--branch-summary td:nth-child(3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--collaborator-summary th:nth-child(n+3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--collaborator-summary td:nth-child(n+3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--non-compliance th:nth-child(n+2),
#dashboard-content table.dashboard-data-table.dashboard-data-table--non-compliance td:nth-child(n+2),
#dashboard-content table.dashboard-data-table.dashboard-data-table--detail th:nth-child(n+4),
#dashboard-content table.dashboard-data-table.dashboard-data-table--detail td:nth-child(n+4) {
    text-align: center;
}

#dashboard-content table.dashboard-data-table.dashboard-data-table--monitoring-summary td:first-child,
#dashboard-content table.dashboard-data-table.dashboard-data-table--monitoring-summary td:nth-child(2),
#dashboard-content table.dashboard-data-table.dashboard-data-table--branch-summary td:first-child,
#dashboard-content table.dashboard-data-table.dashboard-data-table--branch-summary td:nth-child(2),
#dashboard-content table.dashboard-data-table.dashboard-data-table--collaborator-summary td:first-child,
#dashboard-content table.dashboard-data-table.dashboard-data-table--collaborator-summary td:nth-child(2),
#dashboard-content table.dashboard-data-table.dashboard-data-table--non-compliance td:first-child,
#dashboard-content table.dashboard-data-table.dashboard-data-table--detail td:nth-child(-n+3),
#dashboard-content table.dashboard-data-table.dashboard-data-table--standard-summary td:first-child {
    min-width: 9rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

#dashboard-content table.dashboard-data-table td[class~="text-green-600"],
#dashboard-content table.dashboard-data-table td[class~="text-green-500"] {
    color: #456a53;
}

#dashboard-content table.dashboard-data-table td[class~="text-yellow-600"] {
    color: #826b36;
}

#dashboard-content table.dashboard-data-table td[class~="text-red-600"],
#dashboard-content table.dashboard-data-table td[class~="text-red-700"] {
    color: var(--ui-danger);
}

#dashboard-content .dashboard-data-table button {
    min-height: 40px;
    padding: 0.45rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    background: transparent;
    box-shadow: none;
    color: var(--ui-primary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

#dashboard-content .dashboard-data-table button:hover {
    border-color: var(--ui-border);
    background: var(--ui-primary-soft);
}

#dashboard-content .dashboard-data-table .dashboard-table-action span {
    margin-left: 0.2rem;
    color: var(--ui-muted);
    font-variant-numeric: tabular-nums;
}

#dashboard-content .dashboard-data-table .dashboard-table-no-issues {
    color: var(--ui-muted);
    font-size: 0.82rem;
}

#dashboard-content .dashboard-data-table .delete-collaborator-btn {
    color: var(--ui-danger);
}

#dashboard-content .dashboard-data-table .delete-collaborator-btn:hover {
    border-color: #e8d7d2;
    background: #faf4f2;
}

#dashboard-content .dashboard-table-detail {
    padding: 1.25rem;
    border: 1px solid var(--ui-border);
    border-left: 3px solid var(--ui-danger);
    border-radius: 0.65rem;
    background: var(--ui-surface);
}

#dashboard-content .dashboard-table-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

#dashboard-content #non-compliance-detail-title {
    min-width: 0;
    margin: 0;
    color: var(--ui-ink);
    font-size: 1rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

#dashboard-content .dashboard-table-detail-close {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.45rem;
    background: transparent;
    color: var(--ui-primary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

#dashboard-content .dashboard-table-detail-close:hover {
    border-color: var(--ui-border);
    background: var(--ui-primary-soft);
}

#dashboard-content .dashboard-table-detail-close:focus-visible {
    outline: 2px solid var(--ui-primary);
    outline-offset: 2px;
}

#dashboard-content .dashboard-table-empty {
    padding: 2rem 1rem !important;
    color: var(--ui-muted) !important;
    text-align: center !important;
    white-space: normal !important;
}

@media (max-width: 640px) {
    .tabs-nav-container nav {
        gap: 0.5rem;
    }

    #dashboard-content input:not([type="radio"]):not([type="checkbox"]),
    #dashboard-content select,
    #auth-view input {
        min-height: 44px;
    }

    #dashboard-content table.dashboard-data-table thead th,
    #dashboard-content table.dashboard-data-table tbody td {
        padding: 0.7rem 0.75rem;
    }

    #dashboard-content .dashboard-data-table button,
    #dashboard-content .dashboard-table-detail-close,
    #non-compliance-report-view #compliance-threshold {
        min-height: 44px;
    }

    #dashboard-content .dashboard-table-detail {
        padding: 1rem;
    }

    #dashboard-content .management-item-buttons,
    #dashboard-content .list-item-row .item-actions {
        gap: 0.5rem;
    }

    #dashboard-content .standard-score-options > label,
    #dashboard-content .behavior-label {
        min-height: 44px;
    }

    #dashboard-content .behavior-label {
        min-width: 0;
        flex: 1 1 auto;
    }

    #dashboard-content .behavior-label > span {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* Encabezado de marca y sesión: jerarquía compacta, sin repetir el contexto. */
@media (max-width: 1480px) {
    .dashboard-header-layout {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-session-row {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .dashboard-header {
        padding-top: 0;
        padding-bottom: 1rem;
    }

    .dashboard-brand-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
    }

    .dashboard-brand-logo {
        width: min(100%, 15rem);
    }

    .dashboard-heading-divider {
        display: none;
    }

    .dashboard-header h1.dashboard-title {
        font-size: 1.35rem;
    }

    .dashboard-session-row {
        width: 100%;
        align-items: center;
        gap: 0.5rem;
    }

    .dashboard-welcome {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #active-client-indicator {
        max-width: 100%;
        width: 100%;
        flex: 0 1 100%;
        order: 2;
    }

    #change-client-btn,
    #logout-btn {
        min-height: 44px;
    }

    #logout-btn {
        order: 1;
        margin-left: auto;
    }

    #client-selector-modal .client-selector-panel {
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
        padding: 1.2rem;
        border-radius: 0.55rem;
    }

    .client-selector-brand {
        gap: 0.6rem;
    }

    .client-selector-brand img {
        width: min(10rem, 55%);
    }

    .client-selector-brand span {
        padding-left: 0.6rem;
        font-size: 0.6rem;
    }

    .client-selector-footer {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 360px) {
    .client-option-btn {
        align-items: flex-start;
        flex-direction: column;
    }

    .client-option-status {
        align-self: flex-start;
    }
}

/* En móvil, deja libre la marca y centra avisos sobre el borde inferior seguro. */
@media (max-width: 640px) {
    .tk[data-theme="reid"][data-position^="bottom"] {
        bottom: max(3rem, calc(env(safe-area-inset-bottom) + 2.5rem));
    }

    .tk[data-theme="reid"][data-position$="right"] {
        right: auto;
        left: 50%;
        max-width: calc(100vw - 2rem);
        transform: translateX(-50%);
    }
}

/* Reportes: filtros, indicadores y tabla con la misma jerarquía que Comportamientos. */
#non-compliance-report-view .report-date-comparison {
    padding: 1rem 1.1rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface-muted);
}

#non-compliance-report-view .report-comparison-title {
    margin: 0 0 0.75rem;
    color: var(--ui-ink);
    font-size: 0.875rem;
    font-weight: 600;
}

#non-compliance-report-view .report-date-comparison label {
    color: var(--ui-muted);
}

#non-compliance-report-view .report-date-comparison select {
    border-color: var(--ui-border);
    box-shadow: none;
}

#non-compliance-report-view .report-threshold-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1.25rem;
    margin: 0.25rem 0 1.15rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--ui-border);
}

#non-compliance-report-view .report-threshold-setting,
#non-compliance-report-view .report-threshold-input {
    display: flex;
    align-items: center;
}

#non-compliance-report-view .report-threshold-setting {
    flex-wrap: wrap;
    gap: 0.65rem;
}

#non-compliance-report-view .report-threshold-setting label {
    color: var(--ui-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

#non-compliance-report-view .report-threshold-input {
    gap: 0.4rem;
    color: var(--ui-muted);
    font-size: 0.9rem;
}

#non-compliance-report-view #compliance-threshold {
    width: 4.75rem;
    min-height: 40px;
    padding: 0.45rem 0.6rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#non-compliance-report-view .report-threshold-help {
    flex: 1 1 20rem;
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

#non-compliance-report-view .report-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

#non-compliance-report-view .report-title {
    margin: 0;
    color: var(--ui-ink);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    text-wrap: balance;
}

#non-compliance-report-view .report-export-actions {
    align-items: center;
    gap: 0.5rem;
}

#non-compliance-report-view .report-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-block: 1px solid var(--ui-border);
}

#non-compliance-report-view .report-metric {
    min-width: 0;
    padding: 1rem 1.1rem;
}

#non-compliance-report-view .report-metric + .report-metric {
    border-left: 1px solid var(--ui-border);
}

#non-compliance-report-view .report-metric-label {
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

#non-compliance-report-view .report-metric-value {
    margin: 0.2rem 0 0;
    color: var(--ui-primary);
    font-size: 1.45rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

#non-compliance-report-view .report-metric-value.is-good {
    color: #456a53;
}

#non-compliance-report-view .report-metric-value.is-alert {
    color: var(--ui-danger);
}

#non-compliance-report-view .report-summary-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem 1.1rem;
    color: var(--ui-muted);
    font-size: 0.9rem;
}

#non-compliance-report-view .report-table-shell {
    overflow: hidden;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface);
}

#non-compliance-report-view .report-table-heading {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ui-border);
}

#non-compliance-report-view .report-table-heading h3 {
    margin: 0;
    color: var(--ui-ink);
    font-size: 1rem;
    font-weight: 600;
}

#non-compliance-report-view .report-table-heading p {
    margin: 0.2rem 0 0;
    color: var(--ui-muted);
    font-size: 0.85rem;
}

#non-compliance-report-view .report-table-detail {
    overflow: hidden;
    padding: 0;
    border-left-width: 1px;
}

#non-compliance-report-view .report-table-detail .dashboard-table-detail-heading {
    margin: 0;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ui-border);
}

#non-compliance-report-view .report-table-detail > .dashboard-table-shell {
    border: 0;
    border-radius: 0;
}

@media (max-width: 1023px) {
    #non-compliance-report-view .report-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #non-compliance-report-view .report-metric:nth-child(3) {
        border-top: 1px solid var(--ui-border);
        border-left: 0;
    }

    #non-compliance-report-view .report-metric:nth-child(4) {
        border-top: 1px solid var(--ui-border);
    }
}

@media (min-width: 1024px) and (max-width: 1679px) {
    #non-compliance-report-view .report-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #non-compliance-report-view .filter-month-year {
        grid-column: span 2;
    }
}

@media (min-width: 1024px) and (max-width: 1439px) {
    #dashboard-content .filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    #non-compliance-report-view .report-date-comparison {
        padding: 0.85rem;
    }

    #non-compliance-report-view .report-metrics {
        grid-template-columns: minmax(0, 1fr);
    }

    #non-compliance-report-view .report-metric {
        padding: 0.8rem 0.25rem;
    }

    #non-compliance-report-view .report-metric + .report-metric {
        border-top: 1px solid var(--ui-border);
        border-left: 0;
    }

    #non-compliance-report-view .report-heading {
        align-items: stretch;
    }

    #non-compliance-report-view .report-export-actions button {
        flex: 1 1 auto;
    }

    #non-compliance-report-view .report-table-detail .dashboard-table-detail-heading {
        padding: 0.85rem 1rem;
    }
}

/* Modo oscuro REID: superficies pizarra e índigo como acento, sin invertir los colores. */
html[data-theme="dark"] {
    color-scheme: dark;
    --ui-canvas: #171820;
    --ui-surface: #20212c;
    --ui-surface-muted: #262735;
    --ui-ink: #f1f0f6;
    --ui-muted: #b8b8c7;
    --ui-border: #414252;
    --ui-primary: #c4c2fa;
    --ui-primary-fill: #302f69;
    --ui-primary-hover: #d5d3ff;
    --ui-primary-hover-fill: #252451;
    --ui-primary-contrast: #c4c2fa;
    --ui-primary-soft: #2d2d43;
    --ui-accent: #a6a4e2;
    --ui-accent-ink: #d1d0ff;
    --ui-danger: #f0a3a5;
    --ui-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.16);
}

html[data-theme="dark"] .tk[data-theme="reid"] {
    --tk-success: #9fc9a5;
    --tk-error: #f0a3a5;
    --tk-warning: #dfc084;
    --tk-action-bg: var(--ui-primary-fill);
    --tk-action-fg: #ffffff;
    --tk-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.bg-gray-100,
html[data-theme="dark"] #loading-view,
html[data-theme="dark"] #auth-view {
    background-color: var(--ui-canvas);
    color: var(--ui-ink);
}

html[data-theme="dark"] .bg-white {
    background-color: var(--ui-surface);
}

html[data-theme="dark"] .bg-gray-50 {
    background-color: var(--ui-surface-muted);
}

html[data-theme="dark"] .bg-gray-100 {
    background-color: var(--ui-canvas);
}

html[data-theme="dark"] .bg-gray-200,
html[data-theme="dark"] .bg-gray-500,
html[data-theme="dark"] .bg-gray-600 {
    background-color: #353646;
}

html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800,
html[data-theme="dark"] .text-gray-700 {
    color: var(--ui-ink);
}

html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-gray-500 {
    color: var(--ui-muted);
}

html[data-theme="dark"] .text-gray-400 {
    color: #a1a2b4;
}

html[data-theme="dark"] .border-gray-200,
html[data-theme="dark"] .border-gray-300,
html[data-theme="dark"] .border-gray-500,
html[data-theme="dark"] [class~="border-b"],
html[data-theme="dark"] [class~="border-t"],
html[data-theme="dark"] [class~="border-l"],
html[data-theme="dark"] [class~="border-r"],
html[data-theme="dark"] .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html[data-theme="dark"] .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--ui-border);
}

html[data-theme="dark"] .bg-blue-50,
html[data-theme="dark"] .bg-blue-100,
html[data-theme="dark"] .bg-indigo-50 {
    background-color: #2b2b43;
}

html[data-theme="dark"] .bg-green-50,
html[data-theme="dark"] .bg-green-100 {
    background-color: #25362c;
}

html[data-theme="dark"] .bg-red-50,
html[data-theme="dark"] .bg-red-100 {
    background-color: #3b292e;
}

html[data-theme="dark"] .bg-yellow-50,
html[data-theme="dark"] .bg-yellow-100,
html[data-theme="dark"] .bg-orange-500 {
    background-color: #3b3324;
}

html[data-theme="dark"] .bg-blue-500,
html[data-theme="dark"] .bg-blue-600,
html[data-theme="dark"] .bg-green-600 {
    background-color: var(--ui-primary-fill);
}

html[data-theme="dark"] .bg-red-500,
html[data-theme="dark"] .bg-orange-500,
html[data-theme="dark"] .bg-teal-500,
html[data-theme="dark"] .bg-yellow-500 {
    color: #171820;
}

html[data-theme="dark"] .text-blue-400,
html[data-theme="dark"] .text-blue-500,
html[data-theme="dark"] .text-blue-600,
html[data-theme="dark"] .text-blue-700,
html[data-theme="dark"] .text-blue-800,
html[data-theme="dark"] .text-blue-900,
html[data-theme="dark"] .text-indigo-600 {
    color: var(--ui-primary-contrast);
}

html[data-theme="dark"] .text-green-500,
html[data-theme="dark"] .text-green-600,
html[data-theme="dark"] .text-green-700,
html[data-theme="dark"] .text-green-800,
html[data-theme="dark"] .text-green-900 {
    color: #a7d6b0;
}

html[data-theme="dark"] .text-red-500,
html[data-theme="dark"] .text-red-600,
html[data-theme="dark"] .text-red-700,
html[data-theme="dark"] .text-red-800,
html[data-theme="dark"] .text-red-900 {
    color: #f2aaad;
}

html[data-theme="dark"] .text-yellow-400,
html[data-theme="dark"] .text-yellow-500,
html[data-theme="dark"] .text-yellow-600,
html[data-theme="dark"] .text-yellow-700,
html[data-theme="dark"] .text-yellow-800 {
    color: #e6ca88;
}

html[data-theme="dark"] .hover\:bg-gray-50:hover,
html[data-theme="dark"] .hover\:bg-gray-300:hover,
html[data-theme="dark"] .hover\:bg-gray-600:hover {
    background-color: #3a3b4d;
}

html[data-theme="dark"] .hover\:bg-blue-600:hover,
html[data-theme="dark"] .hover\:bg-blue-700:hover,
html[data-theme="dark"] .hover\:bg-green-700:hover {
    background-color: var(--ui-primary-hover-fill);
}

html[data-theme="dark"] .hover\:bg-red-600:hover,
html[data-theme="dark"] .hover\:bg-orange-600:hover,
html[data-theme="dark"] .hover\:bg-yellow-600:hover,
html[data-theme="dark"] .hover\:bg-teal-600:hover {
    filter: brightness(1.12);
}

html[data-theme="dark"] .hover\:text-blue-500:hover,
html[data-theme="dark"] .hover\:text-blue-700:hover,
html[data-theme="dark"] .hover\:text-blue-800:hover,
html[data-theme="dark"] .hover\:text-blue-900:hover {
    color: var(--ui-primary-hover);
}

html[data-theme="dark"] .hover\:text-gray-600:hover,
html[data-theme="dark"] .hover\:text-gray-700:hover {
    color: var(--ui-ink);
}

html[data-theme="dark"] .hover\:text-red-700:hover,
html[data-theme="dark"] .hover\:text-red-800:hover,
html[data-theme="dark"] .hover\:text-red-900:hover {
    color: #ffc1c3;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    border-color: var(--ui-border);
    background-color: var(--ui-surface);
    color: var(--ui-ink);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .placeholder-gray-500::placeholder {
    color: #a1a2b4;
    opacity: 1;
}

html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] {
    accent-color: var(--ui-primary-contrast);
}

html[data-theme="dark"] .tabs-nav-container,
html[data-theme="dark"] .dashboard-header,
html[data-theme="dark"] #dashboard-content table.dashboard-data-table thead {
    border-color: var(--ui-border);
}

html[data-theme="dark"] #dashboard-content table.dashboard-data-table thead {
    background-color: #292a38;
    color: var(--ui-muted);
}

html[data-theme="dark"] #dashboard-content table.dashboard-data-table tbody tr:hover td {
    background-color: #292a38;
}

html[data-theme="dark"] #dashboard-content table.dashboard-data-table td[class~="text-green-600"],
html[data-theme="dark"] #dashboard-content table.dashboard-data-table td[class~="text-green-500"] {
    color: #a7d6b0;
}

html[data-theme="dark"] #dashboard-content table.dashboard-data-table td[class~="text-yellow-600"] {
    color: #e6ca88;
}

html[data-theme="dark"] #dashboard-content table.dashboard-data-table td[class~="text-red-600"],
html[data-theme="dark"] #dashboard-content table.dashboard-data-table td[class~="text-red-700"] {
    color: #f2aaad;
}

html[data-theme="dark"] #dashboard-content .delete-collaborator-btn:hover {
    border-color: #67484b;
    background-color: #3b292e;
}

html[data-theme="dark"] #dashboard-content [class~="bg-red-50"] {
    background-color: #35272c;
}

html[data-theme="dark"] #dashboard-content [class~="bg-red-100"] {
    background-color: #3b292e;
}

html[data-theme="dark"] #dashboard-content [class~="bg-green-50"] {
    background-color: #24332b;
}

html[data-theme="dark"] #dashboard-content [class~="bg-green-100"] {
    background-color: #25362c;
}

html[data-theme="dark"] #dashboard-content [class~="text-green-500"],
html[data-theme="dark"] #dashboard-content [class~="text-green-600"],
html[data-theme="dark"] #dashboard-content [class~="text-green-700"] {
    color: #a7d6b0;
}

html[data-theme="dark"] #dashboard-content [class~="border-green-200"] {
    border-color: #455b49;
}

html[data-theme="dark"] #dashboard-content [class~="border-blue-200"],
html[data-theme="dark"] #dashboard-content [class~="border-blue-300"],
html[data-theme="dark"] #dashboard-content [class~="border-blue-400"] {
    border-color: #555574;
}

html[data-theme="dark"] #dashboard-content .behavior-compliance.is-good,
html[data-theme="dark"] #dashboard-content .behavior-metric-value.is-good {
    color: #a7d6b0;
}

html[data-theme="dark"] #dashboard-content .behavior-compliance.is-warning,
html[data-theme="dark"] #dashboard-content .behavior-metric-value.is-warning {
    color: #e6ca88;
}

html[data-theme="dark"] #auth-error:not(:empty) {
    border-left-color: #dc777c;
    background-color: #3b292e;
    color: #ffc1c3;
}

html[data-theme="dark"] #active-client-indicator {
    border-color: #57568c;
    border-left-color: #8583d2;
    background-color: var(--ui-primary-fill);
}

html[data-theme="dark"] #change-client-btn {
    border-color: #d8d7f2;
    background-color: #f4f3ff;
    color: #302f69;
}

html[data-theme="dark"] #change-client-btn:hover {
    background-color: #e5e4fa;
    color: #242451;
}

html[data-theme="dark"] .theme-toggle {
    border-color: var(--ui-border);
    background-color: var(--ui-surface);
    color: var(--ui-ink);
}

html[data-theme="dark"] .theme-toggle:hover {
    border-color: var(--ui-primary-contrast);
    background-color: var(--ui-primary-soft);
}

html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] #client-selector-modal .client-selector-panel,
html[data-theme="dark"] [role="dialog"] > div {
    border-color: var(--ui-border);
    background-color: var(--ui-surface);
    color: var(--ui-ink);
    box-shadow: var(--ui-shadow);
}

html[data-theme="dark"] .auth-brand,
html[data-theme="dark"] .auth-access {
    background-color: var(--ui-surface);
}

html[data-theme="dark"] .auth-brand {
    background-color: #252633;
}

html[data-theme="dark"] .loading-brand-logo,
html[data-theme="dark"] .auth-brand-logo,
html[data-theme="dark"] .dashboard-brand-logo,
html[data-theme="dark"] .client-selector-brand img {
    filter: brightness(0) invert(1);
}

@media print {
    html[data-theme="dark"] .loading-brand-logo,
    html[data-theme="dark"] .auth-brand-logo,
    html[data-theme="dark"] .dashboard-brand-logo,
    html[data-theme="dark"] .client-selector-brand img {
        filter: none;
    }
}

html[data-theme="dark"] .reid-combobox-menu,
html[data-theme="dark"] #dashboard-content .reid-combobox-menu {
    border-color: var(--ui-border);
    background-color: var(--ui-surface);
}

html[data-theme="dark"] #dashboard-content .reid-combobox-menu-heading {
    border-color: var(--ui-border);
}

html[data-theme="dark"] #dashboard-content .reid-combobox-option:hover,
html[data-theme="dark"] #dashboard-content .reid-combobox-option[aria-selected="true"] {
    background-color: var(--ui-primary-soft);
}

html[data-theme="dark"] #dashboard-content .behavior-status-card,
html[data-theme="dark"] #dashboard-content .dashboard-table-detail {
    border-color: var(--ui-border);
    background-color: var(--ui-surface);
    color: var(--ui-ink);
}

html[data-theme="dark"] .skip-link {
    border: 1px solid var(--ui-border);
    background: var(--ui-surface);
    color: var(--ui-ink);
}

html[data-theme="dark"] .dashboard-data-table,
html[data-theme="dark"] .dashboard-data-table th,
html[data-theme="dark"] .dashboard-data-table td {
    border-color: var(--ui-border);
}

html[data-theme="dark"] #dashboard-content td {
    color: var(--ui-ink);
}

html[data-theme="dark"] #loading-view .border-blue-600 {
    border-color: var(--ui-primary-contrast);
}

html[data-theme="dark"] .tk[data-theme="reid"] {
    color-scheme: dark;
}

body:has(.firebase-emulator-warning) .tk[data-theme="reid"][data-position^="bottom"] {
    bottom: max(calc(var(--tk-inset) + 2rem), calc(env(safe-area-inset-bottom) + 2rem));
}

html[data-theme="dark"] * {
    scrollbar-color: #55566a transparent;
}

/* Perfil de cuenta: acceso compacto dentro del encabezado del dashboard. */
.profile-menu {
    position: relative;
    z-index: 40;
    flex: 0 0 auto;
}

.profile-trigger {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    max-width: 13rem;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.65rem 0.25rem 0.35rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.55rem;
    background: var(--ui-surface);
    color: var(--ui-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
    border-color: var(--ui-primary-contrast);
    background: var(--ui-primary-soft);
}

.profile-trigger-copy,
.profile-identity-copy {
    display: grid;
    min-width: 0;
    gap: 0.05rem;
}

.profile-trigger-name,
.profile-trigger-role,
.profile-identity-copy strong,
.profile-identity-copy > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-trigger-name {
    max-width: 8.6rem;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.2;
}

.profile-trigger-role {
    color: var(--ui-muted);
    font-size: 0.69rem;
    line-height: 1.2;
}

.profile-avatar {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--ui-border);
    border-radius: 50%;
    background: var(--ui-primary-soft);
    color: var(--ui-primary);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

.profile-avatar--large {
    width: 2.65rem;
    height: 2.65rem;
    font-size: 0.98rem;
}

.profile-trigger-chevron {
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    transition: transform 140ms ease;
}

.profile-trigger[aria-expanded="true"] .profile-trigger-chevron {
    transform: rotate(180deg);
}

.profile-panel,
.profile-panel[hidden] {
    display: none;
}

.profile-panel:not([hidden]) {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 90;
    display: block;
    width: min(23rem, calc(100vw - 2rem));
    max-height: min(70vh, 34rem);
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--ui-border);
    border-top: 3px solid var(--ui-primary);
    border-radius: 0.7rem;
    background: var(--ui-surface);
    color: var(--ui-ink);
    box-shadow: var(--ui-shadow);
    overscroll-behavior: contain;
}

.profile-panel-header,
.profile-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.profile-panel-header {
    margin-bottom: 0.85rem;
}

.profile-eyebrow {
    margin: 0 0 0.12rem;
    color: var(--ui-primary);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.3;
    text-transform: uppercase;
}

#profile-panel-title {
    margin: 0;
    color: var(--ui-ink);
    font-size: 1.12rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.profile-close {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
    background: var(--ui-surface);
    color: var(--ui-muted);
    cursor: pointer;
}

.profile-close:hover {
    border-color: var(--ui-primary-contrast);
    background: var(--ui-primary-soft);
    color: var(--ui-primary);
}

.profile-close svg,
.profile-password-action svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.55rem;
    background: var(--ui-surface-muted);
}

.profile-identity-copy strong {
    color: var(--ui-ink);
    font-size: 0.91rem;
    font-weight: 650;
}

.profile-identity-copy > span {
    color: var(--ui-muted);
    font-size: 0.78rem;
}

.profile-clients {
    margin-top: 1rem;
}

.profile-section-heading {
    align-items: baseline;
    margin-bottom: 0.45rem;
}

.profile-section-heading h3 {
    margin: 0;
    color: var(--ui-ink);
    font-size: 0.82rem;
    font-weight: 650;
}

.profile-client-count {
    flex: 0 0 auto;
    color: var(--ui-muted);
    font-size: 0.69rem;
    font-weight: 600;
    text-align: right;
}

.profile-client-status {
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.profile-client-status:empty {
    display: none;
}

.profile-client-list {
    display: grid;
    max-height: 10rem;
    gap: 0.1rem;
    overflow: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.profile-client-list:empty {
    display: none;
}

.profile-client-list li {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.38rem 0.1rem;
    color: var(--ui-ink);
    font-size: 0.8rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.profile-client-marker {
    width: 0.42rem;
    height: 0.42rem;
    flex: 0 0 auto;
    margin-top: 0.36rem;
    border-radius: 50%;
    background: var(--ui-accent);
}

.profile-password-action {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.85rem;
    padding: 0.55rem 0.15rem 0.1rem;
    border: 0;
    border-top: 1px solid var(--ui-border);
    background: transparent;
    color: var(--ui-primary);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.profile-password-action:hover {
    color: var(--ui-primary-hover);
}

.profile-trigger:focus-visible,
.profile-close:focus-visible,
.profile-password-action:focus-visible {
    outline: 2px solid var(--ui-primary-contrast);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .profile-menu {
        order: 1;
    }

    .profile-panel:not([hidden]) {
        position: fixed;
        top: var(--profile-panel-top, 1rem);
        right: max(1rem, env(safe-area-inset-right));
        width: min(23rem, calc(100vw - 2rem));
        max-height: 70vh;
        max-height: 70dvh;
    }
}

/* Adaptación por espacio disponible: formularios, filtros y listas operativas. */
#dashboard-content .grid > *,
.auth-panel > * {
    min-width: 0;
}

#dashboard-content .filter-grid {
    align-items: end;
}

@media (min-width: 640px) and (max-width: 767px) {
    #dashboard-content .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #dashboard-content .filter-month-year {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1023px) {
    #client-management-view > .bg-white > .grid,
    #user-management-view > .bg-white > .grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

#dashboard-content .list-item-row > :first-child,
#dashboard-content .management-item-header > :first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

#dashboard-content .list-item-row,
#dashboard-content .management-item-header,
#dashboard-content .export-buttons-row {
    flex-wrap: wrap;
    gap: 0.75rem;
}

#dashboard-content .standard-score-options {
    flex-shrink: 0;
}

@media (max-width: 767px) {
    #dashboard-content input:not([type="checkbox"]):not([type="radio"]),
    #dashboard-content select,
    #dashboard-content textarea,
    #dashboard-content .filter-grid select[id*="month"],
    #dashboard-content .filter-grid select[id*="year"],
    #auth-view input,
    #input-modal-text {
        min-width: 0;
        min-height: 44px;
        font-size: 1rem;
    }

    #dashboard-content .standard-score-row {
        flex-direction: column;
        align-items: flex-start;
    }

    #dashboard-content .standard-score-options {
        max-width: 100%;
        gap: 0.5rem;
    }

    #dashboard-content .management-item-buttons,
    #dashboard-content .list-item-row .item-actions,
    #dashboard-content .export-buttons-row > .flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #dashboard-content button,
    [role="dialog"] button {
        min-height: 44px;
    }

    #dashboard-content .view h2,
    #dashboard-content .view h3 {
        overflow-wrap: anywhere;
    }
}

/* Visor de eventos: búsqueda clara y lectura cómoda del historial. */
#audit-logs-view .audit-filters {
    margin-bottom: 1.5rem;
    padding: 1.1rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.65rem;
    background: var(--ui-surface-muted);
}

#audit-logs-view .audit-filters-heading h3,
#audit-logs-view .audit-results-heading h3 {
    margin: 0;
    color: var(--ui-ink);
    font-size: 1rem;
    font-weight: 650;
}

#audit-logs-view .audit-filters-heading p,
#audit-logs-view .audit-results-heading p {
    margin: 0.2rem 0 0;
    color: var(--ui-muted);
    font-size: 0.83rem;
    line-height: 1.45;
}

#audit-logs-view .audit-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 0.95rem;
    align-items: end;
}

#audit-logs-view .audit-filter-search {
    grid-column: span 2;
}

#audit-logs-view .audit-filter-field {
    min-width: 0;
}

#audit-logs-view .audit-filter-field label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--ui-ink);
    font-size: 0.81rem;
    font-weight: 600;
    line-height: 1.35;
}

#dashboard-content #audit-logs-view .audit-filter-field input,
#dashboard-content #audit-logs-view .audit-filter-field select {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--ui-border);
    background: var(--ui-surface);
    color: var(--ui-ink);
    font-size: 0.875rem;
}

#audit-logs-view .audit-advanced-filters {
    margin-top: 0.9rem;
    border-top: 1px solid var(--ui-border);
}

#audit-logs-view .audit-advanced-filters > summary {
    min-height: 44px;
    padding-top: 0.75rem;
    color: var(--ui-primary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
}

#audit-logs-view .audit-advanced-filters > summary span {
    margin-left: 0.4rem;
    color: var(--ui-muted);
    font-size: 0.78rem;
    font-weight: 400;
}

#audit-logs-view .audit-advanced-filters .audit-filter-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 0.35rem;
}

#audit-logs-view .audit-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1rem;
}

#audit-logs-view .audit-filter-pending {
    align-self: center;
    margin: 0 auto 0 0;
    color: var(--ui-muted);
    font-size: 0.8rem;
}

#audit-logs-view .audit-filter-pending[hidden] { display: none; }

#dashboard-content #audit-logs-view .audit-button {
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.3;
}

#dashboard-content #audit-logs-view .audit-button-secondary {
    background: var(--ui-surface);
    color: var(--ui-primary);
}

#dashboard-content #audit-logs-view .audit-button-secondary:hover:not(:disabled) {
    background: var(--ui-primary-soft);
    border-color: var(--ui-primary-contrast);
}

#dashboard-content #audit-logs-view .audit-button-primary {
    border-color: var(--ui-primary-fill);
    background: var(--ui-primary-fill);
    color: #fff;
}

#dashboard-content #audit-logs-view .audit-button-primary:hover:not(:disabled) {
    background: var(--ui-primary-hover-fill);
}

#dashboard-content #audit-logs-view .audit-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

#audit-logs-view .audit-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--ui-border);
    border-left: 3px solid var(--ui-danger);
    border-radius: 0.5rem;
    background: var(--ui-surface);
    color: var(--ui-ink);
    font-size: 0.875rem;
}

#audit-logs-view .audit-error[hidden],
#dashboard-content #audit-logs-view .audit-button[hidden] {
    display: none;
}

#audit-logs-view .audit-results-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

#audit-logs-view .audit-export {
    text-align: right;
}

#audit-logs-view .audit-export p {
    font-size: 0.75rem;
}

#audit-logs-view .audit-table-scroll-hint {
    margin: 0 0 0.5rem;
    color: var(--ui-muted);
    font-size: 0.75rem;
}

#dashboard-content #audit-logs-view table.dashboard-data-table tbody td {
    vertical-align: top;
}

#audit-logs-view .audit-log-detail > summary,
#audit-logs-view .audit-raw-data > summary {
    color: var(--ui-primary);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
}

#audit-logs-view .audit-log-detail > summary:hover,
#audit-logs-view .audit-raw-data > summary:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

#audit-logs-view .audit-detail-panel {
    width: min(22rem, 75vw);
    max-width: 100%;
    margin-top: 0.65rem;
    padding: 0.8rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.5rem;
    background: var(--ui-surface-muted);
    color: var(--ui-ink);
    overflow-wrap: anywhere;
}

#audit-logs-view .audit-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0;
}

#audit-logs-view .audit-detail-meta > div,
#audit-logs-view .audit-change-values > div {
    min-width: 0;
}

#audit-logs-view .audit-detail-meta dt,
#audit-logs-view .audit-change-values span {
    color: var(--ui-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

#audit-logs-view .audit-detail-meta dd {
    margin: 0.1rem 0 0;
    font-size: 0.82rem;
}

#audit-logs-view .audit-detail-section,
#audit-logs-view .audit-raw-data {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ui-border);
}

#audit-logs-view .audit-detail-section h4,
#audit-logs-view .audit-change h5 {
    margin: 0 0 0.4rem;
    color: var(--ui-ink);
    font-size: 0.82rem;
    font-weight: 650;
}

#audit-logs-view .audit-change + .audit-change {
    margin-top: 0.65rem;
}

#audit-logs-view .audit-change-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    font-size: 0.8rem;
}

#audit-logs-view .audit-change-values > div {
    padding: 0.5rem;
    border: 1px solid var(--ui-border);
    border-radius: 0.4rem;
    background: var(--ui-surface);
}

#audit-logs-view .audit-raw-data pre {
    max-height: 20rem;
    margin: 0.5rem 0 0;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--ui-ink);
    font-size: 0.75rem;
}

@media (max-width: 1199px) {
    #audit-logs-view .audit-filter-grid,
    #audit-logs-view .audit-advanced-filters .audit-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    #audit-logs-view .audit-table-scroll-hint { display: none; }
}

@media (max-width: 767px) {
    #audit-logs-view .audit-filter-grid,
    #audit-logs-view .audit-advanced-filters .audit-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #audit-logs-view .audit-results-heading {
        align-items: start;
        flex-direction: column;
    }

    #audit-logs-view .audit-export { text-align: left; }
}

@media (max-width: 639px) {
    #audit-logs-view .audit-table-scroll-hint { display: none; }
    #audit-logs-view .dashboard-table-scroll { overflow: visible; }
    #dashboard-content #audit-logs-view table.dashboard-data-table,
    #dashboard-content #audit-logs-view .dashboard-data-table tbody,
    #dashboard-content #audit-logs-view .dashboard-data-table tbody tr {
        display: block;
        width: 100%;
        min-width: 0;
    }

    #audit-logs-view .dashboard-data-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    #dashboard-content #audit-logs-view .dashboard-data-table tbody tr {
        padding: 0.65rem 0;
        border-bottom: 1px solid var(--ui-border);
    }

    #dashboard-content #audit-logs-view .dashboard-data-table tbody tr:last-child { border-bottom: 0; }

    #dashboard-content #audit-logs-view .dashboard-data-table tbody td {
        display: grid;
        grid-template-columns: minmax(6.4rem, 0.9fr) minmax(0, 1.3fr);
        gap: 0.6rem;
        padding: 0.3rem 0.8rem;
        border: 0;
    }

    #dashboard-content #audit-logs-view .dashboard-data-table tbody td[data-not-applicable="true"] { display: none; }

    #dashboard-content #audit-logs-view .dashboard-data-table tbody td:last-child { display: block; }

    #audit-logs-view .dashboard-data-table td:last-child::before {
        display: block;
        margin-bottom: 0.25rem;
    }

    #audit-logs-view .dashboard-data-table td::before {
        content: attr(data-label);
        color: var(--ui-muted);
        font-size: 0.76rem;
        font-weight: 600;
        line-height: 1.4;
    }

    #audit-logs-view .audit-cell-value { min-width: 0; overflow-wrap: anywhere; }
    #audit-logs-view .audit-detail-panel { width: 100%; max-width: 100%; }
    #audit-logs-view .audit-detail-meta,
    #audit-logs-view .audit-change-values { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 479px) {
    #audit-logs-view .audit-filter-grid,
    #audit-logs-view .audit-advanced-filters .audit-filter-grid { grid-template-columns: minmax(0, 1fr); }
    #audit-logs-view .audit-filter-search { grid-column: auto; }
    #audit-logs-view .audit-filter-actions { flex-direction: column-reverse; }
    #audit-logs-view .audit-filter-actions .audit-button { width: 100%; }
    #audit-logs-view .audit-filter-pending { align-self: start; }
    #audit-logs-view .audit-advanced-filters > summary span { display: block; margin: 0.15rem 0 0 1rem; }
}
