@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   RESET Y VARIABLES
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --accent: #2563eb;
    --accent-hover: #1e40af;
    --success: #059669;
    --success-soft: #d1fae5;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --critical: #dc2626;
    --critical-soft: #fee2e2;
    --info: #0284c7;
    --info-soft: #e0f2fe;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================
   LAYOUT
   ============================================================ */
html, body { width: 100%; }

.app {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar {
    background: #1a2332;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    width: 64px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden; /* hide overflow during collapse */
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}
.sidebar:hover,
.sidebar:focus-within,
.sidebar.sidebar-expandida-persist {
    width: 240px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    overflow-y: auto;
}

/* === Brand: cuando está colapsado, ocultar texto y mostrar inicial === */
.brand {
    padding: 20px 14px;
    border-bottom: 1px solid #2d3a4f;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
}
.brand::before {
    /* Logo TRANSPORTIME blanco (sobre fondo oscuro del sidebar) */
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    background-image: url('/static/img/logo-white.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
}
.brand-texto {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.15s ease 0s, transform 0.15s ease 0s;
    min-width: 0;
}
.sidebar:hover .brand-texto,
.sidebar:focus-within .brand-texto,
.sidebar.sidebar-expandida-persist .brand-texto {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.08s;
}
.brand h1 {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    color: white;
    line-height: 1.1;
    letter-spacing: 0.3px;
}
.brand small {
    font-size: 10px;
    color: #94a3b8;
}

.nav { flex: 1; padding: 12px 0; }
.nav-item {
    display: flex;
    align-items: center;
    padding: 11px 22px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: #2d3a4f;
    color: white;
    transform: none; /* override del hover de la otra regla */
}
.nav-item.active {
    background: linear-gradient(90deg, rgba(30,64,175,0.25) 0%, rgba(30,64,175,0.05) 100%);
    color: white;
    border-left-color: #93c5fd;
}
.nav-item.active .nav-icon { color: #93c5fd; }

/* === Íconos PNG (sidebar v7): blancos en reposo, azul claro al activo === */
.nav-icon.nav-icon-img {
    /* Anulamos cualquier color heredado */
    color: inherit;
}
.nav-icon.nav-icon-img img {
    width: 22px;
    height: 22px;
    display: block;
    /* Los PNGs vienen blancos; los dejamos tal cual en reposo.
       En hover y activo aplicamos un filtro para darles tinte azul claro. */
    transition: filter 0.15s ease, opacity 0.15s ease;
    opacity: 0.92;
}
.nav-item:hover .nav-icon.nav-icon-img img {
    opacity: 1;
}
/* Ítem activo: tinte azul claro #93c5fd sobre PNG blanco.
   Filtro genera el tono azul cyan claro de la paleta del sidebar. */
.nav-item.active .nav-icon.nav-icon-img img {
    filter: brightness(0) saturate(100%) invert(82%) sepia(15%) saturate(1200%) hue-rotate(180deg) brightness(105%) contrast(95%);
    opacity: 1;
}

/* Texto del nav-item: se oculta cuando está colapsado */
.nav-item-texto {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.15s ease 0s, transform 0.15s ease 0s;
    margin-left: 12px;
    min-width: 0;
}
.sidebar:hover .nav-item-texto,
.sidebar:focus-within .nav-item-texto,
.sidebar.sidebar-expandida-persist .nav-item-texto {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.08s;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.nav-icon svg { width: 20px; height: 20px; display: block; }

/* Secciones (MAESTROS, CONTROL, etc.) — invisibles cuando está colapsado */
.nav-section {
    font-size: 10px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 22px 6px;
    margin-top: 8px;
    opacity: 0;
    height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: opacity 0.15s ease, height 0.22s ease, padding 0.22s ease;
}
.sidebar:hover .nav-section,
.sidebar:focus-within .nav-section,
.sidebar.sidebar-expandida-persist .nav-section {
    opacity: 1;
    height: auto;
    padding-top: 16px;
    padding-bottom: 6px;
    transition-delay: 0.08s;
}
/* Separador visible cuando está colapsado (en lugar de los textos) */
.nav-section::before {
    content: '';
    display: block;
    width: 32px;
    height: 1px;
    background: #2d3a4f;
    margin: 12px auto 0;
}
.sidebar:hover .nav-section::before,
.sidebar:focus-within .nav-section::before,
.sidebar.sidebar-expandida-persist .nav-section::before {
    display: none;
}

/* === Footer con usuario === */
.user-card {
    padding: 14px;
    border-top: 1px solid #2d3a4f;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.user-info {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    min-width: 0;
    flex: 1;
    margin: 0;
}
.sidebar:hover .user-info,
.sidebar:focus-within .user-info,
.sidebar.sidebar-expandida-persist .user-info {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.08s;
}
.user-info strong {
    display: block;
    font-size: 13px;
    color: white;
    text-transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-logout {
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    display: inline-block;
    padding: 6px 12px;
    background: #2d3a4f;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    flex-shrink: 0;
}
.sidebar:hover .btn-logout,
.sidebar:focus-within .btn-logout,
.sidebar.sidebar-expandida-persist .btn-logout {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.08s;
}
.btn-logout:hover { background: #475569; color: white; }

/* ============================================================
   Operaciones · Tema "Claro (SaaS)" del sidebar.
   (Va en style.css porque _base_ops.html solo carga este stylesheet.)
   Sidebar blanco con acentos azules; armoniza con el contenido claro y
   con los demás módulos. Selectores .sidebar X → ganan a las reglas base.
   ============================================================ */
.sidebar {
    background: #ffffff;
    color: #475569;
    border-right: 1px solid #e6eaf2;
}
/* En fondo claro el logo va en azul (el blanco sería invisible) */
.sidebar .brand { border-bottom-color: #eef2f7; }
.sidebar .brand::before { background-image: url('/static/img/logo-square.png'); }
.sidebar .brand h1 { color: #1e3a8f; }
.sidebar .brand small { color: #94a3b8; }

/* Píldoras redondeadas separadas de los bordes (look del Concepto 3) */
.sidebar .nav { padding: 10px 10px; }
.sidebar .nav-item {
    color: #475569;
    padding: 10px 12px;
    border-left: 0;          /* el acento del activo va por box-shadow, dentro de la píldora */
    border-radius: 10px;
}
.sidebar .nav-item:hover { background: #f1f5f9; color: #0f172a; }
.sidebar .nav-item.active {
    background: #eff4ff;
    color: #2563eb;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #2563eb;   /* franjita azul DENTRO de la píldora */
}
.sidebar .nav-item.active .nav-icon { color: #2563eb; }

/* Iconos PNG: oscurecidos en reposo, azules cuando activos */
.sidebar .nav-icon.nav-icon-img img { filter: none; opacity: 1; }   /* color #475569 horneado en el PNG (igual que el texto) */
.sidebar .nav-item:hover .nav-icon.nav-icon-img img { filter: brightness(0.55); }
.sidebar .nav-item.active .nav-icon.nav-icon-img img {
    filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(1850%) hue-rotate(213deg);
    opacity: 1;
}
.sidebar .nav-icon svg { width: 22px; height: 22px; }

.sidebar .nav-section { color: #94a3b8; padding-left: 12px; }
.sidebar .nav-section::before { background: #e6eaf2; }

.sidebar .user-card { border-top-color: #eef2f7; }
.sidebar .user-avatar { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; }
.sidebar .user-info { color: #64748b; }
.sidebar .user-info strong { color: #0f172a; }
.sidebar .btn-logout { background: #f1f5f9; color: #475569; }
.sidebar .btn-logout:hover { background: #e2e8f0; color: #0f172a; }

/* "Otros módulos": separador arriba (pie del menú); la píldora se separa
   de los bordes igual que los demás ítems */
.ops-volver-selector {
    margin-top: 6px;
    padding: 6px 10px 0;
    border-top: 1px solid #e6eaf2;
}

/* Scrollbar sutil cuando el sidebar está expandido */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

/* Botón "pin" del sidebar en tema claro (borde sutil; hover azul, no tenue) */
.sidebar .btn-pin-sidebar { color: #64748b; }
.sidebar:hover .btn-pin-sidebar,
.sidebar:focus-within .btn-pin-sidebar,
.sidebar.sidebar-expandida-persist .btn-pin-sidebar { border-color: #d6deeb; }
.sidebar .btn-pin-sidebar:hover { background: #eff4ff; color: #2563eb; border-color: #bcd0f5; }

/* ===== Tamaño del sidebar: fuente e iconos más grandes (uniforme) ===== */
.sidebar { width: 70px; }                 /* colapsado: cabe el icono más grande */
.sidebar .brand::before { width: 44px; height: 44px; }
.sidebar .brand h1 { font-size: 16px; }
.sidebar .brand small { font-size: 11px; }
.sidebar .nav-item { font-size: 15px; padding: 11px 12px; }
.sidebar .nav-icon { width: 26px; height: 26px; }
.sidebar .nav-icon.nav-icon-img img { width: 25px; height: 25px; }
.sidebar .nav-icon svg { width: 25px; height: 25px; stroke-width: 1.9; }
.sidebar .nav-section { font-size: 11px; }
.sidebar .user-avatar { width: 40px; height: 40px; font-size: 15px; }
.sidebar .user-info strong { font-size: 14px; }
.sidebar .user-cargo { font-size: 12px; }
.sidebar .role-badge { font-size: 11px; }
.sidebar .btn-logout { font-size: 13px; }

/* === Main: no se mueve cuando el sidebar expande (se superpone) === */
.main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 30px 40px;
    min-height: 100vh;
    overflow-x: auto;
    margin-left: 0;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #1a2332 0%, #2d3a4f 100%);
    margin: -30px -40px;
    padding: 30px 40px;
}
.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    width: 380px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.login-brand { text-align: center; margin-bottom: 8px; }
.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.login-logo img {
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}
.login-brand h1 { font-size: 22px; margin-bottom: 4px; }
.login-brand p { color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.login-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--muted);
}
.login-footer small { font-size: 12px; }
.login-card form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin: 12px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.login-card form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
}
.btn-full { width: 100%; margin-top: 20px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}
.page-title {
    font-size: 26px;
    font-weight: 700;
}
.page-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

/* ============================================================
   KPIs
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px 20px;
}
.kpi-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.kpi-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 6px;
    color: var(--ink);
}
.kpi-success .kpi-value { color: var(--success); }
.kpi-warning .kpi-value { color: var(--warning); }
.kpi-info .kpi-value { color: var(--info); }
.kpi-money .kpi-value { color: var(--accent); font-size: 22px; }

/* ============================================================
   CONTENT SECTION
   ============================================================ */
.content-section {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.section-header {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.section-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

/* Botón discreto "Compartir reporte" en el header de Servicios de hoy.
   Reemplaza la antigua card de acciones rápidas del dashboard. */
.btn-compartir-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: #14B8A6;
    color: white;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease;
    cursor: pointer;
    border: none;
}
.btn-compartir-header:hover {
    background: #0d9488;
    color: white;
}
.btn-compartir-header:active {
    transform: translateY(1px);
}
.btn-compartir-header svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.section-help {
    color: var(--muted);
    font-size: 12.5px;
    margin-bottom: 12px;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--bg); }
.btn-small { padding: 6px 12px; font-size: 12.5px; }

.btn-mini {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
}
.btn-mini:hover { background: var(--line); }
.btn-mini.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}
.btn-mini.btn-danger:hover { background: #fecaca; }

.btn-avanzar {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}
.btn-avanzar:hover { background: var(--accent-hover); }

/* Botón "Registrar guías" — reemplaza al → en el estado 5 */
.btn-avanzar.btn-guias {
    background: #f59e0b;  /* ámbar — destaca la acción especial */
    font-size: 13px;
}
.btn-avanzar.btn-guias:hover { background: #d97706; }

/* Botón retroceder un estado */
.btn-retroceder {
    background: white;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.btn-retroceder:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fca5a5;
}

.estado-select {
    font-size: 10px;
    padding: 2px 4px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: white;
    max-width: 28px;
    cursor: pointer;
    color: transparent;
}
.estado-select option { color: var(--ink); }

.estado-control {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.btn-expand {
    background: transparent;
    border: 1px solid var(--line);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
    transition: all 0.15s;
}
.btn-expand:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================================
   TABLAS
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--ink);
    border-bottom: 2px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.data-table tr:hover { background: #f8fafc; }
.row-inactive { opacity: 0.5; }

/* Fila resaltada cuando el servicio se descarga HOY (urgente, prioridad alta) */
.data-table tbody tr.row-descarga-hoy > td {
    background-color: #fff7ed;
    border-top: 1px solid #fed7aa;
    border-bottom: 1px solid #fed7aa;
}
.data-table tbody tr.row-descarga-hoy > td:first-child {
    border-left: 3px solid #ea580c;
}
.data-table tbody tr.row-descarga-hoy:hover > td {
    background-color: #ffedd5;
}

/* Fila completa cuando el servicio CULMINÓ — toda verde claro como "sello" */
.data-table tbody tr.row-culminado > td {
    background-color: #d1fae5;
    border-top: 1px solid #6ee7b7;
    border-bottom: 1px solid #6ee7b7;
}
.data-table tbody tr.row-culminado > td:first-child {
    border-left: 3px solid #047857;
}
.data-table tbody tr.row-culminado:hover > td {
    background-color: #a7f3d0;
}

/* Fila tenue cuando el servicio está PENDIENTE (sin placa asignada) */
.data-table tbody tr.row-pendiente > td {
    background-color: #fafafa;
}
.data-table tbody tr.row-pendiente > td:first-child {
    border-left: 3px solid #d4d4d8;
}

/* Badge "DESCARGA HOY" debajo del nombre del cliente o la fecha */
.badge-descarga-hoy {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: #ea580c;
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Banner cuando una empresa tiene rol doble (es cliente Y transportista) */
.rol-doble-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    border-left: 4px solid #6366f1;
    border-radius: 6px;
    color: #3730a3;
}
.rol-doble-icon { font-size: 24px; flex-shrink: 0; }
.rol-doble-text { font-size: 13.5px; line-height: 1.4; }
.rol-doble-text strong { color: #1e1b4b; }
.rol-doble-text a {
    color: #6366f1;
    font-weight: 600;
    text-decoration: none;
    margin-left: 6px;
}
.rol-doble-text a:hover { text-decoration: underline; }

/* Checkbox inline (debajo de un input), usado en "unidad ya llegó".
   Reglas con alta especificidad para anular .form-group input/label que aplican
   width:100%, uppercase, etc. */
.form-group label.checkbox-inline,
label.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 0;
    padding: 10px 12px;
    background: #f3f4f6;
    border-left: 3px solid #6366f1;
    border-radius: 4px;
    font-size: 12.5px;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
}
.form-group label.checkbox-inline input[type="checkbox"],
label.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin: 0;
    padding: 0;
    border: 1px solid #94a3b8;
    border-radius: 3px;
    background: white;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #6366f1;
}
.form-group label.checkbox-inline span,
label.checkbox-inline span {
    flex: 1;
    line-height: 1.4;
}
.form-group label.checkbox-inline strong,
label.checkbox-inline strong {
    color: #1e293b;
    font-weight: 600;
}

/* Estilo viejo: solo aplica fuera de la tabla v2.
   La tabla v2 usa .acciones-cell-v2 que respeta display:table-cell. */
.acciones-cell:not(.acciones-cell-v2) {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}
.acciones-cell form { margin: 0; padding: 0; }

/* Detalle expandible */
.servicio-detalle {
    background: #f8fafc !important;
}
.servicio-detalle td {
    padding: 20px !important;
}
.detalle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}
.detalle-col h4 {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 700;
}
.detalle-col div {
    font-size: 12.5px;
    margin-bottom: 3px;
}
.detalle-col-wide { grid-column: span 2; }
.detalle-col-full { grid-column: 1 / -1; }
.guias-list {
    list-style: none;
    padding: 0;
}
.guias-list li {
    padding: 4px 0;
    font-size: 12.5px;
}
.tag-identificador {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   RUTA (origen → destino) en la LISTA de servicios
   Layout vertical: cada línea (origen, destino) en su propio bloque,
   con un icono identificador a la izquierda. Los nombres largos
   se quedan dentro de su propia línea sin invadir la otra.
   IMPORTANTE: clases con prefijo `ruta-celda-` para no chocar con
   `.ruta-bloque` que se usa en el form de servicio con otro layout.
   ============================================================ */
.ruta-celda {
    font-size: 12px;
    line-height: 1.4;
    min-width: 220px;
    vertical-align: top;
}
.ruta-celda-bloque {
    /* DEPRECADO: se usaba cuando origen y destino vivían en una sola celda.
       Ahora se separan en dos columnas (.origen-celda y .destino-celda).
       Conservo la clase por si algún template viejo la referencia. */
    display: block;
}

/* ============================================================
   Origen / Destino en dos columnas separadas
   ============================================================ */
/* Headers: texto centrado sobre cada columna */
.servicios-table th.th-origen,
.servicios-table th.th-destino {
    text-align: center;
}
/* Divisor punteado vertical entre las dos columnas (sobre el borde izquierdo
   del header destino) + flecha "→" flotando justo sobre la línea, centrada
   verticalmente — así las distancias `ORIGEN ↔ → ↔ DESTINO` quedan iguales. */
.servicios-table th.th-destino {
    border-left: 0.5px dashed var(--border, #e5e7eb);
    position: relative;
}
.servicios-table th.th-destino::before {
    content: "→";
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-tabla-header, #f9fafb);
    padding: 0 4px;
    color: var(--muted, #6b7280);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}
/* Body: la celda destino también lleva el divisor punteado vertical para
   que la línea se vea continua a lo largo de toda la tabla. */
.servicios-table td.destino-celda {
    border-left: 0.5px dashed var(--border, #e5e7eb);
}
/* Estructura interna de cada celda (origen y destino): ícono + texto */
.origen-celda, .destino-celda {
    vertical-align: top;
}
.ruta-celda-linea {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
}
.ruta-celda-icono {
    flex-shrink: 0;
    font-size: 11px;
    line-height: 1.4;
    margin-top: 1px;
}
.ruta-celda-texto {
    overflow-wrap: break-word;
    word-break: normal;
    min-width: 0;
    flex: 1 1 auto;
}
.ruta-celda-texto strong {
    color: var(--ink);
    font-weight: 600;
}
.ruta-celda-localidad {
    color: var(--muted);
    font-size: 11px;
}
/* Compatibilidad con uso heredado del separador horizontal "→" */
.ruta-sep { color: var(--muted); margin: 0 4px; }

/* ============================================================
   AVISO DE BLOQUEO DE UNIDAD (cuando hay guías registradas)
   ============================================================ */
.aviso-bloqueo-unidad {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 0 0 16px 0;
    color: #78350f;
    font-size: 13px;
    line-height: 1.5;
}
.aviso-bloqueo-icono {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}
.aviso-bloqueo-unidad strong {
    color: #78350f;
    font-size: 14px;
}
.aviso-bloqueo-unidad small {
    color: #92400e;
}
.guia-celda { white-space: nowrap; }

/* ============================================================
   BADGES Y CHIPS
   ============================================================ */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.status-pendiente { background: var(--critical-soft); color: var(--critical); }

/* Estado 1: en ruta para cargar — gris neutro (la unidad va en camino) */
.status-en-ruta-para-cargar { background: #e5e7eb; color: #374151; }

/* Estados 2-3: unidad esperando a planta o en zona de carga — azul */
.status-en-espera-para-ingresar-a-cargar { background: #dbeafe; color: #1e40af; }
.status-en-zona-de-carga { background: #bfdbfe; color: #1e3a8a; }

/* Estados 4-5: cargando o esperando guías — verde claro */
.status-en-proceso-de-carga { background: #d1fae5; color: #065f46; }
.status-culmino-carga-esperando-guias { background: #a7f3d0; color: #065f46; }

/* Estados 6-10: con carga, en ruta o en zona de descarga — verde oscuro */
.status-con-guias-en-breve-sale-a-ruta { background: #047857; color: white; }
.status-en-ruta-para-descargar { background: #047857; color: white; }
.status-en-espera-para-ingresar-a-descargar { background: #065f46; color: white; }
.status-en-zona-de-descarga { background: #065f46; color: white; }
.status-en-proceso-de-descarga { background: #065f46; color: white; }

/* Estado 11: servicio culminado — verde oscuro (la fila entera se pinta de verde claro) */
.status-culmino-servicio { background: #064e3b; color: white; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-critical { background: var(--critical-soft); color: var(--critical); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--line); color: var(--muted); }

.badge-counter {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 4px;
}
.badge-counter:hover { background: var(--accent-hover); }

.badge-counter-mini {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 2px;
    vertical-align: middle;
}

.parada-detalle {
    background: white;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 12px;
}
.parada-detalle:last-child { margin-bottom: 0; }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.role-admin { background: #fee2e2; color: #991b1b; }
.role-operador, .role-operaciones { background: #dbeafe; color: #1e40af; }
.role-liquidaciones { background: #fef3c7; color: #92400e; }
.role-consulta, .role-gestion { background: #f3f4f6; color: #4b5563; }

.user-cargo {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-style: italic;
    margin-top: 2px;
}

/* ============================================================
   GUÍA INLINE — número + contador opcional + lápiz de edición
   El lápiz vive aquí (no en la columna de acciones) porque actúa
   directamente sobre los datos de esta celda.
   ============================================================ */
.guia-inline-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-editar-guias-inline {
    /* Botón compacto que se siente parte de la celda, no un elemento extra.
       En reposo tiene un fondo naranja muy suave para ser descubrible sin
       gritar visualmente. Al hacer hover se intensifica. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 4px;
    background: #fff7ed;       /* naranja apenas perceptible */
    border: 1px solid #fed7aa;
    border-radius: 5px;
    color: #9a3412;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease,
                transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-editar-guias-inline:hover {
    background: #fed7aa;
    border-color: #fb923c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(251, 146, 60, 0.25);
}
.btn-editar-guias-inline:active {
    transform: translateY(0);
    background: #fdba74;
    box-shadow: none;
}
.btn-editar-guias-inline:focus-visible {
    outline: 2px solid #fb923c;
    outline-offset: 1px;
}
.btn-editar-guias-inline .pencil-icon {
    font-size: 13px;
    display: inline-block;
    line-height: 1;
}

/* Botón legacy (por si quedó algún uso) — mantener compat */
.btn-editar-guias {
    background: #fed7aa;
    border: 1px solid #fb923c;
    color: #9a3412;
    font-weight: 700;
}
.btn-editar-guias:hover {
    background: #fdba74;
    border-color: #ea580c;
}

/* Celda placa clickeable: cursor pointer y hover sutil para indicar interacción */
.celda-clickeable {
    cursor: pointer;
    transition: background 0.15s;
}
.celda-clickeable:hover {
    background: rgba(59, 130, 246, 0.08);
}
/* Botón "+ Asignar unidad": para servicios PENDIENTE sin placa */
.btn-asignar-unidad {
    /* Estilo BASE compartido por los 3 niveles de urgencia (hoy/manana/normal).
       El color del borde y del texto lo define la variante; el formato visual
       (fondo blanco, borde dashed, "+") se mantiene igual para que el usuario
       reconozca "esto es un botón de asignar unidad" independientemente del nivel. */
    background: #fff;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1.5px dashed transparent;  /* el color lo pone la variante */
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-asignar-unidad .icono-mas {
    display: inline-block;
    line-height: 1;
}

/* Nivel 1 — carga en 2+ días: AMARILLO (pendiente normal) */
.btn-asignar-normal {
    color: #92400e;
    border-color: #f59e0b;
}
.btn-asignar-normal:hover {
    background: #fef3c7;
    border-style: solid;
}

/* Nivel 2 — carga mañana: NARANJA (priorizar pronto) */
.btn-asignar-manana {
    color: #7c2d12;
    border-color: #ea580c;
}
.btn-asignar-manana:hover {
    background: #fed7aa;
    border-style: solid;
}

/* Nivel 3 — carga HOY (o pasada): ROJO con pulso alarmante pero contenido
   - Borde dashed cambia de color (rojo intenso ↔ rojo claro)
   - Halo/anillo rojo expande y desaparece (efecto onda hacia afuera)
   - El "+" se contrae/expande con más amplitud
   - El texto y el fondo quedan estables: legible, no marea
   - Ritmo más rápido (1.1s) para transmitir urgencia */
.btn-asignar-hoy {
    color: #991b1b;
    border-color: #dc2626;
    animation: pulse-borde-asignar 1.1s ease-in-out infinite;
}
.btn-asignar-hoy:hover {
    background: #fee2e2;
    animation-play-state: paused;  /* al pasar el mouse, deja de pulsar */
}
.btn-asignar-hoy .icono-mas {
    animation: pulse-mas-asignar 1.1s ease-in-out infinite;
    font-weight: 700;
}
@keyframes pulse-borde-asignar {
    0%, 100% {
        border-color: #dc2626;
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55);
    }
    50% {
        border-color: #fecaca;
        box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
    }
}
@keyframes pulse-mas-asignar {
    0%, 100% { transform: scale(1);    opacity: 1;   }
    50%      { transform: scale(1.35); opacity: 0.5; }
}

/* Accesibilidad: si el usuario activó "reducir movimiento" en su SO,
   no animamos. El color rojo basta para indicar urgencia. */
@media (prefers-reduced-motion: reduce) {
    .btn-asignar-hoy,
    .btn-asignar-hoy .icono-mas {
        animation: none;
    }
}

/* ============================================================ */
/* CHIPS DE FECHA RÁPIDA — UX moderna para Fecha de Carga       */
/* El usuario selecciona con UN click entre HOY..HOY+4 días.     */
/* ============================================================ */
.fecha-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    margin-bottom: 4px;
}
.fecha-chip {
    flex: 1 1 80px;
    min-width: 70px;
    max-width: 130px;
    padding: 9px 6px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: inherit;
    color: var(--text);
}
.fecha-chip:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.fecha-chip .chip-titulo {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--muted);
    text-transform: uppercase;
}
.fecha-chip .chip-fecha {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
}
.fecha-chip.seleccionado {
    border-color: #2563eb;
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.fecha-chip.seleccionado .chip-titulo {
    color: rgba(255, 255, 255, 0.9);
}
.fecha-chip.seleccionado .chip-fecha {
    color: white;
}
.fecha-chip.fecha-chip-hoy:not(.seleccionado) {
    border-color: #f59e0b;
    background: #fffbeb;
}
.fecha-chip.fecha-chip-hoy:not(.seleccionado) .chip-titulo {
    color: #b45309;
}

/* Chips especiales de DESCARGA */
.fecha-chip.chip-mismo-dia:not(.seleccionado) {
    border-color: #3b82f6;
    background: #eff6ff;
}
.fecha-chip.chip-mismo-dia:not(.seleccionado) .chip-titulo {
    color: #1d4ed8;
}
.fecha-chip.chip-sig-dia:not(.seleccionado) {
    border-color: #f59e0b;
    background: #fffbeb;
}
.fecha-chip.chip-sig-dia:not(.seleccionado) .chip-titulo {
    color: #b45309;
}
.fecha-chip.chip-otra-fecha {
    border-style: dashed;
    border-color: #9ca3af;
    background: #f9fafb;
}
.fecha-chip.chip-otra-fecha:not(.seleccionado) .chip-titulo {
    color: #6b7280;
}

/* ============================================================ */
/* FORMULARIO DE SERVICIO V2 — Pasos numerados                   */
/* ============================================================ */
.servicio-form-v2 .form-step {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s;
}
.servicio-form-v2 .form-step:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.step-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f3f4f6;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.step-header h3 {
    margin: 0;
    font-size: 17px;
    color: var(--text);
    font-weight: 600;
}
.step-sub {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
}

/* Bloque de fechas (Paso 2) */
.fechas-bloque {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.fecha-bloque {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fecha-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-transform: uppercase;
    margin: 0;
}
.descarga-help {
    margin-top: 6px;
    line-height: 1.5;
    font-size: 11px;
}
@media (max-width: 900px) {
    .fechas-bloque {
        grid-template-columns: 1fr;
    }
}

/* Bloque de ruta — origen → destino lado a lado */
.ruta-bloque {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    gap: 16px;
    align-items: start;
}
.ruta-col {
    background: #f9fafb;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #f3f4f6;
}
.ruta-col-titulo {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.3px;
}
.ruta-flecha-grande {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #3b82f6;
    font-weight: 300;
    padding-top: 40px;
}
@media (max-width: 900px) {
    .ruta-bloque {
        grid-template-columns: 1fr;
    }
    .ruta-flecha-grande {
        transform: rotate(90deg);
        padding: 0;
    }
}

/* Botón submit prominente */
.btn-large {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
}

/* Barra de acciones pegada al final */
.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 14px 20px;
    border-top: 2px solid #e5e7eb;
    margin: 16px -1px 0;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
    z-index: 10;
}

/* Inputs de fecha bloqueados para escritura: el usuario solo puede usar el calendario.
   Se ven exactamente como un input normal, pero el cursor es pointer para indicar
   que son clickeables. Hover sutil para reforzar la afordancia visual. */
input.fecha-bloqueada {
    cursor: pointer;
    caret-color: transparent;  /* oculta el cursor de texto al hacer focus */
}
input.fecha-bloqueada:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
input.fecha-bloqueada:focus {
    cursor: pointer;
    caret-color: transparent;
}
/* Selección invisible (no se puede seleccionar texto manualmente) */
input.fecha-bloqueada::selection {
    background: transparent;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
}
.tag-tipo { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.tag-propia { color: var(--success); font-weight: 700; }
.tag-tercero { color: var(--warning); font-weight: 700; }

code, .placa {
    font-family: 'Courier New', monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

/* Color de placa según el estado del servicio (la unidad la va siguiendo) */
.placa-neutral-sinplaca,
.placa-neutral { background: #f1f5f9; color: #1e293b; }
/* Azul: unidad llegó / en espera de cargar */
.placa-azul {
    background: #2563eb;
    color: white;
    border: 1px solid #1d4ed8;
}
/* Verde claro: cargando o esperando guías */
.placa-verde-claro {
    background: #10b981;
    color: white;
    border: 1px solid #059669;
}
/* Verde oscuro: ya cargó y/o está en proceso de descarga */
.placa-verde-oscuro {
    background: #047857;
    color: white;
    border: 1px solid #064e3b;
}
/* Servicio culminado: la placa queda en verde más oscuro */
.placa-completo {
    background: #064e3b;
    color: white;
    border: 1px solid #022c22;
}
.placa-sub {
    font-family: 'Courier New', monospace;
    background: #f8fafc;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    color: var(--muted);
}

/* ============================================================
   CONJUNTO TRACTO + CARRETA
   Diseño que evoca el camión físico: el tracto (con color de
   estado) jala a la carreta a su derecha, conectados por un
   pequeño enganche visual. Bajo ambos puede ir el conductor.
   ============================================================ */
.placa-conjunto {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-bottom: 4px;
    /* Permite que las dos placas se sienten como un todo y no se
       partan a líneas distintas en pantallas estrechas. */
    white-space: nowrap;
}

.placa-carreta {
    /* Carreta: misma forma que la placa principal pero más sutil,
       para que el ojo identifique al tracto como el "principal" y
       la carreta como su acompañante. */
    font-family: 'Courier New', monospace;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    line-height: 1.4;
}

/* Enganche visual entre tracto y carreta: un pequeño guion grueso
   que sugiere físicamente "estos dos están unidos". */
.placa-conector {
    display: inline-block;
    width: 8px;
    height: 2px;
    background: #94a3b8;
    margin: 0 3px;
    border-radius: 1px;
    vertical-align: middle;
}

/* Cuando el tracto está coloreado (verde, azul), el conector toma
   un tono compatible para no romper visualmente. */
.placa-conjunto .placa-azul + .placa-conector { background: #93c5fd; }
.placa-conjunto .placa-verde-claro + .placa-conector { background: #6ee7b7; }
.placa-conjunto .placa-verde-oscuro + .placa-conector,
.placa-conjunto .placa-completo + .placa-conector { background: #34d399; }

/* Nombre del conductor en celda compacta (debajo de las placas).
   Display:block para que siempre quede en su propia línea sin
   depender de <br> en el HTML. */
.conductor-mini {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.3;
}

/* ETA prominente cuando la unidad está EN RUTA PARA CARGAR.
   Importante visualmente porque indica cuándo llegará a planta. */
.eta-badge-prominente {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: 0.3px;
    transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* NIVEL 1 — POR VENCER (5 min antes del ETA): naranja claro, pulso suave.
   Alerta: "atención, la unidad debería estar llegando pronto". */
.eta-badge-prominente.eta-por-vencer {
    background: #fed7aa;
    color: #9a3412;
    border-color: #fb923c;
    animation: eta-pulso-suave 2.5s ease-in-out infinite;
}
@keyframes eta-pulso-suave {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.4); }
    50%      { box-shadow: 0 0 0 4px rgba(251, 146, 60, 0); }
}

/* NIVEL 2 — RECIÉN ATRASADO (0–10 min después del ETA): rojo claro, pulso medio.
   Alerta: "la unidad ya debería haber llegado". */
.eta-badge-prominente.eta-atrasado-leve {
    background: #fecaca;
    color: #991b1b;
    border-color: #ef4444;
    animation: eta-pulso-medio 1.8s ease-in-out infinite;
}
@keyframes eta-pulso-medio {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* NIVEL 3 — ATRASADO (10–30 min después del ETA): rojo intenso, pulso más rápido. */
.eta-badge-prominente.eta-atrasado {
    background: #fca5a5;
    color: #7f1d1d;
    border-color: #dc2626;
    border-width: 2px;
    animation: eta-pulso-fuerte 1.3s ease-in-out infinite;
}
@keyframes eta-pulso-fuerte {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.65); }
    50%      { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* NIVEL 4 — MUY ATRASADO (más de 30 min): rojo oscuro, pulso urgente y vibración suave.
   Imposible de ignorar: la unidad está significativamente atrasada. */
.eta-badge-prominente.eta-muy-atrasado {
    background: #dc2626;
    color: white;
    border-color: #7f1d1d;
    border-width: 2px;
    animation: eta-pulso-urgente 0.9s ease-in-out infinite, eta-vibrar 4s ease-in-out infinite;
}
@keyframes eta-pulso-urgente {
    0%, 100% { box-shadow: 0 0 0 0 rgba(127, 29, 29, 0.8); }
    50%      { box-shadow: 0 0 0 10px rgba(127, 29, 29, 0); }
}
@keyframes eta-vibrar {
    0%, 90%, 100% { transform: translateX(0); }
    92%           { transform: translateX(-1.5px); }
    94%           { transform: translateX(1.5px); }
    96%           { transform: translateX(-1.5px); }
    98%           { transform: translateX(1.5px); }
}

.filter-chip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: 12.5px;
    text-decoration: none;
    transition: all 0.15s;
}
.filter-chip:hover { background: var(--bg); }
.filter-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-card, .servicio-form {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.form-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px dashed var(--line);
}
.form-section:last-of-type { border-bottom: none; padding-bottom: 0; }
.form-section h3 {
    font-size: 14px;
    color: var(--ink);
    margin-bottom: 14px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.form-group { display: flex; flex-direction: column; }
.form-group-wide { grid-column: span 2; }
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-group input, .form-group select, .form-group textarea, .servicio-form textarea {
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 13.5px;
    background: white;
    width: 100%;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
.form-group small, .info-muted {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}
.required { color: var(--critical); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Radio cards (selección de tipo) */
.radio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.radio-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}
.radio-card:hover {
    border-color: var(--accent);
    background: #f8fafc;
}
.radio-card input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent);
    transform: scale(1.2);
}
.radio-card input[type="radio"]:checked ~ .radio-card-body .radio-card-title {
    color: var(--accent);
}
.radio-card:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: #eff6ff;
}
.radio-card-body { flex: 1; }
.radio-card-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}
.radio-card-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

/* Info box (avisos informativos) */
.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--accent);
    border-radius: 6px;
    padding: 14px 18px;
}
.info-box strong {
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}
.info-box p {
    font-size: 13px;
    color: var(--ink);
    margin: 0;
}
.info-box a {
    color: var(--accent);
    text-decoration: underline;
}
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.checkbox-item:hover { background: var(--bg); }
.checkbox-item input { margin-top: 3px; }
.checkbox-item small { color: var(--muted); font-size: 11px; }
.checkbox-item-simple {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.guia-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.guia-row input { flex: 1; }
.guia-row .btn-quitar {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.guia-row .btn-quitar:hover { background: #fee2e2; }

.parada-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.parada-row select { flex: 2; }
.parada-row .parada-tn { flex: 1; max-width: 180px; }

.sede-form-inline {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
}
.sede-form-inline h4 {
    font-size: 13px;
    margin-bottom: 12px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================================
   FILTROS
   ============================================================ */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 16px;
}
.filter-group { display: flex; flex-direction: column; }
.filter-group label {
    font-size: 10.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}
.filter-group input, .filter-group select {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 13px;
}
.filter-actions { display: flex; gap: 6px; }

/* ============================================================
   POPUP DE GUÍAS
   ============================================================ */
.guias-popup {
    position: absolute;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    padding: 12px;
    z-index: 1000;
    min-width: 200px;
}
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}
.popup-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}
.guias-popup ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.guias-popup li {
    padding: 4px 0;
    font-size: 13px;
}

/* ============================================================
   INSTRUCCIONES Y RESUMEN
   ============================================================ */
.instructions-card {
    background: #fff8e1;
    border: 1px solid #ffd54f;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.instructions-card h3 {
    margin-bottom: 12px;
    font-size: 14px;
    color: #5d4037;
}
.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.instr-step {
    display: flex;
    gap: 10px;
    background: white;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #ffe9a8;
}
.instr-num {
    flex-shrink: 0;
    width: 24px; height: 24px;
    background: #f57c00;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}
.instr-text { font-size: 12px; }
.instructions-alt {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #ffd54f;
    font-size: 11.5px;
    text-align: center;
}
.resumen-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.resumen-imagen-wrapper {
    text-align: center;
    background: #f1f5f9;
    padding: 20px;
    border-radius: 8px;
}
.resumen-imagen {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ============================================================
   FLASH
   ============================================================ */
/* Flash messages: ahora son toasts flotantes en la esquina superior derecha.
   Ya NO empujan el contenido ni desplazan el scroll, no hacen perder al usuario
   su posición. Se auto-cierran o pueden cerrarse manualmente. */
.flash-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    pointer-events: none;
}
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 4px solid;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    background: white;
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    padding-right: 36px;
    animation: flash-slide-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1.4;
    transition: opacity 0.3s, transform 0.3s;
}
@keyframes flash-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.flash::after {
    content: '✕';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.flash:hover::after { opacity: 1; }
.flash.flash-cerrando {
    opacity: 0;
    transform: translateX(100%);
}
.flash-success { background: #f0fdf4; color: #166534; border-color: #22c55e; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #dc2626; }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.flash-info { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }

.role-info {
    background: #f1f5f9;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 12.5px;
}
.role-info div { padding: 3px 0; }

.empty-state, .empty-state-small {
    text-align: center;
    padding: 30px;
    color: var(--muted);
}
.empty-state-small { padding: 16px; }
.empty-state p { margin-bottom: 12px; }
.muted { color: var(--muted); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .app { flex-direction: column; }
    .sidebar {
        position: relative;
        height: auto;
        width: 100%;
        flex-direction: row;
        padding: 12px;
        overflow-x: auto;
    }
    .main { padding: 20px; }
    .nav { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group-wide { grid-column: span 1; }
}

/* ============================================================
   TIPO CARDS (selección visual con imagen)
   ============================================================ */
.tipo-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.tipo-card {
    cursor: pointer;
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 14px 10px;
    background: white;
    text-align: center;
    transition: all 0.15s;
    position: relative;
}
.tipo-card:hover {
    border-color: var(--accent);
    background: #f8fafc;
}
.tipo-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.tipo-card:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: #eff6ff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}
.tipo-card-body img {
    height: 56px;
    width: auto;
    max-width: 100%;
    margin-bottom: 8px;
    pointer-events: none;
}
.tipo-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.tipo-card:has(input[type="radio"]:checked) .tipo-card-label {
    color: var(--accent);
}

@media (max-width: 700px) {
    .tipo-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Tag con imagen pequeña (tablas) */
.tag-tipo-img {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 3px;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}
.tag-tipo-img img {
    height: 24px;
    width: auto;
    border-radius: 4px;
}

/* ============================================================
   PARADAS CON CASCADA (Cliente → Sede → Localidad)
   ============================================================ */
.parada-row-cascada {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: stretch;
}
.parada-fields {
    display: grid;
    grid-template-columns: 1.4fr 1.4fr 0.7fr;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
/* Si no hay campo TN (típicamente destino), repartir en 2 columnas iguales */
.parada-fields:not(:has(.parada-tn)) {
    grid-template-columns: 1fr 1fr;
}
.parada-fields select, .parada-fields input {
    min-width: 0;  /* permite que se compriman */
    width: 100%;
}
.parada-row-cascada .btn-mini {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 0 12px;
}

@media (max-width: 900px) {
    .parada-fields,
    .parada-fields:not(:has(.parada-tn)) {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   SEDES: edición inline
   ============================================================ */
.sede-edit-row {
    background: #fffbeb !important;
}
.sede-edit-row td {
    padding: 14px 16px !important;
}
.sede-edit-form .form-grid {
    margin-bottom: 0;
}

/* ============================================================
   Choices.js: ajustes para combinar con el estilo de la app
   ============================================================ */
.choices {
    margin-bottom: 0;
}
.choices__inner {
    background: white;
    border: 1px solid var(--line) !important;
    border-radius: 6px !important;
    min-height: 38px !important;
    padding: 6px 10px !important;
    font-size: 14px;
}
.choices[data-type*="select-one"] .choices__inner {
    padding: 6px 10px !important;
}
.choices__list--single {
    padding: 0 16px 0 0 !important;
}
.choices__list--dropdown {
    border: 1px solid var(--line) !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-top: 2px;
    z-index: 100;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: #eff6ff !important;
}
.choices__input {
    background: white !important;
    padding: 6px 10px;
    font-size: 14px;
}
.choices.is-focused .choices__inner,
.choices.is-open .choices__inner {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
/* En filas de paradas, ajustar altura para que coincida con inputs */
.parada-row-cascada .choices {
    width: 100%;
}
.parada-row-cascada .choices__inner {
    min-height: 38px !important;
}

/* ============================================================
   SEDES Y LOCALIDADES: tarjetas con localidades anidadas
   ============================================================ */
.sedes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.sede-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}
.sede-card-inactiva {
    opacity: 0.6;
}
.sede-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 10px;
}
.sede-card-titulo {
    font-size: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.sede-card-acciones {
    display: flex;
    gap: 4px;
}
.sede-edit-inline {
    display: flex;
    gap: 6px;
    width: 100%;
    align-items: center;
}
.sede-edit-inline input { flex: 1; }

.localidades-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 30px;
    margin-bottom: 10px;
}
.localidad-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    background: #f8fafc;
    font-size: 14px;
}
.localidad-row:hover {
    background: #f1f5f9;
}
.localidad-inactiva {
    opacity: 0.5;
    text-decoration: line-through;
}
.localidad-icon {
    font-size: 12px;
    opacity: 0.6;
}
.localidad-nombre {
    flex: 1;
    color: var(--ink);
}
.localidad-acciones {
    display: flex;
    gap: 2px;
}
.btn-mini-icon {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--muted);
}
.btn-mini-icon:hover {
    background: white;
    color: var(--ink);
}
.btn-mini-icon.btn-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}
.localidad-edit {
    background: #fffbeb !important;
}
.localidad-edit-inline {
    display: flex;
    gap: 4px;
    width: 100%;
    align-items: center;
}
.localidad-edit-inline input {
    flex: 1;
    padding: 4px 8px;
    font-size: 14px;
}
.localidad-nueva-inline {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
}
.localidad-nueva-inline input {
    flex: 1;
    padding: 6px 10px;
    font-size: 13px;
}
.empty-localidades {
    color: var(--muted);
    font-style: italic;
    font-size: 13px;
    padding: 6px 0;
}

/* ============================================================
   MODAL DE CREACIÓN RÁPIDA
   ============================================================ */
.quick-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.quick-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}
.quick-modal-dialog {
    position: relative;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
    overflow: hidden;
}
.quick-modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #f8fafc, white);
}
.quick-modal-header h3 {
    margin: 0;
    font-size: 17px;
    color: var(--ink);
}
.quick-modal-close {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--muted);
}
.quick-modal-close:hover {
    background: #f1f5f9;
    color: var(--ink);
}
.quick-modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}
.quick-modal-body .form-group {
    margin-bottom: 14px;
}
.quick-modal-body .form-group:last-child {
    margin-bottom: 0;
}
.quick-modal-body label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}
.quick-modal-body input[type="text"],
.quick-modal-body select,
.quick-modal-body textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
}
.quick-modal-body input:focus,
.quick-modal-body select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.quick-modal-body small.muted {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}
.quick-modal-body .form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.quick-modal-body .modal-context {
    background: #eff6ff;
    color: #1e40af;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin: 0 0 16px 0;
}
.quick-modal-body .checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: normal !important;
    color: var(--ink) !important;
    cursor: pointer;
}
.quick-modal-body .checkbox-label input {
    width: auto !important;
}
.quick-modal-error {
    margin: 0 22px 14px 22px;
    padding: 10px 12px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    font-size: 13px;
}
.quick-modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.quick-modal-footer .btn-primary,
.quick-modal-footer .btn-secondary {
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
}

/* Botón "+ Nuevo" pegado al lado del dropdown */
.input-with-add {
    display: flex;
    gap: 6px;
    align-items: stretch;
}
.input-with-add > *:first-child {
    flex: 1;
    min-width: 0;
}
.btn-add-new {
    flex-shrink: 0;
    padding: 0 12px;
    background: white;
    border: 1px dashed var(--accent);
    color: var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
}
.btn-add-new:hover {
    background: var(--accent);
    color: white;
    border-style: solid;
}

/* Botón "+ Crear" en filas de paradas */
.btn-add-row {
    background: white;
    border: 1px dashed var(--accent);
    color: var(--accent);
}
.btn-add-row:hover {
    background: var(--accent);
    color: white;
    border-style: solid;
}

/* ============================================================
   FILTROS: tabs + buscador en listas grandes
   ============================================================ */
.filtros-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filtros-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tab-btn {
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}
.tab-btn:hover {
    background: #f8fafc;
    color: var(--ink);
}
.tab-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.tab-count {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    min-width: 22px;
    text-align: center;
    font-weight: 700;
}
.tab-btn.active .tab-count {
    background: rgba(255,255,255,0.25);
    color: white;
}
.filtros-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 320px;
}
.filtros-search input[type="search"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
}
.filtros-search input[type="search"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 800px) {
    .filtros-bar { flex-direction: column; align-items: stretch; }
    .filtros-search { flex: 1; }
}

/* ============================================================
   CONTACTOS DE LA EMPRESA
   ============================================================ */
.contactos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.contacto-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    padding: 12px 14px;
}
.contacto-card-inactivo { opacity: 0.5; }
.contacto-card-view {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.contacto-card-body { flex: 1; min-width: 0; }
.contacto-nombre {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.contacto-cargo {
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
}
.contacto-telefono {
    color: var(--ink);
    font-size: 14px;
    margin-top: 4px;
}
.contacto-card-acciones {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.contacto-card-edit {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.contacto-card-edit input[type="text"] {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 14px;
}

/* ============================================================
   CONTACTO Y ETA EN FILA DE SERVICIO
   ============================================================ */
.contacto-en-fila {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.4;
}
.contacto-en-fila .tel-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    white-space: nowrap;
}
.contacto-en-fila .tel-link:hover { text-decoration: underline; }

.eta-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
}

/* ============================================================
   CONTACTO: campos adicionales
   ============================================================ */
.contacto-linea {
    color: var(--accent);
    font-weight: 600;
    font-style: normal;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.contacto-correo {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
    word-break: break-all;
}
.contacto-correo a {
    color: var(--accent);
    text-decoration: none;
}
.contacto-correo a:hover { text-decoration: underline; }

/* Input de teléfono: monospace para que los grupos sean parejos */
input.input-telefono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    letter-spacing: 1px;
}

/* ============================================================
   INPUTS QUE SE GUARDAN EN MAYÚSCULAS (placas, nombres, etc.)
   Visualmente refuerzan la regla "siempre mayúsculas".
   ============================================================ */
input[name="placa"],
input[name="nombre"],
input[name="nombre_completo"],
input[name="cargo"],
input[name="linea_negocio"],
input[name="ruc"],
input[name="dni"],
input[name="marca"],
input[name="responsable"],
input[name="etiqueta_detalle_servicio"],
input[name="guia_remision_remitente"],
input[name="detalle_cliente"],
input[name="localidad_inicial"],
input[name^="origen_localidad_"],
input[name^="destino_localidad_"],
input[name^="guia_"]:not([name^="guia_remision"]) {
    text-transform: uppercase;
}
/* Excepción: correos NO se transforman */
input[name="correo"],
input[type="email"] {
    text-transform: none !important;
}

/* ============================================================
   CONDUCTOR FORM: 2 columnas
   ============================================================ */
.conductor-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.conductor-two-cols .conductor-col {
    margin: 0;  /* Sin margin entre secciones, ya hay gap del grid */
}
@media (max-width: 900px) {
    .conductor-two-cols {
        grid-template-columns: 1fr;
    }
}

/* Grid inline para fechas (3-4 columnas pequeñas) */
.form-grid-inline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (max-width: 600px) {
    .form-grid-inline {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   CONDUCTOR FORM: layouts especializados
   ============================================================ */

/* Grid para tipo documento + número (proporcional 1:3) */
.form-grid-doc {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.form-grid-doc .form-group { margin-bottom: 0; }

/* Grid 2x2 para vigencias (con buena separación) */
.vigencias-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 8px;
}
.vigencias-block h4 {
    margin: 0 0 14px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}
.form-grid-vigencias {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    margin-bottom: 8px;
}
.form-grid-vigencias .form-group { margin-bottom: 0; }
.form-grid-vigencias label {
    font-size: 12px;  /* algo más pequeño para que no se vea apretado */
}

@media (max-width: 700px) {
    .form-grid-doc { grid-template-columns: 1fr; }
    .form-grid-vigencias { grid-template-columns: 1fr; }
}

/* ============================================================
   COORDINADOR: tarjeta de detalles
   ============================================================ */
.coord-detalle {
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.coord-detalle-header {
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.coord-detalle-icon {
    font-size: 18px;
}
.coord-detalle-header strong {
    font-size: 14px;
    color: #1e293b;
    letter-spacing: 0.2px;
}
.coord-detalle-body {
    padding: 10px 14px;
}
.coord-detalle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
}
.coord-detalle-row + .coord-detalle-row {
    border-top: 1px dashed #e2e8f0;
}
.coord-detalle-lbl {
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    min-width: 90px;
}
.coord-detalle-val {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    word-break: break-all;
}
.coord-detalle-val:hover {
    text-decoration: underline;
}

/* ============================================================
   TRANSPORTISTA: rediseño del editor
   ============================================================ */

/* Badge de flota junto al título */
.badge-flota {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 12px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}
.badge-flota-propia {
    background: #d1fae5;
    color: #047857;
    border: 1px solid #10b981;
}
.badge-flota-tercero {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

/* Stats row arriba del editor */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.stat-icon {
    font-size: 26px;
    line-height: 1;
}
.stat-content {
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
}
.stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 2px;
}
@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .stats-row { grid-template-columns: 1fr; }
}

/* Título de sección dentro de form-card (sin línea inferior pesada) */
.card-section-title {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

/* Checkbox como tarjeta (para Tipo flota y Estado) */
.checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 0;
    min-height: 76px;
}
.checkbox-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
/* Anular el width:100% global del input para los checkboxes de las tarjetas */
.checkbox-card input[type="checkbox"],
.form-group .checkbox-card input[type="checkbox"] {
    width: 18px !important;
    height: 18px;
    margin: 2px 0 0 0;
    padding: 0;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}
.checkbox-card span {
    flex: 1;
    min-width: 0;          /* permite que el texto se ajuste sin desbordar */
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.checkbox-card span small {
    color: #64748b;
    font-size: 11.5px;
    display: block;
    margin-top: 4px;
}
.checkbox-card:has(input:checked) {
    background: #eff6ff;
    border-color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

/* Encabezado de sección con título + acción a la derecha */
.section-header-rich {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.section-header-rich h2 {
    margin: 0 0 4px 0;
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
}
.section-header-rich small {
    color: #64748b;
    font-size: 12.5px;
    text-transform: none;
    letter-spacing: 0;
}

/* Tabla compacta para flotas grandes */
.compact-table th, .compact-table td {
    padding: 8px 10px !important;
    font-size: 13px;
}
.compact-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* "Agregar" como bloque colapsable (oculto por defecto) */
.add-block-collapsible {
    margin-top: 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}
.add-block-collapsible summary {
    cursor: pointer;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
    list-style: none;
    user-select: none;
}
.add-block-collapsible summary::-webkit-details-marker { display: none; }
.add-block-collapsible summary:hover { background: #f1f5f9; border-radius: 8px; }
.add-block-collapsible[open] summary {
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
}
.add-block-collapsible .sede-form-inline {
    border: none;
    background: transparent;
    margin: 0;
    padding: 16px;
}

/* ============================================================
   PESTAÑAS (Transportista)
   ============================================================ */
.tabs-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}
.tabs-nav {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 6px;
    gap: 2px;
    overflow-x: auto;
}
.tab-btn {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    transition: all 0.15s ease;
    border-radius: 0;
    white-space: nowrap;
    user-select: none;
}
.tab-btn:hover {
    color: #1e293b;
    background: #f1f5f9;
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: #ffffff;
    font-weight: 600;
}
.tab-icon { font-size: 16px; }
.tab-label { font-size: 14px; }
.tab-count {
    background: #e2e8f0;
    color: #475569;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}
.tab-btn.active .tab-count {
    background: #dbeafe;
    color: var(--accent);
}

/* Paneles */
.tab-panel {
    display: none;
    padding: 20px 24px;
    animation: fadeIn 0.15s ease;
}
.tab-panel.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Toolbar superior del panel: descripción a la izquierda, botón a la derecha */
.tab-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.tab-panel-help {
    margin: 0 0 16px 0;
    color: #64748b;
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.5;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.tab-panel-toolbar .tab-panel-help {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
}

/* ============================================================
   CHIPS DE FILTRO (Unidades/Conductores dentro de Transportista)
   ============================================================ */
.chips-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.chip-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.12s ease;
    user-select: none;
    white-space: nowrap;
}
.chip-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}
.chip-btn.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.chip-count {
    background: #e2e8f0;
    color: #475569;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}
.chip-btn.active .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ============================================================
   CHIPS JERÁRQUICOS + ALERTAS CONSOLIDADAS
   ============================================================ */

/* Chip padre con caret cuando está abierto */
.chip-caret {
    margin-left: 4px;
    font-size: 9px;
    opacity: 0.7;
    transition: transform 0.15s ease;
    display: inline-block;
}
.chip-parent.chip-parent-open .chip-caret {
    transform: rotate(180deg);
}
.chip-parent.chip-parent-open:not(.active) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--accent);
}

/* Wrapper de chips: contiene la fila principal + la sub-fila */
.chips-filter-wrapper {
    margin-bottom: 14px;
}
.chips-filter-wrapper .chips-filter {
    margin-bottom: 0;
}

/* Sub-fila de chips hijos (aparece DEBAJO del chip padre) */
.chips-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 0 4px 18px;
    position: relative;
    flex-wrap: wrap;
    animation: subchipsFadeIn 0.15s ease;
}
@keyframes subchipsFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Línea de árbol que conecta visualmente con el chip padre */
.chips-sub-tree {
    position: absolute;
    left: 0;
    top: -4px;
    bottom: 12px;
    width: 14px;
    border-left: 2px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
    border-bottom-left-radius: 8px;
    pointer-events: none;
}

/* Chip hijo (visualmente más sutil, borde punteado) */
.chip-child {
    background: #ffffff;
    border-style: dashed;
    border-color: #94a3b8;
    font-size: 12.5px;
    padding: 5px 12px;
}
.chip-child:hover {
    background: #f8fafc;
    border-style: solid;
    border-color: #64748b;
    color: #1e293b;
}
.chip-child.active {
    background: var(--accent);
    border-style: solid;
    border-color: var(--accent);
    color: #ffffff;
}
.chip-child .chip-count {
    background: #e2e8f0;
}
.chip-child.active .chip-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Tag de alerta dentro de la columna 'Alertas' */
.alerta-tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alerta-tag-critica {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.alerta-tag-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

/* ============================================================
   POPOVER (mini-panel flotante anclado)
   ============================================================ */

/* Badge clickeable (los que abren el popover) */
.badge-clickable {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
    background: #dbeafe;
    color: #1e40af;
    font-family: inherit;
}
.badge-clickable:hover {
    background: #bfdbfe;
    border-color: #60a5fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}
.badge-clickable.popover-anchor-active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Popover */
.popover {
    position: absolute;
    z-index: 1000;
    min-width: 280px;
    max-width: 400px;
    max-height: 420px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18),
                0 4px 12px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: popoverFadeIn 0.12s ease;
}
@keyframes popoverFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    gap: 8px;
}
.popover-header > span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.popover-close {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    color: #64748b;
    font-size: 13px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.popover-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.popover-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    min-height: 40px;
}
.popover-loading,
.popover-empty {
    padding: 16px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

.popover-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.popover-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}
.popover-item:last-child {
    border-bottom: none;
}
.popover-item-main {
    flex: 1;
    min-width: 0;
}
.popover-item-main strong {
    font-weight: 600;
    color: #1e293b;
}
.popover-item-side {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.popover-sub {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.4;
}
.popover-tipo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #475569;
    margin-left: 6px;
}

.placa-mini {
    background: #1e293b;
    color: #fbbf24;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Contacto principal destacado */
.popover-contact-principal {
    background: #fffbeb;
}
.popover-star {
    color: #f59e0b;
    margin-right: 4px;
}

.popover-footer {
    padding: 8px 14px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 12.5px;
}
.popover-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.popover-footer a:hover {
    text-decoration: underline;
}

/* ============================================================
   CHIPS DE TIPO DE UNIDAD (en listado de Transportistas)
   ============================================================ */
.unidades-tipos {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.tipo-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 5px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
}
.tipo-chip img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    pointer-events: none;
}
.tipo-chip-count {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    min-width: 14px;
    text-align: center;
}
.tipo-chip:hover {
    background: #f0f9ff;
    border-color: #60a5fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.12);
}
.tipo-chip.popover-anchor-active {
    background: var(--accent);
    border-color: var(--accent);
}
.tipo-chip.popover-anchor-active .tipo-chip-count {
    color: #ffffff;
}

/* Stack vertical de tags de alerta (cuando hay vencidos Y por vencer simultáneos) */
.alerta-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}
.alerta-stack .alerta-tag {
    max-width: 100%;
}

/* Destello al volver a una sección/tarjeta tras una acción (scroll-to-anchor) */
@keyframes flashHighlight {
    0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); border-color: var(--line, #e2e8f0); }
    20%  { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.30); border-color: var(--accent); background: #eff6ff; }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); border-color: var(--line, #e2e8f0); }
}
.flash-highlight {
    animation: flashHighlight 1.4s ease-out;
}

/* Scroll con margen superior para no quedar pegado al header al hacer scrollIntoView */
[id^="planta-"], #plantas, #contactos {
    scroll-margin-top: 16px;
}

/* ============================================================
   TOASTS (notificaciones flotantes arriba-derecha)
   ============================================================ */
#toasts-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    border-radius: 8px;
    padding: 11px 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14),
                0 2px 6px rgba(15, 23, 42, 0.06);
    min-width: 260px;
    max-width: 420px;
    font-size: 13.5px;
    color: #1e293b;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.toast-visible {
    transform: translateX(0);
    opacity: 1;
}
.toast-leaving {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
}
.toast-success { border-left-color: #16a34a; }
.toast-success .toast-icon { background: #16a34a; }

.toast-error { border-left-color: #dc2626; }
.toast-error .toast-icon { background: #dc2626; }

.toast-warning { border-left-color: #f59e0b; }
.toast-warning .toast-icon { background: #f59e0b; }

.toast-info { border-left-color: #2563eb; }
.toast-info .toast-icon { background: #2563eb; }

.toast-message {
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}
.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
}
.toast-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Input con error (validación AJAX inline) */
.input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18) !important;
    animation: shakeError 0.4s ease;
}
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Bloque colapsable para "agregar nuevo X" */
details.add-block-collapsible {
    margin-top: 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}
details.add-block-collapsible > summary {
    list-style: none;
    cursor: pointer;
    padding: 11px 16px;
    font-weight: 600;
    color: var(--accent);
    user-select: none;
}
details.add-block-collapsible > summary::-webkit-details-marker { display: none; }
details.add-block-collapsible[open] > summary {
    border-bottom: 1px solid #e2e8f0;
}
details.add-block-collapsible > .sede-form-inline {
    padding: 16px;
    background: transparent;
    border: none;
}

/* ============================================================
   ALERTA-PILL (badges en listado de transportistas)
   ============================================================ */
.alerta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px 3px 7px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}
.alerta-pill span {
    font-size: 12.5px;
    font-weight: 700;
    min-width: 12px;
    text-align: center;
}
.alerta-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12);
}
.alerta-pill-critica {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}
.alerta-pill-critica:hover {
    background: #fecaca;
    border-color: #f87171;
}
.alerta-pill-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
.alerta-pill-warning:hover {
    background: #fde68a;
    border-color: #fbbf24;
}
.alerta-pill.popover-anchor-active {
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.30);
}

/* Popover de Alertas (filas con vencidos / por vencer) */
.popover-alertas .popover-alerta-item {
    align-items: flex-start;
    padding: 10px 14px;
}
.popover-alerta-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.popover-doc-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.5;
    padding: 1px 0;
}
.popover-doc-marker {
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}
.popover-doc-nombre {
    font-weight: 600;
    color: #1e293b;
}
.popover-doc-fecha {
    color: #64748b;
    font-size: 11.5px;
    margin-left: auto;
    font-style: italic;
}
.popover-doc-vencido .popover-doc-nombre { color: #991b1b; }
.popover-doc-pv .popover-doc-nombre { color: #92400e; }

/* ============================================================
   COLUMNA "ALERTAS" en listado de Transportistas
   ============================================================ */
.alertas-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Pill rediseñada: icono + número, más informativa */
.alerta-pill-icono {
    font-size: 14px;
    line-height: 1;
}
.alerta-pill-num {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
}

/* Marcador "todo en orden" */
.alerta-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid #bbf7d0;
}

/* Círculos de estado en popover de alertas (consistentes en tamaño/forma) */
.popover-doc-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95) inset;
}
.popover-doc-dot-rojo {
    background: #dc2626;
}
.popover-doc-dot-amarillo {
    background: #f59e0b;
}

/* ============================================================ */
/* Configuración de ETIQUETAS por cliente (cliente_form)         */
/* ============================================================ */
.etiquetas-cliente-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}
.etiqueta-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.etiqueta-row .etiqueta-input {
    flex: 1 1 200px;
    min-width: 150px;
    text-transform: uppercase;
}
.etiqueta-tipo-toggle {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px;
    border: 1px solid #e5e7eb;
}
.etiqueta-tipo-toggle .toggle-opt {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
    color: #6b7280;
    user-select: none;
    margin: 0;
}
.etiqueta-tipo-toggle .toggle-opt input[type=radio] {
    display: none;
}
.etiqueta-tipo-toggle .toggle-opt:has(input:checked) {
    background: white;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Botón flotante: para agregar plantas/elementos sin scroll */
.fab-add {
    position: fixed;
    bottom: 24px;
    right: 32px;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.fab-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5);
}
.fab-add .fab-icon {
    font-size: 20px;
    font-weight: bold;
}

/* En tabletas grandes/desktop el FAB también se ve bien.
   Si el viewport es muy chico (móvil), se reduce. */
@media (max-width: 600px) {
    .fab-add {
        bottom: 16px;
        right: 16px;
        padding: 12px 16px;
    }
}

/* Modal de etiquetas activas en modal asignar unidad: chips clickeables */
.detalles-cliente-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 14px 0;
}
.detalle-chip {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 18px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.15s;
    user-select: none;
}
.detalle-chip:hover {
    border-color: #9ca3af;
}
.detalle-chip.activo {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1d4ed8;
}
.detalle-chip.obligatorio {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
    cursor: default;
}
.detalle-chip.obligatorio::after {
    content: ' *';
    font-weight: 900;
    color: #dc2626;
}
.detalle-chip-icon {
    margin-right: 4px;
}

/* ============================================================ */
/* Plantas internas: badge + estilo de tarjeta + toggle button   */
/* ============================================================ */
.badge-interna {
    background: #ecfeff;
    color: #155e75;
    border: 1px solid #67e8f9;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.sede-card-interna {
    background: linear-gradient(135deg, #ffffff 0%, #ecfeff 100%);
    border-color: #67e8f9 !important;
}
.btn-toggle-interna {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    transition: all 0.15s;
}
.btn-toggle-interna:hover {
    background: #e5e7eb;
}
.btn-toggle-interna.activo {
    background: #cffafe;
    color: #155e75;
    border-color: #67e8f9;
}
.btn-toggle-interna.activo:hover {
    background: #a5f3fc;
}

/* ============================================================ */
/* Panel de errores inline en modales (no cierran el modal)      */
/* ============================================================ */
.modal-errores-panel {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 14px;
    animation: shake-error 0.4s ease-in-out;
}
@keyframes shake-error {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.modal-errores-header {
    font-weight: 700;
    color: #991b1b;
    font-size: 13px;
    margin-bottom: 6px;
}
.modal-errores-lista {
    margin: 0;
    padding-left: 18px;
    color: #7f1d1d;
    font-size: 13px;
    line-height: 1.5;
}
.modal-errores-lista li {
    margin: 2px 0;
}

/* ============================================================
   VALIDACIÓN DE FORMULARIO — tooltip y marcas de error
   Imita el estilo del tooltip nativo del navegador ("Completa este
   campo") pero funciona sobre wrappers de Choices.js que tienen
   ocultado el <select> original.
   ============================================================ */
.campo-error-tooltip {
    position: absolute;
    z-index: 10000;
    background: #ffffff;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 9px 13px 9px 10px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: #1f2937;
    max-width: 320px;
    line-height: 1.35;
    animation: tooltipEntrar 0.18s ease-out;
    pointer-events: none; /* no estorba clicks debajo */
}
.campo-error-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 14px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-top: 1px solid #d4d4d4;
    border-left: 1px solid #d4d4d4;
    transform: rotate(45deg);
}
.campo-error-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f97316;
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
}
.campo-error-mensaje {
    color: #1f2937;
    font-weight: 400;
}
@keyframes tooltipEntrar {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Marca visual del campo inválido (input/select/textarea normal) */
.campo-error-marca,
input.campo-error-marca,
select.campo-error-marca,
textarea.campo-error-marca {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18) !important;
    animation: shakeError 0.4s ease;
}

/* Marca cuando el campo es un wrapper de Choices.js */
.choices.campo-error-marca .choices__inner {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18) !important;
    animation: shakeError 0.4s ease;
}

/* Etiqueta del grupo en rojo cuando hay error (opcional, sutil) */
.campo-error-grupo > label {
    color: #b54708;
}

/* ============================================================
   Paginación (lista de servicios)
   ============================================================ */
.pagination {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 16px 0 8px;
    margin-top: 12px;
    border-top: 1px solid var(--border, #e5e7eb);
}
.pagination-info {
    font-size: 13px;
    color: var(--muted, #6b7280);
}
.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.pagination-page {
    display: inline-block;
    min-width: 32px;
    padding: 6px 10px;
    text-align: center;
    text-decoration: none;
    color: var(--text, #111827);
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}
.pagination-page:hover {
    background: var(--bg-hover, #f3f4f6);
}
.pagination-page-actual {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: var(--accent, #2563eb);
}
.pagination-page-actual:hover {
    background: var(--accent, #2563eb);
}
.pagination-ellipsis {
    padding: 0 6px;
    color: var(--muted, #6b7280);
}
.btn-secondary.btn-small.disabled,
.btn-primary.btn-small.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   Modal global de CONFIRMACIÓN
   Reemplazo profesional del confirm() del navegador (que aparece
   pegado al borde superior y desplaza el contenido). Este aparece
   centrado en la pantalla, con backdrop oscuro y animación suave.
   ============================================================ */
.modal-confirmar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.18s ease-out;
}
.modal-confirmar-overlay.visible {
    opacity: 1;
}
.modal-confirmar-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px 20px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4),
                0 10px 25px -10px rgba(0, 0, 0, 0.2);
    transform: translateY(-12px) scale(0.97);
    opacity: 0;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
.modal-confirmar-overlay.visible .modal-confirmar-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.modal-confirmar-titulo {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--ink, #111827);
}
.modal-confirmar-titulo > span[aria-hidden] {
    font-size: 20px;
    line-height: 1;
}
.modal-confirmar-mensaje {
    color: var(--muted, #4b5563);
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 22px;
}
.modal-confirmar-botones {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.btn-confirmar {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    min-width: 90px;
}
.btn-confirmar-cancelar {
    background: #fff;
    color: var(--ink, #111827);
    border-color: #d1d5db;
}
.btn-confirmar-cancelar:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.btn-confirmar-aceptar {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.btn-confirmar-aceptar:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}
/* Variante peligrosa: el botón principal queda rojo */
.btn-confirmar-aceptar.btn-confirmar-peligroso {
    background: #dc2626;
    border-color: #dc2626;
}
.btn-confirmar-aceptar.btn-confirmar-peligroso:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
/* Focus ring accesible */
.btn-confirmar:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.btn-confirmar-aceptar.btn-confirmar-peligroso:focus-visible {
    outline-color: #fca5a5;
}

/* Mobile */
@media (max-width: 480px) {
    .modal-confirmar-card {
        padding: 20px;
    }
    .modal-confirmar-botones {
        flex-direction: column-reverse;
    }
    .btn-confirmar {
        width: 100%;
    }
}

/* Accesibilidad: respetar reduce-motion */
@media (prefers-reduced-motion: reduce) {
    .modal-confirmar-overlay,
    .modal-confirmar-card {
        transition: none;
    }
}

/* ============================================================
   Botón "Copiar reporte para WhatsApp" — aparece junto al estado
   ============================================================ */
.btn-copiar-reporte {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    border: 0.5px solid var(--border, #d1d5db);
    background: #fff;
    color: var(--ink, #111827);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    /* Espacio respecto a los botones → y ↺ que están a la izquierda */
    margin-left: 4px;
}
.btn-copiar-reporte:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.btn-copiar-reporte:active {
    transform: scale(0.95);
}
/* Estado "copiado": fondo verde suave por 1.2s */
.btn-copiar-reporte.btn-copiar-reporte-ok {
    background: #dcfce7;
    border-color: #16a34a;
    color: #15803d;
    transform: scale(1.05);
}

/* ============================================================
   PENDIENTE clickeable — "tomar" servicio para buscar unidad
   ============================================================ */
/* El badge PENDIENTE se convierte en botón clickeable.
   Mantenemos el mismo look que el badge normal pero con cursor pointer
   y un sutil indicador visual al hacer hover. */
.status-badge-clickable {
    cursor: pointer;
    border: none;
    font: inherit;
    /* Heredamos color, padding, etc del .status-badge.status-pendiente original */
    transition: filter 0.15s, transform 0.1s;
    /* Quitar bordes/outline default del botón */
    -webkit-appearance: none;
    appearance: none;
}
.status-badge-clickable:hover {
    filter: brightness(0.94) saturate(1.15);
    transform: scale(1.02);
}
.status-badge-clickable:active {
    transform: scale(0.97);
}
.status-badge-clickable:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

/* Chip "⏳ buscando: Nombre" al lado del badge PENDIENTE.
   Solo aparece cuando algún coordinador ha tomado el servicio. */
.buscando-coord {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 11px;
    background: #fef3c7;
    border: 0.5px solid #fcd34d;
    color: #92400e;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    /* Animación sutil de entrada al añadirse vía JS */
    animation: chip-buscando-aparecer 0.25s ease-out;
}
.buscando-icono {
    font-size: 10px;
    line-height: 1;
}
.buscando-nombre {
    /* Truncar nombres muy largos para no romper la fila */
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@keyframes chip-buscando-aparecer {
    from {
        opacity: 0;
        transform: translateX(-4px) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Si el chip muestra a un usuario que NO es el actual, lo mostramos
   ligeramente diferente para indicar "no soy yo, es de otro". El highlight
   se hace vía atributo data-* añadido por el backend. */

/* Mobile: que el chip pase debajo si no hay espacio */
@media (max-width: 600px) {
    .estado-control {
        flex-wrap: wrap;
    }
    .buscando-coord {
        margin-left: 0;
        margin-top: 4px;
    }
}

/* ============================================================
   Sección bloqueada en el formulario de servicio
   Aplicada al bloque "Ruta" cuando el servicio ya está en
   EN PROCESO DE CARGA o más adelante. Visualmente: fondo más
   apagado, sin permitir interacción. El JS además fuerza disabled
   en todos los inputs/selects/botones del bloque.
   ============================================================ */
.seccion-bloqueada {
    background: #f9fafb;
    position: relative;
    opacity: 0.92;
}
.seccion-bloqueada select,
.seccion-bloqueada input,
.seccion-bloqueada textarea,
.seccion-bloqueada button {
    background: #f3f4f6 !important;
    color: #4b5563;
    cursor: not-allowed !important;
    /* Evitar edición/interacción real (no solo visual). El backend también
       ignora cualquier cambio en estos campos vía matriz, pero la doble
       protección evita confusión al operador. */
    pointer-events: none;
}
.seccion-bloqueada .btn-mini.btn-danger,
.seccion-bloqueada .btn-secondary {
    display: none !important;  /* Ocultar botones de añadir/quitar paradas */
}

/* ============================================================
   Botón "Ver ubicación" en el detalle del servicio
   Aparece debajo de cada punto de carga/descarga si la localidad
   tiene URL de ubicación registrada.
   ============================================================ */
.parada-ubicacion {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 0.5px dashed #e5e7eb;
}
.btn-ubicacion {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 6px;
    background: #eff6ff;
    border: 0.5px solid #93c5fd;
    color: #1e40af;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.btn-ubicacion:hover {
    background: #dbeafe;
    border-color: #3b82f6;
    text-decoration: none;
}

/* Badge "Ver ubicación" en cada localidad de Maestros */
.badge-ubicacion-loc {
    margin-left: 6px;
    font-size: 10px !important;
    padding: 1px 6px !important;
}

/* Editor de localidad con varios campos (nombre + URL) — layout vertical */
.localidad-edit-completo {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    border: 0.5px dashed #d1d5db;
}
.loc-edit-fila,
.loc-nueva-fila {
    display: flex;
    gap: 6px;
}
.loc-edit-fila input,
.loc-nueva-fila input {
    flex: 1;
    padding: 5px 9px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
}
.loc-edit-acciones,
.loc-nueva-acciones {
    justify-content: flex-end;
}

/* Form de "Nueva localidad" con URL también vertical */
.localidad-nueva-completo {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
    padding: 10px;
    margin-top: 6px;
    background: #fffef5;
    border: 0.5px dashed #fcd34d;
    border-radius: 6px;
}

/* ============================================================
   Chip de fecha BLOQUEADA (modo solo lectura)
   Visualmente parecido a un chip normal seleccionado, pero con
   tono apagado y candado para dejar claro que no se puede cambiar.
   No es clickeable.
   ============================================================ */
.fecha-chip-bloqueada {
    background: #f3f4f6 !important;
    border: 1px solid #d1d5db !important;
    color: #4b5563 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    box-shadow: none !important;
}
.fecha-chip-bloqueada .chip-titulo {
    color: #b91c1c !important;
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.5px;
}
.fecha-chip-bloqueada .chip-fecha {
    color: #1f2937 !important;
    font-weight: 500;
}

/* ============================================================
   Bloqueo robusto de la sección "Ruta" en el form de servicios
   Choices.js envuelve cada <select> en un <div class="choices">
   con su propia UI clickeable. Marcar el select original como
   `disabled` no afecta a ese div, así que aquí desactivamos el
   div visual con pointer-events: none y le aplicamos estilos
   de bloqueo. Esto cubre tanto plantas como localidades en el
   bloque "Ruta" cuando el servicio está en proceso o más adelante.
   ============================================================ */
.seccion-bloqueada .choices,
.seccion-bloqueada .choices__inner,
.seccion-bloqueada .choices__list,
.seccion-bloqueada .choices__item {
    pointer-events: none !important;
    cursor: not-allowed !important;
}
.seccion-bloqueada .choices__inner {
    background: #f3f4f6 !important;
    color: #4b5563 !important;
    border-color: #d1d5db !important;
}
.seccion-bloqueada .choices[data-type*="select-one"]::after {
    /* Ocultar la flecha del dropdown para reforzar visualmente que no se abre */
    opacity: 0.3;
}

/* ============================================================
   SERVICIOS — Lista v2 (Bloque B del rediseño)
   Tabla más limpia y jerárquica. Conserva todas las clases v1
   para no romper estilos preexistentes; estas reglas v2 son
   aditivas / refinan presentación.
   ============================================================ */

/* Header columns: tamaños y peso visual */
.servicios-table-v2 {
    table-layout: fixed;
    width: 100%;
}
.servicios-table-v2 th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    font-weight: 500;
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
}
/* Anchos fijos para que la suma quepa sin scroll horizontal.
   Total: 34 + 64 + 150 + 210 + 145 + 105 + 76 + 130 + 110 = 1024px */
.servicios-table-v2 th.th-expand   { width: 34px; }
.servicios-table-v2 th.th-fecha    { width: 64px; }
.servicios-table-v2 th.th-cliente  { width: 150px; }
.servicios-table-v2 th.th-ruta     { width: 210px; }
.servicios-table-v2 th.th-unidad   { width: 145px; }
.servicios-table-v2 th.th-guia     { width: 105px; }
.servicios-table-v2 th.th-descarga { width: 76px; }
.servicios-table-v2 th.th-estado   { width: 130px; }
.servicios-table-v2 th.th-acciones { width: 110px; text-align: right; }

/* Cuaderno (Cargas / Descargas): anchos equilibrados. RUTA generosa pero fija
   (380px) para mostrar la ruta sin estirarse de más ni separar origen/destino;
   Guía y Estado con holgura para no encogerse; "Descarga" fija. */
.servicios-table-dashboard th.th-ruta,
.servicios-table-descargas th.th-ruta { width: 380px; }
.servicios-table-dashboard th.th-guia,
.servicios-table-descargas th.th-guia { width: 135px; }
.servicios-table-dashboard th.th-estado,
.servicios-table-descargas th.th-estado { width: 180px; }
.servicios-table-descargas th.th-cuando { width: 92px; }

/* Fila — más respiración */
.servicios-table-v2 td {
    padding: 12px 8px;
    vertical-align: middle;
}

/* Click en celda expand el detalle */
.servicios-table-v2 .td-clickable { cursor: pointer; }
.servicios-table-v2 tr.servicio-row-v2:hover > td.td-clickable,
.servicios-table-v2 tr.servicio-row-v2:hover > td.btn-expand-cell {
    background: #fafafa;
}
.servicios-table-v2 .btn-expand-cell {
    text-align: center;
    cursor: pointer;
}

/* Cliente: jerarquía con nombre + número de servicio debajo */
.servicios-table-v2 .cliente-main {
    font-weight: 600;
    color: #111827;
    font-size: 13px;
    line-height: 1.3;
}
.servicios-table-v2 .cliente-meta {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    letter-spacing: 0.2px;
}

/* Fecha como número grande */
.servicios-table-v2 .fecha-num {
    font-weight: 600;
    font-size: 13px;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

/* Ruta combinada (Origen → Destino en una sola celda) */
.servicios-table-v2 .ruta-cell-v2 {
    font-size: 12px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.3;
}
.servicios-table-v2 .ruta-cell-v2 strong {
    font-weight: 600;
    color: #111827;
}
.servicios-table-v2 .ruta-flecha-v2 {
    color: #9ca3af;
    font-weight: 400;
    font-size: 13px;
}
.servicios-table-v2 .ruta-loc-v2 {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 3px;
    line-height: 1.3;
}

/* Badge HOY más compacto inline */
.servicios-table-v2 .badge-descarga-hoy {
    display: inline-block;
    background: #dc2626;
    color: white;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    vertical-align: middle;
    animation: pulse-hoy 2.5s ease-in-out infinite;
}
@keyframes pulse-hoy {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Acciones: botones pequeños y discretos */
/* Override: la clase vieja .acciones-cell aplicaba display:flex a un <td>,
   lo cual rompe el layout de tabla (la celda "se sale" de la fila).
   Forzamos table-cell y movemos el flex a un wrapper interno. */
.servicios-table-v2 td.acciones-cell-v2 {
    display: table-cell !important;
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}
.acciones-cell-v2 {
    text-align: right;
    white-space: nowrap;
}
.btn-action-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    border: 0.5px solid #e5e7eb;
    background: white;
    color: #4b5563;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    margin-left: 1px;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-action-mini:hover {
    background: #f3f4f6;
    color: #111827;
    border-color: #d1d5db;
}
.btn-action-mini.btn-action-avanzar {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}
.btn-action-mini.btn-action-avanzar:hover {
    background: #1e3a8a;
}
.btn-action-mini.btn-action-guias {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}
.btn-action-mini.btn-action-guias:hover {
    background: #d97706;
}
.btn-action-mini.btn-action-retroceder {
    color: #6b7280;
}
.btn-action-mini.btn-action-danger {
    color: #dc2626;
}
.btn-action-mini.btn-action-danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

/* Estado: limpio, solo el badge */
.td-estado-v2 {
    min-width: 130px;
}

.servicios-table-v2 tr.servicio-row-v2.row-expanded > td {
    background: #eff6ff;
    border-bottom: 0;
}
.servicios-table-v2 tr.servicio-row-v2.row-expanded .btn-expand {
    color: #1e40af;
}
.servicios-table-v2 .btn-expand {
    background: none;
    border: 0;
    color: #9ca3af;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 6px;
    transition: color 0.15s;
}
.servicios-table-v2 .btn-expand:hover {
    color: #1f2937;
}

/* ============================================================
   SERVICIOS — Detalle expandible v2 (Bloque C del rediseño)
   3 secciones jerárquicas en lugar de 6 columnas.
   Cada sección es una "tarjeta" con título y filas label/valor.
   ============================================================ */

.servicios-table-v2 tr.servicio-detalle-v2 > td {
    background: #f9fafb;
    padding: 0;
}
.detalle-wrap-v2 {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
    animation: slideDown 0.18s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 3 secciones lado a lado: Ruta (más ancha) + Transporte + Carga.
   Ruta necesita un poco más de espacio por las paradas (tarjetas con TN y mapa);
   las otras dos son filas label/valor compactas. */
.detalle-secciones-v2 {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .detalle-secciones-v2 {
        grid-template-columns: 1fr;
    }
}

/* Cada sección es una tarjeta */
.detalle-sec-v2 {
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
}
.detalle-sec-titulo {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

/* Fila label/valor (Empresa: TRANSPORTISTA) */
.detalle-row-v2 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 12px;
    padding: 4px 0;
    color: #374151;
    line-height: 1.5;
}
.detalle-row-v2 .dr-label {
    color: #6b7280;
    font-size: 11px;
    flex-shrink: 0;
}
.detalle-row-v2 .dr-val {
    color: #111827;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}
.detalle-row-v2 .dr-val code {
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.detalle-row-v2 .dr-val.muted {
    color: #9ca3af;
    font-weight: 400;
    font-style: italic;
}
.detalle-row-v2 .link-contacto {
    color: #2563eb;
    text-decoration: none;
}
.detalle-row-v2 .link-contacto:hover { text-decoration: underline; }

.detalle-divider {
    border-top: 1px dashed #e5e7eb;
    margin: 10px 0;
}

/* Sección de RUTA: paradas como tarjetitas internas */
.detalle-paradas-grupo {
    margin-bottom: 4px;
}
.detalle-paradas-label {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-bottom: 6px;
}
.detalle-parada-v2 {
    background: #f9fafb;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-size: 12px;
}
.detalle-parada-v2:last-child { margin-bottom: 0; }
.parada-encabezado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.parada-encabezado strong {
    color: #111827;
    font-weight: 600;
}
.parada-tn {
    display: inline-block;
    background: #1e40af;
    color: white;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}
.parada-loc {
    color: #6b7280;
    font-size: 11px;
    line-height: 1.4;
}
.parada-link-mapa {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    color: #2563eb;
    text-decoration: none;
    padding: 2px 7px;
    background: white;
    border: 0.5px solid #dbeafe;
    border-radius: 3px;
}
.parada-link-mapa:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}
.detalle-ruta-flecha-vert {
    text-align: center;
    color: #9ca3af;
    font-size: 16px;
    margin: 6px 0;
    line-height: 1;
}

/* Zona inferior: guías + observaciones */
.detalle-zona-inferior {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #d1d5db;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .detalle-zona-inferior { grid-template-columns: 1fr; }
}
.detalle-zona-item {
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 14px;
}
.detalle-zona-titulo {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin-bottom: 6px;
}
.detalle-guias-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.detalle-guia-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f9fafb;
    padding: 4px 9px;
    border-radius: 4px;
    border: 0.5px solid #e5e7eb;
    font-size: 11px;
}
.detalle-guia-chip code {
    background: transparent;
    padding: 0;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11px;
    color: #111827;
}
.detalle-guia-chip .tag-identificador {
    background: #1e40af;
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.detalle-observaciones-texto {
    margin: 0;
    font-size: 12px;
    color: #374151;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ============================================================
   SERVICIOS — Zona de filtros v2 (Bloque A2 del rediseño)
   Barra de búsqueda + chips de filtro rápido + filtros avanzados
   ============================================================ */
.filtros-zona-v2 {
    margin-bottom: 16px;
}

/* Barra de búsqueda */
.filtros-busqueda {
    display: flex;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 10px;
}
.filtros-buscar-input {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.filtros-buscar-icono {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    font-size: 13px;
    pointer-events: none;
}
.filtros-buscar-input input[type="search"] {
    width: 100%;
    padding: 9px 36px 9px 36px;
    border: 0.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.filtros-buscar-input input[type="search"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.filtros-buscar-limpiar {
    position: absolute;
    right: 10px;
    color: #9ca3af;
    background: #f3f4f6;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.filtros-buscar-limpiar:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Chips de filtro rápido */
.filtros-chips-v2 {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.chip-filtro-rapido {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 12px;
    background: #f3f4f6;
    color: #4b5563;
    text-decoration: none;
    border: 0.5px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-weight: 500;
}
.chip-filtro-rapido:hover {
    background: #e5e7eb;
    color: #1f2937;
}
.chip-filtro-rapido.chip-filtro-activo {
    background: #1e40af;
    color: white;
}
.chip-filtro-rapido.chip-filtro-activo .chip-conteo {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}
.chip-filtro-rapido.chip-amber {
    background: #fef3c7;
    color: #92400e;
}
.chip-filtro-rapido.chip-amber:hover { background: #fde68a; }
.chip-filtro-rapido.chip-red {
    background: #fee2e2;
    color: #991b1b;
}
.chip-filtro-rapido.chip-red:hover { background: #fecaca; }
.chip-conteo {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    padding: 1px 7px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* Botón de filtros avanzados */
.chip-filtro-avanzados {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    background: white;
    color: #4b5563;
    border: 0.5px solid #d1d5db;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-weight: 500;
    position: relative;
}
.chip-filtro-avanzados:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}
.chip-filtro-avanzados.chip-avanzados-activos {
    border-color: #2563eb;
    color: #1e40af;
}
.chip-filtro-avanzados .dot-activo {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2563eb;
    display: inline-block;
}

/* Filtros avanzados (colapsable, hereda estilos de filters-bar) */
.filtros-avanzados {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: #f9fafb;
    padding: 14px;
    border-radius: 8px;
    margin-top: 10px;
    border: 0.5px solid #e5e7eb;
    animation: slideDown 0.18s ease-out;
}
.filtros-avanzados .filter-group label {
    display: block;
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
    font-weight: 600;
}
.filtros-avanzados .filter-group select,
.filtros-avanzados .filter-group input {
    padding: 6px 9px;
    border: 0.5px solid #d1d5db;
    border-radius: 5px;
    font-size: 12px;
    background: white;
    min-width: 140px;
}

/* ============================================================
   DASHBOARD — KPI cards v2 (Bloque A1 del rediseño)
   Cards más visuales, con ícono + número + label + descripción.
   Clickeables → llevan al listado filtrado.
   ============================================================ */
.kpi-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card-v2 {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    padding: 16px;
    border-radius: 10px;
    border: 0.5px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.kpi-card-v2.kpi-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: #d1d5db;
}
.kpi-card-v2 .kpi-icono {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    padding: 8px;
    background: #f3f4f6;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kpi-card-v2 .kpi-body {
    flex: 1;
    min-width: 0;
}
.kpi-card-v2 .kpi-value {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.kpi-card-v2 .kpi-label {
    font-size: 12px;
    color: #4b5563;
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.kpi-card-v2 .kpi-sub {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

/* Variantes por color (con barra lateral) */
.kpi-card-v2.kpi-success { border-left: 3px solid #10b981; }
.kpi-card-v2.kpi-success .kpi-icono { background: #d1fae5; }
.kpi-card-v2.kpi-warning { border-left: 3px solid #f59e0b; }
.kpi-card-v2.kpi-warning .kpi-icono { background: #fef3c7; }
.kpi-card-v2.kpi-info { border-left: 3px solid #3b82f6; }
.kpi-card-v2.kpi-info .kpi-icono { background: #dbeafe; }
.kpi-card-v2.kpi-money { border-left: 3px solid #8b5cf6; }
.kpi-card-v2.kpi-money .kpi-icono { background: #ede9fe; }

/* Estado de alerta (pendientes > 0) */
.kpi-card-v2.kpi-alerta {
    border-left-color: #dc2626;
    background: #fef2f2;
}
.kpi-card-v2.kpi-alerta .kpi-icono { background: #fee2e2; }
.kpi-card-v2.kpi-alerta .kpi-value { color: #991b1b; }
.kpi-card-v2.kpi-alerta .kpi-sub { color: #b91c1c; }

/* ============================================================
   Dashboard — KPI como filtros locales (Bloque A revisado)
   Los <button> reemplazaron a los <a> porque ahora no navegan,
   solo filtran la tabla del dashboard sin recargar.
   ============================================================ */
button.kpi-card-v2 {
    background: white;
    border: 0.5px solid #e5e7eb;
    border-left: 3px solid transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: 100%;
    /* Override del estilo default de los buttons */
    outline: none;
}
button.kpi-card-v2:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
/* KPI activo: borde y fondo más marcados */
button.kpi-card-v2.kpi-filtro-activo {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px #dbeafe;
}
button.kpi-card-v2.kpi-filtro-activo .kpi-value {
    color: #1e40af;
}
button.kpi-card-v2.kpi-filtro-activo.kpi-success {
    border-color: #10b981;
    background: #ecfdf5;
    box-shadow: 0 0 0 2px #d1fae5;
}
button.kpi-card-v2.kpi-filtro-activo.kpi-success .kpi-value {
    color: #065f46;
}
button.kpi-card-v2.kpi-filtro-activo.kpi-warning {
    border-color: #f59e0b;
    background: #fffbeb;
    box-shadow: 0 0 0 2px #fef3c7;
}
button.kpi-card-v2.kpi-filtro-activo.kpi-warning .kpi-value {
    color: #92400e;
}
button.kpi-card-v2.kpi-filtro-activo.kpi-info {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 2px #dbeafe;
}

/* ============================================================
   Bloque D — Ordenamiento por columna en la lista
   Click en cabecera ordena ASC; click otra vez DESC.
   Indicador visual ▲ ▼ junto al título de la columna activa.
   ============================================================ */
.servicios-table-v2 th.th-sortable {
    padding: 0;
}
.servicios-table-v2 th.th-sortable .th-sort-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    padding: 10px 8px;
    cursor: pointer;
    transition: color 0.15s;
}
.servicios-table-v2 th.th-sortable .th-sort-link:hover {
    color: #1f2937;
}
.servicios-table-v2 th.th-sortable .sort-icon {
    color: #d1d5db;
    font-size: 10px;
    transition: color 0.15s;
}
.servicios-table-v2 th.th-sortable-active {
    color: #1e40af;
}
.servicios-table-v2 th.th-sortable-active .th-sort-link {
    color: #1e40af;
    font-weight: 600;
}
.servicios-table-v2 th.th-sortable-active .sort-icon {
    color: #1e40af;
}

/* ============================================================
   Ruta en celda — alineación con grid 3 columnas
   El layout original mezclaba plantas y localidades en líneas
   diferentes sin alinearlas. Ahora cada "extremo" (origen/destino)
   es una columna que contiene la planta arriba y su localidad
   abajo. La flecha está en el centro y queda alineada con el
   símbolo › de las localidades.
   ============================================================ */
.servicios-table-v2 .ruta-cell-v2 {
    /* Origen → flecha → destino EMPACADOS a la izquierda (juntos, no separados).
       Cada extremo crece hasta su contenido (max-content) y solo se recorta con
       "…" si no cabe; minmax(0, …) permite encoger sin desbordar ni encimar. */
    display: grid;
    grid-template-columns: minmax(0, max-content) auto minmax(0, max-content);
    justify-content: start;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: #1f2937;
    line-height: 1.3;
}
.servicios-table-v2 .ruta-extremo {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
/* Línea con planta + badge "+N" lado a lado (no apilados) */
.servicios-table-v2 .ruta-planta-linea {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.servicios-table-v2 .ruta-planta-linea .badge-counter-mini { flex-shrink: 0; }
.servicios-table-v2 .ruta-extremo strong {
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.servicios-table-v2 .ruta-extremo .ruta-loc {
    font-size: 10px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.servicios-table-v2 .ruta-flecha-col {
    color: #9ca3af;
    flex-shrink: 0;
    padding: 0 2px;
}
.servicios-table-v2 .ruta-flecha-col .ruta-flecha-v2 {
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
}
/* Si solo hay una localidad, la flecha mini queda invisible para mantener altura uniforme */

/* ============================================================
   Fix scroll horizontal en la tabla de servicios
   - Los badges de estado largos ("EN ESPERA PARA INGRESAR A CARGAR")
     ahora permiten word-wrap en 2 líneas y se ven más compactos.
   - La columna "Estado" tiene max-width para no estirarse.
   ============================================================ */
.servicios-table-v2 th[data-col="estado"],
.servicios-table-v2 th:nth-child(8) {
    max-width: 130px;
}
.servicios-table-v2 td .status-badge {
    /* Permitir 2 líneas cuando el texto es largo */
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.2;
    max-width: 130px;
}

/* ============================================================
   Sub-bloque "Documentos" dentro de Carga y contacto
   Agrupa GRR + Guías Transportista (que antes estaban abajo).
   ============================================================ */
.detalle-sub-titulo {
    font-size: 10px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    margin: 4px 0 6px;
}
/* Fila especial de guías: el label arriba, los chips debajo (no en línea
   porque pueden ser varios y romper el layout). */
.detalle-row-v2.detalle-row-guias {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 4px 0;
}
.detalle-row-v2.detalle-row-guias .dr-label {
    color: #6b7280;
    font-size: 11px;
}
.detalle-row-v2.detalle-row-guias .detalle-guias-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}
.detalle-row-v2.detalle-row-guias .detalle-guia-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f9fafb;
    padding: 3px 8px;
    border-radius: 4px;
    border: 0.5px solid #e5e7eb;
    font-size: 11px;
}
.detalle-row-v2.detalle-row-guias .detalle-guia-chip code {
    background: transparent;
    padding: 0;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11px;
    color: #111827;
}
.detalle-row-v2.detalle-row-guias .tag-identificador {
    background: #1e40af;
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Zona inferior cuando solo hay observaciones: una columna full width */
.detalle-zona-inferior.detalle-zona-solo-obs {
    grid-template-columns: 1fr;
}

/* ============================================================
   Alineación de encabezados según el contenido de cada columna.
   Las fechas, placas, guías y estado están centrados en las filas,
   sus headers deben ir centrados también para coincidir visualmente.
   ============================================================ */
.servicios-table-v2 th.th-fecha,
.servicios-table-v2 th.th-unidad,
.servicios-table-v2 th.th-guia,
.servicios-table-v2 th.th-estado {
    text-align: center;
}
/* Cuando un th sortable está centrado, su link interno (flex con gap)
   también debe centrarse para que el texto + ícono ▾ queden centrados. */
.servicios-table-v2 th.th-fecha .th-sort-link,
.servicios-table-v2 th.th-estado .th-sort-link {
    justify-content: center;
}

/* ============================================================
   Separador visual entre acciones operativas (▶ ↺ 📋)
   y acciones administrativas (✎ ✕)
   ============================================================ */
.acciones-separador {
    display: inline-block;
    width: 0;
    height: 16px;
    border-left: 1px dashed #d1d5db;
    margin: 0 6px 0 4px;
    vertical-align: middle;
}

/* ============================================================
   Contenido centrado en celdas Carga, Descarga, Unidad, Guía, Estado.
   Para que coincidan con sus headers centrados.
   ============================================================ */
.servicios-table-v2 td.td-fecha {
    text-align: center;
}
.servicios-table-v2 td.placa-celda {
    text-align: center;
}
.servicios-table-v2 td.guia-celda {
    text-align: center;
}
.servicios-table-v2 td.td-estado-v2 {
    text-align: center;
}

/* ============================================================
   Valor "Guías transp." — chips alineados a la derecha
   Mismo patrón que GRR pero con uno o más chips en lugar de un código.
   Si hay muchos, hacen wrap manteniendo alineación derecha.
   ============================================================ */
.detalle-guias-val {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}
.detalle-guias-val .detalle-guia-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f9fafb;
    padding: 2px 7px;
    border-radius: 4px;
    border: 0.5px solid #e5e7eb;
    font-size: 11px;
}
.detalle-guias-val .detalle-guia-chip code {
    background: transparent;
    padding: 0;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11px;
    color: #111827;
}
.detalle-guias-val .tag-identificador {
    background: #1e40af;
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================================
   TIEMPO REAL — Banner y Toasts de cambios de otros usuarios
   - Banner: arriba derecha, persistente hasta click "Actualizar" o ✕
   - Toasts: abajo derecha, se apilan y auto-dismiss tras 6s
   ============================================================ */
.tr-banner {
    position: fixed;
    top: 16px;
    right: 16px;
    background: #1e40af;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    animation: tr-slide-in-right 0.3s ease-out;
}
.tr-banner-icono { font-size: 16px; }
.tr-banner-texto { font-weight: 500; }
.tr-banner-btn {
    background: white;
    color: #1e40af;
    border: 0;
    padding: 5px 12px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    margin-left: 4px;
}
.tr-banner-btn:hover { background: #f3f4f6; }
.tr-banner-cerrar {
    background: transparent;
    color: white;
    border: 0;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    opacity: 0.7;
}
.tr-banner-cerrar:hover { opacity: 1; }

.tr-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 0.5px solid #e5e7eb;
    border-left: 3px solid #1e40af;
    padding: 11px 14px 11px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    max-width: 360px;
    min-width: 280px;
    z-index: 9998;
    animation: tr-slide-in-right 0.3s ease-out;
    transition: top 0.25s ease-out;
}
.tr-toast-cerrar {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.tr-toast-cerrar:hover {
    background: #f3f4f6;
    color: #374151;
}
.tr-toast-out {
    animation: tr-slide-out-right 0.3s ease-out forwards;
}
.tr-toast-encabezado {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
}
.tr-toast-icono {
    font-size: 14px;
    line-height: 1;
}
.tr-toast-usuario {
    color: #1e40af;
    font-size: 12px;
    font-weight: 600;
    flex: 1;
    text-transform: capitalize;
}
.tr-toast-tiempo {
    color: #9ca3af;
    font-size: 10px;
    font-style: italic;
}
.tr-toast-cuerpo {
    color: #374151;
    line-height: 1.4;
    font-size: 12px;
}
.tr-toast-num {
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    color: #111827;
    font-weight: 500;
}
.tr-toast-detalle {
    margin-top: 4px;
    color: #6b7280;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.tr-toast-detalle code {
    background: #f9fafb;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    color: #1f2937;
    border: 0.5px solid #e5e7eb;
}
.tr-toast-flecha {
    color: #9ca3af;
    font-weight: 500;
}

@keyframes tr-slide-in-right {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes tr-slide-out-right {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(110%); opacity: 0; }
}

/* ============================================================
   Botón "Copiar imagen" + agrupación de acciones del header
   ============================================================ */
.page-header-acciones {
    display: flex;
    gap: 8px;
    align-items: center;
}
.page-header-acciones .btn-secondary {
    background: white;
    color: #1e40af;
    border: 0.5px solid #dbeafe;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: inherit;
}
.page-header-acciones .btn-secondary:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
}
.page-header-acciones .btn-secondary:active:not(:disabled) {
    transform: translateY(1px);
}
.page-header-acciones .btn-secondary:disabled {
    cursor: not-allowed;
}

/* Toast de feedback del botón copiar imagen */
.tr-toast-imagen {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 0.5px solid #e5e7eb;
    border-left: 4px solid #10b981;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    color: #065f46;
    font-weight: 500;
    z-index: 10000;
    animation: tr-toast-imagen-in 0.3s ease-out;
    max-width: 480px;
}
.tr-toast-imagen-error {
    border-left-color: #dc2626;
    color: #991b1b;
}
.tr-toast-imagen-out {
    animation: tr-toast-imagen-out 0.3s ease-out forwards;
}
@keyframes tr-toast-imagen-in {
    from { transform: translate(-50%, -10px); opacity: 0; }
    to   { transform: translate(-50%, 0);     opacity: 1; }
}
@keyframes tr-toast-imagen-out {
    from { transform: translate(-50%, 0);     opacity: 1; }
    to   { transform: translate(-50%, -10px); opacity: 0; }
}

/* ============================================================
   Vista por día — chip de fecha en título, barra inferior,
   navegación, botón cerrar día, modal de confirmación
   ============================================================ */
.page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip-fecha-titulo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}
.chip-fecha-titulo small {
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 99px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    background: rgba(255,255,255,0.25);
}
.chip-fecha-hoy     { background: #1e40af; color: white; }
.chip-fecha-pasado  { background: #6b7280; color: white; }
.chip-fecha-futuro  { background: #0891b2; color: white; }

/* ============================================================
   Barra inferior con chips de navegación de días + botón cerrar/reabrir
   Diseño: rápido (un solo click cambia día), intuitivo (etiquetas claras
   AYER/HOY/MAÑANA + fecha), profesional (consistente con el resto).
   ============================================================ */
.barra-inferior-dia {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    gap: 14px;
    flex-wrap: wrap;
}

/* Chips de día — cada uno es un día navegable (-2 a +2) */
.nav-dias-chips {
    display: flex;
    align-items: stretch;
    gap: 6px;
    flex-wrap: wrap;
}
.nav-chip-dia {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 7px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    transition: all 0.15s ease;
    position: relative;
    font-family: inherit;
    line-height: 1.2;
}
.nav-chip-dia:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.nav-chip-etiqueta {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.nav-chip-fecha {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-top: 2px;
}
/* Día activo (el que estoy viendo) */
.nav-chip-activo {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
    box-shadow: 0 2px 6px rgba(30,64,175,0.25);
}
.nav-chip-activo:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: white;
    transform: translateY(-1px);
}
.nav-chip-activo .nav-chip-etiqueta { color: rgba(255,255,255,0.85); }
.nav-chip-activo .nav-chip-fecha { color: white; }

/* Día = HOY pero NO es el activo: marcado sutilmente para reconocerlo */
.nav-chip-hoy {
    border-color: #1e40af;
    border-width: 1.5px;
}
.nav-chip-hoy .nav-chip-fecha { color: #1e40af; }

/* Día con cierre — pequeño candado abajo */
.nav-chip-cerrado .nav-chip-icono {
    position: absolute;
    top: -6px;
    right: -6px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.nav-chip-activo.nav-chip-cerrado .nav-chip-icono {
    border-color: #1e40af;
}

/* === Botón cerrar/reabrir día === */
.btn-dia-accion {
    background: white;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
    font-family: inherit;
    transition: all 0.15s ease;
    line-height: 1;
}
.btn-dia-cerrar-activo {
    background: #fffbeb;
    color: #b45309;
    border-color: #fcd34d;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(245,158,11,0.15);
}
.btn-dia-cerrar-activo:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(245,158,11,0.25);
}
.btn-dia-reabrir {
    background: #ecfdf5;
    color: #047857;
    border-color: #6ee7b7;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(16,185,129,0.15);
}
.btn-dia-reabrir:hover {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16,185,129,0.25);
}

/* === Modal: reabrir (info verde) === */
.modal-info-list {
    background: #ecfdf5;
    border-left: 3px solid #10b981;
    border-radius: 0 4px 4px 0;
    padding: 10px 12px 10px 28px;
    margin: 12px 0;
    color: #065f46;
}
.modal-info-list li { margin-bottom: 4px; font-size: 12px; }
.btn-reabrir-confirmar {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-reabrir-confirmar:hover { background: #059669; }

/* ============================================================
   Servicios bloqueados (día cerrado)
   ============================================================ */
.row-bloqueado {
    background: #f9fafb !important;
    opacity: 0.7;
}
.row-bloqueado:hover { opacity: 0.95; }
.row-bloqueado td { color: #6b7280; }
.row-bloqueado .acciones-cell-v2 button {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}
.icono-bloqueado {
    display: inline-block;
    font-size: 14px;
    line-height: 1;
    padding: 4px;
    cursor: help;
}

/* ============================================================
   Modal de confirmación: cerrar día
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-card {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}
.modal-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 0.5px solid #e5e7eb;
}
.modal-card-head h3 { margin: 0; font-size: 16px; color: #111827; }
.modal-close {
    background: none; border: none; font-size: 16px;
    color: #6b7280; cursor: pointer; padding: 4px 8px;
}
.modal-close:hover { color: #111827; }
.modal-card-body { padding: 18px; font-size: 13px; color: #374151; line-height: 1.6; }
.modal-card-body p { margin: 0 0 12px; }
.modal-warn-list {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 0 4px 4px 0;
    padding: 10px 12px 10px 28px;
    margin: 12px 0;
    color: #92400e;
}
.modal-warn-list li { margin-bottom: 4px; font-size: 12px; }
.modal-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    background: #fafafa;
    border-top: 0.5px solid #e5e7eb;
}
.btn-cerrar-confirmar {
    background: #dc2626;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-cerrar-confirmar:hover { background: #b91c1c; }

/* Indicador "🔒 Bloqueado" en celda de acciones para servicios bloqueados */
.acciones-bloqueado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #6b7280;
    font-weight: 600;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: not-allowed;
}

/* ============================================================
   Chip especial (fecha lejana) + separador
   ============================================================ */
.nav-chip-especial {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    border-width: 1.5px;
    min-width: 80px;
}
.nav-chip-especial .nav-chip-etiqueta { color: #92400e; }
.nav-chip-especial .nav-chip-fecha { color: #78350f; font-size: 12px; }
.nav-chip-especial.nav-chip-activo {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    border-color: #92400e;
    box-shadow: 0 2px 6px rgba(180,83,9,0.3);
}
.nav-chip-especial.nav-chip-activo .nav-chip-etiqueta { color: rgba(255,255,255,0.9); }
.nav-chip-especial.nav-chip-activo .nav-chip-fecha { color: white; }

.nav-chip-separador {
    width: 1px;
    background: #e5e7eb;
    margin: 4px 8px 4px 4px;
    align-self: stretch;
}

/* ============================================================
   Botón "Otra fecha" + popover
   ============================================================ */
.nav-otra-fecha-wrap {
    position: relative;
    display: inline-block;
}
.btn-otra-fecha {
    background: white;
    border: 1px dashed #d1d5db;
    color: #6b7280;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.2;
}
.btn-otra-fecha:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    border-style: solid;
}
.btn-otra-fecha[aria-expanded="true"] {
    background: #f3f4f6;
    border-color: #6b7280;
    border-style: solid;
}
.btn-otra-fecha .of-icono { font-size: 14px; }
.btn-otra-fecha .of-texto {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 2px;
}

.popover-otra-fecha {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 14px;
    width: 280px;
    z-index: 100;
    animation: pop-in 0.18s ease-out;
}
.popover-otra-fecha::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 24px;
    border: 6px solid transparent;
    border-top-color: white;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.06));
}
@keyframes pop-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pop-titulo {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}
.pop-form { margin: 0; }
.pop-date {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #111827;
    margin-bottom: 14px;
    font-family: inherit;
    cursor: pointer;
}
.pop-date:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.pop-sec-titulo {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 6px;
}
.pop-saltos {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pop-salto {
    background: white;
    border: 0.5px solid #e5e7eb;
    padding: 7px 10px;
    border-radius: 5px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    display: block;
}
.pop-salto:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #1e40af;
}
.pop-salto small {
    color: #9ca3af;
    margin-left: 4px;
    font-size: 10px;
}

/* ============================================================
   REGLA GLOBAL: textos en MAYÚSCULAS sin tildes
   Esta regla aplica visualmente a campos de texto. La normalización
   real (sin tildes, etc.) se hace en el backend con helpers.limpiar().
   
   EXCLUSIONES: password, email, url, number, date, time, search
   (no tendría sentido convertirlos a mayúsculas).
   ============================================================ */
input[type="text"],
input[type="tel"],
input:not([type]),
textarea,
select {
    text-transform: uppercase;
}
/* Excepciones explícitas: ciertos campos preservan su case */
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
input.preservar-case,
textarea.preservar-case {
    text-transform: none;
}

/* Texto en celdas y badges también en mayúsculas (defensa en profundidad
   por si se cuela algún dato viejo no normalizado) */
.servicios-table-v2 td .cliente-main,
.servicios-table-v2 td .ruta-extremo strong,
.servicios-table-v2 td .ruta-loc,
.status-badge {
    text-transform: uppercase;
}

/* Placeholders mantienen su case original (las indicaciones se ven mejor en mixto) */
input::placeholder, textarea::placeholder {
    text-transform: none;
}

/* ============================================================
   DASHBOARD MODERNO — Banner de bienvenida, KPIs con íconos
   pastel, acciones rápidas con cards
   Estilo "POS moderno": sombras suaves, mucho whitespace,
   íconos en cuadrados redondeados con fondo pastel.
   ============================================================ */

/* Banner de bienvenida */
.dashboard-bienvenida {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: white;
    padding: 26px 30px;
    border-radius: 14px;
    margin-bottom: 22px;
    box-shadow: 0 6px 20px rgba(30,64,175,0.18);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.dashboard-bienvenida::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -30px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.dashboard-bienvenida::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: 60px;
    width: 140px;
    height: 140px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.db-bienvenida-texto h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
    text-transform: none;  /* override global uppercase */
    color: white;
}
.db-bienvenida-fecha {
    margin: 0;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    text-transform: capitalize;
}
.db-bienvenida-acciones { position: relative; z-index: 2; }
.btn-bienvenida-primary {
    background: white;
    color: #1e40af;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-bienvenida-primary:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    color: #1e3a8a;
}

/* ===== KPI moderna ===== */
.kpi-grid-moderna {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.kpi-moderna {
    background: white;
    border-radius: 14px;
    padding: 18px 18px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    border: 0.5px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}
.kpi-moderna:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    border-color: #e2e8f0;
}
.kpi-link.kpi-filtro-activo {
    border-color: #1e40af;
    box-shadow: 0 0 0 1.5px #1e40af, 0 2px 8px rgba(30,64,175,0.12);
}
.kpi-moderna-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.kpi-moderna-icono {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
/* === KPI iconos: estilo tile sólido (v6) === */
.kpi-icono-azul    { background: #06B6D4; color: #fff; }   /* turquesa */
.kpi-icono-amber   { background: #F59E0B; color: #fff; }   /* naranja */
.kpi-icono-verde   { background: #22C55E; color: #fff; }   /* verde */
.kpi-icono-rojo    { background: #EF4444; color: #fff; }   /* rojo */
.kpi-icono-violeta { background: #8B5CF6; color: #fff; }   /* púrpura */
.kpi-icono-emerald { background: #10B981; color: #fff; }   /* verde esmeralda */
/* Permite mostrar un PNG con su propio diseño como ícono KPI */
.kpi-moderna-icono.kpi-icono-imagen {
    background: transparent !important;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
}
.kpi-moderna-icono.kpi-icono-imagen img {
    width: 100%; height: 100%; object-fit: cover;
    display: block; border-radius: 14px;
}

.kpi-moderna-trend {
    font-size: 10px;
    padding: 3px 9px;
    border-radius: 99px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.kpi-trend-up      { background: #d1fae5; color: #047857; }
.kpi-trend-down    { background: #fee2e2; color: #991b1b; }
.kpi-trend-neutro  { background: #f1f5f9; color: #475569; }

.kpi-moderna-numero {
    font-size: 30px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.kpi-moderna-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.kpi-moderna-alerta {
    animation: kpi-alerta-pulso 2s ease-in-out infinite;
}
@keyframes kpi-alerta-pulso {
    0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02); }
    50%      { box-shadow: 0 0 0 4px rgba(245,158,11,0.15), 0 4px 12px rgba(245,158,11,0.12); }
}

/* ===== Acciones rápidas ===== */
.dashboard-seccion { margin-bottom: 26px; }
.dashboard-sec-titulo {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin: 0 0 10px;
}
.acciones-rapidas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.accion-rapida-card {
    background: white;
    border-radius: 12px;
    padding: 16px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border: 0.5px solid #f1f5f9;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
    color: inherit;
    display: block;
}
.accion-rapida-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.07);
    border-color: #e2e8f0;
}
.accion-rapida-icono {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 10px;
}
/* === Acción rápida iconos: estilo tile sólido (v6) === */
.accion-icono-cyan    { background: #EF4444; color: #fff; }  /* Nuevo Servicio (rojo) */
.accion-icono-naranja { background: #F97316; color: #fff; }  /* Asignar Unidades (naranja) */
.accion-icono-rosa    { background: #2563EB; color: #fff; }  /* Ver Servicios (azul cobalto) */
.accion-icono-indigo  { background: #14B8A6; color: #fff; }  /* Compartir Reporte (teal) */
.accion-rapida-titulo {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
    text-transform: none;
}
.accion-rapida-desc {
    font-size: 11px;
    color: #6b7280;
}

/* ===== Refinar modales para coincidir con el estilo moderno ===== */
.modal-card {
    border-radius: 14px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.18) !important;
}
.modal-card-head {
    padding: 16px 20px !important;
}
.modal-card-head h3 {
    font-size: 16px !important;
    font-weight: 700 !important;
}
.modal-card-body {
    padding: 20px !important;
}
.modal-card-footer {
    padding: 14px 20px !important;
}

/* (Regla antigua de hover sidebar movida a la regla principal del sidebar arriba) */

/* ============================================================
   SVG icons dentro de KPI y acciones rápidas
   ============================================================ */
.kpi-moderna-icono svg {
    width: 32px;
    height: 32px;
    display: block;
}
.accion-rapida-icono svg {
    width: 32px;
    height: 32px;
    display: block;
}

/* SVGs en la sidebar */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
}
.nav-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ============================================================
   FORMULARIO MODERNO — Banner gradiente, step-cards refinadas,
   inputs con focus state moderno, botones consistentes con dashboard
   ============================================================ */

/* === Banner del form === */
.form-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: white;
    padding: 22px 26px;
    border-radius: 14px;
    margin-bottom: 22px;
    box-shadow: 0 6px 20px rgba(30,64,175,0.18);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.form-banner::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -30px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.form-banner-icono {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.form-banner-icono svg {
    width: 28px;
    height: 28px;
    color: white;
}
.form-banner-texto {
    flex: 1;
    position: relative;
    z-index: 2;
    min-width: 0;
}
.form-banner-texto h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
    text-transform: none;
}
.form-banner-texto p {
    margin: 0;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
}
.btn-volver {
    background: rgba(255,255,255,0.15);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    transition: all 0.15s ease;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}
.btn-volver:hover {
    background: rgba(255,255,255,0.25);
    color: white;
}

/* === Step-cards modernizadas (aplica a todos los forms) === */
.form-step,
.form-card,
.form-section {
    background: white;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    border: 0.5px solid #f1f5f9;
    transition: box-shadow 0.18s ease;
}
.form-step:hover,
.form-card:hover,
.form-section:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.03);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 0.5px solid #f1f5f9;
}
.step-num {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(30,64,175,0.25);
}
.step-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    text-transform: none;
    letter-spacing: -0.2px;
}
.step-header .step-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: #6b7280;
    text-transform: none;
}

/* === Inputs modernos (todos los forms del sistema) === */
.form-step input[type="text"],
.form-step input[type="tel"],
.form-step input[type="number"],
.form-step input[type="date"],
.form-step input[type="time"],
.form-step input[type="datetime-local"],
.form-step input[type="email"],
.form-step input[type="password"],
.form-step select,
.form-step textarea,
.form-card input[type="text"],
.form-card input[type="tel"],
.form-card input[type="number"],
.form-card input[type="date"],
.form-card input[type="time"],
.form-card input[type="datetime-local"],
.form-card input[type="email"],
.form-card input[type="password"],
.form-card select,
.form-card textarea,
.form-section input[type="text"],
.form-section input[type="tel"],
.form-section input[type="number"],
.form-section input[type="date"],
.form-section input[type="time"],
.form-section input[type="datetime-local"],
.form-section input[type="email"],
.form-section input[type="password"],
.form-section select,
.form-section textarea {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: #111827;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.form-step input:focus,
.form-step select:focus,
.form-step textarea:focus,
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus,
.form-section input:focus,
.form-section select:focus,
.form-section textarea:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.form-step label,
.form-card label,
.form-section label {
    color: #374151;
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 6px;
}
.form-step .required,
.form-card .required,
.form-section .required {
    color: #dc2626;
    font-weight: 700;
}

/* === Botones del form === */
.servicio-form-v2 .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 18px 0;
    border-top: 1px solid #f1f5f9;
    margin-top: 6px;
}
.servicio-form-v2 .btn-primary {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(30,64,175,0.25);
    transition: all 0.15s ease;
}
.servicio-form-v2 .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30,64,175,0.35);
}

/* Responsive: en móvil banner se apila */
@media (max-width: 640px) {
    .form-banner { flex-direction: column; align-items: flex-start; }
    .btn-volver { align-self: stretch; text-align: center; }
}

/* ============================================================
   LOGIN MODERNO — Split screen con hero gradiente + formulario limpio
   ============================================================ */
.login-split {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
@media (max-width: 900px) {
    .login-split { flex-direction: column; min-height: auto; }
}

/* Lado izquierdo: hero */
.login-hero {
    flex: 1.2;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: white;
    padding: 60px 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.login-hero-content {
    position: relative;
    z-index: 2;
    max-width: 440px;
    width: 100%;
}
.login-hero-logo {
    margin-bottom: 24px;
}
.login-hero-logo img { display: block; }
.login-hero-titulo {
    margin: 0 0 8px;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: white;
    text-transform: none;
}
.login-hero-tagline {
    margin: 0 0 40px;
    font-size: 15px;
    color: rgba(255,255,255,0.85);
}
.login-hero-features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.login-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.login-feature-ico {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}
.login-feature-ico svg {
    width: 22px;
    height: 22px;
    color: white;
}
.login-feature strong {
    display: block;
    color: white;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 3px;
}
.login-feature span {
    display: block;
    color: rgba(255,255,255,0.78);
    font-size: 13px;
}
/* Decoraciones de fondo */
.login-hero-decoracion-1, .login-hero-decoracion-2 {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}
.login-hero-decoracion-1 {
    width: 360px;
    height: 360px;
    top: -80px;
    right: -80px;
}
.login-hero-decoracion-2 {
    width: 240px;
    height: 240px;
    bottom: -60px;
    left: -60px;
    background: rgba(255,255,255,0.04);
}

/* Lado derecho: formulario */
.login-form-side {
    flex: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
}
.login-form-card {
    background: white;
    border-radius: 16px;
    padding: 40px 38px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.03);
    border: 0.5px solid #f1f5f9;
}
.login-form-head {
    margin-bottom: 28px;
    text-align: center;
}
.login-form-head h2 {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.3px;
    text-transform: none;
}
.login-form-head p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    text-transform: none;
}
.login-input-wrap {
    position: relative;
}
.login-input-ico {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
}
.login-input-ico svg { width: 18px; height: 18px; }
.login-input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #111827;
    background: white;
    transition: all 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}
.login-input-wrap input:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 4px rgba(30,64,175,0.1);
}
.login-input-wrap input:focus + .login-input-ico,
.login-input-wrap:focus-within .login-input-ico {
    color: #1e40af;
}
.login-submit {
    margin-top: 12px;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(30,64,175,0.25);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}
.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(30,64,175,0.35);
}
.login-submit svg {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
}
.login-submit:hover svg {
    transform: translateX(3px);
}
.login-form-foot {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
}

/* Cuando estamos en login, ocultar sidebar y main padding */
body:has(.login-split) .sidebar,
body:has(.login-split) .app > .sidebar { display: none !important; }
.login-split { margin: -30px -40px; }  /* compensar padding del main */
@media (max-width: 900px) {
    .login-hero { padding: 40px 24px; min-height: 280px; }
    .login-hero-titulo { font-size: 28px; }
    .login-hero-features { display: none; }  /* En móvil ocultar features */
    .login-form-side { padding: 30px 20px; }
    .login-form-card { padding: 28px 24px; }
}

/* ============================================================
   BANNER DE LISTADOS (clientes, unidades, conductores, etc.)
   Más compacto que el banner del dashboard, pero mismo lenguaje
   ============================================================ */
.lista-banner {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
    color: white;
    padding: 18px 24px;
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: 0 4px 14px rgba(30,64,175,0.18);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.lista-banner::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -40px;
    width: 160px;
    height: 160px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}
.lista-banner-icono {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.lista-banner-icono svg {
    width: 24px;
    height: 24px;
    color: white;
}
.lista-banner-texto {
    flex: 1;
    position: relative;
    z-index: 2;
    min-width: 0;
}
.lista-banner-texto h1 {
    margin: 0 0 3px;
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
    text-transform: none;
}
.lista-banner-texto p {
    margin: 0;
    color: rgba(255,255,255,0.85);
    font-size: 12px;
}
.btn-banner-primary {
    background: white;
    color: #1e40af;
    padding: 9px 18px;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-banner-primary:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    color: #1e3a8a;
}

@media (max-width: 640px) {
    .lista-banner { flex-direction: column; align-items: flex-start; padding: 16px 18px; }
    .btn-banner-primary { align-self: stretch; text-align: center; }
}

/* Ícono basado en imagen (PNG con su propio fondo) — sin el pastel del contenedor */
.accion-rapida-icono.accion-icono-imagen {
    background: transparent !important;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
}
.accion-rapida-icono.accion-icono-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 14px;
}

/* ============================================================
   MEJORAS SIDEBAR v8
   ============================================================ */

/* ===== MEJORA 4 — Header del brand con espacio para botones ===== */
.brand {
    position: relative;     /* para anclar el botón pin */
    justify-content: flex-start;
}

/* ===== MEJORA 2 — Botón pin (fijar sidebar abierta) =====
   Oculto en colapsado, aparece al expandir, click para fijar. */
.btn-pin-sidebar {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease 0.05s, background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-pin-sidebar svg { width: 16px; height: 16px; transform: rotate(45deg); }
.sidebar:hover .btn-pin-sidebar,
.sidebar:focus-within .btn-pin-sidebar,
.sidebar.sidebar-expandida-persist .btn-pin-sidebar,
.sidebar.sidebar-pineada .btn-pin-sidebar {
    opacity: 1;
    pointer-events: auto;
    border-color: #475569;
}
.btn-pin-sidebar:hover {
    background: rgba(30, 64, 175, 0.25);
    color: #cbd5e1;
    border-color: #64748b;
}
/* Estado FIJADO: fondo azul sólido + ícono derecho (no rotado) */
.sidebar.sidebar-pineada .btn-pin-sidebar {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}
.sidebar.sidebar-pineada .btn-pin-sidebar svg { transform: rotate(0deg); }

/* Cuando sidebar está pineada → siempre expandida en desktop */
@media (min-width: 901px) {
    .sidebar.sidebar-pineada { width: 240px; }
    .sidebar.sidebar-pineada .brand-texto,
    .sidebar.sidebar-pineada .nav-item-texto,
    .sidebar.sidebar-pineada .nav-section,
    .sidebar.sidebar-pineada .user-info,
    .sidebar.sidebar-pineada .btn-logout {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== MEJORA 3 — Tooltip personalizado con sección padre =====
   Aparece al hover sobre cada nav-item CUANDO sidebar está colapsada. */
.nav-item {
    position: relative;     /* anchor del tooltip */
}
.nav-item[data-seccion]::after,
.nav-item::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f1620;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #2d3a4f;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease 0.3s; /* delay 300ms como tooltip nativo */
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.nav-item[data-seccion]::after {
    content: attr(title) "\A" attr(data-seccion);
    white-space: pre;
    line-height: 1.5;
}
/* Solo mostrar tooltip cuando sidebar está COLAPSADA */
@media (min-width: 901px) {
    .sidebar:not(:hover):not(:focus-within):not(.sidebar-expandida-persist):not(.sidebar-pineada) .nav-item:hover::after {
        opacity: 1;
    }
}
/* En mobile (drawer abierto) no mostrar tooltip */
@media (max-width: 900px) {
    .nav-item::after { display: none; }
}
/* Flechita del tooltip */
.nav-item::before {
    content: '';
    position: absolute;
    left: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #0f1620;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease 0.3s;
    z-index: 100;
}
@media (min-width: 901px) {
    .sidebar:not(:hover):not(:focus-within):not(.sidebar-expandida-persist):not(.sidebar-pineada) .nav-item:hover::before {
        opacity: 1;
    }
}
/* Sección padre del tooltip en azul claro (visual) */
.nav-item[data-seccion]::after {
    background: #0f1620;
}

/* ===== MEJORA 1 — Mobile/Tablet: drawer + hamburguesa ===== */

/* Botón hamburguesa: oculto en desktop, visible en mobile */
.btn-hamburguesa {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
    background: #1a2332;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: none;       /* solo aparece en mobile */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.btn-hamburguesa span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* Overlay oscuro detrás del drawer (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.sidebar-overlay.sidebar-overlay-open {
    opacity: 1;
    pointer-events: auto;
}

/* Botón X (cerrar drawer): oculto siempre excepto en mobile con drawer abierto */
.btn-cerrar-sidebar {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 6px;
}
.btn-cerrar-sidebar svg { width: 18px; height: 18px; }
.btn-cerrar-sidebar:hover { background: #2d3a4f; color: white; }

/* === Comportamiento responsive: SOBREESCRIBE la regla anterior === */
@media (max-width: 900px) {
    .app { flex-direction: column; }

    /* Hamburguesa visible */
    .btn-hamburguesa { display: flex; }

    /* Sidebar oculto por defecto, aparece como drawer al abrir */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh !important;
        width: 280px !important;
        flex-direction: column !important;
        padding: 0 !important;
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        box-shadow: none;
    }
    .sidebar.sidebar-drawer-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    /* SOBREESCRIBIR la regla vieja que ponía display:none al .nav */
    .sidebar .nav { display: block !important; }

    /* En mobile siempre mostrar contenido expandido del drawer */
    .sidebar .brand-texto,
    .sidebar .nav-item-texto,
    .sidebar .nav-section,
    .sidebar .user-info,
    .sidebar .btn-logout {
        opacity: 1 !important;
        transform: translateX(0) !important;
    }

    /* Botón X visible en mobile dentro del drawer */
    .btn-cerrar-sidebar { display: flex; }
    /* Ocultar pin en mobile (no aplica al drawer) */
    .btn-pin-sidebar { display: none; }

    /* Main: espacio arriba para no tapar contenido con hamburguesa */
    .main { padding-top: 68px !important; }

    /* Logo de brand no debe quedar pegado al borde */
    .brand { padding: 20px 50px 20px 14px; }
}

/* ============================================================
   TABS DEL DASHBOARD (v10) — Cargas hoy / Descargas hoy y mañana
   ============================================================ */
.tabs-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}
.tabs-nav {
    display: flex;
    gap: 4px;
}
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 16px 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.15s, border-color 0.15s;
    position: relative;
    margin-bottom: -1px; /* alinear con border-bottom del contenedor */
    font-family: inherit;
}
.tab-btn:hover {
    color: #374151;
}
.tab-btn.active {
    color: #1e40af;
    border-bottom-color: #1e40af;
}
.tab-btn .tab-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    background: #e5e7eb;
    color: #374151;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.tab-btn.active .tab-badge {
    background: #dbeafe;
    color: #1e40af;
}
.tab-badge-rosa {
    background: #fce7f3;
    color: #9d174d;
}
.tab-btn.active .tab-badge-rosa {
    background: #fce7f3;
    color: #9d174d;
}

/* Paneles: solo el activo es visible */
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* Badge HOY / MAÑANA en tabla de descargas */
.badge-cuando {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.badge-cuando-hoy {
    background: #dbeafe;
    color: #1e40af;
}
.badge-cuando-manana {
    background: #ede9fe;
    color: #6d28d9;
}
.th-cuando { width: 90px; }
.row-descarga-hoy-tab { border-left: 3px solid #3b82f6; }
.row-descarga-manana-tab { border-left: 3px solid #8b5cf6; }

/* Variante de alerta para el KPI de descargas hoy (cuando hay > 0) */
.kpi-icono-rosa { background: #EC4899; color: #fff; }
.kpi-moderna-alerta-rosa {
    animation: kpi-alerta-rosa-pulso 2.5s ease-in-out infinite;
}
@keyframes kpi-alerta-rosa-pulso {
    0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02); }
    50%      { box-shadow: 0 0 0 4px rgba(236,72,153,0.15), 0 4px 12px rgba(236,72,153,0.12); }
}

/* En mobile el tab-header se apila verticalmente */
@media (max-width: 640px) {
    .tabs-header {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-compartir-header {
        align-self: flex-end;
    }
    .tab-btn {
        padding: 10px 12px 12px;
        font-size: 12.5px;
    }
}

/* ============================================================
   WIZARD CIERRE DE DÍA (v11)
   ============================================================ */
.wizard-cerrar-dia-container {
    max-width: 920px;
    margin: 0 auto;
    padding: 8px 0 40px;
}
.wizard-intro {
    margin-bottom: 20px;
}
.wizard-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #1e40af;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 10px;
    padding: 4px 0;
    transition: color 0.15s ease;
}
.wizard-breadcrumb:hover {
    color: #1e3a8a;
    text-decoration: underline;
}
.wizard-breadcrumb svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.wizard-intro h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #0f172a;
}
.wizard-intro-sub {
    color: #64748b;
    font-size: 13.5px;
    margin: 0 0 14px;
    line-height: 1.5;
}
.wizard-intro-meta {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #475569;
    margin-bottom: 14px;
}
.wizard-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.wizard-meta-item strong {
    color: #1e40af;
}

/* Aviso colapsable con las consecuencias del cierre */
.wizard-aviso-consecuencias {
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 0;
    font-size: 12.5px;
}
.wizard-aviso-consecuencias summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    color: #713f12;
    list-style: none;
    user-select: none;
}
.wizard-aviso-consecuencias summary::-webkit-details-marker { display: none; }
.wizard-aviso-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #facc15;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.wizard-aviso-toggle {
    color: #a16207;
    font-weight: 500;
    margin-left: 6px;
    text-decoration: underline;
}
.wizard-aviso-consecuencias[open] .wizard-aviso-toggle::after {
    content: ' ▲';
}
.wizard-aviso-consecuencias:not([open]) .wizard-aviso-toggle::after {
    content: ' ▼';
}
.wizard-aviso-consecuencias ul {
    margin: 0;
    padding: 0 16px 14px 50px;
    line-height: 1.7;
    color: #713f12;
}
.wizard-aviso-consecuencias li {
    margin-bottom: 3px;
}

/* === Card del wizard === */
.wizard-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* Barra de progreso superior */
.wizard-progress {
    height: 4px;
    background: #e0e7ff;
}
.wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    transition: width 0.3s ease;
}

/* Header del wizard (debajo de la barra) */
.wizard-header {
    background: #1e3a8a;
    color: white;
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wizard-step-label {
    font-size: 15px;
    font-weight: 700;
}
.wizard-step-percent {
    font-size: 11.5px;
    color: #bfdbfe;
    margin-top: 2px;
}

/* Botón "Cancelar" del header — pill discreto pero visible */
.wizard-btn-cerrar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.wizard-btn-cerrar:hover {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(220, 38, 38, 1);
}
.wizard-btn-cerrar svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Botón "← Anterior / Revisar gastos" — secundario claro */
.wizard-btn-volver {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.wizard-btn-volver:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}
.wizard-btn-volver:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.wizard-btn-volver svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Botón X (cerrar) del form de gasto — ícono limpio */
.wizard-form-cerrar {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}
.wizard-form-cerrar:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
.wizard-form-cerrar svg {
    width: 16px;
    height: 16px;
}

/* Cada pantalla del wizard */
.wizard-screen {
    display: none;
    padding: 22px;
}
.wizard-screen.active {
    display: block;
}

/* Card de info del servicio */
.wizard-servicio-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
}
.wizard-servicio-cliente {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}
.wizard-servicio-numero {
    font-size: 11.5px;
    color: #94a3b8;
    margin-bottom: 8px;
}
.wizard-servicio-row {
    font-size: 13px;
    color: #475569;
    margin-top: 4px;
    line-height: 1.5;
}

/* Pregunta inicial */
.wizard-pregunta {
    text-align: center;
    padding: 12px 0;
}
.wizard-pregunta-titulo {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
}
.wizard-pregunta-help {
    font-size: 12.5px;
    color: #64748b;
    margin: 0 0 22px;
}
.wizard-pregunta-botones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.wizard-btn-grande {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    color: white;
    transition: transform 0.1s, box-shadow 0.15s;
    font-family: inherit;
}
.wizard-btn-grande:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.wizard-btn-no { background: #10b981; }
.wizard-btn-no:hover { background: #059669; }
.wizard-btn-si { background: #f59e0b; }
.wizard-btn-si:hover { background: #d97706; }
.wizard-btn-icono {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}
.wizard-btn-texto {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}
.wizard-btn-sub {
    font-size: 11.5px;
    opacity: 0.92;
}

/* Lista de gastos agregados */
.wizard-gastos-lista {
    margin-bottom: 14px;
}
.wizard-gasto-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}
.wizard-gasto-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.wizard-gasto-tipo {
    font-weight: 700;
    font-size: 13px;
    color: #14532d;
}
.wizard-gasto-importe {
    font-weight: 700;
    color: #0f172a;
    font-size: 13.5px;
}
.wizard-gasto-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 10px;
}
.wizard-gasto-badge-fact { background: #dbeafe; color: #1e40af; }
.wizard-gasto-badge-sin { background: #fef3c7; color: #92400e; }
.wizard-gasto-badge-pagado { background: #dcfce7; color: #166534; }
.wizard-gasto-badge-pendiente { background: #fee2e2; color: #991b1b; }
.wizard-gasto-chip {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #334155;
}
.wizard-gasto-chip-ci { background: #ede9fe; color: #5b21b6; }
.wizard-gasto-chip-form { background: #dbeafe; color: #1e40af; }
.wizard-gasto-quitar {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}
.wizard-gasto-quitar:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* Form gasto */
.wizard-form-gasto {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
}
.wizard-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.wizard-form-header h3 {
    font-size: 14.5px;
    font-weight: 700;
    color: #92400e;
    margin: 0;
}
.wizard-form-grupo {
    margin-bottom: 14px;
}
.wizard-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 5px;
}
.req { color: #dc2626; }
.wizard-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13.5px;
    background: white;
    font-family: inherit;
    box-sizing: border-box;
}
.wizard-input:focus {
    border-color: #1e40af;
    outline: none;
    box-shadow: 0 0 0 3px rgba(30,64,175,0.12);
}
.wizard-input-importe {
    max-width: 220px;
}
.wizard-radio-group {
    display: flex;
    gap: 22px;
}
.wizard-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}
.wizard-radio input[type="radio"] {
    margin: 0;
}
.wizard-caja-factura {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 14px;
    margin: 6px 0 14px;
}
.wizard-caja-sin-factura {
    margin: 6px 0 14px;
}
.wizard-caja-info {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 8px 12px;
    color: #92400e;
    font-size: 12.5px;
    font-weight: 600;
}
.wizard-caja-titulo {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 10px;
}
.wizard-form-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    margin: 8px 0;
}
.wizard-form-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

/* Footer del wizard (Anterior / Siguiente) */
.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0 4px;
    border-top: 1px solid #e5e7eb;
    margin-top: 16px;
}
.wizard-footer-mid {
    flex: 1;
    text-align: center;
}
.wizard-btn-agregar-otro {
    background: white;
    border: 1px solid #1e40af;
    color: #1e40af;
}
.wizard-btn-agregar-otro:hover {
    background: #eff6ff;
}

/* Pantalla final */
.wizard-final-header {
    text-align: center;
    margin-bottom: 22px;
}
.wizard-final-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #dcfce7;
    color: #059669;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}
.wizard-final-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
}
.wizard-final-header p {
    color: #475569;
    font-size: 13.5px;
    margin: 0;
}

.wizard-final-tabla-wrapper {
    margin: 18px 0;
}
.wizard-final-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.wizard-final-tabla th {
    background: #f1f5f9;
    color: #64748b;
    text-transform: uppercase;
    font-size: 10.5px;
    font-weight: 700;
    padding: 9px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.wizard-final-tabla td {
    padding: 9px 10px;
    border-bottom: 1px solid #f1f5f9;
}
.wizard-final-tabla tfoot td {
    border-top: 2px solid #cbd5e1;
    border-bottom: none;
    background: #f8fafc;
    font-size: 13.5px;
}
.text-right { text-align: right; }
.estado-pago-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
}
.estado-pago-pagado { background: #dcfce7; color: #166534; }
.estado-pago-pendiente { background: #fee2e2; color: #991b1b; }
.wizard-final-vacio {
    text-align: center;
    padding: 24px;
    color: #64748b;
    font-size: 13px;
    background: #f8fafc;
    border-radius: 8px;
}

.wizard-final-aviso {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 12px 16px;
    color: #991b1b;
    font-size: 12.5px;
    line-height: 1.5;
    margin: 18px 0;
}
.wizard-final-aviso strong { display: block; margin-bottom: 4px; }

.btn-confirmar-cierre {
    background: #dc2626;
    color: white;
    border: none;
    padding: 11px 22px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.btn-confirmar-cierre:hover {
    background: #b91c1c;
}

/* Responsive */
@media (max-width: 720px) {
    .wizard-pregunta-botones { grid-template-columns: 1fr; }
    .wizard-radio-group { flex-direction: column; gap: 8px; }
    .wizard-footer { flex-wrap: wrap; }
    .wizard-final-tabla { font-size: 11.5px; }
}

/* === Avisos cuando hay gastos previos guardados (v11 — fix UX al reabrir día) === */

/* Banner global encima del card del wizard */
.wizard-aviso-recordados {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    color: #14532d;
    font-size: 13px;
    line-height: 1.5;
}
.wizard-aviso-recordados svg {
    width: 22px;
    height: 22px;
    color: #16a34a;
    flex-shrink: 0;
    margin-top: 1px;
}
.wizard-aviso-recordados strong {
    color: #14532d;
}

/* Banner por servicio (cuando el servicio actual ya tiene gastos guardados) */
.wizard-gastos-previos-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    color: #065f46;
    font-size: 12.5px;
    line-height: 1.4;
}
.wizard-gastos-previos-banner svg {
    width: 20px;
    height: 20px;
    color: #10b981;
    flex-shrink: 0;
    margin-top: 1px;
}
.wizard-gastos-previos-banner div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.wizard-gastos-previos-banner strong {
    color: #065f46;
}
.wizard-gastos-previos-banner span {
    color: #047857;
}

/* ============================================================
   FORMULARIO DE SERVICIO CON TABS (v12)
   Wizard al crear / Libre al editar
   ============================================================ */

/* Barra de tabs */
.tabs-servicio {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin: 18px 0 0;
    padding: 0;
    border-bottom: 2px solid #e5e7eb;
    background: transparent;
}
.tab-servicio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 14px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: #94a3b8;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    margin-bottom: -2px; /* alinear con border-bottom del contenedor */
    position: relative;
}
.tab-servicio:hover:not(:disabled):not(.tab-bloqueado) {
    background: #f8fafc;
    color: #475569;
}
.tab-servicio.active {
    color: #0f172a;
    border-bottom-color: #1e40af;
}
.tab-servicio.active .tab-servicio-titulo {
    color: #0f172a;
}
.tab-servicio.tab-bloqueado {
    cursor: not-allowed;
    opacity: 0.55;
}
.tab-servicio.tab-completo .tab-servicio-titulo {
    color: #047857;
}
.tab-servicio-num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #cbd5e1;
    font-size: 13px;
    font-weight: 700;
    color: #94a3b8;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tab-servicio.active .tab-servicio-num {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
}
.tab-servicio.tab-completo .tab-servicio-num {
    background: #10b981;
    border-color: #10b981;
    color: white;
}
.tab-servicio.tab-completo .tab-servicio-num .num-label {
    display: none;
}
.tab-servicio.tab-completo .tab-servicio-num::before {
    content: '✓';
    font-size: 14px;
}
.tab-servicio.active.tab-completo .tab-servicio-num {
    background: #1e40af;
    border-color: #1e40af;
}
.tab-servicio.active.tab-completo .tab-servicio-num::before {
    content: '';
}
.tab-servicio.active.tab-completo .tab-servicio-num .num-label {
    display: inline;
}
.tab-servicio-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}
.tab-servicio-titulo {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tab-servicio-sub {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Aviso de modo activo (debajo de tabs) */
.tabs-modo-aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 14px 0 18px;
    font-size: 12.5px;
    line-height: 1.4;
}
.tabs-modo-aviso .modo-icono {
    font-size: 16px;
    flex-shrink: 0;
}
.tabs-modo-crear {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}
.tabs-modo-editar {
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    color: #155e75;
}

/* Banner de error de validación */
.tabs-error-validacion {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    color: #991b1b;
    margin: 12px 0 18px;
    font-size: 13px;
    line-height: 1.5;
}
.tabs-error-validacion svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #dc2626;
}

/* Paneles: solo el activo es visible */
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* Cuando estamos en tabs, NO mostrar el step-header (es redundante) */
.servicio-form-tabs .tab-panel .step-header {
    display: none;
}

/* Footer con navegación wizard */
.tabs-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tabs-footer-mid {
    flex: 1;
    text-align: center;
}
.btn-wizard-anterior {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-wizard-anterior svg {
    width: 16px;
    height: 16px;
}
.btn-wizard-anterior:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-wizard-siguiente {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-wizard-siguiente svg {
    width: 16px;
    height: 16px;
}
.btn-cancelar-wizard {
    color: #94a3b8;
    font-size: 12.5px;
}
.btn-cancelar-wizard:hover {
    color: #dc2626;
}

/* === Modo EDITAR: campos modificados resaltados === */
.campo-modificado {
    border-color: #facc15 !important;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.12) !important;
}
.btn-hay-cambios {
    animation: btn-pulso-cambios 1.8s ease-in-out infinite;
}
@keyframes btn-pulso-cambios {
    0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
    50%      { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22); }
}

/* Responsive: en pantallas chicas los tabs se apilan o muestran solo número */
@media (max-width: 900px) {
    .tabs-servicio {
        grid-template-columns: repeat(5, auto);
        overflow-x: auto;
        scrollbar-width: thin;
    }
    .tab-servicio-info {
        display: none;
    }
    .tab-servicio.active .tab-servicio-info {
        display: flex;
    }
}

/* ============================================================
   CASCADA VISUAL DEL PASO "UNIDAD ASIGNADA" (Fase 1, v13)
   Cards fantasma del próximo paso pendiente.
   ============================================================ */

/* Cards fantasma: placeholder tenue del próximo campo que va a aparecer */
.cascada-fantasma {
    background: transparent;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    min-height: 56px;
    box-sizing: border-box;
}
.cascada-fantasma:hover {
    border-color: #94a3b8;
}
.fantasma-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.4;
}
.fantasma-arrow {
    font-size: 16px;
    color: #cbd5e1;
}
.fantasma-text strong {
    color: #64748b;
    font-weight: 600;
}

/* ============================================================
   LAYOUT TAB 'UNIDAD ASIGNADA' — Opción B (v13.2)
   ETA y Flete Subcontratado lado a lado.

   Grid base: 6 columnas. Distribución:
   - Fila 1: Tracto / Carreta / Conductor → 2 cols cada uno (6 total)
   - Fila 2: ETA (4 cols) + Flete (2 cols) = 6
   - Fila 3: Detalles cliente → 6 cols (form-group-wide)

   Cuando NO aplica flete (tracto propio): el ETA se expande a 6 cols.
   Cuando es FURGÓN (sin carreta): tracto y conductor ocupan 3 cada uno.
   ============================================================ */
.form-grid-cascada {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

/* Por defecto, los pasos reales (Tracto, Carreta, Conductor) ocupan 2 columnas */
.form-grid-cascada > .cascada-paso-tracto,
.form-grid-cascada > .cascada-paso-carreta,
.form-grid-cascada > .cascada-paso-conductor {
    grid-column: span 2;
}

/* Fantasmas también ocupan 2 columnas para mantener alineación */
.form-grid-cascada > .cascada-fantasma-carreta,
.form-grid-cascada > .cascada-fantasma-conductor {
    grid-column: span 2;
}

/* ETA ocupa 4 columnas por defecto (62% del ancho aprox) y 2 filas de alto
   (para que Flete arriba + Detalles abajo quepan a su derecha).
   Usamos !important para ganar sobre `.form-group-wide` (que aplica grid-column: 1 / -1).
   El HTML legacy mantiene form-group-wide por compatibilidad con CSS no-cascada. */
.form-grid-cascada > .cascada-paso-eta {
    grid-column: span 4 !important;
    grid-row: span 2;  /* ETA es alto, ocupa 2 filas */
}
.form-grid-cascada > .cascada-fantasma-eta {
    grid-column: span 4 !important;
}

/* Flete Subcontratado: a la derecha del ETA, fila superior */
.form-grid-cascada > .cascada-paso-flete {
    grid-column: span 2 !important;
}
.form-grid-cascada > .cascada-fantasma-flete {
    grid-column: span 2 !important;
}

/* Detalles del cliente (etiquetas): a la derecha del ETA, debajo del Flete.
   Ocupa 2 columnas como el Flete, en la fila siguiente del grid implícito.
   Si el Flete está oculto, los detalles se ubican solos a la derecha. */
.form-grid-cascada > .cascada-paso-etiquetas {
    grid-column: span 2 !important;
}
.form-grid-cascada > .cascada-fantasma-etiquetas {
    grid-column: span 2 !important;
}

/* Cuando el flete está OCULTO (tracto propio): clase `.sin-flete` aplicada por JS.
   El ETA NO se expande a 6 cols: deja espacio a la derecha para los Detalles. */
.form-grid-cascada.sin-flete > .cascada-paso-eta {
    grid-column: span 4 !important;
    grid-row: span 2;
}
.form-grid-cascada.sin-flete > .cascada-fantasma-eta {
    grid-column: span 4 !important;
}

/* Excepción al 'sin-flete': si TAMBIÉN están ocultos los detalles
   (cliente sin etiquetas), el ETA recupera ancho completo.
   Esta clase la aplica el JS cuando detecta ambos ocultos. */
.form-grid-cascada.sin-flete.sin-detalles > .cascada-paso-eta {
    grid-column: span 6 !important;
}
.form-grid-cascada.sin-flete.sin-detalles > .cascada-fantasma-eta {
    grid-column: span 6 !important;
}

/* Cuando es FURGÓN (no necesita carreta): tracto y conductor ocupan 3 cols cada uno. */
.form-grid-cascada.es-furgon > .cascada-paso-tracto,
.form-grid-cascada.es-furgon > .cascada-paso-conductor {
    grid-column: span 3;
}

/* form-group-wide (Detalles del cliente, fantasma de etiquetas) ocupa todo */
.form-grid-cascada > .form-group-wide {
    grid-column: 1 / -1;
}

/* Estilo extra para destacar el flete subcontratado (card amarilla tenue) */
.form-grid-cascada > .cascada-paso-flete {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 14px 16px;
}
.form-grid-cascada > .cascada-paso-flete label {
    color: #92400e;
}

/* Tracto/Carreta/Conductor: alineación visual del hint debajo del select */
.form-grid-cascada > .cascada-paso-tracto small.info-muted {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.3;
    min-height: 14px;
}

/* Responsive: en tablets/laptops pequeñas (≤900px), el flete pasa abajo del ETA.
   Antes era 1100px pero con el sidebar de navegación y márgenes, la mayoría de
   monitores de escritorio tenían menos de 1100px efectivos y caían en este modo.
   900px es el umbral correcto para distinguir "tablet/portátil chico" de
   "monitor de escritorio normal". */
@media (max-width: 900px) {
    .form-grid-cascada {
        grid-template-columns: repeat(3, 1fr);
    }
    .form-grid-cascada > .cascada-paso-tracto,
    .form-grid-cascada > .cascada-paso-carreta,
    .form-grid-cascada > .cascada-paso-conductor,
    .form-grid-cascada > .cascada-fantasma-carreta,
    .form-grid-cascada > .cascada-fantasma-conductor {
        grid-column: span 1 !important;
    }
    .form-grid-cascada > .cascada-paso-eta,
    .form-grid-cascada > .cascada-fantasma-eta {
        grid-column: 1 / -1 !important;
    }
    .form-grid-cascada > .cascada-paso-flete,
    .form-grid-cascada > .cascada-fantasma-flete {
        grid-column: 1 / -1 !important;
    }
}

/* En pantallas muy pequeñas: 1 columna */
@media (max-width: 700px) {
    .form-grid-cascada {
        grid-template-columns: 1fr;
    }
    .form-grid-cascada > * {
        grid-column: 1 / -1 !important;
    }
}

/* Animación suave al aparecer un paso real (fade in + ligero slide) */
.cascada-paso {
    animation: cascada-fade-in 0.25s ease-out;
}
@keyframes cascada-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Solo animar si display fue cambiado recientemente (no en cada render).
   Truco: solo aplicar la animación cuando NO sea visible originalmente.
   El JS añade .cascada-acaba-aparecer cuando muestra el paso. */

/* ============================================================
   WIZARD ETA / Ya está en planta (v13.1)
   Pregunta con 2 botones, chips de hora rápida, atajos de teclado.
   ============================================================ */
.eta-wizard {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}
.eta-wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}
.eta-wizard-titulo {
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
}
.eta-wizard-sub {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}
.eta-atajos-hint {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.eta-atajo {
    font-size: 10.5px;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.eta-atajo kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 6px;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    box-shadow: 0 1px 0 #cbd5e1;
}

/* Botones grandes de pregunta */
.eta-wizard-botones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.eta-btn-grande {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all 0.15s ease;
    position: relative;
    min-height: 76px;
}
.eta-btn-grande:hover:not(.active) {
    border-color: #94a3b8;
    background: #f8fafc;
}
.eta-btn-icono {
    font-size: 26px;
    flex-shrink: 0;
    line-height: 1;
    width: 32px;
    text-align: center;
}
.eta-btn-contenido {
    flex: 1;
    min-width: 0;
}
.eta-btn-titulo {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 3px;
}
.eta-btn-sub {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.3;
}
.eta-btn-default-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #1e40af;
    color: white;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.eta-btn-camino.active .eta-btn-default-badge {
    /* Cuando "camino" está activo (default), mostrar el badge */
    opacity: 1;
}
/* Si el usuario cambió a "planta", el badge ya no debería destacar */
.eta-btn-camino:not(.active) .eta-btn-default-badge {
    opacity: 0;
}

/* Estados activos */
.eta-btn-camino.active {
    border-color: #1e40af;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}
.eta-btn-camino.active .eta-btn-titulo,
.eta-btn-camino.active .eta-btn-icono {
    color: #1e40af;
}
.eta-btn-planta.active {
    border-color: #10b981;
    background: #dcfce7;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.eta-btn-planta.active .eta-btn-titulo {
    color: #15803d;
}
.eta-btn-planta.active .eta-btn-icono {
    color: #16a34a;
}

/* Caja de ingreso de ETA (visible cuando "camino" activo) */
.eta-caja-ingresar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 14px 16px;
    animation: eta-fade-in 0.2s ease-out;
}
@keyframes eta-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.eta-caja-label {
    display: block;
    margin-bottom: 10px;
}
.eta-caja-titulo {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #1e3a8a;
}
.eta-caja-sub {
    display: block;
    font-size: 11px;
    color: #475569;
    margin-top: 2px;
}
.eta-caja-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
}
.eta-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.eta-input-icon {
    position: absolute;
    left: 12px;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}
.eta-input-grande {
    padding: 10px 12px 10px 38px !important;
    font-size: 18px !important;
    font-weight: 700;
    border: 2px solid #1e40af !important;
    border-radius: 8px;
    background: white;
    width: 180px;
    color: #0f172a;
    font-family: inherit;
}
.eta-input-grande:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.18);
}
.eta-input-grande:disabled {
    background: #f3f4f6;
    border-color: #d1d5db !important;
    color: #94a3b8;
}

/* Chips de hora rápida */
.eta-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.eta-chips-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    margin-right: 2px;
}
.eta-chip {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #1e40af;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s ease;
    min-width: 78px;
    text-align: center;
}
.eta-chip:hover {
    background: #eff6ff;
    border-color: #1e40af;
    transform: translateY(-1px);
}
.eta-chip-activo {
    background: #1e40af;
    border-color: #1e40af;
    color: white;
}
.eta-chip-activo:hover {
    background: #1e3a8a;
    color: white;
}

.eta-help {
    display: block;
    margin-top: 10px;
    font-size: 10.5px;
}

/* Caja de confirmación (visible cuando "planta" activo) */
.eta-caja-confirmacion {
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: eta-fade-in 0.2s ease-out;
}
.eta-conf-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #16a34a;
    color: white;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.eta-conf-texto {
    color: #14532d;
    font-size: 12.5px;
    line-height: 1.5;
}
.eta-conf-texto strong {
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
}
.eta-conf-texto code {
    background: rgba(22, 163, 74, 0.15);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

/* Responsive: en pantallas chicas apilamos */
@media (max-width: 720px) {
    .eta-wizard-botones { grid-template-columns: 1fr; }
    .eta-wizard-header { flex-direction: column; }
    .eta-atajos-hint { flex-direction: row; flex-wrap: wrap; }
    .eta-caja-grid { grid-template-columns: 1fr; }
    .eta-input-grande { width: 100%; }
}

/* ============================================================
   DROPDOWN ENRIQUECIDO — Tracto / Carreta / Conductor (v14)
   Cada opción del dropdown muestra:
     - Línea 1: placa o nombre (grande, destacado) + badge propio/3°
     - Línea 2: empresa transportista (+ DNI en conductor)
   ============================================================ */

/* Layout de cada opción del dropdown */
.choices__list--dropdown .opt-enriquecido,
.choices__list[aria-expanded] .opt-enriquecido {
    padding: 10px 14px;
    line-height: 1.3;
}
.choices__list--dropdown .opt-enriquecido + .opt-enriquecido,
.choices__list[aria-expanded] .opt-enriquecido + .opt-enriquecido {
    border-top: 1px solid #f1f5f9;
}

/* Fila superior: placa + badge */
.opt-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.opt-label {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    letter-spacing: 0.3px;
}

/* Meta (empresa + dni) en línea separada, más tenue */
.opt-meta {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
    font-weight: 400;
}

/* Variante "RUC X..." en monospace para mayor legibilidad numérica. */
.opt-meta-ruc {
    font-family: 'Courier New', monospace;
    color: #475569;
    letter-spacing: 0.3px;
}

/* Variante "Sin RUC registrado" para clientes sin RUC en BD: gris claro
   y cursiva para indicar que es información ausente, no un valor real. */
.opt-meta-sin-ruc {
    color: #cbd5e1;
    font-style: italic;
    font-size: 10px;
}

/* Badges propia/subcontratado */
.opt-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.opt-badge-propia {
    background: #dcfce7;
    color: #15803d;
}
.opt-badge-subc {
    background: #fef3c7;
    color: #92400e;
}

/* Hover y selected en opciones enriquecidas */
.choices__list--dropdown .opt-enriquecido.is-highlighted,
.choices__list[aria-expanded] .opt-enriquecido.is-highlighted {
    background: #eff6ff;
}
.opt-enriquecido[data-choice-selectable]:hover {
    background: #f1f5f9;
}

/* En el item seleccionado (control principal), mantener look limpio:
   solo se ve la placa/nombre, sin badges ni meta. Eso ya lo controla
   el template 'item' del config, pero por si acaso forzamos: */
.choices__item.choices__item--selectable .opt-meta,
.choices__item.choices__item--selectable .opt-badge {
    display: none;
}

/* ============================================================
   FIX: dropdown enriquecido debe quedar SOBRE el footer sticky
   El footer del wizard usa position:sticky con z-index 10-50,
   forzamos el dropdown a estar muy arriba.
   ============================================================ */
.choices__list--dropdown,
.choices__list[aria-expanded] {
    z-index: 9999 !important;
    /* Asegurar que el dropdown se renderice como overlay verdadero */
    position: absolute;
}
/* El contenedor del Choices a veces hereda overflow:hidden del padre,
   lo cual recorta el dropdown si es más alto que el contenedor. */
.choices.is-open {
    z-index: 9999;
}
.choices {
    position: relative;
}

/* ============================================================
   CASCADA VISUAL EN MODAL "Asignar unidad"
   El modal usa form-grid 2 columnas. Los bloques aparecen
   progresivamente igual que en el form principal.
   Diferencia clave vs cascada del form: aquí el grid es de 2 cols
   (no 6), por simplicidad — el modal es más estrecho.
   ============================================================ */

/* Cards fantasma del modal: cuadrados grises con flecha y texto
   indicando qué viene después. Estilo similar a las fantasmas del
   form principal, adaptadas al tamaño del modal. */
.cascada-modal-fantasma {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 10px 14px;
    color: #94a3b8;
    font-size: 12px;
    display: flex;
    align-items: center;
    min-height: 42px;
}
.cascada-modal-fantasma .fantasma-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.cascada-modal-fantasma .fantasma-arrow {
    color: #cbd5e1;
    font-size: 14px;
}
.cascada-modal-fantasma .fantasma-text strong {
    color: #64748b;
    font-weight: 600;
}

/* Bloque ETA dentro del modal: contenedor azulado con bordes y padding */
.cascada-modal-eta .eta-wizard {
    background: #f8fafc;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
}
.cascada-modal-eta .eta-wizard-titulo {
    color: #0f172a;
    font-weight: 600;
}
.cascada-modal-eta .eta-wizard-sub {
    color: #64748b;
}

/* Botones grandes del modal (NO viene en camino / SÍ en planta) */
.cascada-modal-eta .eta-wizard-botones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.cascada-modal-eta .eta-btn-grande {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: all 0.15s;
}
.cascada-modal-eta .eta-btn-grande:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}
.cascada-modal-eta .eta-btn-grande.active.eta-btn-camino {
    border-color: #1e40af;
    background: #eff6ff;
    border-width: 2px;
}
.cascada-modal-eta .eta-btn-grande.active.eta-btn-planta {
    border-color: #16a34a;
    background: #dcfce7;
    border-width: 2px;
}
.cascada-modal-eta .eta-btn-icono {
    font-size: 18px;
    flex-shrink: 0;
}
.cascada-modal-eta .eta-btn-textos {
    flex: 1;
    min-width: 0;
}
.cascada-modal-eta .eta-btn-titulo {
    font-weight: 600;
    font-size: 12px;
    color: #0f172a;
}
.cascada-modal-eta .eta-btn-grande.active.eta-btn-camino .eta-btn-titulo { color: #1e40af; }
.cascada-modal-eta .eta-btn-grande.active.eta-btn-planta .eta-btn-titulo { color: #16a34a; }
.cascada-modal-eta .eta-btn-sub {
    font-size: 10px;
    color: #64748b;
    margin-top: 1px;
}
.cascada-modal-eta .eta-btn-default-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #1e40af;
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 0.15s;
}
.cascada-modal-eta .eta-btn-grande.active.eta-btn-camino .eta-btn-default-badge {
    opacity: 1;
}
.cascada-modal-eta .eta-btn-grande.active.eta-btn-planta .eta-btn-default-badge {
    opacity: 0;  /* No mostrar badge si eligió planta */
}

/* Caja de confirmación "ya está en planta" */
.cascada-modal-eta .eta-caja-confirmacion {
    background: #dcfce7;
    border: 1px solid #16a34a;
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.cascada-modal-eta .eta-conf-icono {
    font-size: 18px;
    color: #15803d;
    flex-shrink: 0;
}
.cascada-modal-eta .eta-conf-texto strong {
    color: #15803d;
    display: block;
    margin-bottom: 2px;
}
.cascada-modal-eta .eta-conf-texto code {
    background: rgba(0,0,0,0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
}

/* Chips ETA del modal: pequeños, en línea */
.cascada-modal-eta .eta-chips {
    display: flex;
}
.cascada-modal-eta .eta-chip {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    background: white;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}
.cascada-modal-eta .eta-chip:hover {
    border-color: #1e40af;
    color: #1e40af;
}
.cascada-modal-eta .eta-chip.eta-chip-activo {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

/* ============================================================
   REASIGNACIÓN DE UNIDAD (Fase 4)
   Banner naranja-rojo en el tab "Unidad" del form Editar Servicio
   cuando el estado del servicio implica matriz REAS (8-12).
   ============================================================ */
.aviso-reasignacion {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 0 0 18px 0;
    color: #7f1d1d;
    font-size: 13px;
    line-height: 1.5;
}
.aviso-reasignacion-mensaje {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}
.aviso-reasignacion-icono {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}
.aviso-reasignacion strong { color: #991b1b; font-size: 14px; }
.aviso-reasignacion small  { color: #7f1d1d; }
.aviso-reasignacion code {
    background: #fee2e2;
    color: #991b1b;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    letter-spacing: 0.2px;
}
.btn-reasignar {
    background: #dc2626;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}
.btn-reasignar:hover { background: #b91c1c; }
.btn-reasignar:active { background: #991b1b; }

/* Modal Reasignación: campos motivo */
.reasignacion-motivo-grupo {
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.reasignacion-motivo-grupo > label {
    font-weight: 600;
    color: #713f12;
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}
.reasignacion-motivo-grupo select,
.reasignacion-motivo-grupo textarea {
    width: 100%;
    box-sizing: border-box;
}
.reasignacion-motivo-grupo textarea {
    margin-top: 8px;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
}
.reasignacion-snapshot {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #4b5563;
}
.reasignacion-snapshot strong { color: #1f2937; }

/* ============================================================
   AJUSTES MODAL REASIGNACIÓN (v32)
   Aseguramos que el modal sea scrollable cuando el zoom del browser
   reduce el espacio vertical disponible.
   ============================================================ */
#modal-reasignacion .quick-modal-dialog {
    /* Reducir max-height para garantizar margen alrededor incluso con zoom. */
    max-height: calc(100vh - 40px);
}
#modal-reasignacion .quick-modal-body {
    /* El body es el área scrollable: header/footer se quedan visibles arriba/abajo. */
    overflow-y: auto;
    max-height: calc(100vh - 180px);  /* deja espacio para header+footer */
}
#modal-reasignacion .quick-modal-footer {
    /* Footer fijo en el fondo del dialog, siempre visible. */
    flex-shrink: 0;
    border-top: 1px solid var(--line);
    padding: 12px 20px;
    background: white;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
@media (max-height: 600px) {
    #modal-reasignacion .quick-modal-body {
        max-height: calc(100vh - 130px);
    }
}

/* ============================================================
   RESUMEN DE REASIGNACIONES EN FORM (v33)
   Bloque colapsable abajo del banner. Lista las últimas 3 con
   link al historial completo /servicios/<id>/reasignaciones.
   ============================================================ */
.reasignaciones-resumen {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 4px solid #ea580c;
    border-radius: 8px;
    margin: 0 0 16px 0;
    padding: 0;
    font-size: 13px;
}
.reasignaciones-resumen > summary {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #7c2d12;
    user-select: none;
    list-style: none;
}
.reasignaciones-resumen > summary::-webkit-details-marker { display: none; }
.reasignaciones-resumen > summary::before {
    content: '▸';
    margin-right: 8px;
    transition: transform 0.15s;
    display: inline-block;
}
.reasignaciones-resumen[open] > summary::before { transform: rotate(90deg); }
.reasignaciones-resumen-count {
    background: #fed7aa;
    color: #7c2d12;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.reasignaciones-resumen-lista {
    padding: 0 16px 12px 16px;
    border-top: 1px solid #fed7aa;
    margin-top: 0;
}
.reasignaciones-resumen-item {
    padding: 10px 0;
    border-bottom: 1px dashed #fed7aa;
}
.reasignaciones-resumen-item:last-of-type { border-bottom: none; }
.reasignaciones-resumen-meta {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 4px;
}
.reasignaciones-resumen-meta strong { color: #1f2937; }
.reasignaciones-resumen-cambios {
    font-size: 12px;
    color: #374151;
    font-family: ui-monospace, monospace;
}
.reasignaciones-resumen-detalle {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}
.reasignaciones-resumen-ver-mas {
    padding-top: 12px;
    text-align: right;
    border-top: 1px solid #fed7aa;
    margin-top: 8px;
}
.reasignaciones-resumen-ver-mas a {
    color: #c2410c;
    font-weight: 600;
    text-decoration: none;
    font-size: 12px;
}
.reasignaciones-resumen-ver-mas a:hover { text-decoration: underline; }

.causa-tag-mini {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: #fee2e2;
    color: #991b1b;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}
.causa-tag-mini.causa-averia-mecanica { background: #fef3c7; color: #92400e; }
.causa-tag-mini.causa-accidente-ruta { background: #fee2e2; color: #991b1b; }
.causa-tag-mini.causa-conductor-no-disponible { background: #ddd6fe; color: #5b21b6; }
.causa-tag-mini.causa-problema-documentario { background: #fef9c3; color: #713f12; }
.causa-tag-mini.causa-otro { background: #f3f4f6; color: #4b5563; }
