/* ================================================================
   Cuentas por Cobrar — Vista distribución por responsables
   ================================================================ */

#ccRespView { padding: 12px; }

.ec-resp-buscar-item {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}
.ec-resp-buscar-item:last-child { border-bottom: none; }
.ec-resp-buscar-item:hover { background: #eef2ff; }
.ec-resp-buscar-item-nombre {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ec-resp-buscar-item-lugar {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
    margin-left: 2px;
}
.ec-resp-buscar-vacio {
    padding: 10px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
}

.ec-resp-nota {
    font-size: 10px;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 4px 10px;
    margin-bottom: 12px;
}
.ec-resp-error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 12px;
    text-align: center;
}
.ec-resp-empty {
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 20px;
    font-size: 12px;
    text-align: center;
}
.ec-resp-edificio-header {
    background: #eef2ff;
    color: #0a2463;
    font-weight: 700;
    font-size: 11px;
    padding: 6px 10px;
    border-bottom: 2px solid #c7d2fe;
    margin-bottom: 8px;
    margin-top: 12px;
    border-radius: 4px 4px 0 0;
}
.ec-resp-edificio-header:first-of-type { margin-top: 0; }

.ec-resp-apt-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 8px;
}
#ccRespView.cc-cols-2 .ec-resp-apt-grid {
    grid-template-columns: 1fr 1fr;
}
.ec-resp-apt-section {
    margin-bottom: 0;
    scroll-margin-top: 64px;
}

/* Referencia visual al volver del historial: señala durante dos segundos la
   unidad restaurada y se desvanece sin cambiar el tamaño de la tarjeta. */
.ec-resp-apt-hdr--restaurado {
    position: relative;
    z-index: 1;
    border-radius: 6px;
    animation: ec-resp-resaltar-unidad 2s ease-out forwards;
}

@keyframes ec-resp-resaltar-unidad {
    0%, 35% {
        box-shadow: 0 0 0 3px #2563eb, 0 0 14px rgba(37, 99, 235, 0.38);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.ec-resp-apt-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-top: none;
    flex-wrap: wrap;
}

.ec-resp-apt-section-num {
    font-size: 11px;
    font-weight: 700;
    color: #334155;
}

.ec-resp-historial-btn {
    font-size: 10px;
    padding: 3px 9px;
    border: 1px solid #6366f1;
    border-radius: 4px;
    background: #eef2ff;
    color: #4338ca;
    cursor: pointer;
    white-space: nowrap;
}
.ec-resp-historial-btn:hover {
    background: #6366f1;
    color: #fff;
}
.ec-historial-corto { display: none; }

.ec-resp-historial-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 680px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ec-resp-historial-modal-hdr {
    padding: 14px 18px;
    background: #0a2463;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ec-resp-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 10px;
    margin-bottom: 8px;
}
.ec-resp-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ec-resp-titulo-linea {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ec-resp-separador {
    color: #9ca3af;
    font-weight: 400;
}
.ec-resp-apt-badge {
    background: #0a2463;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
}
.ec-resp-responsable-line {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}
.ec-resp-card-deuda {
    display: inline-block;
    flex-shrink: 0;
    padding: 3px 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #dc2626;
}
.ec-resp-wa-link {
    color: #25d366;
    margin-left: 2px;
}
.ec-resp-wa-link:hover {
    color: #128c7e;
}

/* Desktop y tablet: el responsable ocupa el espacio disponible y la deuda se
   alinea al extremo derecho de la fila. El teléfono conserva su composición
   compacta definida en responsive/cuentas_por_cobrar/mobile.css. */
@media screen and (min-width: 769px) {
    .ec-resp-responsable-deuda {
        display: inline-flex;
        align-items: center;
        flex: 1 1 auto;
        min-width: 220px;
        gap: 8px;
    }
    .ec-resp-card-deuda { margin-left: auto; white-space: nowrap; }
    .ec-resp-wa-link { display: inline-flex; align-items: center; font-size: 20px; line-height: 1; vertical-align: middle; }
}
.ec-resp-concepto-nombre {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}
.ec-resp-costo-base {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}
.ec-resp-months-grid {
    display: grid;
    grid-template-columns: 56px repeat(12, 1fr);
    gap: 2px;
    align-items: center;
}
.ec-resp-month-label {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: #6b7280;
}
.ec-resp-month-apt-label {
    font-size: 9px;
    font-weight: 600;
    color: #4b5563;
}
.ec-resp-month-cell {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 2px;
    border-radius: 3px;
    user-select: none;
}
.ec-resp-future    { background: #f9fafb; color: #d1d5db; }
.ec-resp-nodata    { background: #f9fafb; color: #d1d5db; }
.ec-resp-status-paid    { background: #dcfce7; color: #16a34a; }
.ec-resp-status-pending { background: #fef2f2; color: #dc2626; }
.ec-resp-status-partial { background: #fef9c3; color: #b45309; }
.ec-resp-status-excess  { background: #dbeafe; color: #2563eb; }
.ec-resp-status-none    { background: #f3f4f6; color: #9ca3af; }

.ec-resp-badge-final {
    display: inline-block;
    background: #16a34a;
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}
.ec-resp-tipo-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}
.ec-resp-tipo-propietario   { background: #dbeafe; color: #1e40af; }
.ec-resp-tipo-inquilino     { background: #dcfce7; color: #166534; }
.ec-resp-tipo-representante { background: #fef3c7; color: #92400e; }

.ec-resp-modal-row {
    padding: 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.ec-resp-modal-row + .ec-resp-modal-row { margin-top: 10px; }
.ec-resp-modal-persona {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
}
.ec-resp-modal-avatar { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #0a2463; background: #e8eefc; }
.ec-resp-modal-identidad { min-width: 0; }
.ec-resp-modal-nombre { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: #172033; font-size: 13px; margin-bottom: 4px; }
.ec-resp-modal-montos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.ec-resp-modal-montos span { min-width: 0; }
.ec-resp-modal-montos small { display: block; margin-bottom: 2px; color: #64748b; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ec-resp-modal-montos b { display: block; color: #1e293b; font-size: 11px; white-space: nowrap; }
.ec-resp-modal-dialog { width: 95%; max-width: 560px; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; background: #f8fafc; border-radius: 12px; box-shadow: 0 22px 55px rgba(15, 23, 42, .28); }
.ec-resp-modal-header { padding: 15px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: #fff; background: linear-gradient(135deg, #0a2463, #123b91); }
.ec-resp-modal-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ec-resp-modal-header-icon { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: rgba(255,255,255,.14); }
.ec-resp-modal-title { font-size: 14px; font-weight: 700; }
.ec-resp-modal-subtitle { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 10px; opacity: .9; }
.ec-resp-modal-subtitle span::before { content: '\2022'; margin-right: 6px; opacity: .65; }
.ec-resp-modal-close { width: 30px; height: 30px; flex: 0 0 30px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.1); font-size: 20px; line-height: 1; cursor: pointer; }
.ec-resp-modal-close:hover { background: rgba(255,255,255,.2); }
.ec-resp-modal-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 14px; border-bottom: 1px solid #dbe3ef; background: #eef3fb; }
.ec-resp-summary-item { padding: 9px 10px; border-radius: 8px; background: #fff; border-left: 3px solid #64748b; }
.ec-resp-summary-item span { display: block; color: #64748b; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.ec-resp-summary-item strong { display: block; margin-top: 3px; color: #172033; font-size: 12px; white-space: nowrap; }
.ec-resp-summary-esperado { border-left-color: #64748b; }
.ec-resp-summary-pagado { border-left-color: #16a34a; }
.ec-resp-summary-pendiente { border-left-color: #dc2626; }
.ec-resp-modal-body { padding: 14px; overflow-y: auto; flex: 1; }
.ec-resp-modal-estado { font-size: 11px; }
.ec-resp-modal-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.ec-resp-modal-status i { font-size: 5px; }

/* ── Caja de búsqueda desplegable ─────────────────────────────
   Se muestra y se oculta con la clase u-oculto, no escribiendo
   display en el atributo style. */

.cc-buscar-box {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    width: 300px;
    margin-top: 4px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ── El buscador ──────────────────────────────────────────────
   El campo está siempre a la vista, con la lupa dentro y una equis que solo
   aparece cuando hay algo escrito. El relleno de la derecha le deja sitio a esa
   equis para que no se pose encima del texto. */

.cc-buscador {
    display: flex;
    align-items: center;
}

.cc-buscador-icono {
    position: absolute;
    left: 8px;
    font-size: 11px;
    color: #0a2463;
    pointer-events: none;
}

.cc-buscador-campo {
    width: 230px;
    padding: 4px 24px 4px 24px;
    border: 1px solid #0a2463;
    border-radius: 5px;
    font-size: 12px;
    color: #1a202c;
    box-sizing: border-box;
}

.cc-buscador-campo::placeholder {
    color: #9ca3af;
}

.cc-buscador-limpiar {
    position: absolute;
    right: 6px;
    border: none;
    background: none;
    padding: 0;
    font-size: 11px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
}

.cc-buscador-limpiar:hover {
    color: #0a2463;
}

.cc-edificio-filtro { flex: 0 0 auto; }
.cc-edificio-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 4px 9px;
    border: 1px solid #0a2463;
    border-radius: 6px;
    background: #fff;
    color: #0a2463;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.cc-edificio-btn:hover,
.cc-edificio-btn-activo { background: #e8eefc; }
.cc-edificio-flecha { font-size: 8px; transition: transform .18s ease; }
.cc-edificio-btn[aria-expanded="true"] .cc-edificio-flecha { transform: rotate(180deg); }
.cc-edificio-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 9999;
    min-width: 210px;
    max-height: 280px;
    padding: 5px;
    overflow-y: auto;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}
.cc-edificio-opcion {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    font-size: 11px;
    text-align: left;
    cursor: pointer;
}
.cc-edificio-opcion i { width: 14px; color: #64748b; text-align: center; }
.cc-edificio-opcion:hover { background: #f1f5f9; }
.cc-edificio-opcion.activo { background: #e8eefc; color: #0a2463; font-weight: 700; }
.cc-edificio-opcion.activo i { color: #0a2463; }
.cc-filtro-edificio-resumen button {
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid #93c5fd;
    border-radius: 5px;
    background: #fff;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.cc-buscar-titulo {
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

/* ── Aviso de que la lista está recortada ─────────────────────
   Va dentro de la propia lista y no en la cabecera: es la primera línea de lo
   que se está mirando, y quien baja la vista buscando un apartamento que no
   aparece se topa con la explicación antes que con el hueco. */

.cc-filtro-resumen {
    padding: 6px 12px;
    font-size: 11px;
    color: #0a2463;
    background: #eef2ff;
    border-bottom: 1px solid #c7d2fe;
}

.cc-filtro-pista {
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
}
.cc-conciliacion-aviso {
    margin: 8px 10px;
    padding: 8px 10px;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.65rem;
    line-height: 1.45;
}

.cc-conciliacion-btn,
.cc-conciliacion-guardar {
    margin-left: 8px;
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    background: #92400e;
    color: #fff;
    cursor: pointer;
    font-size: 0.6rem;
    font-weight: 700;
}

.cc-conciliacion-modal { width: min(900px, 95vw); max-height: 88vh; overflow: hidden; border-radius: 8px; background: #fff; }
.cc-conciliacion-modal-hdr { display: flex; justify-content: space-between; padding: 12px 16px; background: #0a2463; color: #fff; }
.cc-conciliacion-modal-hdr button { border: 0; background: transparent; color: #fff; cursor: pointer; font-size: 1.2rem; }
.cc-conciliacion-lista { max-height: 72vh; padding: 10px; overflow-y: auto; }
.cc-conciliacion-fila { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; gap: 8px; align-items: center; padding: 8px; border-bottom: 1px solid #e5e7eb; }
.cc-conciliacion-dato { display: flex; flex-direction: column; gap: 2px; font-size: 0.62rem; }
.cc-conciliacion-select { padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.62rem; }
.cc-conciliacion-guardar { margin-left: 0; background: #166534; }

@media (max-width: 700px) {
    .cc-conciliacion-fila { grid-template-columns: 1fr; }
    .cc-conciliacion-btn { display: block; margin: 6px 0 0; }
}
