/* UMBRAL · el CRM. Misma familia visual que la web de ROCCA (oscuro, Jost, línea punteada), con el amarillo de Wasi como
   color de acción para que la mano de Guillo lo reconozca. Aplicación web instalable (manifest en /umbral/). */
:root {
  --fondo: #0E0E0E; --panel: #151515; --panel-2: #1D1D1D; --marfil: #F2EFE7; --texto: var(--marfil); --texto-2: #B9B3A6; --texto-3: #7F796D;
  --linea: rgba(242,239,231,.14); --punteado: 1px dashed rgba(242,239,231,.34); --accion: #FFD54B; --accion-txt: #1A1400; --azul: #6FA8FF;
  --verde: #4FBF8A; --rojo: #E8705F; --naranja: #E9A23B; --dorado: #C8A96B; --terracota: #A95742; --geo: 'Jost', 'Futura', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fondo); color: var(--texto); font-family: var(--geo); font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; letter-spacing: .005em; }
a { color: var(--azul); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--terracota); color: #fff; }

/* Barra lateral */
.lateral { width: 236px; flex-shrink: 0; display: flex; flex-direction: column; padding: 22px 14px; gap: 22px; position: sticky; top: 0; height: 100vh; border-right: var(--punteado); background: var(--fondo); }
.lateral .marca { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-weight: 500; letter-spacing: .32em; font-size: 15px; }
.lateral .marca svg { width: 20px; height: 24px; }
.lateral .inmob { padding: 10px 12px; border: var(--punteado); border-radius: 12px; }
.lateral .inmob small { display: block; font-size: 10px; letter-spacing: .18em; color: var(--texto-3); }
.lateral .inmob b { font-size: 14px; letter-spacing: .1em; font-weight: 500; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--texto-2); text-decoration: none; font-weight: 400; }
.lateral nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.lateral nav a[aria-current="page"] { background: var(--panel-2); color: var(--marfil); font-weight: 500; }
.lateral nav a[aria-current="page"] svg { opacity: 1; color: var(--accion); }
.lateral nav a:hover { color: var(--marfil); }
.lateral .abajo { margin-top: auto; font-size: 13px; color: var(--texto-3); display: grid; gap: 8px; padding: 0 12px; }
.lateral .abajo a { color: var(--texto-2); text-decoration: none; } .lateral .abajo a:hover { color: var(--marfil); }

/* Contenido */
main { flex: 1; min-width: 0; padding: 30px 40px 80px; display: flex; flex-direction: column; gap: 22px; }
.cabeza { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.cabeza h1 { margin: 0; font-size: 30px; font-weight: 500; letter-spacing: -.01em; line-height: 1.1; }
.cabeza p { margin: 6px 0 0; color: var(--texto-2); max-width: 640px; font-weight: 300; }
.cabeza .miga { display: block; font-size: 12px; color: var(--texto-3); text-decoration: none; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: var(--punteado); font-weight: 500; letter-spacing: .04em; cursor: pointer; text-decoration: none; background: transparent; color: var(--marfil); transition: border-color .25s, background .25s, transform .2s; }
.boton:hover { border-color: rgba(242,239,231,.9); transform: translateY(-1px); }
.boton.principal { background: var(--accion); color: var(--accion-txt); border: 1px solid var(--accion); }
.boton.principal:hover { background: #FFE07A; }
.boton.azul { background: var(--marfil); color: #171717; border: 1px solid var(--marfil); }
.boton.peligro { color: var(--rojo); }
.boton.chico { min-height: 32px; padding: 0 12px; font-size: 13px; }
.boton:disabled { opacity: .5; cursor: wait; transform: none; }
.pestanas { display: flex; gap: 20px; border-bottom: var(--punteado); overflow-x: auto; }
.pestanas button { background: none; border: 0; padding: 10px 2px; border-bottom: 2px solid transparent; color: var(--texto-2); font-weight: 500; cursor: pointer; white-space: nowrap; }
.pestanas button[aria-selected="true"] { color: var(--marfil); border-bottom-color: var(--accion); }
.pestanas button span { font-weight: 400; color: var(--texto-3); margin-left: 6px; }
.tarjeta { border: var(--punteado); border-radius: 16px; background: transparent; }
.tarjeta .cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 0; }
.tarjeta .cab h2 { margin: 0; font-size: 18px; font-weight: 500; }
.vacio { padding: 40px; display: grid; gap: 10px; justify-items: start; }
.vacio b { font-size: 18px; font-weight: 500; }
.nota { color: var(--texto-2); font-size: 13px; margin: 0; font-weight: 300; }
.aviso { padding: 12px 16px; border-radius: 12px; border: var(--punteado); color: var(--marfil); }
.aviso.error { border-color: var(--rojo); color: #F6C1B9; }
.aviso.ok { border-color: var(--verde); color: #BFE9D2; }
.estado { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--linea); color: var(--texto-2); }
.estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado.publicado, .estado.con_acuerdo, .estado.compro, .estado.consigno, .estado.aceptado, .estado.abierto { color: var(--verde); }
.estado.borrador, .estado.nueva { color: var(--accion); }
.estado.vendido, .estado.arrendado, .estado.contactada, .estado.calificada, .estado.estudio_enviado, .estado.firmado { color: var(--azul); }
.estado.reservado { color: var(--naranja); }
.estado.retirado, .estado.descartada, .estado.anulado { color: var(--rojo); }

/* Filas del inventario */
.fila { display: grid; grid-template-columns: 84px minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) 130px 30px; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: var(--punteado); text-decoration: none; color: inherit; transition: background .2s; }
.fila:last-child { border-bottom: 0; }
.fila:hover { background: var(--panel); }
.fila.encabezado { font-size: 11px; font-weight: 500; letter-spacing: .14em; color: var(--texto-3); text-transform: uppercase; }
.fila .mini { width: 84px; height: 62px; border-radius: 10px; background: var(--panel-2) center/cover no-repeat; border: 1px solid var(--linea); }
.fila .cod { font-size: 11px; font-weight: 500; letter-spacing: .12em; color: var(--texto-3); }
.fila .tit { font-weight: 500; font-size: 16px; }
.fila .sub { color: var(--texto-2); font-size: 13px; font-weight: 300; }
.fila .flecha { color: var(--texto-3); }

/* Formularios */
.formulario { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 24px; }
.campo { display: grid; gap: 6px; min-width: 0; }
.campo label, .campo .rotulo { font-size: 12px; font-weight: 500; color: var(--texto-2); letter-spacing: .04em; }
.campo input, .campo select, .campo textarea { min-height: 42px; padding: 8px 12px; border: var(--punteado); border-radius: 10px; background: transparent; width: 100%; }
.campo select option { background: #1D1D1D; }
.campo textarea { min-height: 120px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border: 1px solid var(--marfil); }
.campo input::placeholder, .campo textarea::placeholder { color: var(--texto-3); }
.ancho-2 { grid-column: span 2; } .ancho-4 { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: var(--punteado); border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--texto-2); background: none; }
.chip[aria-pressed="true"] { background: var(--marfil); color: #171717; border: 1px solid var(--marfil); }
.segmento { display: inline-flex; border: var(--punteado); border-radius: 999px; overflow: hidden; }
.segmento button { border: 0; background: none; padding: 8px 18px; cursor: pointer; color: var(--texto-2); }
.segmento button[aria-pressed="true"] { background: var(--marfil); color: #171717; }

/* Fotos */
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 20px; }
.foto { position: relative; border-radius: 12px; overflow: hidden; border: var(--punteado); display: grid; background: var(--panel); }
.foto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.foto .pie { display: grid; gap: 6px; padding: 8px 10px; font-size: 12px; }
.foto select { min-height: 30px; font-size: 12px; padding: 2px 6px; border: var(--punteado); border-radius: 6px; background: transparent; }
.foto .etq { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.foto .botones { display: flex; gap: 6px; flex-wrap: wrap; }
.foto .botones button { min-height: 28px; padding: 0 10px; font-size: 12px; border-radius: 999px; border: var(--punteado); background: transparent; cursor: pointer; color: var(--texto-2); }
.foto .botones button:hover { color: var(--marfil); border-color: var(--marfil); }
.foto .botones button.empty { background: var(--marfil); color: #171717; border-color: var(--marfil); }
.foto.amoblada { outline: 2px solid var(--accion); }
.subir { margin: 0 20px 20px; padding: 26px; border: var(--punteado); border-radius: 12px; text-align: center; color: var(--texto-2); font-weight: 300; }
.subir.activo { border-color: var(--accion); background: var(--panel); }
.subir input { display: none; }
.subir label { color: var(--accion); font-weight: 500; cursor: pointer; }
.progreso { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progreso i { display: block; height: 100%; background: var(--accion); width: 0; transition: width .2s; }

/* Contactos */
.contacto { display: grid; grid-template-columns: 120px minmax(0, 1.4fr) minmax(0, 2fr) 170px 150px; gap: 16px; align-items: center; padding: 14px 20px; border-bottom: var(--punteado); }
.contacto:last-child { border-bottom: 0; }
.contacto .tipo { font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--texto-3); }
.contacto .nombre { font-weight: 500; } .contacto .tel a { color: var(--azul); text-decoration: none; }
.contacto .sub { color: var(--texto-2); font-size: 13px; font-weight: 300; }
.contacto select { min-height: 34px; padding: 4px 8px; border: var(--punteado); border-radius: 8px; background: transparent; }
.contacto select option { background: #1D1D1D; }
.contacto .fecha { font-size: 12px; color: var(--texto-3); }
.detalle { grid-column: 1 / -1; background: var(--panel); padding: 12px 16px; border-radius: 10px; font-size: 12.5px; white-space: pre-wrap; color: var(--texto-2); margin: 0; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.filtros button { border: var(--punteado); background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--texto-2); }
.filtros button[aria-pressed="true"] { background: var(--marfil); color: #171717; border: 1px solid var(--marfil); }

/* Panel (inicio) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { border: var(--punteado); border-radius: 14px; padding: 18px 20px; display: grid; gap: 4px; text-decoration: none; color: inherit; transition: border-color .25s; }
.kpi:hover { border-color: rgba(242,239,231,.9); }
.kpi b { font-size: 32px; font-weight: 500; letter-spacing: -.02em; line-height: 1; }
.kpi span { font-size: 13px; color: var(--texto-2); font-weight: 300; }
.kpi small { font-size: 12px; color: var(--accion); }
.dos { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 20px; border-bottom: var(--punteado); font-size: 14px; align-items: center; }
.lista-simple li:last-child { border-bottom: 0; }
.lista-simple .sub { color: var(--texto-2); font-size: 12.5px; font-weight: 300; }
.accesos { display: grid; gap: 10px; padding: 20px; }

/* Buscador */
.buscador { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.buscador .tarjeta { padding: 20px; display: grid; gap: 14px; }
.fuentes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fuentes li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: var(--punteado); border-radius: 10px; }
.fuentes li b { font-weight: 500; }
.fuentes li small { color: var(--texto-3); font-weight: 300; display: block; }
.propio { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: var(--punteado); }
.propio:last-child { border-bottom: 0; }
.propio .mini { width: 64px; height: 48px; border-radius: 8px; background: var(--panel-2) center/cover; }
.propio .sub { color: var(--texto-2); font-size: 12.5px; font-weight: 300; }
.sel { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: var(--punteado); }
.sel:last-child { border-bottom: 0; }
.sel .mini { width: 56px; height: 42px; border-radius: 8px; background: var(--panel-2) center/cover; }
.sel .fuente { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--texto-3); }
.sel .tit { font-weight: 500; font-size: 14px; }
.sel .sub { color: var(--texto-2); font-size: 12px; font-weight: 300; }
.sel button { border: 0; background: none; color: var(--texto-3); cursor: pointer; font-size: 18px; }
.pegar { display: flex; gap: 8px; }
.pegar input { flex: 1; }

/* Diálogos y avisos flotantes */
.dialogo { border: var(--punteado); background: #141414; color: var(--marfil); border-radius: 16px; padding: 26px; width: min(640px, 92vw); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.dialogo::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.dialogo h2 { margin: 0 0 12px; font-size: 20px; font-weight: 500; }
.dialogo textarea { width: 100%; min-height: 240px; border: var(--punteado); border-radius: 10px; background: transparent; padding: 12px; font-size: 13.5px; line-height: 1.5; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--marfil); color: #171717; padding: 12px 18px; border-radius: 999px; font-weight: 500; opacity: 0; transition: .3s; z-index: 60; pointer-events: none; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.entrar { margin: auto; width: min(420px, 92vw); border: var(--punteado); border-radius: 16px; padding: 34px; display: grid; gap: 14px; background: var(--panel); }
.entrar h1 { margin: 0; font-size: 20px; letter-spacing: .3em; font-weight: 500; }
.comparar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .comparar img { width: 100%; border-radius: 8px; } .comparar small { display: block; text-align: center; color: var(--texto-2); }
.portales { display: grid; gap: 8px; padding: 0 20px 20px; }
.portales li { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border: var(--punteado); border-radius: 10px; font-size: 14px; }
.portales li small { color: var(--texto-3); }
.cargando { opacity: .5; pointer-events: none; }
@keyframes girar { to { transform: rotate(360deg); } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--linea); border-top-color: var(--marfil); border-radius: 50%; animation: girar .8s linear infinite; display: inline-block; }
@media (max-width: 960px) { .buscador { grid-template-columns: 1fr; } .dos { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  body { flex-direction: column; }
  .lateral { width: auto; height: auto; position: sticky; top: 0; z-index: 30; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: var(--punteado); }
  .lateral .inmob { display: none; } .lateral nav { flex-direction: row; flex-wrap: wrap; gap: 4px; } .lateral nav a { min-height: 36px; padding: 0 10px; font-size: 13px; } .lateral nav a svg { display: none; } .lateral .abajo { margin: 0; display: flex; gap: 12px; }
  main { padding: 18px 14px 60px; }
  .formulario { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; } .ancho-2 { grid-column: span 2; }
  .fila { grid-template-columns: 64px minmax(0, 1fr) 30px; } .fila > :nth-child(3), .fila > :nth-child(4), .fila > :nth-child(5) { display: none; } .fila.encabezado { display: none; }
  .contacto { grid-template-columns: 1fr 1fr; }
}
