﻿/* ============================================================================
   CRM Wiener — Views: Kanban, Modal, Pivot, Timeline, Contacts, Prospects,
                       Geo, Search, Pickers, Sale Orders
   ============================================================================ */

/* ============================================================================
   Validation tooltip
   ============================================================================ */
.cf-validation-tooltip {
    position: fixed;
    z-index: 9999;
    background: #f97316;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px 5px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    pointer-events: none;
    white-space: nowrap;
}
.cf-validation-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 12px;
    border: 5px solid transparent;
    border-bottom-color: #f97316;
    border-top: 0;
}
.cf-val-tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
    line-height: 1;
}

/* ============================================================================
   Login
   ============================================================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--gray-100);
}

.login-card {
    background: var(--white);
    padding: 56px 48px;
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--crimson);
    animation: loginFadeUp 0.18s ease-out both;
    position: relative;
    z-index: 1;
}

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

.login-brand {
    text-align: center;
    margin-bottom: 40px;
}

.login-brand-logo {
    display: block;
    margin: 0 auto;
    width: 280px;
    height: auto;
}

.login-brand-tagline {
    display: block;
    font-size: 16px;
    color: var(--gray-500);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 10px;
    font-weight: 400;
}

.login-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    text-align: left;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: left;
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 13px;
}

.login-note {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-500);
    font-size: 12px;
}

.login-form { margin-top: 0; }

.login-form .btn-primary {
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    padding: 13px 16px;
    letter-spacing: 0.2px;
}

.login-form .btn-primary:hover:not(:disabled) {
    transform: none;
    background-color: var(--crimson-dark);
}

@media (max-width: 480px) {
    .login-card {
        padding: 40px 28px;
        border-radius: 0;
        border-top: none;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* ============================================================================
   Kanban Board
   ============================================================================ */

.kanban-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 16px;
}

.kanban-board {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    align-items: flex-start;
    width: 100%;
}

/* Phase group wrappers — solo para agrupación por etapa */
.kanban-board--phased {
    gap: 14px;
}

.kanban-phase-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.kanban-phase-columns {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.kanban-phase-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 3px 6px 4px;
    border-radius: 3px;
    border-top: 2px solid transparent;
    white-space: nowrap;
}

.kanban-phase-group--early .kanban-phase-label {
    color: #5b7dc8;
    background: rgba(91, 125, 200, 0.08);
    border-top-color: rgba(91, 125, 200, 0.35);
}
.kanban-phase-group--mid .kanban-phase-label {
    color: #b5790a;
    background: rgba(181, 121, 10, 0.07);
    border-top-color: rgba(181, 121, 10, 0.35);
}
.kanban-phase-group--late .kanban-phase-label {
    color: #5b7272;
    background: rgba(91, 114, 114, 0.07);
    border-top-color: rgba(91, 114, 114, 0.35);
}

.kanban-column {
    flex: 1 1 0;
    min-width: 200px;
    background: var(--white);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.kanban-column-header {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.kanban-column-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kanban-column-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-amount {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.kanban-column-count {
    font-size: 11px;
    color: var(--crimson);
    background: var(--crimson-light);
    padding: 4px 10px;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.kanban-column-progress {
    height: 2px;
    background: var(--gray-300);
    margin-top: 12px;
    overflow: hidden;
}

.kanban-column-progress-bar {
    height: 100%;
    background: var(--crimson);
}

.kanban-column-cards {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 60px;
}

.kanban-load-more {
    margin-top: 2px;
    padding: 7px 10px;
    border: 1px dashed var(--gray-300, #d1d5db);
    border-radius: 6px;
    background: transparent;
    color: var(--gray-500, #6b7280);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.kanban-load-more:hover:not(:disabled) {
    background: var(--gray-50, #f9fafb);
    border-color: var(--crimson, #DC143C);
    color: var(--crimson, #DC143C);
}
.kanban-load-more:disabled { opacity: .6; cursor: default; }

/* Info tooltip — used on kanban phase labels and stage column titles */
.kanban-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: var(--gray-500, #6b7280);
    font-size: 9px;
    font-weight: 700;
    font-style: normal;
    text-transform: none;
    letter-spacing: normal;
    cursor: default;
    margin-left: 5px;
    flex-shrink: 0;
    position: relative;
    vertical-align: middle;
}
.kanban-info-icon:hover {
    background: rgba(0, 0, 0, 0.16);
    color: var(--gray-700, #374151);
}

.kanban-tooltip-fixed {
    position: fixed;
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
    padding: 7px 10px;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: 230px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.kanban-tooltip-fixed::before {
    content: '';
    position: absolute;
    top: -5px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #1f2937;
}
.kanban-tooltip-fixed.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Kanban card (compact) */
.kanban-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--gray-50);
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 5px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.kanban-card:hover {
    border-color: var(--crimson);
    transform: scale(1.015);
    box-shadow: var(--shadow-md);
}

.kanban-card-opportunity-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.kanban-card-title {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--gray-500);
    line-height: 1.25;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-company {
    font-size: 0.72rem;
    color: var(--gray-500);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-budget {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--crimson);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.filter-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.filter-user-row #filter-user-multiselect {
    flex: 1 1 auto;
    min-width: 0;
}
.filter-user-row .golive-overlap-label {
    white-space: nowrap;
    flex: none;
}
.dss-wrap.is-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}
.dss-wrap.is-loading::after {
    content: "";
    position: absolute;
    right: 24px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid var(--gray-300, #d1d5db);
    border-top-color: var(--crimson, #DC143C);
    border-radius: 50%;
    animation: dss-spin 0.7s linear infinite;
}
@keyframes dss-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .dss-wrap.is-loading::after { animation: none; }
}

.user-inactive-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7a5a1e;
    background: #f5dfa0;
    border-radius: 4px;
    padding: 1px 5px;
    vertical-align: middle;
    white-space: nowrap;
}
.kanban-card-badge--gone {
    opacity: 0.45;
    box-shadow: 0 0 0 2px #f5dfa0;
}
.plist-scroll {
    overflow-x: auto;
    max-width: 100%;
}
.plist-scroll .data-table {
    /* Igual a la suma de los anchos de columna de #prospects-list-table (1881px:
       1811px + 70px de ensanchar Etapa). Si es menor, table-layout:fixed achica
       todas las columnas proporcionalmente y los títulos vuelven a no entrar. */
    min-width: 1881px;
}
.plist-scroll .data-table th,
.plist-scroll .data-table td {
    white-space: nowrap;
}
.plist-scroll .data-table td.plist-wrap {
    white-space: normal;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kanban-card-duration {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--gray-500);
    margin: 1px 0 0;
    white-space: nowrap;
}
.kanban-card-cuota {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--gray-500);
    margin: 1px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kanban-card-acum {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--gray-700, #374151);
    margin: 3px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.iw-steps { display:flex; gap:4px; padding:12px 22px 0; border-bottom:1px solid var(--gray-200,#e5e7eb); }
.iw-step { display:flex; align-items:center; gap:6px; padding:6px 12px 10px; font-size:12px; color:var(--gray-400,#9ca3af); border-bottom:2px solid transparent; }
.iw-step b { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:50%; background:var(--gray-200,#e5e7eb); color:var(--gray-500,#6b7280); font-size:11px; }
.iw-step.is-active { color:var(--crimson,#DC143C); border-bottom-color:var(--crimson,#DC143C); font-weight:600; }
.iw-step.is-active b { background:var(--crimson,#DC143C); color:#fff; }
.iw-step.is-done b { background:#1a8049; color:#fff; }
.iw-lead { margin:0 0 14px; font-size:13px; color:var(--gray-600,#4b5563); line-height:1.5; }
.iw-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.iw-summary { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.iw-chip { padding:4px 10px; border-radius:12px; font-size:12px; font-weight:600; }
.iw-chip--ok { background:#e7f2eb; color:#1a8049; }
.iw-chip--err { background:#fbe9ed; color:#a8102e; }
.iw-chip--warn { background:#fbefe2; color:#9c5518; }
.iw-note { padding:7px 10px; margin-bottom:10px; background:#fff8e1; border:1px solid #f59e0b; border-radius:4px; font-size:12px; color:#92400e; }
.iw-table-wrap { max-height:320px; overflow-y:auto; border:1px solid var(--gray-200,#e5e7eb); border-radius:6px; }
.iw-table { width:100%; font-size:12px; }
.iw-table td { padding:6px 10px; border-bottom:1px solid var(--gray-100,#f3f4f6); vertical-align:top; }
.iw-num { width:44px; color:var(--gray-400,#9ca3af); }
.iw-sub { font-size:11px; color:var(--gray-400,#9ca3af); }
.iw-row-err td { background:#fff5f6; }

/* Modal Perdido: cuando el producto es "No aplica" el buscador se apaga, para que
   quede claro que ya no hay nada que completar ahi. */
.product-picker.is-na .product-picker-search {
    background: var(--gray-50, #f9fafb);
    color: var(--gray-400, #9ca3af);
    cursor: not-allowed;
}

/* Fila de visita (tercer nivel del tablero de Visitas por oportunidad). */
tr.visitas-detalle td { background:#fcfcfd; color:var(--gray-600,#4b5563); font-size:12px; }
td.visitas-mensaje {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Spinner de la búsqueda de contacto por email/teléfono. */
.pc-wrap { position: relative; }
.pc-searching { padding-right: 32px !important; }
.pc-spin {
    position: absolute; right: 11px; top: 50%; margin-top: -7px;
    width: 14px; height: 14px; pointer-events: none;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-top-color: var(--crimson, #DC143C);
    border-radius: 50%;
    animation: pc-spin .7s linear infinite;
}
@keyframes pc-spin { to { transform: rotate(360deg); } }

/* Zona de arrastre del importador. El input nativo queda oculto pero sigue siendo
   el que guarda el archivo: el drop solo le asigna los FileList. */
.iw-drop {
    position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:8px; padding:30px 20px; text-align:center; cursor:pointer;
    border:2px dashed var(--gray-300,#d1d5db); border-radius:10px; background:var(--gray-50,#f9fafb);
    transition:border-color .15s, background .15s;
}
.iw-drop:hover { border-color:var(--gray-400,#9ca3af); background:#f4f5f7; }
.iw-drop.is-over { border-color:var(--crimson,#DC143C); background:#fdf2f4; }
.iw-drop input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; }
.iw-drop-icon { color:var(--gray-400,#9ca3af); }
.iw-drop.is-over .iw-drop-icon { color:var(--crimson,#DC143C); }
.iw-drop-main { font-size:13px; color:var(--gray-700,#374151); font-weight:600; }
.iw-drop-main u { text-decoration:underline; text-underline-offset:2px; }
.iw-drop-sub { font-size:11.5px; color:var(--gray-400,#9ca3af); }

/* Archivo elegido: reemplaza a la zona de arrastre, no se suma. */
.iw-file {
    display:flex; align-items:center; gap:11px; padding:12px 14px;
    border:1px solid var(--gray-200,#e5e7eb); border-radius:10px; background:#fff;
}
.iw-file-icon {
    flex-shrink:0; display:inline-flex; align-items:center; justify-content:center;
    width:32px; height:32px; border-radius:6px; background:#e7f2eb; color:#1a8049;
}
.iw-file-body { flex:1; min-width:0; }
.iw-file-name { font-size:13px; font-weight:600; color:var(--gray-800,#1f2937); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.iw-file-size { font-size:11.5px; color:var(--gray-400,#9ca3af); }
.iw-file-x {
    flex-shrink:0; width:26px; height:26px; padding:0; line-height:1; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center;
    border:none; border-radius:6px; background:transparent; color:var(--gray-400,#9ca3af);
    font-size:17px; transition:background .12s, color .12s;
}
.iw-file-x:hover { background:#fbe9ed; color:var(--crimson,#DC143C); }
.iw-err { color:#a8102e; }
.iw-warn { color:#9c5518; }
.iw-ok { color:#1a8049; }

.prospect-create-company-btn {
    margin-top: 5px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--crimson, #DC143C);
    background: none;
    border: 1px dashed var(--gray-300, #d1d5db);
    border-radius: 4px;
    cursor: pointer;
}
.prospect-create-company-btn:hover {
    background: var(--gray-50, #f9fafb);
    border-color: var(--crimson, #DC143C);
}

.prospect-contact-suggest {
    position: absolute;
    z-index: 12000;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    font-size: 12px;
}
.prospect-contact-suggest-item {
    padding: 7px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.prospect-contact-suggest-item:last-child { border-bottom: none; }
.prospect-contact-suggest-item:hover { background: var(--gray-50, #f9fafb); }
.prospect-contact-suggest-item span { color: var(--gray-500, #6b7280); }

.kanban-card-country {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45%;
}
.kanban-card-currency {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--gray-500);
    letter-spacing: 0.03em;
}

.kanban-card-so-badge {
    font-size: 0.68rem;
    color: var(--gray-600);
    background: var(--gray-100);
    border-radius: 4px;
    padding: 2px 6px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 4px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-card-so-contract {
    font-size: 0.6rem;
    color: #4a7c59;
    background: #f0f7f2;
    border: 1px solid #b8d9c3;
    border-radius: 3px;
    padding: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.prospect-so-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--crimson);
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.kanban-card-type {
    font-size: 10px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kanban-card-type-dot {
    width: 6px;
    height: 6px;
    background: var(--crimson);
    border-radius: var(--radius-full);
}

.kanban-card-type-text {
    text-transform: uppercase;
    font-size: 0.68rem;
}

.kanban-card-label {
    font-size: 0.65rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 5px;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--gray-300);
    gap: 4px;
}

.kanban-card-rating {
    display: flex;
    align-items: center;
    gap: 1px;
}

.kanban-card-star { font-size: 10px; color: var(--crimson); }
.kanban-card-star.empty { color: var(--gray-300); }
.kanban-card-time { font-size: 0.62rem; color: var(--gray-500); text-transform: uppercase; }

.kanban-card-badge {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--white);
    background: var(--crimson);
    border-radius: var(--radius-full);
}

.kanban-card-badge.green   { background: var(--success); }
.kanban-card-badge.purple  { background: var(--purple); }
.kanban-card-badge.orange  { background: var(--warning); }
.kanban-card-badge.crimson { background: var(--crimson); }
.kanban-card-badge.dark-red { background: var(--crimson-dark); }
.kanban-card-badge.blue    { background: var(--info); }

.kanban-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 3px;
    z-index: 5;
}

.kanban-card:hover .kanban-card-actions { display: flex; }

.kanban-card-action-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    padding: 1px 4px;
}

.kanban-card-action-btn:hover {
    background: var(--crimson);
    color: var(--white);
    border-color: var(--crimson);
}

/* Inactive kanban card */
.kanban-card--inactive {
    background: #fdf6ec;
    border-color: #e8d5b0;
    opacity: 0.82;
}

.kanban-card--inactive:hover {
    border-color: #c9a96e;
    background: #fdf0df;
}

.kanban-card-inactive-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7a5a1e;
    background: #f5dfa0;
    border-radius: 4px;
    padding: 2px 6px;
    align-self: flex-start;
}

.kanban-card-incomplete-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7a4a00;
    background: #ffe0b2;
    border-radius: 4px;
    padding: 2px 6px;
    align-self: flex-start;
}

.kanban-card-lost-ribbon {
    position: absolute;
    top: 10px;
    right: -22px;
    width: 80px;
    text-align: center;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    background: var(--crimson);
    padding: 3px 0;
    transform: rotate(45deg);
    pointer-events: none;
    z-index: 4;
}

/* Kanban skeleton loading state */
.kanban-skeleton {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    align-items: flex-start;
    width: 100%;
}

.kanban-skeleton-column {
    flex: 1 1 0;
    min-width: 200px;
    background: var(--white);
    padding: 12px 10px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.kanban-skeleton-title {
    height: 11px;
    width: 60%;
    margin-bottom: 12px;
}

.kanban-skeleton-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--gray-200);
}

.kanban-skeleton-amount { height: 18px; width: 40%; }
.kanban-skeleton-count { height: 18px; width: 28px; border-radius: var(--radius-full); }

.kanban-skeleton-card {
    height: 64px;
    border-radius: 5px;
    margin-bottom: 7px;
}

.kanban-skeleton-card:last-child { margin-bottom: 0; }

/* List skeleton loading state */
.list-skeleton {
    padding: 4px 0;
}

.list-skeleton-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.list-skeleton-cell { height: 13px; border-radius: 4px; }

#modal-incomplete-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 20px;
    background: #fff8f0;
    border-left: 3px solid #fb923c;
    font-size: 12px;
    color: #7a4a00;
    flex-shrink: 0;
}

#modal-incomplete-warning a {
    color: #7a4a00;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#modal-incomplete-warning a:hover {
    color: #92400e;
}

.incomplete-warning-icon { display: none; }
.incomplete-warning-text { display: contents; }

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-width: 1600px;
    width: 98%;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    z-index: 2001;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-content-small {
    max-width: 600px;
    width: 90%;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 14px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.modal-header-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.modal-header-meta-sep { color: var(--gray-300); font-size: 12px; }
.modal-header-meta-item { font-size: 12px; color: var(--gray-500); }

.modal-menu-btn,
.modal-mobile-menu { display: none; }
.modal-menu-btn--hidden { display: none !important; }

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-500);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.modal-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(96vh - 100px);
}

.modal-body--contact { padding: 0; }

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: var(--gray-100); }
.modal-body::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

#prospect-modal #modal-body::-webkit-scrollbar { width: 12px; }
#prospect-modal #modal-body::-webkit-scrollbar-thumb { border-radius: 6px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
    background: var(--gray-50);
}

/* Modal loading / save overlays */
.modal-loading {
    text-align: center;
    padding: 48px;
    color: var(--gray-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.modal-loading p {
    margin-top: 16px;
    font-size: 14px;
    color: var(--gray-600);
}

.modal-company-contact-loading,
.modal-save-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-save-overlay { background: rgba(255, 255, 255, 0.85); }

.modal-company-contact-loading p,
.modal-save-spinner-wrap p {
    margin: 0;
    font-size: 14px;
    color: var(--gray-600);
}

.modal-save-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--gray-700);
    font-size: 14px;
}

/* Modal detail sections */
.modal-details {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.modal-detail-section {
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.modal-detail-section:first-child {
    border-top: none;
    padding-top: 0;
}

.modal-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--crimson);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.modal-detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

.modal-detail-row:last-child { margin-bottom: 0; }

.modal-detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-detail-item.full-width { grid-column: 1 / -1; }

.modal-detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-detail-value {
    font-size: 14px;
    color: var(--gray-900);
    line-height: 1.5;
}

/* Modal form sections */
.modal-form-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 0;
    overflow: hidden;
}

.modal-section-header {
    background: var(--white);
    padding: 4px 10px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-form-content { padding: 8px 10px; }
.modal-form-content .form-row { margin-bottom: 6px; }
.modal-form-content .form-row:last-child { margin-bottom: 0; }
.modal-form-content .form-group { margin-bottom: 0; }

.modal-form-content .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.modal-form-content .form-group.full-width { grid-column: 1 / -1; }

.modal-form-content .form-group label {
    font-size: 11px;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-form-content .form-input,
.modal-form-content .form-select,
.modal-form-content .form-textarea {
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    padding: 6px 10px;
    font-size: 13px;
}

.modal-form-content .form-input:focus,
.modal-form-content .form-select:focus,
.modal-form-content .form-textarea:focus {
    border-color: var(--crimson);
    box-shadow: 0 0 0 3px var(--crimson-light);
}

.modal-form-content small {
    display: block;
    margin-top: 6px;
    color: var(--gray-500);
    font-size: 11px;
}

.modal-form-section h4.modal-section-title {
    font-size: 14px;
    margin-bottom: 10px;
}

/* Modal relation management */
.modal-relation-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}

.modal-relation-add .form-select,
.modal-relation-add .form-input { min-width: 120px; }

.modal-relation-list { margin-top: 8px; }

.modal-relation-list .empty-state {
    padding: 12px;
    color: var(--gray-500);
    font-size: 13px;
}

/* Prospect form override */
#modal-prospect-form { display: block; }
#modal-prospect-form > .modal-form-section { margin-bottom: 0; }
#modal-prospect-form > .modal-form-section.full-width-section { grid-column: 1 / -1; }

/* Modal tabs (v5) */
.modal-tabs-bar {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid var(--gray-200);
    padding: 0 14px;
    flex-shrink: 0;
    background: var(--gray-50);
    gap: 2px;
    margin: -10px -10px 0;
}

.modal-tab-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
    border-radius: 4px 4px 0 0;
}

.modal-tab-btn:hover {
    color: var(--crimson);
    background: rgba(220, 20, 60, 0.04);
}

.modal-tab-btn.active {
    color: var(--crimson);
    border-bottom-color: var(--crimson);
    font-weight: 600;
}

.modal-tab-panel { display: none; }
.modal-tab-panel.active { display: block; }

.modal-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--gray-200);
    color: var(--gray-600);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 5px;
    line-height: 1;
}

.modal-tab-btn.active .modal-tab-badge {
    background: var(--crimson-light);
    color: var(--crimson);
}

/* ============================================================================
   Stage Pipeline
   ============================================================================ */

.stage-pipeline-wrap {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: 5px 16px;
    overflow-x: auto;
    flex-shrink: 0;
}

.stage-pipeline {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 6px;
}

.stage-step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    line-height: 1.3;
    min-width: 0;
}

.stage-step:hover:not(.stage-step--active):not(.stage-step--done):not(.stage-step--disabled) {
    background: var(--crimson-light);
    color: var(--crimson);
    border-color: var(--crimson);
    z-index: 1;
}

.stage-step--active {
    background: var(--crimson);
    border-color: var(--crimson);
    color: var(--white);
    font-weight: 700;
    z-index: 2;
    cursor: default;
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.25);
}

.stage-step--done {
    background: var(--crimson-light);
    color: var(--crimson);
    border-color: var(--crimson);
    font-weight: 500;
    cursor: default;
}

.stage-step--danger:hover {
    background: var(--crimson);
    color: var(--white);
    border-color: var(--crimson);
    z-index: 1;
}

.stage-step--disabled {
    color: var(--gray-400);
    background: var(--gray-50);
    border-color: var(--gray-200);
    cursor: not-allowed !important;
    opacity: 0.7;
}

.stage-step--disabled:hover {
    background: var(--gray-50);
    color: var(--gray-400);
    border-color: var(--gray-200);
    z-index: auto;
    box-shadow: none;
}

.stage-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    border: 1.5px solid currentColor;
    flex-shrink: 0;
    line-height: 1;
}

.stage-step--active .stage-step-num {
    background: rgba(255, 255, 255, 0.25);
    border-color: var(--white);
    color: var(--white);
}

/* Tooltip para botones de pipeline deshabilitados */
.stage-action-tooltip-wrap {
    position: relative;
    display: flex;
    flex: 1;
    cursor: not-allowed;
}

.stage-action-tooltip-wrap > button {
    width: 100%;
}

.stage-action-tooltip-wrap::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 7px);
    right: 0;
    background: var(--gray-800);
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: normal;
    max-width: 260px;
    z-index: 1000;
    pointer-events: none;
    line-height: 1.4;
    text-align: right;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
}

.stage-action-tooltip-wrap:hover::after {
    opacity: 1;
    visibility: visible;
}

.stage-action-tooltip-wrap::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 1px);
    right: 14px;
    border: 5px solid transparent;
    border-top-color: var(--gray-800);
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
}

.stage-action-tooltip-wrap:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Ícono de ayuda con tooltip — formulario de usuario, etc. */
.field-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 5px;
    border-radius: 50%;
    background: var(--gray-200, #e5e7eb);
    color: var(--gray-600, #6b7280);
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1;
    cursor: help;
    position: relative;
    vertical-align: middle;
}
.field-help:hover {
    background: var(--crimson, #DC143C);
    color: #fff;
}
.field-help::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--gray-800, #1f2937);
    color: #fff;
    padding: 7px 11px;
    border-radius: var(--radius-sm, 6px);
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: 240px;
    z-index: 1000;
    pointer-events: none;
    line-height: 1.4;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
}
.field-help::before {
    content: '';
    position: absolute;
    top: calc(100% + 2px);
    left: 4px;
    border: 5px solid transparent;
    border-bottom-color: var(--gray-800, #1f2937);
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
}
.field-help:hover::after,
.field-help:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Tarjeta de formulario deshabilitada (ej. "Países visibles" para Nivel 2, "Grupos de países" para Nivel 3) */
.form-card--disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

/* Banner de impersonación */
.impersonate-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
}
.impersonate-banner strong {
    font-weight: 700;
}
.impersonate-banner__stop {
    background: #92400e;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm, 6px);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.impersonate-banner__stop:hover {
    background: #78350f;
}

/* Disabled Presupuestos tab */
.modal-tab-btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.stage-tab-disabled-wrap {
    position: relative;
    display: inline-block;
}

.stage-tab-disabled-wrap::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: #fff;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
}

.stage-tab-disabled-wrap:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Stage change modal */
.change-stage-subtitle {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 24px;
    text-align: center;
}

.stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.stage-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.stage-card:hover {
    border-color: var(--crimson);
    background: var(--crimson-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.15);
}

.stage-card-selected {
    border-color: var(--crimson);
    background: var(--crimson-light);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.2);
}

.stage-card-disabled { opacity: 0.5; pointer-events: none; }

.stage-card-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    margin-left: 8px;
    flex-shrink: 0;
}

.stage-card-current {
    border-color: var(--crimson);
    background: linear-gradient(135deg, var(--crimson-light) 0%, var(--white) 100%);
}

.stage-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--crimson);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.stage-card:hover .stage-card-icon {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
}

.stage-card-current .stage-card-icon {
    background: var(--crimson);
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
}

.stage-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stage-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.4;
}

.stage-card-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--crimson);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ============================================================================
   Prospect Form v5 (Odoo-style)
   ============================================================================ */

.prospect-form-v5 { padding: 0; }

.prospect-form-v5-title {
    padding: 8px 16px 6px;
    border-bottom: 1px solid var(--gray-100);
}

.prospect-field-row--name {
    border-bottom: none;
    padding: 2px 0;
    min-height: 36px;
}

.prospect-field-row--name .prospect-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-700);
    width: auto;
    min-width: 0;
    flex-shrink: 0;
}

.prospect-field-row--name .form-input {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    height: 32px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--gray-400);
    background: var(--white);
    width: 100%;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.prospect-field-row--name .form-input:focus {
    border-color: var(--crimson);
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.08);
}

.prospect-field-row--name .form-input:hover:not(:focus) {
    border-color: var(--gray-400);
}

.prospect-form-v5-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.prospect-form-v5-col { padding: 6px 16px 10px; }
.prospect-form-v5-col:first-child { border-right: 1px solid var(--gray-300); }

/* Field row */
.prospect-field-row {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 2px 0;
    border-bottom: 1px solid var(--gray-50);
    gap: 8px;
}

.prospect-field-row:last-child { border-bottom: none; }

.prospect-field-label {
    width: 138px;
    min-width: 138px;
    font-size: 15px;
    color: var(--gray-700);
    flex-shrink: 0;
    line-height: 1.3;
    padding-top: 2px;
}

.prospect-field-control { flex: 1; min-width: 0; }

.prospect-field-control .form-input,
.prospect-field-control .form-select {
    height: 30px;
    font-size: 15px;
    font-family: inherit;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    width: 100%;
    transition: border-color 0.15s, background 0.15s;
    color: var(--gray-800);
}

.prospect-field-control .form-input:focus,
.prospect-field-control .form-select:focus {
    border-color: var(--crimson);
    background: var(--white);
    outline: none;
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.08);
}

.prospect-field-control .form-input:hover:not(:focus),
.prospect-field-control .form-select:hover:not(:focus) {
    border-color: var(--gray-400);
    background: var(--white);
}

.prospect-field-section {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-700);
    padding: 10px 0 4px;
    margin-top: 20px;
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-300);
    margin-bottom: 2px;
}

.prospect-form-v5-col > .prospect-field-section:first-child {
    margin-top: 0;
    border-top: none;
}

.prospect-field-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 0;
}

.prospect-form-v5-fullrow {
    padding: 8px 16px 10px;
    border-top: 1px solid var(--gray-300);
}

.prospect-form-v5-fullrow-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-700);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gray-300);
}

.prospect-form-v5-fullrow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
}

.prospect-field-row .toggle-pill {
    font-size: 12px;
    padding: 3px 10px;
    height: auto;
}

.prospect-form-v5 .form-textarea {
    font-size: 15px;
    font-family: inherit;
    padding: 6px 8px;
    min-height: 64px;
    resize: vertical;
}

/* Tab panels */
.modal-tab-panel--datos { padding-bottom: 8px; }

.modal-tab-panel--presupuestos,
.modal-tab-panel--historial { padding: 12px 16px; }

.modal-tab-panel--presupuestos .sale-orders-wrap {
    border: none;
    box-shadow: none;
    padding: 0;
}

.modal-tab-panel--presupuestos .sale-orders-wrap-header { padding: 10px 14px; }

/* ── Sale-order list (desktop: tabla; mobile: cards) ─────────────────────── */
.so-card-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 4px;
}

.so-card {
    display: grid;
    grid-template-columns: repeat(6, 1fr) minmax(100px, auto) minmax(130px, 1fr);
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
}
.so-card:last-child { border-bottom: none; }

/* Header row */
.so-card--header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200) !important;
}
.so-card--header .so-card__num,
.so-card--header .so-card__date,
.so-card--header .so-card__contract,
.so-card--header .so-card__amount,
.so-card--header .so-card__total,
.so-card--header .so-card__currency,
.so-card--header .so-card__state {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.so-card__field-label { display: none; }

.so-card__num {
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.so-attachment-badge {
    font-size: 14px;
    font-weight: 700;
    color: var(--crimson);
    white-space: nowrap;
}
.so-card__date {
    padding: 9px 8px;
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}
.so-card__contract {
    padding: 9px 8px;
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
}
.so-card__amount {
    padding: 9px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    min-width: 0;
}
.so-card__total {
    padding: 9px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    min-width: 0;
}
.so-card__currency {
    padding: 9px 8px;
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
}
.so-card__state {
    padding: 9px 8px;
    white-space: nowrap;
}
.so-card__actions {
    display: flex;
    gap: 6px;
    padding: 7px 10px;
    white-space: nowrap;
    justify-content: flex-end;
}
.so-card__actions .btn {
    padding: 4px 10px;
    font-size: 11px;
}
.modal-tab-panel--historial { padding: 12px 16px 8px; }
.modal-tab-panel--historial .timeline-list { max-height: 520px; overflow-y: auto; padding-right: 2px; }

/* ============================================================================
   Prospects Masthead (fila 1: título + tabs + CTA)
   ============================================================================ */

.prospects-masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
    position: relative;
    z-index: 501;
}

/* Loading overlay */
#prospects-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(1px);
    transition: opacity 0.2s ease;
}

#prospects-loading-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.prospects-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--crimson);
    border-radius: 50%;
    animation: prospects-spin 0.7s linear infinite;
}

@keyframes prospects-spin {
    to { transform: rotate(360deg); }
}

.prospects-masthead-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.prospects-masthead-left h1 {
    white-space: nowrap;
}

/* ============================================================================
   Prospects Controls Bar (fila 2: organización de vista)
   ============================================================================ */

.prospects-controls-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 10px;
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.prospects-ctrl-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.prospects-ctrl-label {
    font-size: 11px;
    color: var(--gray-500);
    white-space: nowrap;
    font-weight: 500;
}

.prospects-ctrl-select {
    font-size: 12px;
    min-width: 116px;
}

.prospects-show-all-label {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    white-space: nowrap;
    align-items: center;
    user-select: none;
}

.prospects-ctrl-select--narrow {
    min-width: auto;
    width: 64px;
}

.prospects-ctrl-sep {
    width: 1px;
    height: 16px;
    background: var(--gray-200);
    flex-shrink: 0;
    align-self: center;
}

/* ============================================================================
   Filter search row — Solo activos toggle & Limpiar state
   ============================================================================ */

/* Compact quick-toggle chip for "Solo activos" in the search row */
.filter-active-toggle {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 10px;
}

/* "Limpiar" fades when there's nothing to clear */
.btn-clear-filters {
    opacity: 0.45;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.btn-clear-filters:hover { opacity: 0.8; }
.btn-clear-filters.btn-clear-active {
    opacity: 1;
    color: var(--crimson);
    border-color: var(--crimson-light, #ffe4e6);
    background: var(--crimson-light, #fff0f1);
}
.btn-clear-filters.btn-clear-active:hover {
    background: var(--crimson-very-light, #ffe4e6);
    border-color: var(--crimson);
}

.prospects-pagination-bar {
    padding: 6px 16px 4px;
    border-bottom: 1px solid var(--gray-200);
}
.prospects-pagination-bar--bottom {
    padding: 10px 16px;
    margin-top: 8px;
    border-top: 1px solid var(--gray-200);
    border-bottom: none;
}

.prospects-pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.prospects-pagination-summary {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.prospects-pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ============================================================================
   Responsive — Prospects header
   ============================================================================ */

@media (max-width: 860px) {
    .prospects-masthead-left h1 { font-size: 17px; }
    .prospects-controls-bar { gap: 6px; padding: 5px 10px; }
}

@media (max-width: 640px) {
    .prospects-masthead {
        flex-wrap: wrap;
        gap: 10px;
    }
    .prospects-masthead-left {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .prospects-masthead > .btn {
        width: 100%;
        justify-content: center;
    }
    .prospects-controls-bar {
        gap: 6px;
    }
    .prospects-ctrl-sep { display: none; }
}

@media (max-width: 480px) {
    .prospects-masthead-left h1 { display: none; }
    .filter-active-toggle { font-size: 11px; padding: 4px 8px; }
}

/* ============================================================================
   Unified Search Bar (Prospects)
   ============================================================================ */

.filters-card--prospects {
    padding: 12px 16px 12px;
    display: block;
    position: relative;
    z-index: 200;
    overflow: visible;
}

.filters-collapse-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 0 4px;
    margin-top: 8px;
    border-top: 1px solid var(--gray-200);
    cursor: pointer;
    color: var(--gray-300);
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.filters-collapse-bar:hover {
    color: var(--gray-500);
    border-top-color: var(--gray-400);
}

/* Pestaña "Filtros" (prospects/contacts/budgets/users): además del botón
   original #btn-toggle-filters (arriba, junto a los demás controles — se
   mantiene ahí porque sigue siendo útil para cerrar la sábana larga sin tener
   que scrollear), esta pestaña extra cuelga de la línea divisoria para que sea
   más fácil de encontrar. Ambas abren/cierran lo mismo (toggleFilters /
   toggleSecondaryFilters según la página). */
.filters-tab-slot {
    display: flex;
    justify-content: center;
    padding: 0 24px;
    margin-top: 18px;
    border-top: 1px solid var(--gray-200);
}

.filters-tab-btn {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: -1px;
    padding: 8px 16px 9px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-top-color: transparent;
    border-radius: 0 0 8px 8px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.filters-tab-btn.active,
.filters-tab-btn:hover {
    color: var(--crimson);
    border-color: rgba(220, 20, 60, 0.3);
    background: var(--crimson-light, rgba(220, 20, 60, 0.06));
}

/* Gemela de arriba: aparece dentro del panel abierto, en el mismo lugar donde
   estaba la lengueta cuando el panel estaba cerrado. Solo cierra — no reemplaza
   ni al boton de la derecha ni a la lengueta de abajo. */
.filters-tab-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    margin: -6px 0 14px;
    padding: 5px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    color: var(--gray-700, #374151);
    background: var(--crimson-light, rgba(220, 20, 60, 0.06));
    border: 0;
    border-bottom: 1px solid rgba(220, 20, 60, 0.15);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.filters-tab-top:hover {
    color: var(--gray-900, #111827);
    background: rgba(220, 20, 60, 0.11);
}

.filters-tab-top svg { transform: rotate(180deg); flex-shrink: 0; }

.rates-banner {
    justify-content: flex-end;
    margin: 0 0 8px;
}

.prospects-summary-group {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    flex-wrap: nowrap;
    gap: clamp(6px, 0.8vw, 12px);
    min-width: 0;
}

.prospects-summary-group .prospects-pagination-summary {
    flex-shrink: 0;
}

#prospects-rates-inline {
    min-width: 0;
    overflow: hidden;
}

.rates-box {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: clamp(4px, 0.55vw, 10px);
    padding: 4px clamp(6px, 0.7vw, 12px);
    background: rgba(220, 20, 60, 0.06);
    border: 1px solid rgba(220, 20, 60, 0.18);
    border-radius: 6px;
    color: #9b1c2e;
    white-space: nowrap;
}

.rates-box-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: clamp(8px, 0.55vw, 10px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rate-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    font-size: clamp(9px, 0.62vw, 11px);
    white-space: nowrap;
    opacity: 0.9;
}

.rates-mobile-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #9b1c2e;
    background: rgba(220, 20, 60, 0.06);
    border: 1px solid rgba(220, 20, 60, 0.18);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rates-table th {
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500, #6b7280);
    border-bottom: 1px solid var(--gray-200);
}

.rates-table th:last-child,
.rates-table-value {
    text-align: right;
}

.rates-table td {
    padding: 7px 0;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
    color: var(--gray-700, #374151);
}

.rates-table-name {
    margin-left: 8px;
    font-size: 12px;
    color: var(--gray-500, #6b7280);
}

.rates-table-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.rates-modal-note {
    margin: 10px 0 0;
    font-size: 11px;
    color: var(--gray-500, #6b7280);
}

@media (max-width: 767px) {
    .prospects-summary-group { flex-wrap: wrap; justify-content: center; }
    #prospects-rates-inline .rates-box { display: none; }
    .rates-mobile-btn { display: inline-flex; }
}

.rate-chip b {
    font-weight: 700;
}

.prospect-field-control--info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.prospect-field-control--info > :first-child {
    flex: 1;
    min-width: 0;
}

.prospect-field-hint {
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.35;
    color: var(--gray-600, #4b5563);
}

#modal_name:placeholder-shown + .prospect-field-hint {
    display: none;
}

@media (max-width: 767px) {
    .filters-tab-top { display: none; }
}

#filters-collapse-arrow {
    transition: transform 0.2s ease;
}

#filters-collapse-arrow.arrow-up {
    transform: rotate(180deg);
}

.btn-filter-icon { display: none; }
.btn-filter-chevron { margin-left: 1px; }

#mobile-filters-sheet { display: contents; }
.mobile-filters-sheet-header,
.mobile-filters-sheet-footer { display: none; }

.unified-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.unified-search-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.unified-search-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.unified-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
}

.unified-search-input {
    width: 100%;
    height: 36px;
    padding: 0 34px 0 12px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.unified-search-input:focus {
    border-color: var(--crimson);
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.08);
}

.unified-search-input::placeholder {
    color: var(--gray-400);
    font-size: 12px;
}

.unified-search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 18px;
    line-height: 1;
    padding: 0 3px;
    border-radius: 3px;
    transition: color 0.15s;
}

.unified-search-clear-btn:hover { color: var(--gray-700); }

.unified-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 2000;
    max-height: 280px;
    overflow-y: auto;
}

.unified-search-suggestion {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--gray-100);
    user-select: none;
}

.unified-search-suggestion:last-child { border-bottom: none; }

.unified-search-suggestion:hover,
.unified-search-suggestion.active {
    background: var(--crimson-light);
    color: var(--crimson);
}

.unified-search-suggestion strong { font-weight: 700; color: inherit; }

.unified-search-suggestion em {
    font-style: normal;
    font-weight: 600;
    color: var(--gray-900);
}

.unified-search-suggestion:hover em,
.unified-search-suggestion.active em { color: var(--crimson-dark); }

.unified-search-no-results {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--gray-400);
    font-style: italic;
}

/* Active filter chips */
.active-search-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.search-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--crimson-light);
    border: 1px solid rgba(220, 20, 60, 0.25);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--crimson);
    font-weight: 500;
    white-space: nowrap;
}

.search-chip-label { font-weight: 700; }

.search-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--crimson);
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
    margin-left: 1px;
    opacity: 0.65;
    transition: opacity 0.15s;
}

.search-chip-remove:hover { opacity: 1; }

#btn-toggle-filters.active {
    background: var(--crimson-light);
    border-color: rgba(220, 20, 60, 0.3);
    color: var(--crimson);
}

/* Secondary filters */
.secondary-filters {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}

.secondary-filters-grid {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-category-label {
    flex-basis: 100%;
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0 -4px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-200);
}
.filter-category-label:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.secondary-filters-grid .filter-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 120px;
    max-width: none;
    flex-shrink: 0;
}

.secondary-filters-grid .filter-item .filter-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.secondary-filters-grid .filter-item.filter-item--active .filter-label {
    color: var(--crimson);
}
.secondary-filters-grid .filter-item.filter-item--active .form-select--sm,
.secondary-filters-grid .filter-item.filter-item--active .form-input--sm,
.secondary-filters-grid .filter-item.filter-item--active .product-picker-search,
.secondary-filters-grid .filter-item.filter-item--active .ss-trigger {
    border-color: var(--crimson);
    background: rgba(220,20,60,0.06);
    box-shadow: 0 0 0 2px rgba(220,20,60,0.12);
}
.date-filter-row.filter-item--active .date-filter-row-label {
    color: var(--crimson);
    font-weight: 700;
}
.date-filter-row.filter-item--active .form-input--sm {
    border-color: var(--crimson);
    background: rgba(220,20,60,0.06);
    box-shadow: 0 0 0 2px rgba(220,20,60,0.12);
}

.secondary-filter-active-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--crimson);
    color: var(--white);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
}

/* ── Modal overlay fixed (para modales fuera del page-container) ─────────── */
.modal-overlay--fixed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9900 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay--fixed .modal-content {
    z-index: 9901;
}

/* ── Secondary filters 2-column layout ──────────────────────────────────── */
.sf-layout {
    display: flex;
    gap: 0;
    align-items: flex-start;
}
.sf-col-main {
    flex: 1 1 0;
    min-width: 0;
}
.sf-col-shortcuts {
    flex: 0 0 auto;
    border-left: 1px solid var(--gray-100);
    padding-left: 18px;
    margin-left: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-self: stretch;
}

/* ── Filter sections ─────────────────────────────────────────────────────── */
.filter-section {
    padding: 10px 0 6px;
}
.sf-col-main .filter-section + .filter-section {
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
}
.filter-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.filter-section--advanced {
    padding-top: 8px;
    padding-bottom: 2px;
    margin-top: auto;
}

/* ── Shortcuts column (probabilidad arriba, fechas abajo) ────────────────── */
.shortcuts-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

/* ── Shortcuts quadrants grid ────────────────────────────────────────────── */
.shortcuts-quadrants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.shortcuts-quadrants--date {
    margin-top: 6px;
}

/* ── Date shortcut target selector ──────────────────────────────────────── */
.date-shortcut-block {
    padding-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.date-shortcut-target-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.date-shortcut-target-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
}
.date-shortcut-target-btns {
    display: flex;
    gap: 3px;
}
.date-target-btn {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 500;
    color: var(--gray-500);
    background: transparent;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    line-height: 1.5;
}
.date-target-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.date-target-btn.active {
    background: var(--gray-700, #374151);
    color: var(--white);
    border-color: var(--gray-700, #374151);
}

/* ── Date filter rows ────────────────────────────────────────────────────── */
.date-filter-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.date-filter-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.date-filter-row-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    min-width: 130px;
    padding-top: 6px;
    flex-shrink: 0;
}
.date-range-hint {
    font-size: 10px;
    color: var(--gray-400);
    padding-top: 6px;
    flex-shrink: 0;
}
.date-deadline-combined {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

/* ── Quick filter chips ──────────────────────────────────────────────────── */
.quick-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 0 2px;
    border-top: 1px solid var(--gray-100);
    margin-top: 8px;
}

.quick-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-600, #4b5563);
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    line-height: 1.4;
}
.quick-filter-chip:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}
.quick-filter-chip.active {
    background: var(--crimson, #b91c1c);
    color: var(--white);
    border-color: var(--crimson, #b91c1c);
}
.quick-filter-sep {
    width: 1px;
    height: 18px;
    background: var(--gray-200);
    margin: 0 2px;
}
/* ── Botón Exportar Excel ─────────────────────────────────────────────────── */
.btn-export-excel {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 13px;
    font-size: 12px;
    font-weight: 500;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1.5;
}
.btn-export-excel:hover {
    background: #c8e6c9;
    border-color: #66bb6a;
}
.btn-export-excel:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-export-excel--proc {
    opacity: 0.75;
    cursor: not-allowed;
}
.btn-export-excel--ready {
    background: #15803d;
    border-color: #166534;
    color: #fff;
}
.btn-export-excel--ready:hover {
    background: #166534;
    border-color: #14532d;
}
.btn-export-excel--error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}
.btn-export-excel--error:hover {
    background: #fee2e2;
    border-color: #f87171;
}
@keyframes btn-exp-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
/* Icon-only export buttons */
.dash-widget-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.campanas-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    background: var(--crimson-light);
    color: var(--crimson);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}
.campanas-count-badge:empty {
    display: none;
}
.btn-icon-excel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 5px;
    border: none;
    background: #1D6F42;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, opacity .15s;
    line-height: 1;
}
.btn-icon-excel:hover:not(:disabled) { background: #155c36; }
.btn-icon-excel:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-icon-jpg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 5px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1;
}
.btn-icon-jpg:hover:not(:disabled) { background: #e5e7eb; border-color: #9ca3af; color: #374151; }
.btn-icon-jpg:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-icon-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 5px;
    border: none;
    background: #DC143C;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, opacity .15s;
    line-height: 1;
}
.btn-icon-pdf:hover:not(:disabled) { background: #b01030; }
.btn-icon-pdf:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-pdf-header {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: #DC143C;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
    line-height: 1;
}
.btn-pdf-header:hover:not(:disabled) { background: #b01030; }
.btn-pdf-header:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-exp-spin {
    display: inline-block;
    animation: btn-exp-spin 1s linear infinite;
}

.quick-filter-chip--top5:hover {
    background: #fde68a;
    border-color: #f59e0b;
    color: #78350f;
}
.quick-filter-chip--top5.active {
    background: #d97706;
    color: #fff;
    border-color: #b45309;
}

/* ── Probability chips ───────────────────────────────────────────────────── */
.prob-chip-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.prob-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.prob-chip:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}
.prob-chip.active {
    background: var(--crimson, #b91c1c);
    color: var(--white);
    border-color: var(--crimson, #b91c1c);
}

/* ── Deadline shortcut chips ─────────────────────────────────────────────── */
.deadline-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
}
.deadline-shortcut-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm, 6px);
    background: var(--gray-50, #f9fafb);
    min-width: 80px;
}
.deadline-shortcut-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}
.deadline-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.deadline-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-600, #4b5563);
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.deadline-chip:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}
.deadline-chip.active {
    background: var(--blue-600, #2563eb);
    color: var(--white);
    border-color: var(--blue-600, #2563eb);
}

/* ── Date range inputs ───────────────────────────────────────────────────── */
.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
}
.date-range-sep {
    color: var(--gray-400);
    font-size: 12px;
    flex-shrink: 0;
}
.date-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.date-clear-btn {
    display: none;
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: var(--gray-400);
    padding: 0 2px;
}
.date-clear-btn:hover { color: var(--crimson); }
.golive-overlap-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    font-size: 11px;
    color: var(--gray-500);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.golive-overlap-label input[type="checkbox"] {
    accent-color: var(--crimson);
    width: 12px;
    height: 12px;
    cursor: pointer;
}
.golive-overlap-label:has(input:checked) span { color: var(--crimson); font-weight: 600; }
.golive-overlap-label.is-disabled { opacity: 0.45; cursor: not-allowed; }
.golive-overlap-label.is-disabled input[type="checkbox"] { cursor: not-allowed; }
.filter-check-info { flex-shrink: 0; cursor: help; }
.golive-overlap-label + .filter-check-info { margin-left: 3px; }
.filter-item--wide {
    min-width: 260px !important;
}

/* ── Custom filter modal ─────────────────────────────────────────────────── */
.cf-condition-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-100);
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 12px;
}
.cf-condition-label {
    flex: 1;
    color: var(--gray-700);
}
.cf-condition-remove {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}
.cf-condition-remove:hover { color: var(--crimson); }

/* Filters band (prospect horizontal filters) */
.filters-band {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px 12px;
    width: 100%;
    min-width: min-content;
}

.filters-band .filter-item .form-select--sm {
    width: 100%;
    max-width: 92px;
    min-width: 0;
}

/* ── Searchable single-select (filter bar) ─────────────────────────────── */
.ss-wrap {
    position: relative;
    width: 100%;
    max-width: 160px;
}
.ss-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 30px;
    text-align: left;
    overflow: hidden;
}
.ss-trigger:hover { border-color: var(--gray-400); }
.ss-wrap.open .ss-trigger {
    border-color: var(--crimson);
    box-shadow: 0 0 0 3px rgba(220,20,60,0.08);
}
.ss-trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-700);
    font-size: 11px;
}
.ss-trigger-text.has-value { color: var(--gray-900); }
.ss-trigger-caret { font-size: 8px; color: var(--gray-600); flex-shrink: 0; }
.ss-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    min-width: 180px;
    max-width: 280px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
    z-index: 300;
    overflow: hidden;
}
.ss-wrap.open .ss-dropdown { display: block; }
.ss-search-box {
    padding: 6px 8px;
    border-bottom: 1px solid var(--gray-200);
}
.ss-search-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-family: inherit;
    outline: none;
    color: var(--gray-900);
    background: var(--white);
    box-sizing: border-box;
}
.ss-search-input:focus { border-color: var(--crimson); }
.ss-list { max-height: 240px; overflow-y: auto; }
.ss-option {
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ss-option:hover { background: var(--gray-100); }
.ss-option.ss-active {
    background: rgba(220,20,60,0.06);
    color: var(--crimson);
    font-weight: 600;
}
.ss-empty { padding: 8px 10px; font-size: 12px; color: var(--gray-500); }

.ss-option--group {
    font-weight: 700;
    color: var(--crimson);
    letter-spacing: 0.03em;
}

.ss-wrap.ss-disabled .ss-trigger {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--gray-100);
}

/* Form-group context — match .form-select sizing, full width */
.form-group .ss-wrap {
    max-width: none;
}
.form-group .ss-trigger {
    min-height: 38px;
    font-size: 13px;
    padding: 8px 10px;
}
.form-group .ss-trigger-text {
    font-size: 13px;
}
.form-group .ss-dropdown {
    min-width: 100%;
    max-width: none;
}

/* Prospect form modal context — match 15px sizing of other form controls */
.prospect-field-control .ss-wrap { max-width: none; }
.prospect-field-control .ss-trigger {
    height: 30px;
    font-size: 15px;
    padding: 3px 6px;
}
.prospect-field-control .ss-trigger-text { font-size: 15px; }
.prospect-field-control .ss-search-input { font-size: 14px; }
.prospect-field-control .ss-option { font-size: 14px; }

/* Portal mode: dropdown moved to <body> on mobile to escape stacking contexts */
.ss-dropdown--portal {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    border-radius: 14px 14px 0 0;
    z-index: 3000;
    max-height: 60dvh;
    max-height: 60vh;
    padding-bottom: env(safe-area-inset-bottom, 0);
    overflow: hidden;
    background: var(--white);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
}
/* Portal mode desktop: dropdown moved to <body> to escape modal overflow/stacking */
.ss-dropdown--portal-desktop {
    position: fixed !important;
    min-width: 180px;
    max-width: 320px;
    z-index: 9999;
    display: block !important;
    top: auto;
    left: auto;
}

.ss-dropdown--portal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 8px auto 4px;
    flex-shrink: 0;
}
.ss-dropdown--portal .ss-search-box {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--gray-200);
}
.ss-dropdown--portal .ss-search-input {
    min-height: 44px;
    font-size: 16px;
    padding: 8px 12px;
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    box-sizing: border-box;
    outline: none;
}
.ss-dropdown--portal .ss-search-input:focus { border-color: var(--crimson); }
.ss-dropdown--portal .ss-list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.ss-dropdown--portal .ss-option {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 15px;
    white-space: normal;
    cursor: pointer;
}
.ss-dropdown--portal .ss-option:hover,
.ss-dropdown--portal .ss-option:active { background: var(--gray-50); }
.ss-dropdown--portal .ss-option.ss-active { color: var(--crimson); font-weight: 600; }
.ss-dropdown--portal .ss-empty {
    padding: 16px;
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
}

.filters-band__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ============================================================================
   Product Picker
   ============================================================================ */

.product-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-picker-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 0;
}

.product-picker-selected:empty { display: none; }

.product-picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--crimson-light);
    border: 1px solid rgba(220, 20, 60, 0.2);
    color: var(--crimson);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    user-select: none;
    max-width: 100%;
    word-break: break-word;
}

.product-picker-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    color: var(--crimson);
    opacity: 0.65;
    transition: opacity 0.15s;
}

.product-picker-chip-remove:hover { opacity: 1; }

.product-picker-input-wrap { position: relative; }

@keyframes pp-spin { to { transform: translateY(-50%) rotate(360deg); } }
.product-picker-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--crimson, #c0392b);
    border-radius: 50%;
    animation: pp-spin 0.6s linear infinite;
    pointer-events: none;
}

.product-picker-search {
    width: 100%;
    max-width: none;
}

.product-picker-list {
    /* Ancla al propio .product-picker-input-wrap (position:relative) en vez de
       flotar sin coordenadas — con varios pickers en la misma fila de filtros,
       "fixed" sin top/left calculado por JS los hacía superponerse entre sí.
       Los pickers que sí calculan su posición por JS (createSmartPicker en
       /prospects) fijan position:fixed inline, que siempre pisa esta regla. */
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

.product-picker-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.1s;
}

.product-picker-item:last-child { border-bottom: none; }
.product-picker-item:hover { background: var(--gray-50); }

.product-picker-item.selected {
    background: var(--crimson-light);
    color: var(--crimson);
    font-weight: 500;
}

.product-picker-item.selected::after {
    content: '\2713';
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-left: 6px;
}

.product-picker-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--gray-400);
    text-align: center;
}

/* ============================================================================
   Company Picker
   ============================================================================ */

.company-picker-wrap { position: relative; }

.company-picker-dropdown {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    max-height: 220px;
    overflow-y: auto;
}

.company-picker-item {
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-picker-item:last-child { border-bottom: none; }

.company-picker-item:hover {
    background: var(--crimson-light);
    color: var(--crimson-dark);
}

.company-picker-empty {
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--gray-400);
}

/* ============================================================================
   Sale Orders
   ============================================================================ */

.sale-orders-wrap {
    margin: 10px 12px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sale-orders-wrap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.sale-orders-wrap-header h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.sale-orders-wrap-body { padding: 4px 0 0; }

.modal-tab-panel--presupuestos .sale-orders-wrap-body { padding: 4px 0 0; }

#prospects-list-table th[onclick] { cursor: pointer; }
#prospects-list-table th[onclick]:hover { background: var(--gray-100); }
#prospects-list-table tbody tr:nth-child(even) td { background: #f9fafb; }
.sort-indicator { font-size: 10px; color: var(--crimson); margin-left: 3px; }

/* ── Vista Lista: filas compactas ────────────────────────────────────────── */
#view-list-container { overflow-x: auto; }
#prospects-list-table {
    table-layout: fixed;
}
#prospects-list-table th {
    padding: 6px 10px;
    font-size: 10px;
    text-align: center;
    /* Con table-layout:fixed la celda no se ensancha para que entre el titulo: sin
       este recorte, el texto que sobra se derrama sobre la columna vecina. Los td ya
       lo tenian; los th no, y por eso se superponian los encabezados. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#prospects-list-table td {
    padding: 4px 10px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    text-align: center;
}
/* Oportunidad y Cliente: alineación izquierda por legibilidad */
#prospects-list-table th:nth-child(3),
#prospects-list-table td:nth-child(3),
#prospects-list-table th:nth-child(4),
#prospects-list-table td:nth-child(4) { text-align: left; }

/* Anchos de columna. Están las 19: si se agrega una nueva y no se suma acá, queda
   angosta pero el título se corta con puntos suspensivos, no se superpone. */
#prospects-list-table th:nth-child(1)  { width: 28px;  }   /* Contrato       */
#prospects-list-table th:nth-child(2)  { width: 28px;  }   /* Completar      */
#prospects-list-table th:nth-child(3)  { width: 210px; }   /* Oportunidad    */
#prospects-list-table th:nth-child(4)  { width: 165px; }   /* Cliente        */
#prospects-list-table th:nth-child(5)  { width: 100px; }   /* Producto       */
#prospects-list-table th:nth-child(6)  { width: 115px; }   /* Comercial      */
#prospects-list-table th:nth-child(7)  { width: 85px;  }   /* Mercado        */
#prospects-list-table th:nth-child(8)  { width: 70px;  }   /* Probabilidad   */
#prospects-list-table th:nth-child(9)  { width: 80px;  }   /* Duración       */
#prospects-list-table th:nth-child(10) { width: 105px; }   /* Monto total    */
#prospects-list-table th:nth-child(11) { width: 100px; }   /* Monto año      */
#prospects-list-table th:nth-child(12) { width: 100px; }   /* Monto 12m      */
#prospects-list-table th:nth-child(13) { width: 90px;  }   /* F. cierre      */
#prospects-list-table th:nth-child(14) { width: 115px; }   /* F. facturación */
#prospects-list-table th:nth-child(15) { width: 85px;  }   /* Tipo           */
#prospects-list-table th:nth-child(16) { width: 85px;  }   /* Canal          */
#prospects-list-table th:nth-child(17) { width: 85px;  }   /* Indirecto      */
#prospects-list-table th:nth-child(18) { width: 170px; }   /* Etapa          */
#prospects-list-table th:nth-child(19) { width: 65px;  }   /* Abrir          */

/* Columnas fijas: al desplazarse a la derecha se sigue viendo de qué oportunidad es
   cada fila. Mismo patrón que la matriz de Campañas activas. */
#prospects-list-table th:nth-child(-n+3),
#prospects-list-table td:nth-child(-n+3) { position: sticky; background: var(--white); }
#prospects-list-table th:nth-child(-n+3) { background: var(--gray-50); z-index: 4; }
#prospects-list-table td:nth-child(-n+3) { z-index: 2; }
#prospects-list-table th:nth-child(1), #prospects-list-table td:nth-child(1) { left: 0;    }
#prospects-list-table th:nth-child(2), #prospects-list-table td:nth-child(2) { left: 28px; }
#prospects-list-table th:nth-child(3), #prospects-list-table td:nth-child(3) { left: 56px; border-right: 1px solid var(--gray-200); }
/* El rayado y el hover tienen que ganarle al fondo opaco de las fijas, o se ven
   de distinto color que el resto de la fila. */
#prospects-list-table tbody tr:nth-child(even) td:nth-child(-n+3) { background: #f9fafb; }
#prospects-list-table tbody tr:hover td:nth-child(-n+3) { background: var(--crimson-light); }

#contacts-table th:nth-child(1) { width: 28px; }   /* Completar */

/* ── Mismo formato cómodo de la vista Lista de Prospectos, aplicado a
   Contactos, Usuarios y Presupuestos: filas compactas + zebra striping ── */
#contacts-table th,
#users-table th,
#budgets-table th {
    padding: 6px 10px;
    font-size: 10px;
}
#contacts-table td,
#users-table td,
#budgets-table td {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.3;
}
#contacts-table tbody tr:nth-child(even) td,
#users-table tbody tr:nth-child(even) td,
#budgets-table tbody tr:nth-child(even) td {
    background: #f9fafb;
}

.sale-orders-wrap .data-table th,
.sale-orders-wrap .data-table td {
    padding: 8px 12px;
    font-size: 12px;
}

.prospect-sale-orders-wrap {
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
    margin-top: 16px;
}

.sale-orders-list .data-table { font-size: 12px; }

.sale-order-lines-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sale-order-lines-table-wrap .data-table {
    width: 100%;
    margin-top: 8px;
}

.sale-order-lines-table td,
.sale-order-lines-table th { padding: 6px 8px; }

/* ── Sale-order line cards ─────────────────────────────────────────────────── */
.so-lines-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.so-line-row {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.so-line-product-wrap .ss-wrap,
.so-line-product-wrap .form-select { width: 100%; max-width: none; }

.so-line-extra {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.so-line-ctrl--linea  { flex: 0 1 160px; min-width: 100px; }
.so-line-ctrl--sku    { flex: 0 1 90px;  min-width: 70px; }
.so-line-ctrl--detalle { flex: 1 1 120px; min-width: 100px; }
.so-line-extra .so-line-ctrl .form-select,
.so-line-extra .so-line-ctrl .form-input { width: 100%; padding: 5px 8px; font-size: 13px; }

.so-line-controls {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.so-line-ctrl {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 60px;
}

.so-line-ctrl--total { flex: 0 0 auto; min-width: 70px; }

.so-line-ctrl-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.so-line-ctrl .form-input {
    width: 100%;
    padding: 5px 8px;
    font-size: 13px;
}

.so-line-total {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    padding: 5px 0;
}

.so-line-remove { align-self: flex-end; flex-shrink: 0; }

/* Sale-order modal layout */
.so-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 32px;
    align-items: start;
    margin-bottom: 0;
}

.so-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.so-col .form-group { margin-bottom: 14px; }

.so-label-note {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 11px;
}

.so-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: var(--gray-900);
    padding: 10px 0 2px;
    margin: 0;
    user-select: none;
}

.so-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--crimson);
}

.so-revenue-block {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px 18px 6px;
    background: var(--gray-50);
}

.so-revenue-block__title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-500);
    margin: 0 0 14px 0;
}

.so-revenue-block__chevron { display: none; }
.so-revenue-block__header-total { display: none; }

.so-revenue-block .form-group { margin-bottom: 14px; }
.so-revenue-block .form-group.so-revenue-block__last { margin-bottom: 4px; }

/* Processing lines */
.processing-lines-wrap {
    margin: 10px 12px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.processing-lines-wrap-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.processing-lines-wrap-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.processing-lines-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 14px;
}

.processing-lines-empty {
    font-size: 13px;
    color: var(--gray-500);
    font-style: italic;
}

.processing-line-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--blue-bg);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    font-size: 12px;
    color: var(--blue-700);
    font-weight: 500;
}

/* ============================================================================
   Pivot Table
   ============================================================================ */

.pivot-container {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

/* Top bar: Solo activos + chips */
.pivot-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 8px;
    flex-wrap: wrap;
}

.pivot-topbar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pivot-topbar-divider {
    width: 1px;
    height: 22px;
    background: var(--gray-200);
    flex-shrink: 0;
}

.pivot-active-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

/* Accordions */
.pivot-accordion {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.pivot-accordion-hdr {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: var(--gray-50);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-align: left;
    transition: background 0.15s;
}
.pivot-accordion-hdr:hover { background: var(--gray-100); }

.pivot-acc-dot {
    font-size: 9px;
    color: var(--crimson, #DC143C);
    line-height: 1;
}

.pivot-acc-caret {
    margin-left: auto;
    font-size: 11px;
    color: var(--gray-400);
}

.pivot-accordion-body {
    padding: 12px 14px;
    background: var(--white);
}

.pivot-presets-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 10px;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
    margin-bottom: 10px;
}
.pivot-presets-label {
    font-size: 11px;
    color: var(--gray-400, #9ca3af);
    margin-right: 2px;
    white-space: nowrap;
}
.pivot-preset-chip {
    background: none;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 12px;
    padding: 3px 11px;
    font-size: 12px;
    color: var(--gray-600, #4b5563);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.pivot-preset-chip:hover {
    background: var(--gray-50, #f9fafb);
    border-color: var(--gray-400, #9ca3af);
}
.pivot-preset-chip--active {
    background: rgba(220,20,60,.07);
    border-color: var(--crimson, #DC143C);
    color: var(--crimson, #DC143C);
    font-weight: 500;
}

.pivot-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}

.pivot-fbar-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pivot-fbar-group--check {
    flex-direction: row;
    align-items: center;
    padding-bottom: 2px;
}

/* ── Pivot filter sections (grouping within the accordion) ── */
.pivot-fbar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.pivot-fbar-section + .pivot-fbar-section {
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}
.pivot-fbar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.pivot-fbar-section-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.pivot-fbar-group--daterange {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pivot-fbar-group--daterange .pivot-fbar-datepair {
    display: flex;
    gap: 4px;
    align-items: center;
}
.pivot-fbar-group--daterange .pivot-fbar-datepair input[type="date"] {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-800);
    width: 128px;
}
.pivot-fbar-group--daterange .pivot-fbar-datepair input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
}
.pivot-fbar-group--probrange {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pivot-fbar-group--probrange .pivot-fbar-probpair {
    display: flex;
    gap: 4px;
    align-items: center;
}
.pivot-fbar-group--probrange .pivot-fbar-probpair input[type="number"] {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-800);
    width: 60px;
    text-align: center;
}
.pivot-fbar-group--probrange .pivot-fbar-probpair input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}
.pivot-fbar-datepair-sep,
.pivot-fbar-probpair-sep {
    color: var(--gray-400);
    font-size: 11px;
}

.dash-usd-toggle {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 14px; border-radius: 20px;
    border: 1.5px solid var(--crimson); background: transparent;
    color: var(--crimson); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.dash-usd-toggle--active,
.dash-usd-toggle.is-active { background: var(--crimson); color: #fff; }
.dash-usd-toggle:hover:not(.dash-usd-toggle--active):not(.is-active) { background: rgba(220,20,60,.07); }
.dash-usd-toggle svg { flex-shrink: 0; }
.dash-usd-toggle.pivot-today-btn { padding: 3px 8px; font-size: 11px; margin-left: 4px; }

.pivot-view-chip-clear {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0 2px;
    color: var(--gray-400);
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
}
.pivot-view-chip-clear:hover {
    color: var(--gray-700);
}

.pivot-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
}

.pivot-ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pivot-status-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.pivot-ctrl-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.pivot-ctrl-group .form-select {
    min-width: 160px;
    font-size: 13px;
}

.pivot-status-text {
    font-size: 12px;
    color: var(--gray-400);
}

.pivot-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(96vh - 120px);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.pivot-table-container { min-width: 100%; }

.pivot-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: 11px;
}

.pivot-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--gray-50);
}

.pivot-table th {
    padding: 4px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-300);
    border-right: 1px solid var(--gray-200);
    background: var(--gray-50);
    white-space: nowrap;
    line-height: 1.3;
}

.pivot-table th.pivot-row-header,
.pivot-table th.pivot-dimension-header {
    background: var(--crimson-light);
    color: var(--crimson);
    font-weight: 700;
    position: sticky;
    left: 0;
    z-index: 11;
    min-width: 90px;
}

.pivot-table th.pivot-total-col {
    background: var(--gray-100);
    font-weight: 700;
    color: var(--gray-900);
}

.pivot-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200);
    text-align: right;
    line-height: 1.2;
}

.pivot-table td.pivot-row-header {
    font-weight: 600;
    color: var(--gray-900);
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--white);
    min-width: 100px;
}

.pivot-table td.pivot-year-col,
.pivot-table th.pivot-year-header {
    min-width: 56px;
    width: 56px;
    text-align: center;
    font-weight: 600;
    color: var(--gray-500);
}

.pivot-table tbody tr:hover { background: var(--gray-50); }
.pivot-table tbody tr:hover td.pivot-row-header { background: var(--gray-50); }

.pivot-table tr.pivot-total-row {
    background: var(--gray-100);
    font-weight: 600;
}

.pivot-table tr.pivot-total-row td {
    border-top: 2px solid var(--gray-300);
    border-bottom: 2px solid var(--gray-300);
}

.pivot-table tr.pivot-total-row td.pivot-row-header {
    background: var(--gray-100);
    position: sticky;
    left: 0;
    z-index: 6;
}

.pivot-table td.pivot-total-col {
    background: var(--gray-50);
    font-weight: 600;
}

.pivot-table tr.pivot-total-row td.pivot-total-col {
    background: var(--gray-200);
    font-weight: 700;
}

.pivot-table tr.pivot-metric-row th.pivot-metric-desc {
    background: var(--crimson);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 12px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 12;
}

.pivot-cell {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-900);
    white-space: nowrap;
}

.pivot-cell--empty {
    color: var(--gray-300);
    font-weight: 400;
}

.pivot-cell--count {
    text-align: right;
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 400;
    padding: 3px 6px;
    border-left: 1px solid var(--gray-100);
    min-width: 36px;
    width: 36px;
}

.pivot-subheader-row th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--gray-400);
    padding: 3px 8px;
    background: var(--gray-50);
    white-space: nowrap;
}

.pivot-col-subheader--count {
    border-left: 1px solid var(--gray-100);
    color: var(--gray-400);
}

.pivot-col-subheader--nth {
    border-left: 1px solid var(--gray-200);
}

.pivot-cell--nth {
    border-left: 1px solid var(--gray-100);
}

/* Metrics dropdown widget */
.pivot-metrics-widget {
    position: relative;
}

.pivot-metrics-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 160px;
    color: var(--gray-900);
    text-align: left;
}

.pivot-metrics-caret {
    flex-shrink: 0;
    color: var(--gray-400);
    transition: transform 0.15s;
}

.pivot-metrics-dropdown.is-open ~ * .pivot-metrics-caret,
.pivot-metrics-widget:has(.pivot-metrics-dropdown.is-open) .pivot-metrics-caret {
    transform: rotate(180deg);
}

.pivot-metrics-dropdown {
    display: none;
    position: fixed;
    min-width: 210px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    z-index: 9999;
    padding: 6px 0;
}

.pivot-metrics-dropdown.is-open {
    display: block;
}

.pivot-metric-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-700);
    cursor: pointer;
    white-space: nowrap;
    padding: 5px 14px;
    transition: background 0.1s;
}

.pivot-metric-check:hover {
    background: var(--gray-50);
}

.pivot-metric-check input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--crimson);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Metric chips (rendered inside pivot-active-filter-bar) */

.pivot-metric-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background: var(--crimson-light, #fdecea);
    color: var(--crimson);
    border: 1px solid color-mix(in srgb, var(--crimson) 25%, transparent);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.6;
    margin: 1px 0;
}

.pivot-metric-chip-label {
    color: var(--crimson);
    opacity: 0.65;
    font-weight: 400;
}

.pivot-metric-chip-value {
    color: var(--crimson);
    font-weight: 600;
}

.pivot-metric-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--crimson);
    font-size: 15px;
    line-height: 1;
    padding: 0 0 1px 0;
    display: flex;
    align-items: center;
    opacity: 0.7;
    transition: opacity 0.1s;
}

.pivot-metric-chip-remove:hover {
    opacity: 1;
}

.pivot-grand-total {
    background: var(--crimson-light);
    color: var(--crimson);
    font-weight: 700;
}

.pivot-row-header--group {
    background: var(--gray-50);
    border-right: 2px solid var(--gray-300);
    vertical-align: top;
    padding-top: 8px;
}

.pivot-row-header--sub {
    font-weight: 400;
    color: var(--gray-600);
    padding-left: 20px;
    font-size: 12px;
}

.pivot-subtotal-row td {
    background: var(--gray-100);
    border-top: 1px solid var(--gray-300);
    font-weight: 600;
}

.pivot-subtotal-grand {
    background: var(--gray-200);
    font-weight: 700;
}

.pivot-table strong { color: var(--gray-900); }

.pivot-value {
    font-size: 12px;
    color: var(--gray-900);
    font-weight: 500;
    line-height: 1.2;
}

.pivot-count {
    font-size: 10px;
    color: var(--gray-500);
    line-height: 1.1;
}

/* ============================================================================
   Timeline
   ============================================================================ */

.timeline-wrap {
    margin-top: 24px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.timeline-wrap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.timeline-wrap-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-wrap-body {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.timeline-loading-text {
    font-size: 13px;
    color: var(--gray-400);
    margin: 0;
    padding: 4px 0;
}

.timeline-empty {
    font-size: 13px;
    color: var(--gray-400);
    text-align: center;
    padding: 24px 0;
    margin: 0;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.timeline-entry {
    display: flex;
    gap: 10px;
    position: relative;
    padding-bottom: 18px;
}

.timeline-entry:last-child { padding-bottom: 0; }

.timeline-entry::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 18px;
    bottom: 0;
    width: 1px;
    background: var(--gray-200);
}

.timeline-entry:last-child::before { display: none; }

/* Dots */
.timeline-entry-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    z-index: 1;
    background: var(--gray-300);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--gray-300);
}

.timeline-entry--stage .timeline-entry-dot    { background: var(--crimson);       box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--crimson); }
.timeline-entry--message .timeline-entry-dot  { background: var(--gray-500);      box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--gray-500); }
.timeline-entry--creation .timeline-entry-dot { background: var(--tl-creation);   box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--tl-creation); }
.timeline-entry--sale .timeline-entry-dot     { background: var(--tl-sale);       box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--tl-sale); }

/* Type badges */
.timeline-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 3px;
    line-height: 1.6;
    vertical-align: middle;
}

.timeline-type-badge--stage    { background: var(--tl-stage-bg);    color: var(--crimson); }
.timeline-type-badge--message  { background: var(--gray-100);       color: var(--gray-500); }
.timeline-type-badge--email    { background: var(--blue-bg);        color: var(--tl-sale); }
.timeline-type-badge--creation { background: var(--tl-creation-bg); color: var(--tl-creation); }
.timeline-type-badge--sale     { background: var(--tl-sale-bg);     color: var(--tl-sale); }

/* Content */
.timeline-entry-content { flex: 1; min-width: 0; }

.timeline-entry-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}

.timeline-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.timeline-date {
    font-size: 12px;
    color: var(--gray-400);
}

.timeline-body {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
    margin-top: 3px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Field changes */
.timeline-changes {
    list-style: none;
    margin: 6px 0 0 0;
    padding: 7px 10px;
    background: var(--gray-50);
    border-radius: 4px;
    border-left: 2px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.timeline-entry--stage .timeline-changes { border-left-color: var(--crimson-light); }

.timeline-change-item {
    font-size: 12px;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.timeline-change-field { font-weight: 600; color: var(--gray-700); }
.timeline-change-old   { color: var(--gray-400); text-decoration: line-through; }
.timeline-change-arrow { color: var(--gray-400); font-size: 11px; }
.timeline-change-new   { font-weight: 500; color: var(--gray-800); }

/* Minimal timeline (Historial tab) */
.tl-item {
    padding: 7px 0 7px 10px;
    border-left: 2px solid var(--gray-200);
    margin-bottom: 8px;
}

.tl-item:last-child { margin-bottom: 0; }
.tl-item--stage     { border-left-color: var(--crimson); }
.tl-item--creation  { border-left-color: var(--tl-creation); }
.tl-item--sale,
.tl-item--email     { border-left-color: var(--tl-sale); }
.tl-item--message   { border-left-color: var(--gray-300); }

.tl-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tl-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    background: var(--gray-100);
    color: var(--gray-500);
}

.tl-badge--stage    { background: var(--tl-stage-bg); color: var(--crimson); }
.tl-badge--creation { background: var(--tl-creation-bg); color: var(--tl-creation); }
.tl-badge--sale,
.tl-badge--email    { background: var(--tl-sale-bg); color: var(--tl-sale); }

.tl-actor {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.tl-date {
    font-size: 11px;
    color: var(--gray-400);
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.tl-body {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 4px;
    line-height: 1.4;
    word-break: break-word;
}

.tl-changes {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tl-change {
    font-size: 11px;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.tl-change-field { font-weight: 600; color: var(--gray-700); }
.tl-change-old   { color: var(--gray-400); text-decoration: line-through; }
.tl-change-arrow { color: var(--gray-400); }
.tl-change-new   { font-weight: 500; color: var(--gray-800); }

/* ============================================================================
   Contacts — Kanban View & Detail
   ============================================================================ */

.contacts-kanban-container { margin-top: 16px; }

.contacts-kanban-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.contacts-kanban-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.contacts-kanban-skeleton-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.contacts-kanban-skeleton-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.contacts-kanban-skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.contacts-kanban-skeleton-title { height: 14px; flex: 1; }
.contacts-kanban-skeleton-line { height: 12px; margin-bottom: 10px; }
.contacts-kanban-skeleton-line:last-child { margin-bottom: 0; }

.contact-relation-cell {
    max-width: 220px;
    font-size: 13px;
    color: var(--gray-600);
}

.contact-card-relation {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.contact-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--crimson);
}

.contact-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.contact-card-id {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.contact-card-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-700);
    min-width: 0;
}

.contact-card-info svg {
    flex-shrink: 0;
    stroke: var(--gray-500);
    width: 16px;
    height: 16px;
}

.contact-card-info span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-card {
    min-width: 0;
}

.contact-card-body {
    min-width: 0;
}

/* Contact form layouts */
.contact-form-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px 12px 0;
}

.contact-form-sections-full {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}

.contact-form-sections-full > .full-span { grid-column: 1 / -1; }

.contact-form-sections-full--single-col { grid-template-columns: 1fr; }

/* Evita que el contenido interno (p.ej. tablas anchas) fuerce el ancho de la celda de grid
   más allá del viewport — sin esto, .main-content (overflow-x:hidden en mobile) corta el contenido */
.contact-form-sections > *,
.contact-form-sections-full > *,
.contact-relations-wrap > * { min-width: 0; }

.contact-relations-wrap {
    padding: 10px 12px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.contact-relations-wrap .modal-relation-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.contact-relations-wrap .modal-relation-add .form-select,
.contact-relations-wrap .modal-relation-add .form-input {
    flex: 1;
    min-width: 100px;
    padding: 8px 10px;
    font-size: 13px;
}

/* Companies list */
.companies-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.company-link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
}

.company-link-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.company-link-position {
    color: var(--gray-500);
    font-size: 12px;
}

/* ============================================================================
   Geo Detail
   ============================================================================ */

.geo-detail-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    align-items: start;
}

.geo-panels-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.geo-member-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.geo-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--gray-700);
}

.geo-member-item:last-child { border-bottom: none; }
.geo-member-item:hover { background: var(--gray-50); }
.geo-member-item.is-checked { background: rgba(220,20,60,0.06); border-left: 2px solid rgba(220,20,60,0.4); }
.geo-member-item input[type="checkbox"] { accent-color: var(--crimson); width: 15px; height: 15px; cursor: pointer; }

.geo-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 0 10px;
}

.geo-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px 3px 9px;
    background: rgba(220,20,60,0.08);
    border: 1px solid rgba(220,20,60,0.22);
    border-radius: 12px;
    font-size: 12px;
    color: var(--gray-700);
    line-height: 1.4;
}

.geo-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--crimson);
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.65;
}
.geo-chip-remove:hover { opacity: 1; }

.geo-member-code {
    font-size: 11px;
    color: var(--gray-500);
    margin-left: 6px;
}

/* ============================================================================
   Responsive — Views
   ============================================================================ */

@media (max-width: 900px) {
    .contact-form-sections,
    .contact-form-sections-full,
    .contact-relations-wrap { grid-template-columns: 1fr; }

    .contact-form-sections-full > .full-span { grid-column: auto; }
    .geo-detail-layout { grid-template-columns: 1fr; }
    .geo-panels-row { grid-template-columns: 1fr; }
    .so-fields-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .contacts-kanban-grid { grid-template-columns: 1fr; }
    .kanban-column { min-width: 300px; max-width: 300px; }
    .modal-content { width: 95%; max-height: 95vh; }
    .modal-detail-row { grid-template-columns: 1fr; }
    .stages-grid { grid-template-columns: 1fr; }

    .modal-content-small {
        width: 95%;
        max-width: 100%;
    }
}

@media (max-width: 680px) {
    .prospect-form-v5-cols { grid-template-columns: 1fr; }
    .prospect-form-v5-col:first-child { border-right: none; border-bottom: 1px solid var(--gray-300); }
    .prospect-form-v5-fullrow-grid { grid-template-columns: 1fr; gap: 0; }

    .prospect-field-row--name {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .prospect-field-row--name .prospect-field-label {
        white-space: normal !important;
        flex: 1 1 100% !important;
    }
    .prospect-field-row--name .prospect-field-control {
        flex: 1 1 100% !important;
    }
    .prospect-name-customer,
    .prospect-name-probability {
        flex: 1 1 auto !important;
    }
    .prospect-name-customer { justify-content: flex-start !important; }

    /* Filas label+control estándar: apiladas para que el control tenga
       todo el ancho disponible y nunca quede recortado por la etiqueta fija. */
    .prospect-field-row:not(.prospect-field-row--name) {
        flex-wrap: wrap;
        align-items: flex-start;
        row-gap: 4px;
    }
    .prospect-field-row:not(.prospect-field-row--name) .prospect-field-label {
        width: auto;
        min-width: 0;
        flex: 1 1 100%;
    }
    .prospect-field-row:not(.prospect-field-row--name) .prospect-field-control {
        flex: 1 1 100%;
    }
}

@media (max-width: 1200px) {
    #modal-prospect-form { grid-template-columns: 1fr; }
}

/* ── Type toggle buttons — trío "Solo activos / Solo inactivos / Todos" y
   variantes (Compañía/Persona, Sí/No, etc). Antes vivía solo como estilo local
   de contacts.html; ahora es global para que cualquier página lo reuse (users.html). */
.btn-type-toggle {
    padding: 3px 11px;
    border: 1px solid var(--gray-300);
    border-radius: 14px;
    background: var(--white);
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.6;
}
.btn-type-toggle.active {
    background: var(--crimson, #DC143C);
    border-color: var(--crimson, #DC143C);
    color: #fff;
}
.btn-type-toggle:hover:not(.active) {
    border-color: var(--gray-400);
    background: var(--gray-50);
}
.btn-type-toggle.active-warn {
    background: #c07000;
    border-color: #c07000;
    color: #fff;
}
.btn-type-toggle.active-neutral {
    background: var(--gray-600, #6c757d);
    border-color: var(--gray-600, #6c757d);
    color: #fff;
}

/* ============================================================================
   Responsive — Prospects: Mobile (<768px)
   ============================================================================ */

@media (max-width: 767px) {

    /* Vista Pivote: no disponible en mobile */
    #view-pivot { display: none !important; }

    /* Exportar Excel: no disponible en mobile */
    #btn-export-excel-header { display: none !important; }

    /* Kanban: scroll horizontal con snap por columna */
    .kanban-container {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 0 0 20px;
    }
    .kanban-board {
        padding: 8px 16px;
        gap: 12px;
    }
    .kanban-column {
        min-width: 80vw;
        max-width: 80vw;
        scroll-snap-align: center;
        flex-shrink: 0;
        flex: 0 0 auto;
    }

    .kanban-phase-group {
        flex: 0 0 auto !important;
        min-width: 0;
    }
    .kanban-phase-columns { flex-wrap: nowrap; }
    .kanban-phase-label {
        font-size: 11px;
        padding: 6px 10px;
        box-sizing: border-box;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    .prospects-pagination-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .prospects-pagination-summary { text-align: center; white-space: normal; }
    .prospects-pagination-pages { justify-content: center; }

    /* Vista Lista: ocultar columnas Comercial y País en mobile */
    #prospects-list-table th:nth-child(6),
    #prospects-list-table td:nth-child(6),
    #prospects-list-table th:nth-child(7),
    #prospects-list-table td:nth-child(7) { display: none; }

    /* "Monto presupuestado": acordeón cerrado, arriba de todo en el form de presupuesto */
    .so-fields-grid { gap: 0; }
    .so-fields-grid .so-col:nth-child(2) { order: -1; margin-bottom: 16px; }
    .so-revenue-block__header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        margin: -16px -18px 0;
        padding: 16px 18px 22px;
    }
    .so-revenue-collapsed .so-revenue-block__header { margin-bottom: -6px; }
    .so-revenue-block__header .so-revenue-block__title { margin: 0; }
    .so-revenue-block__header-total {
        display: block;
        font-size: 12px;
        font-weight: 500;
        color: var(--gray-400);
    }
    .so-revenue-block__chevron {
        position: absolute;
        left: 50%;
        bottom: 2px;
        transform: translateX(-50%) rotate(180deg);
        display: block;
        line-height: 1;
        color: var(--gray-400);
        font-size: 20px;
        transition: transform 0.15s ease;
    }
    .so-revenue-collapsed .so-revenue-block__chevron { transform: translateX(-50%) rotate(0deg); }
    .so-revenue-block__body {
        overflow: hidden;
        max-height: 600px;
        transition: max-height 0.2s ease;
    }
    .so-revenue-collapsed .so-revenue-block__body {
        max-height: 0;
    }

    /* Modales grandes: full-screen */
    #prospect-modal,
    #sale-order-modal {
        align-items: stretch;
        justify-content: stretch;
    }
    #prospect-modal .modal-content,
    #sale-order-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100%;
        border-radius: 0;
        margin: 0;
        animation: none;
        display: flex;
        flex-direction: column;
    }
    /* El body scrollea internamente; sin max-height heredado del base */
    #prospect-modal .modal-body,
    #sale-order-modal .modal-body {
        flex: 1 1 0;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        /* Espacio para el footer fijo */
        padding-bottom: 72px;
    }
    /* Footer fijo al viewport: siempre visible sin importar el scroll */
    #prospect-modal .modal-footer,
    #sale-order-modal .modal-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 2100;
        border-radius: 0;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    #prospect-modal .modal-header {
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        align-items: center;
        position: relative;
    }
    #prospect-modal .modal-header-center {
        grid-column: 2;
        text-align: center;
        min-width: 0;
    }
    #prospect-modal .modal-header .modal-close {
        grid-column: 3;
    }
    #prospect-modal .modal-header-center #modal-type-badge,
    #prospect-modal .modal-header-center .modal-header-meta-row {
        display: flex;
        justify-content: center;
    }
    #prospect-modal .modal-header-center h2 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #prospect-modal .modal-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        justify-self: start;
        border: none;
        border-radius: 50%;
        background: var(--gray-100);
        font-size: 20px;
        line-height: 1;
        color: var(--gray-700);
        cursor: pointer;
        letter-spacing: 1px;
    }
    #prospect-modal .modal-menu-btn:active {
        background: var(--gray-200);
    }
    #prospect-modal .modal-mobile-menu {
        position: absolute;
        top: 100%;
        left: 8px;
        margin-top: 4px;
        min-width: 200px;
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-md);
        z-index: 2200;
        padding: 6px;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .modal-mobile-menu-item {
        display: block;
        width: 100%;
        text-align: left;
        padding: 10px 12px;
        min-height: 40px;
        font-size: 14px;
        font-weight: 500;
        color: var(--gray-900);
        background: none;
        border: none;
        border-radius: var(--radius-sm);
        cursor: pointer;
    }
    .modal-mobile-menu-item:disabled,
    .modal-mobile-menu-item.disabled {
        color: var(--gray-400);
        cursor: not-allowed;
    }
    .modal-mobile-menu-item-label {
        text-decoration: none;
    }
    .modal-mobile-menu-item.active .modal-mobile-menu-item-label {
        color: var(--gray-900);
        font-weight: 700;
        text-decoration: underline;
        text-underline-offset: 3px;
    }
    .modal-mobile-menu-sep {
        height: 1px;
        background: var(--gray-200);
        margin: 4px 2px;
    }
    .modal-mobile-menu-reason {
        margin: 2px 4px 6px;
        padding: 8px 10px;
        background: #fff8f0;
        border: 1px solid #fb923c55;
        border-left: 3px solid #fb923c;
        border-radius: var(--radius-sm);
        font-size: 12px;
        line-height: 1.4;
        color: #7a4a00;
    }

    #prospect-modal table {
        width: 100% !important;
        table-layout: fixed;
    }
    #prospect-modal table th,
    #prospect-modal table td {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    #prospect-modal #modal-tabs-bar,
    #prospect-modal #stage-pipeline-wrap,
    #prospect-modal #modal-delete-btn,
    #prospect-modal .modal-footer .btn-secondary {
        display: none !important;
    }
    .modal-mobile-menu-title {
        padding: 8px 12px 4px;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--gray-400);
    }
    .modal-mobile-menu-item--stage.done { color: var(--gray-400); }
    .modal-mobile-menu-item--stage.active .modal-mobile-menu-item-label {
        color: var(--gray-900);
        font-weight: 700;
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    #prospect-modal #modal-incomplete-warning {
        padding: 0;
        background: none;
        border-left: none;
        position: relative;
    }
    #prospect-modal .incomplete-warning-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        margin: 6px 0 6px 16px;
        background: #fb923c;
        color: #fff;
        border: none;
        border-radius: 50%;
        font-size: 16px;
        font-weight: 700;
        cursor: pointer;
        flex-shrink: 0;
    }
    #prospect-modal .incomplete-warning-text { display: none; }
    #prospect-modal #modal-incomplete-warning.warning-open .incomplete-warning-text {
        display: block;
        position: absolute;
        top: 100%;
        left: 16px;
        right: 16px;
        margin-top: 4px;
        background: #fff8f0;
        border: 1px solid #fb923c55;
        border-left: 3px solid #fb923c;
        border-radius: var(--radius-md);
        padding: 10px 12px;
        font-size: 13px;
        line-height: 1.4;
        color: #7a4a00;
        z-index: 50;
        box-shadow: var(--shadow-md);
    }
    #prospect-modal .incomplete-warning-text > span:first-child { display: none; }
    .modal-mobile-menu-warn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        margin-left: 6px;
        background: #fb923c;
        color: #fff;
        border-radius: 50%;
        font-size: 10px;
        font-weight: 700;
        vertical-align: middle;
    }

    /* Modales pequeños: bottom-sheet */
    #change-stage-modal,
    #confirm-stage-modal,
    #confirm-delete-modal,
    #app-confirm-modal,
    #confirm-delete-so-modal,
    #views-modal {
        align-items: flex-end;
        justify-content: flex-end;
    }
    #change-stage-modal .modal-content,
    #confirm-stage-modal .modal-content,
    #confirm-delete-modal .modal-content,
    #app-confirm-modal .modal-content,
    #confirm-delete-so-modal .modal-content,
    #views-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin: 0;
        animation: mobileSheetIn 0.25s ease-out;
    }
    /* Filtro personalizado (usa .modal-overlay--fixed como raíz) */
    #custom-filter-modal.modal-overlay--fixed {
        align-items: flex-end;
        justify-content: flex-end;
    }
    #custom-filter-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin: 0;
        animation: mobileSheetIn 0.25s ease-out;
    }
    @keyframes mobileSheetIn {
        from { transform: translateY(40px); opacity: 0.7; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .quick-filter-bar { display: none; }
    .quick-filter-bar.mobile-visible {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        padding-bottom: 6px;
        margin-right: -16px;
        padding-right: 16px;
    }
    .quick-filter-bar.mobile-visible .quick-filter-chip,
    .quick-filter-bar.mobile-visible .quick-filter-sep,
    .quick-filter-bar.mobile-visible #qf-role-group {
        flex-shrink: 0;
    }

    /* Active filter chips bar: oculta en mobile; visible solo al abrir filtros */
    #active-filter-bar { display: none !important; }
    .filters-card--prospects:has(#btn-toggle-filters.active) #active-filter-bar { display: block !important; }

    .btn-clear-filters { display: none; }
    .btn-filter-icon { display: block; }
    .btn-filter-label { display: none; }
    .btn-filter-chevron { display: none; }
    #btn-toggle-filters {
        width: 44px;
        padding: 0;
        flex-shrink: 0;
    }

    .filters-collapse-bar { display: none; }
    .filters-tab-slot { display: none; }

    #mobile-filters-sheet {
        display: none;
    }
    #mobile-filters-sheet.mobile-sheet-open {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        z-index: 2500;
        background: var(--white);
    }
    .mobile-filters-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        padding: 14px 16px;
        border-bottom: 1px solid var(--gray-200);
    }
    .mobile-filters-sheet-title {
        font-size: 16px;
        font-weight: 700;
        color: var(--gray-900);
    }
    .mobile-filters-sheet-close {
        min-width: 44px;
        min-height: 44px;
        background: none;
        border: none;
        font-size: 22px;
        line-height: 1;
        color: var(--gray-500);
        cursor: pointer;
    }
    .mobile-filters-sheet-body {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 14px 16px 24px;
    }
    #mobile-filters-active-slot:not(:empty) {
        margin-bottom: 14px;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--gray-100);
    }
    #mobile-filters-active-slot .filter-active-toggle {
        min-height: 44px;
        font-size: 14px;
        padding: 8px 14px 8px 10px;
    }
    .mobile-filters-sheet-footer {
        display: flex;
        flex-shrink: 0;
        gap: 10px;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--gray-200);
        box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    }
    .mobile-filters-sheet-footer .btn { flex: 1; justify-content: center; }

    /* Kanban card actions: siempre visibles en touch (no dependen de hover) */
    .kanban-card-actions { display: flex; }
    .kanban-card-action-btn { min-width: 44px; min-height: 44px; width: auto; height: auto; }

    /* Touch targets mínimos 44px */
    .view-btn          { min-height: 44px; padding: 0 10px; }
    .btn               { min-height: 44px; }
    .quick-filter-chip { min-height: 44px; }
    .modal-close       { min-width: 44px; min-height: 44px; }

    .unified-search-row {
        flex-wrap: wrap;
        gap: 8px;
        align-items: flex-start;
    }
    .unified-search-main {
        flex: 1 1 100%;
        min-width: 0;
        flex-wrap: wrap;
        align-items: center;
    }
    .unified-search-wrap { flex: 1 0 100%; min-width: 0; }
    .active-search-chips { flex: 0 0 100%; min-width: 0; }
    .unified-search-input { height: 44px; font-size: 15px; }
    .unified-search-actions {
        flex: 1 1 100%;
        min-width: 0;
        flex-wrap: wrap;
        gap: 6px;
    }
    .unified-search-actions > div {
        flex-wrap: wrap;
        min-width: 0;
    }
    .btn-type-toggle {
        min-height: 36px;
        padding: 6px 12px;
    }

    .filter-active-toggle {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* ── Secondary filters: columna única en mobile ─────────────────────── */

    /* Pasar de 2 columnas a layout apilado */
    .sf-layout { flex-direction: column; gap: 0; }
    .sf-col-shortcuts {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        border-top: 1px solid var(--gray-200);
        padding-top: 10px;
        margin-top: 6px;
    }

    .secondary-filters-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px 10px;
        align-items: start;
    }
    .filter-category-label {
        grid-column: 1 / -1;
        margin: 4px 0 -8px;
    }
    .secondary-filters-grid .filter-item {
        min-width: 0 !important;
        max-width: none !important;
        width: 100% !important;
        gap: 5px;
    }
    .secondary-filters-grid .filter-item .filter-label {
        font-size: 11px;
        line-height: 1.3;
    }
    .secondary-filters-grid .filter-item .form-select--sm,
    .secondary-filters-grid .filter-item .form-input--sm {
        max-width: none !important;
        width: 100% !important;
        box-sizing: border-box;
        min-height: 40px;
        font-size: 13px;
        padding: 8px 10px;
    }
    .secondary-filters-grid .filter-item .ss-wrap {
        max-width: none !important;
        width: 100% !important;
    }
    .secondary-filters-grid .filter-item .ss-trigger {
        width: 100% !important;
        box-sizing: border-box;
        min-height: 40px;
        padding: 8px 10px;
    }
    .secondary-filters-grid .filter-item .ss-trigger-text { font-size: 13px; }

    /* Filas de fecha: apilar etiqueta encima de los inputs */
    .date-filter-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .date-filter-row-label { min-width: 0; padding-top: 0; }
    .date-range-inputs { gap: 4px; flex-wrap: wrap; align-items: center; }
    .date-range-inputs .form-input { width: 130px; min-width: 0; }

    .golive-overlap-label {
        flex: 1 0 calc(100% - 24px);
        margin-left: 0;
        margin-top: 6px;
        gap: 8px;
        font-size: 14px;
        min-height: 44px;
    }
    .golive-overlap-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
    .golive-overlap-label + .filter-check-info {
        margin-top: 6px;
        width: 16px;
        height: 16px;
        font-size: 10px;
    }

    .shortcuts-col { gap: 10px; align-items: center; }
    .date-shortcut-block { padding-top: 10px; align-items: center; }
    .date-shortcut-target-row { justify-content: center; flex-wrap: wrap; }
    .shortcuts-quadrants { flex-wrap: wrap; gap: 6px; justify-content: center; }
    .deadline-shortcut-group { min-width: 0; }

    .prob-chip-group { justify-content: center; flex-wrap: wrap; }

    /* Stage pipeline: pills individuales con scroll horizontal */
    .stage-pipeline-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        padding: 8px 12px;
        white-space: nowrap;
    }
    .stage-pipeline {
        display: inline-flex;
        width: auto;
        gap: 5px;
        align-items: center;
    }
    /* Cada etapa: pill independiente (anula la barra conectada del base) */
    .stage-step {
        flex: 0 0 auto !important;
        border: 1.5px solid var(--gray-300) !important;
        border-radius: var(--radius-full) !important;
        padding: 6px 13px !important;
        font-size: 11px !important;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .stage-step:last-child {
        border-right: 1.5px solid var(--gray-300) !important;
        border-radius: var(--radius-full) !important;
    }
    .stage-step--active {
        max-width: 160px !important;
        font-size: 12px !important;
        box-shadow: 0 2px 10px rgba(220, 20, 60, 0.3);
    }
    .stage-step--active:last-child {
        border-right-color: var(--crimson) !important;
    }
    .stage-step--done { opacity: 0.65; }

    /* Controls bar: ocultar en mobile; visible solo al abrir filtros */
    .prospects-controls-bar { display: none; flex-wrap: wrap; }
    .page-container:has(#btn-toggle-filters.active) .prospects-controls-bar { display: flex; }
    #group-by-container     { width: 100%; }

    /* ── Contacts ──────────────────────────────────────────────────────────── */

    /* Page header: acciones en fila completa con wrapping */
    .page-header-actions { width: 100%; flex-wrap: wrap; }

    /* Exportar Excel: no disponible en mobile (paridad con prospects) */
    #btn-export-excel-contacts { display: none !important; }

    /* Lista: ocultar columnas Teléfono (5ª) y Modificado (6ª) — corrido +1 por la
       columna "Completar" agregada como 1ª columna */
    #contacts-table th:nth-child(5),
    #contacts-table td:nth-child(5),
    #contacts-table th:nth-child(6),
    #contacts-table td:nth-child(6) { display: none; }

    /* Modal de edición: full-screen */
    #contact-modal { align-items: stretch; justify-content: stretch; }
    #contact-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100%;
        border-radius: 0;
        margin: 0;
        animation: none;
    }

    /* Modales de confirmación: bottom-sheet */
    #type-change-confirm-modal,
    #delete-contact-modal { align-items: flex-end; justify-content: flex-end; }
    #type-change-confirm-modal .modal-content,
    #delete-contact-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin: 0;
        animation: mobileSheetIn 0.25s ease-out;
    }

    /* Footer del modal de edición: evitar desbordamiento en pantallas < 380px */
    #contact-modal .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    #contact-modal .modal-footer a#contact-modal-open-full {
        width: 100%;
        text-align: center;
    }

    /* Pestaña Equipos (contact_form.html): tablas anchas con scroll horizontal en vez de desbordar */
    #wl-equipment-table-wrap,
    #comp-equipment-table-wrap,
    #del-equipment-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #wl-equipment-table-wrap table,
    #comp-equipment-table-wrap table,
    #del-equipment-table-wrap table {
        min-width: 640px;
    }

    /* Formulario de contacto: apilar filas de 2+ columnas (Nombre/Email/Teléfono, etc.) */
    .form-row { grid-template-columns: 1fr; }

    /* Marketing + Relaciones ("Compañía en la que trabaja"/"Personas que trabajan aquí"): apilar */
    .marketing-relations-row { flex-direction: column; }

    /* Headers de sección con título + botón: no solaparse si el título es largo */
    .form-section-card-header,
    .company-people-header { flex-wrap: wrap; row-gap: 6px; }

    /* Filas "Personas que trabajan aquí" / "Compañías donde trabaja": apilar en vez de desbordar */
    .company-link-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .company-link-info { flex-wrap: wrap; }
    .company-link-item > div:last-child { justify-content: flex-end; }

    /* ── Budgets ─────────────────────────────────────────────────────────────── */

    /* Lista: ocultar columnas Fecha (2ª) y Empresa (4ª) */
    #budgets-table th:nth-child(2),
    #budgets-table td:nth-child(2),
    #budgets-table th:nth-child(4),
    #budgets-table td:nth-child(4) { display: none; }

    /* Modal Nuevo presupuesto: full-screen */
    #new-budget-modal { align-items: stretch; justify-content: stretch; }
    #new-budget-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        max-height: 100dvh;
        height: 100%;
        border-radius: 0;
        margin: 0;
        animation: none;
    }

    /* Modal Eliminar presupuesto: bottom-sheet */
    #delete-modal { align-items: flex-end; justify-content: flex-end; }
    #delete-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin: 0;
        animation: mobileSheetIn 0.25s ease-out;
    }

    /* Modal detalle presupuesto (usa .modal-overlay--fixed como raíz): bottom-sheet */
    #budget-modal.modal-overlay--fixed {
        align-items: flex-end;
        justify-content: flex-end;
    }
    #budget-modal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        margin: 0;
        animation: mobileSheetIn 0.25s ease-out;
    }

    /* Budget form: cabecera envuelve en pantallas muy chicas */
    .budget-form-header { flex-wrap: wrap; }

    /* Presupuestos tab: más respiro en los bordes */
    .modal-tab-panel--presupuestos { padding: 16px 16px 20px; }

    /* ---- Tabla de líneas de presupuesto → card por fila ---- */
    .budget-lines-table-wrap { overflow-x: visible; }
    .budget-lines-table,
    .budget-lines-table tbody,
    .budget-lines-table tr { display: block; width: 100%; }
    .budget-lines-table thead { display: none; }
    /* Interfaces fuerza su thead visible en desktop (table-layout:fixed); en mobile va oculto igual que el resto */
    #so-ifaces-row-wrap .budget-lines-table thead,
    #nb-ifaces-row-wrap .budget-lines-table thead,
    #ifaces-row-wrap .budget-lines-table thead { display: none !important; }

    /* Card base para cualquier fila (Reactivos, Equipos, Interfaces, Puestos, Qualis, Otros) */
    .budget-lines-table tr {
        display: flex;
        flex-direction: column;
        gap: 10px;
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-md);
        padding: 14px;
        margin-bottom: 12px;
        background: var(--white);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .budget-lines-table td { display: block; padding: 0 !important; border: none !important; min-width: 0; }

    /* Reactivos & Equipos: layout agrupado por campos relacionados, en grillas separadas
       porque tienen distinta cantidad/orden de columnas reales en el DOM
       (incluye las variantes so-/nb-/plain: modal de presupuesto en Prospectos y en /budgets) */

    /* Reactivos: línea, cantidad, p.unit., total, borrar (5 celdas) */
    table:has(#so-reactivos-tbody) tr, table:has(#nb-reactivos-tbody) tr, table:has(#reactivos-tbody) tr {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "linea linea del"
            "qty   price total";
        gap: 10px 12px;
    }
    table:has(#so-reactivos-tbody) td:nth-child(1), table:has(#nb-reactivos-tbody) td:nth-child(1), table:has(#reactivos-tbody) td:nth-child(1) { grid-area: linea; }
    table:has(#so-reactivos-tbody) td:nth-child(2), table:has(#nb-reactivos-tbody) td:nth-child(2), table:has(#reactivos-tbody) td:nth-child(2) { grid-area: qty; }
    table:has(#so-reactivos-tbody) td:nth-child(3), table:has(#nb-reactivos-tbody) td:nth-child(3), table:has(#reactivos-tbody) td:nth-child(3) { grid-area: price; }
    table:has(#so-reactivos-tbody) td:nth-child(4), table:has(#nb-reactivos-tbody) td:nth-child(4), table:has(#reactivos-tbody) td:nth-child(4) { grid-area: total; }
    table:has(#so-reactivos-tbody) td:nth-child(5), table:has(#nb-reactivos-tbody) td:nth-child(5), table:has(#reactivos-tbody) td:nth-child(5) { grid-area: del; display: flex; justify-content: flex-end; align-items: flex-start; }

    /* Equipos: línea, producto, sku, cantidad, p.unit., total, fecha instalación, tenencia, borrar (9 celdas).
       Total/Fecha instalación/Tenencia van cada uno en su propia fila (ancho completo) porque
       el selector de tenencia y el date picker se ven apretados compartiendo columna en mobile. */
    table:has(#so-equipos-tbody) tr, table:has(#nb-equipos-tbody) tr, table:has(#equipos-tbody) tr {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "linea     prod      del"
            "sku       qty       price"
            "total     total     total"
            "fecha     fecha     fecha"
            "tenencia  tenencia  tenencia";
        gap: 10px 12px;
    }
    table:has(#so-equipos-tbody) td:nth-child(1), table:has(#nb-equipos-tbody) td:nth-child(1), table:has(#equipos-tbody) td:nth-child(1) { grid-area: linea; }
    table:has(#so-equipos-tbody) td:nth-child(2), table:has(#nb-equipos-tbody) td:nth-child(2), table:has(#equipos-tbody) td:nth-child(2) { grid-area: prod; }
    table:has(#so-equipos-tbody) td:nth-child(3), table:has(#nb-equipos-tbody) td:nth-child(3), table:has(#equipos-tbody) td:nth-child(3) { grid-area: sku; }
    table:has(#so-equipos-tbody) td:nth-child(4), table:has(#nb-equipos-tbody) td:nth-child(4), table:has(#equipos-tbody) td:nth-child(4) { grid-area: qty; }
    table:has(#so-equipos-tbody) td:nth-child(5), table:has(#nb-equipos-tbody) td:nth-child(5), table:has(#equipos-tbody) td:nth-child(5) { grid-area: price; }
    table:has(#so-equipos-tbody) td:nth-child(6), table:has(#nb-equipos-tbody) td:nth-child(6), table:has(#equipos-tbody) td:nth-child(6) { grid-area: total; }
    table:has(#so-equipos-tbody) td:nth-child(7), table:has(#nb-equipos-tbody) td:nth-child(7), table:has(#equipos-tbody) td:nth-child(7) { grid-area: fecha; }
    table:has(#so-equipos-tbody) td:nth-child(8), table:has(#nb-equipos-tbody) td:nth-child(8), table:has(#equipos-tbody) td:nth-child(8) { grid-area: tenencia; }
    table:has(#so-equipos-tbody) td:nth-child(9), table:has(#nb-equipos-tbody) td:nth-child(9), table:has(#equipos-tbody) td:nth-child(9) { grid-area: del; display: flex; justify-content: flex-end; align-items: flex-start; }

    /* Nombre del campo arriba de cada input/select, para que se entienda qué es cada uno */
    .budget-lines-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 9.5px;
        font-weight: 700;
        color: var(--gray-400);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-bottom: 4px;
    }
    .budget-lines-table td input,
    .budget-lines-table td select {
        font-size: 13px;
        padding: 8px 9px !important;
    }
    /* Botón eliminar línea: tamaño cómodo para tocar, alineado a la derecha */
    .budget-lines-table td .so-line-remove,
    .budget-lines-table td .btn-danger.btn-sm {
        min-width: 34px;
        min-height: 34px;
        font-size: 15px;
    }
    .budget-lines-table td:last-child:not([data-label]) {
        display: flex;
        justify-content: flex-end;
    }

    /* Interfaces: sin scroll interno, se despliega entero */
    #so-ifaces-row-wrap,
    #nb-ifaces-row-wrap,
    #ifaces-row-wrap {
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* División entre subsecciones de Software (Interfaces / Puestos / Qualis): separación clara, línea sutil */
    .so-sw-subsection {
        border-top-width: 1px !important;
        border-top-color: var(--gray-100) !important;
        margin-top: 14px !important;
        padding-top: 14px !important;
    }

    /* Header: título + controles apilados, siempre visible arriba al scrollear */
    .modal-tab-panel--presupuestos .sale-orders-wrap-header {
        flex-wrap: wrap;
        gap: 10px;
        align-items: flex-start;
        padding-bottom: 14px;
        margin-bottom: 4px;
        position: sticky;
        top: 0;
        z-index: 3;
    }

    /* Fila de controles: dos líneas — probabilidad arriba, botón abajo */
    .sale-orders-header-controls {
        width: 100%;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px !important;
        justify-content: flex-start !important;
    }

    /* Label de probabilidad: primera línea, sin crecer */
    .sale-orders-header-controls label {
        flex: 0 0 auto;
        align-items: center;
        gap: 6px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }

    /* Select de probabilidad: ancho fijo para valor + flecha sin solaparse */
    .sale-orders-header-controls #lead_probability_select {
        flex: none !important;
        width: 72px !important;
        min-width: 72px !important;
        font-size: 13px !important;
        min-height: 32px;
        padding: 4px 6px !important;
    }

    /* Botón: segunda línea, ancho completo con padding lateral */
    .sale-orders-header-controls .btn {
        flex: 0 0 100%;
        text-align: center;
        justify-content: center;
        white-space: nowrap;
        min-height: 36px;
        font-size: 13px;
        padding: 6px 16px;
    }

    /* Lista de presupuestos: scroll horizontal con cards verticales (mismo patrón que el kanban de /prospects).
       Fondo gris + cards angostas (con "peek" del siguiente item) para insinuar que se puede hacer swipe. */
    .so-card-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        border: none;
        border-radius: var(--radius-sm);
        background: var(--gray-100);
        gap: 12px;
        margin-top: 6px;
        padding: 18px 18px 20px;
    }
    .so-card--header { display: none !important; }
    .so-card {
        display: flex;
        flex-direction: column;
        gap: 12px;
        min-width: 82%;
        max-width: 82%;
        flex: 0 0 auto;
        scroll-snap-align: center;
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: var(--radius-md);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        padding: 18px;
    }
    /* Cada campo: nombre a la izquierda, valor a la derecha */
    .so-card__date,
    .so-card__amount,
    .so-card__total,
    .so-card__currency,
    .so-card__contract {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
        padding: 0;
        width: 100%;
    }
    /* Nro.: título de la card, sin label, centrado y sutil */
    .so-card__num {
        display: block;
        width: 100%;
        text-align: center;
        font-weight: 600;
        font-size: 12px;
        color: var(--gray-500);
    }
    .so-card__field-label {
        display: block;
        flex: 0 0 auto;
        font-size: 11px;
        font-weight: 700;
        color: var(--gray-400);
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
    .so-card__field-value {
        flex: 0 1 auto;
        text-align: right;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .so-card__num             { order: 1; }
    .so-card__date             { order: 2; font-size: 13px; }
    .so-card__amount           { order: 3; font-size: 14px; }
    .so-card__amount .so-card__field-value { font-weight: 600; color: var(--gray-900); }
    .so-card__currency         { order: 4; font-size: 13px; }
    .so-card__total            { order: 5; font-size: 14px; }
    .so-card__total .so-card__field-value  { font-weight: 600; color: var(--gray-900); }
    .so-card__contract         { order: 6; font-size: 13px; }
    .so-card__state    { display: none; }
    .so-card__actions {
        order: 7;
        padding-top: 10px;
        border-top: 1px solid var(--gray-100);
        gap: 16px;
        white-space: normal;
    }
    .so-card__actions .btn {
        flex: 1;
        justify-content: center;
        font-size: 13px;
        font-weight: 600;
        padding: 9px 14px;
    }

    /* Separación clara del header */
    .sale-orders-wrap-body { padding-top: 2px; }

    /* ---- Custom select (ss-wrap): bottom-sheet on mobile ---- */
    .ss-mobile-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 2999;
    }
    .ss-wrap.open .ss-dropdown {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        border-radius: 14px 14px 0 0;
        z-index: 3000;
        max-height: 60dvh;
        max-height: 60vh;
        display: flex !important;
        flex-direction: column;
        padding-bottom: env(safe-area-inset-bottom, 0);
        overflow: hidden;
    }
    .ss-wrap.open .ss-dropdown::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--gray-300);
        border-radius: 2px;
        margin: 8px auto 4px;
        flex-shrink: 0;
    }
    .ss-wrap.open .ss-dropdown .ss-search-box {
        flex-shrink: 0;
        padding: 8px 12px 10px;
    }
    .ss-wrap.open .ss-dropdown .ss-search-input {
        min-height: 44px;
        font-size: 16px;
        padding: 8px 12px;
    }
    .ss-wrap.open .ss-dropdown .ss-list {
        flex: 1;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ss-wrap.open .ss-dropdown .ss-option {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0 16px;
        font-size: 15px;
        white-space: normal;
    }
    .form-group .ss-trigger {
        min-height: 44px;
        font-size: 14px;
    }
    .form-group .ss-trigger-text {
        font-size: 14px;
    }
}

/* ============================================================================
   Responsive — Contactos + Prospectos: Tablet (768px–1024px)
   ============================================================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    .kanban-column {
        min-width: 220px;
        flex: 1 1 220px;
    }
    .modal-content {
        max-width: 96%;
        max-height: 94vh;
    }
    /* Contacts: kanban grid más compacto en tablet */
    .contacts-kanban-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
    }
}

/* ============================================================================
   Dashboard view
   ============================================================================ */

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.dashboard-kpis-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.dashboard-kpis-grid > .dashboard-kpi-card {
    flex: 1 1 155px;
    min-width: 0;
}
.dashboard-kpis-grid > .dashboard-kpi-card--narrow {
    flex: 1 1 92px;
}
@media (max-width: 700px) {
    .dashboard-kpis-grid > .dashboard-kpi-card,
    .dashboard-kpis-grid > .dashboard-kpi-card--narrow { flex: 1 1 130px; }
}

.dashboard-kpi-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 12px 14px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.dashboard-kpi-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.3;
    min-height: 26px;
    margin-bottom: 8px;
}
.dashboard-kpi-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.15;
}
.dashboard-kpi-value--accent  { color: var(--crimson); }
.dashboard-kpi-value--warning { color: #d97706; }
.dashboard-kpi-value--muted   { color: var(--gray-500); }
.dashboard-kpi-sub {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 3px;
}

#dash-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid var(--gray-200);
    min-height: 0;
}
#dash-active-chips:empty { display: none; }
.dash-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff0f3;
    border: 1px solid #fbc4cf;
    border-radius: 10px;
    padding: 2px 6px 2px 9px;
    font-size: 12px;
    white-space: nowrap;
}
.dash-chip-label { color: #b05070; }
.dash-chip-value { color: #7a1530; font-weight: 600; }
.dash-chip-remove {
    border: none;
    background: none;
    cursor: pointer;
    color: #e08090;
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
    margin-left: 1px;
}
.dash-chip-remove:hover { color: var(--crimson); }

.dashboard-widgets-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 900px) { .dashboard-widgets-row { grid-template-columns: 1fr; } }

.dashboard-widget {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 16px 20px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    min-width: 0;
}

.dashboard-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-100);
}

.dashboard-widget-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.dashboard-widget-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dashboard-widget-control-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}
.dash-filter-select--sm {
    font-size: 12px;
    padding: 3px 8px;
    height: 28px;
}

.dashboard-filters-wrap {
    margin-bottom: 10px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    overflow: hidden;
}
.dashboard-filters-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
}

.dash-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: flex-end;
}

.dash-filters-row--selects {
    justify-content: center;
}

.dash-filters-row--actions {
    justify-content: center;
    align-items: center;
    padding-top: 5px;
    border-top: 1px solid var(--gray-200);
}

.dash-filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dash-filter-group--prob {
    align-items: center;
}
.dash-filter-group--prob .dash-filter-label {
    text-align: center;
}

.dash-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-equip-filter {
    display: flex;
    align-items: center;
    gap: 7px;
}
.dash-equip-filter .dss-wrap {
    min-width: 190px;
}

.dash-usd-toggle.is-active {
    background: var(--crimson, #DC143C);
    border-color: var(--crimson, #DC143C);
    color: #fff;
}

.dash-equip-monto {
    color: var(--gray-400, #9ca3af);
    font-weight: 400;
    white-space: nowrap;
}

.negocio-tipo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    min-height: 200px;
    padding: 4px 8px;
}
.negocio-tipo-row > #negocio-tipo-plot-monto {
    width: 210px;
    height: 200px;
    flex: none;
}
.negocio-tipo-row > #negocio-tipo-ref-monto {
    flex: 1 1 340px;
    max-width: 460px;
    font-size: 11px;
    min-width: 0;
}
.negocio-tipo-row > #negocio-tipo-sec {
    flex: 0 1 340px;
    min-width: 0;
    align-self: center;
    padding: 14px 16px 12px;
    background: #fcfcfd;
    border: 1px solid #e9eaee;
    border-radius: 10px;
}
.negocio-sec-title {
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 9px;
}
.negocio-sec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.negocio-sec-table th {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-align: right;
    padding: 0 0 7px 14px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.negocio-sec-table th:first-child { text-align: left; padding-left: 0; }
.negocio-sec-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: 1px;
}
.negocio-sec-table td {
    padding: 7px 0 7px 14px;
    text-align: right;
    color: #111827;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    border-top: 1px solid #f3f4f6;
}
.negocio-sec-table tbody tr:first-child td { border-top: none; }
.negocio-sec-table td:first-child {
    text-align: left;
    padding-left: 0;
    color: #4b5563;
    font-weight: 500;
    width: 1%;
}
.negocio-sec-table td.negocio-sec-vacio { color: #d1d5db; font-weight: 400; }
@media (max-width: 1100px) {
    .negocio-tipo-row > #negocio-tipo-sec { flex-basis: 100%; max-width: 420px; }
}
@media (max-width: 700px) {
    .negocio-tipo-row { gap: 16px; }
    .negocio-tipo-row > #negocio-tipo-ref-monto { flex-basis: 100%; }
}

.dash-stage-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-stage-row .dss-wrap {
    flex: 1 1 auto;
    min-width: 0;
}
.dash-pipeline-btn {
    flex: none;
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--gray-600, #4b5563);
    background: var(--white, #fff);
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 20px;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.dash-pipeline-btn:hover {
    border-color: var(--crimson, #DC143C);
    color: var(--crimson, #DC143C);
}
.dash-pipeline-btn.is-active {
    background: var(--crimson, #DC143C);
    border-color: var(--crimson, #DC143C);
    color: #fff;
}
.dash-pipeline-btn:focus-visible {
    outline: 2px solid var(--crimson, #DC143C);
    outline-offset: 2px;
}

.dash-filter-select,
.dash-filter-date {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-size: 13px;
    color: var(--gray-900);
    outline: none;
    cursor: pointer;
}

.dash-filter-select:focus,
.dash-filter-date:focus {
    border-color: var(--crimson);
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.1);
}

.dash-filter-select:disabled,
.dash-filter-date:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.dash-filter-select {
    min-width: 160px;
}

.dash-filter-date {
    min-width: 140px;
}

.dashboard-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.dashboard-ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-ctrl-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.dashboard-ctrl-group .form-select {
    min-width: 200px;
    font-size: 13px;
}

.dashboard-table-panel {
    width: 100%;
}

.dashboard-paises-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dashboard-paises-table thead th {
    padding: 7px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--gray-200);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 1;
}

.dashboard-paises-table thead th:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.dashboard-paises-table thead th:not(:first-child) {
    text-align: right;
}

.dashboard-paises-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-size: 13px;
}

.dashboard-paises-table tbody td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dashboard-paises-table tbody tr:hover {
    background: var(--gray-50);
}

/* Equipos presupuestados: columnas parejas, con truncado + tooltip nativo (title) en overflow */
#equipos-presupuestados-table {
    table-layout: fixed;
}

#equipos-presupuestados-table th,
#equipos-presupuestados-table td {
    width: 20%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-row--active td {
    background: #fff0f3 !important;
}

.dashboard-pais-link {
    color: #2563eb;
    cursor: pointer;
    text-decoration: none;
}

.dashboard-pais-link:hover {
    text-decoration: underline;
}

.dash-sort-icon {
    display: inline-block;
    font-size: 10px;
    color: var(--gray-400);
    margin-left: 2px;
    min-width: 8px;
}

.dashboard-estados-table {
    width: auto;
    min-width: 220px;
    border-collapse: collapse;
    font-size: 13px;
}

.dashboard-estados-table thead th {
    padding: 7px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 1;
}

.dashboard-estados-table thead th:nth-child(n+3) { text-align: right; }

.dashboard-estados-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-size: 13px;
}

.dashboard-estados-table tbody td.estados-dias,
.dashboard-estados-table tbody td.estados-count {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dashboard-estados-table tbody .estados-etapa-cell {
    font-weight: 500;
    color: var(--gray-800);
}

.dashboard-estados-table tbody tr:hover { background: var(--gray-50); }

.estados-row--even td { background: #fafafa; }
.estados-row--even:hover td { background: var(--gray-50) !important; }

.dash-equip-market-head { text-align: center !important; border-bottom: 1px solid var(--gray-200, #e5e7eb); }
.dash-equip-subhead { font-size: 9.5px !important; font-weight: 500 !important; color: var(--gray-400, #9ca3af) !important; }
.dash-equip-subhead--num { text-align: right !important; }
.dash-equip-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }

.dash-paises-vendor-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-400, #9ca3af);
    margin-left: 2px;
}

.estados-dias--fast { color: #16a34a; font-weight: 600; }
.estados-dias--slow { color: #d97706; font-weight: 600; }

.dashboard-estados-table .pivot-stage-col {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-left: 1px solid var(--gray-100, #f3f4f6);
}
.dashboard-estados-table thead .pivot-stage-col {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
}

@media (max-width: 640px) {
    /* Dashboard: menos espacio vertical */
    .dashboard-container { gap: 10px; margin-top: 8px; }

    /* Filtros: 2 por fila, sin min-width fijo */
    .dashboard-filters-bar { gap: 8px; padding: 10px 12px; }
    .dash-filter-group { flex: 1 1 calc(50% - 4px); min-width: 0; }
    .dash-filter-select,
    .dash-filter-date { min-width: 0; width: 100%; }

    /* Widget header: envolver botón de exportar */
    .dashboard-widget-header { flex-wrap: wrap; gap: 8px; }

    /* Scatter: reducir altura inline */
    #dashboard-scatter-plot { height: 280px !important; }
    #dashboard-scatter-wrapper { min-height: 280px; }

    /* Tabla países: ocultar Oport. / Gan. / Vend. — mantener País, Total, Ganado */
    #dashboard-paises-wrapper { overflow-x: auto; }
    .dashboard-paises-table th:nth-child(4),
    .dashboard-paises-table td:nth-child(4),
    .dashboard-paises-table th:nth-child(5),
    .dashboard-paises-table td:nth-child(5),
    .dashboard-paises-table th:nth-child(6),
    .dashboard-paises-table td:nth-child(6) { display: none; }
}

@media (max-width: 480px) {
    /* Filtros: 1 por fila en móvil pequeño */
    .dash-filter-group { flex: 1 1 100%; }
}

@media (min-width: 768px) {
    .prospects-ctrl-select                 { min-width: 145px; }
    .pivot-ctrl-group .form-select         { min-width: 200px; }
    .dash-filter-select                    { min-width: 200px; }
    .dash-filter-date                      { min-width: 175px; }
    .dashboard-ctrl-group .form-select     { min-width: 250px; }
}

/* ============================================================================
   Budget shared styles (budget_form + modals in budgets + prospects)
   ============================================================================ */
.btn-budget-add {
    min-width: 160px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--crimson);
    background: transparent;
    border: 1.5px solid var(--crimson);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.btn-budget-add:hover { background: var(--crimson-light); }

.btn-section-add {
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 18px;
    font-weight: 300;
    line-height: 1;
    color: var(--crimson);
    background: transparent;
    border: 1.5px solid var(--crimson);
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.btn-section-add:hover { background: var(--crimson-light); }
.btn-section-add:disabled {
    color: var(--gray-400);
    border-color: var(--gray-300);
    background: transparent;
    cursor: not-allowed;
    opacity: 0.5;
}

.budget-lines-table:not(:has(tbody tr)) thead { display: none; }

/* Reactivos & Equipos: Total column matches P. unit. width */
table:has(#so-reactivos-tbody) th:nth-child(6),
table:has(#nb-reactivos-tbody) th:nth-child(6),
table:has(#reactivos-tbody) th:nth-child(6),
table:has(#so-equipos-tbody) th:nth-child(6),
table:has(#nb-equipos-tbody) th:nth-child(6),
table:has(#equipos-tbody) th:nth-child(6) { width: 90px !important; }

/* Otros: Descripción 2/3 — Monto 1/3 */
#so-otros-row-wrap .budget-lines-table,
#nb-otros-row-wrap .budget-lines-table,
#otros-row-wrap .budget-lines-table { table-layout: fixed; width: 100%; }

#so-otros-row-wrap .budget-lines-table th:first-child,
#nb-otros-row-wrap .budget-lines-table th:first-child,
#otros-row-wrap .budget-lines-table th:first-child { width: 66.67% !important; }

#so-otros-row-wrap .budget-lines-table th:last-child,
#nb-otros-row-wrap .budget-lines-table th:last-child,
#otros-row-wrap .budget-lines-table th:last-child { width: 33.33% !important; }

/* Software subsection: proportional equal-width columns */
#so-lis-row-wrap .budget-lines-table,
#nb-lis-row-wrap .budget-lines-table,
#lis-row-wrap .budget-lines-table,
#so-puestos-row-wrap .budget-lines-table,
#nb-puestos-row-wrap .budget-lines-table,
#puestos-row-wrap .budget-lines-table { table-layout: fixed; width: 100%; }

#so-lis-row-wrap .budget-lines-table th,
#nb-lis-row-wrap .budget-lines-table th,
#lis-row-wrap .budget-lines-table th,
#so-puestos-row-wrap .budget-lines-table th,
#nb-puestos-row-wrap .budget-lines-table th,
#puestos-row-wrap .budget-lines-table th { width: 20%; }

#so-ifaces-row-wrap .budget-lines-table,
#nb-ifaces-row-wrap .budget-lines-table,
#ifaces-row-wrap .budget-lines-table { table-layout: fixed; width: 100%; }

/* Interfaces thead: always visible so table-layout:fixed has <th> anchors on first paint.
   The row-wrap itself is display:none when empty, so a visible thead inside a hidden
   container costs nothing visually. */
#so-ifaces-row-wrap .budget-lines-table thead,
#nb-ifaces-row-wrap .budget-lines-table thead,
#ifaces-row-wrap .budget-lines-table thead { display: table-header-group; }

/* Interfaces columns: button column fixed, 4 data columns split the rest via calc */
#so-ifaces-row-wrap .budget-lines-table th:last-child,
#nb-ifaces-row-wrap .budget-lines-table th:last-child,
#ifaces-row-wrap .budget-lines-table th:last-child { width: 36px; }

#so-ifaces-row-wrap .budget-lines-table th:not(:last-child),
#nb-ifaces-row-wrap .budget-lines-table th:not(:last-child),
#ifaces-row-wrap .budget-lines-table th:not(:last-child) { width: calc((100% - 36px) / 4); }

/* Clip cell content to column boundary; suppress browser min-width on form elements */
#so-ifaces-row-wrap .budget-lines-table td,
#nb-ifaces-row-wrap .budget-lines-table td,
#ifaces-row-wrap .budget-lines-table td { overflow: hidden; }

#so-ifaces-row-wrap .budget-lines-table td select,
#nb-ifaces-row-wrap .budget-lines-table td select,
#ifaces-row-wrap .budget-lines-table td select,
#so-ifaces-row-wrap .budget-lines-table td input,
#nb-ifaces-row-wrap .budget-lines-table td input,
#ifaces-row-wrap .budget-lines-table td input { min-width: 0; max-width: 100%; }

.sw-subsection-title {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 2px 8px;
    letter-spacing: 0.04em;
}

.budget-lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.budget-lines-table th {
    padding: 4px 8px;
    border: 1px solid var(--gray-200);
    text-align: left;
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
}
.budget-lines-table th .required,
.so-form-required {
    color: var(--crimson);
    font-weight: 600;
    font-size: 11px;
    margin-left: 2px;
}
.budget-lines-table td {
    padding: 4px 6px;
    border: 1px solid var(--gray-200);
}
.budget-lines-table td input,
.budget-lines-table td select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
}
.budget-lines-table td input:focus,
.budget-lines-table td select:focus {
    outline: none;
    border-color: var(--crimson);
}

/* ============================================================================
   BUDGET FORM — Section separators (consistent across all 3 budget entry points)
   ============================================================================ */

/* Full-page form (budget_form.html) — section wrappers */
.budget-section {
    border-top: 1px solid var(--gray-200);
    padding-top: 20px;
    margin-top: 12px;
}
.budget-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.budget-section h2.form-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-left: 3px solid var(--crimson);
    padding-left: 8px;
    margin: 0;
}
.budget-lines-table-wrap { overflow-x: auto; }

/* Full-page form — software sub-sections (LIS / Interfaces / Puestos) */
.sw-subsection { margin-bottom: 4px; }
.sw-subsection + .sw-subsection {
    border-top: 1px solid var(--gray-200);
    padding-top: 8px;
}
.sw-subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.sw-subsection-total {
    font-size: 12px;
    font-weight: 700;
    color: var(--crimson);
}

/* Modal budget forms (prospects.html #sale-order-form, budgets.html #new-budget-form) */
#sale-order-form > div:has(h3.modal-section-title),
#new-budget-form > div:has(h3.modal-section-title) {
    border-top: 1px solid var(--gray-200);
    padding-top: 12px;
}
#sale-order-form h3.modal-section-title,
#new-budget-form h3.modal-section-title {
    border-left: 3px solid var(--crimson);
    padding-left: 8px;
    font-size: 11px;
}
