/* Housia.ar — estilos compartidos (tema + componentes + responsive) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Dark theme (default) — sistema Linear/Vercel: fondo plano casi negro,
   superficies sólidas escalonadas por luminosidad, bordes ultra-finos,
   sin glassmorphism ni orbes de color. La profundidad viene del contraste
   entre capas, no de blur ni sombras pesadas. */
:root {
  /* Superficies — escala de gris azulado, plano y sólido */
  --midnight: #0A0C10;   /* fondo base de la app */
  --navy:     #15171C;   /* superficie nivel 1 — cards, kpi, inputs */
  --navy-l:   #1D2027;   /* superficie nivel 2 — modals, popovers, hover elevado */

  /* Acentos — un toque más vivos para que respiren sobre el fondo oscuro */
  --teal:     #2A8C84;
  --teal-l:   #46C7BA;
  --teal-dim: rgba(70,199,186,0.12);
  --sand:     #D3B074;
  --sand-dim: rgba(211,176,116,0.13);
  --cream:    #F5F0E8;
  --green:    #3FB950;
  --green-dim:rgba(63,185,80,0.13);
  --red:      #F0655A;
  --red-dim:  rgba(240,101,90,0.13);
  --purple:   #A878F5;
  --purple-dim:rgba(168,120,245,0.13);

  /* Texto — escala con contraste alto y deliberado */
  --text:     #ECEDEF;
  --muted:    #9BA1AB;
  --dim:      #686D77;

  --border:   rgba(255,255,255,0.065);
  --card:     #15171C;
  --card-h:   #1C1F26;
  --input-bg: #0F1116;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4);
  --hover-tint: rgba(255,255,255,0.045);
  --pill-grey-bg: rgba(255,255,255,0.07);

  /* "Glass" — conservamos los nombres de variable porque los usan ~30 componentes,
     pero ahora son superficies SÓLIDAS (blur 0). Linear no usa glassmorphism. */
  --glass-bg:         #15171C;
  --glass-bg-strong:  #1C1F26;
  --glass-bg-elev:    #1D2027;
  --glass-border:     rgba(255,255,255,0.075);
  --glass-highlight:  rgba(255,255,255,0.03);
  --glass-blur:       0px;
  --glass-sat:        100%;
  --glass-shadow:     0 1px 2px rgba(0,0,0,0.35), 0 4px 14px rgba(0,0,0,0.22);
  --glass-shadow-lg:  0 16px 50px rgba(0,0,0,0.55);
  /* Sidebar — apenas distinto del fondo, separado por borde */
  --sidebar-bg:       #0D0F13;
  /* Orbes apagados — fondo plano */
  --orb-1:            transparent;
  --orb-2:            transparent;
  --orb-3:            transparent;

  --sidebar-w: 210px;
  --topbar-h: 64px;
  --topbar-h-mobile: 56px;
}

/* Light theme — mismo sistema: superficies sólidas, sin glass ni orbes.
   Fondo gris muy claro neutro, cards blancas, bordes finos. */
:root[data-theme="light"] {
  --midnight: #F6F7F8;   /* fondo base */
  --navy:     #FFFFFF;   /* superficie nivel 1 — cards */
  --navy-l:   #FFFFFF;   /* superficie nivel 2 — modals */
  --teal:     #1F8079;
  --teal-l:   #16857B;
  --teal-dim: rgba(31,128,121,0.10);
  --sand:     #B0894C;
  --sand-dim: rgba(176,137,76,0.13);
  --cream:    #F5F0E8;
  --green:    #1A7F3C;
  --green-dim:rgba(26,127,60,0.11);
  --red:      #D14438;
  --red-dim:  rgba(209,68,56,0.10);
  --purple:   #6D44D9;
  --purple-dim:rgba(109,68,217,0.10);
  --text:     #1A1D24;
  --muted:    #5E646E;
  --dim:      #8A909A;
  --border:   rgba(20,23,28,0.10);
  --card:     #FFFFFF;
  --card-h:   #F2F3F5;
  --input-bg: #FFFFFF;
  --shadow-card: 0 1px 2px rgba(20,23,28,0.06);
  --hover-tint: rgba(20,23,28,0.045);
  --pill-grey-bg: rgba(20,23,28,0.06);

  --glass-bg:         #FFFFFF;
  --glass-bg-strong:  #F2F3F5;
  --glass-bg-elev:    #FFFFFF;
  --glass-border:     rgba(20,23,28,0.10);
  --glass-highlight:  rgba(255,255,255,0);
  --glass-blur:       0px;
  --glass-sat:        100%;
  --glass-shadow:     0 1px 2px rgba(20,23,28,0.06), 0 4px 14px rgba(20,23,28,0.05);
  --glass-shadow-lg:  0 16px 50px rgba(20,23,28,0.14);
  --sidebar-bg:       #FFFFFF;
  --orb-1:            transparent;
  --orb-2:            transparent;
  --orb-3:            transparent;
}

/* Transición suave al alternar tema. Excluimos transforms para no romper animaciones existentes. */
html {
  color-scheme: dark;
  /* En iOS, el double-tap nativo dispara zoom y desplaza el layout. Con
     'manipulation' deshabilitamos el double-tap-to-zoom pero conservamos
     el pinch-to-zoom (a11y). También bloqueamos el text-size-adjust que
     redimensiona texto al rotar el device. */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
:root[data-theme="light"] { color-scheme: light; }
body, .card, .modal, .feat-card, .step, input, select, textarea, button {
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ── Switch reutilizable (toggle on/off al estilo iOS) ────────────────────── */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 40px; height: 22px; margin: 0;
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 999px; position: relative; cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch input[type="checkbox"]:checked { background: var(--teal); border-color: var(--teal); }
.switch input[type="checkbox"]:checked::after { transform: translateX(18px); background: #fff; }
.switch input[type="checkbox"]:disabled { opacity: 0.5; cursor: not-allowed; }
.switch-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.switch input[type="checkbox"]:checked ~ .switch-label { color: var(--teal-l, var(--teal)); }

/* ── Orbes de color difuminados detrás de todo (estilo macOS Sonoma) ─────────
   Fixed al viewport, sin pointer events, en z-index negativo respecto al body.
   El backdrop-filter de las cards/topbar/modales recoge estos colores y los
   blurrea, dando el efecto de vidrio teñido. */
body::before {
  content: '';
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 0%,   var(--orb-1) 0%, transparent 65%),
    radial-gradient(55% 45% at 100% 18%, var(--orb-2) 0%, transparent 65%),
    radial-gradient(70% 55% at 50% 105%, var(--orb-3) 0%, transparent 65%),
    radial-gradient(45% 40% at 90% 72%, var(--orb-1) 0%, transparent 70%);
  filter: saturate(125%);
}

/* ── AGENCY SWITCHER ── */
.agency-switcher { position: relative; margin: 0 0 14px; }
.as-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; cursor: pointer; color: var(--text); font: inherit;
  transition: background 0.15s;
}
.as-trigger:hover { background: var(--card-h); }
.as-mark { width: 22px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, var(--teal), var(--sand)); color: var(--midnight); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; font-family: 'Playfair Display', serif; }
.as-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 500; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-caret { font-size: 10px; color: var(--muted); flex-shrink: 0; }
.as-popup {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--glass-bg-elev);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 4px; max-height: 240px; overflow-y: auto; z-index: 50;
  box-shadow: var(--glass-shadow-lg);
  display: none;
}
.agency-switcher.open .as-popup { display: block; }
.as-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--text); }
.as-item:hover { background: var(--hover-tint); }
.as-item.current { background: var(--teal); color: #fff; }
.as-item-role { font-size: 9.5px; color: var(--muted); margin-left: auto; text-transform: uppercase; letter-spacing: 0.06em; }
.as-item.current .as-item-role { color: rgba(255,255,255,0.7); }
.as-empty { padding: 10px; font-size: 11px; color: var(--muted); text-align: center; }
.platform-pill { font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase; background: var(--sand-dim); color: var(--sand); padding: 1px 6px; border-radius: 8px; margin-left: 4px; font-weight: 600; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.42); backdrop-filter: blur(10px) saturate(140%); -webkit-backdrop-filter: blur(10px) saturate(140%); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
:root[data-theme="light"] .modal-overlay { background: rgba(26,39,64,0.22); }
.modal-overlay.open { display: flex; }
.modal {
  display: block;
  background: var(--glass-bg-elev);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--glass-shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; overflow-x: hidden;
  padding: 22px 24px;
  /* En flex containers (como .modal-overlay), un item con contenido grande puede
     querer crecer más allá del max-width. flex-shrink:1 + min-width:0 garantiza
     que respete max-width y no se desborde horizontalmente. */
  flex: 0 1 auto;
  min-width: 0;
}
.modal-hd { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.modal-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 4px; letter-spacing: 0.04em; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text); border-radius: 9px; padding: 8px 10px; font-family: inherit; font-size: 13px; transition: border-color 0.15s, box-shadow 0.15s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--teal-l); box-shadow: 0 0 0 3px var(--teal-dim); }
.modal-ft { display: flex; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); justify-content: flex-end; }
.btn { background: var(--glass-bg-strong); backdrop-filter: blur(12px) saturate(160%); -webkit-backdrop-filter: blur(12px) saturate(160%); border: 1px solid var(--glass-border); color: var(--text); padding: 8px 16px; border-radius: 10px; font-family: inherit; font-size: 12.5px; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.12s; box-shadow: inset 0 1px 0 var(--glass-highlight); }
.btn:hover { background: var(--card-h); border-color: var(--glass-highlight); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(180deg, var(--teal-l), var(--teal)); border-color: rgba(255,255,255,0.18); color: #fff; box-shadow: 0 6px 18px rgba(42,127,127,0.35), inset 0 1px 0 rgba(255,255,255,0.25); }
.btn-primary:hover { background: linear-gradient(180deg, var(--teal-l), var(--teal-l)); border-color: rgba(255,255,255,0.25); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.form-err { color: var(--red); font-size: 11px; min-height: 14px; }
/* Versión "visible": banner sticky con icono, activado vía .visible desde JS. */
.form-err.visible {
  background: rgba(229,105,93,0.10);
  border: 1px solid rgba(229,105,93,0.45);
  color: var(--red);
  font-size: 12.5px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 9px;
  margin-top: 12px;
  line-height: 1.45;
  position: sticky;
  bottom: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  z-index: 5;
}
/* Resalta el wrapper .field cuando JS marca un campo con error. */
.field.has-error > input,
.field.has-error > textarea,
.field.has-error > select { border-color: var(--red) !important; box-shadow: 0 0 0 2px rgba(229,105,93,0.18) !important; }
.field.has-error > label { color: var(--red); }
.field.has-error .chip-group { outline: 1px dashed var(--red); outline-offset: 4px; border-radius: 10px; }

/* Chips de selección (checkbox para múltiple, radio para única). El input nativo
   se oculta y el <span> de al lado actúa como la "pill" clickeable. */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt { position: relative; cursor: pointer; user-select: none; }
.chip-opt input[type="checkbox"],
.chip-opt input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.chip-opt > span { display: inline-block; padding: 6px 12px; border: 1px solid var(--glass-border); background: var(--input-bg); border-radius: 999px; font-size: 12px; color: var(--text); transition: background 0.12s, border-color 0.12s, color 0.12s; }
.chip-opt:hover > span { border-color: var(--glass-highlight); }
.chip-opt input[type="checkbox"]:checked + span,
.chip-opt input[type="radio"]:checked + span { background: var(--teal); border-color: var(--teal-l); color: #fff; box-shadow: 0 2px 8px rgba(42,127,127,0.25); }
.chip-opt input[type="checkbox"]:focus-visible + span,
.chip-opt input[type="radio"]:focus-visible + span { box-shadow: 0 0 0 3px var(--teal-dim); }

/* Stats de visitas en la cabecera del modal de propiedad */
.prop-stat { display: inline-flex; align-items: baseline; gap: 5px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; font-size: 12px; color: var(--text); }
.prop-stat strong { font-size: 14px; font-weight: 600; font-family: 'Playfair Display', serif; color: var(--teal-l); }
.prop-stat .ps-icon { color: var(--muted); }
.prop-stat .ps-lb   { color: var(--muted); font-size: 11px; }

/* Visibilidad del sitio público (configuración) — 3 radios estilo card */
.vis-opt { cursor: pointer; position: relative; }
.vis-opt input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.vis-opt .vis-card {
  background: var(--card); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 14px; transition: all 0.15s; height: 100%;
}
.vis-opt:hover .vis-card { background: var(--card-h); border-color: var(--muted); }
.vis-opt input:checked + .vis-card { border-color: var(--teal-l); background: var(--teal-dim); box-shadow: inset 0 0 0 1px var(--teal-l); }
.vis-opt .vis-icon  { font-size: 20px; margin-bottom: 6px; }
.vis-opt .vis-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.vis-opt .vis-desc  { font-size: 11px; color: var(--muted); line-height: 1.4; }
@media (max-width: 640px) {
  .vis-grid { grid-template-columns: 1fr !important; }
}

/* Panel "✨ IA" del modal de propiedad (narrativas) */
.ai-panel { padding: 4px 0; }
.ai-empty { text-align: center; padding: 30px 18px; background: var(--card); border: 1px dashed var(--border); border-radius: 12px; }
.ai-tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--border); margin-bottom: 14px; padding-bottom: 8px; flex-wrap: wrap; }
.ai-tab { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 6px 12px; font: inherit; font-size: 12px; border-radius: 7px; cursor: pointer; transition: all 0.15s; }
.ai-tab:hover { color: var(--text); background: var(--card); }
.ai-tab.active { background: var(--teal-dim); color: var(--teal-l); border-color: rgba(58,173,173,0.3); }
.ai-text { background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-border); border-radius: 12px; padding: 14px 16px; font-size: 13px; line-height: 1.7; color: var(--text); white-space: pre-wrap; max-height: 320px; overflow-y: auto; }
.ai-meta { font-size: 10.5px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.ai-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; flex-wrap: wrap; }

/* Autocomplete de dirección (Nominatim/OSM) */
.addr-ac { position: relative; }
.addr-ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--glass-bg-elev);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  max-height: 240px; overflow-y: auto; z-index: 60;
  box-shadow: var(--glass-shadow-lg);
}
.addr-ac-item { padding: 8px 10px; cursor: pointer; font-size: 12.5px; color: var(--text); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.addr-ac-item:last-child { border-bottom: none; }
.addr-ac-item:hover, .addr-ac-item.active { background: var(--teal-dim); }
.addr-ac-item .ac-main { font-weight: 500; }
.addr-ac-item .ac-sub  { font-size: 10.5px; color: var(--muted); }
.addr-ac-status { padding: 10px 12px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* Calendario de visitas */
/* minmax(0, 1fr) — NO repeat(7, 1fr): 1fr es minmax(auto,1fr) y el `auto`
   mide min-content, así que una celda con un .cal-event `white-space:nowrap`
   largo expande toda la columna y rompe la grilla. minmax(0,1fr) reparte
   parejo e ignora el min-content. */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 4px; text-align: center; }
.cal-cell { background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-height: 92px; padding: 6px 8px; cursor: pointer; transition: background 0.12s; display: flex; flex-direction: column; gap: 3px; }
.cal-cell:hover { background: var(--card-h); }
.cal-cell.other-month { opacity: 0.35; }
.cal-cell.today { border-color: var(--teal-l); }
.cal-cell.today .cal-day-num { color: var(--teal-l); font-weight: 700; }
.cal-day-num { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }

/* ── Banner de estado del Google Calendar (conectado/error/CTA) ──
   Usa vars de tema en lugar de hex fijos para adaptar a dark/light. */
.cal-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.cal-card.cal-card-ok  { background: var(--green-dim); border-color: var(--green); }
.cal-card.cal-card-err { background: var(--red-dim);   border-color: var(--red);   }
.cal-card-ico  { font-size: 22px; line-height: 1; flex-shrink: 0; }
.cal-card-body { flex: 1; min-width: 0; }
.cal-card-title { font-weight: 600; font-size: 14px; }
.cal-card-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cal-card-warn  { font-size: 12px; color: var(--sand); margin-top: 4px; }
.cal-card-err .cal-card-sub { color: var(--red); }
.cal-card-btn  { font-size: 12px; padding: 6px 12px; flex-shrink: 0; }
.cal-event { font-size: 10.5px; padding: 3px 6px; border-radius: 4px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.cal-event:hover { filter: brightness(1.2); }
.cal-event.scheduled { background: var(--teal-dim); color: var(--teal-l); }
.cal-event.done { background: var(--green-dim); color: var(--green); }
.cal-event.no_show { background: var(--red-dim); color: var(--red); }
.cal-event.cancelled { background: var(--hover-tint); color: var(--muted); text-decoration: line-through; }
.cal-event-time { font-weight: 600; margin-right: 4px; }
.cal-more { font-size: 10px; color: var(--muted); padding: 2px 4px; cursor: pointer; }
.cal-more:hover { color: var(--text); }

@media (max-width: 700px) {
  .cal-cell { min-height: 64px; padding: 4px 5px; }
  .cal-event { padding: 1px 4px; font-size: 9.5px; }
  .cal-day-num { font-size: 10px; }
}

/* Timeline reutilizable */
.timeline-panel { position: relative; padding: 6px 0 6px 26px; max-height: 460px; overflow-y: auto; }
.timeline-panel::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 1px; background: var(--border); }
.tl-event { position: relative; padding: 8px 0 14px; }
.tl-event::before {
  content: ''; position: absolute; left: -19px; top: 12px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bullet, var(--teal)); box-shadow: 0 0 0 3px var(--midnight);
}
.tl-event .tl-when { font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.tl-event .tl-title { font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.tl-event .tl-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tl-event .tl-actor { font-size: 10.5px; color: var(--muted); margin-top: 2px; font-style: italic; }
.tl-event[data-kind="note"]                 { --bullet: var(--sand); }
.tl-event[data-kind="lead_received"]        { --bullet: var(--teal-l); }
.tl-event[data-kind="lead_first_response"]  { --bullet: var(--teal); }
.tl-event[data-kind="visit_scheduled"]      { --bullet: var(--purple); }
.tl-event[data-kind="visit_done"]           { --bullet: var(--green); }
.tl-event[data-kind="visit_noshow"]         { --bullet: var(--red); }
.tl-event[data-kind="visit_cancelled"]      { --bullet: var(--muted); }
.tl-event[data-kind="op_opened"]            { --bullet: var(--sand); }
.tl-event[data-kind="op_closed"]            { --bullet: var(--green); }
.tl-event[data-kind="rent_paid"]            { --bullet: var(--green); }
.tl-event[data-kind="photo_uploaded"]       { --bullet: var(--teal-l); }
.tl-event[data-kind="property_created"],
.tl-event[data-kind="client_created"]       { --bullet: var(--sand); }
.tl-event[data-kind="demand_created"]       { --bullet: var(--purple); }
.tl-empty { padding: 24px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* Tabs de detalle (cliente, etc.) */
.cdet-panel { animation: fadeUp 0.18s ease; min-height: 200px; }

/* Galería de fotos en propiedades */
.photo-tile { position: relative; aspect-ratio: 4/3; background: var(--midnight); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile.is-main { outline: 2px solid var(--sand); }
.photo-tile .photo-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.photo-tile:hover .photo-actions { opacity: 1; }
.photo-tile .photo-actions button { background: rgba(0,0,0,0.65); border: none; color: #fff; font-size: 10px; padding: 4px 6px; border-radius: 4px; cursor: pointer; backdrop-filter: blur(4px); }
.photo-tile .photo-actions button:hover { background: rgba(0,0,0,0.85); }
.photo-tile .main-pill { position: absolute; bottom: 4px; left: 4px; font-size: 9px; background: var(--sand); color: var(--midnight); padding: 2px 6px; border-radius: 3px; font-weight: 600; }
.photo-tile.is-pending { outline: 2px dashed var(--teal-l); outline-offset: -1px; }
.photo-tile .pending-pill { position: absolute; bottom: 4px; left: 4px; font-size: 9px; background: var(--teal); color: #fff; padding: 2px 6px; border-radius: 3px; font-weight: 600; letter-spacing: 0.04em; }

/* ── Dropzone para fotos de propiedad ──
   Wrapper que contiene la grilla (#prop-photos-list), el hint inicial vacío y
   el overlay que aparece al arrastrar archivos. Drag&drop + paste con Ctrl+V. */
.photos-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 18px;
  min-height: 160px;
  transition: border-color 0.15s, background 0.15s;
}
.photos-dropzone:hover { border-color: var(--glass-highlight); }
.photos-dropzone.drag-over { border-color: var(--teal-l); background: rgba(58,173,173,0.06); }
.photos-dropzone.has-photos { padding: 12px; }
.photos-dropzone #prop-photos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.photos-dropzone #prop-photos-list:empty { display: none; }

.photos-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 24px 16px; text-align: center;
}
.photos-empty-icon { font-size: 44px; line-height: 1; opacity: 0.7; }
.photos-empty-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.photos-empty-hint { font-size: 12px; color: var(--muted); line-height: 1.6; max-width: 380px; }
.photos-empty kbd {
  display: inline-block; padding: 1px 6px; font-size: 10.5px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 4px;
  font-family: 'DM Sans', system-ui, sans-serif; color: var(--text); font-weight: 500;
}

/* Overlay que se muestra encima del dropzone mientras se arrastra un archivo */
.photos-drop-overlay {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(42,127,127,0.18);
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
}
.photos-dropzone.drag-over .photos-drop-overlay { display: flex; }
.photos-drop-overlay-text {
  font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600;
  color: #fff;
  background: var(--teal); padding: 12px 24px; border-radius: 999px;
  border: 1px solid var(--teal-l);
  box-shadow: 0 14px 36px rgba(0,0,0,0.45);
}

.photos-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}

/* Tabs internos del modal de propiedad */
.prop-tab-panel { animation: fadeUp 0.2s ease; }

/* ── Modo guiado (wizard) del alta de propiedad ── */
#prop-wizard-toggle.active { background: var(--teal); border-color: var(--teal-l); color: #fff; }
.prop-wizard-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 16px;
  animation: fadeUp 0.18s ease;
}
.prop-wizard-steps { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pw-step {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 6px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--muted);
  position: relative;
}
.pw-step .pw-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--midnight);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}
.pw-step.active { border-color: var(--teal-l); color: var(--text); box-shadow: 0 0 0 2px rgba(58,173,173,0.18); }
.pw-step.active .pw-num { background: var(--teal); color: #fff; }
.pw-step.done { border-color: rgba(93,214,138,0.45); color: var(--text); }
.pw-step.done .pw-num { background: #5DD68A; color: var(--midnight); font-size: 0; }
.pw-step.done .pw-num::before { content: '✓'; font-size: 11px; font-weight: 700; }
.prop-wizard-hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.prop-wizard-nav { display: flex; gap: 8px; justify-content: flex-end; }
.prop-wizard-nav .btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Campo destacado (ej: etapa de obra cuando operation=development) */
.field.emphasized {
  background: rgba(167,139,250,0.10);
  border: 1px solid rgba(167,139,250,0.35);
  border-radius: 9px;
  padding: 10px 12px;
  margin: 4px 0;
}
.field.emphasized > label { color: var(--purple); }

/* ── Asistente AI de construcción de template ── */
.tpl-builder summary::-webkit-details-marker { display: none; }
.tpl-builder[open] .tpl-caret { transform: rotate(180deg); }
.tpl-builder-result {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px;
}
.tpl-builder-result .meta-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: 11.5px;
  margin-bottom: 10px;
}
.tpl-builder-result .meta-row .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  color: var(--muted);
}
.tpl-builder-result .meta-row .chip strong { color: var(--text); font-weight: 500; }
.tpl-builder-result .meta-row .swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; border: 1px solid var(--glass-border); }
.tpl-builder-result .code-box {
  position: relative;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  margin-top: 8px;
  max-height: 360px; overflow: auto;
}
:root[data-theme="light"] .tpl-builder-result .code-box { background: rgba(26,39,64,0.06); }
.tpl-builder-result .code-box pre {
  margin: 0; padding: 12px 14px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1.55;
  color: var(--text);
  white-space: pre;
}
.tpl-builder-result .code-actions {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center;
}
.tpl-builder-result .notes {
  margin-top: 10px;
  font-size: 11.5px; line-height: 1.55;
  color: var(--muted);
  background: var(--sand-dim);
  border-left: 2px solid var(--sand);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  white-space: pre-wrap;
}

/* ── Preview en vivo del template generado ── */
.tpl-preview-box {
  margin-top: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}
.tpl-preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: var(--glass-bg-strong);
  border-bottom: 1px solid var(--glass-border);
  gap: 10px; flex-wrap: wrap;
}
.tpl-preview-tabs { display: flex; gap: 4px; }
.tpl-preview-tab {
  background: transparent; border: 1px solid transparent;
  color: var(--muted); font-size: 11.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
  transition: all 0.12s;
}
.tpl-preview-tab:hover { color: var(--text); background: var(--glass-bg); }
.tpl-preview-tab.active {
  background: var(--teal-dim); color: var(--teal-l);
  border-color: var(--teal-dim);
}
.tpl-preview-bar-right { display: flex; align-items: center; gap: 8px; }
.tpl-preview-status { font-size: 11px; color: var(--muted); }
.tpl-preview-iframe {
  width: 100%;
  height: 540px;
  border: 0;
  background: #fff;
  display: block;
}
:root[data-theme="dark"] .tpl-preview-iframe { background: #0A1520; }

/* ── Iterar con tweaks (asistente conversacional simple) ── */
.tpl-iterate {
  margin-top: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}
.tpl-iterate summary {
  cursor: pointer; padding: 10px 12px;
  font-size: 12.5px; font-weight: 500; color: var(--teal-l);
  background: var(--glass-bg-strong);
  list-style: none;
  border-bottom: 1px solid transparent;
}
.tpl-iterate summary::-webkit-details-marker { display: none; }
.tpl-iterate[open] summary { border-bottom-color: var(--glass-border); }
.tpl-iterate-body { padding: 10px 12px 12px; }
.tpl-iterate-quickreplies {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.tpl-qr {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 11px; font-weight: 500;
  padding: 5px 10px; border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s;
}
.tpl-qr:hover { background: var(--teal-dim); border-color: var(--teal-dim); color: var(--teal-l); }

/* ── Selector de template público (Configuración → Inmobiliaria) ── */
.tpl-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px; padding: 9px 12px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px;
}
.tpl-toolbar-active { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tpl-toolbar-label {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.tpl-toolbar-name { font-size: 13px; color: var(--text); font-weight: 500; }
.tpl-toolbar-actions { display: flex; align-items: center; gap: 10px; }
.tpl-dirty-note { font-size: 11px; color: var(--sand); }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 6px; }
.tpl-active-badge {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--teal); color: #fff;
  padding: 2px 8px; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.tpl-card {
  position: relative; cursor: pointer;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.tpl-card:hover { transform: translateY(-2px); border-color: var(--glass-highlight); }
.tpl-card.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-dim), inset 0 1px 0 var(--glass-highlight);
}
.tpl-card .tpl-preview {
  height: 88px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.tpl-card .tpl-preview::before {
  content: ''; position: absolute; inset: 0;
  background: var(--tpl-bg, var(--card-h));
}
.tpl-card .tpl-preview::after {
  content: ''; position: absolute; left: 18%; right: 18%; top: 22%; bottom: 22%;
  background: var(--tpl-accent, var(--teal));
  border-radius: 4px;
  opacity: 0.55;
}
.tpl-card.selected .tpl-preview::after { opacity: 0.85; }
.tpl-card .tpl-body { padding: 10px 12px 12px; }
.tpl-card .tpl-name { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.tpl-card .tpl-name .tpl-check {
  width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; color: transparent;
}
.tpl-card.selected .tpl-name .tpl-check {
  background: var(--teal); border-color: var(--teal); color: #fff;
}
.tpl-card.selected .tpl-name .tpl-check::before { content: '✓'; }
.tpl-card .tpl-desc { font-size: 10.5px; color: var(--muted); line-height: 1.4; }

/* ── Cropper de imágenes (encuadrar foto/logo/portada) ── */
.cropper-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.62);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.cropper-card {
  background: var(--navy-l);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow-lg);
  padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: calc(100vw - 40px);
}
.cropper-title {
  font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600;
  color: var(--text); align-self: flex-start;
}
.cropper-stage {
  position: relative; overflow: hidden;
  background: var(--input-bg);
  border-radius: 10px;
  cursor: grab; touch-action: none;
  user-select: none;
}
.cropper-stage:active { cursor: grabbing; }
.cropper-stage.round { border-radius: 50%; }
.cropper-img {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
  max-width: none; pointer-events: none; -webkit-user-drag: none;
}
.cropper-mask {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: inherit;
}
.cropper-zoom {
  display: flex; align-items: center; gap: 10px; width: 100%;
}
.cropper-zoom-ic { color: var(--muted); font-size: 16px; width: 12px; text-align: center; }
.cropper-slider {
  flex: 1; appearance: none; -webkit-appearance: none;
  height: 4px; border-radius: 2px; background: var(--border);
  cursor: pointer;
}
.cropper-slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--teal-l); cursor: grab; border: 2px solid var(--navy-l);
}
.cropper-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--navy-l);
  background: var(--teal-l); cursor: grab;
}
.cropper-hint { font-size: 10.5px; color: var(--dim); }
.cropper-ft { display: flex; gap: 8px; justify-content: flex-end; width: 100%; }
@media (max-width: 480px) {
  .cropper-card { padding: 16px; }
}

/* ── Grilla de amenities (chips agrupados por categoría) ── */
.amenities-grid { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.amenity-group { display: flex; flex-direction: column; gap: 7px; }
.amenity-group-title { font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-left: 2px; }
.amenity-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.amenity-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.amenity-chip:hover { background: var(--glass-bg-strong); color: var(--text); border-color: var(--glass-highlight); }
.amenity-chip:active { transform: scale(0.97); }
.amenity-chip svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 1.8; }
.amenity-chip.selected {
  background: var(--teal-dim);
  border-color: rgba(58,173,173,0.45);
  color: var(--teal-l);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 0 1px rgba(58,173,173,0.15);
}
.amenity-chip.selected:hover { background: rgba(42,127,127,0.22); }
:root[data-theme="light"] .amenity-chip.selected { color: var(--teal); background: rgba(31,111,111,0.14); border-color: rgba(31,111,111,0.35); }

/* Lista de tareas */
.task-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-row.completed .task-title { text-decoration: line-through; color: var(--muted); }
.task-checkbox { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border); cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: transparent; }
.task-checkbox.checked { background: var(--teal); border-color: var(--teal); }
.task-checkbox.checked::after { content: '✓'; color: #fff; font-size: 11px; }
.task-title { font-size: 12.5px; font-weight: 500; }
.task-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.priority-pill { font-size: 9.5px; padding: 1px 5px; border-radius: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.priority-pill.high   { background: var(--red-dim); color: var(--red); }
.priority-pill.medium { background: var(--sand-dim); color: var(--sand); }
.priority-pill.low    { background: var(--card-h); color: var(--muted); }

/* Notes panel reutilizable */
.notes-panel { background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); border: 1px solid var(--glass-border); border-radius: 14px; padding: 14px 16px; box-shadow: var(--glass-shadow); }
.notes-panel .notes-list { max-height: 240px; overflow-y: auto; margin-bottom: 10px; }
.notes-panel .note { background: var(--glass-bg-strong); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 10px; font-size: 12px; margin-bottom: 8px; line-height: 1.5; }
.notes-panel .note-meta { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; display: flex; justify-content: space-between; align-items: center; }
.notes-panel .note-del { background: none; border: none; color: var(--red); cursor: pointer; font-size: 11px; }
.notes-panel textarea { width: 100%; background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text); border-radius: 9px; padding: 8px 10px; font-family: inherit; font-size: 12.5px; resize: vertical; }
.notes-panel .add-row { display: flex; gap: 8px; margin-top: 8px; align-items: flex-start; }
.notes-panel .add-row textarea { flex: 1; }

/* Leaflet popup oscuro */
.leaflet-popup-content-wrapper { background: var(--navy); color: var(--text); border: 1px solid var(--border); }
.leaflet-popup-tip { background: var(--navy); }
.leaflet-container { background: var(--midnight); }

/* Filtros inline (selects/inputs en row de filtros) */
.field-inline { background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text); border-radius: 9px; padding: 7px 10px; font-family: inherit; font-size: 12px; transition: border-color 0.15s, box-shadow 0.15s; }
.field-inline:focus { outline: none; border-color: var(--teal-l); box-shadow: 0 0 0 3px var(--teal-dim); }

/* Botón "+ Nuevo" en cards */
.btn-add { background: var(--teal); color: #fff; border: none; padding: 6px 12px; border-radius: 7px; font-size: 12px; font-family: inherit; cursor: pointer; }
.btn-add:hover { background: var(--teal-l); }

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


html { height: 100%; background: var(--midnight); color: var(--text); }
body { height: 100%; font-family: 'DM Sans', sans-serif; background: transparent; color: var(--text); font-size: 13px; overflow: hidden; }

/* ── SHELL ── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  padding: 22px 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 28px; padding: 0 6px; }
.brand-mark { width: 30px; height: 30px; background: var(--sand); border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-mark span { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 700; color: var(--navy); }
.brand-name { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--text); }
.brand-name em { color: var(--teal-l); font-style: normal; }

.nav-section-label { font-size: 9px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted); padding: 0 10px; margin-bottom: 4px; margin-top: 16px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; transition: all 0.15s; margin-bottom: 1px; font-size: 12.5px; font-weight: 400; position: relative; }
.nav-item:hover { background: var(--card-h); color: var(--text); }
.nav-item.active { background: var(--teal); color: #fff; font-weight: 500; }
.nav-icon { font-size: 13px; opacity: 0.7; width: 16px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 10px; }
.nav-badge.gold { background: var(--sand); color: var(--midnight); }

.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,var(--teal),var(--sand)); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }

/* Backdrop para drawer mobile (oculto en desktop) */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 80; opacity: 0; transition: opacity 0.2s; }
.sidebar-backdrop.open { display: block; opacity: 1; }

/* ── MAIN ── */
.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  flex-shrink: 0; gap: 12px;
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.tb-logo { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.tb-title { font-family: 'Playfair Display', serif; font-size: 19px; font-weight: 600; letter-spacing: -0.3px; }
.tb-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.tb-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.tb-nav { display: flex; align-items: center; gap: 3px; justify-content: center; flex-shrink: 0; }
.tb-nav-btn { display: flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; white-space: nowrap; }
.tb-nav-btn:hover { background: var(--card); color: var(--text); border-color: var(--border); }
.tb-nav-btn.active { background: var(--card); color: var(--text); border-color: var(--border); font-weight: 600; }

/* ── Buscador global en el topbar ── */
.tb-search { position: relative; display: flex; align-items: center; flex: 1; min-width: 140px; max-width: 360px; margin: 0 8px; }
.tb-search-ico { position: absolute; left: 10px; color: var(--muted); font-size: 14px; pointer-events: none; line-height: 1; }
.tb-search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 12.5px;
  transition: border-color 0.15s, background 0.15s;
}
.tb-search-input::placeholder { color: var(--muted); }
.tb-search-input:focus { outline: none; border-color: var(--brand, var(--text)); background: var(--card-h, var(--card)); }
.tb-search-input::-webkit-search-cancel-button { cursor: pointer; }

.menu-btn { display: none; width: 36px; height: 36px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); color: var(--text); align-items: center; justify-content: center; cursor: pointer; font-size: 16px; flex-shrink: 0; }

.nav-mobile-only { display: none; }
.icon-btn { width: 32px; height: 32px; border-radius: 7px; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; }

/* ── Botón de usuario en el topbar (reemplaza al user-row del sidebar) ── */
.tb-user-wrap { position: relative; }
.tb-user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px 4px 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  color: var(--text);
}
.tb-user-btn:hover { background: var(--card-h); border-color: var(--border-strong, var(--border)); }
.tb-user-btn .avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }
.tb-user-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; max-width: 140px; }
.tb-user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.tb-user-role { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.tb-user-chev { font-size: 9px; color: var(--muted); margin-left: 2px; transition: transform 0.15s; }
.tb-user-btn[aria-expanded="true"] .tb-user-chev { transform: rotate(180deg); }

/* El .topbar tiene backdrop-filter, que crea un containing block para descendientes
   position:fixed y los atrapa en su stacking context (el z-index del menú queda
   confinado al topbar y aparece por DEBAJO de .content). Por eso el menú vive
   FUERA del .topbar en el partial (es hermano del topbar dentro de .main, que
   no tiene filter/transform/backdrop-filter). Con eso el position:fixed escapa
   al viewport de verdad y el z-index 1100 sí aplica.
   El JS calcula top/right con getBoundingClientRect() del botón al abrirlo.
   z-index alto para quedar arriba del FAB del asistente (1000) y el panel de
   notificaciones (1001), pero abajo de modales globales (100 es modal-overlay
   con su backdrop oscuro — los modales bloquean toda la UI, está OK que tape al menú). */
.tb-user-menu {
  position: fixed; top: 60px; right: 18px;
  min-width: 240px;
  background: var(--card); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.18);
  padding: 6px;
  opacity: 0; transform: translateY(-4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 1100;
}
:root[data-theme="light"] .tb-user-menu { box-shadow: 0 12px 32px rgba(26,39,64,0.16), 0 2px 8px rgba(26,39,64,0.1); }
.tb-user-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.tb-user-menu-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; }
.tb-user-menu-head .avatar-md { width: 36px; height: 36px; font-size: 12.5px; }
.tb-user-menu-head-text { min-width: 0; flex: 1; }
.tb-user-menu-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user-menu-meta { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user-menu-sep { height: 1px; background: var(--border); margin: 2px 4px; }
.tb-user-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px; border-radius: 7px;
  background: transparent; border: 0; color: var(--text);
  font-size: 12.5px; font-weight: 500; text-align: left; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.tb-user-menu-item:hover { background: var(--card-h); }
.tb-user-menu-ico { width: 18px; text-align: center; opacity: 0.75; font-size: 13px; }
.tb-user-menu-danger { color: var(--red); }
.tb-user-menu-danger:hover { background: rgba(228, 77, 77, 0.1); }
.notif-wrap { position: relative; }
.notif-wrap::after { content:''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; background: var(--sand); border-radius: 50%; box-shadow: 0 0 0 2px var(--glass-bg-elev); }

/* ── CONTENT ── */
.content { flex: 1; overflow-y: auto; padding: 22px 26px 40px; display: flex; flex-direction: column; gap: 18px; }
.content::-webkit-scrollbar { width: 3px; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.view { display: none; flex-direction: column; gap: 18px; }
.view.active { display: flex; }

/* view-editar-propiedad ahora vive dentro de .content (movido en commit posterior
   a la migración modal→ficha). Sin reglas extra de posicionamiento — hereda el
   layout normal de las demás views. */

/* Pill numérico junto a "Prospectos" en la ficha de propiedad */
.prospects-pill {
  display: inline-block; margin-left: 4px;
  font-size: 10.5px; font-weight: 600; line-height: 1;
  padding: 3px 7px; border-radius: 999px;
  background: var(--teal); color: #fff;
}

/* ── Stats collapsibles ──
   Bloque de KPIs que arranca colapsado y se despliega al click. Reduce ruido
   visual en la parte superior de listados grandes (propiedades, contratos…). */
.stats-collapsible { margin-bottom: 14px; }
.stats-collapse-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.stats-collapse-btn:hover { background: var(--card-h); border-color: var(--glass-highlight); }
.stats-collapse-btn .stats-collapse-arrow { font-size: 10px; opacity: 0.7; transition: transform 0.2s; }
.stats-collapsible[data-collapsed="true"] .stats-collapse-arrow { transform: rotate(-90deg); }
.stats-collapsible[data-collapsed="true"] .stats-collapse-body { display: none; }
.stats-collapse-body { margin-top: 12px; animation: fadeUp 0.2s ease; }

/* ── GRIDS ── */
.g4  { display: grid; grid-template-columns: repeat(4,1fr);    gap: 14px; }
.g3  { display: grid; grid-template-columns: repeat(3,1fr);    gap: 14px; }
.g2  { display: grid; grid-template-columns: 1fr 1fr;           gap: 14px; }
.g21 { display: grid; grid-template-columns: 1.7fr 1fr;         gap: 14px; }
.g12 { display: grid; grid-template-columns: 1fr 1.7fr;         gap: 14px; }
.g32 { display: grid; grid-template-columns: 1.5fr 1fr;         gap: 14px; }

/* ── Vista Clientes: avatar, pills clickeables, fila expandida con matches ── */
.client-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--midnight) center/cover no-repeat;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  cursor: pointer;
}
.client-av-init { background: linear-gradient(135deg, var(--teal), var(--sand)); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; border: 0;
  font-size: 10.5px; font-weight: 600; line-height: 1.6;
  cursor: pointer; transition: transform 0.1s, filter 0.15s;
}
.pill-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.pill-btn.p-teal { background: var(--teal-dim, rgba(70,199,186,0.18)); color: var(--teal-l, var(--teal)); }
.pill-btn.p-sand { background: rgba(220,180,110,0.18); color: var(--sand); }

.client-matches-row { background: var(--card); }
:root[data-theme="light"] .client-matches-row { background: rgba(70,199,186,0.04); }
.client-matches-cell { padding: 0 !important; border-top: 0 !important; }
.client-matches-host { padding: 12px 18px 16px; border-bottom: 1px solid var(--border); }
.match-group { margin-bottom: 14px; padding: 10px 12px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px; }
.match-group:last-child { margin-bottom: 0; }
.match-group-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.match-group-hd strong { color: var(--text); font-weight: 600; }
.match-table tbody tr td { padding: 6px 8px; }
.match-table tr:hover td { background: var(--card-h); }
.match-thumb { width: 56px; height: 42px; border-radius: 6px; border: 1px solid var(--border); }

/* ── Ficha de cliente: avatar grande con upload, thread de chat ── */
.cdet-head { display: flex; gap: 16px; align-items: center; }
.cdet-avatar-wrap { position: relative; flex-shrink: 0; }
.cdet-avatar {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--midnight) center/cover no-repeat;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 600; color: #fff;
}
.cdet-avatar-init { background: linear-gradient(135deg, var(--teal), var(--sand)); }
.cdet-avatar-edit {
  position: absolute; bottom: -2px; right: -2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  transition: background 0.15s;
}
.cdet-avatar-edit:hover { background: var(--card-h); }

.cdet-chat-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; max-height: 460px; overflow-y: auto; padding-right: 4px; }
.cdet-msg { padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; max-width: 88%; }
.cdet-msg-out { background: var(--teal-dim, rgba(70,199,186,0.18)); align-self: flex-end; border-top-right-radius: 3px; }
.cdet-msg-in  { background: var(--card); border: 1px solid var(--border); align-self: flex-start; border-top-left-radius: 3px; }
.cdet-msg-meta { font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.cdet-msg-meta em { font-style: italic; color: var(--text); }
.cdet-msg-body { white-space: pre-wrap; word-wrap: break-word; }

.cdet-chat-composer { padding-top: 12px; border-top: 1px solid var(--border); }
.cdet-chat-composer-meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.cdet-chat-composer textarea { width: 100%; background: var(--input-bg); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 8px 10px; font-family: inherit; font-size: 13px; resize: vertical; }
.cdet-chat-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ── KPI ── */
.kpi {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 17px 19px;
  position: relative; overflow: hidden;
  box-shadow: var(--glass-shadow);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
}
.kpi::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background: var(--kpi-color, var(--teal)); }
.kpi:hover { background: var(--glass-bg-strong); transform: translateY(-2px); box-shadow: var(--glass-shadow-lg); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.kpi-label { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.kpi-icon { font-size: 15px; opacity: 0.55; }
.kpi-val { font-size: 25px; font-weight: 600; letter-spacing: -0.5px; line-height: 1; margin-bottom: 7px; }
.kpi-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 10px; padding: 2px 6px; border-radius: 20px; font-weight: 500; }
.up   { background: var(--green-dim); color: var(--green); }
.dn   { background: var(--red-dim);   color: var(--red); }
.neu  { background: var(--sand-dim);  color: var(--sand); }
.kpi-note { font-size: 10.5px; color: var(--muted); }

/* ── CARD ── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 19px 21px;
  box-shadow: var(--glass-shadow);
}
.card-hd { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.card-sub { font-size: 11px; color: var(--muted); }
/* card-link se usa en <button>: hay que resetear el chrome nativo del browser
   (background/border buttonface) que sino se ve como un recuadro gris sucio. */
.card-link {
  font-size: 11px; color: var(--teal-l);
  background: none; border: none; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  padding: 4px 8px; border-radius: 7px;
  transition: background 0.14s ease, color 0.14s ease;
}
.card-link:hover { background: var(--hover-tint); }
.card-link:active { transform: translateY(0.5px); }
.placeholder { padding: 30px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.placeholder strong { color: var(--text); }

/* ── TABLE ── */
.t-wrap { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; }
.t th { font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0 0 9px; border-bottom: 1px solid var(--border); font-weight: 400; white-space: nowrap; }
.t td { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
.t td + td, .t th + th { padding-left: 10px; }
.t tr:last-child td { border-bottom: none; }
.t tr:hover td { color: var(--text); }
.t-name { font-weight: 500; margin-bottom: 1px; }
.t-sub  { font-size: 10.5px; color: var(--muted); }
.t-val  { font-weight: 600; color: var(--sand); white-space: nowrap; }

/* PILLS */
.pill { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 500; white-space: nowrap; display: inline-block; }
.p-teal   { background: var(--teal-dim);   color: var(--teal-l); }
.p-sand   { background: var(--sand-dim);   color: var(--sand); }
.p-green  { background: var(--green-dim);  color: var(--green); }
.p-red    { background: var(--red-dim);    color: var(--red); }
.p-purple { background: var(--purple-dim); color: #A78BFA; }
.p-grey   { background: var(--pill-grey-bg); color: var(--muted); }

/* ── BAR CHART ── */
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 110px; }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bc-bars { width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 90px; }
.bc-bar { border-radius: 4px 4px 0 0; width: 45%; min-height: 4px; transition: opacity 0.2s; }
.bc-bar:hover { opacity: 0.8; }
.bc-lbl { font-size: 9.5px; color: var(--muted); }

/* ── FUNNEL ── */
.funnel-row { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.fn-lbl { font-size: 11px; color: var(--muted); width: 110px; flex-shrink: 0; line-height: 1.3; }
.fn-track { flex: 1; background: var(--border); border-radius: 4px; height: 22px; overflow: hidden; }
.fn-bar { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 10.5px; font-weight: 500; color: #fff; }
.fn-count { font-size: 11px; font-weight: 500; width: 28px; text-align: right; flex-shrink: 0; }

/* ── DONUT ── */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-rel { position: relative; width: 110px; height: 110px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
svg.donut { transform: rotate(-90deg); position: absolute; }
.donut-center { text-align: center; }
.donut-val { font-size: 20px; font-weight: 600; letter-spacing: -0.5px; }
.donut-lbl { font-size: 10px; color: var(--muted); }
.dl { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 140px; }
.dl-row { display: flex; align-items: center; gap: 7px; }
.dl-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.dl-name { flex: 1; font-size: 11.5px; color: var(--muted); }
.dl-pct { font-size: 11.5px; font-weight: 500; }

/* ── MINI STAT ── */
.mini {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 13px 15px; display: flex; align-items: center; gap: 11px;
  box-shadow: var(--glass-shadow);
}
.mini-ico { font-size: 18px; opacity: 0.7; }
.mini-val { font-size: 17px; font-weight: 600; letter-spacing: -0.4px; }
.mini-lbl { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* ── AGENT ROW ── */
.ag-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.ag-row:last-child { border-bottom: none; }
.ag-av { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; color: #fff; }
.ag-name { font-size: 12px; font-weight: 500; }
.ag-meta { font-size: 10.5px; color: var(--muted); }
.ag-val { font-size: 12px; font-weight: 600; color: var(--sand); white-space: nowrap; margin-left: auto; }

/* ── ACTIVITY ── */
.act { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: none; }
.act-line-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 3px; }
.act-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.act-line { width: 1px; flex: 1; background: var(--border); margin-top: 3px; }
.act-title { font-size: 12px; font-weight: 500; margin-bottom: 2px; line-height: 1.4; }
.act-meta  { font-size: 10.5px; color: var(--muted); }

/* ── TIMELINE BAR ── */
.timeline-bar { display: flex; height: 40px; border-radius: 8px; overflow: hidden; gap: 2px; margin-bottom: 10px; }
.tl-seg { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; border-radius: 6px; transition: flex 0.3s; padding: 0 4px; text-align: center; }

/* ── OPS TABS ── */
.ops-tabs { display:flex; gap:6px; margin-bottom:13px; flex-wrap: wrap; }
.ops-tab { display:flex; align-items:center; gap:6px; padding:6px 13px; border-radius:7px; border:1px solid var(--border); background:var(--card); color:var(--muted); cursor:pointer; font-size:12px; font-family:'DM Sans',sans-serif; transition:all 0.15s; }
.ops-tab.active { background: var(--glass-bg-strong); color:var(--text); border-color: var(--glass-highlight); box-shadow: inset 0 1px 0 var(--glass-highlight); }
.ops-tab:hover:not(.active) { background:var(--card-h); color:var(--text); }
.ops-tab-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.ops-tab-count { font-size:10px; background:var(--pill-grey-bg); padding:1px 5px; border-radius:10px; margin-left:2px; }

/* ── PORTAL BADGE ── */
.portal-b { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 4px; display: inline-block; }
.pz { background: rgba(0,122,255,0.18); color: #4DA3FF; }
.pa { background: rgba(255,149,0,0.18);  color: #FFB347; }
.pm { background: rgba(255,214,0,0.18);  color: #D4B800; }
.pr { background: rgba(192,57,43,0.18);  color: var(--red); }
.pi { background: var(--purple-dim); color: #A78BFA; }

.ppc-bar-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 22px; }
.ppc-bar { position: absolute; left: 50%; transform: translateX(-50%); top: 0; bottom: 0; border-radius: 4px; opacity: 0.55; }
.ppc-bar-wrap span { position: relative; font-size: 11px; font-weight: 600; color: #fff; }

/* ── CONTRACT WIZARD STEPPER ── */
.contract-wizard-steps { display:flex; align-items:center; gap:10px; margin-bottom:18px; flex-wrap:wrap; }
.cws-step { display:flex; align-items:center; gap:8px; padding:7px 14px; border-radius:7px; border:1px solid var(--border); background:var(--card); color:var(--muted); font-size:12px; transition:all 0.15s; }
.cws-step.active { background: var(--glass-bg-strong); color:var(--text); border-color: var(--glass-highlight); box-shadow: inset 0 1px 0 var(--glass-highlight); }
.cws-step.done { color:var(--text); border-color: var(--teal); }
.cws-step.clickable { cursor:pointer; }
.cws-step.clickable:hover { background:var(--card-h); }
.cws-num { display:flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:var(--input-bg); font-size:11px; font-weight:600; }
.cws-step.active .cws-num { background: var(--teal); color:#fff; }
.cws-step.done .cws-num   { background: var(--teal); color:#fff; }
.cws-step.done .cws-num::after { content: '✓'; }
.cws-step.done .cws-num span { display:none; }
.cws-lbl { font-weight:500; }
.cws-sep { flex:1; height:1px; background:var(--border); min-width:20px; }

/* ── CONTRACT: grilla de propiedades en el paso 1 ── */
.contract-prop-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px; }
.contract-prop-card { display:flex; flex-direction:column; padding:10px; border:1px solid var(--border); border-radius:8px; background:var(--card); cursor:pointer; transition:all 0.15s; text-align:left; font-family:inherit; }
.contract-prop-card:hover { background:var(--card-h); border-color: var(--glass-highlight); }
.contract-prop-card.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(48,179,167,0.18); }
.contract-prop-card .cpc-img { width:100%; aspect-ratio:16/10; border-radius:6px; background:var(--midnight) center/cover no-repeat; margin-bottom:8px; }
.contract-prop-card .cpc-title { font-size:12.5px; font-weight:500; color:var(--text); margin-bottom:2px; line-height:1.3; }
.contract-prop-card .cpc-addr  { font-size:11px; color:var(--muted); margin-bottom:4px; }
.contract-prop-card .cpc-meta  { font-size:11px; color:var(--muted); display:flex; gap:6px; flex-wrap:wrap; }

/* ── CONTRACT: chips grandes para tipo de contrato (paso 2) ── */
.contract-kind-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:14px; }
.contract-kind-card { display:flex; flex-direction:column; gap:8px; padding:18px 16px; border:1px solid var(--border); border-radius:10px; background:var(--card); cursor:pointer; text-align:left; font-family:inherit; transition:all 0.15s; color:inherit; }
.contract-kind-card:hover { background:var(--card-h); border-color: var(--glass-highlight); }
.contract-kind-card.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(48,179,167,0.18); background: var(--glass-bg-strong); }
.contract-kind-card .ckc-icon { font-size:28px; }
.contract-kind-card .ckc-title { font-size:14px; font-weight:600; color:var(--text); }
.contract-kind-card .ckc-desc  { font-size:11.5px; color:var(--muted); line-height:1.5; }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.view.active > * { animation: fadeUp 0.35s ease both; }
.view.active > *:nth-child(1) { animation-delay: 0.04s; }
.view.active > *:nth-child(2) { animation-delay: 0.09s; }
.view.active > *:nth-child(3) { animation-delay: 0.14s; }
.view.active > *:nth-child(4) { animation-delay: 0.19s; }
.view.active > *:nth-child(5) { animation-delay: 0.24s; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   Breakpoints:
     ≥1100px  → desktop (default arriba)
     1100-900 → tablet wide  (g4 → 2col, g21/g12/g32 → 1col)
     900-700  → tablet
     ≤700px   → mobile (sidebar drawer, todo apilado)
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 1099px) {
  .g4  { grid-template-columns: repeat(2, 1fr); }
  .g3  { grid-template-columns: repeat(2, 1fr); }
  .g21, .g12, .g32 { grid-template-columns: 1fr; }
}

@media (max-width: 899px) {
  .g3  { grid-template-columns: 1fr; }
  .g2  { grid-template-columns: 1fr; }
  .content { padding: 18px 18px 32px; gap: 14px; }
  .topbar { padding: 12px 18px; }
}

@media (max-width: 699px) {
  :root { --sidebar-w: 0px; }
  body { overflow-y: auto; }
  html, body { height: auto; }

  /* iOS Safari hace auto-zoom al tocar un input/select/textarea con
     font-size < 16px (y luego mantiene el zoom, "modificando" el layout).
     Forzamos 16px en mobile para evitar el comportamiento. En desktop
     dejamos los tamaños chicos originales. */
  input, select, textarea, button {
    font-size: 16px;
  }
  .shell { display: block; height: auto; min-height: 100vh; }
  .main { height: auto; overflow: visible; }
  .content { overflow-y: visible; padding: 16px 14px 28px; gap: 12px; }

  /* Sidebar como drawer off-canvas — más opaca en mobile para legibilidad */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 250px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 90;
    background: var(--midnight);
    box-shadow: 8px 0 32px rgba(0,0,0,0.45), inset -1px 0 0 var(--glass-border);
  }
  :root[data-theme="light"] .sidebar { background: var(--navy); box-shadow: 8px 0 32px rgba(26,39,64,0.18), inset -1px 0 0 var(--glass-border); }
  .sidebar.open { transform: translateX(0); }

  .menu-btn { display: inline-flex; }

  .topbar { padding: 12px 14px; gap: 8px; }
  .tb-title { font-size: 16px; }
  .tb-sub { font-size: 10.5px; }
  .icon-btn { width: 30px; height: 30px; font-size: 13px; }
  .tb-nav { display: none; }
  .tb-logo { display: none; }
  .tb-search { display: none; }
  .nav-mobile-only { display: flex; }
  .nav-section-label.nav-mobile-only { display: block; }

  /* En mobile, comprimir el botón de usuario a solo avatar para ganar espacio */
  .tb-user-btn { padding: 3px; gap: 0; }
  .tb-user-text, .tb-user-chev { display: none; }
  .tb-user-btn .avatar-sm { width: 28px; height: 28px; }
  .tb-user-menu { min-width: 220px; right: -4px; }

  .g4 { grid-template-columns: 1fr; }
  .kpi-val { font-size: 22px; }
  .card { padding: 16px 16px; }

  /* Tablas: scroll horizontal y reducir labels largos */
  .fn-lbl { width: 92px; font-size: 10.5px; }
  .bar-chart { height: 96px; }
  .bc-bars { height: 78px; }
}

@media (max-width: 420px) {
  .tb-title { font-size: 14.5px; }
  .kpi { padding: 14px 14px; }
  .card { padding: 14px 14px; }
  .ops-tab { padding: 5px 10px; font-size: 11px; }
  .funnel-row { gap: 6px; }
  .fn-lbl { width: 80px; font-size: 10px; }
}

/* ═══════════════ Vista Mapa ═══════════════ */
.map-shell {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 480px;
}
.map-controls {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--navy);
  align-items: center;
  flex-wrap: wrap;
}
.map-controls input,
.map-controls select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}
.map-controls input { flex: 1; min-width: 200px; }
.map-controls input:focus,
.map-controls select:focus { outline: none; border-color: var(--teal); }
.map-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.map-count {
  font-size: 11.5px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}
.map-canvas {
  flex: 1;
  width: 100%;
  background: var(--midnight);
}
.map-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}

/* Mini-mapa del resumen */
.mini-map {
  height: 220px;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: var(--midnight);
  border: 1px solid var(--border);
}

/* Pin clásico (gotita) — usado por el ghost del geocoding y compat. */
.map-pin {
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
}
.map-pin::after {
  content: '';
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  display: block;
}
.map-pin.own     { background: var(--teal); }
.map-pin.foreign { background: var(--purple); }

/* ─── Pin tipo "cápsula de precio" (Zillow-style) ─────────────────────
   Mostramos el precio abreviado directamente sobre el mapa, en color
   por tipo de operación, con icono de tipo de propiedad. Mucho más
   informativo que un punto y permite escanear precios en el mapa. */
.map-pin-wrap { /* contenedor del divIcon — reseteamos lo default de leaflet */
  background: none !important;
  border: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: visible;
}
/* La cápsula se ancla por su centro-bottom al punto del mapa (de ahí el translate).
   Como el wrap tiene 0×0, no necesitamos iconSize/iconAnchor exactos en Leaflet. */
.map-price-pin {
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -100%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px 3px 5px;
  border-radius: 999px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.15);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.map-price-pin:hover {
  transform: translate(-50%, -100%) translateY(-1px) scale(1.04);
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.2);
}
.map-price-pin .mpp-ico {
  font-size: 11px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  background: rgba(255,255,255,0.22);
  border-radius: 50%;
  flex-shrink: 0;
}
.map-price-pin .mpp-cur { font-size: 9.5px; opacity: 0.88; font-weight: 600; }
.map-price-pin .mpp-num { font-size: 11.5px; }
.map-price-pin .mpp-sfx {
  font-size: 9px; opacity: 0.85; font-weight: 600;
  margin-left: 1px;
}
/* Colores por operación */
.map-price-pin.op-sale  { background: linear-gradient(180deg, #46C7BA, var(--teal)); }
.map-price-pin.op-rent  { background: linear-gradient(180deg, #DDC089, var(--sand)); color: #2A1F0A; }
.map-price-pin.op-temp  { background: linear-gradient(180deg, #BC95F8, var(--purple)); }
.map-price-pin.op-dev   { background: linear-gradient(180deg, #F58176, var(--red)); }
/* Pin de la red (ajeno) — borde violeta para distinguirlo del propio */
.map-price-pin.is-foreign { border-color: var(--purple); }
.map-price-pin.is-foreign::after {
  content: '⇆';
  position: absolute;
  top: -7px; right: -7px;
  background: var(--purple);
  color: #fff;
  border-radius: 50%;
  width: 14px; height: 14px;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
  font-weight: 700;
}

/* Variante compacta para el mini-mapa del Resumen (pin más chico) */
.map-pin-wrap.is-mini .map-price-pin {
  padding: 2px 6px 2px 4px;
  font-size: 10px;
  border-width: 1.5px;
}
.map-pin-wrap.is-mini .map-price-pin .mpp-ico {
  width: 13px; height: 13px; font-size: 9px;
}
.map-pin-wrap.is-mini .map-price-pin .mpp-num { font-size: 10px; }
.map-pin-wrap.is-mini .map-price-pin .mpp-cur { font-size: 8px; }

/* ─── Popup compacto (consistente entre Vista Mapa y Red Housia) ───── */
.leaflet-popup-content-wrapper {
  background: var(--navy);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
}
.leaflet-popup-content { margin: 0; min-width: 200px; }
.leaflet-popup-tip { background: var(--navy); border: 1px solid var(--border); }
.leaflet-popup-close-button { color: var(--muted) !important; padding: 6px 8px 0 0 !important; }
.map-popup-compact { font-family: 'DM Sans', sans-serif; width: 220px; }
.map-popup-compact .mpc-photo {
  position: relative;
  width: 100%;
  height: 92px;
  background-size: cover;
  background-position: center;
  background-color: var(--midnight);
  border-radius: 9px 9px 0 0;
}
.map-popup-compact .mpc-op {
  position: absolute;
  top: 6px; left: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.map-popup-compact .mpc-op.op-sale  { background: var(--teal); }
.map-popup-compact .mpc-op.op-rent  { background: var(--sand); color: #2A1F0A; }
.map-popup-compact .mpc-op.op-temp  { background: var(--purple); }
.map-popup-compact .mpc-op.op-dev   { background: var(--red); }
.map-popup-compact .mpc-body { padding: 8px 10px 10px; }
.map-popup-compact .mpc-price {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--teal-l);
  line-height: 1.15;
  margin-bottom: 4px;
}
.map-popup-compact .mpc-meta {
  font-size: 10.5px;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.3;
}
.map-popup-compact .mpc-meta .mpc-type { font-weight: 600; }
.map-popup-compact .mpc-meta .mpc-specs { color: var(--muted); }
.map-popup-compact .mpc-addr {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.map-popup-compact .mpc-owner {
  font-size: 9.5px;
  color: var(--purple);
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-popup-compact .mpc-btn {
  width: 100%;
  background: linear-gradient(180deg, var(--teal-l), var(--teal));
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.map-popup-compact .mpc-btn:hover { filter: brightness(1.08); }

/* Mobile: popup aún más chico para no tapar el mapa */
@media (max-width: 699px) {
  .map-popup-compact { width: 180px; }
  .map-popup-compact .mpc-photo { height: 76px; }
  .map-popup-compact .mpc-price { font-size: 14px; }
  .map-popup-compact .mpc-meta,
  .map-popup-compact .mpc-addr { font-size: 10px; }
  .map-popup-compact .mpc-btn { font-size: 10.5px; padding: 5px 8px; }
  /* Pin un poco más chico para evitar superposiciones en zoom bajo */
  .map-price-pin { font-size: 10.5px; padding: 2px 7px 2px 4px; }
  .map-price-pin .mpp-ico { width: 14px; height: 14px; font-size: 10px; }
  .map-price-pin .mpp-num { font-size: 10.5px; }
}

/* Context menu del mapa (click derecho sobre el canvas) */
.map-ctx-menu {
  position: absolute;
  z-index: 1000;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  overflow: hidden;
}
.map-ctx-menu[hidden] { display: none; }
.map-ctx-menu button {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 9px 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.map-ctx-menu button:hover { background: var(--teal-dim); }

/* Autocomplete de geocoding en el control del mapa */
#map-geo-ac .addr-ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1001;
}

/* Flash de feedback cuando se copia algo al clipboard */
.toast-flash {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(58,173,173,0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  animation: toastFlash 1.8s ease-out forwards;
}
@keyframes toastFlash {
  0%   { opacity: 0; transform: translate(-50%, 10px); }
  10%  { opacity: 1; transform: translate(-50%, 0); }
  80%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* ═══════════════ Identidad de la inmobiliaria (sidebar) ═══════════════ */
.agency-identity {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; margin-bottom: 14px;
  border-radius: 9px; cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.agency-identity:hover { background: var(--card); border-color: var(--border); }
.agency-logo {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--sand));
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: 14px; font-weight: 700;
  color: #fff;
}
.agency-logo.has-img { background-color: #fff; }
.agency-identity-text { min-width: 0; }
.agency-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agency-identity-sub { font-size: 9.5px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* ═══════════════ Tour de bienvenida ═══════════════ */
.tour-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(8px) saturate(130%);
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.tour-overlay[hidden] { display: none; }
.tour-card {
  width: 100%; max-width: 460px;
  background: var(--glass-bg-elev);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow-lg);
  padding: 14px 14px 18px;
  position: relative;
}
.tour-skip {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 11.5px; cursor: pointer; font-family: inherit;
  padding: 4px 6px; border-radius: 6px;
}
.tour-skip:hover { color: var(--text); background: var(--card); }
.tour-slide { text-align: center; padding: 30px 22px 16px; }
.tour-slide.accent .tour-icon {
  background: var(--purple-dim);
  box-shadow: 0 0 0 6px var(--purple-dim);
}
.tour-countdown {
  position: absolute; top: 14px; left: 16px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tour-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 16px; background: var(--teal-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.tour-title {
  font-family: 'Playfair Display', serif;
  font-size: 21px; font-weight: 600; color: var(--text);
  margin-bottom: 9px;
}
.tour-text { font-size: 13.5px; line-height: 1.65; color: var(--muted); max-width: 340px; margin: 0 auto; }
.tour-text strong { color: var(--text); }
.tour-step { font-size: 10.5px; color: var(--dim); margin-top: 14px; letter-spacing: 0.04em; }
.tour-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border);
}
.tour-dots { display: flex; gap: 6px; padding-left: 6px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background 0.2s, width 0.2s; }
.tour-dot.active { background: var(--teal-l); width: 18px; border-radius: 3px; }
.tour-controls { display: flex; gap: 6px; }
.tour-ctrl {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.tour-ctrl:hover { background: var(--card-h); }

/* ═══════════════ Splash de Inmobiliarias amigas ═══════════════ */
.modal.friends-intro { padding: 0; overflow: hidden; }
.friends-intro-hero {
  text-align: center; padding: 30px 28px 22px;
  background: linear-gradient(160deg, var(--teal-dim), transparent);
  border-bottom: 1px solid var(--border);
}
.friends-intro-icon {
  width: 58px; height: 58px; margin: 0 auto 14px;
  border-radius: 15px; background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
}
.friends-intro-lede { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin-top: 8px; }
.friends-intro-points { padding: 20px 26px 6px; display: flex; flex-direction: column; gap: 16px; }
.fi-point { display: flex; gap: 12px; align-items: flex-start; }
.fi-ico {
  font-size: 20px; flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.fi-point > div { display: flex; flex-direction: column; gap: 3px; }
.fi-point strong { font-size: 13px; color: var(--text); }
.fi-point span { font-size: 12px; color: var(--muted); line-height: 1.55; }

/* ═══════════════ Hero de la sección Amigas ═══════════════ */
.friends-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, var(--teal-dim), var(--purple-dim));
  border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.friends-hero-main { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.friends-hero-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.friends-hero-title { font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.friends-hero-text { font-size: 12px; color: var(--muted); line-height: 1.55; }
.friends-hero-text strong { color: var(--text); }
.friends-hero-help {
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); padding: 8px 14px; border-radius: 9px;
  font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}
.friends-hero-help:hover { background: var(--card-h); }
@media (max-width: 560px) {
  .friends-hero-help { width: 100%; }
}

/* ═══════════════ Red Housia — capa social ═══════════════ */
.net-filterbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
  margin-bottom: 14px;
}
.net-filterbar .field { margin: 0; flex: 1 1 130px; min-width: 0; }
.net-filterbar .field.grow { flex: 2 1 200px; }
.net-filterbar .field input,
.net-filterbar .field select {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 12.5px;
}
.net-filterbar .field input:focus,
.net-filterbar .field select:focus { outline: none; border-color: var(--teal-l); box-shadow: 0 0 0 3px var(--teal-dim); }

.net-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 12px;
}
.net-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: transform 0.13s, border-color 0.13s, box-shadow 0.13s;
}
.net-card:hover { transform: translateY(-2px); border-color: var(--teal-l); box-shadow: 0 8px 22px rgba(0,0,0,0.22); }
.net-card-photo {
  height: 152px; background: var(--midnight) center/cover no-repeat;
  position: relative; flex-shrink: 0;
}
.net-card-photo .nc-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.net-card-photo .nc-count {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(10,12,16,0.78); color: #fff; font-size: 10.5px;
  padding: 2px 7px; border-radius: 20px; display: flex; gap: 8px;
}
.net-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.net-card-price { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600; color: var(--teal-l); }
.net-card-title { font-size: 12.5px; color: var(--text); font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.net-card-loc { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net-card-specs { font-size: 11px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.net-card-owner {
  display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-top: 8px;
  border-top: 1px solid var(--border); font-size: 11px; color: var(--muted);
}
.net-card-owner .nco-logo {
  width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--sand)) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 600;
}

.net-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }
.net-pager button { min-width: 88px; }
.net-pager-info { font-size: 12px; color: var(--muted); }

/* Directorio de inmobiliarias */
.net-dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.net-agency-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; transition: transform 0.13s, border-color 0.13s;
}
.net-agency-card:hover { transform: translateY(-2px); border-color: var(--purple); }
.net-agency-cover {
  height: 78px; background: linear-gradient(135deg, var(--teal-dim), var(--purple-dim)) center/cover no-repeat;
}
.net-agency-body { padding: 0 13px 13px; margin-top: -22px; }
.net-agency-logo {
  width: 46px; height: 46px; border-radius: 10px; border: 2px solid var(--card);
  background: var(--midnight) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-weight: 600; font-size: 20px; color: var(--text);
}
.net-agency-name { font-size: 13.5px; font-weight: 600; color: var(--text); margin-top: 7px; cursor: pointer; }
.net-agency-name:hover { color: var(--teal-l); }
.net-agency-tagline { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.net-agency-meta { display: flex; gap: 10px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.net-agency-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.net-agency-actions .btn, .net-agency-actions .card-link { font-size: 11.5px; }

/* Modal de perfil de inmobiliaria */
.net-profile-cover { height: 130px; margin: -22px -24px 0; background: linear-gradient(135deg, var(--teal-dim), var(--purple-dim)) center/cover no-repeat; border-radius: 18px 18px 0 0; }
.net-profile-head { display: flex; gap: 14px; align-items: flex-end; margin-top: -34px; padding: 0 2px; }
.net-profile-logo {
  width: 72px; height: 72px; border-radius: 14px; border: 3px solid var(--card);
  background: var(--midnight) center/cover no-repeat; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-weight: 600; font-size: 28px; color: var(--text);
}
.net-profile-stats { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.net-profile-stat {
  background: var(--card-h); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; text-align: center; flex: 1; min-width: 84px;
}
.net-profile-stat b { display: block; font-family: 'Playfair Display', serif; font-size: 18px; color: var(--teal-l); }
.net-profile-stat span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* Hilo de comentarios */
.net-comments { display: flex; flex-direction: column; gap: 10px; }
.net-comment { display: flex; gap: 9px; }
.net-comment-av {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--sand)) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600;
}
.net-comment-main { flex: 1; min-width: 0; }
.net-comment-hd { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.net-comment-author { font-size: 12px; font-weight: 600; color: var(--text); }
.net-comment-agency { font-size: 11px; color: var(--teal-l); }
.net-comment-time { font-size: 10.5px; color: var(--muted); margin-left: auto; }
.net-comment-body { font-size: 12.5px; color: var(--text); line-height: 1.5; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.net-comment-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 0; margin-top: 3px; }
.net-comment-del:hover { color: var(--red); }
.net-composer { display: flex; gap: 8px; margin-top: 4px; }
.net-composer textarea {
  flex: 1; background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 12.5px; resize: vertical; min-height: 40px;
}
.net-composer textarea:focus { outline: none; border-color: var(--teal-l); box-shadow: 0 0 0 3px var(--teal-dim); }

/* Feed de actividad */
.net-activity { display: flex; flex-direction: column; gap: 2px; }
.net-act-item {
  display: flex; gap: 11px; padding: 11px 4px; border-bottom: 1px solid var(--border); align-items: center;
}
.net-act-item:last-child { border-bottom: none; }
.net-act-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--card-h); border: 1px solid var(--border);
}
.net-act-thumb { width: 46px; height: 46px; border-radius: 8px; flex-shrink: 0; background: var(--midnight) center/cover no-repeat; border: 1px solid var(--border); }
.net-act-main { flex: 1; min-width: 0; }
.net-act-text { font-size: 12.5px; color: var(--text); line-height: 1.4; }
.net-act-text b { font-weight: 600; }
.net-act-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.net-act-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.net-act-item .card-link { cursor: pointer; }

.net-section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  margin: 16px 0 8px; font-weight: 600;
}
.net-section-label:first-child { margin-top: 0; }

/* ═══════════════ Orquestador / Help desk — chat panel lateral ═══════════════
   - Side panel derecho con header arriba, mensajes en el medio, composer abajo
     (estilo mensajero clásico). Toggle Cmd/Ctrl+H.
   - Composer: textarea multilínea (autogrow) + botón enviar.
     Enter envía · Shift+Enter agrega salto de línea.
   - Quick replies (chips) acceden con Cmd/Ctrl + 1..9.
*/

/* Composer: queda al pie del panel, no scrollea con los mensajes. */
.assist-composer {
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px 12px;
  background: var(--glass-bg-elev);
  border-top: 1px solid var(--border);
}

/* Bar del composer: textarea + send. Look "input box" de chat clásico. */
.assist-bar {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--input-bg, var(--card));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 8px 8px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.assist-bar:focus-within {
  border-color: var(--teal-l);
  box-shadow: 0 0 0 3px var(--teal-dim);
}
.assist-bar.sending { border-color: var(--teal); }
.assist-bar.sending .assist-bar-send { animation: assistSend 0.42s cubic-bezier(.2,.9,.3,1.1); }
@keyframes assistSend {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-22px) scale(0.78); }
  60%  { transform: translateY(-22px) scale(0.78); opacity: 0; }
  61%  { transform: translateY(8px)   scale(1.1);  opacity: 1; }
  100% { transform: translateY(0)     scale(1); }
}
.assist-bar-input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font: inherit; font-size: 13.5px; resize: none; outline: none;
  line-height: 1.5; max-height: 160px; min-height: 22px;
  padding: 4px 0; overflow-y: auto;
}
.assist-bar-input::placeholder { color: var(--dim); }
.assist-bar-send {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--teal); color: #fff; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.assist-bar-send:hover { background: var(--teal-l); }

/* Hint arriba del bar mostrando atajos de quick replies cuando hay askChips activos. */
.assist-input-hint {
  display: none; gap: 6px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted);
}
.assist-input-hint.has-replies { display: flex; }
.assist-hint-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: 999px;
}
.assist-hint-item kbd {
  font-family: inherit; font-size: 10px; font-weight: 600; color: var(--teal-l);
  background: var(--teal-dim); padding: 1px 5px; border-radius: 4px;
}

/* Side panel derecho — el chat */
.assist-side {
  position: fixed; top: 60px; right: 16px; bottom: 16px;
  width: 380px; max-width: calc(100vw - 32px); z-index: 310;
  display: flex; flex-direction: column;
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  border-radius: 16px; overflow: hidden; box-shadow: var(--glass-shadow-lg);
  backdrop-filter: blur(14px) saturate(160%);
  transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none;
  transition: transform 0.28s cubic-bezier(.2,.9,.3,1.1), opacity 0.22s ease;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.assist-side.open {
  transform: translateX(0); opacity: 1; pointer-events: auto;
}

.assist-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--glass-bg-elev);
}
.assist-title { font-size: 12.5px; font-weight: 600; color: var(--text); flex: 1; }
.assist-mode-badge {
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 10px; background: var(--pill-grey-bg); color: var(--muted);
}
.assist-mode-badge[data-mode="chat"]        { background: var(--teal-dim);   color: var(--teal-l); }
.assist-mode-badge[data-mode="plan"]        { background: var(--sand-dim);   color: var(--sand); }
.assist-mode-badge[data-mode="orchestrate"] { background: var(--purple-dim); color: var(--purple); }
.assist-head-btn {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px; border: none;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 14px;
}
.assist-head-btn:hover { background: var(--card-h); color: var(--text); }

.assist-msgs {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
}

/* Burbujas */
.assist-msg {
  font-size: 13px; line-height: 1.55; padding: 9px 12px; border-radius: 12px; max-width: 88%;
  word-wrap: break-word;
  animation: assistBubbleIn 0.28s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes assistBubbleIn {
  from { transform: translateY(10px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
.assist-msg.assist-user {
  align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px;
}
.assist-msg.assist-assistant {
  align-self: flex-start; background: var(--card-h); color: var(--text); border-bottom-left-radius: 4px;
}
.assist-msg.assist-error {
  align-self: flex-start; background: var(--red-dim); color: var(--red); border: 1px solid var(--red-dim);
}
.assist-msg strong { color: inherit; font-weight: 600; }

/* Pasos de orquestación */
.assist-step {
  align-self: flex-start; font-size: 11.5px; line-height: 1.5; color: var(--muted);
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; max-width: 92%;
}
.assist-step.done { opacity: 0.6; }
.assist-step strong { color: var(--text); }
.assist-step em { color: var(--sand); font-style: normal; }

/* Typing */
.assist-typing { display: flex; gap: 4px; padding: 12px 14px; }
.assist-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--dim);
  animation: assistBlink 1.2s infinite ease-in-out;
}
.assist-typing span:nth-child(2) { animation-delay: 0.2s; }
.assist-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes assistBlink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Ask (pregunta con chips de respuesta rápida) — el chip muestra el atajo Cmd+N */
.assist-ask { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.assist-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 4px; }
.assist-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--input-bg); border: 1px solid var(--teal-dim);
  color: var(--teal-l); font: inherit; font-size: 12px; font-weight: 500;
  padding: 5px 11px 5px 5px; border-radius: 14px; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.assist-chip-key {
  font-size: 10px; font-weight: 600; color: var(--teal-l);
  background: var(--teal-dim); padding: 2px 6px; border-radius: 8px;
  letter-spacing: 0.02em;
}
.assist-chip-label { line-height: 1.3; }
.assist-chip:hover { background: var(--teal-dim); }
.assist-chip:active { transform: scale(0.96); }
.assist-chip:disabled { opacity: 0.45; cursor: default; }
.assist-chip.picked { background: var(--teal); color: #fff; border-color: var(--teal); opacity: 1; }
.assist-chip.picked .assist-chip-key { background: rgba(255,255,255,0.22); color: #fff; }

/* Plan */
.assist-plan {
  align-self: stretch; background: var(--input-bg); border: 1px solid var(--sand-dim);
  border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.assist-plan-head { font-size: 12.5px; font-weight: 600; color: var(--sand); }
.assist-plan-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.assist-plan-steps li { display: flex; gap: 9px; font-size: 12.5px; line-height: 1.45; }
.assist-plan-n {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--sand-dim);
  color: var(--sand); font-size: 10.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.assist-plan-steps li div { display: flex; flex-direction: column; gap: 1px; }
.assist-plan-steps li span { color: var(--muted); font-size: 11.5px; }
.assist-plan-steps li strong { color: var(--text); font-weight: 600; }
.assist-plan-actions { display: flex; gap: 8px; }
.assist-plan-run, .assist-plan-skip {
  border: none; border-radius: 8px; padding: 7px 14px; font: inherit; font-size: 12px;
  font-weight: 600; cursor: pointer;
}
.assist-plan-run { background: var(--teal); color: #fff; }
.assist-plan-run:hover { background: var(--teal-l); }
.assist-plan-skip { background: var(--card-h); color: var(--muted); }
.assist-plan-skip:hover { color: var(--text); }

/* Spotlight (highlight de elementos) */
.assist-spotlight {
  position: fixed; z-index: 250; pointer-events: none;
  border-radius: 8px; border: 2px solid var(--teal-l);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), 0 0 18px rgba(70,199,186,0.5);
  transition: all 0.25s ease;
}
.assist-spotlight[hidden] { display: none; }
.assist-spot-note {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  background: var(--glass-bg-elev); border: 1px solid var(--glass-border);
  color: var(--text); font-size: 12px; line-height: 1.45; padding: 8px 12px;
  border-radius: 10px; width: max-content; max-width: 260px;
  box-shadow: var(--glass-shadow-lg); pointer-events: none;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.assist-spotlight.note-below .assist-spot-note { bottom: auto; top: calc(100% + 10px); }

/* FAB permanente del asistente: botón redondo y compacto. Solo ícono; el shortcut
   vive en el tooltip (title) y en el placeholder del input cuando se abre. */
.assist-fab {
  /* z-index 50: por encima del contenido pero por debajo de los dropdowns (75
     del user menu) y modales (100). */
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--teal-l), var(--teal));
  color: #fff; border: 1px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(42,127,127,0.42), inset 0 1px 0 rgba(255,255,255,0.30);
  transition: transform 0.16s cubic-bezier(.2,.9,.3,1.1),
              box-shadow 0.16s ease,
              opacity 0.18s ease;
  position: fixed;
}
.assist-fab::after {
  /* Halo sutil pulsante para llamar la atención sin ser invasivo. */
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid rgba(70,199,186,0.28); pointer-events: none;
  animation: assistFabPulse 2.6s ease-out infinite;
}
@keyframes assistFabPulse {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { transform: scale(1.18); opacity: 0;    }
  100% { transform: scale(1.18); opacity: 0;    }
}
.assist-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(42,127,127,0.55), inset 0 1px 0 rgba(255,255,255,0.36);
}
.assist-fab:active { transform: translateY(0); }
.assist-fab:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }
.assist-fab.hidden { opacity: 0; pointer-events: none; transform: translateY(8px) scale(0.94); }
.assist-fab-ico {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.18));
}
/* Estos quedaban del FAB con label; los neutralizamos por si algún viejo
   render todavía los inyecta. */
.assist-fab-text, .assist-fab-lbl, .assist-fab-kbd { display: none !important; }
.assist-fab-kbd > span {
  display: inline-block; min-width: 14px; padding: 1px 5px;
  background: rgba(0,0,0,0.22); border-radius: 4px;
  font-weight: 600; color: #fff;
  text-align: center;
}

@media (max-width: 699px) {
  /* Mobile: panel full-width, sube desde abajo; el composer queda al pie
     (que es donde aparece el teclado virtual). */
  .assist-side {
    top: auto; bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 78vh; border-radius: 16px 16px 0 0;
    transform: translateY(110%);
  }
  .assist-side.open { transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   Propiedades — chips de atajo rápido (Amigas / Liberándose / Recientes / Hot)
   ══════════════════════════════════════════════════════════════ */
.prop-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.prop-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.08s;
}
.prop-quick-chip:hover { background: var(--card-h); color: var(--text); border-color: var(--glass-highlight); }
.prop-quick-chip:active { transform: translateY(1px); }
.prop-quick-chip .pqc-ico   { font-size: 14px; line-height: 1; }
.prop-quick-chip .pqc-label { font-weight: 600; }
.prop-quick-chip .pqc-count {
  font-size: 10.5px;
  background: var(--pill-grey-bg);
  color: var(--text);
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  font-weight: 600;
}

/* Estados activos: cada chip toma su propio color para que la cartera "respire"
   distinto según el atajo elegido. Mantiene el badge bien visible. */
.prop-quick-chip[data-quick="friends"].active   { background: rgba(168,120,245,0.92); color: #fff; border-color: rgba(168,120,245,0.95); }
.prop-quick-chip[data-quick="releasing"].active { background: rgba(212,160,90,0.92);  color: #1a1a1a; border-color: rgba(212,160,90,0.95); }
.prop-quick-chip[data-quick="recent"].active    { background: rgba(58,173,173,0.92);  color: #fff; border-color: rgba(58,173,173,0.95); }
.prop-quick-chip[data-quick="hot"].active       { background: rgba(229,105,93,0.92);  color: #fff; border-color: rgba(229,105,93,0.95); }
.prop-quick-chip.active .pqc-count { background: rgba(0,0,0,0.22); color: inherit; }

/* Indicadores de actividad sobre la foto en la grilla (👁 / 🚶) */
.pc-activity {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
  z-index: 2;
}
.pc-act {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
  line-height: 1.2;
}
.pc-act-views  { background: rgba(15,18,22,0.62); color: rgba(255,255,255,0.94); }
.pc-act-visits { background: rgba(229,105,93,0.92); color: #fff; box-shadow: 0 2px 6px rgba(229,105,93,0.35); }

/* ══════════════════════════════════════════════════════════════
   Propiedades — toggle grilla/tabla
   ══════════════════════════════════════════════════════════════ */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--input-bg); }
.view-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 32px; padding: 0; border: none; cursor: pointer;
  background: transparent; color: var(--muted); transition: background 0.15s, color 0.15s;
}
.view-toggle-btn svg { width: 16px; height: 16px; }
.view-toggle-btn:hover { color: var(--text); background: var(--hover-tint); }
.view-toggle-btn.active { background: var(--teal-dim); color: var(--teal-l); }
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border); }
.view-toggle-btn.vt-text { width: auto; padding: 0 14px; font-size: 12px; font-family: inherit; gap: 5px; }

/* Widget "Próxima visita" */
.next-visit-card {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--teal-dim), var(--card));
  border: 1px solid var(--teal); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(42,127,127,0.18);
}
.next-visit-icon { font-size: 24px; opacity: 0.9; }
.next-visit-main { flex: 1; min-width: 0; }
.next-visit-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.next-visit-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-visit-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.next-visit-countdown {
  font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600;
  color: var(--teal-l); white-space: nowrap; padding-left: 14px; border-left: 1px solid var(--border);
}
.next-visit-countdown.soon { color: var(--sand); }
.next-visit-countdown.now  { color: var(--red); }

/* Vista del día (dentro del card de visitas) */
.day-view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.day-view-head h2 { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 600; margin: 0; }
.day-view-list { display: flex; flex-direction: column; gap: 8px; }
.day-visit {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 14px;
  background: var(--input-bg); cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.day-visit:hover { background: var(--card-h); border-color: var(--glass-highlight); }
.day-visit-time { font-family: 'Playfair Display', serif; font-size: 18px; color: var(--teal-l); font-weight: 600; min-width: 70px; }
.day-visit-body { flex: 1; min-width: 0; }
.day-visit-title { font-size: 13px; font-weight: 500; }
.day-visit-sub   { font-size: 11.5px; color: var(--muted); }
.day-visit-actions { display: flex; gap: 6px; }

/* Selector de propiedad (grilla compacta dentro de la ficha de visita) */
.prop-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.prop-picker-card {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--card); cursor: pointer; transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  display: flex; flex-direction: column;
}
.prop-picker-card:hover { border-color: var(--teal-l); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.prop-picker-card.selected { border-color: var(--teal-l); box-shadow: 0 0 0 2px var(--teal-dim); }
.prop-picker-photo { aspect-ratio: 4 / 3; background-size: cover; background-position: center; background-color: var(--midnight); pointer-events: none; }
.prop-picker-body { padding: 8px 10px; pointer-events: none; }
.prop-picker-price { font-family: 'Playfair Display', serif; font-size: 14px; color: var(--teal-l); font-weight: 600; }
.prop-picker-title { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-picker-sub   { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Form como ficha full-screen. Sin look de modal flotante: ocupa el ancho del
   contenedor del view, fondo sutil, separado por borde y no por sombra. La
   topbar queda sticky para que los botones de Guardar / Volver no se pierdan
   al scrollear formularios largos. */
.ficha-form {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  max-width: 100%;
  margin: 0;
}
.ficha-form .ficha-topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 0 14px; margin-bottom: 18px;
}
/* Tabs y paneles del form usan card-look para mantener jerarquía visual sin
   parecer modal: cada panel se ve como una "card" sin glass pesado. */
.ficha-form .prop-tab-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.ficha-form .prop-tabs { margin-bottom: 14px; }
/* Forms de ficha sin tabs (ej. editar-demanda): el form-grid directo del
   .ficha-form también recibe card-look para no quedar flotando en el vacío. */
.ficha-form > .form-grid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

/* Ficha de demanda con panel lateral de matches en vivo */
.ficha-demand-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; max-width: 1340px; margin: 0 auto; }
.ficha-demand-grid > .ficha-form { max-width: none; margin: 0; }
.demand-matches-panel { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 14px; padding: 16px 18px; position: sticky; top: 14px; max-height: calc(100vh - 60px); overflow-y: auto; box-shadow: 0 12px 36px rgba(0,0,0,0.18); }
.dmp-head { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.dmp-title { font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; }
.dmp-sub   { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.dmp-list  { display: flex; flex-direction: column; gap: 8px; }
.dmp-card  { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--input-bg); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.dmp-card:hover { border-color: var(--teal-l); background: var(--card-h); }
.dmp-thumb { width: 64px; aspect-ratio: 1; background-size: cover; background-position: center; border-radius: 6px; background-color: var(--midnight); flex-shrink: 0; }
.dmp-info  { flex: 1; min-width: 0; }
.dmp-price { font-family: 'Playfair Display', serif; font-size: 13px; color: var(--teal-l); font-weight: 600; }
.dmp-title-line { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmp-sub-line   { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 980px) { .ficha-demand-grid { grid-template-columns: 1fr; } .demand-matches-panel { position: static; max-height: none; } }

/* Propiedad ya seleccionada en la ficha (resumen + botón cambiar) */
.prop-chosen {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--teal); border-radius: 10px; padding: 12px 14px; background: var(--teal-dim);
}
.prop-chosen-photo { width: 80px; aspect-ratio: 4/3; background-size: cover; background-position: center; border-radius: 6px; background-color: var(--midnight); flex-shrink: 0; }
.prop-chosen-main  { flex: 1; min-width: 0; }
.prop-chosen-title { font-size: 13.5px; font-weight: 500; }
.prop-chosen-sub   { font-size: 11.5px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════
   Propiedades — vista grilla
   ══════════════════════════════════════════════════════════════ */
.prop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 14px;
}
.prop-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.prop-card:hover { border-color: var(--teal-l); transform: translateY(-2px); box-shadow: var(--glass-shadow); }
.prop-card-photo {
  position: relative; aspect-ratio: 4/3; background: var(--midnight) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 38px;
}
.prop-card-photo .pc-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.prop-card-photo .pc-op {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.62); color: #fff; font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; backdrop-filter: blur(4px); letter-spacing: 0.02em;
}
.prop-card-photo .pc-count {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.62); color: #fff; font-size: 10px; font-weight: 500;
  padding: 3px 8px; border-radius: 20px; backdrop-filter: blur(4px); display: flex; align-items: center; gap: 4px;
}
.prop-card-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.prop-card-price { font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; color: var(--teal-l); }
.prop-card-price .pc-noche { font-family: inherit; font-size: 11px; font-weight: 400; color: var(--muted); }
.prop-card-title { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.3; }
.prop-card-sub { font-size: 11px; color: var(--muted); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.prop-card-meta { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.prop-card-meta span { display: inline-flex; align-items: center; gap: 3px; }
.prop-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); gap: 8px;
}
.prop-card-foot .pcf-agent { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-card-foot .pcf-time  { font-size: 10px; color: var(--dim); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   Ficha de propiedad — vista completa
   ══════════════════════════════════════════════════════════════ */
.ficha { display: flex; flex-direction: column; gap: 18px; max-width: 1120px; margin: 0 auto; width: 100%; }
.ficha-flyer-host { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px 0; }
.ficha-flyer-host canvas { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; background: #0A1520; box-shadow: 0 4px 18px rgba(0,0,0,0.15); }
.ficha-flyer-formats { display: flex; gap: 6px; flex-wrap: wrap; }
.ficha-topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ficha-back {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border); color: var(--text);
  padding: 7px 13px; border-radius: 9px; font-size: 12.5px; font-family: inherit; transition: background 0.15s;
}
.ficha-back:hover { background: var(--card-h); }
.ficha-topbar .ficha-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Galería */
.ficha-gallery { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ficha-stage {
  position: relative; width: 100%; max-width: 900px; aspect-ratio: 16/10; max-height: 520px;
  background: var(--midnight); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: zoom-in;
}
.ficha-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficha-thumbs { max-width: 900px; width: 100%; }
.ficha-stage .ficha-stage-empty { color: var(--dim); font-size: 56px; }
.ficha-stage-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); transition: background 0.15s;
}
.ficha-stage-nav:hover { background: rgba(0,0,0,0.8); }
.ficha-stage-nav.prev { left: 12px; }
.ficha-stage-nav.next { right: 12px; }
.ficha-stage-count {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 20px; backdrop-filter: blur(4px);
}
.ficha-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.ficha-thumb {
  flex: 0 0 auto; width: 92px; height: 66px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: var(--midnight); padding: 0; transition: border-color 0.15s;
}
.ficha-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficha-thumb.active { border-color: var(--teal-l); }
.ficha-thumb:hover { border-color: var(--muted); }

/* Encabezado de datos */
.ficha-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; }
.ficha-head-main { flex: 1; min-width: 220px; }
.ficha-head h1 { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 600; line-height: 1.2; margin: 0 0 5px; }
.ficha-head-sub { font-size: 13px; color: var(--muted); }
.ficha-head-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.ficha-head-price { text-align: right; }
.ficha-head-price .fhp-amount { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 600; color: var(--teal-l); }
.ficha-head-price .fhp-noche { font-size: 13px; color: var(--muted); font-weight: 400; }
.ficha-head-price .fhp-exp { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ficha-head-price .fhp-age { font-size: 11px; color: var(--dim); margin-top: 4px; }

/* Cuerpo: 2 columnas */
.ficha-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.ficha-col-main, .ficha-col-side { display: flex; flex-direction: column; gap: 16px; }
.ficha-section {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
}
.ficha-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  font-weight: 600; margin-bottom: 12px;
}
.ficha-specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.ficha-spec { display: flex; flex-direction: column; gap: 2px; }
.ficha-spec .fs-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ficha-spec .fs-value { font-size: 14px; color: var(--text); font-weight: 500; }
.ficha-desc { font-size: 13px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.ficha-amenities { display: flex; flex-wrap: wrap; gap: 6px; }
.ficha-amenity {
  font-size: 11px; color: var(--text); background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 5px;
}
.ficha-map { height: 320px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.ficha-video { position: relative; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--midnight); }
.ficha-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* Sidebar: agente + asociados */
.ficha-agent { display: flex; align-items: center; gap: 11px; }
.ficha-agent-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; background: var(--card-h) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-family: 'Playfair Display', serif;
  font-size: 17px; color: var(--teal-l); border: 1px solid var(--border);
}
.ficha-agent-name { font-size: 13px; font-weight: 500; color: var(--text); }
.ficha-agent-role { font-size: 11px; color: var(--muted); }
.ficha-assoc-list { display: flex; flex-direction: column; }
.ficha-assoc-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border);
}
.ficha-assoc-item:last-child { border-bottom: none; }
.ficha-assoc-ico {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: var(--card-h); border: 1px solid var(--border);
}
.ficha-assoc-main { flex: 1; min-width: 0; }
.ficha-assoc-text { font-size: 12px; color: var(--text); line-height: 1.35; }
.ficha-assoc-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.ficha-assoc-empty { font-size: 11.5px; color: var(--dim); padding: 6px 2px; }
.ficha-stats-row { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 880px) {
  .ficha-body { grid-template-columns: 1fr; }
}

/* ─── Mini-calendar reutilizable (visitas, disponibilidad) ─── */
.mini-cal {
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 12px;
}
.mini-cal-hd {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  margin-bottom: 8px;
}
.mini-cal-hd strong { font-size: 13px; text-transform: capitalize; }
.mini-cal-nav {
  width: 24px; height: 24px; border-radius: 6px; background: var(--card-h);
  border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.mini-cal-nav:hover { background: var(--midnight); }
.mini-cal-dows {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  font-size: 10px; color: var(--muted); text-align: center; margin-bottom: 4px;
}
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini-cal-cell {
  aspect-ratio: 1; min-height: 28px; max-height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text); border-radius: 6px; position: relative;
  background: transparent; border: 1px solid transparent;
}
.mini-cal-cell.empty { background: transparent; }
.mini-cal-cell.today { border-color: var(--teal); color: var(--teal-l); font-weight: 600; }
.mini-cal-cell.has-evt { font-weight: 500; }
.mini-cal-cell.tone-teal  { background: rgba(48,179,167,0.15);  color: var(--teal-l); }
.mini-cal-cell.tone-green { background: rgba(93,214,138,0.18);  color: #5DD68A; }
.mini-cal-cell.tone-sand  { background: rgba(232,196,127,0.18); color: var(--sand); }
.mini-cal-cell.tone-red   { background: rgba(239,68,68,0.18);   color: #ff8a8a; }
.mini-cal-cell.tone-grey  { background: var(--card-h);          color: var(--muted); }
.mini-cal-dot {
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}

/* ─── Sección Visitas en ficha ─── */
.ficha-visits-grid {
  display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start;
}
@media (max-width: 760px) { .ficha-visits-grid { grid-template-columns: 1fr; } }
.ficha-visits-list { display: flex; flex-direction: column; gap: 8px; max-height: 480px; overflow-y: auto; }
.ficha-visit-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
  align-items: center;
}
.ficha-visit-card:hover { background: var(--card-h); }
.ficha-visit-when { font-size: 12px; font-weight: 500; }
.ficha-visit-when.tone-teal  { color: var(--teal-l); }
.ficha-visit-when.tone-green { color: #5DD68A; }
.ficha-visit-when.tone-red   { color: #ff8a8a; }
.ficha-visit-when.tone-grey  { color: var(--muted); }
.ficha-visit-body { font-size: 11.5px; }
.ficha-visit-status { margin-bottom: 4px; }
.ficha-visit-people { color: var(--text); }

/* ─── Disponibilidad temporario ─── */
.ficha-avail-cals { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .ficha-avail-cals { grid-template-columns: 1fr; } }
.ficha-avail-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.ficha-avail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 9px; font-size: 12px;
}
.ficha-avail-item strong { font-weight: 500; font-size: 12.5px; }

/* ─── Tarifas y servicios ─── */
.ficha-fees-sub-title {
  font-size: 11.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 8px;
}
.ficha-fees-tbl {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.ficha-fees-tbl th, .ficha-fees-tbl td {
  padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left;
}
.ficha-fees-tbl th { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.ficha-fees-tbl tr:last-child td { border-bottom: none; }


/* ═══════════════ Red Housia — cápsula de visibilidad y perfil sub-vista ═══════════════ */
.vis-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); padding: 6px 12px; border-radius: 999px;
  font: inherit; font-size: 11.5px; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.vis-pill:hover { background: var(--card-h); border-color: var(--teal-l); }
.vis-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }
.vis-pill-label strong { font-weight: 600; color: var(--text); margin-left: 2px; }

/* Sub-vista de perfil (drill-down dentro del card de Red) */
.net-profile-backbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.net-profile-backbar .btn { font-size: 12px; }
.net-profile-page {
  background: var(--card-h); border: 1px solid var(--border); border-radius: 14px;
  padding: 0 18px 20px; overflow: hidden;
}
.net-profile-cover-inline {
  height: 150px; margin: 0 -18px 0;
  background: linear-gradient(135deg, var(--teal-dim), var(--purple-dim)) center/cover no-repeat;
}
.net-profile-page .net-profile-head {
  margin-top: -36px; padding: 0 4px;
  display: flex; gap: 14px; align-items: flex-end;
}
.net-profile-page .net-profile-stats { margin: 16px 0 14px; }
@media (max-width: 600px) {
  .net-profile-page .net-profile-head { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
   Notificaciones — bell badge + drawer derecho
   ══════════════════════════════════════════════════════════════ */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; line-height: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--midnight); box-sizing: content-box; pointer-events: none;
}
.notif-badge[hidden] { display: none; }

.notif-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.32);
  backdrop-filter: blur(2px); z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.notif-backdrop.open { opacity: 1; pointer-events: auto; }

.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 92vw;
  background: var(--navy); border-left: 1px solid var(--border);
  box-shadow: -16px 0 40px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
  z-index: 100;
}
.notif-panel.open { transform: translateX(0); }
.notif-panel-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.notif-panel-title { font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; }
.notif-panel-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-panel-actions {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px; border-bottom: 1px solid var(--border);
  background: var(--card);
}
.notif-clear-wrap { display: inline-flex; align-items: center; }
.notif-clear-confirm {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card-h); border: 1px solid var(--border);
  padding: 3px 8px 3px 10px; border-radius: 999px;
  animation: notifClearFade 0.14s ease-out;
}
.notif-clear-confirm[hidden] { display: none; }
.notif-clear-q { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
@keyframes notifClearFade { from { opacity: 0; transform: translateX(4px); } to { opacity: 1; transform: none; } }
.notif-list { flex: 1; overflow-y: auto; padding: 4px 0; }

.notif-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s; position: relative;
}
.notif-item:hover { background: var(--card-h); }
.notif-item.unread { background: rgba(58,173,173,0.06); }
.notif-item.unread::before {
  content: ''; position: absolute; left: 7px; top: 18px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal-l);
}
.notif-item-ico {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--card-h); border: 1px solid var(--border);
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.35; }
.notif-item-sub { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-item-time { font-size: 10px; color: var(--dim); margin-top: 4px; }
.notif-item-actions {
  display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s;
  position: absolute; top: 10px; right: 12px;
}
.notif-item:hover .notif-item-actions { opacity: 1; }
.notif-item-actions button {
  background: rgba(0,0,0,0.45); border: 1px solid var(--border); color: var(--text);
  font-size: 10.5px; padding: 3px 7px; border-radius: 6px; cursor: pointer;
  backdrop-filter: blur(4px); transition: background 0.12s, color 0.12s;
}
.notif-item-actions button:hover { background: var(--card-h); }
.notif-item-actions button.danger:hover { color: var(--red); border-color: var(--red); }
.notif-empty { padding: 40px 24px; text-align: center; color: var(--dim); font-size: 12.5px; }

/* ═══════════════ Red Housia v2 — header compacto + stories + toggles ═══════════════ */
.net-card-main { padding-top: 16px; }
.net-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.net-header-id { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
.net-header-icon {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.net-header-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
.net-header-sub   { font-size: 11px; color: var(--muted); margin-top: 1px; }
.net-header-stats { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: center; }
.net-stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font-size: 11.5px; color: var(--muted);
}
.net-stat-pill b { font-family: 'Playfair Display', serif; font-size: 14px; color: var(--text); font-weight: 600; }
.net-stat-ico { font-size: 12px; }
.net-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.net-header-actions .btn-add { padding: 7px 14px; font-size: 12px; }
.net-header-actions .vis-pill { padding: 5px 10px; font-size: 11px; }
@media (max-width: 760px) {
  .net-header-stats { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .net-header-actions { order: 2; }
}

/* Stories bar tipo IG */
.net-stories {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 14px;
  margin-bottom: 14px; border-bottom: 1px solid var(--border);
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.net-stories::-webkit-scrollbar { height: 6px; }
.net-stories::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.net-story { flex-shrink: 0; width: 72px; text-align: center; cursor: pointer; scroll-snap-align: start; user-select: none; }
.net-story-avatar {
  position: relative; width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
  background: var(--midnight) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600; color: var(--text);
  box-shadow: 0 0 0 2px var(--card-h), 0 0 0 4px var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
}
.net-story:hover .net-story-avatar { transform: scale(1.06); box-shadow: 0 0 0 2px var(--card-h), 0 0 0 4px var(--teal-l); }
.net-story.has-new .net-story-avatar { padding: 4px; background-image: linear-gradient(135deg, var(--teal), var(--sand), var(--purple)); box-shadow: 0 0 0 2px var(--card-h); }
.net-story.has-new .net-story-inner {
  width: 100%; height: 100%; border-radius: 50%; background: var(--card-h) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: 20px; color: var(--text);
}
.net-story-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  border-radius: 10px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px; border: 2px solid var(--card);
}
.net-story-name {
  display: block; font-size: 10.5px; color: var(--muted); margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.net-story.is-discover .net-story-avatar { background: var(--card); color: var(--teal-l); font-size: 28px; }

/* Toolbar de filtros del feed: segmented controls */
.net-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.seg-toggle { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-btn {
  background: transparent; border: none; color: var(--muted);
  padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 12px;
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: linear-gradient(180deg, var(--teal-l), var(--teal));
  color: #fff; font-weight: 500;
  box-shadow: 0 4px 12px rgba(42,127,127,0.28);
}
.seg-toggle-view { margin-left: auto; }

/* Sub-tabs internos de "Mi red" */
.ops-subtabs { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.ops-subtabs .ops-tab { font-size: 12px; padding: 5px 12px; }

/* ────── Módulo "Mi Web" ────── */
.miweb-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding: 22px 24px;
}
.miweb-hero-main { display: flex; align-items: center; gap: 18px; min-width: 0; flex: 1; }
.miweb-logo {
  width: 64px; height: 64px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 600;
  color: var(--muted); flex-shrink: 0; overflow: hidden;
}
.miweb-eyebrow {
  font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--teal-l); font-weight: 600; margin-bottom: 3px;
}
.miweb-name {
  font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 600;
  letter-spacing: -0.4px; color: var(--text); margin-bottom: 4px;
}
.miweb-url code {
  background: var(--input-bg); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 6px; font-size: 11.5px;
  color: var(--teal-l); display: inline-block;
}
.miweb-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.miweb-panel { animation: fadeUp 0.18s ease; }
.miweb-save-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* Tag "Tu propiedad" / "Red" en cada card del feed */
.net-card-photo .net-card-origin {
  position: absolute; top: 8px; right: 8px;
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: rgba(10,12,16,0.78); color: #fff; backdrop-filter: blur(4px);
}
.net-card-photo .net-card-origin.own { background: rgba(42,140,132,0.92); }

/* ═══════════════════ Vista Mercado + Tasación ═══════════════════ */
/* Toolbar de filtros del top de la vista. */
.market-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 12px;
}
.market-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.market-fld { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.market-fld > span {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.market-fld select, .market-fld input {
  background: var(--input-bg); border: 1px solid var(--border); color: var(--text);
  padding: 7px 10px; border-radius: 8px; font-size: 13px; outline: none;
  transition: border-color 120ms;
}
.market-fld select:focus, .market-fld input:focus { border-color: var(--teal); }
.market-universe-note {
  font-size: 11px; color: var(--muted); margin-bottom: 10px; font-style: italic;
}

/* Fila clickeable del ranking de zonas. */
.mkt-zone-row { cursor: pointer; transition: background 80ms; }
.mkt-zone-row:hover { background: var(--hover-tint); }
.mkt-zone-row-active {
  background: var(--teal-dim) !important;
  box-shadow: inset 3px 0 0 var(--teal);
}

/* Chart de tendencia mensual: SVG full-width, alturas responsive. */
.mkt-chart-wrap { padding: 6px 4px 12px; }
.mkt-chart-hd {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--text); margin-bottom: 6px;
}
.mkt-legend { font-size: 14px; vertical-align: middle; }
.mkt-legend-offer { color: var(--teal); }
.mkt-legend-closed { color: var(--sand); }
.mkt-chart {
  width: 100%; height: 150px; display: block;
  border: 1px solid var(--border); border-radius: 8px;
  background: linear-gradient(180deg, transparent 0%, rgba(70,199,186,0.04) 100%);
}
.mkt-chart-line {
  fill: none; stroke: var(--teal); stroke-width: 1.5; vector-effect: non-scaling-stroke;
}
.mkt-chart-dot-offer { fill: var(--teal); }
.mkt-chart-dot-closed { fill: var(--sand); stroke: #fff; stroke-width: 0.4; }
.mkt-chart-x {
  display: flex; justify-content: space-between; font-size: 9.5px;
  color: var(--muted); margin-top: 4px; padding: 0 2px;
}
.mkt-chart-x span:nth-child(even) { display: none; }
@media (min-width: 700px) { .mkt-chart-x span:nth-child(even) { display: inline; } }

/* Sección título: usado para "Por superficie", "Cierres recientes", etc. */
.mkt-section-title {
  font-size: 12px; font-weight: 500; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
}

/* Distribución (rooms / surface): filas con label, valor y n. */
.mkt-dist { display: flex; flex-direction: column; gap: 6px; }
.mkt-dist-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  padding: 6px 10px; background: var(--input-bg); border-radius: 6px;
  font-size: 12.5px;
}
.mkt-dist-label { color: var(--text); }
.mkt-dist-val { color: var(--teal-l); font-weight: 500; }
.mkt-dist-n { color: var(--muted); font-size: 11px; }

/* Cierres recientes / comparables. */
.mkt-closed-list, .mkt-comps-list { display: flex; flex-direction: column; gap: 6px; }
.mkt-closed-row, .mkt-comp-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 8px 12px; background: var(--input-bg); border-radius: 7px;
  border: 1px solid transparent; transition: border-color 80ms;
}
.mkt-closed-row:hover, .mkt-comp-row:hover { border-color: var(--border); }
.mkt-closed-main, .mkt-comp-main { flex: 1 1 auto; min-width: 0; }
.mkt-closed-title, .mkt-comp-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.mkt-closed-title a, .mkt-comp-title a { color: var(--teal-l); text-decoration: none; }
.mkt-closed-title a:hover, .mkt-comp-title a:hover { text-decoration: underline; }
.mkt-closed-meta, .mkt-comp-meta {
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
.mkt-closed-price, .mkt-comp-price { text-align: right; flex-shrink: 0; }
.mkt-closed-price strong, .mkt-comp-price strong {
  font-size: 13.5px; color: var(--text); font-weight: 600;
}
.mkt-closed-sub, .mkt-comp-sub {
  font-size: 10.5px; color: var(--muted); margin-top: 2px;
}

/* Card grande con el resultado de la tasación. */
.mkt-appraise-result-card {
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 11px; padding: 16px; margin-top: 14px;
}
.mkt-appraise-header {
  display: grid; grid-template-columns: 1fr auto auto; gap: 16px;
  align-items: center; margin-bottom: 14px;
}
@media (max-width: 600px) { .mkt-appraise-header { grid-template-columns: 1fr; } }
.mkt-appraise-mid {
  font-size: 26px; font-weight: 600; letter-spacing: -0.5px;
  color: var(--text); line-height: 1.1; margin-top: 2px;
}
.mkt-appraise-mid-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.mkt-appraise-meta { text-align: right; }
.mkt-appraise-delta {
  background: var(--glass-bg); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: 7px; padding: 10px 12px; min-width: 140px;
}

/* Barra de rango visual (p25 — mediana — p75) con marker del precio actual. */
.mkt-range-bar { margin: 6px 0 4px; }
.mkt-range-track {
  position: relative; height: 10px; background: var(--card-h);
  border-radius: 5px; overflow: visible;
}
.mkt-range-fill {
  position: absolute; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--teal), var(--teal-l));
  border-radius: 5px; opacity: 0.55;
}
.mkt-range-marker {
  position: absolute; top: -4px; width: 4px; height: 18px;
  background: var(--sand); border-radius: 2px; box-shadow: 0 0 0 2px var(--bg);
  transform: translateX(-2px);
}
.mkt-range-labels {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  font-size: 11px; color: var(--muted); margin-top: 6px;
}

/* Ajustes aplicados (estado, antigüedad, etc.). */
.mkt-appraise-adj {
  margin-top: 12px; padding: 8px 12px; background: var(--card-h);
  border-radius: 7px; display: flex; flex-direction: column; gap: 4px;
}
.mkt-adj-row { display: flex; justify-content: space-between; font-size: 12px; }

/* Panel de tasación dentro de la ficha de propiedad. */
.prop-appraise-panel {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 14px;
  margin-top: 6px;
}
.prop-appraise-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; flex-wrap: wrap;
}
.prop-appraise-title {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  letter-spacing: -0.01em;
}
.prop-appraise-sub { font-size: 11px; color: var(--muted); margin-top: 3px; max-width: 60ch; }
/* ═══════════════ Editor Markdown (EasyMDE) — adapta al tema ═══════════════
   EasyMDE viene con un CSS claro fijo. Estos overrides lo integran al sistema
   de tokens del CRM para que respete dark/light y los bordes del resto de
   los inputs. Targets:
     .EasyMDEContainer  → wrapper
     .editor-toolbar    → barra de íconos
     .CodeMirror        → área de edición (CodeMirror-based)
     .editor-preview-*  → preview lateral / fullscreen
     .editor-statusbar  → barra inferior
   Usamos vars del tema (--card, --text, etc.) — funciona en dark y light. */

.EasyMDEContainer { border-radius: 10px; overflow: hidden; }

.editor-toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  padding: 6px 4px;
  opacity: 1;
}
.editor-toolbar a,
.editor-toolbar button {
  color: var(--muted) !important;
  border-radius: 6px !important;
  border: 1px solid transparent !important;
}
.editor-toolbar a:hover,
.editor-toolbar a.active,
.editor-toolbar button:hover,
.editor-toolbar button.active {
  background: var(--card-h) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.editor-toolbar i.separator {
  border-left: 1px solid var(--border);
  border-right: 1px solid transparent;
}
.editor-toolbar.disabled-for-preview a:not(.no-disable) { background: transparent; }

.EasyMDEContainer .CodeMirror {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  font-family: 'SF Mono', Consolas, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 8px 4px;
}
.EasyMDEContainer .CodeMirror-cursor { border-left-color: var(--text); }
.EasyMDEContainer .CodeMirror-selected { background: var(--teal-dim) !important; }
.EasyMDEContainer .CodeMirror-focused .CodeMirror-selected { background: var(--teal-dim) !important; }
.EasyMDEContainer .CodeMirror-line::selection,
.EasyMDEContainer .CodeMirror-line ::selection { background: var(--teal-dim) !important; }

/* Tokens de syntax highlight (CodeMirror modo markdown). */
.EasyMDEContainer .cm-header { color: var(--teal-l); font-weight: 600; }
.EasyMDEContainer .cm-strong { color: var(--text); font-weight: 700; }
.EasyMDEContainer .cm-em     { color: var(--text); font-style: italic; }
.EasyMDEContainer .cm-link,
.EasyMDEContainer .cm-url    { color: var(--sand); }
.EasyMDEContainer .cm-comment,
.EasyMDEContainer .cm-formatting { color: var(--dim); }
.EasyMDEContainer .cm-hr     { color: var(--muted); }
.EasyMDEContainer .cm-quote  { color: var(--muted); font-style: italic; }
.EasyMDEContainer .cm-variable-2,
.EasyMDEContainer .cm-keyword { color: var(--purple); }

/* Preview en side-by-side y en modo solo-preview. */
.EasyMDEContainer .editor-preview,
.EasyMDEContainer .editor-preview-side {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.EasyMDEContainer .editor-preview h1,
.EasyMDEContainer .editor-preview h2,
.EasyMDEContainer .editor-preview h3,
.EasyMDEContainer .editor-preview-side h1,
.EasyMDEContainer .editor-preview-side h2,
.EasyMDEContainer .editor-preview-side h3 { color: var(--text); border-bottom-color: var(--border); }
.EasyMDEContainer .editor-preview a,
.EasyMDEContainer .editor-preview-side a { color: var(--teal-l); }
.EasyMDEContainer .editor-preview hr,
.EasyMDEContainer .editor-preview-side hr { border-color: var(--border); }
.EasyMDEContainer .editor-preview code,
.EasyMDEContainer .editor-preview-side code {
  background: var(--input-bg); color: var(--sand);
  padding: 2px 5px; border-radius: 4px; font-size: 0.92em;
}

.editor-statusbar {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  border-top: 0;
  font-size: 10.5px;
}

/* Fullscreen del editor: por encima del FAB y del side panel, debajo de modales.
   La toolbar fullscreen vuelve a aparecer y necesita asentarse sobre el body. */
.editor-toolbar.fullscreen,
.CodeMirror-fullscreen,
.editor-preview-side {
  background: var(--midnight);
  z-index: 1050 !important;
}
.editor-toolbar.fullscreen { border-bottom: 1px solid var(--border); }

/* En el modal de contrato, el editor pisa el padding del modal-body. Devolvemos
   un poco de aire arriba para que no se pegue al label "Cuerpo del contrato". */
#contract-form .EasyMDEContainer { margin-top: 4px; }
/* ═══════════════ Vista Reservas — calendario Airbnb-style + timeline ═══════════════
   Dos vistas convivientes:
     1. Calendario mensual por propiedad (grilla 7 col, días pintados según estado).
     2. Timeline global (Gantt-like): fila por propiedad, columnas por día.
   Switch entre vistas en el toolbar. Modal de nueva reserva con date range
   picker + breakdown vivo de fees (nights × rate + cleaning + commission + extras). */

/* ── Toolbar / view switch ─────────────────────────────────────────────── */
.rsv-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.rsv-toolbar .rsv-prop-sel { min-width: 240px; }
.rsv-toolbar .rsv-spacer { flex: 1; }

.rsv-view-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden; background: var(--input-bg);
}
.rsv-view-toggle button {
  padding: 7px 14px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-right: 1px solid var(--border);
}
.rsv-view-toggle button:last-child { border-right: 0; }
.rsv-view-toggle button.active { background: var(--teal); color: #fff; }
.rsv-view-toggle button:not(.active):hover { background: var(--card-h); color: var(--text); }

/* ── Calendario mensual (vista por propiedad) ─────────────────────────── */
.rsv-cal-card { padding: 16px; }
.rsv-cal-nav {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.rsv-cal-nav .rsv-month {
  font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 600;
  min-width: 200px; text-align: center; text-transform: capitalize;
}
.rsv-cal-nav button.rsv-nav-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.rsv-cal-nav button.rsv-nav-btn:hover { background: var(--card-h); }
.rsv-cal-legend {
  display: flex; gap: 14px; flex-wrap: wrap; margin-left: auto;
  font-size: 11px; color: var(--muted);
}
.rsv-cal-legend .rsv-leg {
  display: inline-flex; align-items: center; gap: 5px;
}
.rsv-cal-legend .rsv-leg-sw {
  width: 11px; height: 11px; border-radius: 3px; border: 1px solid transparent;
}
.rsv-leg-sw.s-reserved  { background: var(--sand-dim);  border-color: var(--sand);  }
.rsv-leg-sw.s-confirmed { background: var(--green-dim); border-color: var(--green); }
.rsv-leg-sw.s-blocked   { background: var(--hover-tint); border-color: var(--muted); }

.rsv-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.rsv-cal-dayhead {
  text-align: center; font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 4px;
}

.rsv-cal-cell {
  position: relative;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  min-height: 84px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.rsv-cal-cell:hover { background: var(--card-h); }
.rsv-cal-cell.is-other  { opacity: 0.35; }
.rsv-cal-cell.is-past   { opacity: 0.6; cursor: default; }
.rsv-cal-cell.is-today  { border-color: var(--teal-l); }
.rsv-cal-cell.is-today .rsv-day-num { color: var(--teal-l); font-weight: 700; }
.rsv-cal-cell.is-selecting,
.rsv-cal-cell.is-selected     { border-color: var(--teal-l); background: var(--teal-dim); }
.rsv-cal-cell.is-range        { background: var(--teal-dim); }
.rsv-cal-cell.is-range-start  { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.rsv-cal-cell.is-range-end    { border-top-left-radius:  0; border-bottom-left-radius:  0; }
.rsv-cal-cell.is-range-mid    { border-radius: 0; }

.rsv-day-num { font-size: 12px; font-weight: 500; color: var(--text); }

/* Pill de reserva dentro de la celda (Airbnb-style) */
.rsv-pill {
  font-size: 10.5px; line-height: 1.25;
  padding: 3px 7px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border: 1px solid transparent;
  transition: filter 0.12s, transform 0.08s;
}
.rsv-pill:hover { filter: brightness(1.15); }
.rsv-pill:active { transform: scale(0.98); }
.rsv-pill.s-reserved  { background: var(--sand-dim);  color: var(--sand);  border-color: rgba(211,176,116,0.35); }
.rsv-pill.s-confirmed { background: var(--green-dim); color: var(--green); border-color: rgba(63,185,80,0.35); }
.rsv-pill.s-blocked   { background: var(--hover-tint); color: var(--muted); border-color: var(--border); }
.rsv-pill.s-cancelled { background: var(--hover-tint); color: var(--dim); text-decoration: line-through; }

.rsv-cal-empty {
  padding: 60px 18px; text-align: center; color: var(--muted);
  font-size: 13px;
}
.rsv-cal-empty strong { color: var(--text); font-weight: 600; }

/* ── Timeline global (Gantt) ──────────────────────────────────────────── */
.rsv-tl-wrap {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  /* Scroll horizontal en el contenedor; el header sticky usa position:sticky
     contra este overflow. */
  position: relative;
}
.rsv-tl-scroll { overflow-x: auto; overflow-y: visible; }
.rsv-tl {
  /* La grilla tiene una columna fija para "Propiedad" + N columnas auto
     (una por día). JS calcula y aplica grid-template-columns inline.
     position:relative para que las barras absolute (creadas en JS) se
     posicionen respecto a la grilla y no al wrap externo. */
  position: relative;
  display: grid;
  min-width: 100%;
}
.rsv-tl-corner,
.rsv-tl-prop {
  background: var(--card);
  border-right: 1px solid var(--border);
  position: sticky; left: 0; z-index: 2;
}
.rsv-tl-corner {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em;
  z-index: 3;
}
.rsv-tl-prop {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.rsv-tl-prop .rsv-tl-prop-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rsv-tl-prop .rsv-tl-prop-sub {
  font-size: 10.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rsv-tl-header {
  padding: 8px 0; text-align: center; font-size: 10.5px;
  color: var(--muted); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--card);
}
.rsv-tl-header.is-weekend { background: var(--hover-tint); }
.rsv-tl-header .rsv-tl-h-day { font-size: 13px; font-weight: 600; color: var(--text); }
.rsv-tl-header.is-today .rsv-tl-h-day { color: var(--teal-l); }
.rsv-tl-cell {
  border-bottom: 1px solid var(--border);
  border-right: 1px dashed transparent;
  min-height: 44px; position: relative;
}
.rsv-tl-cell.is-weekend { background: var(--hover-tint); }
.rsv-tl-cell.is-today   { background: var(--teal-dim); }

/* Bar dentro del timeline (booking que ocupa N días) */
.rsv-tl-bar {
  position: absolute; top: 6px; bottom: 6px;
  border-radius: 6px;
  display: flex; align-items: center; padding: 0 8px;
  font-size: 11px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; z-index: 1;
  border: 1px solid transparent;
  transition: filter 0.12s, transform 0.08s;
}
.rsv-tl-bar:hover { filter: brightness(1.18); z-index: 2; }
.rsv-tl-bar.s-reserved  { background: var(--sand-dim);  color: var(--sand);  border-color: rgba(211,176,116,0.45); }
.rsv-tl-bar.s-confirmed { background: var(--green-dim); color: var(--green); border-color: rgba(63,185,80,0.45); }
.rsv-tl-bar.s-blocked   { background: var(--hover-tint); color: var(--muted); border-color: var(--border); }
.rsv-tl-bar.s-cancelled { background: var(--hover-tint); color: var(--dim);  text-decoration: line-through; }

/* ── Modal de reserva con breakdown vivo ──────────────────────────────── */
.rsv-modal { max-width: 720px; }
.rsv-modal-body {
  display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: flex-start;
}
@media (max-width: 760px) {
  .rsv-modal-body { grid-template-columns: 1fr; }
}
.rsv-form-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.rsv-form-section + .rsv-form-section { margin-top: 10px; }
.rsv-form-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 8px;
}

/* Breakdown card (sidebar derecha del modal) */
.rsv-breakdown {
  position: sticky; top: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.rsv-bd-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 4px;
}
.rsv-bd-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px;
}
.rsv-bd-row .rsv-bd-lbl   { color: var(--text); }
.rsv-bd-row .rsv-bd-sub   { color: var(--muted); font-size: 11px; }
.rsv-bd-row .rsv-bd-val   { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }
.rsv-bd-row .rsv-bd-val.bd-secondary { color: var(--muted); font-size: 11px; font-weight: 400; }
.rsv-bd-sep { height: 1px; background: var(--border); margin: 4px 0; }
.rsv-bd-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border);
  font-family: 'Playfair Display', serif;
}
.rsv-bd-total .rsv-bd-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
.rsv-bd-total .rsv-bd-val { font-size: 18px; font-weight: 700; color: var(--teal-l); font-variant-numeric: tabular-nums; }
.rsv-bd-total .rsv-bd-alt { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.rsv-bd-deposit {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: var(--sand-dim); color: var(--sand);
  font-size: 11.5px; line-height: 1.5;
}
.rsv-bd-empty {
  padding: 30px 8px; text-align: center; color: var(--muted); font-size: 12px;
}

.rsv-extra-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.rsv-extra-row:last-child { border-bottom: 0; }
.rsv-extra-row input[type="checkbox"] { width: 14px; height: 14px; }
.rsv-extra-row .rsv-extra-lbl   { flex: 1; font-size: 12.5px; }
.rsv-extra-row .rsv-extra-sub   { font-size: 10.5px; color: var(--muted); }
.rsv-extra-row .rsv-extra-price { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Form de fees en ficha de propiedad ──────────────────────────────── */
.rsv-fees-table { width: 100%; border-collapse: collapse; }
.rsv-fees-table th,
.rsv-fees-table td { padding: 8px 6px; font-size: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.rsv-fees-table th { color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }
.rsv-fees-table input,
.rsv-fees-table select {
  width: 100%; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 7px; color: var(--text); font: inherit; font-size: 12px;
}
.rsv-fees-table .rsv-fees-del {
  background: transparent; border: 0; color: var(--red); cursor: pointer;
  font-size: 14px; padding: 4px 6px;
}
.rsv-fees-empty { padding: 14px; color: var(--muted); font-size: 12px; text-align: center; }
/* ── Vista Búsqueda global (resultados del buscador del topbar) ── */

.search-results { display: flex; flex-direction: column; gap: 18px; }

.search-loading,
.search-empty {
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.search-group { border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; }
.search-group-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--card-h, var(--card));
  border-bottom: 1px solid var(--border);
}
.search-group-title { font-weight: 600; font-size: 13px; color: var(--text); }
.search-group-count {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--input-bg, var(--card)); color: var(--muted);
  border: 1px solid var(--border);
}

.search-group-items { list-style: none; margin: 0; padding: 0; }
.search-group-items li + li { border-top: 1px solid var(--border); }

.search-item {
  display: block; padding: 10px 14px;
  text-decoration: none; color: var(--text);
  transition: background 0.12s;
}
.search-item:hover { background: var(--card-h, rgba(127,127,127,0.06)); }
.search-item-title { font-size: 13px; font-weight: 500; }
.search-item-sub   { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
/* Wise-style picker: chips con avatar (foto o iniciales) + nombre, buscador
   con autocomplete remoto. Reemplaza <select> en asociaciones (broker, cliente,
   propiedad, etc.). Single y multi-select. Usa los tokens del 00-base.css. */

.wp-root {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 38px;
}

/* Zona de chips seleccionados + input inline */
.wp-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  cursor: text;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.wp-control:focus-within {
  border-color: var(--accent, #7c5cff);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .15);
}
.wp-control[data-disabled="1"] {
  opacity: .55;
  pointer-events: none;
}

/* Chip de cada item seleccionado (multi) o el único (single) */
.wp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  background: var(--chip-bg, rgba(124, 92, 255, .08));
  border: 1px solid var(--chip-border, rgba(124, 92, 255, .25));
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text);
  max-width: 100%;
}
.wp-chip .wp-avatar { width: 22px; height: 22px; font-size: 10px; }
.wp-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.wp-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.wp-chip-remove:hover { background: rgba(0, 0, 0, .08); color: var(--text); }
html[data-theme="dark"] .wp-chip-remove:hover { background: rgba(255, 255, 255, .08); }

/* Input de búsqueda inline */
.wp-input {
  flex: 1;
  min-width: 80px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  padding: 4px 2px;
}
.wp-input::placeholder { color: var(--muted); }

/* Botón clear (single, cuando hay valor y no se busca) */
.wp-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
}
.wp-clear:hover { color: var(--text); }

/* Dropdown de resultados */
.wp-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  z-index: 1000;
  background: var(--card-bg, var(--input-bg));
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.wp-dropdown[data-open="1"] { display: block; }

.wp-empty, .wp-loading {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

/* Grid de opciones — estilo Wise: avatar grande + nombre debajo */
.wp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 4px;
  padding: 8px;
}
.wp-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  text-align: center;
  transition: background-color .1s ease, border-color .1s ease;
}
.wp-grid-item:hover,
.wp-grid-item[data-active="1"] {
  background: var(--hover-bg, rgba(124, 92, 255, .08));
  border-color: var(--chip-border, rgba(124, 92, 255, .25));
}
.wp-grid-item[data-selected="1"] {
  background: var(--chip-bg, rgba(124, 92, 255, .12));
  border-color: var(--accent, #7c5cff);
}

.wp-grid-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
  max-width: 100%;
  word-break: break-word;
  /* Limitar a 2 líneas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wp-grid-sublabel {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Avatar: foto circular o iniciales con color por hash */
.wp-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: .5px;
}
.wp-avatar[data-photo="1"] { background-color: #ddd; color: transparent; }

/* Variante cuadrada para propiedades (más fiel a "miniatura") */
.wp-avatar[data-shape="square"] {
  border-radius: 8px;
  font-size: 11px;
  letter-spacing: 0;
}

/* Mobile: dropdown ocupa más ancho */
@media (max-width: 699px) {
  .wp-grid { grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)); }
  .wp-avatar { width: 40px; height: 40px; }
}
