/* TRAYEKTO / Despachos: respaldo global de estilos para Light/Dark. */
/* DESPACHOS — Estilos aislados, compatibles con la paleta MudBlazor Light/Dark. */
.dispatch-page{width:100%;min-width:0;color:var(--mud-palette-text-primary);font-family:'Roboto Condensed',sans-serif}
.dispatch-hero{display:grid;grid-template-columns:1.1fr 1fr;border:1px solid var(--mud-palette-lines-default);border-radius:10px;overflow:hidden;background:var(--mud-palette-surface)}
.dispatch-hero-title{display:flex;align-items:center;gap:16px;padding:18px 20px}.dispatch-hero-title> .mud-icon-root{font-size:38px;color:var(--mud-palette-primary)}.dispatch-hero h1{margin:0;font-size:2rem;font-weight:800}.dispatch-hero p{margin:4px 0 0;font-size:.9rem}
.dispatch-hero-banner{display:flex;flex-direction:column;justify-content:center;gap:5px;padding:20px 24px;color:#fff;background:linear-gradient(90deg,rgba(3,28,54,.94),rgba(3,43,75,.55)),url('/images/home/hero-logistics.webp') center/cover}.dispatch-hero-banner strong{font-size:1.2rem}
.dispatch-demo-note{display:flex;align-items:center;gap:8px;padding:10px 4px;font-size:.83rem;color:var(--mud-palette-text-secondary)}.dispatch-demo-note> .mud-icon-root{color:var(--mud-palette-info)}
.dispatch-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-bottom:12px}.dispatch-kpi{display:flex;align-items:center;gap:13px;min-width:0;padding:16px 13px;border:1px solid var(--mud-palette-lines-default);border-radius:10px;background:var(--mud-palette-surface);box-shadow:0 3px 12px rgba(7,30,57,.05)}.dispatch-kpi strong{display:block;font-size:1.65rem;line-height:1.1}.dispatch-kpi small{display:block;margin-top:4px;font-size:.78rem}.dispatch-kpi-icon{width:46px;height:46px;display:grid;place-items:center;flex-shrink:0;border-radius:50%;color:white}.dispatch-kpi-icon.blue{background:#087cfa}.dispatch-kpi-icon.green{background:#00a96b}.dispatch-kpi-icon.amber{background:#f5a400}.dispatch-kpi-icon.purple{background:#8546ef}.dispatch-kpi-icon.red{background:#f44258}
.dispatch-panel,.dispatch-bottom-card{min-width:0;border:1px solid var(--mud-palette-lines-default);border-radius:10px;background:var(--mud-palette-surface);box-shadow:0 3px 12px rgba(7,30,57,.04)}.dispatch-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;padding:9px 12px;border-bottom:1px solid var(--mud-palette-lines-default)}.dispatch-tabs{display:flex;flex-wrap:wrap;gap:6px}.dispatch-tabs button{padding:11px 10px;background:transparent;border:0;border-bottom:3px solid transparent;color:var(--mud-palette-text-secondary);cursor:pointer}.dispatch-tabs button.active{color:var(--mud-palette-primary);border-bottom-color:var(--mud-palette-primary);font-weight:800}.dispatch-actions{display:flex;gap:8px;flex-wrap:wrap}.dispatch-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:38px;padding:8px 14px;border:1px solid var(--mud-palette-lines-inputs);border-radius:6px;background:var(--mud-palette-surface);color:var(--mud-palette-text-primary);font-weight:700;cursor:pointer}.dispatch-btn.primary{background:var(--mud-palette-primary);border-color:var(--mud-palette-primary);color:var(--mud-palette-primary-text)}.dispatch-btn:hover,.dispatch-row-action:hover{filter:brightness(.92)}.dispatch-btn> .mud-icon-root{font-size:18px}
.dispatch-search{display:flex;align-items:center;gap:10px;margin:12px;padding:0 12px;border:1px solid var(--mud-palette-lines-inputs);border-radius:6px;background:var(--mud-palette-background-gray)}.dispatch-search input{width:100%;min-width:0;padding:11px 0;border:0;outline:0;background:transparent;color:var(--mud-palette-text-primary)}.dispatch-filters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) auto;align-items:end;gap:12px;padding:0 12px 14px}.dispatch-filters label,.dispatch-detail-grid label{display:flex;flex-direction:column;gap:5px;font-size:.78rem;font-weight:700}.dispatch-filters input,.dispatch-filters select,.dispatch-detail-grid input,.dispatch-detail-grid select{width:100%;min-width:0;min-height:38px;padding:7px 10px;border:1px solid var(--mud-palette-lines-inputs);border-radius:5px;background:var(--mud-palette-surface);color:var(--mud-palette-text-primary)}
.dispatch-table-scroll{width:100%;overflow-x:auto}.dispatch-table{width:100%;border-collapse:collapse;font-size:.82rem}.dispatch-table th{padding:11px 12px;background:var(--mud-palette-background-gray);text-align:left;white-space:nowrap}.dispatch-table td{padding:12px;border-top:1px solid var(--mud-palette-lines-default)}.dispatch-table td strong{color:var(--mud-palette-primary)}.dispatch-table tbody tr:hover{background:var(--mud-palette-action-default-hover)}.dispatch-status{display:inline-block;padding:4px 9px;border-radius:20px;font-weight:700;font-size:.75rem;background:rgba(8,124,250,.13);color:var(--mud-palette-primary)}.dispatch-status.pendiente{background:rgba(245,164,0,.15);color:#a66c00}.dispatch-status.preparación{background:rgba(133,70,239,.15);color:#8852c7}.dispatch-status.despachado{background:rgba(0,169,107,.14);color:#008a57}.dispatch-row-action{display:inline-flex;align-items:center;gap:6px;border:0;background:transparent;color:var(--mud-palette-primary);font-weight:700;cursor:pointer}.dispatch-row-action> .mud-icon-root{font-size:18px}.dispatch-empty{text-align:center;padding:35px!important}.dispatch-table-footer{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;padding:12px;font-size:.8rem}.dispatch-table-footer>div{display:flex;align-items:center;gap:10px}.dispatch-table-footer button{padding:7px 11px;border:1px solid var(--mud-palette-lines-default);border-radius:5px;background:var(--mud-palette-surface);color:var(--mud-palette-text-primary);cursor:pointer}.dispatch-table-footer button:disabled{opacity:.4;cursor:default}
.dispatch-bottom{display:grid;grid-template-columns:1.5fr 1fr 1fr .8fr;gap:12px;margin-top:12px}.dispatch-bottom-card{padding:15px}.dispatch-bottom-card h2{display:flex;align-items:center;gap:8px;margin:0 0 14px;font-size:1rem}.dispatch-bottom-card h2> .mud-icon-root{color:var(--mud-palette-primary)}.dispatch-movements>div{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:7px;padding:10px 0;border-bottom:1px solid var(--mud-palette-lines-default);font-size:.8rem}.dispatch-progress{display:grid;grid-template-columns:90px 1fr 22px;align-items:center;gap:8px;margin:12px 0;font-size:.8rem}.dispatch-progress>div{height:10px;border-radius:8px;background:var(--mud-palette-background-gray);overflow:hidden}.dispatch-progress i{display:block;height:100%;background:var(--mud-palette-primary);border-radius:8px}.dispatch-scan{text-align:center}.dispatch-scan h2{text-align:left}.dispatch-scan> .dispatch-qr{font-size:54px;color:var(--mud-palette-primary)}.dispatch-scan p{font-size:.8rem}
.dispatch-overlay{position:fixed;inset:0;z-index:1400;display:grid;place-items:center;padding:16px;background:rgba(0,15,35,.72);backdrop-filter:blur(3px)}.dispatch-modal{width:min(640px,100%);max-height:90vh;overflow:auto;border:1px solid var(--mud-palette-lines-default);border-radius:12px;background:var(--mud-palette-surface);color:var(--mud-palette-text-primary);box-shadow:0 24px 80px rgba(0,0,0,.3)}.dispatch-modal header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--mud-palette-lines-default)}.dispatch-modal header>div{display:flex;align-items:center;gap:10px}.dispatch-modal header>div> .mud-icon-root{color:var(--mud-palette-primary)}.dispatch-modal header button{border:0;background:transparent;color:var(--mud-palette-text-primary);font-size:28px;cursor:pointer}.dispatch-modal-body{padding:20px}.dispatch-modal-body h2{margin:0 0 16px}.dispatch-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dispatch-detail-grid>div{display:flex;flex-direction:column;gap:6px;padding:12px;border:1px solid var(--mud-palette-lines-default);border-radius:7px}.dispatch-detail-grid small{color:var(--mud-palette-text-secondary)}.dispatch-hint{margin:16px 0 0;font-size:.82rem;color:var(--mud-palette-text-secondary)}.dispatch-modal-actions{display:flex;justify-content:flex-end;margin-top:20px}.dispatch-notice{position:fixed;bottom:24px;right:24px;z-index:1500;padding:14px 18px;border:1px solid var(--mud-palette-lines-default);border-radius:8px;background:var(--mud-palette-surface);color:var(--mud-palette-text-primary);box-shadow:0 8px 30px #0003}.dispatch-notice button{margin-left:12px;border:0;background:transparent;color:var(--mud-palette-primary);cursor:pointer}.dispatch-export{width:100%;min-height:220px;background:var(--mud-palette-background-gray);color:var(--mud-palette-text-primary);border:1px solid var(--mud-palette-lines-inputs);padding:10px}
@media(max-width:1100px){.dispatch-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.dispatch-bottom{grid-template-columns:repeat(2,minmax(0,1fr))}.dispatch-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.dispatch-filters .clear{grid-column:span 2}}
@media(max-width:700px){.dispatch-hero{grid-template-columns:1fr}.dispatch-hero-banner{min-height:90px}.dispatch-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.dispatch-bottom{grid-template-columns:1fr}.dispatch-toolbar{align-items:stretch}.dispatch-tabs{width:100%;overflow-x:auto;flex-wrap:nowrap}.dispatch-tabs button{white-space:nowrap}.dispatch-actions{width:100%}.dispatch-actions .dispatch-btn{flex:1}.dispatch-table-scroll{overflow:visible}.dispatch-table,.dispatch-table tbody,.dispatch-table tr,.dispatch-table td{display:block;width:100%}.dispatch-table thead{display:none}.dispatch-table tr{margin:10px;border:1px solid var(--mud-palette-lines-default);border-radius:8px;overflow:hidden}.dispatch-table td{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;text-align:right;overflow-wrap:anywhere}.dispatch-table td::before{content:attr(data-label);font-weight:700;text-align:left;color:var(--mud-palette-text-secondary)}.dispatch-table td.dispatch-empty::before{content:none}.dispatch-table td.dispatch-empty{text-align:center;display:block}.dispatch-filters{grid-template-columns:1fr}.dispatch-filters .clear{grid-column:auto}.dispatch-detail-grid{grid-template-columns:1fr}}
@media(max-width:380px){.dispatch-kpis{grid-template-columns:1fr}.dispatch-hero-title{padding:14px}.dispatch-hero h1{font-size:1.5rem}.dispatch-table-footer{flex-direction:column;align-items:flex-start}}


/* Refuerzo global: evita que reglas generales del tema oculten controles de Despachos. */
.dispatch-page { padding: 12px 4px 24px; }
.dispatch-page .dispatch-hero,
.dispatch-page .dispatch-kpi,
.dispatch-page .dispatch-panel,
.dispatch-page .dispatch-bottom-card {
    background-color: var(--mud-palette-surface, #ffffff);
    border: 1px solid var(--mud-palette-lines-default, #d4deec);
    box-shadow: 0 3px 14px rgba(12, 39, 75, .09);
}
.dispatch-page .dispatch-kpi { min-height: 86px; }
.dispatch-page .dispatch-kpi strong { color: var(--mud-palette-text-primary, #102c54); }
.dispatch-page .dispatch-kpi small { color: var(--mud-palette-text-secondary, #50627c); }
.dispatch-page .dispatch-btn,
.dispatch-page button.dispatch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid var(--mud-palette-lines-inputs, #aebed4);
    border-radius: 6px;
    background-color: var(--mud-palette-surface, #ffffff);
    color: var(--mud-palette-text-primary, #122b50);
    font-weight: 700;
    opacity: 1;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 25, 60, .08);
}
.dispatch-page .dispatch-btn.primary,
.dispatch-page button.dispatch-btn.primary,
.dispatch-modal .dispatch-btn.primary,
.dispatch-modal button.dispatch-btn.primary {
    background: #086cf5;
    border-color: #086cf5;
    color: #ffffff;
    box-shadow: 0 3px 9px rgba(0, 99, 225, .20);
}
.dispatch-page .dispatch-btn.primary:hover,
.dispatch-modal .dispatch-btn.primary:hover { background: #0058d5; border-color: #0058d5; }
.dispatch-page .dispatch-btn:focus-visible,
.dispatch-modal button:focus-visible { outline: 3px solid #62a5ff; outline-offset: 2px; }
.dispatch-page .dispatch-filters input,
.dispatch-page .dispatch-filters select,
.dispatch-page .dispatch-search,
.dispatch-modal .dispatch-detail-grid input,
.dispatch-modal .dispatch-detail-grid select {
    border: 1px solid var(--mud-palette-lines-inputs, #aebed4);
    background-color: var(--mud-palette-surface, #ffffff);
    color: var(--mud-palette-text-primary, #122b50);
    opacity: 1;
}
.dispatch-page .dispatch-search input { color: var(--mud-palette-text-primary, #122b50); }
.dispatch-page .dispatch-table th { border-bottom: 1px solid var(--mud-palette-lines-default, #d4deec); }
.dispatch-page .dispatch-table td { border-bottom: 1px solid var(--mud-palette-lines-default, #d4deec); }
.dispatch-page .dispatch-bottom-card { min-height: 210px; }
.dispatch-overlay .dispatch-modal {
    width: min(760px, calc(100vw - 32px));
    max-height: min(90vh, 900px);
    background-color: var(--mud-palette-surface, #ffffff);
    color: var(--mud-palette-text-primary, #122b50);
    border: 1px solid var(--mud-palette-lines-default, #d4deec);
}
.dispatch-overlay .dispatch-modal header { background: var(--mud-palette-background-gray, #f3f7fc); }
.dispatch-overlay .dispatch-modal header strong { font-size: 1.1rem; }
.dispatch-overlay .dispatch-modal-body { padding: 24px; }
.dispatch-overlay .dispatch-detail-grid label {
    padding: 12px;
    background: var(--mud-palette-background-gray, #f3f7fc);
    border: 1px solid var(--mud-palette-lines-default, #d4deec);
    border-radius: 8px;
    color: var(--mud-palette-text-primary, #122b50);
}
.dispatch-overlay .dispatch-modal-actions {
    padding-top: 16px;
    border-top: 1px solid var(--mud-palette-lines-default, #d4deec);
}
@media (max-width: 700px) {
    .dispatch-page .dispatch-hero { grid-template-columns: 1fr; }
    .dispatch-overlay .dispatch-modal-body { padding: 16px; }
    .dispatch-page .dispatch-bottom-card { min-height: 0; }
}


/* ================================================================
   TRAYEKTO / DESPACHOS - CORRECCIÓN DE CONTRASTE LIGHT / DARK
   El tema real se determina por html[data-theme], no por las
   variables MudBlazor (que pueden permanecer en modo claro).
   No modifica el menú compartido ni la lógica de los despachos.
   ================================================================ */
html[data-theme] .dispatch-page {
    --dispatch-surface: var(--bg-card);
    --dispatch-elevated: var(--bg-subtle);
    --dispatch-text: var(--text-primary);
    --dispatch-muted: var(--text-secondary);
    --dispatch-border: var(--border-color);
    --dispatch-input: var(--input-bg);
    color: var(--dispatch-text);
}

/* Contenedores y cabecera: la regla anterior de MudBlazor no debe
   imponer superficies blancas en el tema oscuro. */
html[data-theme] .dispatch-page .dispatch-hero,
html[data-theme] .dispatch-page .dispatch-kpi,
html[data-theme] .dispatch-page .dispatch-panel,
html[data-theme] .dispatch-page .dispatch-bottom-card {
    background: var(--dispatch-surface) !important;
    color: var(--dispatch-text) !important;
    border: 1px solid var(--dispatch-border) !important;
}
html[data-theme] .dispatch-page .dispatch-hero-title,
html[data-theme] .dispatch-page .dispatch-hero-title h1,
html[data-theme] .dispatch-page .dispatch-kpi strong,
html[data-theme] .dispatch-page .dispatch-bottom-card h2,
html[data-theme] .dispatch-page .dispatch-table,
html[data-theme] .dispatch-page .dispatch-table td,
html[data-theme] .dispatch-page .dispatch-table-footer,
html[data-theme] .dispatch-page .dispatch-filters label,
html[data-theme] .dispatch-page .dispatch-detail-grid label,
html[data-theme] .dispatch-page .dispatch-movements,
html[data-theme] .dispatch-page .dispatch-progress {
    color: var(--dispatch-text) !important;
}
html[data-theme] .dispatch-page .dispatch-hero-title p,
html[data-theme] .dispatch-page .dispatch-kpi small,
html[data-theme] .dispatch-page .dispatch-demo-note,
html[data-theme] .dispatch-page .dispatch-scan p {
    color: var(--dispatch-muted) !important;
}
html[data-theme] .dispatch-page .dispatch-tabs button {
    color: var(--dispatch-muted) !important;
}
html[data-theme] .dispatch-page .dispatch-tabs button.active {
    color: var(--primary) !important;
    border-bottom-color: var(--primary) !important;
}
html[data-theme] .dispatch-page .dispatch-search,
html[data-theme] .dispatch-page .dispatch-filters input,
html[data-theme] .dispatch-page .dispatch-filters select,
html[data-theme] .dispatch-page .dispatch-export {
    background: var(--dispatch-input) !important;
    color: var(--dispatch-text) !important;
    border-color: var(--input-border) !important;
}
html[data-theme] .dispatch-page .dispatch-search input {
    color: var(--dispatch-text) !important;
}
html[data-theme] .dispatch-page input::placeholder {
    color: var(--text-muted) !important;
    opacity: 1;
}
html[data-theme] .dispatch-page .dispatch-table th {
    background: var(--dispatch-elevated) !important;
    color: var(--dispatch-text) !important;
    border-color: var(--dispatch-border) !important;
}
html[data-theme] .dispatch-page .dispatch-table td,
html[data-theme] .dispatch-page .dispatch-toolbar,
html[data-theme] .dispatch-page .dispatch-movements > div {
    border-color: var(--dispatch-border) !important;
}
html[data-theme] .dispatch-page .dispatch-table tbody tr {
    background: var(--dispatch-surface) !important;
}
html[data-theme] .dispatch-page .dispatch-table tbody tr:hover {
    background: var(--hover-bg) !important;
}
html[data-theme] .dispatch-page .dispatch-table td strong,
html[data-theme] .dispatch-page .dispatch-row-action {
    color: var(--primary) !important;
}
html[data-theme] .dispatch-page .dispatch-btn:not(.primary),
html[data-theme] .dispatch-page .dispatch-table-footer button {
    background: var(--dispatch-surface) !important;
    color: var(--dispatch-text) !important;
    border-color: var(--input-border) !important;
}
html[data-theme] .dispatch-page .dispatch-btn.primary,
html[data-theme] .dispatch-overlay .dispatch-btn.primary {
    background: #0878f9 !important;
    color: #fff !important;
    border-color: #0878f9 !important;
}
html[data-theme] .dispatch-page .dispatch-progress > div {
    background: var(--dispatch-elevated) !important;
}

/* El modal se representa fuera de la página en algunas variantes:
   aplicar el tema a través del elemento raíz HTML. */
html[data-theme] .dispatch-overlay .dispatch-modal,
html[data-theme] .dispatch-overlay .dispatch-notice {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
html[data-theme] .dispatch-overlay .dispatch-modal header,
html[data-theme] .dispatch-overlay .dispatch-detail-grid label {
    background: var(--bg-subtle) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
html[data-theme] .dispatch-overlay .dispatch-modal header button,
html[data-theme] .dispatch-overlay .dispatch-modal-body,
html[data-theme] .dispatch-overlay .dispatch-modal-body h2,
html[data-theme] .dispatch-overlay .dispatch-detail-grid {
    color: var(--text-primary) !important;
}
html[data-theme] .dispatch-overlay .dispatch-detail-grid input,
html[data-theme] .dispatch-overlay .dispatch-detail-grid select,
html[data-theme] .dispatch-overlay .dispatch-export {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--input-border) !important;
}
html[data-theme] .dispatch-overlay .dispatch-hint,
html[data-theme] .dispatch-overlay .dispatch-detail-grid small {
    color: var(--text-secondary) !important;
}
html[data-theme] .dispatch-overlay .dispatch-modal-actions {
    border-color: var(--border-color) !important;
}
html[data-theme] .dispatch-overlay .dispatch-btn:not(.primary) {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--input-border) !important;
}
/* Estados: conservan su significado, pero mejoran lectura en oscuro. */
html[data-theme="dark"] .dispatch-page .dispatch-status.pendiente { color: #ffd47a !important; }
html[data-theme="dark"] .dispatch-page .dispatch-status.preparación { color: #d3b4ff !important; }
html[data-theme="dark"] .dispatch-page .dispatch-status.despachado { color: #76e6b8 !important; }
html[data-theme="dark"] .dispatch-page .dispatch-status { color: #9acbff; }
@media (max-width:700px) {
    html[data-theme] .dispatch-page .dispatch-table td::before {
        color: var(--dispatch-muted) !important;
    }
    html[data-theme] .dispatch-page .dispatch-table tr {
        border-color: var(--dispatch-border) !important;
    }
}
