/* ========================================
   APP REYCO - Estilos Corporativos
   ======================================== */

:root {
    --reyco-red: #C41E3A;
    --reyco-red-dark: #A01830;
    --reyco-red-light: #fde8ec;
    --reyco-white: #FFFFFF;
    --reyco-gray-dark: #333333;
    --reyco-gray-medium: #666666;
    --reyco-gray-light: #F5F5F5;
    --reyco-gray-border: #E0E0E0;
}

/* Base */
html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--reyco-white);
    color: var(--reyco-gray-dark);
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Reset Bootstrap container */
.container, .container-fluid, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Links */
a {
    color: var(--reyco-red);
    text-decoration: none;
}

a:hover {
    color: var(--reyco-red-dark);
    text-decoration: underline;
}

/* Botones principales */
.btn-primary {
    background-color: var(--reyco-red);
    border-color: var(--reyco-red);
    color: var(--reyco-white);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--reyco-red-dark);
    border-color: var(--reyco-red-dark);
    color: var(--reyco-white);
}

.btn-outline-primary {
    color: var(--reyco-red);
    border-color: var(--reyco-red);
}

.btn-outline-primary:hover {
    background-color: var(--reyco-red);
    color: var(--reyco-white);
}

/* Header */
.app-header {
    background-color: var(--reyco-white);
    border-bottom: 3px solid var(--reyco-red);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .logo-link {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.app-header .logo {
    height: 45px;
}

.logo-mobile {
    display: none;
    height: 36px;
    width: 36px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

/* Navegación en header */

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    margin: 0 0.15rem;
    color: var(--reyco-gray-medium);
    background: none;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.nav-tab:hover {
    color: var(--reyco-red);
    border-color: var(--reyco-red);
    background-color: rgba(196, 30, 58, 0.06);
}

.nav-tab.active {
    color: var(--reyco-white);
    background-color: var(--reyco-red);
    border-color: var(--reyco-red);
    margin: 0 0.25rem;
}

.nav-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.nav-hint {
    margin-left: auto;
    padding: 0.5rem 1rem;
}

.hint-text {
    font-size: 0.75rem;
    color: var(--reyco-gray-medium);
    background-color: var(--reyco-gray-light);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

.nav-spacer {
    flex: 1;
}

/* Contenido principal */
.main-content {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

/* Contenedor principal de la app */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Títulos de sección */
.section-title {
    color: var(--reyco-red);
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--reyco-gray-border);
}

/* Tarjetas de listado */
.list-card {
    background-color: var(--reyco-white);
    border: 1px solid var(--reyco-gray-border);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-card:hover {
    border-color: var(--reyco-red);
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.15);
}

.list-card .date {
    font-weight: 600;
    color: var(--reyco-gray-dark);
}

.list-card .route {
    color: var(--reyco-gray-medium);
    font-size: 0.95rem;
}

.list-card .type-badge {
    background-color: var(--reyco-gray-light);
    color: var(--reyco-gray-dark);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Panel de dos columnas */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
}

/* Panel individual */
.panel {
    background-color: var(--reyco-white);
    border: 1px solid var(--reyco-gray-border);
    border-radius: 6px;
    padding: 1rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Botón flotante de acción */
.btn-action {
    background-color: var(--reyco-red);
    color: var(--reyco-white);
    border: none;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-action:hover {
    background-color: var(--reyco-red-dark);
}

/* Iconos */
.icon-cargo::before {
    content: "📦";
    margin-right: 0.5rem;
}

.icon-truck::before {
    content: "🚚";
    margin-right: 0.5rem;
}

/* Formularios */
.form-control:focus {
    border-color: var(--reyco-red);
    box-shadow: 0 0 0 0.2rem rgba(196, 30, 58, 0.25);
}

/* Validación */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--reyco-red);
}

.validation-message {
    color: var(--reyco-red);
}

/* Error boundary */
.blazor-error-boundary {
    background: var(--reyco-red);
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Ha ocurrido un error.";
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    color: var(--reyco-gray-dark);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Card row layout */
.card-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-row .date {
    font-weight: 600;
    color: var(--reyco-gray-dark);
    min-width: 42px;
    font-size: 0.9rem;
}

.card-row .route {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.card-row .location {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: var(--reyco-gray-dark);
    background-color: var(--reyco-gray-light);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.card-row .arrow {
    color: var(--reyco-gray-medium);
    font-weight: bold;
}

/* Split View Container */
.split-container {
    display: grid;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    padding: 1rem 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.split-container.single-view {
    grid-template-columns: 1fr;
    max-width: 50%;
}

.split-container.single-view.single-mapa {
    max-width: 75%;
}

.split-container.dual-view {
    grid-template-columns: 1fr 1fr;
    max-width: 1200px;
}

.split-container.triple-view {
    grid-template-columns: 1fr 1fr 2fr;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0.75rem;
    margin: 0;
    min-height: 0;
}

@media (max-width: 1024px) {
    .split-container.dual-view,
    .split-container.triple-view {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.split-panel {
    background-color: var(--reyco-white);
    border: 1px solid var(--reyco-gray-border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-content .panel-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--reyco-gray-border);
    background-color: var(--reyco-gray-light);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
}

.panel-content .panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--reyco-gray-dark);
}

.panel-content .panel-title .icon {
    width: 22px;
    height: 22px;
    fill: var(--reyco-red);
}

.panel-content .list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Mapa placeholder */
.map-placeholder {
    background-color: var(--reyco-gray-light);
    border: 2px dashed var(--reyco-gray-border);
    border-radius: 8px;
    flex: 1;
    margin: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-info {
    text-align: center;
    color: var(--reyco-gray-medium);
}

.map-icon-svg {
    width: 64px;
    height: 64px;
    fill: var(--reyco-gray-medium);
    margin-bottom: 1rem;
}

.map-info ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.map-info li {
    margin: 0.5rem 0;
}

.map-note {
    font-size: 0.85rem;
    color: var(--reyco-gray-medium);
    margin-top: 1rem;
}

/* ========================================
   MODALES
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay-top {
    z-index: 1050;
    padding: 1rem;
}

.modal-content {
    background-color: var(--reyco-white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--reyco-gray-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--reyco-gray-dark);
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--reyco-gray-border);
    background-color: var(--reyco-gray-light);
    flex-shrink: 0;
}

/* ========================================
   FORMULARIOS
   ======================================== */

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--reyco-gray-dark);
    letter-spacing: 0.02em;
    transition: color 0.2s;
}

.form-group:focus-within label {
    color: var(--reyco-red);
}

.form-control {
    padding: 0.55rem 0.75rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: #fff;
    color: var(--reyco-dark, #1a1a2e);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control::placeholder {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85rem;
}

.form-control:hover {
    border-color: #9ca3af;
    background-color: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--reyco-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
    background-color: #fff;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* ── Tom Select: Formularios ────────────────────────────────── */

.form-group .ts-wrapper {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: auto !important;
}

.form-group .ts-wrapper .ts-control,
.form-group .ts-wrapper.single .ts-control {
    border: 1.5px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 0.55rem 2rem 0.55rem 0.75rem !important;
    font-size: 0.9rem !important;
    min-height: 2.2rem !important;
    line-height: 1.3 !important;
    background-color: #fff !important;
    background-image: none !important;
    cursor: pointer !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box !important;
}

.form-group .ts-wrapper.single .ts-control::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    right: 0.6rem !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 5px solid transparent !important;
    border-right: 5px solid transparent !important;
    border-top: 5px solid #6b7280 !important;
    border-bottom: none !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
}

.form-group .ts-wrapper.single.dropdown-active .ts-control::after {
    border-top: none !important;
    border-bottom: 5px solid var(--reyco-red) !important;
}

/* Ocultar el input de búsqueda (single selects) */
.form-group .ts-wrapper.single .ts-control > input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
}

.form-group .ts-wrapper .ts-control:hover,
.form-group .ts-wrapper.single .ts-control:hover {
    border-color: #9ca3af !important;
    background-color: #fafafa !important;
}

.form-group .ts-wrapper.focus .ts-control,
.form-group .ts-wrapper.dropdown-active .ts-control,
.form-group .ts-wrapper.single.focus .ts-control,
.form-group .ts-wrapper.single.dropdown-active .ts-control {
    border-color: var(--reyco-red) !important;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12) !important;
}

.form-group .ts-wrapper .ts-dropdown {
    border: 1.5px solid #d1d5db !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    margin-top: 3px !important;
    overflow: hidden;
}

.form-group .ts-wrapper .ts-dropdown .option {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.form-group .ts-wrapper .ts-dropdown .option.active {
    background-color: rgba(200, 16, 46, 0.08) !important;
    color: var(--reyco-red) !important;
}

.form-group .ts-wrapper .ts-dropdown .option:hover {
    background-color: #f3f4f6 !important;
}

/* Ocultar select nativo multi para evitar flash al inicializar Tom Select */
.form-group select[multiple] {
    visibility: hidden !important;
    height: 2.2rem !important;
    overflow: hidden !important;
}

/* ── Multi-select: items compactos inline con codigos cortos ── */
.form-group .ts-wrapper.multi .ts-control,
.form-group .ts-wrapper.multi .ts-control:not(.focus) {
    border: 1.5px solid #d1d5db !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    background-image: none !important;
    padding: 0.55rem 2rem 0.55rem 0.75rem !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    font-size: 0.9rem !important;
    line-height: normal !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group .ts-wrapper.multi .ts-control > .item {
    display: inline !important;
    float: none !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
    color: var(--reyco-gray-dark) !important;
    line-height: 1.8 !important;
}

/* Separador coma entre items */
.form-group .ts-wrapper.multi .ts-control > .item + .item::before {
    content: ', ' !important;
}

/* Input de busqueda en multi: mostrar solo como placeholder */
.form-group .ts-wrapper.multi .ts-control > input {
    position: relative !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    font-size: 0.85rem !important;
    flex: 1 !important;
    min-width: 0 !important;
}

/* Placeholder difuminado (como el resto de inputs) */
.form-group .ts-wrapper.multi .ts-control > input::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* Cuando hay items seleccionados, ocultar input (no hace falta buscar) */
.form-group .ts-wrapper.multi.has-items .ts-control > input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Dropdown multi: checkbox en misma linea que el nombre */
.form-group .ts-wrapper.multi .ts-dropdown {
    min-width: 240px !important;
}

.form-group .ts-wrapper.multi .ts-dropdown .option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
}

.form-group .ts-wrapper.multi .ts-dropdown .option input[type="checkbox"] {
    accent-color: var(--reyco-red) !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    width: 1rem !important;
    height: 1rem !important;
}

/* ── Blazor multi-select (tipo camion) ── */
.tipo-camion-group {
    position: relative;
}

.blazor-multiselect {
    display: flex;
    align-items: center;
    min-height: 2.2rem;
    padding: 0.4rem 0.6rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    background: #fff;
}

.blazor-multiselect:hover {
    border-color: #9ca3af;
}

.bms-placeholder {
    color: #9ca3af;
}

.bms-value {
    color: var(--reyco-gray-dark);
    font-weight: 500;
}

.bms-arrow {
    margin-left: auto;
    border: 4px solid transparent;
    border-top: 5px solid #9ca3af;
    transition: transform 0.2s;
}

.bms-arrow.open {
    transform: rotate(180deg);
}

.bms-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
}

.bms-dropdown {
    position: absolute;
    z-index: 100;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
}

.bms-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    margin: 0;
}

.bms-option:hover {
    background: var(--reyco-gray-light);
}

.bms-option input[type="checkbox"] {
    accent-color: var(--reyco-red);
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

input[type="date"].form-control,
input[type="time"].form-control {
    cursor: pointer;
    position: relative;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator,
input[type="time"].form-control::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    filter: none;
}

input[type="date"].form-control:hover::-webkit-calendar-picker-indicator,
input[type="time"].form-control:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

input[readonly].form-control {
    cursor: default;
    opacity: 0.7;
}

.btn-secondary {
    background-color: var(--reyco-white);
    color: var(--reyco-gray-dark);
    border: 1.5px solid #d1d5db;
    padding: 0.55rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--reyco-gray-light);
}

.btn-primary {
    background-color: var(--reyco-red);
    color: var(--reyco-white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--reyco-red-dark);
}

/* ========================================
   DETALLE
   ======================================== */

.detail-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--reyco-gray-border);
    margin-bottom: 1rem;
}

.detail-date {
    font-size: 0.9rem;
    color: var(--reyco-gray-medium);
    text-transform: capitalize;
}

.detail-route {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-truck-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.location-big {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--reyco-gray-dark);
    background-color: var(--reyco-gray-light);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.arrow-big {
    font-size: 1.5rem;
    color: var(--reyco-red);
    font-weight: bold;
}

.type-badge-big {
    background-color: var(--reyco-red);
    color: var(--reyco-white);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
}

.detail-info {
    margin-top: 1rem;
}

.detail-pair {
    display: flex;
    gap: 2rem;
    margin-bottom: 0.3rem;
    line-height: 1.5;
}

.detail-pair span:first-child {
    min-width: 45%;
}

.detail-observaciones {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--reyco-gray-light);
}

.detail-compact pre {
    margin-bottom: 0.75rem;
}

@media (max-width: 480px) {
    .detail-pair {
        flex-direction: column;
        gap: 0;
    }
    .detail-pair span:first-child {
        min-width: auto;
    }
}

.detail-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--reyco-gray-dark);
    font-size: 0.9rem;
}

.detail-info pre {
    background-color: var(--reyco-gray-light);
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    color: var(--reyco-gray-dark);
}

/* ========================================
   MAPA LEAFLET
   ======================================== */

.mapa-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mapa-container {
    flex: 1;
    min-height: 500px;
    height: 100%;
    border-radius: 4px;
    z-index: 1;
}

.mapa-leyenda {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--reyco-gray-dark);
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: opacity 0.2s, background-color 0.2s;
    user-select: none;
}

.leyenda-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.leyenda-item.inactivo {
    opacity: 0.35;
    text-decoration: line-through;
}

.leyenda-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.leyenda-item.carga .leyenda-dot {
    background-color: var(--reyco-red);
}

.leyenda-item.camion .leyenda-dot {
    background-color: #2563eb;
}

/* Marcadores personalizados */
.marker-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.marker-icon svg {
    width: 18px;
    height: 18px;
}

.marker-icon.carga {
    background-color: var(--reyco-red);
    color: white;
}

.marker-icon.camion {
    background-color: #2563eb;
    color: white;
}

/* Popups de Leaflet */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.popup-content {
    min-width: 180px;
}

.popup-btn {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.4rem 0.75rem;
    background-color: var(--reyco-red);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.popup-btn:hover {
    background-color: var(--reyco-red-dark);
}

.popup-buttons {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.popup-buttons .popup-btn {
    flex: 1;
    margin-top: 0;
}

.popup-btn-secondary {
    flex: 1;
    padding: 0.4rem 0.75rem;
    background-color: transparent;
    color: var(--reyco-red);
    border: 1.5px solid var(--reyco-red);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-btn-secondary:hover {
    background-color: var(--reyco-red);
    color: white;
}

.popup-btn-asistente {
    flex: 1;
    padding: 0.4rem 0.5rem;
    background-color: #fef3cd;
    color: #856404;
    border: 1.5px solid #e8a308;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-btn-asistente:hover {
    background-color: #e8a308;
    color: white;
}

/* Indicador de match posible (borde amarillo izquierdo) */
.list-card.has-sugerencias {
    border-left: 3px solid #e8a308;
}

/* Resaltado de tarjeta al localizar desde el mapa */
.list-card.resaltado {
    border: 2px solid var(--reyco-red);
    background-color: rgba(200, 30, 50, 0.08);
    box-shadow: 0 0 12px rgba(200, 30, 50, 0.25);
    animation: resaltado-pulse 0.6s ease-in-out 2;
}

@keyframes resaltado-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(200, 30, 50, 0.25); }
    50% { box-shadow: 0 0 20px rgba(200, 30, 50, 0.45); }
}

/* ========================================
   BORRADOR (VISIBILIDAD PRIVADA)
   ======================================== */

.list-card.card-borrador {
    background-color: #e5e7eb;
    border-color: #c0c4cc;
    opacity: 0.75;
}

.list-card.card-borrador:hover {
    opacity: 1;
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.borrador-icon {
    width: 14px;
    height: 14px;
    color: #999;
    flex-shrink: 0;
}

.filter-chip {
    background: var(--reyco-gray-light);
    border: 1px solid var(--reyco-gray-border);
    border-radius: 16px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--reyco-gray-medium);
}

.filter-chip:hover {
    border-color: var(--reyco-red);
    color: var(--reyco-red);
}

.filter-chip.active {
    background: var(--reyco-red);
    border-color: var(--reyco-red);
    color: #fff;
}

.action-bar-publicar {
    color: #059669;
}

.action-bar-publicar:hover {
    background: rgba(5, 150, 105, 0.08);
}

.action-bar-ocultar {
    color: #6b7280;
}

.action-bar-ocultar:hover {
    background: #f3f4f6;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .split-container.single-view {
        max-width: 70%;
    }
    
    .split-container.dual-view {
        max-width: 95%;
    }
}

/* Móvil */
@media (max-width: 768px) {
    /* Header compacto */
    .app-header {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }
    
    .logo-desktop {
        display: none;
    }

    .logo-mobile {
        display: block;
    }

    /* Navegación: solo iconos */
    .header-nav {
        display: flex;
        gap: 0;
        flex: 1;
        justify-content: center;
    }
    
    .nav-tab {
        padding: 0.5rem 0.75rem;
        margin: 0 0.1rem;
    }
    
    .nav-tab .nav-text {
        display: none;
    }

    /* Action bar modales: solo iconos en mobile */
    .action-bar-text {
        display: none;
    }

    .nav-icon {
        width: 24px;
        height: 24px;
    }
    
    /* Contenedor ocupa todo el ancho */
    .split-container {
        padding: 0.5rem;
        max-width: 100% !important;
    }
    
    .split-container.single-view,
    .split-container.single-view.single-mapa {
        max-width: 100% !important;
    }
    
    /* Forzar vista única (no dual/triple) */
    .split-container.dual-view,
    .split-container.triple-view {
        grid-template-columns: 1fr !important;
    }
    
    .split-container.dual-view .split-panel:not(:first-child),
    .split-container.triple-view .split-panel:not(:first-child) {
        display: none;
    }
    
    /* Botón Nueva: solo mostrar "+" */
    .btn-action .btn-text {
        display: none;
    }
    
    .btn-action {
        padding: 0.5rem 0.75rem;
        font-size: 1.1rem;
    }
    
    /* Panel header más compacto */
    .panel-content .panel-header {
        padding: 0.75rem;
    }
    
    .panel-content .panel-title {
        font-size: 1rem;
    }
    
    /* Modal responsive — dvh = viewport visible real en iOS Safari */
    .modal-content {
        max-height: 95vh;
        max-height: 95dvh;
        margin: 0.5rem;
    }

    .modal-footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Cards más compactas */
    .list-card {
        padding: 0.6rem 0.75rem;
    }
    
    .card-row .date {
        min-width: 40px;
        font-size: 0.9rem;
    }
    
    .card-row .location {
        font-size: 0.85rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Móvil pequeño */
@media (max-width: 480px) {
    .app-header {
        padding: 0.4rem 0.75rem;
    }
    
    .app-header .logo {
        height: 28px;
    }
    
    .nav-tab {
        padding: 0.4rem 0.6rem;
    }
    
    .nav-icon {
        width: 22px;
        height: 22px;
    }
    
    .split-panel {
        min-height: 400px;
    }
    
    /* Mapa más pequeño */
    .mapa-container {
        min-height: 350px;
    }
}

/* En móvil: Mapa muestra solo "Mapa", no "Mapa de Disponibilidad" */
@media (max-width: 768px) {
    .title-full {
        display: none;
    }
}

/* ===== ICONOS DE CONTACTO ===== */
.list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.list-card .card-row {
    flex: 1;
    cursor: pointer;
}

.contact-icons {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.contact-btn svg {
    width: 14px;
    height: 14px;
}

.contact-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.contact-btn:active {
    transform: scale(0.95);
}

/* Teléfono - azul */
.contact-btn.phone {
    background: #2196F3;
    color: white;
}

.contact-btn.phone:hover {
    background: #1976D2;
}

/* WhatsApp - verde */
.contact-btn.whatsapp {
    background: #25D366;
    color: white;
}

.contact-btn.whatsapp:hover {
    background: #128C7E;
}

/* Copiar - gris */
.contact-btn.copy {
    background: #607D8B;
    color: white;
}

.contact-btn.copy:hover {
    background: #455A64;
}

/* En móvil: iconos un poco más pequeños */
@media (max-width: 768px) {
    .contact-btn {
        width: 28px;
        height: 28px;
    }
    
    .contact-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   DRAG & DROP
   ═══════════════════════════════════════════════════════════════════════ */

.list-card[draggable="true"] {
    cursor: grab;
}

.list-card[draggable="true"]:active {
    cursor: grabbing;
    opacity: 0.5;
}

.list-card.drag-over-valid {
    border: 2px dashed #22c55e;
    background-color: rgba(34, 197, 94, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════
   VALIDACIÓN DE FORMULARIOS
   ═══════════════════════════════════════════════════════════════════════ */

.validacion-errores {
    margin: 0.75rem 1.5rem;
    padding: 0.6rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.validacion-error {
    margin: 0.2rem 0;
    font-size: 0.82rem;
    color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════════════
   RETIRAR CARGA / CAMIÓN
   ═══════════════════════════════════════════════════════════════════════ */


.retirar-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.retirar-form-row {
    display: flex;
    gap: 0.5rem;
}

.retirar-select {
    flex: 1;
    font-size: 0.85rem;
}

.retirar-obs {
    font-size: 0.85rem;
    resize: none;
}


.btn-danger {
    padding: 0.4rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background: #ef4444;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════
   SUGERENCIAS DE MATCH
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Animación de Match ── */
.match-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.80);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: matchOverlayFade 3.5s ease forwards;
    pointer-events: none;
}

@keyframes matchOverlayFade {
    0%   { opacity: 0; }
    8%   { opacity: 1; }
    82%  { opacity: 1; }
    100% { opacity: 0; }
}

.match-animation-scene {
    position: relative;
    width: 320px;
    height: 120px;
    margin-bottom: 1rem;
}

.match-anim-box {
    position: absolute;
    right: 75px;
    top: 30px;
    width: 40px;
    height: 40px;
    color: var(--reyco-red);
    z-index: 2;
    animation: matchBoxMove 3.5s ease forwards;
}

@keyframes matchBoxMove {
    0%   { transform: translateX(-350px); opacity: 0; }
    25%  { transform: translateX(0px); opacity: 1; }
    50%  { transform: translateX(0px); opacity: 1; }
    55%  { transform: translateX(0px); opacity: 1; }
    85%  { transform: translateX(400px); opacity: 1; }
    100% { transform: translateX(500px); opacity: 0; }
}

.match-anim-truck {
    position: absolute;
    right: 40px;
    top: 12px;
    width: 90px;
    height: 80px;
    color: #ffffff;
    z-index: 1;
    animation: matchTruckMove 3.5s ease forwards;
}

@keyframes matchTruckMove {
    0%   { transform: translateX(250px); opacity: 0; }
    25%  { transform: translateX(0px); opacity: 1; }
    50%  { transform: translateX(0px); opacity: 1; }
    55%  { transform: translateX(0px); opacity: 1; }
    85%  { transform: translateX(400px); opacity: 1; }
    100% { transform: translateX(500px); opacity: 0; }
}

.match-anim-text {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    animation: matchTextIn 3.5s ease forwards;
}

@keyframes matchTextIn {
    0%   { opacity: 0; transform: translateY(10px); }
    35%  { opacity: 0; transform: translateY(10px); }
    50%  { opacity: 1; transform: translateY(0); }
    82%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

.match-anim-check {
    display: inline-block;
    color: #22c55e;
    margin-right: 0.4rem;
    animation: matchCheckPop 3.5s ease forwards;
}

@keyframes matchCheckPop {
    0%   { transform: scale(0); }
    42%  { transform: scale(0); }
    52%  { transform: scale(1.3); }
    60%  { transform: scale(1); }
    82%  { transform: scale(1); }
    100% { transform: scale(0); }
}

/* ── Búsqueda manual de match ── */
.busqueda-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--reyco-gray-light);
}

.busqueda-section h4 {
    font-size: 0.9rem;
    color: var(--reyco-red);
    margin-bottom: 0.5rem;
}

.busqueda-input {
    margin-bottom: 0.5rem;
    font-size: 0.85rem !important;
    padding: 0.4rem 0.6rem !important;
    border-radius: 6px !important;
}

.busqueda-hint {
    font-size: 0.8rem;
    color: var(--reyco-gray-medium);
    font-style: italic;
    margin: 0.25rem 0 0;
}

.busqueda-sin-resultados {
    font-size: 0.8rem;
    color: var(--reyco-gray-medium);
    margin: 0.25rem 0 0;
}

/* ── Sugerencias automáticas ── */
.sugerencias-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--reyco-gray-light);
}

.sugerencias-section h4 {
    font-size: 0.9rem;
    color: var(--reyco-red);
    margin-bottom: 0.5rem;
}

.sugerencia-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
    background: var(--reyco-gray-light);
    border-radius: 6px;
    font-size: 0.85rem;
    gap: 0.5rem;
}

.sugerencia-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.sugerencia-dist {
    font-size: 0.75rem;
    color: var(--reyco-gray-medium);
    white-space: nowrap;
}

.btn-match {
    padding: 0.3rem 0.75rem;
    background: var(--reyco-red);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-match:hover {
    background: var(--reyco-red-dark, #a21d2d);
}

/* ═══════════════════════════════════════════════════════════════════════
   MATCHES - BADGES Y TARJETAS
   ═══════════════════════════════════════════════════════════════════════ */

.match-info {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.match-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.match-badge.interno {
    background: #22c55e;
    color: white;
}

.match-badge.externo {
    background: #f59e0b;
    color: white;
}

.match-card .contact-btn {
    background: #ef4444;
}

.match-card .contact-btn:hover {
    background: #dc2626;
}

/* Modal de confirmación compacto */
.modal-confirm {
    max-width: 380px;
}

/* ═══════════════════════════════════════════════════════════════════════
   ADVERTENCIA DE TIPO MISMATCH
   ═══════════════════════════════════════════════════════════════════════ */

.match-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin-top: 0.75rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #92400e;
}

.warning-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: #f59e0b;
}

/* Icono de advertencia en la lista de matches */
.match-warning-icon {
    display: inline-flex;
    align-items: center;
}

.match-warning-icon svg {
    width: 16px;
    height: 16px;
    color: #f59e0b;
}

/* ── Cabecera de Matches con tabs integrados ── */
.matches-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    border-bottom: 2px solid var(--reyco-gray-light, #e5e7eb);
}

.panel-content .panel-header.matches-header {
    justify-content: flex-start;
}

.matches-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: var(--reyco-gray-medium, #6b7280);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.matches-tab:hover {
    color: var(--reyco-red);
}

.matches-tab.active {
    color: var(--reyco-red);
    border-bottom-color: var(--reyco-red);
    font-weight: 600;
}

/* ── Tarjetas de coincidencias ── */
.coincidencia-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coincidencia-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.3rem 0;
    min-width: 0;
}

.coincidencia-par {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
}

.coincidencia-carga,
.coincidencia-camion {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-width: 0;
}

.coincidencia-carga svg {
    color: var(--reyco-red);
    flex-shrink: 0;
}

.coincidencia-camion svg {
    color: #2563eb;
    flex-shrink: 0;
}

.coincidencia-separator {
    display: inline-flex;
    align-items: center;
    color: var(--reyco-gray-medium, #6b7280);
    flex-shrink: 0;
}

.coincidencia-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
}

.coincidencia-dist {
    color: var(--reyco-red);
    font-weight: 600;
    white-space: nowrap;
}

.coincidencia-tipo {
    color: var(--reyco-gray-medium, #6b7280);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════
   FLATPICKR CUSTOM (acento reyco sutil)
   ═══════════════════════════════════════════════════════════════════════ */

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--reyco-red) !important;
    border-color: var(--reyco-red) !important;
}

.flatpickr-day.today {
    border-color: var(--reyco-red) !important;
}

.flatpickr-day:hover {
    background: rgba(200, 16, 46, 0.08) !important;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: var(--reyco-red) !important;
}

/* Inputs Flatpickr: cursor pointer + icono calendario */
input.flatpickr-input,
input.flatpickr-input + input.form-control,
input.flatpickr-input + input.filter-input {
    cursor: pointer !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    padding-right: 2rem !important;
}

.filter-panel input.flatpickr-input + input {
    cursor: pointer !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.3rem center !important;
    padding-right: 1.5rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   FILTROS EN LISTADOS
   ═══════════════════════════════════════════════════════════════════════ */

.header-buttons {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.btn-filter {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: transparent;
    border: none;
    color: var(--reyco-red);
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    transition: all 0.2s;
    position: relative;
    margin-left: 0.25rem;
}

.btn-filter svg {
    width: 24px;
    height: 24px;
}

.btn-filter.open svg {
    color: var(--reyco-red);
}

.btn-filter:hover {
    opacity: 0.7;
}

.btn-filter.active {
    color: var(--reyco-red);
}

.filter-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--reyco-red);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.filter-panel {
    background: var(--reyco-gray-light, #f8f9fa);
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    animation: filterSlideDown 0.2s ease-out;
}

@keyframes filterSlideDown {
    from { opacity: 0; max-height: 0; padding: 0 0.75rem; }
    to { opacity: 1; max-height: 200px; padding: 0.5rem 0.75rem; }
}

.filter-row {
    display: flex;
    gap: 0.4rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.filter-group label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--reyco-gray-medium, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.filter-input {
    font-size: 0.75rem;
    padding: 0.3rem 0.4rem;
    border: 1.5px solid #d1d5db;
    border-radius: 5px;
    background: white;
    color: var(--reyco-dark, #1a1a2e);
    width: 100%;
    min-width: 0;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.filter-input:hover {
    border-color: #9ca3af;
    background-color: #fafafa;
}

.filter-input:focus {
    outline: none;
    border-color: var(--reyco-red);
    box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.12);
    background-color: #fff;
}

select.filter-input {
    cursor: pointer;
}

/* ── Tom Select: Filtros (compacto) ─────────────────────────── */

.filter-group .ts-wrapper {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: auto !important;
}

.filter-group .ts-wrapper .ts-control,
.filter-group .ts-wrapper.single .ts-control {
    border: 1.5px solid #d1d5db !important;
    border-radius: 5px !important;
    padding: 0.2rem 1.6rem 0.2rem 0.4rem !important;
    font-size: 0.75rem;
    min-height: 1.65rem !important;
    line-height: 1.2 !important;
    background-color: #fff !important;
    background-image: none !important;
    cursor: pointer !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box !important;
}

.filter-group .ts-wrapper.single .ts-control::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    right: 0.4rem !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 4px solid transparent !important;
    border-right: 4px solid transparent !important;
    border-top: 4px solid #6b7280 !important;
    border-bottom: none !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
}

.filter-group .ts-wrapper.single.dropdown-active .ts-control::after {
    border-top: none !important;
    border-bottom: 4px solid var(--reyco-red) !important;
}

.filter-group .ts-wrapper .ts-control > input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
}

.filter-group .ts-wrapper .ts-control:hover {
    border-color: #9ca3af !important;
}

.filter-group .ts-wrapper.focus .ts-control,
.filter-group .ts-wrapper.dropdown-active .ts-control {
    border-color: var(--reyco-red) !important;
    box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.12) !important;
}

.filter-group .ts-wrapper .ts-dropdown {
    border: 1.5px solid #d1d5db !important;
    border-radius: 5px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    margin-top: 3px !important;
    overflow: hidden;
}

.filter-group .ts-wrapper .ts-dropdown .option {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.filter-group .ts-wrapper .ts-dropdown .option.active {
    background-color: rgba(200, 16, 46, 0.08) !important;
    color: var(--reyco-red) !important;
}

.filter-group .ts-wrapper .ts-dropdown .option:hover {
    background-color: #f3f4f6 !important;
}

.filter-cp {
    max-width: 45px;
    text-align: center;
}

input[type="date"].filter-input {
    max-width: 130px;
}

.btn-limpiar {
    background: transparent;
    border: 1.5px solid #d1d5db;
    border-radius: 5px;
    color: var(--reyco-gray-medium, #9ca3af);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
    align-self: flex-end;
}

.btn-limpiar:hover {
    background: var(--reyco-red);
    border-color: var(--reyco-red);
    color: white;
    transform: scale(1.05);
}

/* ════════════════════════════════════════════════════════════════════════
   ASISTENTE DE RUTA (ERP NetOffice)
   ════════════════════════════════════════════════════════════════════════ */

/* Barra de acciones entre cabecera y contenido del modal */
.modal-action-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--reyco-gray-border);
}

.action-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: #4b5563;
}

.action-bar-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

.action-bar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Asistente */
.action-bar-asistente {
    border-color: #f59e0b;
    color: #92400e;
}

.action-bar-asistente svg {
    color: #f59e0b;
}

.action-bar-asistente:hover {
    background: #fffbeb;
    border-color: #d97706;
}

/* Editar */
.action-bar-editar {
    border-color: #3b82f6;
    color: #1e40af;
}

.action-bar-editar svg {
    color: #3b82f6;
}

.action-bar-editar:hover {
    background: #eff6ff;
    border-color: #2563eb;
}

/* Retirar */
.action-bar-retirar {
    border-color: #ef4444;
    color: #991b1b;
}

.action-bar-retirar svg {
    color: #ef4444;
}

.action-bar-retirar:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

.action-bar-externo {
    border-color: #f59e0b;
    color: #92400e;
}

.action-bar-externo svg {
    color: #f59e0b;
}

.action-bar-externo:hover {
    background: #fffbeb;
    border-color: #d97706;
}

/* Botón cerrar con SVG */
.modal-close {
    background: none;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s;
    padding: 0;
    font-size: 0;
    line-height: 1;
}

.modal-close svg {
    width: 18px;
    height: 18px;
    display: block;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

/* Overlay del asistente (z-index superior al modal principal) */
.asistente-overlay {
    z-index: 1100;
}

/* Modal del asistente (un poco más grande) */
.asistente-modal {
    max-width: 640px;
    max-height: 85vh;
}

.asistente-header {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.asistente-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: white;
}

.asistente-header .modal-close {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.asistente-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.asistente-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.asistente-body {
    padding: 1rem 1.25rem;
}

/* Loading */
.asistente-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
    color: var(--reyco-gray-medium);
}

.asistente-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Secciones */
.asistente-section {
    margin-bottom: 1.25rem;
}

.asistente-section:last-child {
    margin-bottom: 0;
}

.asistente-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Precios */
.asistente-precios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.precio-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.precio-card-full {
    text-align: center;
}

.precio-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--reyco-gray-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.precio-medio {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
}

.precio-rango {
    font-size: 0.78rem;
    color: #6b7280;
}

.precio-total {
    font-size: 0.75rem;
    color: var(--reyco-gray-medium);
}

.precio-sin-datos {
    font-size: 0.85rem;
    color: var(--reyco-gray-medium);
    font-style: italic;
}

/* Contactos (clientes y transportistas) */
.asistente-contacto {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    background: #f9fafb;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    border: 1px solid #e5e7eb;
    transition: border-color 0.15s;
}

.asistente-contacto:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.contacto-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

.contacto-nombre {
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.contacto-stats {
    font-size: 0.7rem;
    color: var(--reyco-gray-medium);
    white-space: nowrap;
    flex-shrink: 0;
    background: #f3f4f6;
    padding: 1px 7px;
    border-radius: 10px;
}

.contacto-info-extra {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    flex-shrink: 0;
}

.contacto-info-extra span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.contacto-acciones {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.contacto-acciones .contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.contacto-acciones .contact-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.contacto-acciones .contact-btn.phone {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.contacto-acciones .contact-btn.phone:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.contacto-acciones .contact-btn.whatsapp {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

.contacto-acciones .contact-btn.whatsapp:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.contacto-acciones .contact-btn.email {
    background: #fefce8;
    color: #b45309;
    border-color: #fde68a;
}

.contacto-acciones .contact-btn.email:hover {
    background: #fef9c3;
    border-color: #fcd34d;
}

.asistente-sin-datos {
    color: var(--reyco-gray-medium);
    font-style: italic;
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

/* Iconos SVG de sección en asistente */
.section-icon {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
    margin-right: 4px;
    opacity: 0.7;
}

/* Mini iconos SVG para datos de contacto */
.mini-icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 2px;
    opacity: 0.55;
}

/* Responsive */
@media (max-width: 600px) {
    .asistente-modal {
        max-width: 95vw;
    }
    .asistente-precios {
        grid-template-columns: 1fr;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   NOTIFICACIÓN POST-CREACIÓN (coincidencias)
   ════════════════════════════════════════════════════════════════════════ */

.notificacion-modal {
    max-width: 540px;
    animation: notificacionSlideIn 0.3s ease-out;
}

@keyframes notificacionSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header verde cuando hay coincidencias */
.notificacion-header-ok {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

.notificacion-header-ok h3 {
    color: white;
}

.notificacion-header-ok .modal-close {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.notificacion-header-ok .modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Header gris cuando no hay coincidencias */
.notificacion-header-empty {
    background: #f3f4f6;
    border-bottom-color: #e5e7eb;
}

.notificacion-header-empty h3 {
    color: #6b7280;
}

/* Icono en header */
.notificacion-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 0.3rem;
}

.notificacion-header-ok h3 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.notificacion-header-empty h3 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Info de la ruta/ubicación publicada */
.notificacion-ruta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--reyco-gray-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Mensaje sin datos */
.notificacion-sin-datos {
    text-align: center;
    color: var(--reyco-gray-medium);
    font-size: 0.9rem;
    padding: 1.5rem 0;
    font-style: italic;
}

/* Tarjeta enriquecida de coincidencia */
.notificacion-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.notificacion-card:hover {
    border-color: #d1d5db;
}

.notificacion-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.notificacion-card-location {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--reyco-gray-dark);
}

.notificacion-card-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.notificacion-card-detail {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 0.2rem;
}

.notificacion-obs {
    font-size: 0.78rem;
    font-style: italic;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.notificacion-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

.notificacion-telefono {
    font-size: 0.82rem;
    color: #6b7280;
    margin-left: 0.25rem;
}

/* ════════════════════════════════════════════════════════════════════════
   BADGES NAVEGACION (alertas tiempo real)
   ════════════════════════════════════════════════════════════════════════ */

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--reyco-red);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 0.35rem;
}

.nav-tab.active .nav-badge {
    background: #fff;
    color: var(--reyco-red);
}

.nav-badge-pulse {
    animation: badge-pulse 1.5s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ════════════════════════════════════════════════════════════════════════
   PANEL DE USUARIOS (Admin)
   ════════════════════════════════════════════════════════════════════════ */

/* Tarjetas de usuario */
.user-card {
    background: var(--reyco-white);
    border: 1px solid var(--reyco-gray-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-card:hover {
    border-color: var(--reyco-red);
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.12);
}

.user-card.card-inactive {
    opacity: 0.6;
    background: #fafafa;
}

.user-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.user-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.user-login-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--reyco-gray-dark);
}

.user-full-name {
    font-size: 0.8rem;
    color: var(--reyco-gray-medium);
}

.user-card-badges {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

.user-card-meta {
    font-size: 0.75rem;
    color: var(--reyco-gray-medium);
    margin-top: 0.35rem;
}

/* Badges de rol y estado */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-admin {
    background: var(--reyco-red);
    color: white;
}

.badge-operador {
    background: #2563eb;
    color: white;
}

.badge-activo {
    background: #22c55e;
    color: white;
}

.badge-inactive {
    background: #9ca3af;
    color: white;
}

.badge-orden {
    background: #e5e7eb;
    color: #374151;
}

.badge-protegido {
    background: #f59e0b;
    color: white;
}

.admin-protegido-info {
    color: var(--reyco-gray-medium);
    font-size: 0.85rem;
    font-style: italic;
}

/* Subheader para secciones dentro de tabs de configuracion */
.config-subheader {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.75rem 1rem;
}

/* Detalle de usuario */
.detalle-campo {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--reyco-gray-light);
}

.detalle-campo:last-of-type {
    border-bottom: none;
}

.detalle-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--reyco-gray-medium);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detalle-valor {
    font-size: 0.95rem;
    color: var(--reyco-gray-dark);
}

.detalle-acciones {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
}

/* Botones especiales */
.btn-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--reyco-gray-medium);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-close svg {
    width: 20px;
    height: 20px;
}

.btn-close:hover {
    color: var(--reyco-gray-dark);
}

.btn-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* Modal pequeño */
.modal-sm {
    max-width: 450px;
}

/* Formularios genéricos en modales de usuario */
.form-group input,
.form-group select {
    padding: 0.55rem 0.75rem;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: #fff;
    color: var(--reyco-gray-dark);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--reyco-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.form-group input::placeholder {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85rem;
}

.form-group input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-group select {
    cursor: pointer;
}

/* Toggle activo/inactivo */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.toggle-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--reyco-red);
}

/* Info de password reseteada */
.password-reset-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
}

.password-reset-info p {
    margin: 0 0 0.25rem;
    font-size: 0.85rem;
    color: #166534;
}

.password-reset-info code {
    display: block;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--reyco-gray-dark);
    letter-spacing: 0.05em;
    border: 1px solid #bbf7d0;
    margin: 0.25rem 0;
}

.password-warning {
    font-size: 0.78rem !important;
    color: #b45309 !important;
    font-style: italic;
}

/* Textos de estado en listas */
.loading-text,
.empty-text {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--reyco-gray-medium);
    font-size: 0.9rem;
}
