/* Iridis / SABTR — layout app y componentes (sin Tailwind en área autenticada) */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: var(--sabtr-bg);
    color: var(--sabtr-text);
}

.technical-border {
    border: 0.5px solid var(--sabtr-border);
}

.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sabtr-surface);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.45rem;
    border-bottom: 0.5px solid var(--sabtr-border);
}

.app-sidebar-close,
.app-nav-toggle {
    display: none !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--sabtr-text);
    cursor: pointer;
    border-radius: 4px;
}

.app-sidebar-close:hover,
.app-nav-toggle:hover,
.app-sidebar-close:focus-visible,
.app-nav-toggle:focus-visible {
    background: var(--sabtr-accent-soft);
    color: var(--sabtr-text-strong);
    outline: none;
}

.app-nav-backdrop {
    display: none;
}

.app-topbar-dataset {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.app-sidebar-system-logo {
    flex-shrink: 0;
    height: 58px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
    margin: 0;
}

.app-sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 0;
}

.app-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    gap: 0.25rem;
}

.app-nav-group {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sabtr-text-muted);
    padding: 1rem 1rem 0.35rem;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    margin: 0 0.5rem;
    color: var(--sabtr-text-soft);
    text-decoration: none;
    font-size: 13px;
    border-left: 2px solid transparent;
}

.app-nav-link:hover {
    color: var(--sabtr-text-strong);
    background: var(--sabtr-accent-soft);
}

.app-nav-link.is-active {
    color: var(--sabtr-text-strong);
    background: var(--sabtr-accent-soft);
    border-left-color: var(--sabtr-accent);
}

.app-nav-link .material-symbols-outlined {
    font-size: 20px;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--sabtr-bg);
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.25rem;
    background: var(--sabtr-surface);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 40;
}

.app-topbar-left,
.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-inline-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sabtr-text-muted);
}

.app-select {
    background: var(--sabtr-surface-deep);
    border: 0.5px solid var(--sabtr-border);
    color: var(--sabtr-text);
    font-size: 12px;
    padding: 0.35rem 0.5rem;
    min-width: 140px;
}

.app-select:disabled {
    opacity: 0.5;
}

.app-header-empresa-logo {
    flex-shrink: 0;
    line-height: 0;
}

.app-header-empresa-logo-img {
    display: block;
    height: 34px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
}

.app-user-meta {
    font-size: 12px;
    color: var(--sabtr-text-soft);
}

.app-topbar-empresa {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 18rem;
}

.app-user-empresa {
    font-size: 13px;
    font-weight: 600;
    color: var(--sabtr-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-btn-ghost {
    font-size: 12px;
    font-weight: 600;
    color: var(--sabtr-accent);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
}

.app-btn-ghost:hover {
    text-decoration: underline;
}

.app-content {
    flex: 1;
    padding: 1.25rem;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
}

.app-topbar-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0;
}

.panel {
    background: var(--sabtr-surface);
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
    margin: 0 0 0.5rem;
}

.text-muted {
    color: var(--sabtr-text-soft);
    font-size: 13px;
    line-height: 1.5;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.admin-table-actions {
    white-space: nowrap;
}

.admin-btn-inline {
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    padding: 0.25rem 0;
}

.admin-empresa-dialog {
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1.25rem 1.35rem 1.35rem;
    border: 1px solid var(--sabtr-border, #d0d5dd);
    border-radius: 8px;
    background: var(--sabtr-surface, #fff);
    color: var(--sabtr-text, inherit);
}

.admin-empresa-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.admin-empresa-dialog__head,
.admin-empresa-dialog__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.admin-empresa-dialog__actions {
    justify-content: flex-end;
    margin-top: 1.15rem;
}

.admin-empresa-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 0.75rem;
    margin-top: 1rem;
}

.admin-empresa-form > div {
    min-width: 0;
}

.admin-empresa-form .span-2 {
    grid-column: 1 / -1;
}

.admin-empresa-form .admin-input {
    width: 100%;
    box-sizing: border-box;
}

body.app-body--staging .admin-empresa-dialog {
    background: var(--st-surface, #2c2c30);
    border-color: var(--st-border, #3a3a40);
    color: var(--st-text, #eee);
}

@media (max-width: 640px) {
    .admin-empresa-form {
        grid-template-columns: 1fr;
    }

    .admin-empresa-form .span-2 {
        grid-column: auto;
    }
}

.admin-table-msg {
    max-width: 14rem;
    white-space: normal;
    word-break: break-word;
    font-size: 11px;
    color: var(--sabtr-text-soft);
}

.page-center {
    max-width: 28rem;
    margin: 0 auto;
    padding: 4rem 1.25rem;
    text-align: center;
}

.page-center h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--sabtr-text-strong);
    margin: 0 0 0.5rem;
}

.page-center p {
    color: var(--sabtr-text-soft);
    margin: 0 0 1.5rem;
}

.btn-primary {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--sabtr-accent);
    color: var(--sabtr-on-accent);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border-radius: 2px;
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--sabtr-accent-hover);
}

.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--sabtr-text);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border-radius: 2px;
    border: 0.5px solid var(--sabtr-border);
    font-family: inherit;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--sabtr-accent);
    background: var(--sabtr-accent-soft);
}

.admin-alert {
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 0.5px solid var(--sabtr-border);
    font-size: 12px;
}

.admin-alert-ok {
    background: #12321f;
    color: #c8ffd8;
}

.admin-alert-error {
    background: #4a1010;
    color: #ffd4d4;
}

.admin-grid-form {
    --filter-control-h: 2.25rem;
    --filter-font-size: 12px;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.5rem 0.65rem;
    width: 100%;
    box-sizing: border-box;
}

.admin-grid-form > div:not(.admin-form-actions) {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1 1 0;
    min-width: 0;
}

.admin-grid-form .admin-input:not([type="file"]) {
    height: var(--filter-control-h);
    min-height: var(--filter-control-h);
    max-height: var(--filter-control-h);
    padding: 0 0.5rem;
    font-size: var(--filter-font-size);
    line-height: 1.2;
    box-sizing: border-box;
}

.admin-grid-form .admin-input[type="date"] {
    padding: 0 0.4rem;
    line-height: var(--filter-control-h);
}

.admin-grid-form > div > .section-title,
.admin-grid-form > div > .dashboard-filter-label {
    margin: 0 0 0.25rem;
    font-size: 10px;
    letter-spacing: 0.06em;
}

.admin-input-tip-wrap {
    position: relative;
    display: block;
}

.admin-grid-form > div:has(.admin-input-tip-wrap) {
    overflow: visible;
}

.admin-grid-form > div:has(.admin-input-tip-wrap):hover,
.admin-grid-form > div:has(.admin-input-tip-wrap):focus-within {
    z-index: 40;
}

.admin-input-tip {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.4rem);
    z-index: 50;
    width: max-content;
    max-width: min(18rem, 85vw);
    padding: 0.5rem 0.65rem;
    font-size: 11px;
    line-height: 1.45;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    color: var(--sabtr-text-soft);
    background: var(--sabtr-surface-alt);
    border: 1px solid rgba(120, 170, 220, 0.5);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.admin-input-tip-wrap:hover .admin-input-tip,
.admin-input-tip-wrap:focus-within .admin-input-tip {
    opacity: 1;
    visibility: visible;
}

.admin-grid-form .admin-form-actions .btn-primary {
    height: var(--filter-control-h);
    min-height: var(--filter-control-h);
    width: auto;
    white-space: nowrap;
    padding: 0 0.85rem;
    font-size: var(--filter-font-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.admin-input {
    width: 100%;
    background: var(--sabtr-surface-deep);
    border: 0.5px solid var(--sabtr-border);
    color: var(--sabtr-text);
    font-size: 12px;
    padding: 0.45rem 0.5rem;
}

.admin-input[type="file"] {
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: var(--sabtr-text-muted);
    font-size: 11px;
}

.admin-input[type="file"]::file-selector-button {
    margin-right: 0.65rem;
    padding: 0.45rem 0.9rem;
    border: 0.5px solid #2a4a72;
    border-radius: 4px;
    background: linear-gradient(180deg, #1e4578 0%, #15355c 100%);
    color: var(--sabtr-on-accent);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.admin-input[type="file"]::file-selector-button:hover {
    border-color: var(--sabtr-accent);
    background: linear-gradient(180deg, #2560a0 0%, #1a4068 100%);
    box-shadow: 0 0 0 1px rgba(42, 138, 224, 0.25);
}

.admin-input[type="file"]::file-selector-button:active {
    transform: translateY(1px);
}

.admin-input[type="file"]::-webkit-file-upload-button {
    margin-right: 0.65rem;
    padding: 0.45rem 0.9rem;
    border: 0.5px solid #2a4a72;
    border-radius: 4px;
    background: linear-gradient(180deg, #1e4578 0%, #15355c 100%);
    color: var(--sabtr-on-accent);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.admin-input[type="file"]::-webkit-file-upload-button:hover {
    border-color: var(--sabtr-accent);
    background: linear-gradient(180deg, #2560a0 0%, #1a4068 100%);
    box-shadow: 0 0 0 1px rgba(42, 138, 224, 0.25);
}

.admin-form-actions {
    display: flex;
    align-items: end;
}

.admin-form-actions .btn-primary {
    width: 100%;
}

.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Profundidad >37 m: supervisor → grilla detalle bajo el gráfico */
.prof-sup-picker {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sabtr-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}

.prof-sup-picker:hover,
.prof-sup-picker:focus-visible {
    color: var(--sabtr-accent);
    outline: none;
}

tr.prof-sup-main-row.is-selected td {
    background: var(--sabtr-accent-soft);
}

.profundidad-detalle-wrap[hidden] {
    display: none !important;
}

.profundidad-detalle-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.profundidad-detalle-meta {
    color: var(--sabtr-text-muted);
    font-size: 13px;
}

/* Resumen / Diarios: celda enlace → Detalle con filtro (sin subrayado) */
a.resumen-sup-to-detalle,
a.diarios-buzo-to-detalle {
    text-decoration: none;
    color: inherit;
    display: block;
    margin: -0.55rem -0.4rem;
    padding: 0.55rem 0.4rem;
}

a.resumen-sup-to-detalle:hover,
a.resumen-sup-to-detalle:focus-visible,
a.diarios-buzo-to-detalle:hover,
a.diarios-buzo-to-detalle:focus-visible {
    text-decoration: underline;
}

/* Faenas: filtro por clic en nombre de faena en matriz */
a.faenas-pivot-faena-link {
    color: var(--sabtr-accent);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
a.faenas-pivot-faena-link:hover,
a.faenas-pivot-faena-link:focus-visible {
    color: var(--sabtr-text-soft);
    text-decoration: underline;
}
.admin-table-matrix tr.faenas-pivot-row--selected td:first-child {
    background: rgba(255, 235, 59, 0.12);
    box-shadow: inset 3px 0 0 #ffeb3b;
}
.admin-table-matrix tr.faenas-pivot-row--selected a.faenas-pivot-faena-link {
    color: #ffeb3b;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: var(--sabtr-text);
}

.admin-table th.text-right,
.admin-table td.text-right {
    text-align: right;
}

.admin-table th,
.admin-table td {
    border-top: 0.5px solid var(--sabtr-border);
    padding: 0.55rem 0.4rem;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--sabtr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 10px;
}

.admin-inline-form {
    margin: 0;
}

.admin-table-actions:has(.admin-user-actions) {
    white-space: nowrap;
    vertical-align: middle;
}

.admin-table-actions--icons {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.admin-table-th-actions {
    width: 1%;
    text-align: right;
}

.admin-user-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.admin-user-actions .admin-inline-form {
    display: inline-flex;
    margin: 0;
    align-items: center;
}

.admin-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(120, 170, 220, 0.38);
    background: rgba(10, 36, 64, 0.65);
    color: var(--sabtr-text-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-icon-btn:hover {
    background: rgba(42, 116, 214, 0.38);
    color: var(--sabtr-text-strong);
    border-color: rgba(120, 190, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(42, 138, 224, 0.2);
}

.admin-icon-btn:focus-visible {
    outline: 2px solid var(--sabtr-accent-bright);
    outline-offset: 2px;
}

.admin-icon-btn .material-symbols-outlined {
    font-size: 22px;
    line-height: 1;
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.admin-icon-btn--edit:hover {
    border-color: rgba(120, 200, 255, 0.55);
}

.admin-icon-btn--warn:hover {
    border-color: rgba(255, 140, 120, 0.45);
    color: #ffc9c0;
    background: rgba(80, 24, 24, 0.45);
}

.admin-icon-btn--danger {
    color: #ff9c8f;
}

.admin-icon-btn--danger:hover {
    border-color: rgba(255, 110, 95, 0.6);
    color: var(--sabtr-text-strong);
    background: rgba(150, 30, 30, 0.6);
}

.admin-icon-btn--ok:hover {
    border-color: rgba(100, 220, 160, 0.5);
    color: #c8ffd8;
    background: rgba(18, 50, 36, 0.55);
}

.admin-icon-btn--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--sabtr-text-muted);
}

.admin-icon-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sabtr-text-strong);
    border-color: rgba(120, 170, 220, 0.25);
}

.admin-icon-btn--disabled,
.admin-icon-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
    border-color: rgba(120, 170, 220, 0.2);
    color: var(--sabtr-text-muted);
    background: rgba(10, 36, 64, 0.35);
}

.admin-icon-btn--disabled:hover,
.admin-icon-btn:disabled:hover {
    background: rgba(10, 36, 64, 0.35);
    color: var(--sabtr-text-muted);
    border-color: rgba(120, 170, 220, 0.2);
    box-shadow: none;
}

.admin-icon-btn--mfa-off {
    color: #ffc9c0;
    border-color: rgba(255, 130, 110, 0.45);
    background: rgba(72, 22, 22, 0.5);
}

.admin-icon-btn--mfa-off:hover {
    border-color: rgba(255, 150, 130, 0.6);
    color: #ffe8e4;
    background: rgba(100, 28, 28, 0.65);
}

.admin-icon-btn--mfa-on {
    color: #b8f0d0;
    border-color: rgba(90, 200, 140, 0.45);
    background: rgba(18, 52, 38, 0.5);
}

.admin-icon-btn--mfa-on:hover {
    border-color: rgba(110, 230, 170, 0.55);
    color: #e0ffe8;
    background: rgba(24, 68, 48, 0.65);
}

.admin-mfa-cell {
    vertical-align: middle;
    min-width: 8.5rem;
}

.admin-mfa-cell__inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.admin-mfa-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
}

.admin-mfa-actions .admin-inline-form {
    display: inline-flex;
    margin: 0;
    align-items: center;
}

.admin-page--usuarios .um-modal__box {
    background: linear-gradient(165deg, var(--sabtr-surface-alt) 0%, var(--sabtr-surface-2) 55%, var(--sabtr-bg-deep) 100%);
}

.um-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.um-modal[hidden] {
    display: none !important;
}

.um-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 8, 18, 0.78);
    backdrop-filter: blur(3px);
}

.um-modal__box {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    max-height: min(90vh, 640px);
    overflow: auto;
    padding: 1.35rem 1.4rem 1.25rem;
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.um-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.um-modal__title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.um-modal__intro {
    margin: 0 0 1.1rem;
    line-height: 1.45;
    font-size: 0.875rem;
    color: var(--sabtr-text-muted);
}

.um-modal__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.um-field__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
    margin-bottom: 0.35rem;
}

.um-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.25rem;
    padding-top: 0.35rem;
    border-top: 0.5px solid rgba(30, 61, 96, 0.85);
}

.admin-status {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border: 0.5px solid var(--sabtr-border);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-status-ok {
    color: #c8ffd8;
    background: #12321f;
}

.admin-status-warn {
    color: #ffd8a8;
    background: #352100;
}

.admin-status-off {
    color: #ffd4d4;
    background: #4a1010;
}

.admin-status-mandante {
    color: var(--sabtr-text);
    background: #12304a;
}

.admin-status-prestador {
    color: #ffe7c2;
    background: #3a2a10;
}

.admin-empresa-clasificacion {
    min-width: 16rem;
    display: grid;
    gap: 0.35rem;
}

/* Riesgo supervisores (resumen): % no cumple sobre buceos con paradas programadas > 0 */
.riesgo-sup {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border: 0.5px solid var(--sabtr-border);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.riesgo-sup--alto {
    color: #ffc9c9;
    background: #5c1414;
    border-color: #8b2020;
}

.riesgo-sup--medio {
    color: #2a2210;
    background: #e8c96a;
    border-color: #b8942e;
}

.riesgo-sup--bajo {
    color: #c8ffd8;
    background: #12321f;
    border-color: #2d6b45;
}

.riesgo-sup--na {
    color: var(--sabtr-text-muted);
    background: #152536;
    border-color: #2a4058;
}

.riesgo-sup--ok {
    color: #b8f0d0;
    background: var(--sabtr-success-bg);
    border-color: #2a6b45;
}

.riesgo-sup-pct {
    font-size: 11px;
    color: var(--sabtr-text-muted);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.admin-page {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-page-head {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 0.5px solid var(--sabtr-border);
}

.admin-logo-upload-field {
    cursor: help;
}

.admin-empresa-logo-thumb {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
}

.admin-form-logo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    cursor: help;
}

.admin-input-file-inline {
    max-width: 220px;
    font-size: 11px;
    padding: 0.3rem 0.4rem;
}

.admin-input.admin-input-file-inline[type="file"]::file-selector-button,
.admin-input.admin-input-file-inline[type="file"]::-webkit-file-upload-button {
    padding: 0.3rem 0.55rem;
    font-size: 11px;
}

.admin-page-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--sabtr-text-strong);
    letter-spacing: 0.02em;
}

.admin-page-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--sabtr-text-soft);
    line-height: 1.45;
}

.admin-card {
    padding: 1.25rem;
    background: var(--sabtr-surface);
    border: 0.5px solid var(--sabtr-border);
    margin-bottom: 1rem;
}

.admin-card:last-child {
    margin-bottom: 0;
}

.admin-card--danger {
    border-color: rgba(255, 107, 107, 0.45);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.12);
}

.admin-purge-form > * + * {
    margin-top: 1rem;
}

.admin-purge-ack {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 13px;
    color: var(--sabtr-text-soft);
    line-height: 1.4;
}

.admin-purge-ack input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.btn-primary--danger {
    background: #c62828;
    border-color: #8e0000;
}

.btn-primary--danger:hover {
    background: #e53935;
}

.admin-muted-block {
    padding: 0.75rem;
    background: var(--sabtr-surface-deep);
    border: 0.5px solid var(--sabtr-border);
    font-size: 12px;
    color: var(--sabtr-text-soft);
    line-height: 1.5;
}

.admin-muted-block code {
    color: var(--sabtr-text);
    font-size: 11px;
}

/* Dashboard pestañas */
.dashboard-tabs {
    background: var(--sabtr-surface);
    padding: 0;
    max-width: 100%;
}

.dashboard-tabs-head {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    border-bottom: 0.5px solid var(--sabtr-border);
}

.dashboard-tabs-head .dashboard-tablist {
    flex: 1;
    min-width: 0;
    border-bottom: none;
}

.dashboard-export-actions {
    display: inline-flex;
    flex-shrink: 0;
    align-items: stretch;
    align-self: stretch;
    margin: 0;
}

.dashboard-export-csv,
.dashboard-export-pdf {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0 0.55rem 0 0.65rem;
    margin: 0;
    text-decoration: none;
    color: #2d9d5f;
    border: none;
    border-left: 0.5px solid var(--sabtr-border);
    background: transparent;
    cursor: pointer;
    font: inherit;
    transition: color 0.15s ease, background 0.15s ease;
}

.dashboard-export-pdf {
    color: #e57373;
}

.dashboard-export-pdf--all {
    color: var(--sabtr-text-muted);
}

.dashboard-export-csv:hover {
    color: #4cf090;
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-export-pdf:hover {
    color: #ef9a9a;
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-export-pdf--all:hover {
    color: var(--sabtr-text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-export-pdf:disabled,
.dashboard-export-csv[aria-disabled="true"] {
    opacity: 0.45;
    cursor: wait;
    pointer-events: none;
}

.dashboard-export-csv-icon {
    font-size: 26px;
    font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.dashboard-export-csv-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dashboard-pdf-busy {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 14, 28, 0.72);
    color: var(--sabtr-text-soft);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    pointer-events: all;
}

.dashboard-pdf-busy[hidden] {
    display: none !important;
}

.dashboard-pdf-busy-card {
    padding: 1rem 1.4rem;
    border: 0.5px solid var(--sabtr-border);
    background: var(--sabtr-surface-2);
    border-radius: 4px;
    text-align: center;
}

.dashboard-pdf-busy-card small {
    display: block;
    margin-top: 0.35rem;
    color: var(--sabtr-text-muted);
    font-weight: 500;
    font-size: 12px;
}

/* Diapositiva off-screen para captura 16:9 (no deformar gráficos) */
.dashboard-pdf-slide-root {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 1920px;
    height: 1080px;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.dashboard-pdf-slide {
    box-sizing: border-box;
    width: 1920px;
    height: 1080px;
    padding: 36px 44px 28px;
    background: linear-gradient(160deg, var(--sabtr-bg-deep) 0%, var(--sabtr-surface-2) 55%, var(--sabtr-surface-2) 100%);
    color: var(--sabtr-text-soft);
    font-family: Inter, system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dashboard-pdf-slide-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(30, 61, 96, 0.9);
    padding-bottom: 14px;
}

.dashboard-pdf-slide-brand {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.dashboard-pdf-slide-title {
    margin: 4px 0 0;
    font-size: 34px;
    font-weight: 700;
    color: var(--sabtr-text-strong);
    line-height: 1.15;
}

.dashboard-pdf-slide-meta {
    text-align: right;
    font-size: 14px;
    color: var(--sabtr-text-muted);
    line-height: 1.45;
}

.dashboard-pdf-kpi-row {
    display: flex;
    gap: 14px;
    flex-wrap: nowrap;
}

.dashboard-pdf-kpi {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    border: 1px solid var(--sabtr-border);
    background: rgba(11, 28, 54, 0.85);
    border-radius: 4px;
}

.dashboard-pdf-kpi-label {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.dashboard-pdf-kpi-value {
    margin: 6px 0 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--sabtr-text-strong);
}

.dashboard-pdf-kpi--alert .dashboard-pdf-kpi-value {
    color: #ff8a80;
}

.dashboard-pdf-body {
    flex: 1;
    min-height: 0;
    display: grid;
    gap: 14px;
}

.dashboard-pdf-body--charts-1 {
    grid-template-columns: 1fr;
}

.dashboard-pdf-body--charts-2 {
    grid-template-columns: 1fr 1fr;
}

.dashboard-pdf-body--charts-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.dashboard-pdf-body--charts-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.dashboard-pdf-body--charts-many {
    grid-template-columns: 1fr 1fr 1fr;
}

.dashboard-pdf-body--split {
    grid-template-columns: 1.2fr 1fr;
}

.dashboard-pdf-chart-box {
    position: relative;
    min-height: 0;
    border: 1px solid var(--sabtr-border);
    background: var(--sabtr-bg-deep);
    border-radius: 4px;
    padding: 10px 12px 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-pdf-chart-caption {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.dashboard-pdf-chart-img {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.dashboard-pdf-table-wrap {
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--sabtr-border);
    border-radius: 4px;
    background: var(--sabtr-bg-deep);
}

.dashboard-pdf-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dashboard-pdf-table-wrap th,
.dashboard-pdf-table-wrap td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--sabtr-border);
    text-align: left;
    color: var(--sabtr-text-soft);
    white-space: nowrap;
}

.dashboard-pdf-table-wrap th {
    color: var(--sabtr-text-muted);
    font-weight: 600;
    background: rgba(14, 36, 64, 0.9);
}

.dashboard-pdf-slide-footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6f89a6;
    border-top: 1px solid rgba(30, 61, 96, 0.7);
    padding-top: 10px;
}

.dashboard-tablist {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 0.5px solid var(--sabtr-border);
}

.dashboard-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--sabtr-text-soft);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.85rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -0.5px;
}

.dashboard-tab:hover {
    color: var(--sabtr-text-strong);
}

.dashboard-tab.is-active {
    color: var(--sabtr-text-strong);
    border-bottom-color: var(--sabtr-accent);
}

.dashboard-panel-head {
    margin-bottom: 0.5rem;
}

.dashboard-panel-head-resumen {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-panel-hint {
    margin: 0;
    font-size: 12px;
    color: var(--sabtr-text-muted);
    line-height: 1.45;
}

.gerencia-brief {
    padding: 0.95rem 1.05rem;
    background: linear-gradient(135deg, var(--sabtr-surface) 0%, var(--sabtr-surface-alt) 100%);
    border-left: 3px solid #2a9d8f;
}

.gerencia-brief-kicker {
    margin: 0 0 0.35rem;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.gerencia-brief-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--sabtr-text-soft);
}

.dashboard-filters {
    --filter-control-h: 2.25rem;
    --filter-font-size: 12px;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.5rem 0.65rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.7rem;
    background: var(--sabtr-surface-2);
}

.dashboard-filters > div:not(.dashboard-filter-actions) {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 1 1 0;
    min-width: 0;
}

.dashboard-filter-label {
    display: block;
    margin: 0 0 0.25rem;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-filter-input,
.dashboard-filters select.dashboard-filter-input {
    width: 100%;
    min-width: 0;
    height: var(--filter-control-h);
    min-height: var(--filter-control-h);
    max-height: var(--filter-control-h);
    background: var(--sabtr-surface-alt);
    border: 0.5px solid var(--sabtr-border);
    color: var(--sabtr-text);
    font-size: var(--filter-font-size);
    padding: 0 0.5rem;
    line-height: 1.2;
    box-sizing: border-box;
}

.dashboard-filter-input[type="date"] {
    padding: 0 0.4rem;
    line-height: var(--filter-control-h);
}

.dashboard-filter-input[type="number"] {
    padding-right: 0.35rem;
}

/* Calendario en inputs type=date: forzar icono blanco (Chromium / Safari WebKit) */
.app-body .dashboard-filter-input[type="date"],
.dashboard-filter-input[type="date"] {
    color-scheme: dark;
}

/* SVG blanco explícito: no depende del color del icono del SO */
.app-body .dashboard-filter-input[type="date"]::-webkit-calendar-picker-indicator,
.dashboard-filter-input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 1 !important;
    width: 1.2rem !important;
    height: 1.2rem !important;
    margin: 0 0 0 0.2rem !important;
    padding: 0 !important;
    flex-shrink: 0;
    border: none;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%23ffffff%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Crect%20x%3D%273%27%20y%3D%274%27%20width%3D%2718%27%20height%3D%2718%27%20rx%3D%272%27/%3E%3Cpath%20d%3D%27M16%202v4M8%202v4M3%2010h18%27/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    filter: none !important;
}

.dashboard-filters > .dashboard-filter-actions,
.admin-grid-form > .admin-form-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex: 0 0 auto;
    flex-shrink: 0;
    width: auto;
    min-width: max-content;
    max-width: none;
    margin-left: auto;
    align-self: flex-end;
    white-space: nowrap;
}

.dashboard-filter-actions .btn-primary,
.dashboard-filter-actions .app-btn-ghost,
.admin-grid-form .admin-form-actions .btn-primary {
    height: var(--filter-control-h);
    min-height: var(--filter-control-h);
    width: auto;
    min-width: auto;
    padding: 0 0.75rem;
    font-size: var(--filter-font-size);
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
}

.admin-grid-form .admin-form-actions .app-btn-ghost,
.dashboard-filter-actions .app-btn-ghost {
    height: var(--filter-control-h);
    min-height: var(--filter-control-h);
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

.dashboard-panel {
    display: none;
    padding: 1.25rem;
    min-height: 0;
}

.dashboard-panel.is-active {
    display: block;
}

.dashboard-panel[hidden] {
    display: none !important;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.resumen-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.resumen-kpi-row--gerencia {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 1280px) {
    .resumen-kpi-row--gerencia {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.resumen-kpi-card {
    background: var(--sabtr-surface-alt);
    padding: 0.7rem 0.8rem;
}

a.resumen-kpi-card--link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.resumen-kpi-card--link:hover {
    border-color: var(--sabtr-accent);
    box-shadow: 0 0 0 1px rgba(42, 138, 224, 0.22);
}

.resumen-kpi-label {
    margin: 0 0 0.45rem;
    font-size: 10px;
    color: var(--sabtr-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.resumen-kpi-main {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--sabtr-text-soft);
    font-weight: 500;
}

.resumen-kpi-unit {
    font-size: 1.15rem;
    color: var(--sabtr-text-faint);
}

.resumen-kpi-sub {
    margin: 0.4rem 0 0;
    font-size: 11px;
    line-height: 1.3;
    color: var(--sabtr-text-muted);
}

.resumen-kpi-ok {
    border-left: 2px solid #2a9d8f;
}

.resumen-kpi-ok .resumen-kpi-main {
    color: #8ee0d4;
}

.resumen-kpi-alert {
    border-left: 2px solid #d07d1f;
}

.resumen-kpi-alert .resumen-kpi-main {
    color: #ffb875;
}

.resumen-mid-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.1fr) minmax(320px, 2fr);
    gap: 0.75rem;
}

.resumen-mid-grid--descomp-3 {
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.4fr) minmax(220px, 1fr);
}

.chart-canvas-host-descomp-faenas {
    height: 280px;
    max-height: 280px;
}

.resumen-card {
    background: var(--sabtr-surface-alt);
}

.resumen-centros-list {
    display: grid;
    gap: 0.65rem;
}

.resumen-centro-row {
    display: grid;
    gap: 0.25rem;
}

.resumen-centro-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 12px;
    color: var(--sabtr-text-muted);
}

.resumen-centro-bar {
    height: 9px;
    width: 100%;
    border-radius: 999px;
    background: var(--sabtr-surface-2);
    overflow: hidden;
}

.resumen-centro-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sabtr-text-muted) 0%, #a9d0ff 100%);
}

.kpi-card {
    padding: 0.75rem;
    background: var(--sabtr-surface-deep);
}

.kpi-label {
    margin: 0 0 0.25rem;
    font-size: 10px;
    color: var(--sabtr-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kpi-value {
    margin: 0;
    font-size: 24px;
    color: var(--sabtr-text-strong);
    font-weight: 600;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.dashboard-charts .panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.chart-canvas-host {
    position: relative;
    height: 280px;
    max-height: 280px;
    width: 100%;
    overflow: hidden;
}

.chart-canvas-host-small {
    height: 240px;
    max-height: 240px;
}

.chart-canvas-host--detalle-bar canvas {
    cursor: pointer;
}

.admin-table--auditoria .aud-detalle code {
    font-size: 11px;
    word-break: break-all;
    color: var(--sabtr-text-muted);
}
.admin-table--auditoria .aud-accion--csv_export,
.admin-table--auditoria .aud-accion--csv_export_denegado {
    color: #fff59d;
}

/* Dispersión: controles de rango de ejes */
.dispersion-axis-controls {
    padding: 0.5rem 0.6rem;
    background: var(--sabtr-surface-2);
    font-size: 11px;
}

.dispersion-axis-title {
    margin: 0 0 0.4rem;
    color: var(--sabtr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
}

.dispersion-axis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.5rem;
}

.dispersion-axis-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--sabtr-text-muted);
    font-size: 10px;
}

.dispersion-input {
    width: 100%;
    background: var(--sabtr-surface-alt);
    border: 0.5px solid var(--sabtr-border);
    color: var(--sabtr-text);
    font-size: 12px;
    padding: 0.3rem 0.4rem;
}

.dispersion-apply,
.dispersion-reset {
    font-size: 11px;
    margin-right: 0.5rem;
    margin-top: 0.35rem;
}

.dispersion-table-wrap {
    overflow: auto;
    max-height: min(420px, 55vh);
    margin-top: 0.75rem;
    border: 0.5px solid var(--sabtr-border);
    border-radius: 4px;
}

.dispersion-table-wrap .admin-table {
    font-size: 11px;
}

.dispersion-table-wrap .admin-table th,
.dispersion-table-wrap .admin-table td {
    padding: 0.35rem 0.45rem;
    white-space: nowrap;
}

.dispersion-table-wrap .admin-table td.dispersion-cell-wrap {
    white-space: normal;
    max-width: 12rem;
}

tr.dispersion-row {
    cursor: pointer;
}

tr.dispersion-row:hover {
    background: rgba(94, 168, 255, 0.06);
}

tr.dispersion-row--selected {
    outline: 2px solid #ffeb3b;
    background: rgba(255, 235, 59, 0.14);
}

tr.dispersion-row--filtered-out {
    display: none;
}

tr.descomp-row--no-cumple > td {
    background: rgba(255, 107, 107, 0.08);
}

/* Tiempos: facetas + apilado */
.tiempos-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.tiempos-facet-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.tiempos-facet-cell {
    min-width: 0;
}

.tiempos-facet-title {
    margin: 0 0 0.35rem;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
    line-height: 1.25;
    min-height: 2.2em;
}

.chart-canvas-host-tiempos-facet {
    height: 200px;
    max-height: 200px;
}

.chart-canvas-host-tiempos-facet canvas {
    max-height: 200px !important;
}

.chart-canvas-host-tiempos-stacked {
    height: 300px;
    max-height: 300px;
}

.chart-canvas-host-tiempos-stacked canvas {
    max-height: 300px !important;
}

.admin-table-tiempos-matrix th.text-center,
.admin-table-tiempos-matrix td.text-center {
    text-align: center;
}

@media (max-width: 1100px) {
    .tiempos-top-grid {
        grid-template-columns: 1fr;
    }
}

/* Por centro: mapa Leaflet + tablas */
.dashboard-map-host {
    height: 420px;
    width: 100%;
    min-height: 280px;
    background: var(--sabtr-surface-2);
    border-radius: 4px;
    z-index: 0;
}

.dashboard-map-host .leaflet-container {
    font-family: inherit;
    background: var(--sabtr-surface-2);
}

.dashboard-map-empty {
    padding: 1.25rem 1.5rem;
    margin: 0;
}

.centros-tables-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.table-name-sub {
    font-size: 0.78em;
    line-height: 1.35;
}

@media (max-width: 960px) {
    .centros-tables-grid {
        grid-template-columns: 1fr;
    }
}

.chart-canvas-host canvas {
    display: block;
    max-height: 280px !important;
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 1440px) and (max-height: 900px) {
    .app-content {
        padding: 0.8rem;
    }

    .dashboard-panel {
        padding: 0.8rem;
    }

    .resumen-kpi-row {
        gap: 0.45rem;
    }

    .resumen-kpi-card {
        padding: 0.55rem 0.65rem;
    }

    .resumen-kpi-main {
        font-size: 1.45rem;
    }

    .resumen-mid-grid {
        gap: 0.55rem;
    }

    .resumen-mid-grid--descomp-3 {
        grid-template-columns: 1fr;
    }

    .chart-canvas-host-descomp-faenas {
        height: 220px;
        max-height: 220px;
    }

    .resumen-card {
        padding: 0.8rem !important;
    }

    .chart-canvas-host {
        height: 180px;
        max-height: 180px;
    }

    .chart-canvas-host-small {
        height: 160px;
        max-height: 160px;
    }

    .chart-canvas-host canvas {
        max-height: 180px !important;
    }

    .dashboard-filters,
    .admin-grid-form {
        gap: 0.4rem 0.5rem;
        padding: 0.45rem 0.5rem;
    }

    .admin-table th,
    .admin-table td {
        padding-top: 0.42rem;
        padding-bottom: 0.42rem;
    }
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

/* Login: fondo con imagen + velo azul */
.login-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.login-page__photo {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1.02);
}

.login-page__shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: var(--sabtr-login-shade);
}

.login-page__main {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-brand-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 0 0.35rem;
    padding: 0;
    line-height: 0;
}

/* Fila centrada: el ancho real es solo el logo; ANALYTICS va al costado sin descentrar el PNG */
.login-brand-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    padding: 0 0.25rem;
    box-sizing: border-box;
}

.login-brand-logo-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    margin: 0 auto;
}

.login-brand-analytics {
    position: absolute;
    left: 100%;
    bottom: 0.35rem;
    margin-left: 0.35rem;
    font-family: Inter, system-ui, sans-serif;
    font-size: clamp(0.58rem, 2vw, 0.78rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #c9a03a;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.35);
}

.login-brand-rule {
    width: 100%;
    max-width: 100%;
    height: 2px;
    margin: 0.4rem auto 0;
    border: 0;
    border-radius: 1px;
    background: linear-gradient(
        90deg,
        rgba(232, 244, 255, 0.45) 0%,
        rgba(232, 244, 255, 0.12) 38%,
        #c9a03a 52%,
        #d4b44a 100%
    );
}

/* Pantallas muy angostas: ANALYTICS debajo para no desbordar la tarjeta */
@media (max-width: 380px) {
    .login-brand-analytics {
        position: static;
        display: block;
        text-align: center;
        margin: 0.35rem 0 0;
        padding: 0;
    }

    .login-brand-logo-wrap {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

.login-system-logo {
    width: auto;
    max-width: min(200px, 58vw);
    height: auto;
    max-height: 168px;
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
    padding: 0;
}

/* Login (layout público con Tailwind + utilidades locales) */
.login-card {
    background-color: rgba(15, 34, 64, 0.78);
    border-color: rgba(30, 61, 96, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.input-field {
    background-color: var(--sabtr-surface-deep);
    border: 0.5px solid var(--sabtr-border);
    color: var(--sabtr-text);
    caret-color: var(--sabtr-accent);
}

.input-field::placeholder {
    color: var(--sabtr-text-faint);
}

.input-field:focus {
    border-color: var(--sabtr-accent);
    box-shadow: 0 0 0 1px var(--sabtr-accent);
    outline: none;
}

/* Login: texto siempre legible (Tailwind Forms / autofill no deben dejar blanco sobre blanco) */
.login-card .input-field,
.login-card input.input-field {
    color: var(--sabtr-text);
    background-color: #121f35;
}

.login-card .input-field:-webkit-autofill,
.login-card .input-field:-webkit-autofill:hover,
.login-card .input-field:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--sabtr-text);
    caret-color: var(--sabtr-accent);
    box-shadow: 0 0 0 1000px #121f35 inset;
    transition: background-color 99999s ease-out;
}

.password-field__input {
    padding-right: 2.75rem !important;
}

.password-toggle {
    position: absolute;
    right: 0.15rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--sabtr-text-muted);
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--sabtr-text);
}

.password-toggle .material-symbols-outlined {
    font-size: 1.25rem;
}

@media (max-width: 900px) {
    .resumen-kpi-row {
        grid-template-columns: 1fr;
    }

    .resumen-kpi-row--gerencia {
        grid-template-columns: 1fr 1fr;
    }

    .resumen-mid-grid {
        grid-template-columns: 1fr;
    }
}

/* Superadmin: datos por empresa — ancho completo y uso del viewport */
.app-content:has(.admin-page--empresa-buceos) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: clamp(0.5rem, 1.8vw, 1.25rem);
}

.admin-page--empresa-buceos {
    max-width: none;
    width: 100%;
    margin-inline: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    box-sizing: border-box;
}

.admin-page--empresa-buceos .eb-grid-card > .section-title,
.admin-page--empresa-buceos .eb-grid-card > .admin-page-subtitle,
.admin-page--empresa-buceos .eb-grid-card > .admin-pagination-wrap {
    flex-shrink: 0;
}

.eb-hist-comment {
    max-width: 18rem;
    white-space: normal;
    word-break: break-word;
}
.eb-hist-val {
    max-width: 14rem;
    white-space: normal;
    word-break: break-word;
}
.eb-hist-empty {
    text-align: center;
    color: var(--sabtr-text-muted);
    padding: 1.25rem 0.5rem;
}
.eb-hist-null {
    opacity: 0.65;
}

.admin-page--empresa-buceos .admin-card.eb-grid-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
}

.admin-page--empresa-buceos .eb-leyenda-alerta-tf {
    color: #fff59d;
}

/* Dos gráficos de dispersión en fila (Datos por empresa) */
.admin-page--empresa-buceos .eb-dispersion-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    width: 100%;
}

.admin-page--empresa-buceos .eb-dispersion-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .admin-page--empresa-buceos .eb-dispersion-pair {
        grid-template-columns: 1fr;
    }
}

.admin-page--empresa-buceos .eb-grid-card .eb-table-wrap {
    flex: 1;
    min-height: 12rem;
    max-width: none;
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-page--empresa-buceos .chart-canvas-host.chart-canvas-host-empresa-buceos {
    flex-shrink: 0;
    height: clamp(200px, 34vh, 580px);
    max-height: none;
    min-height: 200px;
    width: 100%;
}

.admin-page--empresa-buceos .chart-canvas-host.chart-canvas-host-empresa-buceos {
    overflow: visible;
}

.admin-page--empresa-buceos .chart-canvas-host.chart-canvas-host-empresa-buceos canvas {
    max-height: none !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 200px;
}

@media (max-width: 720px) {
    .admin-page--empresa-buceos .chart-canvas-host.chart-canvas-host-empresa-buceos {
        height: clamp(180px, 38vh, 420px);
    }
}

@media (max-width: 1440px) and (max-height: 900px) {
    .admin-page--empresa-buceos .chart-canvas-host.chart-canvas-host-empresa-buceos {
        height: clamp(160px, 30vh, 400px);
        min-height: 160px;
    }
}

tr.eb-row[data-buceo-id] {
    cursor: pointer;
}

tr.eb-row[data-buceo-id]:hover {
    background: rgba(94, 168, 255, 0.06);
}

tr.eb-row--selected {
    outline: 2px solid #ffeb3b;
    background: rgba(255, 235, 59, 0.14);
}

tr.eb-row--filtered-out {
    display: none;
}

tr.eb-row--alerta-tf-buceo > td {
    background: rgba(255, 235, 100, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 200, 60, 0.35);
}

tr.eb-row--incidencia > td:first-child {
    font-weight: 600;
}

.eb-leyenda-muestra {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.eb-leyenda-muestra--tf {
    background: rgba(255, 235, 100, 0.35);
    color: #ffe9a0;
}

tr.eb-row--selected.eb-row--alerta-tf-buceo > td {
    background: rgba(255, 230, 120, 0.32);
    box-shadow: inset 0 0 0 1px rgba(255, 235, 59, 0.65);
}

tr.eb-row--inactive {
    opacity: 0.88;
}

tr.eb-row--inactive .eb-badge--off {
    opacity: 1;
}

.eb-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.eb-badge--ok {
    background: rgba(72, 180, 120, 0.25);
    color: #9ee6c0;
    border: 1px solid rgba(72, 180, 120, 0.45);
}

.eb-badge--off {
    background: rgba(200, 120, 80, 0.2);
    color: #f0c4a8;
    border: 1px solid rgba(200, 120, 80, 0.4);
}

.eb-table td.eb-actions-cell {
    white-space: nowrap;
    vertical-align: middle;
}

.eb-row-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
}

.eb-row-actions .eb-save-row,
.eb-row-actions .admin-icon-btn {
    flex-shrink: 0;
}

.eb-table-wrap {
    overflow-x: auto;
    max-width: 100%;
}

.eb-table .admin-input {
    min-width: 4.5rem;
    font-size: 11px;
    padding: 0.25rem 0.35rem;
}

.eb-table td:last-child:not(.eb-actions-cell) {
    white-space: nowrap;
}

.eb-pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.admin-pagination-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
}

.admin-pagination-summary {
    margin: 0;
    font-size: 0.875rem;
    color: var(--sabtr-text-muted);
}

.admin-pagination.admin-pagination {
    gap: 0.35rem;
}

.admin-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sabtr-text-soft);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-pagination__page:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--sabtr-text-soft);
}

.admin-pagination__page.is-active {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.45);
    color: var(--sabtr-text-muted);
    cursor: default;
}

.admin-pagination__edge.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.admin-pagination__gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    color: #6b7f92;
    font-size: 0.875rem;
    user-select: none;
}

.eb-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.eb-modal[hidden] {
    display: none !important;
}

.eb-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 10, 20, 0.72);
}

.eb-modal__box {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 1.25rem;
    background: var(--sabtr-surface);
    color: var(--sabtr-text);
    box-shadow: 0 18px 48px rgba(4, 16, 32, 0.35);
}

.eb-modal__box--edit {
    width: min(720px, 100%);
}

.eb-modal__box--historial {
    width: min(960px, 100%);
}

.eb-historial-table-wrap {
    max-height: min(52vh, 420px);
    overflow: auto;
}

.eb-historial-table .hc-comment,
.eb-historial-table td:nth-child(5) {
    max-width: 14rem;
    white-space: normal;
    word-break: break-word;
}

.eb-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.eb-edit-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1.25rem;
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(120, 170, 220, 0.28);
    border-radius: 8px;
    background: rgba(8, 24, 48, 0.45);
}

.eb-edit-meta__item {
    margin: 0;
}

.eb-edit-meta__item--full {
    grid-column: 1 / -1;
}

.eb-edit-meta-fecha-buzo {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 0.75rem 1.25rem;
    align-items: start;
}

.eb-edit-meta-fecha-buzo__left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.eb-edit-meta__item--tight {
    margin-top: -0.15rem;
}

.eb-edit-meta__item--tight + .eb-edit-meta__item--tight {
    margin-top: -0.35rem;
}

.eb-edit-meta__item--tight dt {
    margin-bottom: 0.05rem;
}

.eb-edit-meta__item--tight dd {
    line-height: 1.25;
}

.eb-edit-incidencias {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.eb-edit-incidencias__legend {
    margin: 0 0 0.45rem;
    padding: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.eb-edit-incidencia-check {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 0 0 0.35rem;
    font-size: 12px;
    line-height: 1.35;
    color: var(--sabtr-text-soft);
    cursor: pointer;
}

.eb-edit-incidencia-check:last-child {
    margin-bottom: 0;
}

.eb-edit-incidencia-check__input {
    margin: 0.15rem 0 0;
    flex-shrink: 0;
    accent-color: #3d8fd4;
}

.eb-edit-incidencia-check__label {
    flex: 1;
    min-width: 0;
}

.eb-edit-meta dt {
    margin: 0 0 0.2rem;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.eb-edit-meta dd {
    margin: 0;
    font-size: 13px;
    color: var(--sabtr-text-soft);
    word-break: break-word;
}

.admin-page--velocidades-buceos .dashboard-filters {
    flex-wrap: wrap;
}

.admin-page--velocidades-buceos .dashboard-filters > div:not(.dashboard-filter-actions) {
    flex: 1 1 7.5rem;
    min-width: 7.25rem;
    max-width: 12rem;
}

@media (max-width: 640px) {
    .admin-page--velocidades-buceos .dashboard-filters > div:not(.dashboard-filter-actions) {
        flex: 1 1 100%;
        max-width: none;
    }
}

.admin-table--velocidades th:nth-child(n+9),
.admin-table--velocidades td:nth-child(n+9) {
    text-align: right;
    white-space: nowrap;
}

.vb-cell-promedio {
    font-weight: 600;
}

.vb-row--sin-velocidad td {
    opacity: 0.72;
}

.vb-row--clickable {
    cursor: pointer;
}

.vb-row--clickable:hover td,
.vb-row--clickable:focus td {
    background: rgba(232, 197, 71, 0.08);
}

.vb-row--clickable:focus {
    outline: 2px solid rgba(232, 197, 71, 0.45);
    outline-offset: -2px;
}

body.vb-modal-open {
    overflow: hidden;
}

#vb-modal-perfil.eb-modal,
#eb-modal-perfil-sabtr.eb-modal {
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem;
}

#eb-modal-perfil-sabtr.eb-modal {
    padding-top: 4.5rem;
}

#eb-modal-perfil-sabtr .eb-modal__box--perfil {
    max-height: calc(100vh - 6rem);
}

.eb-perfil-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin: 0 0 0.85rem;
}

.eb-perfil-nav__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(120, 170, 220, 0.35);
    background: rgba(8, 22, 42, 0.85);
    color: var(--sabtr-text-soft);
    cursor: pointer;
}

.eb-perfil-nav__btn .material-symbols-outlined {
    font-size: 1.35rem;
}

.eb-perfil-nav__btn:hover:not(:disabled) {
    background: rgba(42, 138, 224, 0.22);
    border-color: rgba(42, 138, 224, 0.55);
}

.eb-perfil-nav__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.eb-perfil-nav__label {
    min-width: 6.5rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--sabtr-text-soft);
}

.eb-modal__box--perfil {
    width: min(1240px, calc(100vw - 1.5rem));
    max-height: calc(100vh - 1.5rem);
    margin: 0 auto;
    overflow-y: auto;
}

.vb-perfil-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem 1rem;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--sabtr-border);
    border-radius: 8px;
    background: var(--sabtr-surface-2);
    color: var(--sabtr-text);
}

.vb-perfil-meta dt {
    margin: 0;
    font-size: 0.7rem;
    color: var(--sabtr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.vb-perfil-meta dd {
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
    color: var(--sabtr-text-strong);
}

.vb-perfil-chart-wrap {
    position: relative;
    width: 100%;
    max-height: min(32vh, 300px);
    padding: 0.5rem 0.35rem;
    background: #3a3f44;
    border-radius: 8px;
    border: 1px solid rgba(120, 170, 220, 0.2);
    overflow: hidden;
}

.vb-perfil-chart {
    width: 100%;
    max-height: min(32vh, 300px);
}

.vb-perfil-svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(32vh, 300px);
}

.eb-perfil-sabtr-chart-wrap.vb-perfil-chart-wrap,
.eb-perfil-sabtr-chart-wrap .vb-perfil-chart,
.eb-perfil-sabtr-chart-wrap .vb-perfil-svg {
    max-height: min(42vh, 380px);
}

@media (max-width: 900px) {
    .eb-modal__box--perfil {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        padding: 1rem;
    }

    .vb-perfil-meta {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.4rem 0.75rem;
        padding: 0.65rem 0.75rem;
    }

    .vb-perfil-chart-wrap,
    .vb-perfil-chart,
    .vb-perfil-svg {
        max-height: min(28vh, 220px);
    }

    .eb-perfil-sabtr-chart-wrap.vb-perfil-chart-wrap,
    .eb-perfil-sabtr-chart-wrap .vb-perfil-chart,
    .eb-perfil-sabtr-chart-wrap .vb-perfil-svg {
        max-height: min(36vh, 280px);
    }

    .vb-perfil-legend__box {
        font-size: 0.72rem;
    }
}

@media (max-width: 640px) {
    #vb-modal-perfil.eb-modal,
    #eb-modal-perfil-sabtr.eb-modal {
        padding: 0.5rem;
    }

    #eb-modal-perfil-sabtr.eb-modal {
        padding-top: 3.25rem;
    }

    #eb-modal-perfil-sabtr .eb-modal__box--perfil {
        max-height: calc(100vh - 4.25rem);
    }

    .eb-modal__box--perfil .eb-modal__head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .vb-perfil-chart-wrap,
    .vb-perfil-chart,
    .vb-perfil-svg {
        max-height: min(24vh, 180px);
    }
}

.vb-perfil-legend__box {
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--sabtr-text-muted);
}

.vb-perfil-legend__item {
    margin: 0 0 0.5rem;
}

.vb-perfil-legend__item:last-child {
    margin-bottom: 0;
}

.vb-perfil-tooltip {
    position: absolute;
    z-index: 5;
    max-width: min(320px, calc(100% - 1rem));
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid rgba(120, 170, 220, 0.45);
    background: rgba(8, 20, 38, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    font-size: 0.78rem;
    line-height: 1.4;
    color: #e8f2ff;
    pointer-events: none;
}

.vb-perfil-tooltip[hidden] {
    display: none !important;
}

.vb-perfil-tooltip p {
    margin: 0 0 0.25rem;
}

.vb-perfil-tooltip p:last-child {
    margin-bottom: 0;
}

.vb-tip-title {
    font-weight: 600;
    color: #e8c547;
    margin-bottom: 0.35rem !important;
}

.vb-tip-k {
    color: var(--sabtr-text-muted);
}

.vb-chart-node,
.vb-chart-seg {
    cursor: help;
}

.vb-chart-node:focus {
    outline: none;
}

.vb-chart-node:focus .vb-chart-node-dot,
.vb-chart-node.is-hovered .vb-chart-node-dot {
    stroke: #e8c547;
    stroke-width: 3;
    filter: drop-shadow(0 0 4px rgba(232, 197, 71, 0.65));
}

.vb-chart-seg.is-hovered .vb-chart-seg-line {
    stroke-width: 6;
    filter: drop-shadow(0 0 3px rgba(232, 197, 71, 0.5));
}

.vb-perfil-nodes-index {
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--sabtr-text-muted);
}

.vb-perfil-nodes-index__title {
    margin: 0 0 0.5rem;
    font-weight: 600;
    color: var(--sabtr-text);
}

.vb-perfil-nodes-index__list {
    margin: 0;
    padding-left: 1.25rem;
}

.vb-perfil-nodes-index__list li {
    margin-bottom: 0.2rem;
}

.eb-edit-velocidades-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1.25rem;
    margin: 0.75rem 0 0;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(120, 170, 220, 0.28);
    border-radius: 8px;
    background: rgba(8, 24, 48, 0.45);
}

.eb-edit-velocidades-grid[hidden] {
    display: none;
}

.eb-edit-velocidades__item {
    margin: 0;
}

.eb-edit-velocidades__item dt {
    margin: 0 0 0.2rem;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.eb-edit-velocidades__item dd {
    margin: 0;
    font-size: 13px;
    color: var(--sabtr-text-soft);
}

.eb-edit-velocidades__item--promedio dd {
    font-weight: 600;
    color: var(--sabtr-text-muted);
}

.eb-edit-velocidades-empty[hidden] {
    display: none;
}

.eb-edit-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}

.eb-edit-form-grid--full {
    grid-column: 1 / -1;
}

.eb-btn-icon {
    font-size: 1.15rem;
    vertical-align: middle;
    margin-right: 0.25rem;
}

.admin-icon-btn--save:hover {
    border-color: rgba(100, 200, 255, 0.55);
    color: var(--sabtr-text);
    background: rgba(18, 48, 72, 0.55);
}

.eb-modal-textarea {
    width: 100%;
    min-height: 6rem;
    resize: vertical;
}

.eb-modal-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Dashboard — ranking incidencias supervisores */
.dash-th-with-tip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.dash-tip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(120, 170, 220, 0.45);
    border-radius: 50%;
    background: rgba(12, 36, 64, 0.8);
    color: var(--sabtr-text-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    vertical-align: middle;
}

.dash-tip-btn:hover,
.dash-tip-btn:focus-visible {
    color: var(--sabtr-text-soft);
    border-color: #5a9fd4;
    outline: none;
}

.ranking-inc-calc-help {
    padding: 0.75rem 1rem;
    background: rgba(8, 24, 48, 0.4);
}

.ranking-inc-calc-help__summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--sabtr-text-muted);
    list-style: none;
}

.ranking-inc-calc-help__summary::-webkit-details-marker {
    display: none;
}

.ranking-inc-calc-help__body {
    margin-top: 0.75rem;
    font-size: 12px;
    line-height: 1.5;
    color: var(--sabtr-text-soft);
}

.ranking-inc-calc-help__list {
    margin: 0.35rem 0 0 1.1rem;
    padding: 0;
}

.ranking-inc-calc-help__note {
    margin: 0.5rem 0 0;
    font-size: 11px;
    color: var(--sabtr-text-muted);
}

.ranking-inc-table .ranking-inc-nivel-badge {
    display: inline-block;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.ranking-inc-prelim {
    margin-left: 0.15rem;
    color: #e8c96a;
    font-weight: 700;
    cursor: help;
}

.ranking-inc-breakdown {
    font-size: 11px;
}

.ranking-inc-breakdown__summary {
    cursor: pointer;
    color: var(--sabtr-text-muted);
    list-style: none;
}

.ranking-inc-breakdown__summary::-webkit-details-marker {
    display: none;
}

.ranking-inc-breakdown__list {
    margin: 0.35rem 0 0;
    padding: 0 0 0 0.85rem;
    color: var(--sabtr-text-muted);
}

.ranking-inc-table--secondary {
    opacity: 0.92;
}

.ranking-inc-table .app-btn-ghost {
    padding: 0.2rem 0.5rem;
    font-size: 11px;
}

/* Admin — historial de cambios (superadmin) */
.admin-page--historial-cambios .hc-comment {
    max-width: 14rem;
    word-break: break-word;
    font-size: 12px;
}

.admin-page--historial-cambios .hc-actions-cell {
    white-space: nowrap;
}

.hc-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 12px;
    color: var(--sabtr-text-soft);
    cursor: pointer;
}

.hc-check input {
    margin-top: 0.15rem;
    accent-color: #3d8fd4;
}

.hc-meta-value {
    margin: 0.25rem 0 0;
    font-size: 14px;
    color: var(--sabtr-text-soft);
}

.hc-delete-summary {
    font-size: 12px;
    color: var(--sabtr-text-muted);
    line-height: 1.45;
}

.hc-buceo-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--sabtr-text-muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hc-buceo-link:hover {
    color: var(--sabtr-text-muted);
}

.hc-view-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.hc-view-section {
    padding: 0.85rem 1rem;
    border: 1px solid var(--sabtr-border);
    border-radius: 6px;
    background: var(--sabtr-surface-2);
    color: var(--sabtr-text);
}

.hc-view-section--hist {
    background: var(--sabtr-surface-alt);
}

.hc-view-buceo {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
}

.hc-view-buceo__item {
    margin: 0;
}

.hc-view-buceo__item dt {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.hc-view-buceo__item dd {
    margin: 0.2rem 0 0;
    font-size: 14px;
    color: var(--sabtr-text-soft);
    word-break: break-word;
}

.hc-view-incidencia-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hc-view-incidencia-chip {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 12px;
    color: #fde68a;
    background: rgba(180, 120, 40, 0.28);
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.hc-view-hist-row--current td {
    background: rgba(61, 143, 212, 0.18);
}

body.app-body--staging .hc-buceo-link {
    color: var(--sabtr-text-muted);
}

body.app-body--staging .hc-buceo-link:hover {
    color: var(--sabtr-text-muted);
}

body.app-body--staging .hc-view-buceo__item dt {
    color: var(--st-text-muted, #3f3f46);
}

body.app-body--staging .hc-view-buceo__item dd {
    color: var(--st-text, #18181b);
}

body.app-body--staging .hc-view-section,
body.app-body--staging .vb-perfil-meta {
    border-color: var(--st-border, #d4d4d8);
    background: var(--st-surface-2, #f4f4f5);
    color: var(--st-text, #18181b);
}

/* --- Ambiente de pruebas: tokens --st-* viven en theme.css (claro/oscuro) --- */
.env-staging-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(90deg, #fde047 0%, #fbbf24 25%, #f59e0b 50%, #ea580c 75%, #f59e0b 100%);
    border-bottom: 2px solid #c2410c;
    color: #431407;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35);
}

.env-staging-banner__hint {
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: #7c2d12;
    font-size: 10px;
}

body.app-body--staging {
    padding-top: 2rem;
    background: var(--st-bg);
    color: var(--st-text);
}

body.app-body--staging .app-topbar {
    top: 2rem;
}

body.app-body--staging .app-nav-toggle,
body.app-body--staging .app-sidebar-close {
    color: var(--st-text);
}

body.app-body--staging .app-shell {
    min-height: calc(100vh - 2rem);
}

body.app-body--staging .technical-border,
body.app-body--staging .admin-alert,
body.app-body--staging .admin-card,
body.app-body--staging .admin-page.technical-border.panel,
body.app-body--staging .admin-input,
body.app-body--staging .app-select,
body.app-body--staging .dashboard-filters,
body.app-body--staging .dashboard-filter-input,
body.app-body--staging .admin-table-wrap,
body.app-body--staging .chart-canvas-host,
body.app-body--staging .resumen-kpi-card,
body.app-body--staging .resumen-card.panel {
    border-color: var(--st-border);
}

body.app-body--staging .app-sidebar,
body.app-body--staging .app-topbar {
    background: var(--st-surface);
    box-shadow: 0 1px 0 var(--st-border);
}

body.app-body--staging .admin-card,
body.app-body--staging .admin-page.technical-border.panel,
body.app-body--staging .resumen-kpi-card,
body.app-body--staging .resumen-card.panel,
body.app-body--staging .dashboard-filters {
    background: var(--st-surface);
}

body.app-body--staging .app-main {
    background: var(--st-bg);
}

body.app-body--staging .app-sidebar-brand {
    border-bottom-color: var(--st-border);
}

body.app-body--staging .app-sidebar-title,
body.app-body--staging .app-nav-link,
body.app-body--staging .app-user-meta,
body.app-body--staging .app-user-empresa,
body.app-body--staging .app-inline-label,
body.app-body--staging .admin-page-title,
body.app-body--staging .admin-table td,
body.app-body--staging .admin-table th,
body.app-body--staging .dashboard-panel-hint,
body.app-body--staging .admin-page-subtitle,
body.app-body--staging .hc-check,
body.app-body--staging .hc-meta-value {
    color: var(--st-text);
}

body.app-body--staging .app-nav-group,
body.app-body--staging .section-title,
body.app-body--staging .dashboard-filter-label,
body.app-body--staging .admin-grid-form > div > .section-title,
body.app-body--staging .text-muted {
    color: var(--st-text-muted);
}

body.app-body--staging .app-nav-link:hover {
    color: var(--st-text);
    background: var(--st-accent-soft);
}

body.app-body--staging .app-nav-link.is-active {
    color: var(--st-text);
    background: var(--st-accent-soft);
    border-left-color: var(--st-accent);
}

body.app-body--staging .admin-input,
body.app-body--staging .app-select,
body.app-body--staging .dashboard-filter-input {
    background: var(--st-input-bg);
    color: var(--st-text);
}

body.app-body--staging .btn-primary {
    background: var(--st-accent);
    color: #fff;
}

body.app-body--staging .btn-primary:hover {
    background: var(--st-accent-hover);
}

body.app-body--staging .btn-secondary {
    color: var(--st-text);
    border-color: var(--st-border);
}

body.app-body--staging .btn-secondary:hover {
    border-color: var(--st-accent);
    background: var(--st-accent-soft);
}

body.app-body--staging .app-btn-ghost {
    border-color: var(--st-border-strong);
    color: var(--st-text);
    background: var(--st-surface-2);
}

body.app-body--staging .app-btn-ghost:hover,
body.app-body--staging .app-btn-ghost:focus-visible {
    border-color: var(--st-border-strong);
    color: #fafafa;
    background: #52525b;
}

body.app-body--staging a.resumen-sup-to-detalle,
body.app-body--staging a.resumen-kpi-card--link {
    border-color: var(--st-border);
    color: var(--st-accent);
}

body.app-body--staging .resumen-kpi-main,
body.app-body--staging .resumen-kpi-label {
    color: var(--st-text);
}

body.app-body--staging .admin-table thead th {
    background: var(--st-surface-2);
    color: var(--st-text-muted);
}

body.app-body--staging .admin-table tbody tr:hover td {
    background: var(--st-surface-2);
}

body.app-body--staging .admin-alert-ok {
    background: #3d5c48;
    color: #d1fae5;
    border-color: #6b9080;
}

body.app-body--staging .admin-alert-error {
    background: #6b3a3a;
    color: #fecaca;
    border-color: #9f6060;
}

body.app-body--staging .admin-input-tip {
    background: var(--st-surface);
    color: var(--st-text);
    border-color: var(--st-border-strong);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

body.app-body--staging .dash-tip-btn {
    border-color: var(--st-border-strong);
    background: var(--st-surface-2);
    color: var(--st-accent);
}

body.app-body--staging .dash-tip-btn:hover,
body.app-body--staging .dash-tip-btn:focus-visible {
    color: #fafafa;
    border-color: var(--st-border-strong);
}

body.public-body--staging {
    padding-top: 2rem;
    background: var(--st-bg) !important;
    color: var(--st-text) !important;
}

body.public-body--staging .login-page__shade {
    background: linear-gradient(135deg, rgba(39, 39, 42, 0.92) 0%, rgba(24, 24, 27, 0.88) 100%);
}

body.public-body--staging .login-card.technical-border {
    border-color: var(--st-border-strong);
    background: rgba(63, 63, 70, 0.97);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

body.public-body--staging .login-brand-rule {
    background: linear-gradient(90deg, transparent, #a1a1aa, transparent);
}

body.public-body--staging .login-page__main h2,
body.public-body--staging .login-page__main label {
    color: var(--st-text) !important;
}

body.public-body--staging .login-page__main p.text-\[\var(--sabtr-text-muted)\] {
    color: var(--st-text-muted) !important;
}

/* --- Riesgos: reporte ascensos rápidos --- */
.app-content:has(.admin-page--riesgos) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: clamp(0.5rem, 1.8vw, 1.25rem);
}

.admin-page--riesgos {
    max-width: none;
    width: 100%;
    margin-inline: 0;
    box-sizing: border-box;
}

.admin-page--riesgos .dashboard-filters {
    width: 100%;
}

.riesgos-hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: var(--sabtr-surface-alt);
}

.riesgos-hero__eyebrow {
    display: block;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
    margin-bottom: 0.35rem;
}

.riesgos-hero__title {
    margin: 0 0 0.4rem;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--sabtr-text-soft);
}

.riesgos-hero__periodo {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    background: var(--sabtr-surface-2);
    min-width: min(100%, 280px);
}

.riesgos-hero__periodo .material-symbols-outlined {
    color: #6eb5ff;
    font-size: 1.5rem;
}

.riesgos-hero__periodo-label {
    margin: 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sabtr-text-muted);
}

.riesgos-hero__periodo-value {
    margin: 0.15rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sabtr-text-soft);
}

.riesgos-hero__periodo-meta {
    margin: 0.25rem 0 0;
    font-size: 11px;
    color: var(--sabtr-text-muted);
}

.riesgos-kpi-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.6rem;
}

.riesgos-kpi-card {
    position: relative;
    padding-top: 2rem;
}

.riesgos-kpi-icon {
    position: absolute;
    top: 0.65rem;
    right: 0.7rem;
    font-size: 1.25rem;
    color: #6eb5ff;
    opacity: 0.85;
}

.riesgos-kpi-card--alerta {
    border-left: 2px solid #e05c5c;
}

.riesgos-kpi-card--alerta .resumen-kpi-main {
    color: #ffb4b4;
}

.riesgos-mid-grid,
.riesgos-bottom-grid {
    display: grid;
    gap: 0.75rem;
}

.riesgos-mid-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr) minmax(240px, 0.82fr);
}

.riesgos-bottom-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.riesgos-panel--centros {
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.riesgos-panel {
    background: var(--sabtr-surface-alt);
    padding: 0.85rem 0.95rem;
    min-height: 200px;
}

.riesgos-panel__title {
    margin: 0 0 0.75rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.riesgos-panel__empty {
    margin: 0;
    font-size: 13px;
}

.riesgos-inline-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.riesgos-inline-bar__track {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: var(--sabtr-surface-2);
    overflow: hidden;
}

.riesgos-inline-bar__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.riesgos-inline-bar__val {
    font-size: 12px;
    color: var(--sabtr-text-soft);
    min-width: 1.5rem;
    text-align: right;
}

.riesgos-bar--verde {
    background: linear-gradient(90deg, #3d8f5a 0%, #5cb87a 100%);
}

.riesgos-bar--amarillo {
    background: linear-gradient(90deg, #b8922a 0%, #e8c547 100%);
}

.riesgos-bar--naranja {
    background: linear-gradient(90deg, #c46a1f 0%, #f0a04a 100%);
}

.riesgos-bar--rojo {
    background: linear-gradient(90deg, #b83a3a 0%, #e86a6a 100%);
}

.riesgos-buzo-name {
    font-size: 12px;
    color: var(--sabtr-text-soft);
}

.riesgos-podium__label {
    margin: 0 0 0.5rem;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sabtr-text-muted);
}

.riesgos-podium__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.riesgos-podium__item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 11px;
    color: var(--sabtr-text-muted);
    max-width: 100%;
}

.riesgos-podium__icon {
    font-size: 1.1rem;
    color: #d4a84a;
}

.riesgos-podium__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.riesgos-donut-wrap {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(160px, 1fr);
    gap: clamp(0.75rem, 2vw, 1.25rem);
    align-items: center;
    flex: 1;
    min-height: 0;
}

.riesgos-donut-chart-col {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.riesgos-donut-host {
    position: relative;
    width: 100%;
    max-width: 340px;
    height: clamp(240px, 32vw, 340px);
    max-height: none;
    margin: 0 auto;
}

.riesgos-donut-host canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.riesgos-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    padding: 28%;
}

.riesgos-donut-center__icon {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    color: #6eb5ff;
    margin-bottom: 0.15rem;
}

.riesgos-donut-center__total {
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1;
    color: var(--sabtr-text-soft);
}

.riesgos-donut-center__label {
    margin-top: 0.2rem;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sabtr-text-muted);
}

.riesgos-donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
    font-size: 12px;
    align-content: center;
}

.riesgos-donut-legend__item {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 0.55rem;
    align-items: start;
    padding: 0.35rem 0.4rem;
    border-radius: 4px;
    transition: background 0.15s ease;
    cursor: default;
}

.riesgos-donut-legend__item.is-highlighted {
    background: rgba(110, 181, 255, 0.12);
}

.riesgos-donut-legend__swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-top: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(11, 28, 54, 0.6);
}

.riesgos-donut-legend__text {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.riesgos-donut-legend__name {
    display: block;
    color: var(--sabtr-text-soft);
    font-weight: 500;
    line-height: 1.3;
    word-break: break-word;
}

.riesgos-donut-legend__val {
    display: block;
    color: var(--sabtr-text-muted);
    font-size: 11px;
}

.riesgos-supervision {
    text-align: center;
    padding: 0.5rem 0;
}

.riesgos-supervision__avatar {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.65rem;
    border-radius: 50%;
    background: var(--sabtr-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6eb5ff;
}

.riesgos-supervision__avatar .material-symbols-outlined {
    font-size: 2rem;
}

.riesgos-supervision__name {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sabtr-text-soft);
}

.riesgos-supervision__badge {
    display: inline-block;
    padding: 0.55rem 0.75rem;
    background: var(--sabtr-surface-2);
    margin-bottom: 0.65rem;
}

.riesgos-supervision__badge-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sabtr-text-muted);
}

.riesgos-supervision__badge-value {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6eb5ff;
}

.riesgos-supervision__note {
    margin: 0;
    font-size: 11px;
    text-align: left;
}

.riesgos-dist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.riesgos-dist-row__head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 11px;
    color: var(--sabtr-text-muted);
    margin-bottom: 0.25rem;
}

.riesgos-vel-max-box {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    background: var(--sabtr-surface-2);
}

.riesgos-vel-max-box__icon {
    font-size: 1.75rem;
    color: #e86a6a;
}

.riesgos-vel-max-box__label {
    margin: 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sabtr-text-muted);
}

.riesgos-vel-max-box__value {
    margin: 0.15rem 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffb4b4;
}

.riesgos-row--critico .riesgos-cell--critico {
    color: #ff8a8a;
    font-weight: 600;
}

.riesgos-alertas-wrap {
    max-height: min(480px, 60vh);
    overflow-y: auto;
}

.vb-perfil-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.vb-perfil-head-actions a[hidden] {
    display: none;
}

.riesgos-footnote {
    margin: 0;
    font-size: 11px;
    color: var(--sabtr-text-muted);
    line-height: 1.45;
}

.riesgos-footnote--warn {
    color: #f0a04a;
}

.riesgos-obs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.riesgos-obs-item {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.riesgos-obs-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: #6eb5ff;
}

.riesgos-obs-item p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--sabtr-text-muted);
}

.admin-table--riesgos th,
.admin-table--riesgos td {
    font-size: 12px;
    padding: 0.45rem 0.5rem;
}

@media (max-width: 1280px) {
    .riesgos-kpi-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .riesgos-mid-grid {
        grid-template-columns: 1fr 1fr;
    }

    .riesgos-mid-grid .riesgos-panel--centros {
        grid-column: 1 / -1;
    }

    .riesgos-bottom-grid {
        grid-template-columns: 1fr;
    }

    .riesgos-donut-wrap {
        grid-template-columns: minmax(220px, 1fr) minmax(200px, 1.2fr);
    }

    .riesgos-donut-host {
        max-width: 300px;
    }
}

@media (max-width: 900px) {
    .riesgos-mid-grid {
        grid-template-columns: 1fr;
    }

    .riesgos-donut-wrap {
        grid-template-columns: 1fr;
    }

    .riesgos-donut-host {
        max-width: min(100%, 320px);
    }

    .riesgos-donut-legend {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.4rem;
    }
}

@media (max-width: 640px) {
    .riesgos-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

body.app-body--staging .riesgos-hero,
body.app-body--staging .riesgos-panel,
body.app-body--staging .riesgos-hero__periodo,
body.app-body--staging .riesgos-supervision__badge,
body.app-body--staging .riesgos-vel-max-box {
    background: var(--st-surface);
    border-color: var(--st-border);
}

body.app-body--staging .riesgos-hero__periodo,
body.app-body--staging .riesgos-supervision__avatar,
body.app-body--staging .riesgos-inline-bar__track,
body.app-body--staging .riesgos-vel-max-box {
    background: var(--st-surface-2);
}

body.app-body--staging .riesgos-hero__title,
body.app-body--staging .riesgos-buzo-name,
body.app-body--staging .riesgos-donut-legend__name,
body.app-body--staging .riesgos-supervision__name {
    color: var(--st-text);
}

body.app-body--staging .riesgos-donut-center__total,
body.app-body--staging .riesgos-donut-legend__name {
    color: var(--st-text);
}

body.app-body--staging .riesgos-donut-center__label,
body.app-body--staging .riesgos-donut-legend__val {
    color: var(--st-text-muted);
}

body.app-body--staging .riesgos-donut-legend__item.is-highlighted {
    background: rgba(161, 161, 170, 0.15);
}

body.app-body--staging .riesgos-panel__title,
body.app-body--staging .riesgos-hero__eyebrow,
body.app-body--staging .riesgos-hero__periodo-label,
body.app-body--staging .riesgos-podium__label {
    color: var(--st-text-muted);
}

/* --- SABTR-Lite (solo staging) --- */
.admin-page--sabtr-lite .sl-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
}

.admin-page--sabtr-lite .sl-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1rem;
    border-radius: 0.4rem;
    color: var(--text-muted, #8aa4c4);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.admin-page--sabtr-lite .sl-tab:hover {
    color: var(--text, var(--sabtr-text));
    background: rgba(148, 163, 184, 0.12);
}

.admin-page--sabtr-lite .sl-tab.is-active {
    color: var(--text, var(--sabtr-text));
    background: rgba(56, 189, 248, 0.16);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.admin-page--sabtr-lite .resumen-kpi-main--sm {
    font-size: 1.05rem;
    line-height: 1.3;
}

.admin-page--sabtr-lite .sl-row--alerta td {
    background: rgba(248, 113, 113, 0.08);
}

.admin-page--sabtr-lite .sl-sync-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
    background: rgba(148, 163, 184, 0.15);
}

.admin-page--sabtr-lite .sl-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.admin-page--sabtr-lite .sl-status--on {
    background: rgba(52, 211, 153, 0.18);
    color: #6ee7b7;
}

.admin-page--sabtr-lite .sl-status--off {
    background: rgba(148, 163, 184, 0.18);
    color: #94a3b8;
}

.admin-page--sabtr-lite .sl-status--lock {
    background: rgba(251, 191, 36, 0.18);
    color: #fbbf24;
}

.sl-dialog {
    width: min(640px, calc(100vw - 2rem));
    max-height: min(85vh, 900px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.6rem;
    padding: 0;
    background: var(--surface, #0f1c30);
    color: var(--text, var(--sabtr-text));
}

.sl-dialog::backdrop {
    background: rgba(2, 8, 20, 0.65);
}

.sl-dialog__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.sl-dialog__title {
    margin: 0;
    font-size: 1.05rem;
}

.sl-dialog__body {
    padding: 1rem 1.1rem 1.25rem;
    overflow: auto;
    max-height: calc(85vh - 4rem);
}

.sl-detalle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
}

.sl-detalle-grid dt {
    margin: 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #8aa4c4);
}

.sl-detalle-grid dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.sl-alert-chip {
    display: inline-block;
    margin: 0.15rem 0.25rem 0.15rem 0;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    background: rgba(248, 113, 113, 0.18);
    color: #fca5a5;
}

.sl-json {
    margin: 0;
    padding: 0.75rem;
    border-radius: 0.4rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow: auto;
}

.sl-notes {
    margin: 0;
    white-space: pre-wrap;
}

.sl-pwd-form .dashboard-filter-input {
    width: 100%;
    max-width: 100%;
}

.sl-pwd-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

@media (max-width: 640px) {
    .sl-detalle-grid {
        grid-template-columns: 1fr;
    }
}

body.app-body--staging .admin-page--sabtr-lite .sl-tab.is-active {
    background: rgba(161, 161, 170, 0.2);
    box-shadow: inset 0 0 0 1px rgba(161, 161, 170, 0.4);
}

body.app-body--staging .sl-dialog {
    background: var(--st-surface);
    border-color: var(--st-border);
    color: var(--st-text);
}

/* —— Layout tablet / celular: menú cajón y contenido apilado —— */
@media (max-width: 1024px) {
    .app-nav-toggle,
    .app-sidebar-close {
        display: inline-flex !important;
    }

    .app-sidebar-brand {
        gap: 0.35rem;
        padding-right: 0.35rem;
    }

    .app-sidebar-title {
        flex: 1;
        min-width: 0;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(280px, 88vw);
        z-index: 80;
        transform: translateX(-110%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    body.app-body--staging .app-sidebar {
        top: 2rem;
    }

    body.is-nav-open .app-sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.45);
    }

    .app-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(0, 10, 24, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body.app-body--staging .app-nav-backdrop {
        top: 2rem;
    }

    body.is-nav-open .app-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    body.is-nav-open {
        overflow: hidden;
    }

    .app-nav-link {
        min-height: 2.75rem;
    }

    .app-topbar {
        padding: 0.45rem 0.75rem;
        gap: 0.5rem;
    }

    .app-topbar-dataset {
        display: none;
    }

    .app-select {
        min-width: 0;
        max-width: 100%;
    }

    .app-user-meta {
        max-width: 11rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-content {
        padding: 0.85rem 0.75rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }

    .admin-card {
        padding: 0.9rem 0.85rem;
    }

    .dashboard-filters,
    .admin-grid-form {
        flex-wrap: wrap;
    }

    .dashboard-filters > div:not(.dashboard-filter-actions),
    .admin-grid-form > div:not(.admin-form-actions) {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 9.5rem;
    }

    .dashboard-filters > .dashboard-filter-actions,
    .admin-grid-form > .admin-form-actions {
        flex: 1 1 100%;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dashboard-tablist {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-tab {
        flex-shrink: 0;
        padding: 0.7rem 0.75rem;
    }
}

@media (max-width: 640px) {
    .app-content {
        padding: 0.7rem 0.55rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    }

    .admin-page-title {
        font-size: 1.05rem;
    }

    .app-user-meta {
        display: none;
    }

    .app-header-empresa-logo-img {
        height: 28px;
        max-width: 88px;
    }

    .dashboard-filters > div:not(.dashboard-filter-actions),
    .admin-grid-form > div:not(.admin-form-actions) {
        flex: 1 1 100%;
    }

    .admin-form-actions .btn-primary,
    .admin-form-actions .btn-secondary,
    .dashboard-filter-actions .btn-primary {
        min-height: 2.75rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .resumen-kpi-row {
        grid-template-columns: 1fr;
    }

    .env-staging-banner__hint {
        display: none;
    }

    .login-page__main {
        padding: 0.75rem 0.6rem;
        align-items: flex-start;
        padding-top: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar,
    .app-nav-backdrop {
        transition: none;
    }
}

