/* ── Tokens de marca — styleguide v3.1 Javier Toro ── */
[x-cloak] { display: none !important; }

:root {
  --crema:       #F2EDE4;
  --off-white:   #FAF7F2;
  --negro:       #1C1A18;
  --oliva:       #5A6049;
  --petroleo:    #2D4A4F;
  --salvia:      #9CA889;
  --nogal:       #5C4A3A;
  --dorado:      #9C7E4F;
  --display:     'Playfair Display', Georgia, serif;
  --body:        'Inter', system-ui, sans-serif;
  --radius:      4px;
  --gap:         1.5rem;
  --rojo:        #c0392b;  /* error / sin verificar */

  /* ── Tokens de tema (claro por defecto). El modo oscuro los redefine abajo. ── */
  --bg:            #FAF7F2;           /* fondo de página */
  --surface:       #fff;             /* tarjetas, tablas, sidebar, barras */
  --surface-2:     #F2EDE4;          /* hover de filas, placeholders, hero */
  --surface-hover: #F2EDE4;          /* hover de filas/nav */
  --text:          #1C1A18;          /* texto principal */
  --text-muted:    #6f6a62;          /* texto secundario */
  --border:        #e8e3da;          /* borde estándar */
  --border-soft:   #f0ece4;          /* borde sutil */
  --input-bg:      #FAF7F2;          /* fondo de inputs */
  --input-border:  #ddd8cf;          /* borde de inputs */
  --shadow:        rgba(28,26,24,0.06);
  /* Alias de marca (apuntan a tokens para que el modo oscuro los herede) */
  --linea:       var(--border);      /* borde estándar */
  --linea-soft:  var(--border-soft); /* borde sutil entre filas */
  --aviso-bg:    #fdf7ee;            /* fondo aviso/dorado suave */
  --crema:       #F2EDE4;
  --off-white:   #FAF7F2;
  --negro:       #1C1A18;
}

/* ── Modo oscuro: paleta cálida estilo Notion Calendar ── */
[data-theme="dark"] {
  --bg:            #191919;
  --surface:       #202020;
  --surface-2:     #2a2a2a;
  --surface-hover: #2c2c2c;
  --text:          #e9e6e1;
  --text-muted:    #9b958c;
  --border:        #343331;
  --border-soft:   #2b2a28;
  --input-bg:      #262625;
  --input-border:  #3a3937;
  --shadow:        rgba(0,0,0,0.35);
  /* Alias de marca usados por nombre en plantillas/CSS antiguos */
  --linea:         #343331;
  --linea-soft:    #2b2a28;
  --crema:         #2a2a2a;
  --off-white:     #191919;
  --aviso-bg:      #2e2a20;
  color-scheme: dark;
}

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

html { font-size: 16px; }

body {
  font-family: var(--body);
  font-weight: 300;
  background: var(--off-white);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

/* ── Sidebar (barra vertical izquierda) ── */
.sidebar {
  width: 190px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.wordmark {
  font-family: var(--body);
  font-weight: 300;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  padding: 0 0.4rem;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.side-nav a {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text);
  text-decoration: none;
  opacity: 0.7;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.15s, background 0.15s;
}

.side-nav a:hover { opacity: 1; background: var(--surface-2); }
.side-nav a.active { opacity: 1; background: var(--surface-2); font-weight: 500; }

/* El botón "+" para añadir: solo el símbolo, en un recuadro, el primero de la lista */
.side-nav a.side-add {
  width: 40px;
  height: 40px;
  justify-content: center;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.85;
  border: 1px solid var(--input-border);
  margin-bottom: 0.5rem;
}
.side-nav a.side-add:hover,
.side-nav a.side-add.active {
  background: var(--dorado);
  color: #fff;
  border-color: var(--dorado);
  opacity: 1;
}

.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.72rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}
.side-user { opacity: 0.6; line-height: 1.4; }

/* ── Layout ── */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.footer {
  padding: 1rem 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row;
    flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 0; border-top: none; padding-top: 0; flex-direction: row; align-items: center; }
}

.wordmark-sm {
  font-family: var(--body);
  font-weight: 300;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.4;
}

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat { display: flex; flex-direction: column; gap: 0.15rem; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
}

.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.5;
}

/* ── Filters ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filters input,
.filters select {
  font-family: var(--body);
  font-size: 0.8rem;
  font-weight: 300;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--off-white);
  color: var(--text);
  outline: none;
}

.filters input:focus,
.filters select:focus {
  border-color: var(--dorado);
}

.filters input[type="search"] { min-width: 200px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--negro);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn:hover { background: var(--negro); color: #fff; }

.btn-primary {
  background: var(--negro);
  color: #fff;
  border-color: var(--text);
}

.btn-primary:hover { background: var(--oliva); border-color: var(--oliva); }

.btn-sm {
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
}

.btn-danger { border-color: #c0392b; color: #c0392b; }
.btn-danger:hover { background: #c0392b; color: #fff; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

thead th {
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.55;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border-soft); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td {
  padding: 0.75rem 0.9rem;
  color: var(--text);
  vertical-align: middle;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.badge-disponible { color: var(--oliva); }
.badge-reservado  { color: var(--dorado); }
.badge-vendido    { color: #999; }
.badge-borrador   { color: #bbb; }
.badge-activo     { color: var(--petroleo); }
.badge-pendiente  { color: var(--dorado); background: var(--aviso-bg); }

/* ── Property detail ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--gap);
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card + .card { margin-top: var(--gap); }

.card-title {
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--linea);
}

.section-title {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.45;
  margin-bottom: 1rem;
}

/* ── Form fields ── */
.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.5;
  margin-bottom: 0.3rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--body);
  font-size: 0.85rem;
  font-weight: 300;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--off-white);
  color: var(--text);
  outline: none;
}

.field textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--dorado);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
}

/* ── Hero image ── */
.hero-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  background: var(--surface-2);
}

.hero-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface-2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.3;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

/* ── Photo gallery ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item .photo-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(28, 26, 24, 0.7);
  display: none;
  gap: 0.3rem;
  padding: 0.3rem;
  justify-content: center;
}

.gallery-item:hover .photo-actions { display: flex; }

/* ── Selección múltiple de fotos ── */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.25rem;
  background: var(--surface-2, #f3efe8);
  border: 1px solid var(--input-border, #e0d8cc);
  border-radius: var(--radius);
  font-size: 0.8rem;
}
.gallery-toolbar .sel-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.gallery-toolbar .sel-count {
  color: var(--nogal, #5C4A3A);
  font-weight: 500;
}
.gallery-item .sel-check {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  background: rgba(28, 26, 24, 0.55);
  border-radius: 4px;
  cursor: pointer;
}
.gallery-item .sel-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--dorado, #9c7e4f);
}
.gallery-item.is-selected {
  outline: 3px solid var(--dorado, #9c7e4f);
  outline-offset: -3px;
}

.gallery-item.is-portada::after {
  content: "PORTADA";
  position: absolute;
  top: 0.35rem;
  left: 2rem;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  background: var(--negro);
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

/* ── Drag-sort de fotos ── */
.gallery-item .pos-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  font-size: 0.6rem;
  font-weight: 500;
  min-width: 1.1rem;
  text-align: center;
  background: rgba(28, 26, 24, 0.65);
  color: #fff;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
  pointer-events: none;
}
.gallery-item.is-portada .pos-badge {
  background: var(--dorado, #9c7e4f);
}
.gallery-item.dragging {
  opacity: 0.35;
  outline: 2px dashed var(--dorado, #9c7e4f);
  outline-offset: -2px;
}
.gallery.sorting {
  opacity: 0.6;
  pointer-events: none;
}
.gallery-item .extra-tag {
  position: absolute;
  bottom: 0.2rem;
  left: 0.2rem;
  font-size: 0.55rem;
  background: rgba(28, 26, 24, 0.55);
  color: #fff;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
}

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--input-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--dorado);
  background: var(--aviso-bg);
}

.upload-zone p {
  font-size: 0.82rem;
  color: var(--text);
  opacity: 0.6;
  margin-top: 0.5rem;
}

/* ── Ingest page ── */
.ingest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

@media (max-width: 800px) {
  .ingest-grid { grid-template-columns: 1fr; }
  .detail-grid  { grid-template-columns: 1fr; }
}

/* ── Toast / alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.alert-success { background: #edf7f0; border: 1px solid #b7e1c4; color: var(--oliva); }
.alert-error   { background: #fdf2f2; border: 1px solid #f5c6c6; color: #c0392b; }
.alert-warn    { background: var(--aviso-bg); border: 1px solid #f0d8a8; color: var(--nogal); }

/* ── Progress/spinner ── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Page title ── */
.page-title {
  font-family: var(--display);
  font-size: 1.6rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.page-sub {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.5;
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
}

/* ── Divider dorado ── */
.divider {
  width: 40px;
  height: 1px;
  background: var(--dorado);
  margin: 1.25rem 0;
}

/* ── Zona pendiente warning ── */
.zona-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dorado);
  background: var(--aviso-bg);
  border: 1px solid #f0d8a8;
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}

/* ── Action row ── */
.action-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ════════════════════════════════════════════════════════════
   CAPA DE UTILIDADES — única fuente de verdad visual.
   Sustituye los style="..." inline repetidos de las plantillas.
   No introduce colores nuevos: usa las variables de :root.
   ════════════════════════════════════════════════════════════ */

/* Numéricas: alineadas a la derecha y con cifras tabulares para que no "bailen" */
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }

/* Tabla inventario */
.thumb-col  { width: 56px; }
.thumb-cell { padding: 0.3rem 0.4rem; }
.row-unverified { opacity: 0.75; }

/* Texto */
.text-xs   { font-size: 0.7rem; }
.text-sm   { font-size: 0.75rem; }
.text-md   { font-size: 0.8rem; }
.muted     { opacity: 0.6; }
.muted-2   { opacity: 0.45; }
.muted-3   { opacity: 0.35; }
.nowrap    { white-space: nowrap; }
.danger    { color: var(--rojo); }
.warn      { color: var(--dorado, #9c7e4f); }
.italic-empty { font-style: italic; opacity: 0.4; }

/* Layout helpers */
.row        { display: flex; align-items: center; gap: 0.4rem; }
.row-between{ display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.col        { display: flex; flex-direction: column; }
.gap-sm     { gap: 0.5rem; }
.mt-sm      { margin-top: 0.5rem; }
.mt-md      { margin-top: 0.75rem; }
.mb-gap     { margin-bottom: var(--gap); }
.list-meta  { margin-top: 0.75rem; font-size: 0.75rem; opacity: 0.45; }

/* Precio destacado (Inter, tabular — antes Playfair inline) */
.price-lg {
  font-family: var(--body);
  font-weight: 500;
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* Miniatura de portada (tabla inventario / previsualización) */
.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--linea);
  display: block;
}
.thumb-ph {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  opacity: 0.4;
}
.thumb-sm {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--linea);
}

/* Badges sólidos */
.badge-on {
  font-size: 0.55rem;
  margin-left: 0.2rem;
  background: var(--dorado);
  color: #fff;
  border-color: var(--dorado);
}
.badge-danger {
  background: var(--rojo);
  color: #fff;
  border-color: var(--rojo);
  font-size: 0.55rem;
}
.badge-verif-bad { background: var(--rojo); color: #fff; border-color: var(--rojo); margin-left: 0.5rem; }
.badge-verif-ok  { background: var(--oliva); color: #fff; border-color: var(--oliva); margin-left: 0.5rem; }

/* Card de precio (cabecera de listing_detail) */
.card-price { margin-bottom: var(--gap); }

/* Fila divisoria sutil (sustituye border-bottom:1px solid var(--border-soft) inline) */
.divide-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--linea-soft);
}

/* ── Toast / notificaciones de error (patrón único para fallos de fetch) ── */
.toast-host {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
  max-width: min(380px, calc(100vw - 2.5rem));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.4;
  background: var(--surface);
  border: 1px solid var(--linea);
  box-shadow: 0 6px 24px rgba(28, 26, 24, 0.12);
  animation: toast-in 0.18s ease-out;
}
.toast-error   { border-left: 3px solid var(--rojo); }
.toast-success { border-left: 3px solid var(--oliva); }
.toast-warn    { border-left: 3px solid var(--dorado); }
.toast-icon { font-size: 0.95rem; line-height: 1.2; }
.toast-msg  { flex: 1; }
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.4;
  padding: 0;
  line-height: 1;
}
.toast-close:hover { opacity: 0.9; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Botones de icono (drag/orden) ── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.65rem;
  line-height: 1;
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--negro); color: #fff; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

/* Controles de orden por teclado (alternativa al drag) */
.order-ctrls {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  display: none;
  gap: 0.2rem;
  z-index: 2;
}
.gallery-item:hover .order-ctrls,
.gallery-item:focus-within .order-ctrls { display: flex; }

/* ─── Tablero kanban de clientes (estilo Pipedrive) ─────────────────────── */
.kanban-board {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 250px;
  background: var(--surface-2);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  border-top: 3px solid var(--dorado);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px);
}
/* Un acento de color por etapa, dentro de la paleta de marca */
.kanban-col:nth-child(1) { border-top-color: var(--salvia); }
.kanban-col:nth-child(2) { border-top-color: var(--petroleo); }
.kanban-col:nth-child(3) { border-top-color: var(--oliva); }
.kanban-col:nth-child(4) { border-top-color: var(--dorado); }
.kanban-col:nth-child(5) { border-top-color: var(--nogal); }

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--linea);
}
.kanban-col-title {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}
.kanban-col-count {
  font-size: 0.7rem;
  background: var(--negro);
  color: #fff;
  border-radius: 10px;
  padding: 0.05rem 0.5rem;
  min-width: 1.4rem;
  text-align: center;
}
.kanban-col-body {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  min-height: 70px;
  flex: 1;
}
.kanban-col-body.drop-target {
  background: var(--aviso-bg);
  outline: 2px dashed var(--dorado);
  outline-offset: -5px;
}
.kanban-card {
  background: var(--off-white);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.kanban-card:hover { border-color: var(--dorado); }
.kanban-card.dragging { opacity: 0.45; cursor: grabbing; }
.kanban-card-name { font-weight: 600; font-size: 0.84rem; margin-bottom: 0.3rem; }
.kanban-card-name a { color: var(--text); text-decoration: none; }
.kanban-card-name a:hover { color: var(--dorado); }
.kanban-card-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.25rem; }
.kanban-card-sub { font-size: 0.72rem; color: var(--nogal); opacity: 0.75; }
.badge-soft {
  font-size: 0.66rem;
  background: var(--linea-soft);
  border: 1px solid var(--linea);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  color: var(--text);
}

/* ─── Buscador de clientes con autocompletado ───────────────────────────── */
.typeahead { position: relative; }
.typeahead-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  margin-top: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  max-height: 300px;
  overflow-y: auto;
}
.typeahead-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.82rem;
  border-bottom: 1px solid var(--linea-soft);
}
.typeahead-item:hover { background: var(--surface-2); }
.typeahead-sub { color: var(--nogal); opacity: 0.65; font-size: 0.72rem; white-space: nowrap; }
.typeahead-empty { padding: 0.5rem 0.6rem; font-size: 0.78rem; color: var(--nogal); opacity: 0.6; }

/* Pie de la tarjeta kanban: contacto a la izquierda, presupuesto (tipo "deal value") a la derecha */
.kanban-card-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.kanban-card-budget {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--dorado);
  white-space: nowrap;
}

/* "Marcar como colaborador": el <summary> se ve como un botón (sin triángulo) */
.colab-action { display: inline-block; }
.colab-action summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
}
.colab-action summary::-webkit-details-marker { display: none; }
.colab-action summary::marker { content: ""; }
.colab-action[open] { display: block; }

/* ─── Carpetas de captación dentro de lead-in (Instagram / Portales) ─────── */
.kanban-col-folders { gap: 0.7rem; }
.kanban-folder {
  background: var(--surface-2);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  overflow: hidden;
}
.kanban-folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--linea-soft);
}
.kanban-folder-head::-webkit-details-marker { display: none; }
.kanban-folder-head::marker { content: ""; }
.kanban-folder-title::before { content: "📁 "; }
.kanban-folder[open] .kanban-folder-title::before { content: "📂 "; }
.kanban-folder-count {
  background: var(--surface);
  border: 1px solid var(--linea);
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.68rem;
  min-width: 1.4rem;
  text-align: center;
}
.kanban-folder-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  min-height: 36px;
}
.kanban-folder-empty {
  font-size: 0.72rem;
  color: var(--nogal);
  opacity: 0.55;
  margin: 0.15rem 0.1rem;
}

/* "Archivar lead": el summary se ve como botón rojo (sin triángulo) */
.archivar-action summary { display: inline-block; }
.archivar-action[open] summary { margin-bottom: 0.2rem; }

/* ─── Teambot: leads archivados (seguimiento en frío) ───────────────────── */
.teambot {
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  background: var(--off-white);
  padding: 0.75rem 1rem 1rem;
}
.teambot-head {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.teambot-count {
  background: var(--linea-soft);
  border: 1px solid var(--linea);
  border-radius: 999px;
  padding: 0 0.5rem;
  font-size: 0.72rem;
}
.teambot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.6rem;
}
.teambot-card {
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.55rem 0.65rem;
}
.teambot-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.teambot-name { font-weight: 600; font-size: 0.82rem; color: var(--text); text-decoration: none; }
.teambot-name:hover { color: var(--dorado); }
.teambot-meta { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem; }
.teambot-motivo {
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: var(--nogal);
  border-top: 1px dashed var(--linea);
  padding-top: 0.3rem;
}

/* ─── Privacidad de leads: pool sin asignar / dueño ─────────────────────── */
.badge-pool {
  font-size: 0.64rem;
  background: var(--aviso-bg);
  border: 1px solid var(--dorado);
  color: var(--nogal);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  font-weight: 600;
}
.badge-owner {
  font-size: 0.64rem;
  background: var(--linea-soft);
  border: 1px solid var(--linea);
  color: var(--text);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
}
.kanban-card.is-pool { border-left: 3px solid var(--dorado); }

/* Salud del lead (antigüedad sin próxima acción, estilo Pipedrive). */
.kanban-card.health-amber { border-left: 3px solid #d6a52e; }
.kanban-card.health-red   { border-left: 3px solid var(--rojo); }
.kanban-card-next {
  display: flex; align-items: center; gap: 0.35rem;
  margin-top: 0.4rem; font-size: 0.68rem; color: var(--nogal);
}
.next-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.next-neutral { background: var(--salvia); }
.next-amber   { background: #d6a52e; }
.next-red     { background: var(--rojo); }
.next-none    { color: var(--rojo); opacity: 0.85; }
.next-date    { opacity: 0.8; }

/* Salud en la ficha del lead */
.health-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--linea);
}
.health-pill.health-amber { border-color: #d6a52e; color: #8a6a16; background: #fdf7ea; }
.health-pill.health-red   { border-color: var(--rojo); color: var(--rojo); background: #fbeeec; }

/* Modal genérico (próxima acción al mover de etapa). */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(28, 26, 24, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  background: var(--off-white); border: 1px solid var(--linea);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  width: 100%; max-width: 360px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}
.modal-title { font-family: var(--display); font-size: 1.1rem; margin-bottom: 0.5rem; }

/* Barra sobre la tabla de listings: recuento + acción "Verificar todos". */
.list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem;
}
.list-toolbar .verify-all-form { margin-left: auto; }
/* Botones master (Aprobar todo / Denegar todo) en la cabecera de la columna de acciones. */
.bulk-actions { display: flex; flex-direction: column; gap: 0.3rem; }
.bulk-actions form { margin: 0; }
.bulk-actions .btn { white-space: nowrap; }
/* Paginación bajo la tabla. */
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; margin-top: 1rem;
}

/* Pop-up flotante de características en los filtros. */
.features-modal {
  max-width: 720px; display: flex; flex-direction: column; max-height: 80vh;
}
.features-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.features-modal-head .modal-title { margin-bottom: 0; }
.features-modal-body {
  overflow-y: auto; column-width: 200px; column-gap: 1.5rem; padding-right: 0.25rem;
}
.features-modal-foot {
  margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--linea);
  display: flex; justify-content: flex-end;
}

/* Línea de tiempo de actividad en la ficha. */
.activity-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.activity-item {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.5rem 0.6rem; border: 1px solid var(--linea); border-radius: var(--radius);
  background: var(--off-white);
}
.activity-item.pending { border-left: 3px solid #d6a52e; }
.activity-item.overdue { border-left: 3px solid var(--rojo); }
.activity-when { font-size: 0.72rem; color: var(--nogal); opacity: 0.8; white-space: nowrap; }
.activity-body { flex: 1; font-size: 0.82rem; }
.activity-meta { font-size: 0.68rem; color: var(--nogal); opacity: 0.7; }

/* Chips de cualificación (temperatura) + etiquetas del lead (Fase C). */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.74rem; padding: 0.2rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--linea); background: var(--off-white);
  cursor: pointer; user-select: none;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:hover { border-color: var(--dorado); }
.chip-on, .chip:has(input:checked) {
  border-color: var(--dorado); background: var(--aviso-bg); font-weight: 600;
}
/* Temperatura: cada chip seleccionado se ilumina con su propio color. */
.chip-temp-caliente.chip-on, .chip-temp-caliente:has(input:checked) {
  border-color: #e8702a; background: rgba(232,112,42,0.16); color: #b8480f;
}
.chip-temp-templado.chip-on, .chip-temp-templado:has(input:checked) {
  border-color: #d6a52e; background: rgba(214,165,46,0.18); color: #8a6a12;
}
.chip-temp-frio.chip-on, .chip-temp-frio:has(input:checked) {
  border-color: #3b82c4; background: rgba(59,130,196,0.16); color: #1f5d96;
}
.chip-temp-time_waster.chip-on, .chip-temp-time_waster:has(input:checked) {
  border-color: #c0392b; background: rgba(192,57,43,0.14); color: #962b20;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 999px;
  background: rgba(156, 126, 79, 0.1); border: 1px solid var(--linea);
}
.tag-x {
  border: none; background: none; cursor: pointer; font-size: 0.7rem;
  color: var(--nogal); opacity: 0.6; padding: 0; line-height: 1;
}
.tag-x:hover { opacity: 1; color: var(--rojo); }
.save-ok { color: var(--oliva); }

/* "Enviar a cliente" desde la ficha de la propiedad (Fase D). */
.send-to { position: relative; }
.send-to > summary { list-style: none; cursor: pointer; }
.send-to > summary::-webkit-details-marker { display: none; }
.send-to-panel {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 40;
  width: 280px; background: var(--off-white); border: 1px solid var(--linea);
  border-radius: var(--radius); padding: 0.75rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

/* Búsqueda unificada de clientes. */
#ai-search-results:not([hidden]) {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
}
.ai-result {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border: 1px solid var(--linea); border-radius: var(--radius);
  background: var(--off-white); text-decoration: none; color: var(--text);
}
.ai-result:hover { border-color: var(--dorado); }
.ai-result.health-amber { border-left: 3px solid #d6a52e; }
.ai-result.health-red   { border-left: 3px solid var(--rojo); }

.kanban-claim { margin-top: 0.45rem; }
.btn-xs {
  font-size: 0.66rem;
  padding: 0.15rem 0.5rem;
  line-height: 1.4;
}

/* ─── Pool Gallery ──────────────────────────────────────────────────────────── */
/* Columna Lead Pool: header clickable con hover sutil */
.kanban-col-pool .kanban-col-head { user-select: none; }
.kanban-col-pool .kanban-col-head:hover { background: var(--aviso-bg, #fffbeb); border-radius: var(--radius); }

/* Carpetas de la galería (Instagram / Portales) */
.pool-folder { border: 1px solid var(--linea, #e5e5e5); border-radius: var(--radius); overflow: hidden; }
.pool-folder-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 1rem; background: var(--off-white, #f9f9f9);
  cursor: pointer; list-style: none; font-weight: 600; font-size: 0.85rem;
}
.pool-folder-head::-webkit-details-marker { display: none; }
.pool-folder-count {
  font-size: 0.72rem; font-weight: 700;
  background: var(--primary, #2563eb); color: #fff;
  border-radius: 999px; padding: 0.1rem 0.55rem;
}
.pool-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  padding: 1rem;
}

.pool-card {
  background: var(--off-white);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  transition: border-color 0.15s;
}
.pool-card:hover { border-color: var(--dorado); }
.pool-card-head { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.pool-flag { font-size: 1.1rem; flex-shrink: 0; }
.pool-contact-row {
  font-size: 0.78rem; color: var(--primary, #2563eb);
  text-decoration: none; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pool-contact-row:hover { text-decoration: underline; }
.pool-card-inquiry {
  font-size: 0.75rem; color: var(--muted, #888);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pool-card-canal {
  font-size: 0.68rem; color: var(--muted, #888);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Ordenación de columnas (tablas de listings) ── */
th.th-sortable { position: relative; }
.sort-btn {
  background: none; border: none; cursor: pointer; padding: 0 0 0 0.3rem;
  color: inherit; opacity: 0.45; vertical-align: middle; line-height: 1;
  display: inline-flex; align-items: center; gap: 0.15rem;
}
.sort-btn:hover { opacity: 1; }
th.sort-active .sort-btn { opacity: 1; color: var(--petroleo); }
.sort-btn svg { width: 12px; height: 12px; display: block; }
.sort-indicator { font-size: 0.7rem; }
.sort-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 0.2rem); z-index: 50;
  background: var(--off-white); border: 1px solid var(--linea); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); padding: 0.25rem; min-width: 160px;
}
.sort-menu.open { display: block; }
.sort-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  cursor: pointer; padding: 0.45rem 0.6rem; font-size: 0.78rem; color: var(--text);
  border-radius: 3px; text-transform: none; letter-spacing: 0;
}
.sort-menu button:hover { background: var(--surface-2); }

/* ── Enlaces de referencia/proyecto (azul de marca, adaptado al tema) ── */
:root { --link: #1a3a5c; }
[data-theme="dark"] { --link: #8ab4e8; }
a.lnk { color: var(--link); font-weight: 500; text-decoration: none; }
a.lnk:hover { text-decoration: underline; }

/* ── Ajustes finos del modo oscuro para chips/estados de fondo claro ── */
[data-theme="dark"] .alert-success { background:#1c2a22; border-color:#2f5740; }
[data-theme="dark"] .alert-warn    { background:#2e2a20; border-color:#5a4a28; }
[data-theme="dark"] .alert-error,
[data-theme="dark"] .alert-danger  { background:#2c1d1d; }
[data-theme="dark"] .health-pill.health-amber { background:#2e2a20; color:#d6a52e; }
[data-theme="dark"] .health-pill.health-red   { background:#2c1d1d; }
[data-theme="dark"] .kanban-col-pool .kanban-col-head:hover { background:#2e2a20; }
[data-theme="dark"] img.thumb,
[data-theme="dark"] .hero-img { filter: brightness(0.92); }

/* Sol/luna del conmutador de tema en Ajustes */
.theme-switch {
  display:inline-flex; align-items:center; gap:0.9rem; cursor:pointer;
  padding:1rem 1.4rem; border:1px solid var(--border); border-radius:12px;
  background:var(--surface); transition:background .15s,border-color .15s;
}
.theme-switch:hover { border-color: var(--dorado); }
.theme-switch .ts-icon { font-size:1.6rem; line-height:1; }
.theme-switch .ts-label { font-size:0.9rem; font-weight:500; color:var(--text); }
.theme-switch .ts-sub { font-size:0.75rem; color:var(--text-muted); }

/* ── Botones en modo oscuro (invertidos: claro sobre fondo oscuro) ── */
[data-theme="dark"] .btn { border-color:#4a4945; color:var(--text); }
[data-theme="dark"] .btn:hover { background:var(--text); color:#191919; }
[data-theme="dark"] .btn-primary { background:var(--text); color:#191919; border-color:var(--text); }
[data-theme="dark"] .btn-primary:hover { background:var(--salvia); border-color:var(--salvia); color:#191919; }

/* ── Celda editable de municipio en la lista de listings ── */
.muni-edit { display: inline-flex; align-items: center; gap: 0.25rem; }
.muni-input {
  width: 110px; font-family: var(--body); font-size: 0.8rem; font-weight: 300;
  padding: 0.25rem 0.45rem; border: 1px solid var(--input-border);
  border-radius: var(--radius); background: var(--input-bg); color: var(--text); outline: none;
}
.muni-input:focus { border-color: var(--dorado); }
.muni-ok {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex-shrink: 0; cursor: pointer; line-height: 1;
  border: 1px solid var(--oliva); border-radius: var(--radius);
  background: transparent; color: var(--oliva); font-size: 0.85rem;
}
.muni-ok:hover { background: var(--oliva); color: #fff; }

/* ─── Matching Properties (sugerencias de inventario para un lead) ─────────── */
.match-row {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--text); font-size: 0.8rem; min-width: 0;
}
.match-thumb {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 6px;
  object-fit: cover; border: 1px solid var(--linea);
}
.match-thumb-ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-muted); font-size: 0.85rem;
}
.match-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ── Aviso "falta descripción" en la columna Anuncio ── */
.badge-warn {
  background: #f9d65c; color: #6b4e00; border-color: #e0b020;
  font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.badge-warn:hover { background: #f5c623; color: #4a3600; }

/* ─── Registro de notas (log cronológico del lead) ────────────────────────── */
.note-log-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.6rem; flex-wrap: wrap;
}
.note-log-controls { display: flex; align-items: center; gap: 0.35rem; }
.note-log-size {
  font-size: 0.72rem; padding: 0.1rem 0.3rem; border-radius: var(--radius);
  border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text);
}
.note-log-list { display: flex; flex-direction: column; gap: 0.5rem; }
.note-log-item {
  padding: 0.5rem 0.65rem; border: 1px solid var(--linea);
  border-radius: var(--radius); background: var(--surface-2);
}
.note-log-when {
  font-size: 0.68rem; color: var(--text-muted); margin-bottom: 0.2rem;
  letter-spacing: 0.02em;
}
.note-log-text { font-size: 0.82rem; color: var(--text); line-height: 1.4; }

/* ─── Comparación de duplicados (pestaña flotante lado a lado) ──────────────── */
.compare-modal {
  max-width: 880px; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.85rem;
}
.compare-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.compare-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.compare-col { min-width: 0; }
.compare-tag {
  display: inline-block; font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.12rem 0.45rem; border-radius: 999px; color: #fff;
}
.compare-tag.tag-new { background: #9c7e4f; }
.compare-tag.tag-old { background: #5c6b73; }
.compare-photos {
  display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.5rem;
}
.compare-photos img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--linea);
}
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.compare-table td, .compare-table th { padding: 0.32rem 0.5rem; }
.compare-table .compare-key {
  text-align: center; font-weight: 500; color: var(--muted, #8a8276);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  width: 30%; white-space: nowrap;
}
.compare-table .compare-val { text-align: center; width: 35%; }
.compare-table tr.diff { background: rgba(192, 57, 43, 0.07); }
.compare-table tr.diff .compare-val { color: #b03a2e; font-weight: 500; }
.compare-table tr.same .compare-val { color: #2e7d46; }
.compare-table tr + tr { border-top: 1px solid var(--linea); }
.compare-desc .desc-box {
  max-height: 130px; overflow-y: auto; background: var(--crema, #faf7f1);
  border: 1px solid var(--linea); border-radius: 6px; padding: 0.5rem;
  line-height: 1.4; white-space: pre-wrap;
}
.compare-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end;
  border-top: 1px solid var(--linea); padding-top: 0.85rem;
}
.btn-merge { background: #2e7d46; border-color: #2e7d46; color: #fff; }
.btn-merge:hover { background: #256237; }
.btn-keep-separate { background: #c0392b; border-color: #c0392b; color: #fff; }
.btn-keep-separate:hover { background: #a93226; }

/* Botón "Agrupar como mismo desarrollo" en la comparación de duplicados */
.btn-group { background: #2f5d8a; border-color: #2f5d8a; color: #fff; }
.btn-group:hover { background: #264c70; }

/* ─── Cola de procesamiento: fila "procesando" resaltada en vivo ─────────────── */
.row-proc {
  animation: rowProcPulse 1.6s ease-in-out infinite;
}
@keyframes rowProcPulse {
  0%, 100% { background: rgba(156, 126, 79, 0.06); }
  50%      { background: rgba(156, 126, 79, 0.15); }
}

/* ── Botón flotante de feedback (mejorar esta pantalla) ───────────────────── */
.fb-fab {
  position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 9000;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--nogal); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
  transition: transform .12s ease, background .15s ease;
}
.fb-fab:hover { background: var(--oliva); transform: translateY(-2px) scale(1.04); }
.fb-fab:active { transform: scale(.96); }
.fb-fab svg { width: 24px; height: 24px; }

.fb-modal {
  position: fixed; inset: 0; z-index: 9001;
  background: rgba(20,18,16,0.38);
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 1.4rem;
}
.fb-modal[hidden] { display: none; }
.fb-card {
  width: 380px; max-width: calc(100vw - 2rem); max-height: 80vh; overflow: auto;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
  display: flex; flex-direction: column;
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem; border-bottom: 1px solid var(--border-soft);
  font-weight: 500;
}
.fb-close {
  background: none; border: none; font-size: 1.3rem; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 0 .2rem;
}
.fb-close:hover { color: var(--text); }
.fb-body { padding: 1rem; }
.fb-hint { font-size: .78rem; color: var(--text-muted); margin: 0 0 .6rem; }
.fb-card textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--input-border); border-radius: var(--radius);
  padding: .55rem .6rem; font: inherit; font-size: .85rem;
}
.fb-foot {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .75rem 1rem; border-top: 1px solid var(--border-soft);
}
.fb-result { margin-top: .9rem; font-size: .82rem; }
.fb-result[hidden] { display: none; }
.fb-badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .12rem .5rem; border-radius: 999px; margin-bottom: .5rem;
}
.fb-badge.si      { background: #e7f3ea; color: #1f7a3d; }
.fb-badge.parcial { background: #fdf3e2; color: #9c6a16; }
.fb-badge.no      { background: #fbe9e7; color: #b3372a; }
[data-theme="dark"] .fb-badge.si      { background: #15301f; color: #6cc187; }
[data-theme="dark"] .fb-badge.parcial { background: #322611; color: #d6a85a; }
[data-theme="dark"] .fb-badge.no      { background: #341c19; color: #e08b80; }
.fb-result ul { margin: .4rem 0 .2rem; padding-left: 1.1rem; }
.fb-result li { margin: .2rem 0; }
.fb-result .fb-notas { color: var(--text-muted); margin-top: .5rem; font-size: .78rem; }
.fb-result .fb-saved { color: var(--text-muted); margin-top: .6rem; font-size: .72rem; }
.fb-spin { font-size: .82rem; color: var(--text-muted); }
.fb-actions { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; }
.fb-prompt-zone { margin-top: .8rem; }
.fb-prompt-zone[hidden] { display: none; }
.fb-prompt-head { font-size: .76rem; font-weight: 500; color: var(--text-muted); margin-bottom: .35rem; }
.fb-prompt-text {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem; line-height: 1.4; padding: .6rem; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2, #faf8f4); color: var(--text);
}
[data-theme="dark"] .fb-prompt-text { background: #15161a; }
.fb-copy-ok { font-size: .74rem; color: #1f7a3d; }
[data-theme="dark"] .fb-copy-ok { color: #6cc187; }
