:root {
    --color-primary: #c1442d;
    --color-primary-dark: #a3371f;
    --color-dark: #2b2b2b;
    --color-bg: #f5f5f3;
    --color-card: #ffffff;
    --color-border: #e3e0da;
    --color-text: #2b2b2b;
    --color-muted: #767267;
    --color-success: #3c8a4c;
    --color-warning: #c98a1a;
    --color-danger: #b23a2e;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 700; margin-top: 0; }

/* ---------- Login / portal publico ---------- */
.pantalla-centrada {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.tarjeta-login {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.tarjeta-login img { max-width: 160px; margin-bottom: 16px; }

/* ---------- Formularios ---------- */
.campo { margin-bottom: 16px; text-align: left; }
.campo label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: var(--color-muted); }
.campo input, .campo select, .campo textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--color-text);
}
.campo textarea { resize: vertical; min-height: 90px; }
.campo-inline { display: flex; align-items: center; gap: 8px; }
.campo-inline input { width: auto; }
.campo-inline input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* Fila de varios campos uno al lado de otro (se apila en movil) */
.fila-campos { display: flex; gap: 12px; flex-wrap: wrap; }
.fila-campos > .campo { flex: 1 1 160px; min-width: 0; }

.btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    min-height: 44px;
    line-height: 1.2;
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn:disabled { background: #c7c3ba; color: #8a8578; cursor: not-allowed; }
.btn-secundario { background: #fff; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secundario:hover { background: var(--color-bg); }
.btn-bloque { display: block; width: 100%; }
.btn-peligro { background: var(--color-danger); }
.btn-sm { padding: 8px 12px; font-size: .85rem; min-height: 36px; }

.mensaje-error {
    background: #fbeae7;
    color: var(--color-danger);
    border: 1px solid #f0c6bf;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: .9rem;
}
.mensaje-exito {
    background: #e9f5ec;
    color: var(--color-success);
    border: 1px solid #c3e3ca;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: .9rem;
}

/* ---------- Layout admin/portal con sidebar ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--color-dark);
    color: #fff;
    padding: 20px 0;
}
.sidebar .logo-wrap { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.sidebar .logo-wrap img { max-width: 130px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #d8d5cd;
    font-size: .92rem;
    line-height: 1.2;
    transition: background .15s ease, color .15s ease;
}
.sidebar nav a:hover, .sidebar nav a.activo {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}
.sidebar nav a svg {
    width: 18px;
    height: 18px;
    min-width: 18px;
    flex-shrink: 0;
    opacity: .85;
}
.sidebar nav a:hover svg, .sidebar nav a.activo svg {
    opacity: 1;
}
.sidebar-seccion-titulo {
    margin: 18px 0 6px;
    padding: 0 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #a8a396;
}
.nav-con-badge {
    justify-content: space-between;
}
.nav-con-badge .nav-item-principal {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar .usuario-actual {
    padding: 12px 20px;
    font-size: .8rem;
    color: #a8a49a;
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: 12px;
}

.contenido {
    flex: 1;
    padding: 28px 36px;
    max-width: 100%;
    min-width: 0;
}

/* Barra superior movil: oculta en escritorio */
.topbar-movil {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: var(--color-dark);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-movil img { height: 28px; }
.topbar-movil .btn-menu {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    padding: 8px;
    cursor: pointer;
}
.overlay-menu {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 20;
}

.cabecera-pagina {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

/* ---------- Tarjetas / tablas ---------- */
.tarjeta {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; }
.stat[data-href] { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.stat[data-href]:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); border-color: var(--color-primary); transform: translateY(-2px); }
.stat[data-href]:active { transform: scale(.98); }
.stat .numero { font-size: 1.8rem; font-weight: 700; color: var(--color-primary); }
.stat .etiqueta { font-size: .85rem; color: var(--color-muted); }

.tabla-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
table th, table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: .92rem;
}
table td:last-child, table th:last-child { white-space: nowrap; }
table th { color: var(--color-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
table tr:hover td { background: #faf9f7; }
table tr[data-href] { cursor: pointer; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-activo, .badge-resuelta, .badge-pagado, .badge-cobrada { background: #e9f5ec; color: var(--color-success); }
.badge-abierta, .badge-vencido { background: #fbeae7; color: var(--color-danger); }
.badge-en_gestion, .badge-pendiente, .badge-borrador { background: #fdf2e0; color: var(--color-warning); }
.badge-finalizado, .badge-rescindido { background: #eee; color: var(--color-muted); }
.badge-emitida, .badge-info { background: #eef2ff; color: #4f46e5; }

/* ---------- Filas de tabla de incidencias con color de estado ---------- */
tr.tr-inc-abierta td { background: #fff5f3; }
tr.tr-inc-en_gestion td { background: #fffdf0; }
tr.tr-inc-resuelta td { background: #f2faf4; }

tr.tr-inc-abierta:hover td { background: #fbe6e2; }
tr.tr-inc-en_gestion:hover td { background: #f7eed0; }
tr.tr-inc-resuelta:hover td { background: #e3f5e7; }

.acciones-fila { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Header CRM Top & Buscador Global & Notificaciones ---------- */
.header-crm-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.buscador-global {
    position: relative;
    flex: 1;
    max-width: 480px;
    min-width: 220px;
}
.buscador-global input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--color-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.buscador-global input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(193,68,45,0.12);
}

.contenedor-notificaciones {
    position: relative;
}
.btn-campana {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.btn-campana:hover {
    background: #fdfdfc;
    border-color: var(--color-primary);
}
.badge-notif {
    background: var(--color-danger);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
}
.desplegable-notificaciones {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 320px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: min(70vh, 560px);
}
.contenedor-notificaciones:hover .desplegable-notificaciones,
.contenedor-notificaciones:focus-within .desplegable-notificaciones,
.desplegable-notificaciones.activo {
    display: block;
}
.header-notif {
    padding: 10px 14px;
    background: var(--color-bg);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
}
.item-notif {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    transition: background .15s ease;
}
.item-notif:hover {
    background: #fdf8f7;
    text-decoration: none;
}
.item-notif strong {
    display: block;
    font-size: 0.88rem;
    color: var(--color-dark);
}
.item-notif span {
    display: block;
    font-size: 0.8rem;
    color: var(--color-muted);
}
.item-notif small {
    font-size: 0.72rem;
    color: var(--color-muted);
}
.item-notif-firma {
    border-left: 3px solid var(--color-primary);
}
.form-marcar-leidas {
    margin: 0;
    border-bottom: 1px solid var(--color-border);
}
.form-marcar-leidas button {
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: 0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    text-align: center;
}
.form-marcar-leidas button:hover { background: #fdf8f7; }
.item-notif-vacio {
    padding: 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-muted);
}
.ver-todas-notif {
    display: block;
    padding: 10px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-primary);
    background: #fafaf9;
    text-decoration: none;
}

/* ---------- Buscador ---------- */
.buscador {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}
.buscador input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    transition: border-color .15s ease, background .15s ease;
}
.buscador input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
}
/* Input suelto (fuera de un .campo), ej. campos inline en una tabla */
.input-compacto {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--color-text);
    transition: border-color .15s ease;
}
.input-compacto:focus {
    outline: none;
    border-color: var(--color-primary);
}

.buscador-icono {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--color-muted);
    pointer-events: none;
}


/* ---------- Incidencias: tarjetas en móvil ---------- */
.incidencias-tarjetas { display: none; }

.inc-card {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-left: 5px solid var(--color-muted);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.inc-card:active {
    transform: scale(0.98);
}

.inc-card-abierta {
    background: #fff8f7;
    border-color: #f7d2cc;
    border-left-color: var(--color-danger);
}
.inc-card-en_gestion {
    background: #fffdf2;
    border-color: #fceec5;
    border-left-color: var(--color-warning);
}
.inc-card-resuelta {
    background: #f4faf6;
    border-color: #cdecd5;
    border-left-color: var(--color-success);
}

.inc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.inc-card-titulo {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--color-dark);
    line-height: 1.35;
}
.inc-card-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.inc-card-direccion {
    font-weight: 600;
    color: var(--color-text);
}
.inc-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.08);
    font-size: 0.78rem;
    color: var(--color-muted);
}

/* Escritorio / móvil toggle */
.solo-escritorio { display: block; }
.solo-movil { display: none; }

@media (max-width: 780px) {
    .topbar-movil { display: flex; }
    .app { position: relative; overflow-x: hidden; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        max-width: 80vw;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 40;
    }
    .app.menu-abierto .sidebar { transform: translateX(0); }
    .app.menu-abierto .overlay-menu { display: block; }

    .contenido { padding: 14px; width: 100%; }

    .cabecera-pagina { margin-bottom: 14px; }
    .cabecera-pagina h1 { font-size: 1.25rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 1rem; margin-bottom: 8px; }
    .tarjeta { padding: 14px; margin-bottom: 14px; }

    .campo { margin-bottom: 10px; }
    .fila-campos { flex-direction: column; gap: 0; }
    .fila-campos > .campo { flex: 1 1 auto; }

    .grid-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .stat { padding: 12px; }
    .stat .numero { font-size: 1.5rem; }

    table th, table td { padding: 8px 10px; }

    .mensaje-error, .mensaje-exito { padding: 8px 12px; margin-bottom: 10px; }

    /* Incidencias: tarjetas en lugar de tabla */
    .solo-escritorio, .tabla-scroll.solo-escritorio { display: none !important; }
    .solo-movil { display: block !important; }
    .incidencias-tarjetas { display: block !important; }
}

@media (max-width: 420px) {
    .grid-stats { grid-template-columns: 1fr 1fr; }
    .tarjeta-login { padding: 24px 20px; }
}

/* ---------- Modal Visor de Medios (Fotos / Vídeos) ---------- */
.modal-visor {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-visor.activo {
    display: flex;
}
.modal-visor-contenedor {
    position: relative;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.modal-visor-contenido img,
.modal-visor-contenido video {
    max-width: 92vw;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    object-fit: contain;
}
.modal-visor-cerrar {
    position: absolute;
    top: -42px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}
.modal-visor-titulo {
    color: #d8d5cd;
    font-size: 0.85rem;
    margin-top: 10px;
    text-align: center;
    word-break: break-all;
}

/* ---------- Editor Visual (Quill) de Email ---------- */
#editor-visual.ql-container {
    min-height: 280px;
    height: 340px;
    resize: vertical;
    overflow-y: auto;
    font-size: 0.95rem;
    border-radius: 0 0 8px 8px;
    background: #fff;
}
#editor-visual .ql-editor {
    min-height: 100%;
}
#cuerpo_html {
    min-height: 280px;
}

/* ---------- Digitalizar (fotos/PDF + IA) ---------- */
.selector-tabs {
    display: flex;
    gap: 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 4px;
}
.tab-opcion {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 10px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    color: var(--color-muted);
}
.tab-opcion input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.tab-opcion:has(input:checked) {
    background: var(--color-card);
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.caja-captura {
    margin: 16px 0 20px;
    padding: 14px;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: 10px;
}
.btn-captura {
    flex: 1;
    min-width: 100px;
    text-align: center;
    cursor: pointer;
}
.grid-miniaturas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 14px;
}
.miniatura {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: #fff;
}
.miniatura img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.miniatura-pdf {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    text-align: center;
    padding: 4px;
    color: var(--color-muted);
}
.miniatura-pdf span {
    font-size: .65rem;
    word-break: break-all;
    margin-top: 2px;
}
.miniatura-quitar {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 480px) {
    .selector-tabs { flex-direction: column; }
}

/* ---------- Subida de fotos (arrastrar y soltar) ---------- */
.caja-captura.arrastrando {
    border-style: solid;
    border-color: var(--color-primary);
    background: #fbeee9;
}
.caja-captura-zona {
    text-align: center;
    padding: 20px 10px;
    cursor: pointer;
}
.caja-captura-zona strong { color: var(--color-primary); }
.miniatura.miniatura-subiendo img { opacity: .55; }
.miniatura-progreso {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 5px;
    background: rgba(0,0,0,.25);
}
.miniatura-progreso-relleno {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
    transition: width .2s ease;
}
.miniatura-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(178,58,46,.9);
    color: #fff;
    font-size: .68rem;
    text-align: center;
    padding: 4px;
}
.miniatura-error button {
    border: 1px solid #fff;
    background: transparent;
    color: #fff;
    border-radius: 4px;
    font-size: .65rem;
    padding: 2px 6px;
    cursor: pointer;
}
.miniatura[draggable="true"] { cursor: grab; }
.miniatura.arrastrando-item { opacity: .4; }

/* ---------- Pad de firma en pantalla ---------- */
.pad-firma-caja {
    position: relative;
    border: 2px dashed var(--color-primary);
    border-radius: 10px;
    background: #fff;
    margin: 8px 0;
    overflow: hidden;
    max-width: 100%;
    touch-action: none;
}
.pad-firma-caja canvas {
    width: 100%;
    height: 160px;
    max-width: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
}
.pad-firma-caja::before {
    content: "✍️ Firma aquí";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-muted);
    font-size: .95rem;
    font-weight: 600;
    pointer-events: none;
    opacity: .6;
}
.pad-firma-caja.pad-firma-con-trazo::before {
    display: none;
}
.pad-firma-etiqueta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .85rem;
    color: var(--color-muted);
    margin-bottom: 4px;
}

/* ---------- Texto legal completo (parte de visita, contratos) ---------- */
.texto-legal {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 18px;
    max-height: 420px;
    overflow-y: auto;
    font-size: .82rem;
    line-height: 1.55;
    margin: 12px 0 20px;
}
.texto-legal h3 { font-size: .85rem; margin: 14px 0 6px; color: var(--color-primary); }
.texto-legal h3:first-child { margin-top: 0; }
.texto-legal p { margin: 0 0 8px; white-space: pre-line; }
.texto-legal ul { margin: 0 0 8px; padding-left: 20px; }

/* ---------- Editor de texto simple (negrita/cursiva) ---------- */
.editor-rico-toolbar {
    display: flex;
    width: fit-content;
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #f4f3f0;
    overflow: hidden;
}
.editor-rico-toolbar button {
    border: none;
    border-right: 1px solid var(--color-border);
    background: transparent;
    padding: 6px 16px;
    cursor: pointer;
    font-size: .9rem;
    color: var(--color-dark);
}
.editor-rico-toolbar button:last-child { border-right: none; }
.editor-rico-toolbar button:hover { background: #e8e6e0; }
.editor-rico-toolbar button.negrita { font-weight: 700; }
.editor-rico-toolbar button.cursiva { font-style: italic; }
.editor-rico-caja {
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 0 6px 6px 6px;
    background: #fff;
    font-size: .92rem;
    line-height: 1.5;
}
.editor-rico-caja:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }
.editor-rico-caja:empty:before {
    content: attr(data-placeholder);
    color: var(--color-muted);
}


/* ---------- Líneas de concepto de factura (conceptos largos, varias líneas) ---------- */
.fila-linea-factura {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 14px 4px;
    margin-bottom: 12px;
    background: #fcfcfb;
}
.fila-linea-factura .campo-concepto {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    line-height: 1.45;
    white-space: pre-wrap;
}
.num-linea-factura {
    font-weight: 400;
    color: var(--color-muted);
}
.acciones-concepto-linea {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.acciones-concepto-linea select {
    flex: 1 1 220px;
    min-width: 0;
    font-size: .82rem;
}
.numeros-linea-factura {
    gap: 8px;
    align-items: flex-end;
}
.numeros-linea-factura .campo {
    flex: 1 1 120px;
    margin-bottom: 8px;
}
.numeros-linea-factura .campo-quitar-linea {
    flex: 0 0 auto;
}

/* Galería del inmueble: vídeos y documentos */
.miniatura video { width: 100%; height: 100%; object-fit: cover; display: block; background: #111; }
.miniatura-video a { display: block; width: 100%; height: 100%; }
.miniatura-video-icono {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: .9rem; pointer-events: none;
}
.doc-inmueble {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 8px 12px; background: #f8f9fa; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .9rem;
}
.doc-inmueble a { text-decoration: none; font-weight: 600; color: var(--color-dark); word-break: break-word; }
