:root {
    --app-bg: #f3f6fb;
    --app-surface: #ffffff;
    --app-surface-alt: #f8fafc;
    --app-border: #dbe4f0;
    --app-border-strong: #c7d3e3;
    --app-text: #122033;
    --app-text-soft: #55657d;
    --app-text-muted: #7d8aa0;
    /* Azul oscuro base del header (equivalente sólido a rgba(12, 22, 39, 0.92)) */
    --app-navbar-base: rgb(12, 22, 39);
    --app-navbar-base-hover: rgb(22, 38, 64);
    --app-primary: #1c4fa1;
    --app-primary-dark: #163f80;
    --app-primary-soft: #eaf1ff;
    --app-success: #1f8b5f;
    --app-success-soft: #e8f8f1;
    --app-warning: #a76d1c;
    --app-warning-soft: #fff6e8;
    --app-danger: #b5474e;
    --app-danger-soft: #fff0f1;
    --app-info: #2d6cdf;
    --app-shadow-sm: 0 8px 18px rgba(15, 36, 77, 0.06);
    --app-shadow-md: 0 18px 40px rgba(15, 36, 77, 0.08);
    --app-radius-lg: 24px;
    --app-radius-md: 18px;
    --app-radius-sm: 12px;
}

html {
    color-scheme: light dark;
}
html[data-theme="light"] {
    color-scheme: light;
}
html[data-theme="dark"] {
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

/*
 * El scroll horizontal de la tabla debe quedar solo en .dashboard-table-wrap.
 * Si el documento también scrollea en X, al moverse a la derecha se ve el fondo del body
 * “al costado” de la tarjeta blanca (bug en notebooks).
 */
html {
    overflow-x: hidden;
    overflow-x: clip;
}

body.app-shell {
    margin: 0;
    color: var(--app-text);
    background:
        radial-gradient(circle at top left, rgba(43, 108, 223, 0.08), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--app-bg) 100%);
    font-family: "Segoe UI", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    overflow-x: hidden;
    overflow-x: clip;
}

a {
    color: var(--app-primary);
}

.app-container {
    width: min(1240px, calc(100% - 88px));
    margin: 0 auto;
    min-width: 0;
    max-width: 100%;
}

.app-navbar {
    background: rgba(12, 22, 39, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 25px rgba(8, 15, 31, 0.18);
    padding: 1rem 0;
}

/* Bootstrap .btn fuerza color de texto oscuro; en el header debe verse como los nav-link */
.navbar.app-navbar .btn.btn-app-nav {
    color: rgba(255, 255, 255, 0.92);
}

.navbar.app-navbar .btn.btn-app-nav:hover,
.navbar.app-navbar .btn.btn-app-nav:focus,
.navbar.app-navbar .btn.btn-app-nav.show {
    color: #fff;
}

.navbar.app-navbar .btn.btn-app-nav span {
    color: inherit;
}

.navbar.app-navbar .btn.btn-app-nav .fa-cogs {
    color: rgba(255, 255, 255, 0.88);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    color: #fff;
    text-decoration: none;
}

.app-brand:hover,
.app-brand:focus {
    color: #fff;
}

.app-brand-mark {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.1rem;
    overflow: hidden;
    flex-shrink: 0;
}

.app-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.app-brand-title,
.app-brand-subtitle {
    display: block;
    line-height: 1.1;
}

.app-brand-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.app-brand-subtitle {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.65);
}

/* ========== Página de login (misma línea visual que el dashboard) ========== */
body.app-shell.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.login-page__bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(43, 108, 223, 0.14), transparent 55%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(28, 79, 161, 0.1), transparent 50%);
}

html[data-theme="dark"] body.app-shell.login-page .login-page__bg {
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(77, 159, 255, 0.12), transparent 55%),
        radial-gradient(ellipse 70% 45% at 0% 100%, rgba(28, 79, 161, 0.08), transparent 50%);
}

.login-page__theme-wrap {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.login-page__main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.75rem 1.25rem 3rem;
    width: 100%;
}

.login-page__inner {
    width: 100%;
    max-width: 420px;
}

.login-card {
    position: relative;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(214, 225, 240, 0.86);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-md);
}

.login-card__accent {
    height: 4px;
    width: 100%;
    background: linear-gradient(
        90deg,
        var(--app-primary-dark),
        var(--app-primary),
        rgba(43, 108, 223, 0.85)
    );
}

.login-card__header {
    text-align: center;
    padding: 2rem 1.75rem 1.25rem;
}

.login-card__logo-wrap {
    width: 108px;
    height: 108px;
    margin: 0 auto 1rem;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(234, 241, 255, 0.92));
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

html[data-theme="dark"] body.app-shell.login-page .login-card__logo-wrap {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border-color: var(--app-border-strong);
}

.login-card__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.login-card__kicker {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--app-text-muted);
}

.login-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--app-text);
    line-height: 1.2;
}

.login-card__lead {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--app-text-soft);
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
}

.login-form {
    padding: 0 1.75rem 1.5rem;
}

.login-field {
    margin-bottom: 1.1rem;
}

.login-field .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text-soft);
    margin-bottom: 0.45rem;
}

.login-field .input-icon-wrap .form-control {
    padding-left: 2.65rem;
}

.login-password-wrap {
    position: relative;
}

.login-password-wrap .form-control {
    padding-right: 3rem;
}

.login-password-toggle {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--app-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.login-password-toggle:hover {
    background: #fff;
    color: var(--app-primary);
}

html[data-theme="dark"] body.app-shell.login-page .login-password-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--app-primary);
}

.login-password-toggle:focus-visible {
    outline: 2px solid rgba(28, 79, 161, 0.45);
    outline-offset: 2px;
}

.login-alert {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.4;
    border: 1px solid rgba(181, 71, 78, 0.35);
    background: var(--app-danger-soft);
    color: var(--app-danger);
}

html[data-theme="dark"] body.app-shell.login-page .login-alert {
    border-color: rgba(248, 81, 73, 0.35);
}

/* Incluir btn-primary: si no, Bootstrap (.btn tras style.css) deja fondo transparente y se ve “blanco” hasta el hover. */
body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary {
    margin-top: 0.35rem;
    color: #fff;
    background-color: var(--app-primary);
    border-color: var(--app-primary);
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(28, 79, 161, 0.22);
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary:hover,
body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary:focus {
    color: #fff;
    background-color: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
    box-shadow: 0 6px 22px rgba(22, 63, 128, 0.28);
}

body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary:active {
    color: #fff;
    background-color: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(22, 63, 128, 0.22);
}

html[data-theme="dark"] body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary:hover,
html[data-theme="dark"] body.app-shell.login-page button.login-submit.btn.btn-primary.btn-app-primary:focus {
    background-color: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
    color: #fff;
}

.login-card__footer {
    padding: 1rem 1.75rem 1.25rem;
    text-align: center;
    border-top: 1px solid var(--app-border);
    background: var(--app-surface-alt);
}

.login-card__footer-line {
    font-size: 0.78rem;
    color: var(--app-text-muted);
}

html[data-theme="dark"] body.app-shell.login-page .login-card {
    border-color: var(--app-border);
    background: var(--app-surface);
}

html[data-theme="dark"] body.app-shell.login-page .login-card__footer {
    background: rgba(0, 0, 0, 0.2);
    border-top-color: var(--app-border);
}

.app-nav-actions {
    align-items: center;
    gap: 0.75rem;
}

.app-nav-actions .nav-link {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.app-nav-actions .nav-link:hover,
.app-nav-actions .nav-link:focus {
    color: #fff;
}

.app-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-app-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(77, 159, 255, 0.3);
    background: rgba(77, 159, 255, 0.12);
    color: #fff;
    padding: 0.6rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}

.btn-app-nav:hover,
.btn-app-nav:focus {
    color: #fff;
    background: rgba(77, 159, 255, 0.22);
    border-color: rgba(77, 159, 255, 0.45);
}

.btn-app-nav .fa-cogs {
    color: rgba(77, 159, 255, 0.9);
}

.app-dropdown {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-md);
    padding: 0.5rem;
}

.app-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
}

.dashboard-main {
    padding: 2rem 0 2.5rem;
    min-width: 0;
    max-width: 100%;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(214, 225, 240, 0.8);
    border-radius: var(--app-radius-lg);
    background: linear-gradient(135deg, #ffffff 0%, #f7faff 100%);
    box-shadow: var(--app-shadow-sm);
}

.eyebrow,
.section-kicker,
.modal-kicker {
    display: inline-block;
    margin-bottom: 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--app-primary);
}

.dashboard-title {
    margin: 0;
    font-size: clamp(1.85rem, 2vw, 2.35rem);
    font-weight: 700;
}

.dashboard-subtitle,
.section-copy,
.table-helper {
    margin: 0;
    color: var(--app-text-soft);
}

.dashboard-subtitle {
    margin-top: 0.6rem;
    max-width: 720px;
    font-size: 1rem;
}

.dashboard-hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(170px, 1fr));
    gap: 0.85rem;
    min-width: 360px;
}

.hero-meta-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    background: rgba(255, 255, 255, 0.9);
}

.hero-meta-card strong {
    display: block;
    font-size: 0.95rem;
}

.hero-meta-label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--app-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.section-card {
    margin-bottom: 1.5rem;
    padding: 1.4rem 1.45rem;
    border: 1px solid rgba(214, 225, 240, 0.86);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
    min-width: 0;
    max-width: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.section-header-inline {
    align-items: center;
}

.section-copy {
    max-width: 480px;
    font-size: 0.95rem;
}

.filters-card-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem 1.25rem;
}

.filters-card-header-titles {
    min-width: 0;
    flex: 1 1 12rem;
}

.filters-result-summary {
    margin: 0;
    margin-left: auto;
    padding-top: 0.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--app-text-soft);
    text-align: right;
    line-height: 1.35;
    max-width: min(100%, 16rem);
}

.filters-layout {
    display: grid;
    grid-template-columns: minmax(260px, 2.1fr) repeat(4, minmax(160px, 1fr)) auto;
    gap: 1rem;
    align-items: end;
}

.filter-field {
    min-width: 0;
}

.filter-field .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text-soft);
    margin-bottom: 0.45rem;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    top: 50%;
    left: 0.95rem;
    transform: translateY(-50%);
    color: var(--app-text-muted);
}

.input-icon-wrap .form-control {
    padding-left: 2.6rem;
}

.form-control,
.form-select {
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid var(--app-border-strong);
    background: var(--app-surface-alt);
    color: var(--app-text);
    box-shadow: none;
}

.form-control:disabled,
.form-select:disabled {
    /* Evita el “gris claro” nativo (y esquinas claras) en dark mode */
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text-muted);
    opacity: 1;
}

.filters-layout .multi-select {
    width: 100%;
    --primary-color: var(--app-primary);
    --checkbox-background: var(--app-surface-alt);
    --checkbox-border: var(--app-border-strong);
    --checkbox-active: #ffffff;
    --ms-bg: var(--app-surface);
    --text-color-dark: var(--app-text);
    --text-color: var(--app-text-soft);
    --text-color-light: var(--app-text-muted);
    --border-color: var(--app-border-strong);
    --border-color-light: var(--app-border);
    --input-border: var(--app-border-strong);
    --input-border-active: rgba(28, 79, 161, 0.45);
    --input-background: var(--app-surface-alt);
    --option-background: var(--app-surface-alt);
}

@supports (background: color-mix(in srgb, white 50%, black)) {
    .filters-layout .multi-select {
        --checkbox-background: color-mix(in srgb, var(--app-text) 9%, var(--app-surface));
    }
}

.filters-layout .multi-select .multi-select-header {
    min-height: 48px;
    border-radius: 14px;
    border-color: var(--app-border-strong);
    background: var(--app-surface-alt);
    padding-block: 0.45rem;
}

.filters-layout .multi-select .multi-select-header.multi-select-header-active {
    border-color: rgba(28, 79, 161, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(28, 79, 161, 0.12);
    background: var(--app-surface);
}

.filters-layout .multi-select .multi-select-header-option {
    border-radius: 999px;
    background: rgba(28, 79, 161, 0.08);
    color: var(--app-primary-dark);
    font-weight: 600;
    padding: 0.2rem 0.55rem;
}

.filters-layout .multi-select .multi-select-options {
    margin-top: 0.35rem;
    border: 1px solid var(--app-border-strong);
    border-radius: 14px;
    background: var(--app-surface);
    box-shadow: 0 18px 40px rgba(15, 35, 75, 0.14);
}

.filters-layout .multi-select .multi-select-search {
    border-radius: 12px;
}

.filters-layout .multi-select .multi-select-option-radio {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--checkbox-size);
}

.filters-layout .multi-select .multi-select-all.multi-select-selected .multi-select-option-radio::after,
.filters-layout .multi-select .multi-select-group.multi-select-selected .multi-select-option-radio::after,
.filters-layout .multi-select .multi-select-option.multi-select-selected .multi-select-option-radio::after {
    position: absolute;
    display: block;
    margin: 0;
    box-sizing: border-box;
    border: solid var(--checkbox-active);
    border-width: 0 var(--checkbox-thickness) var(--checkbox-thickness) 0;
    transform: translate(-50%, -56%) rotate(45deg);
    transform-origin: center;
    margin-right: 7px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(28, 79, 161, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(28, 79, 161, 0.12);
    background: #fff;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: end;
}

.btn-app-primary,
.btn-app-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.8rem 1.1rem;
    border-radius: 14px;
    font-weight: 600;
    border-width: 1px;
}

.btn-app-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-app-primary:hover,
.btn-app-primary:focus {
    background: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
}

/* Sincronizar emails: mismo azul oscuro que el header */
.btn-app-sync {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0.55rem 1rem;
    border-radius: 14px;
    font-weight: 600;
    border-width: 1px;
    background: var(--app-navbar-base);
    border-color: var(--app-navbar-base);
    color: #fff;
}

.btn-app-sync:hover,
.btn-app-sync:focus {
    background: var(--app-navbar-base-hover);
    border-color: var(--app-navbar-base-hover);
    color: #fff;
}

.btn-app-sync:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.btn-app-light {
    color: var(--app-text);
    background: #fff;
    border-color: var(--app-border);
}

.btn-app-light:hover,
.btn-app-light:focus {
    background: var(--app-surface-alt);
    border-color: var(--app-border-strong);
}

/* Misma caja que btn-app-primary/light (el btn-danger de Bootstrap queda más bajo sin esto). */
.btn-app-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.8rem 1.1rem;
    border-radius: 14px;
    font-weight: 600;
    border-width: 1px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.3rem;
    border: 1px solid rgba(214, 225, 240, 0.86);
    border-radius: var(--app-radius-md);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-size: 1.15rem;
}

.kpi-positive .kpi-icon {
    background: var(--app-success-soft);
    color: var(--app-success);
}

.kpi-negative .kpi-icon {
    background: var(--app-danger-soft);
    color: var(--app-danger);
}

.kpi-info .kpi-icon {
    background: #edf4ff;
    color: var(--app-info);
}

.kpi-label {
    display: block;
    font-size: 0.83rem;
    color: var(--app-text-soft);
    margin-bottom: 0.2rem;
}

.kpi-content strong {
    display: block;
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.1;
}

.chart-card {
    padding-bottom: 1.15rem;
}

.chart-card-header {
    align-items: center;
    margin-bottom: 0;
}

.chart-accordion-trigger {
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0;
}

.chart-accordion-trigger:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.16rem rgba(28, 79, 161, 0.12);
    border-radius: 12px;
}

.chart-accordion-title {
    display: flex;
    flex-direction: column;
}

.chart-accordion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    color: var(--app-text-soft);
    background: rgba(244, 247, 251, 0.92);
    transition: transform 0.22s ease, background-color 0.22s ease, color 0.22s ease;
}

.chart-accordion-trigger:hover .chart-accordion-icon {
    background: #eaf1fb;
    color: var(--app-primary);
}

.chart-accordion-trigger.is-expanded .chart-accordion-icon {
    transform: rotate(180deg);
    color: var(--app-primary);
}

.estado-filter-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.3rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(18, 32, 51, 0.75);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(219, 228, 240, 0.9);
}

.estado-filter-chip.is-active .estado-filter-chip-count {
    color: var(--app-primary-dark);
    border-color: rgba(28, 79, 161, 0.25);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.chart-panel {
    padding: 0.15rem;
}

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

.chart-shell {
    position: relative;
    min-height: 360px;
}

.chart-shell-half {
    min-height: 340px;
}

.chart-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    color: var(--app-text-muted);
    background: rgba(255, 255, 255, 0.8);
    border: 1px dashed var(--app-border);
    border-radius: 16px;
}

.table-card {
    padding-bottom: 1rem;
}

.table-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: rgba(244, 247, 251, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.view-toggle-btn {
    border: 0;
    background: transparent;
    color: var(--app-text-soft);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    padding: 0 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.view-toggle-btn:hover,
.view-toggle-btn:focus-visible {
    color: var(--app-primary);
}

.view-toggle-btn.is-active {
    background: #fff;
    color: var(--app-primary-dark);
    box-shadow: 0 6px 16px rgba(15, 36, 77, 0.08);
}

.view-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.25rem;
    padding: 0 0.38rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(28, 79, 161, 0.08);
    color: currentColor;
}

.sync-progress {
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(244, 247, 251, 0.9), rgba(255, 255, 255, 0.96));
}

.sync-progress-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.sync-progress-message {
    margin: 0.2rem 0 0;
    color: var(--app-text-soft);
}

.sync-progress-percent {
    min-width: 52px;
    text-align: right;
    font-weight: 700;
    color: var(--app-primary);
}

.sync-progress-bar {
    width: 100%;
    height: 10px;
    overflow: hidden;
    background: #e6edf7;
    border-radius: 999px;
}

.sync-progress-bar-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--app-primary), #4f93ff);
    transition: width 0.25s ease;
}

.sync-progress-stats {
    margin-top: 0.75rem;
    font-size: 0.92rem;
    color: var(--app-text-soft);
}

/*
 * Solo scroll horizontal si la tabla es ancha; el scroll vertical debe ser solo el del documento.
 * Si overflow-x no es "visible", overflow-y: visible se calcula como "auto" (CSS 2.1),
 * y el contenedor gana barra de scroll vertical además del body — por eso forzamos overflow-y.
 */
.dashboard-table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    /* Misma superficie que la tarjeta para que al scrollear no se “vea el body” en el hueco del scrollport */
    background: var(--app-surface);
    border-radius: 14px;
}

.dashboard-table {
    margin-bottom: 0;
    min-width: 1320px;
    border-collapse: separate;
    border-spacing: 0;
}

.dashboard-table thead th.table-logo-th {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    padding-left: 0.65rem;
    padding-right: 0.35rem;
    text-align: center;
    font-size: 0;
    color: transparent;
    box-shadow: 0 1px 0 rgba(219, 228, 240, 0.95);
}

.dashboard-table thead th.table-logo-th::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: 1px;
}

.dashboard-table tbody td.table-logo-cell {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
    padding: 0.55rem 0.35rem 0.55rem 0.65rem;
    vertical-align: middle;
}

.licit-row-brand {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid rgba(15, 35, 75, 0.12);
    background: var(--app-surface, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-sizing: border-box;
}

.licit-row-brand--empty {
    color: var(--app-text-muted);
    font-size: 0.95rem;
    background: var(--app-surface-alt, #f8fafc);
}

.licit-row-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    display: block;
}

html[data-theme="dark"] body.app-shell .licit-row-brand {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .licit-row-brand--empty {
    background: var(--app-surface);
    color: var(--app-text-muted);
}

.dashboard-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.95rem 1rem;
    border: 0;
    background: #f4f7fb;
    color: var(--app-text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 1px 0 rgba(219, 228, 240, 0.95);
}

.dashboard-table thead th.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.dashboard-table thead th.sortable-th:hover,
.dashboard-table thead th.sortable-th:focus-visible {
    color: var(--app-primary);
}

.dashboard-table thead th.sortable-th:focus-visible {
    outline: 2px solid rgba(28, 79, 161, 0.35);
    outline-offset: 2px;
}

.sortable-th-label {
    margin-right: 0.35rem;
}

.sort-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    vertical-align: middle;
}

.table-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.estado-filter-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.46rem 0.82rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
    opacity: 0.9;
}

.estado-filter-chip:hover,
.estado-filter-chip:focus-visible {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(18, 38, 63, 0.08);
}

.estado-filter-chip.is-active {
    opacity: 1;
    border-color: rgba(18, 38, 63, 0.22);
    box-shadow: 0 10px 20px rgba(18, 38, 63, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.estado-filter-chip.is-active::before {
    content: "";
    width: 0.48rem;
    height: 0.48rem;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.48);
}

.filter-tone-all {
    background-color: rgba(255, 255, 255, 0.92);
    color: var(--app-text);
}

.filter-tone-pendiente {
    background-color: #f3f4f6;
    color: #5f6673;
    border-color: rgba(95, 102, 115, 0.18);
}

.filter-tone-en-proceso {
    background-color: #e8f1ff;
    color: #1d5fd0;
    border-color: rgba(29, 95, 208, 0.2);
}

.filter-tone-licitada {
    background-color: #fff2cc;
    color: #9a6700;
    border-color: rgba(154, 103, 0, 0.18);
}

.filter-tone-confirmada {
    background-color: #e6f7ea;
    color: #2f8f4e;
    border-color: rgba(47, 143, 78, 0.18);
}

.filter-tone-completada {
    background-color: #d7f0de;
    color: #0d5c2b;
    border-color: rgba(13, 92, 43, 0.18);
}

.filter-tone-importante {
    background-color: #ffe6e3;
    color: #c2342b;
    border-color: rgba(194, 52, 43, 0.18);
}

/* Íconos de "Importante": por defecto fuego; en GOLD estrella. */
.important-icon-fire {
    display: inline-block !important;
}

.important-icon-star {
    display: none !important;
}

html[data-reception-active-card="gold"] body.app-shell .important-icon-fire {
    display: none !important;
}

html[data-reception-active-card="gold"] body.app-shell .important-icon-star {
    display: inline-block !important;
}

/* GOLD mode: Importantes en dorado (chip + fila + badge) */
html[data-reception-active-card="gold"] body.app-shell .filter-tone-importante {
    background: rgba(214, 173, 74, 0.18);
    color: #8a5a00;
    border-color: rgba(214, 173, 74, 0.45);
}

.dashboard-table tbody td {
    padding: 1rem;
    border-color: #edf2f8;
    vertical-align: middle;
}

/* Hover solo en tema claro: en oscuro los fondos claros dejaban texto ilegible */
html[data-theme="light"] .dashboard-table tbody tr:hover {
    background: #fbfdff;
}

.dashboard-table tbody tr.dashboard-table-row {
    cursor: pointer;
}

html[data-theme="light"] .dashboard-table tbody tr.dashboard-table-row:hover {
    background: #f0f6ff;
}

/* Fila marcada como importante: fondo, hover y borde izquierdo */
.dashboard-table tbody tr.dashboard-table-row.table-row-important {
    background: rgba(255, 80, 80, 0.08);
}

html[data-reception-active-card="gold"] body.app-shell .dashboard-table tbody tr.dashboard-table-row.table-row-important {
    background: rgba(214, 173, 74, 0.14);
}

html[data-theme="light"] .dashboard-table tbody tr.dashboard-table-row.table-row-important:hover {
    background: rgba(255, 80, 80, 0.15);
}

html[data-reception-active-card="gold"][data-theme="light"] body.app-shell .dashboard-table tbody tr.dashboard-table-row.table-row-important:hover {
    background: rgba(214, 173, 74, 0.22);
}

html[data-theme="dark"] .dashboard-table tbody tr:hover,
html[data-theme="dark"] .dashboard-table tbody tr.dashboard-table-row:hover {
    background: rgba(77, 159, 255, 0.1);
}

html[data-theme="dark"] .dashboard-table tbody tr.dashboard-table-row.table-row-important:hover {
    background: rgba(248, 113, 113, 0.16);
}

html[data-reception-active-card="gold"][data-theme="dark"] body.app-shell .dashboard-table tbody tr.dashboard-table-row.table-row-important:hover {
    background: rgba(214, 173, 74, 0.20);
}

.dashboard-table tbody tr.table-row-important td.table-logo-cell {
    box-shadow: inset 6px 0 0 #e02020;
}

html[data-reception-active-card="gold"] body.app-shell .dashboard-table tbody tr.table-row-important td.table-logo-cell {
    box-shadow: inset 6px 0 0 rgba(214, 173, 74, 0.95);
}

.dashboard-table tbody tr.dashboard-table-row:focus-visible {
    outline: 2px solid rgba(28, 79, 161, 0.35);
    outline-offset: -2px;
}

.table-empty-state {
    padding: 2rem 1rem !important;
    text-align: center;
    color: var(--app-text-soft);
}

/* Rejilla 1fr | auto | 1fr: “Por página” a la izquierda; nav de páginas centrado en la tarjeta */
.table-pagination-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    column-gap: 1rem;
    row-gap: 0.75rem;
    margin-top: 1rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

.pagination-page-size {
    grid-column: 1;
    justify-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 120px;
    flex-shrink: 0;
}

.pagination-page-size-label {
    margin-bottom: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text-soft);
}

.table-pagination {
    grid-column: 2;
    justify-self: center;
    margin-top: 0;
    min-width: 0;
    max-width: 100%;
    width: max-content;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* Tablet / ventana estrecha: selector arriba a la izquierda; paginación centrada en fila completa */
@media (max-width: 1199.98px) and (min-width: 768px) {
    .table-pagination-bar {
        grid-template-columns: 1fr;
    }

    .pagination-page-size {
        grid-column: 1;
    }

    .table-pagination {
        grid-column: 1;
        justify-self: center;
        width: 100%;
        max-width: 100%;
    }
}

.table-pagination .pagination {
    flex-wrap: nowrap;
    width: max-content;
    max-width: none;
    margin-bottom: 0;
    justify-content: center;
}

.pagination .page-link {
    color: var(--app-primary);
    border-radius: 12px !important;
    border: 1px solid var(--app-border);
    margin: 0 0.18rem;
    min-width: 40px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.42rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-activa {
    background-color: var(--app-success-soft);
    color: var(--app-success);
}

.status-vencida {
    background-color: var(--app-danger-soft);
    color: var(--app-danger);
}

.status-procesada {
    background-color: #fff2cc;
    color: #9a6700;
}

.status-en-revision {
    background-color: #e8f1ff;
    color: #1d5fd0;
}

.status-confirmada {
    background-color: #e6f7ea;
    color: #2f8f4e;
}

.status-completada {
    background-color: #d7f0de;
    color: #0d5c2b;
}

.status-pendiente {
    background-color: #f3f4f6;
    color: #5f6673;
}

.status-badge-archivada {
    background-color: var(--app-surface-alt);
    color: var(--app-text-muted);
    border: 1px solid var(--app-border-strong);
    font-weight: 600;
}

.status-indefinida {
    background-color: #f7f7f8;
    color: #737a86;
}

.estado-action-btn {
    min-width: 2rem;
    padding-inline: 0.65rem;
}

.estado-modal-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.estado-modal-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
    text-align: left;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.estado-modal-option:hover:not(:disabled) {
    border-color: rgba(28, 79, 161, 0.24);
    background: #f8fbff;
    box-shadow: 0 8px 18px rgba(18, 38, 63, 0.06);
}

.estado-modal-option:disabled {
    opacity: 0.7;
    cursor: wait;
}

.estado-modal-option.is-current {
    border-color: rgba(28, 79, 161, 0.3);
    background: #f7fbff;
}

.estado-modal-option-badge {
    flex: 0 0 auto;
}

.estado-modal-option-copy {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.estado-modal-option-copy strong {
    font-size: 0.95rem;
    color: var(--app-text);
}

.estado-modal-option-copy small {
    color: var(--app-text-soft);
}

.estado-modal-option-current {
    color: var(--app-primary);
}

/* Columna repuestos: el td fuerza un tope para que la tabla no gane scrollWidth por contenido largo */
.dashboard-table thead tr th:nth-child(8) {
    max-width: 220px;
}

.dashboard-table td:has(.repuestos-cell) {
    max-width: 220px;
    width: 1%;
    min-width: 0;
    vertical-align: middle;
}

.repuestos-cell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 220px;
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.repuestos-cell:hover {
    border-color: rgba(28, 79, 161, 0.28);
    background: var(--app-primary-soft);
}

.repuestos-cell:focus-visible {
    outline: 0;
    border-color: rgba(28, 79, 161, 0.38);
    background: var(--app-primary-soft);
    box-shadow: 0 0 0 0.16rem rgba(28, 79, 161, 0.12);
}

.primer-repuesto {
    display: block;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.repuestos-cell small {
    flex-shrink: 0;
    margin-left: 0.1rem;
    color: var(--app-text-muted);
    white-space: nowrap;
}

/* Debajo del chip y ancho acotado a la celda: evita que position:absolute a la derecha
   ensanche el scrollWidth de la tabla (scroll horizontal con “aire” a la derecha). */
.repuestos-hover-card {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 6px;
    transform: none;
    z-index: 20;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(22, 63, 128, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 38px rgba(17, 30, 53, 0.14);
    color: var(--app-text);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Puente invisible entre chip y tarjeta: sin esto el cursor cruza un “vacío” y se pierde :hover
   antes de llegar al panel (y no se puede hacer scroll dentro). */
.repuestos-hover-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 10px;
}

.repuestos-hover-list-wrap {
    display: block;
    max-height: min(220px, 36vh);
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.repuestos-cell:hover .repuestos-hover-card,
.repuestos-cell:focus-within .repuestos-hover-card,
.repuestos-hover-card:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.repuestos-hover-title {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-text-soft);
}

.repuestos-hover-list {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.8rem;
    line-height: 1.35;
}

.repuestos-hover-list li + li {
    margin-top: 0.15rem;
}

.repuestos-hover-extra {
    margin-top: 0.35rem;
    font-size: 0.76rem;
    color: var(--app-text-soft);
}

/* !important: Bootstrap define display en .btn después de este archivo y gana en especificidad */
.app-hidden {
    display: none !important;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top: 2px solid var(--app-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.25s ease-in;
}

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

.app-modal .modal-dialog {
    padding: 1rem 0;
}

.app-modal .modal-content {
    border: 1px solid rgba(214, 225, 240, 0.86);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(15, 36, 77, 0.14);
    overflow: hidden;
}

.app-modal .modal-header,
.app-modal .modal-footer {
    padding: 1rem 1.35rem;
    border-color: #ebf0f6;
}

.app-modal .modal-footer {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.app-modal .modal-header {
    background: #fbfcff;
}

.app-modal .modal-header.licitar-modal-header {
    padding: 0;
    background: linear-gradient(180deg, #e8f4fc 0%, #d9eef9 100%);
    border-bottom: 1px solid rgba(45, 108, 223, 0.14);
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
}

.licitar-modal-brand-strip {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0.35rem 0.85rem 1.1rem;
    background: transparent;
}

#licitarModal .modal-header .btn-close,
#licitarConfirmModal .modal-header .btn-close {
    padding: 0.5rem 0.5rem;
    margin: -0.5rem 0.5rem -0.5rem auto;
}

.licitar-modal-logo-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 10px;
    border: 1px solid rgba(45, 108, 223, 0.18);
    box-shadow: 0 1px 3px rgba(15, 36, 77, 0.06);
    overflow: hidden;
}

.licitar-modal-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.licitar-modal-logo-fallback {
    color: var(--app-primary);
    font-size: 1.35rem;
    opacity: 0.88;
}

.licitar-modal-logo-fallback.app-hidden {
    display: none !important;
}

.licitar-modal-title-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 52px;
    padding: 0.15rem 0;
}

.licitar-modal-title-block .modal-kicker {
    margin-bottom: 0.2rem;
}

.licitar-modal-title-block .modal-title {
    font-size: 1.05rem;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.licitar-modal-title-block .modal-title i {
    opacity: 0.85;
    font-size: 0.95em;
}

.licitar-modal-lic-num {
    margin-top: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--app-text-muted);
    letter-spacing: 0.02em;
}

/* Modal Licitar: paneles más limpios, vehículo legible, carrusel sin tanto “cajón” */
#licitarModal .quote-panel--licitar-vehiculo,
#licitarModal .quote-panel--licitar-photos,
#licitarModal .quote-panel--licitar-table {
    border-color: rgba(214, 225, 240, 0.65);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 36, 77, 0.04);
}

#licitarModal .quote-panel--licitar-vehiculo {
    padding: 0.95rem 1.1rem;
}

.quote-panel h6.licitar-vehiculo-title {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-primary);
}

.licitar-vehiculo-grid {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.licitar-vehiculo-row {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 0.75rem;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(233, 239, 247, 0.95);
}

.licitar-vehiculo-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.licitar-vehiculo-row:first-of-type {
    padding-top: 0;
}

.licitar-vehiculo-row dt {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text-soft);
}

.licitar-vehiculo-row dd {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--app-text);
    word-break: break-word;
}

.licitar-vehiculo-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.quote-panel h6.licitar-subsection-title {
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-text);
}

.licitar-parte-subline {
    display: block;
    margin-top: 0.2rem;
    line-height: 1.35;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.licitar-subsection-hint {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--app-text-muted);
    max-width: 42rem;
}

.licitar-carousel-section-header {
    margin-bottom: 0.75rem;
}

.licitar-vencimiento-wrap {
    padding: 0.25rem 0.5rem;
}

.licitar-vencimiento-inner {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(214, 225, 240, 0.85);
}

#licitarModal .quote-panel--licitar-photos {
    padding-bottom: 1rem;
}

.image-carousel--licitar {
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.image-carousel--licitar .image-carousel-viewport {
    padding: 0.65rem 0.5rem;
    border-radius: 14px;
    background: linear-gradient(180deg, #f3f7fc 0%, #e8f0f8 100%);
    border: 1px solid rgba(214, 225, 240, 0.85);
}

.image-carousel--licitar .image-carousel-image-frame {
    background: #fff;
    border-radius: 12px;
    min-height: min(42vh, 320px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-carousel--licitar .image-carousel-image-frame img.attachment-thumb {
    width: 100%;
    height: auto;
    min-height: min(38vh, 280px);
    max-height: min(48vh, 400px);
    object-fit: contain;
    border: 0;
    background: transparent;
}

.image-carousel--licitar .attachment-filename {
    margin-top: 0.5rem;
    padding: 0 0.15rem;
    text-align: center;
    word-break: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.image-carousel--licitar .image-carousel-footer {
    margin-top: 0.65rem;
    padding-top: 0.35rem;
    flex-wrap: wrap;
}

.image-carousel--licitar .image-carousel-help {
    flex: 1 1 100%;
    text-align: center;
    font-size: 0.74rem;
    margin-top: 0.15rem;
}

/* Automation panel (licitación automática VALUA) */
.automation-status-panel {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1px solid rgba(214, 225, 240, 0.65);
    border-radius: 18px;
    background: #fff;
}

.automation-status-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
}

.automation-spinner-wrap {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.automation-spinner-icon {
    font-size: 1.8rem;
    color: var(--app-primary);
}

.automation-status-text {
    flex: 1;
    min-width: 0;
}

.automation-status-title {
    margin: 0 0 0.2rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.automation-status-detail {
    margin: 0;
    font-size: 0.82rem;
    color: var(--app-text-muted);
    line-height: 1.4;
}

.automation-status-badge {
    flex-shrink: 0;
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 999px;
    background: var(--app-surface-alt);
    color: var(--app-text-soft);
}

.automation-badge-processing,
.automation-badge-pending {
    background: #e8f4fc;
    color: #1a6fb5;
}

.automation-badge-ready {
    background: #e6f9ed;
    color: #1a7a3a;
}

.automation-badge-confirming {
    background: #fff8e1;
    color: #b5850a;
}

.automation-badge-completed {
    background: #e6f9ed;
    color: #1a7a3a;
}

.automation-badge-failed {
    background: #fdeaea;
    color: #c0392b;
}

.automation-badge-cancelled {
    background: var(--app-surface-alt);
    color: var(--app-text-muted);
}

.automation-pdf-preview {
    margin: 0.75rem 0;
    border: 1px solid rgba(214, 225, 240, 0.85);
    border-radius: 14px;
    overflow: hidden;
    background: #f8fbff;
}

.automation-pdf-iframe {
    display: block;
    width: 100%;
    height: min(62vh, 520px);
    border: 0;
}

.automation-repuestos-verify {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid rgba(214, 225, 240, 0.85);
    background: var(--app-surface, #fff);
}

.automation-repuestos-verify-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
}

.automation-repuestos-verify-hint {
    font-size: 0.78rem;
    color: var(--app-text-muted);
    line-height: 1.35;
}

.automation-repuestos-verify-table-wrap {
    margin-top: 0.5rem;
}

.automation-repuestos-verify-table {
    font-size: 0.8125rem;
}

.automation-repuestos-verify-table thead th {
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(248, 251, 255, 0.95);
}

.automation-error {
    margin: 0.75rem 0;
}

.automation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(233, 239, 247, 0.95);
}

.app-modal .modal-body {
    padding: 1.3rem 1.35rem 1.4rem;
    max-height: 78vh;
    overflow-y: auto;
}

.modal-title-wrap .modal-title {
    margin: 0;
    font-weight: 700;
}

.app-alert {
    border: 1px solid rgba(220, 188, 123, 0.35);
    border-radius: 16px;
}

.app-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 320px;
    border: 0;
    border-radius: 16px;
    box-shadow: var(--app-shadow-md);
}

.raw-pre {
    margin: 0;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: "Consolas", "Cascadia Code", "Courier New", monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    max-height: min(70vh, 640px);
    overflow: auto;
}

.raw-json-code {
    display: block;
    margin: 0;
    padding: 1rem 1.15rem;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    tab-size: 2;
    color: #cbd5e1;
}

/* JSON syntax (modal raw Orion/Porto/SURA) */
.raw-json-code .json-hl-key {
    color: #7dd3fc;
}
.raw-json-code .json-hl-string {
    color: #86efac;
}
.raw-json-code .json-hl-number {
    color: #fcd34d;
}
.raw-json-code .json-hl-boolean {
    color: #c4b5fd;
}
.raw-json-code .json-hl-null {
    color: #94a3b8;
    font-style: italic;
}

.excel-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.excel-table-container {
    max-height: 70vh;
    overflow: auto;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    padding: 0.75rem;
    background: #fff;
}

.table-subject {
    min-width: 380px;
    max-width: min(58vw, 720px);
}

.table-row-important .table-subject {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.table-subject-main {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    color: var(--app-text);
    max-width: min(58vw, 720px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-subject-main .table-subject-text {
    font-weight: 600;
    color: var(--app-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-row-important .table-subject-main .table-subject-text {
    font-weight: 700;
    color: #0a1220;
}

html[data-reception-active-card="gold"][data-theme="dark"] body.app-shell .table-row-important .table-subject-main .table-subject-text {
    color: var(--app-text);
}

.table-subject-meta {
    display: block;
    margin-top: 0.28rem;
    color: var(--app-text-muted);
    font-size: 0.8rem;
}

.important-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex: 0 0 auto;
    padding: 0.12rem 0.5rem 0.14rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(224, 32, 32, 0.14);
    color: #b91c1c;
    border: 1px solid rgba(224, 32, 32, 0.4);
    line-height: 1.2;
}

html[data-reception-active-card="gold"] body.app-shell .important-chip {
    background: rgba(214, 173, 74, 0.18);
    color: #8a5a00;
    border-color: rgba(214, 173, 74, 0.55);
}

.important-chip-emoji {
    font-size: 0.75rem;
    line-height: 1;
}

.table-cell-muted {
    color: var(--app-text-soft);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--app-border);
    background: #fff;
    color: var(--app-text-soft);
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

/* Mismo hover para iconos y Licitar (evita el azul oscuro solo en el primario). */
.action-btn:hover,
.action-btn:focus,
.action-btn-primary:hover,
.action-btn-primary:focus {
    color: var(--app-primary);
    border-color: rgba(28, 79, 161, 0.35);
    background: var(--app-primary-soft);
}

.action-btn-primary {
    width: auto;
    padding: 0 0.85rem;
    gap: 0.45rem;
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
    font-weight: 600;
}

.important-action-btn.is-active {
    border-color: rgba(194, 52, 43, 0.28);
    background: #ffe6e3;
    color: #c2342b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

html[data-reception-active-card="gold"] body.app-shell .important-action-btn.is-active {
    border-color: rgba(214, 173, 74, 0.55);
    background: rgba(214, 173, 74, 0.18);
    color: #8a5a00;
}

.important-action-btn:hover,
.important-action-btn:focus {
    border-color: rgba(194, 52, 43, 0.28);
}

html[data-reception-active-card="gold"] body.app-shell .important-action-btn:hover,
html[data-reception-active-card="gold"] body.app-shell .important-action-btn:focus {
    border-color: rgba(214, 173, 74, 0.55);
}

.archive-action-btn.is-active {
    border-color: rgba(45, 108, 223, 0.22);
    background: #eaf1ff;
    color: #1d5fd0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.detail-card,
.attachment-card,
.list-panel,
.quote-panel {
    padding: 1rem 1.05rem;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: var(--app-surface-alt);
}

.detail-card h6,
.attachment-card h6,
.list-panel h6,
.quote-panel h6 {
    margin-bottom: 0.9rem;
    font-weight: 700;
}

.licitar-price-input {
    font-variant-numeric: tabular-nums;
}

.detail-table {
    width: 100%;
    margin: 0;
}

.detail-table tr:not(:last-child) td {
    border-bottom: 1px solid #e9eff7;
}

.detail-table td {
    padding: 0.65rem 0;
    vertical-align: top;
}

.detail-label {
    width: 38%;
    color: var(--app-text-soft);
    font-weight: 600;
}

.detail-value {
    color: var(--app-text);
    word-break: break-word;
}

.parts-list {
    display: grid;
    gap: 0.65rem;
}

.parts-summary {
    display: grid;
    gap: 0.75rem;
}

.parts-summary-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.35rem;
    justify-content: flex-end;
    align-items: baseline;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(28, 79, 161, 0.2);
    border-radius: 12px;
    background: linear-gradient(180deg, #f4f8ff 0%, #e8f1fc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    color: var(--app-text);
    font-size: 0.9rem;
    font-weight: 600;
}

.parts-summary-totals .parts-summary-total-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    white-space: nowrap;
}

.parts-summary-totals strong {
    color: var(--app-primary);
    font-size: 1.08rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.part-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #e7eef7;
    border-radius: 14px;
    background: #fff;
}

.part-item-main {
    font-weight: 600;
}

.part-item-meta {
    color: var(--app-text-muted);
    font-size: 0.84rem;
}

.attachment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.attachment-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.85rem;
}

.carousel-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
}

.image-carousel {
    border: 1px solid var(--app-border);
    border-radius: 18px;
    background: #fff;
    padding: 0.9rem;
    outline: none;
}

.image-carousel:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(28, 79, 161, 0.14);
}

.image-carousel-viewport {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 0.8rem;
    align-items: center;
}

.image-carousel-track {
    min-width: 0;
}

.image-carousel-slide {
    display: none;
    margin: 0;
}

.image-carousel-slide.is-active {
    display: block;
}

.image-carousel-image-frame {
    display: block;
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 14px;
}

.image-carousel-image-frame.is-zoomed {
    cursor: grab;
}

.image-carousel-image-frame.is-zoomed.is-dragging {
    cursor: grabbing;
}

.image-carousel-image-frame img.attachment-thumb {
    transform-origin: 0 0;
    will-change: transform;
}

.image-carousel-nav {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
    color: var(--app-text);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.image-carousel-nav:hover,
.image-carousel-nav:focus {
    background: var(--app-primary-soft);
    border-color: rgba(28, 79, 161, 0.35);
    color: var(--app-primary);
}

.image-carousel-nav:disabled {
    opacity: 0.45;
    cursor: default;
}

.attachment-image-card {
    padding: 0.7rem;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: #fff;
}

.attachment-thumb {
    width: 100%;
    height: min(44vh, 340px);
    object-fit: contain;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
    display: block;
}

.attachment-filename {
    margin-top: 0.55rem;
    color: var(--app-text-muted);
    font-size: 0.78rem;
    word-break: break-all;
}

.image-carousel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    color: var(--app-text-muted);
    font-size: 0.8rem;
}

.image-carousel-counter {
    font-weight: 700;
    color: var(--app-text-soft);
}

.image-carousel-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.image-carousel-help {
    text-align: right;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 15, 28, 0.82);
    backdrop-filter: blur(4px);
}

.image-lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(94vw, 1400px);
    height: min(92vh, 920px);
    margin: 4vh auto;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
}

.image-lightbox-close {
    grid-column: 3;
    justify-self: end;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.image-lightbox-stage {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    padding: 1rem;
}

.image-lightbox-stage.is-zoomed {
    align-items: flex-start;
    justify-content: flex-start;
}

.image-lightbox-image {
    display: block;
    max-width: none;
    max-height: none;
    object-fit: contain;
    cursor: zoom-in;
    transition: width 0.18s ease, height 0.18s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.image-lightbox-image.is-zoomed {
    cursor: grab;
}

.image-lightbox-stage.is-dragging .image-lightbox-image.is-zoomed {
    cursor: grabbing;
}

.image-lightbox-nav {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.image-lightbox-nav-prev {
    grid-column: 1;
    grid-row: 2;
}

.image-lightbox-nav-next {
    grid-column: 3;
    grid-row: 2;
}

.image-lightbox-toolbar {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.86);
}

.image-lightbox-caption {
    font-weight: 600;
}

.image-lightbox-help {
    color: rgba(255, 255, 255, 0.72);
}

body.lightbox-open {
    overflow: hidden;
}

.quote-table {
    margin-bottom: 0;
}

.quote-table thead th {
    background: #f4f7fb;
    font-size: 0.76rem;
    color: var(--app-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Modal Licitar / confirmación: misma grilla thead/tbody (evita columnas desfasadas) */
#licitarModal .quote-table,
#licitarConfirmModal .quote-table {
    table-layout: fixed;
    width: 100%;
}

#licitarModal .quote-table thead th,
#licitarModal .quote-table tbody td,
#licitarConfirmModal .quote-table thead th,
#licitarConfirmModal .quote-table tbody td {
    vertical-align: middle;
}

#licitarModal .quote-table thead th,
#licitarConfirmModal .quote-table thead th {
    white-space: nowrap;
    padding: 0.55rem 0.6rem;
    box-sizing: border-box;
}

#licitarModal .quote-table tbody td .form-control,
#licitarConfirmModal .quote-table tbody td .form-control,
#licitarModal .quote-table tbody td .form-select,
#licitarConfirmModal .quote-table tbody td .form-select {
    min-width: 0;
    width: 100%;
}

/* Misma altura que .form-control-sm: el global .form-select { min-height: 48px } no lo reduce */
#licitarModal .quote-table tbody td .form-control.form-control-sm,
#licitarModal .quote-table tbody td .form-select.form-select-sm {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.375rem;
}

#licitarModal .quote-table tbody td .licitar-stock-select.form-select-sm {
    /* Flecha del select sin inflar la caja */
    padding-right: 2rem;
    background-position: right 0.5rem center;
    background-size: 1rem 0.65rem;
}

#licitarModal .quote-table tbody td:nth-child(2) {
    word-break: break-word;
}

/* Cotización: columna Cotizar con ancho fijo (evita solapes) */
#licitarModal .quote-table thead th:nth-child(1),
#licitarModal .quote-table tbody td:nth-child(1),
#licitarConfirmModal .quote-table thead th:nth-child(1),
#licitarConfirmModal .quote-table tbody td:nth-child(1) {
    width: 5.15rem;
    min-width: 5.15rem;
    max-width: 5.75rem;
    padding-left: 0.45rem;
    padding-right: 0.55rem;
    text-align: center;
    vertical-align: middle;
}

#licitarModal .quote-table thead th:nth-child(1),
#licitarConfirmModal .quote-table thead th:nth-child(1) {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

#licitarModal .quote-table tbody td:nth-child(1) .form-check {
    display: flex;
    justify-content: center;
    margin-bottom: 0;
    min-height: 0;
}

#licitarModal .quote-table thead th:nth-child(2),
#licitarModal .quote-table tbody td:nth-child(2),
#licitarConfirmModal .quote-table thead th:nth-child(2),
#licitarConfirmModal .quote-table tbody td:nth-child(2) {
    width: 27%;
    min-width: 9rem;
    max-width: 22rem;
    padding-left: 0.35rem;
    padding-right: 0.45rem;
}

/* Ref. Mercado (solo modal Licitar): compacto para dar aire a disponibilidad + precios */
#licitarModal .quote-table thead th:nth-child(3),
#licitarModal .quote-table tbody td:nth-child(3) {
    width: 5.25rem;
    min-width: 5rem;
    max-width: 6rem;
    padding-left: 0.35rem;
    padding-right: 0.4rem;
}

/* Confirmación: col 3 = Original (importes) */
#licitarConfirmModal .quote-table thead th:nth-child(3),
#licitarConfirmModal .quote-table tbody td:nth-child(3) {
    width: 7.5rem;
    min-width: 6.5rem;
    max-width: 10rem;
    padding-left: 0.45rem;
    padding-right: 0.55rem;
    text-align: right;
}

/* Confirmación (BSE): distribución más natural (repuesto ancho, disponibilidad angosta) */
#licitarConfirmModal .quote-table thead th:nth-child(1),
#licitarConfirmModal .quote-table tbody td:nth-child(1) {
    width: 48%;
    min-width: 14rem;
    max-width: none;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    text-align: left;
}

#licitarConfirmModal .quote-table thead th:nth-child(2),
#licitarConfirmModal .quote-table tbody td:nth-child(2) {
    width: 12%;
    min-width: 6.25rem;
    max-width: 8rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    text-align: center;
    white-space: nowrap;
}

#licitarConfirmModal .quote-table thead th:nth-child(3),
#licitarConfirmModal .quote-table tbody td:nth-child(3),
#licitarConfirmModal .quote-table thead th:nth-child(4),
#licitarConfirmModal .quote-table tbody td:nth-child(4),
#licitarConfirmModal .quote-table thead th:nth-child(5),
#licitarConfirmModal .quote-table tbody td:nth-child(5) {
    text-align: right;
    white-space: nowrap;
}

/*
 * Modal Licitar — columna 4 = Disponibilidad (select/texto): ancho mínimo real para
 * "Seleccionar…" + padding derecho como respiro antes del bloque de precios.
 */
#licitarModal .quote-table thead th:nth-child(4),
#licitarModal .quote-table tbody td:nth-child(4) {
    width: 11.25rem;
    min-width: 11rem;
    max-width: 14rem;
    padding-left: 0.5rem;
    padding-right: 1rem;
    text-align: center;
    vertical-align: middle;
}

/*
 * Separación visual Disponibilidad → precios: padding + línea muy suave (grupo de importes).
 */
#licitarModal .quote-table thead th:nth-child(5),
#licitarModal .quote-table tbody td:nth-child(5) {
    padding-left: 0.85rem;
    border-left: 1px solid color-mix(in srgb, var(--app-border) 70%, transparent);
}

@supports not (border-left-color: color-mix(in srgb, white 50%, black)) {
    #licitarModal .quote-table thead th:nth-child(5),
    #licitarModal .quote-table tbody td:nth-child(5) {
        border-left-color: rgba(0, 0, 0, 0.08);
    }
}

/* Precios (y en SURA también Calidad en col 5): ritmo homogéneo entre columnas */
#licitarModal .quote-table thead th:nth-child(5),
#licitarModal .quote-table thead th:nth-child(6),
#licitarModal .quote-table thead th:nth-child(7) {
    padding-right: 0.55rem;
}

#licitarModal .quote-table tbody td:nth-child(6),
#licitarModal .quote-table tbody td:nth-child(7) {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

#licitarModal .quote-table tbody td:nth-child(5):has(.licitar-price-input),
#licitarModal .quote-table tbody td:nth-child(6):has(.licitar-price-input),
#licitarModal .quote-table tbody td:nth-child(7):has(.licitar-price-input) {
    text-align: right;
}

/* VALUA/Porto/Orion/BSE: cabeceras de precios alineadas a la derecha con el número */
#licitarModal .quote-table:not(.licitar-quote-table--sura) thead th:nth-child(5),
#licitarModal .quote-table:not(.licitar-quote-table--sura) thead th:nth-child(6),
#licitarModal .quote-table:not(.licitar-quote-table--sura) thead th:nth-child(7) {
    text-align: right;
}

/* SURA: Calidad centrada; Precio como importe */
#licitarModal .quote-table.licitar-quote-table--sura thead th:nth-child(5) {
    text-align: center;
}

#licitarModal .quote-table.licitar-quote-table--sura thead th:nth-child(6) {
    text-align: right;
}

/* Confirmación: 4ª columna = precio intermedio (p. ej. Legítimo); ancho uniforme con el modal */
#licitarConfirmModal .quote-table thead th:nth-child(4),
#licitarConfirmModal .quote-table tbody td:nth-child(4) {
    width: 7rem;
    min-width: 6.5rem;
    max-width: 9rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    text-align: right;
    white-space: nowrap;
}

/* Filas de repuestos (cotización): hover sutil para ver en qué línea estás */
#licitarModal #licitar-repuestos-tbody tr > td,
#licitarConfirmModal #licitar-confirm-tbody tr > td {
    transition: background-color 0.18s ease;
}

#licitarModal #licitar-repuestos-tbody tr:hover > td,
#licitarConfirmModal #licitar-confirm-tbody tr:hover > td {
    background-color: color-mix(in srgb, var(--app-primary) 7%, var(--app-surface));
}

@supports not (background-color: color-mix(in srgb, white 50%, black)) {
    #licitarModal #licitar-repuestos-tbody tr:hover > td,
    #licitarConfirmModal #licitar-confirm-tbody tr:hover > td {
        background-color: rgba(28, 79, 161, 0.06);
    }
}

#licitarModal .modal-footer .licitar-modal-footer-action-btn,
#licitarConfirmModal .modal-footer .licitar-confirm-action-btn {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.quote-alert {
    border-radius: 14px;
}

.line-preview-list {
    display: grid;
    gap: 0.7rem;
}

.line-preview-item {
    padding: 0.9rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
}

.line-preview-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

@media (max-width: 640px) {
    .filters-result-summary {
        margin-left: 0;
        max-width: none;
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 1200px) {
    .filters-layout {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-field-search {
        grid-column: 1 / -1;
    }

    .filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Filtros: en anchos intermedios la grilla de 6 columnas aprieta demasiado (sin afectar ≥1920 ni ≤1200). */
@media (max-width: 1600px) and (min-width: 1201px) {
    .filters-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-field-search {
        grid-column: 1 / -1;
    }

    .filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

/*
 * Notebooks / pantallas < 1920px — el layout “grande” (p. ej. 3840×2160) no entra aquí.
 * Rango 992px–1919px: reduce min-width de la tabla y márgenes; <992 sigue con mobile.css.
 */
@media (max-width: 1919px) and (min-width: 992px) {
    .app-container {
        width: min(1240px, calc(100% - 48px));
    }

    .dashboard-table {
        min-width: 1180px;
    }

    .dashboard-table thead th,
    .dashboard-table tbody td {
        padding: 0.75rem 0.65rem;
    }
}

@media (max-width: 1599px) and (min-width: 992px) {
    .dashboard-table {
        min-width: 1060px;
    }

    .dashboard-table thead th {
        font-size: 0.72rem;
        padding: 0.7rem 0.55rem;
    }

    .dashboard-table tbody td {
        padding: 0.7rem 0.55rem;
    }

    .table-subject-main .table-subject-text {
        font-size: 0.9rem;
    }

    .section-card.table-card {
        padding: 1.15rem 1.25rem;
    }
}

@media (max-width: 1399px) and (min-width: 992px) {
    .dashboard-table {
        min-width: 980px;
    }

    .dashboard-table thead th.table-logo-th,
    .dashboard-table tbody td.table-logo-cell {
        width: 46px;
        min-width: 46px;
        max-width: 46px;
    }

    .licit-row-brand {
        width: 34px;
        height: 34px;
    }

    .table-filter-chips {
        gap: 0.45rem;
    }

    .estado-filter-chip {
        padding: 0.38rem 0.65rem;
        font-size: 0.76rem;
    }

    .table-toolbar {
        gap: 0.5rem;
    }

    .table-toolbar .btn {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }

    .reception-summary-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 1199px) and (min-width: 992px) {
    .table-card .section-header-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .table-card .section-header-inline > div:first-child {
        min-width: 0;
    }

    .table-card .table-toolbar {
        width: 100%;
        justify-content: space-between;
    }

    .table-card .view-toggle {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
    }
}

@media (max-width: 991.98px) {
    .app-container {
        width: min(100% - 24px, 1240px);
    }

    .dashboard-hero,
    .section-header,
    .section-header-inline {
        flex-direction: column;
    }

    .dashboard-hero-meta {
        min-width: 0;
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .sync-progress-header {
        flex-direction: column;
    }

    .sync-progress-percent {
        min-width: 0;
        text-align: left;
    }

    .image-carousel-viewport {
        grid-template-columns: 1fr;
    }

    .image-carousel-nav {
        display: none;
    }

    .image-carousel-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .image-carousel-help {
        text-align: left;
    }
}

/* Columna centrada “tipo 4K” solo en viewports anchos; no compite con reglas <1920px. */
@media (min-width: 1920px) {
    .app-container {
        width: min(1220px, calc(100% - 120px));
    }
}

@media (max-width: 767.98px) {
    .dashboard-main {
        padding-top: 1.25rem;
    }

    .section-card,
    .dashboard-hero {
        padding: 1.1rem;
        border-radius: 18px;
    }

    .filters-layout,
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .table-toolbar {
        flex-direction: column;
    }

    .filter-actions .btn,
    .table-toolbar .btn {
        width: 100%;
    }

    .dashboard-table {
        min-width: 900px;
    }

    .image-lightbox-dialog {
        width: min(96vw, 1400px);
        height: min(94vh, 920px);
        margin: 3vh auto;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto auto;
    }

    .image-lightbox-close,
    .image-lightbox-stage,
    .image-lightbox-toolbar,
    .image-lightbox-nav-prev,
    .image-lightbox-nav-next {
        grid-column: 1;
    }

    .image-lightbox-nav-prev,
    .image-lightbox-nav-next {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    .image-lightbox-nav-prev {
        left: 0.5rem;
    }

    .image-lightbox-nav-next {
        right: 0.5rem;
    }

    .image-lightbox-toolbar {
        flex-direction: column;
    }
}

.search-synonyms-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: end;
}

.search-synonyms-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.search-example-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-alt);
}

.search-example-card strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.search-example-card p {
    margin: 0;
    color: var(--app-text-soft);
}

.search-synonym-chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.search-synonym-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: var(--app-primary-soft);
    color: var(--app-primary-dark);
    font-size: 0.8rem;
    font-weight: 600;
}

.search-synonym-chip.is-muted {
    background: #eef2f8;
    color: var(--app-text-soft);
}

/* --- Resumen de recepción (dashboard) --- */
.reception-summary-card.reception-summary-collapsed .reception-summary-body {
    display: none;
}

.reception-summary-card.reception-summary-collapsed .reception-summary-collapse-btn .fa-chevron-up {
    transform: rotate(180deg);
}

.reception-summary-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.reception-summary-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.reception-summary-range-hint {
    margin: 0 0 0.5rem;
}

.reception-summary-pills {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 0.2rem;
    border-radius: 999px;
    border: 1px solid var(--app-border-strong);
    background: var(--app-surface-alt);
    gap: 0.15rem;
}

.reception-summary-pill {
    border: none;
    background: transparent;
    color: var(--app-text-soft);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.reception-summary-pill:hover {
    color: var(--app-text);
    background: rgba(28, 79, 161, 0.08);
}

.reception-summary-pill:focus-visible {
    outline: 2px solid rgba(28, 79, 161, 0.45);
    outline-offset: 2px;
}

.reception-summary-pill.is-active {
    background: #fff;
    color: var(--app-primary-dark);
    box-shadow: 0 1px 3px rgba(15, 35, 75, 0.12);
}

.reception-summary-collapse-btn {
    color: var(--app-text-muted);
    padding: 0.35rem 0.55rem;
    text-decoration: none;
    border-radius: 10px;
}

.reception-summary-collapse-btn:hover {
    color: var(--app-primary);
    background: rgba(28, 79, 161, 0.06);
}

.reception-summary-collapse-btn .fa-chevron-up {
    transition: transform 0.2s ease;
}

.reception-summary-total {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    line-height: 1.35;
}

.reception-summary-total-label {
    font-weight: 800;
    color: var(--app-primary-dark);
    letter-spacing: 0.04em;
    font-size: 0.78rem;
    margin-right: 0.35rem;
}

.reception-summary-total-num {
    font-weight: 800;
    font-size: 1.45rem;
    color: var(--app-primary-dark);
    margin-right: 0.35rem;
}

.reception-summary-total-suffix {
    color: var(--app-text-soft);
    font-weight: 500;
    font-size: 0.92rem;
}

.reception-summary-loading {
    color: var(--app-text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.reception-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
}

.reception-summary-system-card {
    /* Franja izquierda: siempre el azul del header (identidad unificada) */
    --reception-card-accent: var(--app-navbar-base);
    position: relative;
    border: 1px solid var(--app-border);
    border-left: 4px solid var(--reception-card-accent);
    border-radius: var(--app-radius-md);
    padding: 0.85rem 1rem;
    background: var(--app-surface);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    box-shadow: var(--app-shadow-sm);
}

.reception-summary-system-card.reception-summary-system-card--clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.12s ease;
}

.reception-summary-system-card.reception-summary-system-card--clickable:hover {
    box-shadow: var(--app-shadow-md);
}

.reception-summary-system-card.reception-summary-system-card--clickable:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}

/* Card cuyo sistema/compañía coincide con los filtros del listado */
.reception-summary-system-card.reception-summary-system-card--filter-active {
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--app-primary) 42%, transparent),
        0 0 22px color-mix(in srgb, var(--app-primary) 14%, transparent),
        var(--app-shadow-sm);
    background: color-mix(in srgb, var(--app-primary-soft) 55%, var(--app-surface));
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.reception-summary-system-card.reception-summary-system-card--filter-active.reception-summary-system-card--clickable:hover {
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--app-primary) 52%, transparent),
        0 0 26px color-mix(in srgb, var(--app-primary) 18%, transparent),
        var(--app-shadow-md);
}

/* ============================================================
   Recepción: estilo "dorado" para card activa (toggle simple)
   Para volver a la versión anterior: en templates/dashboard.html cambiar
   data-reception-active-card="gold" por "default" o borrar el atributo.
   ============================================================ */
html[data-reception-active-card="gold"] body.app-shell .reception-summary-system-card.reception-summary-system-card--filter-active {
    border-color: rgba(214, 173, 74, 0.55);
    background: linear-gradient(180deg, rgba(255, 236, 190, 0.55), rgba(255, 255, 255, 0.92));
    box-shadow:
        0 0 0 2px rgba(214, 173, 74, 0.55),
        0 0 26px rgba(214, 173, 74, 0.25),
        0 14px 34px rgba(20, 32, 52, 0.12);
    transition: box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

html[data-reception-active-card="gold"] body.app-shell .reception-summary-system-card.reception-summary-system-card--filter-active.reception-summary-system-card--clickable:hover {
    box-shadow:
        0 0 0 2px rgba(214, 173, 74, 0.75),
        0 0 32px rgba(214, 173, 74, 0.32),
        0 18px 44px rgba(20, 32, 52, 0.16);
}

.reception-summary-system-card.is-inactive {
    opacity: 0.68;
    border-style: dashed;
}

.reception-summary-system-card.is-inactive .reception-summary-system-count {
    color: var(--app-text-muted);
}

.reception-summary-system-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem;
}

.reception-summary-count-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.2rem;
    min-width: 5.5rem;
}

.reception-summary-trend {
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: right;
    max-width: 7.5rem;
    letter-spacing: 0.01em;
    min-height: 1.15em;
}

.reception-summary-trend--above.reception-trend--up {
    color: #0d7a45;
}

.reception-summary-trend--below.reception-trend--mid {
    color: #b8860b;
}

.reception-summary-trend--below.reception-trend--low {
    color: #b33a2a;
}

html[data-theme="dark"] body.app-shell .reception-summary-trend--above.reception-trend--up {
    color: #34d399;
}

html[data-theme="dark"] body.app-shell .reception-summary-trend--below.reception-trend--mid {
    color: #fbbf24;
}

html[data-theme="dark"] body.app-shell .reception-summary-trend--below.reception-trend--low {
    color: #f87171;
}

.reception-summary-trend--below.reception-trend--neutral {
    color: var(--app-text-muted);
    font-weight: 600;
}

.reception-summary-count-col .reception-summary-system-count {
    line-height: 1.05;
}

.reception-summary-licitadas-inline {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 0.18rem;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
}

html[data-theme="dark"] body.app-shell .reception-summary-licitadas-inline {
    color: #94a3b8;
}

.reception-summary-system-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: center;
    min-height: 40px;
}

.reception-summary-system-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    align-self: center;
    box-sizing: border-box;
}

.reception-tone-bse .reception-summary-system-icon {
    background: linear-gradient(135deg, #1c4fa1, #2563c7);
}

.reception-tone-sancristobal .reception-summary-system-icon {
    background: linear-gradient(135deg, #1a2d5a, #2a4a80);
}

.reception-tone-mapfre .reception-summary-system-icon {
    background: linear-gradient(135deg, #c8102e, #e0243e);
}

.reception-tone-mapfre .reception-summary-system-icon--logo {
    background: #fff !important;
    border-color: rgba(214, 26, 29, 0.28);
}

.reception-tone-surco .reception-summary-system-icon {
    background: linear-gradient(135deg, #1a3a6c, #264f8e);
}

.reception-tone-sura .reception-summary-system-icon {
    background: linear-gradient(135deg, #0090b8, #00a8cc);
}

.reception-tone-porto .reception-summary-system-icon {
    background: linear-gradient(135deg, #c41e2a, #e02834);
}

.reception-tone-hdi .reception-summary-system-icon {
    background: linear-gradient(135deg, #c41451, #e01860);
}

.reception-tone-sbi .reception-summary-system-icon {
    background: linear-gradient(135deg, #3a5a8c, #4d72a8);
}

.reception-tone-default .reception-summary-system-icon {
    background: linear-gradient(135deg, #5c6570, #7a8494);
}

.reception-summary-system-icon--logo {
    background: #fff !important;
    border: 1px solid rgba(15, 35, 75, 0.12);
    box-shadow: 0 1px 2px rgba(15, 35, 75, 0.06);
    color: inherit;
}

.reception-summary-system-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
    display: block;
}

.reception-summary-system-info .reception-summary-system-name {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--app-text);
    line-height: 1.2;
}


.reception-summary-system-count {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--app-primary-dark);
    line-height: 1;
}

.reception-summary-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-primary-dark);
    background: rgba(28, 79, 161, 0.06);
    border: 1px solid rgba(28, 79, 161, 0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.reception-summary-details-toggle:hover {
    background: rgba(28, 79, 161, 0.11);
}

.reception-summary-details-toggle:focus-visible {
    outline: 2px solid rgba(28, 79, 161, 0.35);
    outline-offset: 2px;
}

.reception-summary-details-toggle[aria-expanded="true"] .reception-summary-chevron-mini {
    transform: rotate(180deg);
}

.reception-summary-chevron-mini {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.reception-summary-detalle {
    padding: 0.4rem 0 0;
    border-top: 1px dashed rgba(214, 225, 240, 0.9);
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.reception-detalle-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.65rem;
    font-size: 0.78rem;
    color: var(--app-text);
}

.reception-detalle-row--strong .reception-detalle-label {
    font-weight: 700;
}

.reception-detalle-row--strong .reception-detalle-num {
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--app-primary-dark);
}

.reception-detalle-row--arch {
    margin-top: 0.3rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--app-border);
    color: var(--app-text-soft);
}

.reception-detalle-label {
    font-weight: 600;
}

.reception-detalle-num {
    font-weight: 700;
    color: var(--app-text-soft);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.reception-detalle-muted {
    margin: 0;
    font-size: 0.82rem;
    color: var(--app-text-muted);
}

.reception-summary-company-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0 0;
    border-top: 1px dashed rgba(214, 225, 240, 0.9);
}

.reception-summary-company-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    color: var(--app-text);
}

.reception-summary-company-list .reception-summary-company-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reception-summary-company-list .reception-summary-company-count {
    font-weight: 700;
    color: var(--app-text-soft);
    flex-shrink: 0;
}

.reception-summary-system-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reception-summary-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.reception-summary-status-badge.is-active {
    color: #0a7b3e;
    background: rgba(10, 123, 62, 0.09);
}

.reception-summary-status-badge.is-inactive {
    color: #b33a2a;
    background: rgba(179, 58, 42, 0.08);
}

.reception-summary-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.reception-summary-status-badge.is-active .reception-summary-status-dot {
    background: #0a7b3e;
    box-shadow: 0 0 0 2px rgba(10, 123, 62, 0.18);
}

.reception-summary-status-badge.is-inactive .reception-summary-status-dot {
    background: #b33a2a;
    box-shadow: 0 0 0 2px rgba(179, 58, 42, 0.15);
}

.reception-summary-last-date {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--app-text-muted);
    font-weight: 500;
}

.reception-summary-last-date .fa-clock {
    font-size: 0.62rem;
    opacity: 0.7;
}

.reception-summary-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.25rem;
    color: var(--app-text-muted);
    font-size: 0.92rem;
    border: 1px dashed var(--app-border);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-alt);
}

@media (max-width: 767.98px) {
    .reception-summary-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .reception-summary-toolbar {
        justify-content: space-between;
    }

    .reception-summary-pills {
        flex: 1;
        justify-content: center;
    }
}

.search-terms-editor {
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-alt);
}

/* --- Logs de recepción (/configuracion/logs) --- */
.logs-filters-layout {
    margin-top: 1rem;
}

.logs-table-section {
    margin-top: 1rem;
}

.logs-table-scroll {
    max-height: calc(100vh - 300px);
    overflow: auto;
    background: var(--app-surface, #fff);
}

.logs-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--app-border, #dee2e6);
}

@media (max-width: 767.98px) {
    .logs-table-scroll {
        max-height: calc(100vh - 360px);
    }
}

/* ============================================================
   Dark Mode Toggle
   ============================================================ */
.app-navbar .dark-mode-toggle {
    flex-shrink: 0;
    z-index: 20;
}

.dark-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 200, 60, 0.9);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.25s, transform 0.25s, color 0.25s;
    padding: 0;
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: rotate(15deg) scale(1.08);
    color: #ffd740;
}

html[data-theme="dark"] .dark-mode-toggle {
    color: rgba(255, 200, 60, 1);
    background: rgba(255, 200, 60, 0.12);
    border-color: rgba(255, 200, 60, 0.25);
}

/* Bootstrap .btn carga después y pone texto oscuro: forzar contraste en navbar oscura */
.navbar.app-navbar .btn.dark-mode-toggle,
.navbar.app-navbar .btn.dark-mode-toggle:focus {
    color: #ffe066 !important;
    background: rgba(255, 200, 60, 0.16) !important;
    border-color: rgba(255, 215, 100, 0.45) !important;
    box-shadow: 0 0 0 1px rgba(255, 210, 100, 0.12);
}

.navbar.app-navbar .btn.dark-mode-toggle:hover {
    color: #fff6c2 !important;
    background: rgba(255, 200, 60, 0.26) !important;
    border-color: rgba(255, 230, 140, 0.55) !important;
}

.navbar.app-navbar .btn.dark-mode-toggle i {
    color: inherit !important;
}

.navbar.navbar-dark:not(.app-navbar) .btn.dark-mode-toggle,
.navbar.navbar-dark:not(.app-navbar) .btn.dark-mode-toggle:focus {
    color: #ffe066 !important;
    background: rgba(255, 200, 60, 0.16) !important;
    border-color: rgba(255, 215, 100, 0.45) !important;
    box-shadow: 0 0 0 1px rgba(255, 210, 100, 0.12);
}

.navbar.navbar-dark:not(.app-navbar) .btn.dark-mode-toggle:hover {
    color: #fff6c2 !important;
    background: rgba(255, 200, 60, 0.26) !important;
    border-color: rgba(255, 230, 140, 0.55) !important;
}

.navbar.navbar-dark:not(.app-navbar) .btn.dark-mode-toggle i {
    color: inherit !important;
}

/* ============================================================
   Dark Mode Theme
   ============================================================ */
html[data-theme="dark"] body.app-shell {
    --app-bg: #0d1117;
    --app-surface: #161b22;
    --app-surface-alt: #1c2129;
    --app-border: rgba(255, 255, 255, 0.1);
    --app-border-strong: rgba(255, 255, 255, 0.18);
    --app-text: #e6edf3;
    --app-text-soft: #9da8b7;
    --app-text-muted: #6d7a8a;
    --app-primary: #4d9fff;
    --app-primary-dark: #79b8ff;
    --app-primary-soft: rgba(77, 159, 255, 0.12);
    --app-success: #3fb68b;
    --app-success-soft: rgba(52, 211, 153, 0.1);
    --app-warning: #e5a100;
    --app-warning-soft: rgba(251, 191, 36, 0.1);
    --app-danger: #f85149;
    --app-danger-soft: rgba(248, 81, 73, 0.1);
    --app-info: #4d9fff;
    --app-shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.4);
    --app-shadow-md: 0 18px 40px rgba(0, 0, 0, 0.5);

    background: #0d1117 !important;
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .section-card {
    background: var(--app-surface);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .form-control,
html[data-theme="dark"] body.app-shell .form-select {
    background-color: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .form-control:focus,
html[data-theme="dark"] body.app-shell .form-select:focus {
    background-color: #1f2937;
    border-color: rgba(77, 159, 255, 0.4);
    color: var(--app-text);
    box-shadow: 0 0 0 3px rgba(77, 159, 255, 0.15);
}

html[data-theme="dark"] body.app-shell .form-control::placeholder {
    color: var(--app-text-muted);
}

html[data-theme="dark"] body.app-shell .table {
    color: var(--app-text);
    --bs-table-bg: transparent;
}

html[data-theme="dark"] body.app-shell .table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .table > thead > tr > th {
    background-color: var(--app-surface-alt);
    border-bottom-color: var(--app-border-strong);
    color: var(--app-text-soft);
}

html[data-theme="dark"] body.app-shell .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .table-hover > tbody > tr:hover > * {
    background-color: rgba(77, 159, 255, 0.06);
    color: var(--app-text);
}

/* Bootstrap carga después: sin !important el hover claro ganaba en tablas con .table-hover */
html[data-theme="dark"] body.app-shell .dashboard-table.table-hover > tbody > tr:hover > * {
    background-color: rgba(77, 159, 255, 0.1) !important;
    color: var(--app-text) !important;
    --bs-table-accent-bg: rgba(77, 159, 255, 0.1);
    --bs-table-hover-bg: rgba(77, 159, 255, 0.1);
}

html[data-theme="dark"] body.app-shell .modal-content {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .app-modal .modal-header,
html[data-theme="dark"] body.app-shell .app-modal .modal-footer {
    background: var(--app-surface-alt);
}

html[data-theme="dark"] body.app-shell .modal-header {
    border-bottom-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .modal-footer {
    border-top-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

html[data-theme="dark"] body.app-shell .app-dropdown {
    background: var(--app-surface);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .app-dropdown .dropdown-item {
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .app-dropdown .dropdown-item:hover,
html[data-theme="dark"] body.app-shell .app-dropdown .dropdown-item:focus {
    background: var(--app-surface-alt);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .reception-summary-system-card {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    border-left-color: var(--reception-card-accent) !important;
}

html[data-theme="dark"] body.app-shell .reception-summary-system-card.reception-summary-system-card--filter-active {
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--app-primary) 65%, transparent),
        0 0 28px color-mix(in srgb, var(--app-primary) 22%, transparent),
        var(--app-shadow-sm);
    background: color-mix(in srgb, var(--app-primary) 14%, var(--app-surface)) !important;
}

html[data-theme="dark"] body.app-shell .reception-summary-system-card.reception-summary-system-card--filter-active.reception-summary-system-card--clickable:hover {
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--app-primary) 75%, transparent),
        0 0 32px color-mix(in srgb, var(--app-primary) 26%, transparent),
        var(--app-shadow-md);
}

html[data-reception-active-card="gold"][data-theme="dark"] body.app-shell .reception-summary-system-card.reception-summary-system-card--filter-active {
    border-color: rgba(214, 173, 74, 0.55) !important;
    background: linear-gradient(180deg, rgba(214, 173, 74, 0.22), rgba(22, 27, 34, 0.92)) !important;
    box-shadow:
        0 0 0 2px rgba(214, 173, 74, 0.55),
        0 0 30px rgba(214, 173, 74, 0.22),
        var(--app-shadow-sm);
}

html[data-reception-active-card="gold"][data-theme="dark"] body.app-shell .reception-summary-system-card.reception-summary-system-card--filter-active.reception-summary-system-card--clickable:hover {
    box-shadow:
        0 0 0 2px rgba(214, 173, 74, 0.75),
        0 0 36px rgba(214, 173, 74, 0.30),
        var(--app-shadow-md);
}

html[data-theme="dark"] body.app-shell .reception-summary-system-icon--logo {
    background: var(--app-surface-alt) !important;
    border-color: var(--app-border) !important;
}

html[data-theme="dark"] body.app-shell .reception-summary-pills {
    border-color: var(--app-border);
    background: var(--app-surface-alt);
}

html[data-theme="dark"] body.app-shell .reception-summary-pill {
    color: var(--app-text-muted);
}

html[data-theme="dark"] body.app-shell .reception-summary-pill:hover {
    color: var(--app-text);
    background: rgba(77, 159, 255, 0.1);
}

html[data-theme="dark"] body.app-shell .reception-summary-pill.is-active {
    background: var(--app-surface);
    color: var(--app-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] body.app-shell .reception-summary-details-toggle {
    color: var(--app-primary);
    background: rgba(77, 159, 255, 0.08);
    border-color: rgba(77, 159, 255, 0.15);
}

html[data-theme="dark"] body.app-shell .reception-summary-details-toggle:hover {
    background: rgba(77, 159, 255, 0.14);
}

html[data-theme="dark"] body.app-shell .reception-summary-company-list {
    border-top-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .reception-summary-detalle {
    border-top-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .reception-detalle-row--strong .reception-detalle-num {
    color: var(--app-primary);
}

html[data-theme="dark"] body.app-shell .reception-summary-empty {
    border-color: var(--app-border);
    background: var(--app-surface-alt);
    color: var(--app-text-muted);
}

html[data-theme="dark"] body.app-shell .section-kicker {
    color: var(--app-primary);
}

html[data-theme="dark"] body.app-shell a {
    color: var(--app-primary);
}

html[data-theme="dark"] body.app-shell .badge.bg-success,
html[data-theme="dark"] body.app-shell .badge.bg-warning,
html[data-theme="dark"] body.app-shell .badge.bg-danger,
html[data-theme="dark"] body.app-shell .badge.bg-info {
    color: #fff;
}

html[data-theme="dark"] body.app-shell .logs-table-scroll {
    background: var(--app-surface);
}

html[data-theme="dark"] body.app-shell .logs-table-scroll thead th {
    box-shadow: 0 1px 0 var(--app-border);
}

html[data-theme="dark"] body.app-shell .estado-chip {
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .filter-field label {
    color: var(--app-text-soft);
}

html[data-theme="dark"] body.app-shell .licit-actions .btn {
    border-color: var(--app-border);
    color: var(--app-text-soft);
}

html[data-theme="dark"] body.app-shell .licit-actions .btn:hover {
    background: var(--app-surface-alt);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .btn-app-light {
    background: var(--app-surface-alt);
    color: var(--app-text);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .btn-app-light:hover,
html[data-theme="dark"] body.app-shell .btn-app-light:focus {
    background: var(--app-surface);
}

/* Botón "Sincronizar emails": en dark el azul del navbar se camufla con el fondo. */
html[data-theme="dark"] body.app-shell .btn-app-sync {
    background: rgba(77, 159, 255, 0.16);
    border-color: rgba(77, 159, 255, 0.38);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .btn-app-sync:hover,
html[data-theme="dark"] body.app-shell .btn-app-sync:focus {
    background: rgba(77, 159, 255, 0.24);
    border-color: rgba(77, 159, 255, 0.55);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .btn-app-sync:disabled {
    opacity: 0.8;
    background: rgba(77, 159, 255, 0.12);
    border-color: rgba(77, 159, 255, 0.26);
    color: rgba(230, 237, 243, 0.9);
}

/* Automatización (panel de "Procesando licitación..." dentro del modal Licitar) */
html[data-theme="dark"] body.app-shell .automation-status-panel {
    background: var(--app-surface);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .automation-status-title {
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .automation-status-detail {
    color: var(--app-text-soft);
}

html[data-theme="dark"] body.app-shell .automation-status-badge {
    background: var(--app-surface-alt);
    color: var(--app-text-soft);
    border: 1px solid var(--app-border);
}

html[data-theme="dark"] body.app-shell .automation-badge-processing,
html[data-theme="dark"] body.app-shell .automation-badge-pending {
    background: rgba(77, 159, 255, 0.14);
    color: #cfe4ff;
    border-color: rgba(77, 159, 255, 0.22);
}

html[data-theme="dark"] body.app-shell .automation-badge-ready,
html[data-theme="dark"] body.app-shell .automation-badge-completed {
    background: rgba(63, 182, 139, 0.14);
    color: #b9f6d7;
    border-color: rgba(63, 182, 139, 0.22);
}

html[data-theme="dark"] body.app-shell .automation-badge-confirming {
    background: rgba(229, 161, 0, 0.14);
    color: #ffe8b3;
    border-color: rgba(229, 161, 0, 0.22);
}

html[data-theme="dark"] body.app-shell .automation-badge-failed {
    background: rgba(248, 81, 73, 0.14);
    color: #fecaca;
    border-color: rgba(248, 81, 73, 0.25);
}

html[data-theme="dark"] body.app-shell .automation-pdf-preview {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .automation-repuestos-verify {
    background: var(--app-surface);
    border-top-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .automation-repuestos-verify-hint {
    color: var(--app-text-soft);
}

html[data-theme="dark"] body.app-shell .automation-repuestos-verify-table thead th {
    background: var(--app-surface-alt);
    color: var(--app-text-soft);
    border-bottom-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .automation-actions {
    border-top-color: var(--app-border);
}

/* Acciones (iconos en tabla): asegurar contraste en dark */
html[data-theme="dark"] body.app-shell .action-btn {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text-soft);
}

html[data-theme="dark"] body.app-shell .action-btn i,
html[data-theme="dark"] body.app-shell .action-btn svg {
    color: inherit;
}

html[data-theme="dark"] body.app-shell .action-btn:hover,
html[data-theme="dark"] body.app-shell .action-btn:focus-visible {
    background: color-mix(in srgb, var(--app-primary) 12%, var(--app-surface-alt));
    border-color: rgba(77, 159, 255, 0.35);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .action-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(77, 159, 255, 0.15);
}

html[data-theme="dark"] body.app-shell .action-btn-primary:hover,
html[data-theme="dark"] body.app-shell .action-btn-primary:focus-visible {
    color: #fff;
}

/* Carruseles / adjuntos / vista rápida dentro de modales */
html[data-theme="dark"] body.app-shell .image-carousel,
html[data-theme="dark"] body.app-shell .attachment-image-card {
    background: var(--app-surface);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .image-carousel-nav {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .image-carousel-nav:hover,
html[data-theme="dark"] body.app-shell .image-carousel-nav:focus {
    background: color-mix(in srgb, var(--app-primary) 12%, var(--app-surface-alt));
    border-color: rgba(77, 159, 255, 0.35);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .attachment-thumb {
    background: #0b1220;
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .quote-table thead th {
    background: var(--app-surface-alt);
    color: var(--app-text-soft);
    border-bottom-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .line-preview-item,
html[data-theme="dark"] body.app-shell .part-item {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .parts-summary-totals {
    background: var(--app-surface-alt);
    border-color: rgba(77, 159, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .parts-summary-totals strong {
    text-shadow: none;
}

html[data-theme="dark"] body.app-shell .repuestos-cell {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .repuestos-cell small {
    color: var(--app-text-muted);
}

html[data-theme="dark"] body.app-shell .repuestos-cell:hover,
html[data-theme="dark"] body.app-shell .repuestos-cell:focus-visible {
    background: color-mix(in srgb, var(--app-primary) 12%, var(--app-surface-alt));
    border-color: rgba(77, 159, 255, 0.35);
}

html[data-theme="dark"] body.app-shell .repuestos-hover-card {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
    box-shadow: var(--app-shadow-md);
}

html[data-theme="dark"] body.app-shell .repuestos-hover-title,
html[data-theme="dark"] body.app-shell .repuestos-hover-extra {
    color: var(--app-text-soft);
}

/* Modal Licitar: evitar paneles blancos en dark */
html[data-theme="dark"] body.app-shell #licitarModal .quote-panel--licitar-vehiculo,
html[data-theme="dark"] body.app-shell #licitarModal .quote-panel--licitar-photos,
html[data-theme="dark"] body.app-shell #licitarModal .quote-panel--licitar-table {
    background: var(--app-surface);
    border-color: var(--app-border);
    box-shadow: var(--app-shadow-sm);
}

html[data-theme="dark"] body.app-shell .licitar-vehiculo-row {
    border-bottom-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .licitar-vencimiento-inner {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .image-carousel--licitar .image-carousel-viewport {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .image-carousel--licitar .image-carousel-image-frame {
    background: #0b1220;
    border: 1px solid var(--app-border);
}

html[data-theme="dark"] body.app-shell .view-toggle-btn.is-active {
    background: var(--app-surface);
    color: var(--app-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] body.app-shell .estado-modal-option {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text);
}

html[data-theme="dark"] body.app-shell .estado-modal-option:hover:not(:disabled) {
    background: var(--app-surface);
    border-color: rgba(77, 159, 255, 0.25);
}

html[data-theme="dark"] body.app-shell .estado-modal-option.is-current {
    background: rgba(77, 159, 255, 0.08);
    border-color: rgba(77, 159, 255, 0.3);
}

html[data-theme="dark"] body.app-shell .view-toggle {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .sync-modal-progress {
    background: var(--app-surface-alt);
}

html[data-theme="dark"] body.app-shell .ficha-panel {
    background: var(--app-surface);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .raw-panel {
    background: var(--app-surface);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell pre {
    background: var(--app-surface-alt);
    color: var(--app-text);
    border-color: var(--app-border);
}

html[data-theme="dark"] body.app-shell .licit-row:hover {
    background: rgba(77, 159, 255, 0.04);
}

html[data-theme="dark"] body.app-shell .page-size-select {
    background: var(--app-surface-alt);
    border-color: var(--app-border);
    color: var(--app-text);
}

/* --- Páginas legacy (sin app-shell): login, configuración, usuarios, index --- */
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) {
    background-color: #0d1117 !important;
    color: #e6edf3;
}

html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .modal-content {
    background: #161b22;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e6edf3;
}

html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .modal-header,
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .modal-footer {
    background: #1c2129;
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .modal-title,
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .modal-body,
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .form-label {
    color: #e6edf3;
}

html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell).bg-light {
    background-color: #0d1117 !important;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .card {
    background: #161b22;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e6edf3;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .card-header {
    background: #1c2129;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e6edf3;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .card-footer {
    background: #161b22;
    border-color: rgba(255, 255, 255, 0.1);
    color: #9da8b7;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .form-control,
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .input-group-text {
    background: #1c2129;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e6edf3;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.2);
    color: #e6edf3;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .navbar.bg-primary {
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .navbar .nav-link,
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .navbar-brand {
    color: rgba(255, 255, 255, 0.92) !important;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .text-muted {
    color: #9da8b7 !important;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .alert-info {
    background: rgba(77, 159, 255, 0.12);
    border-color: rgba(77, 159, 255, 0.25);
    color: #cfe4ff;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .alert-danger {
    background: rgba(248, 81, 73, 0.12);
    border-color: rgba(248, 81, 73, 0.35);
    color: #fecaca;
}
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) code {
    background: rgba(255, 255, 255, 0.06);
    color: #79b8ff;
}

/* Botón tema en navbar clásica (bg-primary) */
html[data-theme="dark"] body:not(.app-shell):not(.opp-shell) .dark-mode-toggle {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 210, 100, 0.95);
}

/* Toggle flotante (login): visible en modo claro y oscuro */
.dark-mode-toggle--floating {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}
html[data-theme="light"] .dark-mode-toggle--floating {
    border-color: rgba(28, 79, 161, 0.22);
    background: #fff;
    color: #1c4fa1;
    box-shadow: 0 4px 14px rgba(15, 36, 77, 0.08);
}
html[data-theme="light"] .dark-mode-toggle--floating:hover {
    background: #eaf1ff;
    color: #163f80;
}
html[data-theme="dark"] .dark-mode-toggle--floating {
    border-color: rgba(255, 200, 60, 0.28);
    background: rgba(255, 200, 60, 0.12);
    color: #ffd740;
}

