/* =====================================================================
   Diseño de paradas de ruta (detalle de ruta y plantillas).
   Compartido por RouteStopsPanel (pestaña Paradas de ITRoutesCRUD) y ITRoutesTemplatePoint.
   ===================================================================== */

/* Toolbar de cabecera: botones estándar round-button-gold (40x40, icono blanco,
   span = tooltip). Los modificadores rt-tool--* solo cambian el color de fondo
   semántico conservando tamaño/tooltip del estándar. */
.route-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }

.round-button-gold.rt-tool--orange { background: #fd7e14; box-shadow: 0 2px 6px rgba(253, 126, 20, .25); }
.round-button-gold.rt-tool--orange:hover { background: #d9660a; box-shadow: 0 4px 10px rgba(253, 126, 20, .35); }

.round-button-gold.rt-tool--red { background: #dc3545; box-shadow: 0 2px 6px rgba(220, 53, 69, .25); }
.round-button-gold.rt-tool--red:hover { background: #b02a37; box-shadow: 0 4px 10px rgba(220, 53, 69, .35); }

/* LoadingButton dentro del estándar: el spinner sustituye al icono (centrado,
   sin margen) y el texto de "ocupado" queda como tooltip (span). Hay que
   "des-tooltipizar" el span del spinner, que hereda los estilos de burbuja. */
.round-button-gold .lb-spinner {
    position: static;
    opacity: 1;
    visibility: visible;
    width: 15px;
    height: 15px;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 50%;
    transform: none;
}

.round-button-gold .lb-spinner::after { content: none; }

/* Hint de arrastre */
.route-hint {
    display: flex; align-items: center; gap: 8px;
    font-size: .82rem; color: #8a97a8; margin: 2px 0 12px;
}

/* Tarjeta de parada */
.route-stop {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid #e6ebf2; border-radius: 12px;
    padding: 12px 14px; margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    cursor: grab; transition: box-shadow .15s ease, border-color .15s ease;
}
.route-stop:hover { border-color: #cfe0f0; box-shadow: 0 3px 10px rgba(16, 24, 40, .08); }
.route-stop:active { cursor: grabbing; }
.route-stop__drag { color: #b9c3cf; font-size: 1rem; flex: 0 0 auto; }
.route-stop__order {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
    background: #4088BD; color: #fff; font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
}
.route-stop__info { flex: 1; min-width: 0; }
.route-stop__addr { font-weight: 600; color: #2c3e50; font-size: .92rem; word-break: break-word; }
.route-stop__loc { font-size: .8rem; color: #8a97a8; margin-top: 2px; }
/* Acciones de parada: usan los botones estándar round-button (34px + tooltip). */
.route-stop__actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* Estado vacío */
.route-empty { text-align: center; padding: 30px 16px; color: #8a97a8; }
.route-empty i { font-size: 2rem; color: #c4ccd6; margin-bottom: 10px; display: block; }
.route-empty p { margin: 0 0 4px; font-weight: 600; color: #56657a; }
.route-empty span { font-size: .85rem; }

/* =====================================================================
   Facturas de la ruta: cabecera compacta + facturas como filas-card.
   ===================================================================== */
.rt-inv__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 12px;
}
.rt-inv__title { margin: 0; font-size: .95rem; font-weight: 700; color: #2c3e50; }
.rt-inv__count {
    flex: 0 0 auto; display: inline-flex; align-items: center;
    padding: 4px 12px; border-radius: 999px;
    background: #e8f1f8; color: #35709c;
    font-size: .78rem; font-weight: 700; line-height: 1.2; white-space: nowrap;
}

.rt-inv__list { display: flex; flex-direction: column; gap: 10px; }

/* Fila-card horizontal por factura */
.rt-inv-row {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid #e6ebf2; border-radius: 12px;
    padding: 12px 14px; cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.rt-inv-row:hover, .rt-inv-row:focus {
    border-color: #cfe0f0; box-shadow: 0 3px 10px rgba(16, 24, 40, .08);
    outline: none;
}
.rt-inv-row__id {
    flex: 0 0 150px; min-width: 0;
    display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
}
.rt-inv-row__number { font-weight: 700; color: #2c3e50; font-size: .92rem; word-break: break-word; }
.rt-inv-row__grid {
    flex: 1; min-width: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.rt-inv-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-inv-field span {
    font-size: .72rem; font-weight: 600; color: #8a97a8;
    text-transform: uppercase; letter-spacing: .03em;
}
.rt-inv-field strong { font-size: .88rem; color: #34495e; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-inv-field__amount { color: #1a7a43 !important; font-weight: 700 !important; }

/* Colores de estado extra para it-badge. Borrador va con borde discontinuo y sin relleno
   para que no se confunda con una factura ya enviada. */
.rt-badge--draft { background: #fff; color: #6b7684; border: 1px dashed #aab4c0; }
.rt-badge--sent { background: #e8f1f8; color: #2f6a98; }
.rt-badge--pending { background: #fdf4dc; color: #b3860a; }
.rt-badge--rectified { background: #f1ecfb; color: #6b4fa3; }
.rt-badge--cancelled { background: #fdecea; color: #c0392b; }
.rt-inv-row__number--none { color: #98a2b3; font-style: italic; font-weight: 600; }

@media (max-width: 640px) {
    .rt-inv-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .rt-inv-row__id { flex: 0 0 auto; flex-direction: row; align-items: center; justify-content: space-between; }
    .rt-inv-row__grid { grid-template-columns: 1fr; gap: 8px; }
}

/* =====================================================================
   Ficha de ruta unificada (ITRoutesCRUD): cabecera, trayecto y pestañas.
   ===================================================================== */
.rt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rt-head__main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rt-head__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rt-chip {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    background: #e8f1f8; color: #35709c; font-size: .78rem; font-weight: 700;
}
.rt-head__client { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: #56657a; font-weight: 600; }
.rt-head__client i { color: #98a2b3; }

/* Trayecto origen → destino */
.rt-trip {
    display: flex; align-items: center; gap: 14px; margin-top: 14px;
    padding: 12px 16px; background: #f8fafc; border: 1px solid #e6ebf2; border-radius: 12px;
}
.rt-trip__point { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; }
.rt-trip__txt { display: flex; flex-direction: column; min-width: 0; }
.rt-trip__txt small { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8a97a8; }
.rt-trip__txt strong { font-size: .92rem; color: #2c3e50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-trip__txt span { font-size: .76rem; color: #8a97a8; }
.rt-trip__line { flex: 0 1 220px; position: relative; text-align: center; font-size: .75rem; font-weight: 600; color: #8a97a8; }
.rt-trip__line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed #cfd8e3; }
.rt-trip__line span { position: relative; padding: 0 8px; background: #f8fafc; }

.rt-dot { flex: 0 0 auto; display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.rt-dot--origin { background: #2e9e57; box-shadow: 0 0 0 3px rgba(46, 158, 87, .18); }
.rt-dot--dest { background: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .18); }

/* Pestañas: mismo aspecto que MyCustomTabs, con contador y estado deshabilitado. */
.rt-tabs {
    display: flex; gap: 6px; margin-top: 14px; padding: 6px;
    background: #f1f4f8; border-radius: 14px; overflow-x: auto;
}
.rt-tab {
    display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
    padding: 9px 15px; border: none; border-radius: 10px; background: transparent;
    color: #64748b; font-weight: 500; font-size: .875rem; white-space: nowrap; cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.rt-tab:hover:not(.rt-tab--active):not(.rt-tab--disabled):not(.rt-tab--locked) { background: rgba(255, 255, 255, .6); color: #475569; }
.rt-tab--active { background: #fff; color: #4088BD; font-weight: 700; box-shadow: 0 2px 8px rgba(16, 24, 40, .08); }
.rt-tab--disabled { opacity: .5; cursor: not-allowed; }
/* Pestaña de un módulo no contratado (DeCA): se ve, apagada y con candado. */
.rt-tab--locked { opacity: .55; cursor: not-allowed; }
.rt-tab__lock { font-size: .78em; color: #98a2b3; }
.rt-tab__count {
    min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #e2e8f0; color: #475569;
    font-size: .72rem; font-weight: 700; line-height: 1.5; text-align: center;
}
.rt-tab--active .rt-tab__count { background: #e8f1f8; color: #35709c; }
.rt-tab-body { padding-top: 16px; }

/* Formulario por secciones */
.rt-form-section {
    display: flex; align-items: center; gap: 8px; margin: 18px 0 10px;
    font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #4088BD;
}
.rt-form-section:first-child { margin-top: 0; }
.rt-form-section::after { content: ""; flex: 1; border-top: 1px solid #e6ebf2; }
.rt-hint {
    display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 10px 14px;
    border-radius: 10px; background: #eef6fc; color: #35709c; font-size: .85rem;
}
.rt-hint i { margin-top: 2px; }
/* Centrado: a la derecha lo tapaba EVA, que vive en la esquina inferior derecha. */
.rt-form-actions { display: flex; justify-content: center; margin-top: 20px; }

/* Casilla «Esta ruta lleva DeCA»: mismo aspecto que las casillas del formulario del DeCA.
   Nombre propio: .rt-check ya lo usa la casilla del cargador, con su estilo en la ficha. */
.rt-deca-check {
    display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 12px 14px;
    border: 1px solid #e6e9ee; border-radius: 10px; background: #fff; color: #475467;
    font-size: .88rem; cursor: pointer; user-select: none; transition: border-color .15s, background .15s;
}
.rt-deca-check:hover { border-color: #cfe0f0; }
.rt-deca-check.on { border-color: #4088BD; background: #eef5fc; color: #1f2937; }
.rt-deca-check input { accent-color: #4088BD; width: 17px; height: 17px; margin: 2px 0 0; flex: 0 0 auto; cursor: pointer; }
.rt-deca-check span { display: flex; flex-direction: column; gap: 2px; }
.rt-deca-check small { font-size: .8rem; color: #8a97a8; }

/* Pestaña Paradas: lista a la izquierda, mapa a la derecha. */
.rt-stops { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: 18px; align-items: start; }
.rt-panel { background: #fff; border: 1px solid #e6ebf2; border-radius: 14px; padding: 14px; min-width: 0; }
.rt-panel__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.rt-panel__title { margin: 0; font-size: 1rem; font-weight: 700; color: #2c3e50; }
.rt-panel__sub { font-size: .8rem; color: #8a97a8; }
/* La lupa va centrada respecto al campo (44 px de alto → 22 px), no al contenedor: los
   estilos globales de input le añadían margen y la lupa quedaba por debajo. */
.rt-search { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.rt-search__box { position: relative; flex: 1; min-width: 0; }
.rt-search__box > i { position: absolute; left: 14px; top: 22px; transform: translateY(-50%); color: #98a2b3; pointer-events: none; z-index: 1; }
/* «Buscar»: lleva el mapa a la zona escrita; la parada se añade luego pulsando en el mapa. */
.rt-search__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; height: 44px; padding: 0 18px; margin: 0; white-space: nowrap; flex-shrink: 0; }
.rt-search-hint { margin: -2px 0 10px; padding: 9px 12px; border-radius: 10px; background: #eaf3fb; border: 1px solid #cfe0ef; color: #2e6da4; font-size: .84rem; line-height: 1.45; }
.rt-search-hint i { margin-right: 4px; }
.rt-search input {
    display: block; width: 100%; box-sizing: border-box; height: 44px; margin: 0 !important; padding: 0 14px 0 38px;
    font-size: 1rem; color: #1f2937; background: #fff; border: 1.6px solid #d7dde5; border-radius: 12px; outline: none;
}

/* Formulario de modal en dos columnas con aire entre filas (gasto del viaje). */
.rt-modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; align-items: start; }
.rt-modal-full { grid-column: 1 / -1; }
@media (max-width: 560px) { .rt-modal-grid { grid-template-columns: 1fr; } }

/* Aviso dentro de un formulario de modal (p. ej. "añade primero el equipo"): mismo alto
   mínimo que un campo para que la fila quede alineada. */
.rt-modal-note {
    display: flex; align-items: center; gap: 10px; box-sizing: border-box; min-height: 50px;
    padding: 10px 12px; border: 1px solid #ffe0a3; border-radius: 12px;
    background: #fff7e6; color: #8a5a00; font-size: .84rem; line-height: 1.35;
}
.rt-modal-note i { flex: 0 0 auto; font-size: 1rem; }

/* =====================================================================
   Listado de rutas: filtros globales (periodo, búsqueda, estado, progreso).
   ===================================================================== */
.rt-filters { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.rt-filters__fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.rt-filters__count { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: .82rem; color: #8a97a8; }
.rt-filters__reset {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 999px;
    background: #fff; color: #475569; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.rt-filters__reset:hover { border-color: #cbd5e1; background: #f8fafc; }
.rt-empty-filter { text-align: center; padding: 26px 12px; color: #8a97a8; }
.rt-empty-filter p { margin: 0 0 10px; font-size: 1rem; font-weight: 600; color: #56657a; }
@media (max-width: 900px) {
    .rt-filters__fields { grid-template-columns: 1fr 1fr; }
    .rt-filters__fields > :first-child { grid-column: 1 / -1; }
}

/* Rol de cada parada en la lista: origen (verde), intermedia (azul), destino (rojo). */
.route-stop__order--origin { background: #2e9e57; }
.route-stop__order--dest { background: #c0392b; }
.route-stop__tag {
    display: block; margin-bottom: 1px; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: #8a97a8;
}
.route-stop__tag--origin { color: #2e9e57; }
.route-stop__tag--dest { color: #c0392b; }

/* Listado de rutas: cliente con matrícula/conductor y trayecto. */
.rt-cell-main { font-weight: 600; color: #2c3e50; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-cell-sub { margin-top: 2px; font-size: .75rem; color: #8a97a8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-cell-place { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rt-cell-place .rt-dot { width: 9px; height: 9px; box-shadow: none; }
.rt-cell-place__txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-cell-empty { color: #98a2b3; font-size: .8rem; font-style: italic; }

@media (max-width: 992px) {
    .rt-stops { grid-template-columns: 1fr; }
    .rt-trip { flex-direction: column; align-items: stretch; }
    .rt-trip__line { flex-basis: auto; }
}

/* =====================================================================
   Mapa de paradas (MapsNew.js → renderRouteStops): tarjeta al pulsar un pin.
   Acotado con :has(.rs-iw) para no tocar los InfoWindow de otros mapas.
   ===================================================================== */
.gm-style .gm-style-iw-c:has(.rs-iw) {
    padding: 0 !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08) !important;
}
.gm-style .gm-style-iw-c:has(.rs-iw) .gm-style-iw-chr { padding: 10px 4px 0 14px; align-items: center; }
.gm-style .gm-style-iw-c:has(.rs-iw) .gm-style-iw-d { overflow: hidden !important; padding: 0 14px 14px !important; }
.gm-style .gm-style-iw-c:has(.rs-iw) .gm-ui-hover-effect { opacity: .55; border-radius: 8px; }
.gm-style .gm-style-iw-c:has(.rs-iw) .gm-ui-hover-effect:hover { opacity: .9; background: #f1f4f8 !important; }

.rs-iw-head { display: flex; align-items: center; gap: 8px; }
.rs-iw-head__num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
    color: #fff; font-size: 12px; font-weight: 700;
}
.rs-iw-head__role { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.rs-iw { min-width: 210px; max-width: 260px; color: #2c3e50; line-height: 1.35; }
.rs-iw > .rs-iw-head { margin-bottom: 2px; } /* sin headerContent: cabecera dentro del contenido */
.rs-iw__addr { margin-top: 6px; font-size: 14px; font-weight: 600; word-break: break-word; }
.rs-iw__loc { margin-top: 4px; font-size: 12px; color: #8a97a8; }
.rs-iw__loc i { margin-right: 3px; color: #b9c3cf; }
.rs-iw__link {
    display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid #eef1f5; font-size: 12px; font-weight: 600; color: #4088BD; text-decoration: none;
}
.rs-iw__link:hover { text-decoration: underline; }
.rs-iw__link i { font-size: 10px; }

/* =====================================================================
   Pestaña Equipo (RouteCrewPanel): una fila por vehículo / remolque / chófer.
   ===================================================================== */
.rt-hint--warn { background: #fff7e6; color: #9a6700; }

.rt-crew { display: flex; flex-direction: column; gap: 10px; }
.rt-crew__row {
    display: grid; grid-template-columns: 112px repeat(3, minmax(0, 1fr)) 84px; gap: 12px; align-items: center;
    padding: 12px; border: 1px solid #e6ebf2; border-radius: 12px; background: #fff;
}
.rt-crew__row--main { border-color: #bfe3cc; background: #f6fbf8; }
.rt-crew__num { display: flex; align-items: center; gap: 8px; }
.rt-crew__order {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 28px; height: 28px; border-radius: 50%; background: #4088BD; color: #fff; font-size: .85rem; font-weight: 700;
}
.rt-crew__row--main .rt-crew__order { background: #2e9e57; }
.rt-crew__badge { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #2e9e57; }
.rt-crew__actions { display: flex; justify-content: flex-end; gap: 6px; }
.rt-crew__footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 14px; }

.rt-link-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
    border: 1.5px dashed #b9cfe3; border-radius: 10px; background: #f7fbfe;
    color: #35709c; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.rt-link-btn:hover:not(:disabled) { border-color: #4088BD; background: #eef6fc; }
.rt-link-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Resumen del equipo en la pestaña Datos (edición) */
.rt-crew-summary {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    padding: 12px 14px; border: 1px solid #e6ebf2; border-radius: 12px; background: #f8fafc;
}
.rt-crew-summary__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-crew-summary__main strong { color: #2c3e50; font-size: .92rem; }
.rt-crew-summary__main span { color: #8a97a8; font-size: .8rem; }

/* =====================================================================
   Pestaña Gastos y balance (RouteExpensesPanel y sus modales)
   ===================================================================== */
/* Una sola fila con las tarjetas que haya (3 sin precio pactado, 4 con él), todas del
   mismo ancho: con grid-auto-columns no hay que tocar el CSS al añadir una nueva. */
.rt-balance { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; }
.rt-kpi {
    display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
    border: 1px solid #e6ebf2; border-radius: 14px; background: #fff;
}
.rt-kpi__label {
    display: flex; align-items: center; gap: 6px;
    font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8a97a8;
}
.rt-kpi__value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; color: #2c3e50; }
.rt-kpi__sub { font-size: .78rem; color: #8a97a8; }
.rt-kpi--pos { border-color: #bfe3cc; background: #f3fbf6; }
.rt-kpi--pos .rt-kpi__value { color: #1a7a43; }
.rt-kpi--neg { border-color: #f3c7c2; background: #fdf3f2; }
.rt-kpi--neg .rt-kpi__value { color: #c0392b; }

/* ---- Pestaña de análisis con IA ---- */
.rt-tab__ia {
    margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .62rem; font-weight: 800;
    letter-spacing: .06em; color: #fff; background: linear-gradient(135deg, #7b5bd6, #4088BD);
}
.rt-tab--off { opacity: .65; }
.rt-ia-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rt-ia-metrics {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 6px;
}
.rt-ia-metric {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
    border: 1px solid #e6ebf2; border-radius: 12px; background: #fff;
}
.rt-ia-metric span { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #8a97a8; }
.rt-ia-metric strong { font-size: 1.05rem; color: #2f3d4f; }
.rt-ia-verdict {
    display: inline-block; margin: 14px 0 8px; padding: 6px 14px; border-radius: 999px;
    font-weight: 700; color: #35597a; background: #eef3f8;
}
.rt-ia-text { margin: 0 0 14px; font-size: .95rem; line-height: 1.6; color: #35597a; }
.rt-ia-block { margin-bottom: 14px; padding: 12px 16px; border-radius: 12px; border-left: 3px solid #cfd6e0; background: #fbfcfe; }
.rt-ia-block h4 { margin: 0 0 8px; font-size: .9rem; color: #2f3d4f; }
.rt-ia-block ul { margin: 0; padding-left: 18px; color: #54637a; font-size: .88rem; line-height: 1.6; }
.rt-ia-block li { margin-bottom: 5px; }
.rt-ia-block--good { border-left-color: #2e9e57; }
.rt-ia-block--good h4 i { color: #2e9e57; }
.rt-ia-block--bad { border-left-color: #c0392b; }
.rt-ia-block--bad h4 i { color: #c0392b; }
.rt-ia-block--tip { border-left-color: #7b5bd6; }
.rt-ia-block--tip h4 i { color: #7b5bd6; }

/* Ancho x fondo x alto: un solo dato, en una fila de tres y a todo el ancho de la rejilla. */
.rt-dims { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .rt-dims { grid-template-columns: 1fr; } }

/* Llamada a crear el DeCA desde la ficha de la ruta. */
.rt-deca-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.rt-deca-cta span { font-size: .82rem; color: #8a97a8; }

/* Cifras de la comparación previsto/real: verde lo que suma, rojo lo que resta. */
.rt-pos { color: #1a7a43; }
.rt-neg { color: #c0392b; }

/* Etiqueta "opcional" junto al título de una sección del formulario. */
.rt-form-section__hint {
    text-transform: none; letter-spacing: 0; font-weight: 600; font-size: .72rem;
    color: #98a2b3; background: #f1f5f9; border-radius: 999px; padding: 2px 9px;
}

.rt-balance__bar { height: 8px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: #e8f1f8; }
.rt-balance__fill { height: 100%; border-radius: 999px; background: #4088BD; }
.rt-balance__fill--over { background: #c0392b; }
.rt-balance__legend { margin-top: 6px; font-size: .78rem; color: #8a97a8; }

.rt-panel--gap { margin-top: 16px; }
.rt-table-wrap { overflow-x: auto; }
.rt-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rt-table th {
    padding: 8px 10px; border-bottom: 1px solid #e6ebf2; text-align: left; white-space: nowrap;
    font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8a97a8;
}
.rt-table td { padding: 10px; border-bottom: 1px solid #f0f3f7; color: #34495e; vertical-align: middle; }
.rt-table .num { text-align: right; white-space: nowrap; }
.rt-table tfoot td { border-bottom: none; font-weight: 700; color: #2c3e50; }
.rt-table__actions { display: flex; justify-content: flex-end; gap: 6px; }

.rt-modal-base { margin-top: 18px; padding: 10px 14px; border-radius: 10px; background: #f3fbf6; color: #1a7a43; font-size: .88rem; }
.rt-modal-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

.rt-linkexp__list { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; margin-top: 12px; overflow-y: auto; }
.rt-linkexp__row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e6ebf2; border-radius: 12px; }
.rt-linkexp__info { flex: 1; min-width: 0; }
.rt-linkexp__info .rt-chip { margin-left: 6px; }
.rt-linkexp__amount { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.rt-linkexp__amount small { font-size: .7rem; color: #8a97a8; }

@media (max-width: 1200px) {
    /* Con cuatro tarjetas y poco ancho se parten en dos filas de dos, no en una columna
       larguísima: el balance se sigue leyendo de un vistazo. */
    .rt-balance { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
    .rt-crew__row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .rt-balance { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; }
}

/* =====================================================================
   Pestaña Archivos (RouteFilesPanel): fotos y documentos de la ruta.
   ===================================================================== */
.rt-files-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.rt-files-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: 1px solid #e2e8f0; border-radius: 999px; background: #fff;
    color: #64748b; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.rt-files-chip span {
    min-width: 18px; padding: 0 6px; border-radius: 999px; background: #eef2f6;
    font-size: .7rem; text-align: center; line-height: 1.6;
}
.rt-files-chip:hover:not(.is-active) { border-color: #b9cfe3; color: #35709c; }
.rt-files-chip.is-active { border-color: #4088BD; background: #eef6fc; color: #35709c; }
.rt-files-chip.is-active span { background: #4088BD; color: #fff; }

.rt-files-drop {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 6px;
    border: 1.5px dashed #b9cfe3; border-radius: 12px; background: #f7fbfe;
    transition: border-color .15s ease, background .15s ease;
}
.rt-files-drop.is-over { border-color: #4088BD; background: #e8f1f8; }
.rt-files-drop.is-busy { border-style: solid; }
/* Mientras se arrastra, los hijos no deben disparar dragleave en el contenedor. */
.rt-files-drop.is-over * { pointer-events: none; }
.rt-files-drop__main {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0;
    padding: 18px 12px; border-radius: 9px; text-align: center; cursor: pointer; color: #35709c;
}
.rt-files-drop__main:hover { background: #eef6fc; }
.rt-files-drop__main i { font-size: 1.7rem; color: #4088BD; }
.rt-files-drop__main strong { font-size: .9rem; }
.rt-files-drop__main span { font-size: .78rem; color: #8a97a8; }
.rt-files-drop__busy {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 18px 12px; color: #35709c;
}
.rt-files-drop__busy div { display: flex; flex-direction: column; min-width: 0; }
.rt-files-drop__busy span:not(.lb-spinner) {
    font-size: .78rem; color: #8a97a8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw;
}
.rt-files-input { display: none; }
/* «Hacer foto» solo en pantallas táctiles: allí abre la cámara. */
.rt-files-camera { display: none; margin: 0 8px 0 0; }
@media (hover: none) and (pointer: coarse) {
    .rt-files-camera { display: inline-flex; }
}

.rt-files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.rt-file {
    display: flex; flex-direction: column; min-width: 0; overflow: hidden;
    border: 1px solid #e6ebf2; border-radius: 12px; background: #fff;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.rt-file:hover { border-color: #cfdcea; box-shadow: 0 4px 14px rgba(16, 24, 40, .08); }
.rt-file__thumb {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    aspect-ratio: 4 / 3; width: 100%; padding: 0; border: none; background: #f1f4f8; cursor: pointer; overflow: hidden;
}
.rt-file__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rt-file__thumb > i { font-size: 2.6rem; }
.rt-file__ext { font-size: .72rem; font-weight: 800; letter-spacing: .06em; color: #64748b; }
.rt-file--doc .rt-file__thumb { background: #f8fafc; }
.rt-file__type {
    position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .02em;
}
.rt-file--foto .rt-file__type { background: rgba(15, 23, 42, .62); color: #fff; }
.rt-file--doc .rt-file__type { background: #e8f1f8; color: #35709c; }
.rt-file__info { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 4px; min-width: 0; }
.rt-file__info strong {
    color: #2c3e50; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rt-file__info span {
    color: #8a97a8; font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rt-file__actions { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 10px 10px; margin-top: auto; }

/* Visor a pantalla completa. Por debajo de ItModalHost (99990): una confirmación abierta
   desde aquí queda encima. */
.rt-viewer {
    position: fixed; inset: 0; z-index: 99980; display: flex; flex-direction: column;
    background: rgba(10, 15, 25, .92); outline: none;
}
.rt-viewer__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; color: #e2e8f0;
}
.rt-viewer__name {
    display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; font-size: .9rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rt-viewer__name small { color: #94a3b8; font-weight: 500; }
.rt-viewer__tools { display: flex; gap: 6px; flex: 0 0 auto; }
.rt-viewer__btn, .rt-viewer__nav {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    border: none; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
}
.rt-viewer__btn:hover, .rt-viewer__nav:hover { background: rgba(255, 255, 255, .24); }
.rt-viewer__stage {
    flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px 24px;
}
.rt-viewer__stage img {
    max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
}
.rt-viewer__stage iframe { width: min(1000px, 100%); height: 100%; border: none; border-radius: 6px; background: #fff; }
.rt-viewer__spinner { width: 34px; height: 34px; color: #fff; }
.rt-viewer__msg { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #e2e8f0; text-align: center; max-width: 420px; }
.rt-viewer__msg > i { font-size: 2rem; color: #94a3b8; }
.rt-viewer__msg p { margin: 0; }
.rt-viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; }
.rt-viewer__nav--prev { left: 12px; }
.rt-viewer__nav--next { right: 12px; }

@media (max-width: 560px) {
    .rt-files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .rt-files-drop { flex-direction: column; align-items: stretch; }
    .rt-files-camera { margin: 0; justify-content: center; }
    .rt-viewer__stage { padding: 0 8px 16px; }
    .rt-viewer__nav { top: auto; bottom: 16px; transform: none; }
}
