/* ==========================================================================
   KRONOS · Capa de componentes
   --------------------------------------------------------------------------
   Ajusta la apariencia de los componentes de Bootstrap y las piezas propias
   (shell de la app, hero, grilla de módulos, navegación inferior móvil).
   REGLA: aquí no hay colores fijos. Todo sale de las variables de theme.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html {
    font-size: 15px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--app-bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
}

/* Deja aire para la barra inferior en móvil */
@media (max-width: 575.98px) {
    body {
        padding-bottom: 4.25rem;
    }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.18;
    letter-spacing: 0;
}

/* Chrome pequeño: se mantiene en fuente UI para no perder nitidez. */
.badge,
.table > thead th,
.status-card .status-label,
.stat-card .stat-label,
.hero .eyebrow,
.notif-time {
    font-family: var(--font-ui);
}

/* Utilidad versalita: etiquetas editoriales (mayúsculas, tracking amplio). */
.sc {
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: .15em;
    font-size: .72rem;
    font-weight: 600;
}

/* Escala editorial. Las vistas usan <h1>/<h2> "pelados". */
main h1, .page-title {
    font-size: 1.9rem;
    margin-bottom: .15rem;
}

main h2 {
    font-size: 1.3rem;
}

main h1 + p.text-muted,
main h1 + p.page-subtitle {
    margin-bottom: 1.25rem;
}

.page-title {
    margin-bottom: .15rem;
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 0;
}

a {
    color: var(--bs-link-color);
    text-decoration: none;
}

a:hover {
    color: var(--bs-link-hover-color);
    text-decoration: underline;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 .2rem var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   App shell · Barra superior con marca
   -------------------------------------------------------------------------- */
.app-header {
    background: var(--header-gradient);
    color: var(--on-header);
    box-shadow: var(--shadow-sm);
}

.app-header .navbar {
    padding-top: .6rem;
    padding-bottom: .6rem;
}

.app-header .navbar-brand {
    color: var(--on-header);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

/* Piezas de marca que no son encabezados pero comparten la fuente de títulos */
.page-title,
.module-card .module-title,
.stat-card .stat-value,
.status-card .status-value,
.auth-card .auth-brand,
.notif-title {
    font-family: var(--font-display);
}

.app-header .navbar-brand:hover {
    color: var(--on-header);
    text-decoration: none;
    opacity: .92;
}

/* Logo de marca (imagen). Sustituye al texto/ícono en header y footer.
   Se espera un PNG/SVG con FONDO TRANSPARENTE en wwwroot/images/kronos-logo.png */
.brand-logo {
    display: block;
    width: auto;
    height: 40px;
}

.app-header .brand-logo {
    height: 38px;
}

.footer .brand-logo {
    height: 42px;
    opacity: .9;
}

@media (max-width: 575.98px) {
    .app-header .brand-logo {
        height: 32px;
    }
}

.app-header .nav-link {
    color: var(--on-header-muted);
    font-weight: 500;
    border-radius: var(--radius-pill);
    padding: .4rem .85rem;
    transition: background-color .15s ease, color .15s ease;
}

.app-header .nav-link:hover,
.app-header .nav-link:focus {
    color: var(--on-header);
    background-color: rgba(255, 255, 255, .14);
}

.app-header .nav-link.active {
    color: var(--on-header);
    background-color: rgba(255, 255, 255, .22);
}

.app-header .navbar-toggler {
    border-color: rgba(255, 255, 255, .4);
    color: var(--on-header);
}

.app-header .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.9%29' stroke-linecap='round' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Identidad del usuario + acciones a la derecha */
.app-header .user-chip {
    color: var(--on-header);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.app-header .user-chip .avatar {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-pill);
    background-color: rgba(255, 255, 255, .2);
    color: var(--on-header);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}

.btn-header {
    --bs-btn-color: var(--on-header);
    --bs-btn-border-color: rgba(255, 255, 255, .45);
    --bs-btn-hover-color: var(--brand-strong);
    --bs-btn-hover-bg: var(--on-header);
    --bs-btn-hover-border-color: var(--on-header);
    --bs-btn-active-color: var(--brand-strong);
    --bs-btn-active-bg: var(--on-header);
    --bs-btn-focus-shadow-rgb: 255, 255, 255;
    border-radius: var(--radius-pill);
}

/* Botón de cambio de tema */
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .45);
    color: var(--on-header);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color .15s ease;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, .16);
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: inline; }

[data-bs-theme="dark"] .theme-toggle .icon-moon { display: inline; }
[data-bs-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* --------------------------------------------------------------------------
   Encabezado editorial del dashboard  (.hero-masthead)  — plano, sin banda
   -------------------------------------------------------------------------- */
.hero-masthead {
    padding: 2.6rem 0 0;
    margin-bottom: 2.4rem;
}

.hero-masthead .eyebrow {
    color: var(--brand-soft);
}

.hero-masthead h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2.9rem;
    line-height: 1.05;
    margin: .55rem 0 0;
    color: var(--text);
}

.hero-masthead h1::after {
    content: "";
    display: block;
    width: 84px;
    height: 2px;
    background: var(--brand);
    margin: 1rem 0 0;
}

.hero-masthead .hero-sub {
    color: var(--text-muted);
    margin: 1rem 0 0;
    font-size: 1.05rem;
}

.hero-masthead .hero-sub .is-active {
    color: var(--success);
}

@media (max-width: 575.98px) {
    .hero-masthead { padding-top: 1.4rem; margin-bottom: 1.8rem; }
    .hero-masthead h1 { font-size: 2rem; }
}

/* Cabecera de sección editorial (título serif + versalita a la derecha) */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.6rem;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.7rem;
    margin: 0;
}

.section-eyebrow {
    color: var(--text-subtle);
    flex: none;
}

/* El panel de notificaciones alinea su cabecera con la de la sección */
.dash-grid .notif-panel { margin-top: .1rem; }

/* Tarjeta de estado que "flota" sobre el hero */
.status-card {
    display: flex;
    flex-wrap: wrap;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: .35rem .5rem;
}

.status-card .status-item {
    flex: 1 1 0;
    min-width: 33%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .25rem;
    padding: .95rem 1rem;
}

.status-card .status-item + .status-item {
    border-left: 1px solid var(--border);
}

@media (max-width: 575.98px) {
    .status-card .status-item {
        flex-basis: 100%;
        min-width: 0;
    }

    .status-card .status-item + .status-item {
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

.status-card .status-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-subtle);
}

.status-card .status-value {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.2;
    color: var(--text);
}

.status-card .status-value.is-active {
    color: var(--success);
}

/* --------------------------------------------------------------------------
   Accesos rápidos  ("¿Qué deseas hacer?")
   Panel destacado + filas compactas, con acentos dorados y micro-animación.
   -------------------------------------------------------------------------- */
.actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- Panel destacado (acción principal del rol) --- */
.action-hero {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(135deg, var(--brand-tint) 0%, var(--surface) 72%);
    border: 1px solid var(--brand-tint-strong);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.action-hero:hover,
.action-hero:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text);
    text-decoration: none;
}

.action-hero-icon {
    flex: 0 0 auto;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--brand);
    color: var(--on-brand);
}

.action-hero-icon svg {
    width: 1.7rem;
    height: 1.7rem;
}

.action-hero-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.action-hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.2;
}

.action-hero-desc {
    color: var(--text-muted);
    font-size: .9rem;
}

.action-cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--brand-strong);
}

.action-cta svg {
    width: 1rem;
    height: 1rem;
    transition: transform .15s ease;
}

.action-hero:hover .action-cta svg {
    transform: translateX(3px);
}

/* --- Filas compactas (el resto de accesos) --- */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: .85rem;
}

.action-tile {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.action-tile:hover,
.action-tile:focus-visible {
    transform: translateY(-2px);
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
    color: var(--text);
    text-decoration: none;
}

.action-tile-icon {
    flex: 0 0 auto;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-2);
    color: var(--text-muted);
    transition: background-color .15s ease, color .15s ease;
}

.action-tile-icon svg {
    width: 1.3rem;
    height: 1.3rem;
}

.action-tile:hover .action-tile-icon {
    background-color: var(--brand-tint);
    color: var(--brand-strong);
}

.action-tile-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.action-tile-title {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.25;
}

.action-tile-desc {
    color: var(--text-muted);
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-chevron {
    flex: 0 0 auto;
    width: 1.1rem;
    height: 1.1rem;
    color: var(--text-subtle);
    transition: transform .15s ease, color .15s ease;
}

.action-tile:hover .action-chevron {
    transform: translateX(3px);
    color: var(--brand);
}

@media (max-width: 575.98px) {
    .action-hero {
        flex-wrap: wrap;
    }

    .action-cta {
        width: 100%;
        justify-content: flex-end;
    }
}

/* --------------------------------------------------------------------------
   Grilla de módulos  (variante en tarjetas · disponible si se reutiliza)
   -------------------------------------------------------------------------- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--gutter);
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .35rem;
    padding: 1.4rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.module-card:hover,
.module-card:focus {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
    color: var(--text);
    text-decoration: none;
}

.module-card .module-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
    background-color: var(--brand-tint);
    color: var(--brand-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .55rem;
}

.module-card .module-icon svg {
    width: 1.4rem;
    height: 1.4rem;
}

.module-card .module-title {
    font-weight: 600;
    font-size: 1.02rem;
}

.module-card .module-desc {
    color: var(--text-muted);
    font-size: .88rem;
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Tarjetas
   -------------------------------------------------------------------------- */
.card {
    border-radius: var(--radius-md);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background-color: var(--surface-2);
    border-bottom-color: var(--border);
    font-weight: 600;
}

/* Tarjeta de métrica del dashboard */
.stat-card .stat-label {
    color: var(--text-muted);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .35rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.stat-card .stat-hint {
    color: var(--text-subtle);
    font-size: .82rem;
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */
.btn {
    --bs-btn-border-radius: var(--radius-pill);
    font-weight: 600;
    padding-inline: 1.1rem;
}

.btn-sm {
    --bs-btn-border-radius: var(--radius-pill);
    padding-inline: .8rem;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-strong);
    --bs-btn-hover-border-color: var(--brand-strong);
    --bs-btn-active-bg: var(--brand-stronger);
    --bs-btn-active-border-color: var(--brand-stronger);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-color: var(--on-brand);
    --bs-btn-hover-color: var(--on-brand);
    --bs-btn-active-color: var(--on-brand);
    --bs-btn-disabled-color: var(--on-brand);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-strong);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-hover-color: var(--on-brand);
    --bs-btn-active-bg: var(--brand-strong);
    --bs-btn-active-border-color: var(--brand-strong);
    --bs-btn-active-color: var(--on-brand);
}

.btn-secondary {
    --bs-btn-bg: var(--surface-2);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-color: var(--text);
    --bs-btn-hover-bg: var(--border);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text);
    --bs-btn-active-bg: var(--border);
    --bs-btn-active-color: var(--text);
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-muted);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--surface-2);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text);
    --bs-btn-active-bg: var(--surface-2);
    --bs-btn-active-color: var(--text);
}

.btn-link {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-hover-color: var(--bs-link-hover-color);
    font-weight: 600;
    text-decoration: none;
}

/* Botones semánticos alineados con los tokens del tema */
.btn-success {
    --bs-btn-bg: var(--success);
    --bs-btn-border-color: var(--success);
    --bs-btn-hover-bg: var(--success);
    --bs-btn-hover-border-color: var(--success);
    --bs-btn-active-bg: var(--success);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.btn-warning {
    --bs-btn-bg: var(--warning);
    --bs-btn-border-color: var(--warning);
    --bs-btn-hover-bg: var(--warning);
    --bs-btn-hover-border-color: var(--warning);
    --bs-btn-active-bg: var(--warning);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.btn-danger {
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: var(--danger);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-active-bg: var(--danger);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: var(--danger);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--danger);
    --bs-btn-active-color: #fff;
}

.btn-outline-success {
    --bs-btn-color: var(--success);
    --bs-btn-border-color: var(--success);
    --bs-btn-hover-bg: var(--success);
    --bs-btn-hover-border-color: var(--success);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--success);
    --bs-btn-active-color: #fff;
}

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */
.form-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: .35rem;
}

/* Ancho cómodo y centrado para páginas de formulario */
.form-narrow {
    max-width: 680px;
    margin-inline: auto;
}

/* Barra de acciones consistente al pie del formulario */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.5rem;
}

.form-text {
    color: var(--text-muted);
}

/* Validación */
.validation-summary-valid {
    display: none;
}

.validation-summary-errors {
    background-color: var(--danger-tint);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: .8rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.15rem;
}

.field-validation-error {
    display: inline-block;
    margin-top: .3rem;
    font-size: .85rem;
    color: var(--danger);
}

.input-validation-error {
    border-color: var(--danger) !important;
}

/* Botón "ocupado" tras enviar (anti doble-envío) */
.btn.is-busy {
    pointer-events: none;
    opacity: .8;
}

.btn-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -.15em;
    margin-right: .45em;
    animation: btnSpin .6s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

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

/* --------------------------------------------------------------------------
   Lista clave / valor para vistas de detalle  (.detail-list)
   Acepta <dl><dt><dd> o <div><span class="dl-label"><span class="dl-value">
   -------------------------------------------------------------------------- */
.detail-list {
    margin: 0;
}

.detail-list > div,
.detail-list > .dl-row {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem 1.25rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-list > div:last-child,
.detail-list > .dl-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.detail-list dt,
.detail-list .dl-label {
    flex: 0 0 11rem;
    max-width: 11rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    padding-top: .12rem;
}

.detail-list dd,
.detail-list .dl-value {
    flex: 1 1 12rem;
    margin: 0;
    min-width: 0;
}

@media (max-width: 560px) {
    .detail-list dt,
    .detail-list .dl-label {
        flex-basis: 100%;
        max-width: none;
    }
}

.form-control,
.form-select {
    background-color: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: .55rem .8rem;
}

.form-control::placeholder {
    color: var(--text-subtle);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface);
    border-color: var(--brand);
    color: var(--text);
    box-shadow: 0 0 0 .2rem var(--focus-ring);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--surface-inset);
    color: var(--text-muted);
}

.input-group-text {
    background-color: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Tablas
   -------------------------------------------------------------------------- */
.table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--brand-tint);
    --bs-table-hover-color: var(--text);
    margin-bottom: 0;
}

.table > thead th {
    background-color: var(--surface-2);
    color: var(--text-muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom-color: var(--border);
    white-space: nowrap;
}

.table > tbody td {
    border-bottom-color: var(--border);
    vertical-align: middle;
}

/* Estado vacío dentro de una tarjeta con tabla/lista */
.table-empty {
    padding: 2.75rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.table-empty svg {
    width: 2.4rem;
    height: 2.4rem;
    color: var(--text-subtle);
    margin-bottom: .6rem;
}

/* --- Tabla que colapsa a "tarjetas apiladas" en móvil --- */
@media (max-width: 640px) {
    /* El contenedor con scroll horizontal deja de hacer falta al apilar */
    .table-responsive:has(.table-stack) {
        overflow: visible;
    }

    .table-stack thead {
        display: none;
    }

    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tbody tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background-color: var(--surface);
        padding: .6rem 1rem .75rem;
        margin-bottom: .75rem;
    }

    .table-stack td {
        border: 0 !important;
        padding: .3rem 0;
        text-align: left;
    }

    /* Etiqueta encima del valor (robusto ante celdas multilínea) */
    .table-stack td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: .05rem;
        font-family: var(--font-ui);
        font-size: .66rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--text-subtle);
    }

    /* Celda de acciones = la que no lleva data-label: fila de botones */
    .table-stack td:not([data-label]) {
        display: flex;
        flex-wrap: wrap;
        gap: .4rem;
        margin-top: .5rem;
        padding-top: .65rem;
        border-top: 1px solid var(--border) !important;
    }

    .table-stack td:not([data-label])::before {
        content: none;
    }

    .table-stack td:not([data-label]) .btn {
        flex: 1 1 auto;
    }

    .table-stack td:not([data-label]) form {
        flex: 1 1 auto;
        display: flex;
    }

    .table-stack td:not([data-label]) form .btn {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   Encabezado de página  (_PageHeader)
   -------------------------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-header-text {
    min-width: 0;
}

.page-header .page-title {
    margin-bottom: .15rem;
}

.page-header .page-title .badge {
    vertical-align: middle;
    margin-left: .6rem;
    font-size: .72rem;
    position: relative;
    top: -.1em;
}

.page-header .page-subtitle {
    margin-bottom: 0;
}

.page-header-action {
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Barra de paginación  (_Paginacion)
   -------------------------------------------------------------------------- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    color: var(--text-muted);
    font-size: .85rem;
}

/* --------------------------------------------------------------------------
   Badges de estado
   -------------------------------------------------------------------------- */
.badge {
    font-weight: 600;
    letter-spacing: .01em;
    padding: .4em .7em;
    border-radius: var(--radius-pill);
}

/* Badges suaves para estados: legibles en claro y oscuro */
.badge.bg-primary { background-color: var(--brand-tint) !important; color: var(--brand-stronger) !important; }
.badge.bg-success { background-color: var(--success-tint) !important; color: var(--success) !important; }
.badge.bg-warning { background-color: var(--warning-tint) !important; color: var(--warning) !important; }
.badge.bg-danger  { background-color: var(--danger-tint) !important;  color: var(--danger) !important; }
.badge.bg-info    { background-color: var(--info-tint) !important;    color: var(--info) !important; }
.badge.bg-secondary { background-color: var(--surface-2) !important;  color: var(--text-muted) !important; }

[data-bs-theme="dark"] .badge.bg-success { color: #6fe0a0 !important; }
[data-bs-theme="dark"] .badge.bg-warning { color: #f2c377 !important; }
[data-bs-theme="dark"] .badge.bg-danger  { color: #f19a94 !important; }
[data-bs-theme="dark"] .badge.bg-info    { color: #86c7e6 !important; }
[data-bs-theme="dark"] .badge.bg-primary { color: #8dd6f0 !important; }

/* --------------------------------------------------------------------------
   Listas
   -------------------------------------------------------------------------- */
.list-group {
    --bs-list-group-bg: var(--surface);
    --bs-list-group-color: var(--text);
    --bs-list-group-border-color: var(--border);
    --bs-list-group-action-hover-bg: var(--brand-tint);
    --bs-list-group-action-hover-color: var(--text);
    --bs-list-group-action-color: var(--text);
    border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   Notificaciones · lista sin "caja dentro de caja"
   Las filas van directamente dentro de .card-body, separadas por líneas
   finas y con aire suficiente entre título, mensaje y fecha.
   -------------------------------------------------------------------------- */
.notif-list {
    display: flex;
    flex-direction: column;
}

.notif-item {
    display: block;
    padding: 1.15rem .35rem;
    color: var(--text);
    text-decoration: none;
    border-top: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: background-color .12s ease, border-color .12s ease, padding-left .12s ease;
    animation: notifItemIn .3s ease both;
}

.notif-item:first-child {
    border-top: 0;
}

/* Entrada suave y escalonada de las primeras filas */
.notif-list .notif-item:nth-child(1) { animation-delay: .02s; }
.notif-list .notif-item:nth-child(2) { animation-delay: .06s; }
.notif-list .notif-item:nth-child(3) { animation-delay: .10s; }
.notif-list .notif-item:nth-child(4) { animation-delay: .14s; }
.notif-list .notif-item:nth-child(5) { animation-delay: .18s; }
.notif-list .notif-item:nth-child(6) { animation-delay: .22s; }

@keyframes notifItemIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-item:hover,
.notif-item:focus {
    background-color: var(--brand-tint);
    color: var(--text);
    text-decoration: none;
}

.notif-item.is-unread {
    border-left-color: var(--brand);
    padding-left: .85rem;
}

.notif-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .45rem;
}

.notif-title {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.3;
}

.notif-msg {
    color: var(--text-muted);
    line-height: 1.65;
    margin: 0 0 .55rem;
}

.notif-time {
    display: inline-block;
    font-size: .78rem;
    letter-spacing: .02em;
    color: var(--text-subtle);
}

.notif-item.is-hidden {
    display: none;
}

/* --------------------------------------------------------------------------
   Panel lateral de notificaciones (dashboard) · columna vertical con scroll
   -------------------------------------------------------------------------- */
.notif-panel {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    /* Altura ACOTADA: el panel no crece con la cantidad de notificaciones;
       lo que sobra se desplaza dentro de .notif-scroll. */
    max-height: min(520px, calc(100vh - 5.5rem));
    overflow: hidden;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .9rem 1.1rem;
    background-color: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-weight: 600;
}

/* Grupo de filtros (Todas / Nuevas / Vistas) — sirve para <button> y <a> */
.notif-filter {
    display: flex;
    gap: .35rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
}

.notif-filter > * {
    flex: 1;
    padding: .35rem .5rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background-color: transparent;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: .78rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color .12s ease, background-color .12s ease, border-color .12s ease, transform .1s ease;
}

.notif-filter > *:hover {
    color: var(--text);
    border-color: var(--brand);
}

.notif-filter > *:active {
    transform: scale(.96);
}

.notif-filter > .is-active,
.notif-filter > [aria-pressed="true"] {
    background-color: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

/* Parpadeo dorado del filtro "Nuevas" cuando hay notificaciones sin leer.
   La clase .has-nuevas la pone la vista solo si el contador > 0. */
.notif-filter.has-nuevas .notif-filter-nuevas {
    animation: notifPulse 1.9s ease-in-out infinite;
}

@keyframes notifPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(200, 162, 58, 0);
        border-color: var(--brand-strong);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(200, 162, 58, .30);
        border-color: var(--brand);
    }
}

/* Respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .notif-item,
    .notif-filter.has-nuevas .notif-filter-nuevas {
        animation: none;
    }
}

.notif-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 1.1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.notif-scroll::-webkit-scrollbar {
    width: 8px;
}

.notif-scroll::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: var(--radius-pill);
}

.notif-panel .notif-item {
    padding-inline: 0;
}

.notif-panel .notif-item.is-unread {
    padding-left: .75rem;
}

.notif-panel-foot {
    padding: .75rem 1.1rem;
    border-top: 1px solid var(--border);
}

.notif-empty {
    padding: 2rem 1.1rem;
    color: var(--text-muted);
    text-align: center;
    font-size: .9rem;
}

@media (max-width: 991.98px) {
    .notif-panel {
        position: static;
        max-height: 460px;
    }
}

/* --------------------------------------------------------------------------
   Alertas
   -------------------------------------------------------------------------- */
.alert {
    border-radius: var(--radius-md);
    border-color: var(--border);
}

.alert-light {
    background-color: var(--surface-2);
    color: var(--text);
}

/* --------------------------------------------------------------------------
   Paginación
   -------------------------------------------------------------------------- */
.page-link {
    color: var(--brand-strong);
    background-color: var(--surface);
    border-color: var(--border);
}

.page-link:hover {
    color: var(--brand-stronger);
    background-color: var(--brand-tint);
    border-color: var(--border);
}

.page-item.active .page-link {
    background-color: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

.page-item.disabled .page-link {
    background-color: var(--surface);
    border-color: var(--border);
    color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   Panel de autenticación (login / recuperación)
   -------------------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--header-gradient);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem;
}

.auth-card .auth-brand {
    text-align: center;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--brand-strong);
    margin-bottom: .25rem;
}

.auth-card .auth-tagline {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

/* --------------------------------------------------------------------------
   Navegación inferior (solo móvil) · estilo app
   -------------------------------------------------------------------------- */
.bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1030;
    display: none;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 40, 55, .08);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
}

.bottom-nav form {
    display: contents;
}

.bottom-nav .bottom-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    padding: .35rem 0;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 600;
    text-decoration: none;
}

.bottom-nav .bottom-link svg {
    width: 1.4rem;
    height: 1.4rem;
}

.bottom-nav .bottom-link.active {
    color: var(--brand-strong);
}

.bottom-nav .bottom-link:hover {
    color: var(--brand-strong);
    text-decoration: none;
}

@media (max-width: 575.98px) {
    .bottom-nav {
        display: flex;
    }

    .hero {
        padding-top: 1.25rem;
    }

    .hero h1 {
        font-size: 1.55rem;
    }
}

/* --------------------------------------------------------------------------
   Estado de error / vacío a página completa  (.error-state)
   -------------------------------------------------------------------------- */
.error-state {
    max-width: 460px;
    margin: 3.5rem auto;
    text-align: center;
    padding: 1rem;
}

.error-state .error-code {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 4.5rem;
    line-height: 1;
    color: var(--brand);
    margin-bottom: .75rem;
}

.error-state .error-icon {
    width: 3.5rem;
    height: 3.5rem;
    color: var(--brand);
    margin-bottom: .5rem;
}

.error-state .form-actions {
    justify-content: center;
    border-top: 0;
    margin-top: 1.25rem;
}

/* Resumen de filtros aplicados (Reportes) */
.filters-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .5rem;
    margin-bottom: 1.25rem;
    font-size: .85rem;
}

.filters-summary .chip {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: .2rem .7rem;
    color: var(--text-muted);
}

.filters-summary .chip strong {
    color: var(--text);
    font-weight: 600;
}

/* ==========================================================================
   CAPA EDITORIAL  (Dirección A)
   Filetes dorados finísimos, versalitas, superficies casi planas, aire.
   Va al final para ganar la cascada sobre los componentes de arriba.
   ========================================================================== */

/* --- Navegación superior: versalitas + subrayado dorado en el activo --- */
.app-header .nav-link {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .74rem;
    font-weight: 600;
    border-radius: 0;
    padding: .35rem .1rem;
    margin-inline: .55rem;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}

.app-header .nav-link:hover,
.app-header .nav-link:focus {
    background: transparent;
    color: var(--on-header);
    border-bottom-color: var(--brand-strong);
}

.app-header .nav-link.active {
    background: transparent;
    color: var(--on-header);
    border-bottom-color: var(--brand);
}

.app-header .navbar-brand { letter-spacing: 0; }

/* --- Encabezado de página: filete dorado bajo el título --- */
.page-header {
    margin-bottom: 1.9rem;
}

.page-header .page-title {
    font-size: 2.1rem;
    letter-spacing: 0;
}

.page-header-rule {
    width: 84px;
    height: 2px;
    background: var(--brand);
    margin: .7rem 0 .1rem;
}

.page-header .page-subtitle {
    color: var(--text-muted);
}

.page-header .page-title .badge {
    top: -.14em;
}

/* --- Tarjetas: casi planas, borde apenas visible --- */
.card {
    border-radius: var(--radius-md);
    border-color: var(--border);
    background-color: var(--surface);
    box-shadow: none;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--rule-gold);
    color: var(--text-muted);
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .72rem;
    font-weight: 600;
    padding: .95rem 1.15rem;
}

/* --- Tablas: filetes, no cajas --- */
.table > thead th {
    background-color: transparent;
    border-bottom: 1px solid var(--rule-gold);
    letter-spacing: .12em;
    font-size: .68rem;
    color: var(--text-subtle);
    padding-block: .8rem;
}

.table > tbody td {
    border-bottom-color: var(--rule);
    padding-block: .85rem;
}

.table > tbody tr:last-child td { border-bottom: 0; }

/* --- Badges de estado: píldoras de filete, no rellenas --- */
.badge {
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: .66rem;
    padding: .38em .8em;
    background-color: transparent !important;
    border: 1px solid currentColor;
}

.badge.bg-primary   { color: var(--brand) !important; }
.badge.bg-success   { color: var(--success) !important; }
.badge.bg-warning   { color: var(--warning) !important; }
.badge.bg-danger    { color: var(--danger) !important; }
.badge.bg-info      { color: var(--info) !important; }
.badge.bg-secondary { color: var(--text-subtle) !important; }

[data-bs-theme="dark"] .badge.bg-success { color: #7fbf8f !important; }
[data-bs-theme="dark"] .badge.bg-warning { color: #e0b877 !important; }
[data-bs-theme="dark"] .badge.bg-danger  { color: #e79a90 !important; }
[data-bs-theme="dark"] .badge.bg-info    { color: #8fb7cf !important; }
[data-bs-theme="dark"] .badge.bg-primary { color: var(--brand-soft) !important; }

/* --- Encabezado + franja de estado del dashboard --- */
.hero-masthead { margin-bottom: 2rem; }

.dash-grid { margin-top: 0; }

.status-card {
    background: transparent;
    border: 0;
    border-top: 1px solid var(--rule-gold);
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 2.25rem;
}

.status-card .status-item + .status-item { border-left-color: var(--rule); }

.status-card .status-item {
    padding: 1.5rem 1.75rem;
    gap: .55rem;
}

.status-card .status-item:first-child { padding-left: .25rem; }

.status-card .status-label {
    text-transform: uppercase;
    letter-spacing: .13em;
    font-size: .68rem;
    color: var(--text-subtle);
}

.status-card .status-value {
    font-size: 1.15rem;
}

.status-card .status-value.is-active::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    margin-right: .5rem;
    vertical-align: .08em;
}

/* --- Panel de notificaciones: plano, cabecera en versalita --- */
.notif-panel {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-height: 560px;
}

.notif-panel-head {
    background: transparent;
    padding-inline: 0;
    border-bottom: 1px solid var(--rule-gold);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .74rem;
    color: var(--text-muted);
}

.notif-title { font-family: var(--font-display); font-weight: 400; font-size: 1.02rem; }

.notif-filter { padding-inline: 0; }
.notif-scroll { padding-inline: 0; }

/* La etiqueta "Nueva" del ítem: versalita dorada sin borde */
.notif-head .badge.bg-primary {
    border: 0;
    padding: 0;
    letter-spacing: .13em;
    font-size: .58rem;
    color: var(--brand-soft) !important;
}

.notif-panel-foot {
    padding: .9rem 0 0;
    border-top: 1px solid var(--rule-gold);
}

.notif-panel-foot .btn {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--brand-soft);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .72rem;
    font-weight: 600;
}

.notif-panel-foot .btn::after { content: " →"; }

/* --- detail-list: etiquetas versalita alineadas con .sc --- */
.detail-list .dl-label,
.detail-list dt {
    letter-spacing: .13em;
    font-size: .68rem;
}

.detail-list > div,
.detail-list > .dl-row { border-bottom-color: var(--rule); }

/* --- Accesos rápidos: lista de filas con filete (Dirección A) --- */
.action-grid {
    display: block;                 /* una sola columna, tipo índice editorial */
}

.action-tile {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    padding: 1.3rem .4rem;
    gap: 1.15rem;
}

.action-tile:first-of-type { border-top: 1px solid var(--rule); }

.action-tile:hover,
.action-tile:focus-visible {
    transform: none;
    box-shadow: none;
    border-color: var(--rule);
    background: linear-gradient(90deg, rgba(200,162,58,.06), transparent 55%);
}

.action-tile-icon {
    background: transparent;
    border: 1px solid var(--rule-gold);
    color: var(--text-muted);
    width: 2.6rem;
    height: 2.6rem;
}

.action-tile:hover .action-tile-icon { background: var(--brand-tint); color: var(--brand-soft); }

.action-tile-title { font-weight: 400; font-size: 1.12rem; }
.action-tile-desc { font-size: .9rem; white-space: normal; }

/* Panel destacado */
.action-hero {
    border-radius: 0;
    box-shadow: none;
    padding: 1.7rem 1.6rem;
    margin-bottom: .4rem;
}

.action-hero-icon {
    background: transparent;
    border: 1px solid var(--rule-gold);
    border-radius: 999px;
    color: var(--brand-soft);
    width: 3.2rem;
    height: 3.2rem;
}

.action-hero-title { font-weight: 400; font-size: 1.25rem; }
.action-hero-desc { font-size: .95rem; }

/* --- Stat cards del dashboard: planas, cifra serif grande --- */
.stat-card {
    background: transparent;
    border: 0;
    border-top: 1px solid var(--rule-gold);
    border-radius: 0;
    box-shadow: none;
}

.stat-card .card-body { padding: 1.1rem .2rem 0; }

.stat-card .stat-label {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .66rem;
    color: var(--text-subtle);
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2.3rem;
    line-height: 1.1;
    margin-top: .35rem;
}

.stat-card .stat-hint { font-size: .78rem; color: var(--text-subtle); }

/* --- Formularios: campos con línea inferior, aire --- */
.form-label {
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .72rem;
    color: var(--text-subtle);
    font-family: var(--font-ui);
}

/* --- Footer --- */
.footer { background: transparent; border-top-color: var(--rule-gold); }

/* --- Enlaces "sc" del pie / migas --- */
.page-header .sc, .card-body .sc { color: var(--text-subtle); }

/* --------------------------------------------------------------------------
   Impresión  (@@media print)
   Oculta el "chrome" de la app y deja el contenido en negro sobre blanco.
   Marca con .no-print lo que no debe imprimirse.
   -------------------------------------------------------------------------- */
@media print {
    .app-header,
    .footer,
    .bottom-nav,
    .no-print,
    .form-actions,
    .page-header-action {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    body {
        padding-bottom: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #bbb !important;
        break-inside: avoid;
    }

    .card-header {
        background: #f0f0f0 !important;
    }

    a {
        color: #000 !important;
        text-decoration: none !important;
    }

    .container {
        max-width: none !important;
        width: 100% !important;
    }

    .table {
        --bs-table-bg: #fff;
        --bs-table-color: #000;
        font-size: .8rem;
    }

    .table > thead th {
        background: #eee !important;
        color: #000 !important;
    }
}

/* ==========================================================================
   VISUALIZACIÓN DE DATOS  (pantallas de pagos · Dirección B)
   Serie única = magnitud en el tiempo -> barras de un solo tono (dorado),
   marcas finas, base tenue, etiquetas selectivas, tooltip al pasar.
   ========================================================================== */

/* Densidad ligeramente mayor en las vistas de datos */
.data-view .table { font-variant-numeric: tabular-nums; }

/* En las vistas de datos las stat-cards SON contenedores sutiles
   (no las franjas con filete del estilo editorial). */
.data-view .stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.data-view .stat-card .card-body {
    padding: 1.15rem 1.25rem 1.1rem;
}

.data-view .stat-card .stat-value {
    font-size: 1.9rem;
    margin-top: .3rem;
}

.data-view .card {
    border-color: var(--border-strong);
}

/* --- Sparkline dentro de una stat-card --- */
.stat-spark {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .5rem;
}

.stat-spark svg { flex: none; overflow: visible; }
.stat-spark .spark-line { fill: none; stroke: var(--brand); stroke-width: 1.6; }
.stat-spark .spark-dot { fill: var(--brand-soft); }

.stat-delta {
    font-family: var(--font-ui);
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-subtle);
}

.stat-delta.is-up { color: var(--success); }
.stat-delta.is-down { color: var(--danger); }

/* --- Selector de periodo del gráfico --- */
.chart-toggle {
    display: inline-flex;
    gap: .35rem;
}

.chart-toggle button {
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1;
    padding: .42rem .85rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.chart-toggle button:hover { color: var(--text); border-color: var(--brand); }

.chart-toggle button.is-active {
    background-color: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

/* --- Figura de barras --- */
.earn-figure { position: relative; }

.earn-figure .earn-cap {
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .66rem;
    color: var(--text-subtle);
    margin-bottom: .9rem;
}

.earn-chart { overflow-x: auto; }
.earn-chart.is-hidden { display: none; }

.earn-bars {
    display: flex;
    align-items: flex-end;
    gap: .45rem;
    height: 210px;
    min-width: 100%;
    padding-top: 1.5rem;
    border-bottom: 1px solid var(--rule-gold);
    background-image: repeating-linear-gradient(to top,
        var(--rule) 0, var(--rule) 1px, transparent 1px, transparent 25%);
}

.earn-bar-col {
    flex: 1 1 0;
    min-width: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.earn-bar-track {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.earn-bar {
    width: 100%;
    max-width: 38px;
    min-height: 3px;
    background: var(--brand);
    border-radius: 4px 4px 0 0;
    position: relative;
    transform-origin: bottom;
    transition: background-color .12s ease;
    animation: earnBarGrow .5s ease both;
}

.earn-bar-col:hover .earn-bar { background: var(--brand-soft); }

.earn-bar-val {
    position: absolute;
    top: -1.4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-ui);
    font-variant-numeric: tabular-nums;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity .12s ease;
}

.earn-bar-col:hover .earn-bar-val,
.earn-bar-col.is-peak .earn-bar-val,
.earn-bar-col.is-last .earn-bar-val { opacity: 1; }

.earn-bar-col.is-peak .earn-bar-val { color: var(--brand-soft); }

.earn-bar-label {
    margin-top: .55rem;
    font-family: var(--font-ui);
    font-size: .66rem;
    letter-spacing: .03em;
    line-height: 1.15;
    color: var(--text-subtle);
    text-align: center;
    white-space: nowrap;
}

.earn-bar-col.is-last .earn-bar-label {
    color: var(--text);
    font-weight: 600;
}

.earn-bar-col.is-empty .earn-bar { background: var(--border); min-height: 3px; }

@keyframes earnBarGrow {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

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

/* --- Barras horizontales (magnitud por categoría) --- */
.hbar-list {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.hbar-row {
    display: grid;
    grid-template-columns: minmax(90px, 30%) 1fr auto;
    align-items: center;
    gap: 1rem;
}

.hbar-name {
    font-family: var(--font-body);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hbar-track {
    height: 10px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.hbar-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 999px;
    animation: hbarGrow .55s ease both;
    transform-origin: left;
}

.hbar-val {
    font-family: var(--font-ui);
    font-variant-numeric: tabular-nums;
    font-size: .82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

@keyframes hbarGrow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

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

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text-muted);
    padding: 1rem 0;
    font-size: .85rem;
}

@media (max-width: 575.98px) {
    .footer {
        display: none;
    }
}

.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--brand-strong); }

/* ==========================================================================
   PÁGINAS PÚBLICAS  ·  Landing / Tutorial / Acerca de MoonByte
   ========================================================================== */

/* --- Hero de la landing --- */
.landing-hero {
    text-align: center;
    padding: 4.5rem 1rem 3rem;
}

.landing-hero .eyebrow { justify-content: center; }

.landing-hero h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 3.1rem;
    line-height: 1.08;
    margin: .85rem auto 0;
    max-width: 20ch;
    color: var(--text);
}

.landing-hero h1::after {
    content: "";
    display: block;
    width: 84px;
    height: 2px;
    background: var(--brand);
    margin: 1.1rem auto 0;
}

.landing-hero .lead {
    max-width: 52ch;
    margin: 1.25rem auto 0;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.landing-hero-actions {
    display: flex;
    justify-content: center;
    gap: .85rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

@media (max-width: 575.98px) {
    .landing-hero { padding: 2.75rem 0 2rem; }
    .landing-hero h1 { font-size: 2.1rem; }
}

/* --- Franja de audiencias (Empleados / Jefes / Administradores) --- */
.audience-strip {
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid var(--rule-gold);
    border-bottom: 1px solid var(--rule);
    margin: 0 0 3.5rem;
}

.audience-item {
    flex: 1 1 220px;
    padding: 1.5rem 1.75rem;
    border-left: 1px solid var(--rule);
}

.audience-item:first-child { border-left: 0; }

.audience-item .audience-label {
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .68rem;
    color: var(--brand-soft);
    margin-bottom: .4rem;
}

.audience-item p { color: var(--text-muted); margin: 0; }

@media (max-width: 767.98px) {
    .audience-item { flex-basis: 100%; border-left: 0; border-top: 1px solid var(--rule); padding: 1.25rem 0; }
    .audience-item:first-child { border-top: 0; }
}

/* --- Cuadrícula de funcionalidades --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.75rem 2rem;
    margin-bottom: 3.5rem;
}

.feature-card .feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--rule-gold);
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    margin-bottom: 1rem;
}

.feature-card .feature-icon svg { width: 1.2rem; height: 1.2rem; }

.feature-card h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.2rem;
    margin: 0 0 .5rem;
}

.feature-card p { color: var(--text-muted); margin: 0; }

/* --- Franja de llamado a la acción --- */
.cta-band {
    text-align: center;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--rule-gold);
    border-bottom: 1px solid var(--rule-gold);
    margin-bottom: 3rem;
}

.cta-band h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.8rem;
    margin: 0 0 .5rem;
}

.cta-band p { color: var(--text-muted); margin: 0 0 1.5rem; }

/* --- Pasos numerados de tutorial --- */
.tutorial-steps {
    display: flex;
    flex-direction: column;
}

.tutorial-step {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 1rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--rule);
}

.tutorial-step:first-child { border-top: 0; }

.tutorial-step .tutorial-num {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--brand-soft);
}

.tutorial-step h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.15rem;
    margin: 0 0 .4rem;
}

.tutorial-step p { color: var(--text-muted); margin: 0; }

/* El conmutador .chart-toggle solo oculta paneles .earn-chart por defecto;
   los paneles del tutorial (por rol) necesitan la misma regla genérica. */
[data-chart-panel].is-hidden { display: none; }

/* --- Página "Acerca de MoonByte" --- */
.moonbyte-hero {
    text-align: center;
    padding: 3.5rem 1rem 2.5rem;
}

.moonbyte-hero h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2.4rem;
    margin: .75rem 0 0;
}

.moonbyte-hero .lead {
    max-width: 46ch;
    margin: 1rem auto 0;
    color: var(--text-muted);
}

/* ==========================================================================
   Balance de pagos por empleado
   ========================================================================== */

.team-balance-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}


.team-balance-row {
    display: block;
    padding: 1rem 1.1rem;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}


    .team-balance-row:hover {
        color: var(--text);
        text-decoration: none;
        background: var(--surface-2);
        border-color: var(--rule-gold);
        transform: translateY(-1px);
    }


.team-balance-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}


.team-balance-name {
    display: block;
    color: var(--text);
    font-size: 1rem;
}


.team-balance-subtitle {
    margin-top: .15rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: .76rem;
}


.team-balance-arrow {
    color: var(--brand-soft);
    font-family: var(--font-ui);
    font-size: 1.65rem;
    line-height: 1;
}


.team-balance-metric {
    display: grid;
    grid-template-columns: 72px minmax(80px, 1fr) minmax(90px, auto);
    align-items: center;
    gap: .75rem;
    margin-top: .55rem;
}


.team-balance-label {
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: .78rem;
}


.team-balance-track {
    height: 10px;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: var(--radius-pill);
}


.team-balance-fill {
    display: block;
    height: 100%;
    min-width: 0;
    border-radius: var(--radius-pill);
    animation: hbarGrow .55s ease both;
    transform-origin: left;
}


    .team-balance-fill.is-paid {
        background: var(--success);
    }


    .team-balance-fill.is-debt {
        background: var(--warning);
    }


.team-balance-value {
    color: var(--text);
    font-family: var(--font-ui);
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}


@media (max-width: 575.98px) {

    .team-balance-row {
        padding: .9rem;
    }


    .team-balance-metric {
        grid-template-columns: 64px 1fr;
    }


    .team-balance-value {
        grid-column: 2;
        margin-top: -.35rem;
        text-align: left;
        color: var(--text-muted);
    }
}

.balance-request {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}


    .balance-request:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }