/* ROVI MiniApp — Design System "Luminous Ether"
   (docs/MINIAPP_DESIGN_SYSTEM.md)
   Primary   #00D9FF (cian — SOLO acento/relleno en claro)
   Ink       #0E7490 (texto interactivo en claro; = primary en oscuro)
   Fondo     #F8FAFC claro / #0B1426 navy oscuro
   Regla §2: nunca #00D9FF como texto en tema claro. */

/* ============ Luminous Ether — tokens ============ */
:root {
  color-scheme: light;
  /* fondo y superficies */
  --bg: #f8fafc;
  --bg-soft: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  /* texto */
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  /* marca */
  --primary: #00d9ff;          /* SOLO relleno/acento en claro */
  --primary-ink: #0e7490;      /* texto/enlaces interactivos (5.12:1) */
  --primary-contrast: #003640; /* texto sobre cian (7.72:1) */
  --primary-soft: rgba(0, 217, 255, 0.12);
  --primary-container: #e0f7ff;
  /* semánticos */
  --success: #047857;
  --success-soft: #d1fae5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  /* alias legacy (no romper vistas existentes) */
  --secondary: var(--success);
  --secondary-soft: var(--success-soft);
  --accent: var(--warn);
  --accent-soft: var(--warn-soft);
  /* bordes y glass */
  --border: rgba(15, 23, 42, 0.08);
  --outline: #cbd5e1;
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.35);
  /* halos de fondo */
  --halo-1: rgba(0, 217, 255, 0.08);
  --halo-2: rgba(139, 92, 246, 0.05);
  /* geometría y efectos */
  --radius: 20px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --radius-full: 999px;
  --shadow: 0 8px 32px rgba(0, 217, 255, 0.05);
  --glow: 0 8px 24px rgba(0, 217, 255, 0.4);
  --blur-card: 20px;
  --blur-bar: 24px;
  --tab-h: 64px;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b1426;
  --bg-soft: #131c33;
  --surface: #141d33;
  --surface-2: #1e2740;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --faint: #64748b;
  --primary: #00d9ff;
  --primary-ink: #00d9ff;      /* en oscuro cian SÍ es texto válido (9.9:1) */
  --primary-contrast: #062e38;
  --primary-soft: rgba(0, 217, 255, 0.14);
  --primary-container: rgba(0, 217, 255, 0.18);
  --success: #6ee7b7;
  --success-soft: rgba(16, 185, 129, 0.16);
  --warn: #fcd34d;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --danger: #fca5a5;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --border: rgba(148, 163, 184, 0.14);
  --outline: rgba(148, 163, 184, 0.28);
  --glass-bg: rgba(20, 29, 51, 0.62);
  --glass-border: rgba(120, 144, 180, 0.2);
  --halo-1: rgba(0, 217, 255, 0.1);
  --halo-2: rgba(99, 102, 241, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --glow: 0 8px 28px rgba(0, 217, 255, 0.35);
}

/* ============ Base + halos radiales ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 100% 0%, var(--halo-1), transparent 420px),
    radial-gradient(circle at 0% 100%, var(--halo-2), transparent 420px);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  margin: 0 auto;
}

/* ============ Iconos Material Symbols (decorativos, §6.2) ============ */
.msi {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  display: inline-block;
  line-height: 1;
  letter-spacing: normal;
  white-space: nowrap;
  vertical-align: -4px;
  user-select: none;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.msi.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.msi.sm { font-size: 16px; vertical-align: -3px; }
/* Acento: en claro va con tinta accesible; en oscuro --primary-ink = cian */
.msi.accent { color: var(--primary-ink); }

/* ============ Top bar (glass) ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--glass-border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 0.06em; font-size: 16px; }
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft), 0 0 14px rgba(0, 217, 255, 0.55);
}
.topbar-user { text-align: right; font-size: 12px; color: var(--muted); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user b { display: block; color: var(--text); font-size: 13px; font-weight: 700; }

/* ============ Layout ============ */
.view {
  flex: 1;
  padding: 14px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
}
.screen-title { margin: 4px 0 12px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.screen-sub { color: var(--muted); margin: -8px 0 14px; font-size: 13px; }
.section { margin: 18px 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.section-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ============ Glass card (con fallback @supports) ============ */
.glass-card,
.card,
.stat {
  background: var(--surface);              /* fallback sólido */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card,
  .card,
  .stat {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    -webkit-backdrop-filter: blur(var(--blur-card)) saturate(180%);
    backdrop-filter: blur(var(--blur-card)) saturate(180%);
  }
}
.card { padding: 14px; margin-bottom: 10px; }
.card.tappable { cursor: pointer; transition: transform 0.08s ease; }
.card.tappable:active { transform: scale(0.985); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-head strong { font-size: 15px; font-weight: 700; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.card .meta { color: var(--faint); font-size: 12px; margin-top: 4px; }

/* ============ Hero card (gradiente cian→navy) ============ */
.hero-card {
  background: linear-gradient(135deg, #00b8d9 0%, #0e7490 38%, #0b1426 115%);
  color: #fff;
  border: 0;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: '';
  position: absolute;
  top: -42px;
  right: -42px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(0, 217, 255, 0.3);
  filter: blur(38px);
  pointer-events: none;
}
.hero-card .eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.82); margin: 0 0 6px; }
.hero-card h3 { margin: 0 0 4px; font-size: 18px; }
.hero-card p { color: rgba(255, 255, 255, 0.85); }
.hero-card .actions button { color: #fff; }
.hero-card .btn-ghost { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.32); }

/* ============ Glass metric cards (§5.1) ============ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat { padding: 12px; min-height: 44px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.stat-ic {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--primary-container);
  color: var(--primary-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  vertical-align: middle;
}
.stat b { display: block; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; word-break: break-word; }
.stat b.metric-num { font-size: 18px; }
.stat > .msi { display: block; margin-bottom: 6px; }
.stat small { color: var(--muted); font-size: 11px; font-weight: 600; }

.metric-num { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric-num.brand { color: var(--primary-ink); }
.link, .text-primary { color: var(--primary-ink); font-weight: 700; }

/* ============ Tags / badges ============ */
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.tag.st-nuevo { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.tag.st-contactado { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.st-calificacion { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.st-presentacion { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tag.st-apartado { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tag.st-venta { background: var(--success); color: var(--surface); border-color: transparent; }
.tag.st-perdido { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.pr-alta, .tag.pr-urgente, .tag.overdue { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.pr-media { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.pr-baja { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tag.ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ============ Chips de filtro ============ */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 4px 14px rgba(0, 217, 255, 0.25);
}

/* ============ Barra de progreso de etapa (§5.6) ============ */
.progress { height: 8px; border-radius: var(--radius-full); background: var(--primary-soft); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.6s ease; }
.progress-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.progress-row .count { color: var(--muted); }

/* ============ Botones / inputs ============ */
button { font-family: inherit; }
.btn {
  border: 0;
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 11px 16px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  background: var(--bg-soft);
  transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 4px 14px rgba(0, 217, 255, 0.25); }
.btn-secondary { background: var(--primary-soft); color: var(--primary-ink); }
.btn-accent { background: var(--warn-soft); color: var(--warn); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; border: 1px solid var(--outline); color: var(--muted); }
.btn-block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn { flex: 1; min-width: 120px; }

.input, textarea.input, select.input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--glass-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row .input { flex: 1; }

/* ============ FAB (§5.7) ============ */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  z-index: 45;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 18px;            /* cuadrado redondeado del mockup */
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: var(--glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.fab:active { transform: scale(0.9); }
.fab.fab-pill { width: auto; padding: 0 20px; border-radius: var(--radius-full); font-size: 15px; font-weight: 800; gap: 6px; }
/* Oculto mientras hay un sheet abierto (WebViews sin :has lo dejan bajo el backdrop) */
body:has(.sheet-backdrop) .fab { opacity: 0; pointer-events: none; }

/* ============ Estados ============ */
.empty {
  color: var(--muted);
  padding: 26px 16px;
  text-align: center;
  border: 1px dashed var(--outline);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}
.empty .btn { margin-top: 12px; }
.error-block {
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  font-weight: 600;
}
.error-block .btn { margin-top: 10px; background: var(--surface); color: var(--text); }
.notice {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--surface-2) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
.sk-card { height: 86px; margin-bottom: 10px; }
.sk-line { height: 16px; margin-bottom: 8px; }
.sk-line.short { width: 55%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.boot-loading { padding-top: 16px; }

/* ============ Tab bar (glass, §5.8) ============ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  max-width: 680px;
  margin: 0 auto;
  min-height: var(--tab-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-top: 1px solid var(--glass-border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar,
  .tabbar {
    -webkit-backdrop-filter: blur(var(--blur-bar)) saturate(160%);
    backdrop-filter: blur(var(--blur-bar)) saturate(160%);
  }
}
.tabbar button {
  flex: 1;
  min-height: 48px;
  min-width: 44px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.active { color: var(--primary-ink); background: var(--primary-soft); }
[data-theme='dark'] .tabbar button.active svg { filter: drop-shadow(0 0 6px rgba(0, 217, 255, 0.55)); }

/* ============ Bottom sheet (superficie sólida a propósito) ============ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 8, 20, 0.5);
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.18s ease;
}
.sheet {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 86dvh;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
}
.sheet-handle { width: 42px; height: 5px; border-radius: var(--radius-full); background: var(--outline); margin: 4px auto 12px; }
.sheet-title { margin: 0 0 12px; font-size: 17px; font-weight: 800; }
.sheet .option-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 8px;
  text-align: left;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } }

/* ============ Chat ============ */
.chat-wrap { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tab-h) - 140px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--primary-contrast);
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(0, 217, 255, 0.2);
}
.bubble.agent {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
  box-shadow: var(--shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bubble.agent {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    -webkit-backdrop-filter: blur(var(--blur-card)) saturate(180%);
    backdrop-filter: blur(var(--blur-card)) saturate(180%);
  }
}
.bubble.error { align-self: flex-start; background: var(--danger-soft); color: var(--danger); }
.bubble .chips { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-input-row {
  position: sticky;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 8px 0;
}
.chat-input-row .input { flex: 1; }

/* ============ Action cards (pending_confirmation) ============ */
.action-card { border-left: 4px solid var(--warn); }
.action-card .preview { white-space: pre-wrap; font-size: 13px; color: var(--text); margin-top: 6px; }
.action-card .resolved { font-weight: 800; margin-top: 8px; }
.action-card .resolved.ok { color: var(--success); }
.action-card .resolved.bad { color: var(--danger); }

/* ============ Filas de tarea (§5.4, mockup oscuro) ============ */
.task-row { display: flex; align-items: flex-start; gap: 6px; padding: 10px 14px 10px 6px; }
.task-check {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}
.task-check::before {
  content: '';
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--outline);
  display: block;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.task-check:disabled::before {
  background: var(--primary) center / 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23003640' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  border-color: var(--primary);
}
.task-body { flex: 1; min-width: 0; padding-top: 11px; }
.task-body strong { font-size: 14px; font-weight: 600; display: block; }
.task-body p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.task-row .tag { margin-top: 13px; }
.task-row.done .task-body strong { text-decoration: line-through; opacity: 0.6; }

/* ============ Misc ============ */
.list { display: grid; gap: 10px; }
.list .card { margin-bottom: 0; }
.day-group h3 {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tarjeta de lead del pipeline (§5.3) */
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 10px; }
.lead-grid small {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lead-grid span { font-size: 14px; font-weight: 700; word-break: break-word; }
.lead-grid .metric-num { font-size: 15px; }
.lead-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
}
.lead-foot .meta { margin: 0; }
.lead-foot .btn { min-width: 0; flex: 0 0 auto; }

/* Property card (§5.2) */
.card.prop-card { padding: 0; overflow: hidden; }
.prop-body { padding: 14px; }
.prop-media { position: relative; }
.prop-media .prop-cover { display: block; width: 100%; height: 170px; object-fit: cover; margin: 0; border-radius: 0; background: var(--bg-soft); }
.prop-grad {
  position: absolute;
  inset: auto 0 0 0;
  height: 86px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
  pointer-events: none;
}
.prop-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.prop-sku {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 2px 8px;
  border-radius: 6px;
}
.prop-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prop-title-row strong { font-size: 17px; font-weight: 700; line-height: 1.2; }
.prop-loc { display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; margin-top: 4px; }
.prop-price { text-align: right; flex: 0 0 auto; }
.prop-price .metric-num { font-size: 18px; display: block; }
.prop-price small {
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.prop-specs {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 600;
}
.prop-specs > span { display: inline-flex; align-items: center; gap: 5px; }
.prop-cover { width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--bg-soft); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 10px; }
.field-grid div small { display: block; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.field-grid div span { font-size: 14px; font-weight: 600; word-break: break-word; }
.draft-box {
  margin-top: 12px;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--primary-ink) 45%, transparent);
  background: var(--primary-soft);
  white-space: pre-wrap;
  font-size: 14px;
}
.rank-row { display: flex; align-items: center; gap: 12px; }
.rank-num {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  background: var(--bg-soft);
  color: var(--muted);
}
.rank-row.top .rank-num { background: var(--warn-soft); color: var(--warn); }
.rank-info { flex: 1; min-width: 0; }
.rank-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-info small { color: var(--muted); }
.rank-points { font-weight: 900; color: var(--primary-ink); white-space: nowrap; }

.onboard { text-align: center; padding: 36px 10px; }
.onboard h2 { font-size: 20px; font-weight: 800; }
.onboard ol { text-align: left; color: var(--muted); line-height: 1.7; padding-left: 22px; }
.onboard-dot {
  width: 56px;
  height: 56px;
  margin: 6px auto 18px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 12px var(--primary-soft), var(--glow);
}
.onboard .code-pill {
  display: inline-block;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin: 10px 0;
}

/* ============ Toasts (invertidos) ============ */
#toastRoot {
  position: fixed;
  bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  max-width: 86%;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-error { background: var(--danger); color: var(--bg); }
.toast.toast-success { background: var(--success); color: var(--bg); }
