/* Shared components: glass, buttons, pill, chips, cards, detail, sheets, empty, toast, headers.
   Colours come from tokens.css only. Motion is off under prefers-reduced-motion. */

/* Glass: floating controls only */
.lv-glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-card), var(--glass-inset);
}

/* Buttons */
.lv-btn {
  height: var(--h-btn); padding: 0 18px; border-radius: var(--r-btn);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14.5px; font-weight: 600; white-space: nowrap; transition: background var(--t-fast), transform var(--t-fast);
}
.lv-btn:active { transform: scale(.97); }
.lv-btn[disabled], .lv-btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.lv-btn-primary { background: var(--blue); color: var(--on-blue); box-shadow: var(--shadow-primary), inset 0 1px 0 var(--on-blue-soft); }
.lv-btn-primary:hover { background: var(--blue-hover); }
.lv-btn-glass { background: var(--glass-bg-soft); border: 1px solid var(--glass-line-strong); color: var(--blue); }
.lv-btn-outline { background: var(--bg); border: 1px solid var(--line-2); color: var(--ink); }
.lv-btn-outline:hover { border-color: var(--blue); }
.lv-btn-quiet { color: var(--grey); }
.lv-btn-quiet:hover { color: var(--ink); }
.lv-btn-sm { height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13px; }
.lv-btn-icon { width: var(--h-btn); padding: 0; flex-shrink: 0; }
.lv-btn-sm.lv-btn-icon { width: 36px; }
.lv-btn-block { width: 100%; }
.lv-disc { width: 52px; height: 52px; border-radius: 26px; background: var(--blue); color: var(--on-blue); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: var(--shadow-primary); }
.lv-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--blue); color: var(--on-blue); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* Avatar and pill */
.lv-avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 1.5px solid var(--bg); background: var(--avatar-bg); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: .02em; }
.lv-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.lv-pill { height: 44px; padding: 4px 14px 4px 4px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 9px; max-width: 62%; }
.lv-pill-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-pill .lv-icon { color: var(--faint); flex-shrink: 0; }

/* Segmented pills (scope Mías / Inmobiliaria / Mercado, tabs) */
.lv-pills { display: inline-flex; padding: 4px; border-radius: var(--r-pill-lg); gap: 2px; }
.lv-pills-opt { height: 40px; padding: 0 16px; border-radius: 20px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.lv-pills-opt.is-on { background: var(--blue); color: var(--on-blue); }
.lv-pills-count { font-size: 12px; opacity: .75; }

/* Chips: 28px tall; descriptive chips stay neutral */
.lv-chip { height: var(--h-chip); padding: 0 11px; border-radius: var(--r-chip); display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--ink-2); }
.lv-chip.tone-blue { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.lv-chip.tone-green { background: var(--green-wash); border-color: transparent; color: var(--green); }
.lv-chip.tone-amber { background: var(--amber-wash); border-color: transparent; color: var(--amber); }
.lv-chip.tone-muted { background: var(--bg-4); border-color: var(--line); color: var(--grey); }
.lv-chip-photo { -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-color: var(--glass-chip-line); background: var(--glass-bg); color: var(--ink); font-weight: 700; }
.lv-chip-photo.tone-blue { background: var(--blue-glass); color: var(--on-blue); }
.lv-chip-photo.tone-green { background: var(--green-glass); color: var(--on-blue); }
.lv-chip-filter { background: var(--bg); border-color: var(--line-2); color: var(--ink); }
.lv-chip-filter .lv-icon { color: var(--grey); }
.lv-chip-add { background: transparent; border: 1px dashed var(--line-2); color: var(--blue); }
.lv-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.lv-dot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; background: var(--faint); }
.lv-dot.tone-blue { background: var(--blue); }
.lv-dot.tone-green { background: var(--green); }
.lv-dot.tone-amber { background: var(--amber); }
.lv-dot.tone-muted { background: var(--line-2); }
.lv-notice { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 14px; font-size: 13.5px; background: var(--bg-3); color: var(--ink-2); }
.lv-notice.tone-amber { background: var(--attn-bg); color: var(--attn); }

/* Cards */
.lv-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .lv-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .lv-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lv-card { border-radius: var(--r-card); padding: 6px; background: var(--glass-bg); border: 1px solid var(--glass-line); box-shadow: var(--shadow-card), var(--glass-inset); animation: lvCardIn .26s ease-out; min-width: 0; }
.lv-card.is-unavailable { opacity: .6; }
.lv-cover { position: relative; display: block; width: 100%; border-radius: var(--r-cover); overflow: hidden; aspect-ratio: 4 / 3; background: var(--line-2); color: var(--on-photo); }
.lv-cover img { width: 100%; height: 100%; object-fit: cover; }
.lv-nophoto { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; color: var(--faint); font-size: var(--fs-meta); background: var(--bg-4); }
.lv-shade { position: absolute; inset: 0; background: var(--shade); pointer-events: none; }
.lv-cover-chips { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.lv-cover-text { position: absolute; left: 14px; right: 14px; bottom: 12px; color: var(--on-photo); }
.lv-price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lv-price { font-size: var(--fs-price); font-weight: 700; letter-spacing: -.02em; }
.lv-exp { font-size: 12px; opacity: .85; }
.lv-addr { font-size: 14.5px; font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-meta-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lv-cover .lv-meta { color: inherit; opacity: .85; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-card-actions { display: flex; gap: 8px; padding: 8px 4px 4px; align-items: center; }
.lv-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 6px; font-size: 13.5px; color: var(--ink-2); }

/* Detail */
.lv-detail { display: flex; flex-direction: column; }
.lv-detail-media { position: relative; }
.lv-detail-back { position: absolute; top: 12px; left: 12px; }
.lv-gallery { position: relative; border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--line-2); }
.lv-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.lv-track::-webkit-scrollbar { display: none; }
.lv-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.lv-slide img { width: 100%; height: 100%; object-fit: cover; }
.lv-counter { position: absolute; right: 14px; bottom: 12px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--counter-bg); color: var(--on-photo); font-size: 11.5px; font-weight: 600; display: flex; align-items: center; }
.lv-detail-data { padding: 18px 4px 0; }
.lv-detail-price { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lv-detail-price strong { font-size: var(--fs-title); font-weight: 700; letter-spacing: -.025em; }
.lv-detail-price span { font-size: 13px; color: var(--grey); }
.lv-detail-title { font-size: 17px; font-weight: 600; margin-top: 4px; }
.lv-detail-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; font-size: 14px; color: var(--grey); }
.lv-detail-meta code { font-family: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--faint); }
.lv-detail-actions { display: flex; gap: 8px; align-items: center; padding-top: 16px; }
.lv-detail .lv-notice { margin-top: 10px; }
.lv-facts { border-radius: 24px; padding: 4px 16px; }
.lv-fact { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hairline-soft); font-size: 14.5px; }
.lv-fact:last-child { border-bottom: 0; }
.lv-fact dt { color: var(--grey); }
.lv-fact dd { font-weight: 600; text-align: right; }
.lv-desc { font-size: 15px; line-height: 1.55; color: var(--ink-2); white-space: pre-line; text-wrap: pretty; }

/* Sheets: bottom on mobile, centred dialog on desktop */
.lv-sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.lv-sheet-scrim { position: absolute; inset: 0; background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: lvFade .2s ease-out; }
.lv-sheet-panel { position: relative; width: 100%; max-width: var(--w-buyer); max-height: 88dvh; display: flex; flex-direction: column; border-radius: var(--r-sheet) var(--r-sheet) 0 0; background: var(--glass-bg-strong); box-shadow: var(--shadow-float); padding: 8px 0 calc(16px + env(safe-area-inset-bottom)); animation: lvSheetUp .32s var(--ease-pop); }
.lv-sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 6px; }
.lv-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 20px 8px; }
.lv-sheet-head h2 { font-size: 18px; font-weight: 700; }
.lv-sheet-body { overflow-y: auto; padding: 4px 20px 12px; overscroll-behavior: contain; }
.lv-sheet-foot { padding: 12px 20px 0; display: flex; gap: 8px; border-top: 1px solid var(--hairline-soft); }
@media (min-width: 720px) {
  .lv-sheet { align-items: center; }
  .lv-sheet-panel { max-width: 560px; border-radius: var(--r-sheet); }
  .lv-sheet-grab { display: none; }
}

/* Empty state */
.lv-empty { margin-top: 28px; padding: 28px 20px; border-radius: var(--r-card); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lv-empty .lv-icon { color: var(--blue); }
.lv-empty h2 { font-size: 18px; font-weight: 700; }
.lv-empty p { font-size: 14px; color: var(--grey); line-height: 1.5; text-wrap: pretty; max-width: 42ch; }
.lv-empty .lv-btn { margin-top: 6px; }

/* Toast */
/* Centred with auto margins, not a transform: the entry animation owns transform. */
.lv-toast { position: fixed; left: 0; right: 0; margin-inline: auto; width: fit-content; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 16px; background: var(--ink); color: var(--on-blue); font-size: 14px; box-shadow: var(--shadow-float); animation: lvSheetUp .26s var(--ease-pop); }

/* Adviser header: white at 96% with blur, tabs */
.lv-topbar { position: sticky; top: 0; z-index: 40; background: var(--header-veil); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.lv-topbar-row { height: 64px; display: flex; align-items: center; gap: 16px; }
.lv-brand { display: inline-flex; align-items: center; }
.lv-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.lv-tabs::-webkit-scrollbar { display: none; }
.lv-tab { height: 40px; padding: 0 14px; border-radius: 20px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.lv-tab:hover { background: var(--bg-4); }
.lv-tab.is-on { background: var(--blue-wash); color: var(--blue); }
.lv-me { display: flex; align-items: center; gap: 8px; }
.lv-me-name { font-size: 14px; font-weight: 600; white-space: nowrap; }
.lv-me form { margin: 0; }
@media (max-width: 719px) {
  .lv-topbar-row { height: auto; flex-wrap: wrap; padding: 10px var(--gutter) 6px; gap: 8px 12px; }
  .lv-tabs { order: 3; flex-basis: 100%; }
  .lv-me { margin-left: auto; }
  .lv-me-name { display: none; }
  .lv-tab span { font-size: 13px; }
}

/* Buyer header, island and blobs */
.lv-blobs { position: fixed; inset: 0; pointer-events: none; z-index: 0; background:
  radial-gradient(240px 180px at 92% 120px, var(--blob-1) 0%, transparent 70%),
  radial-gradient(220px 160px at 6% 380px, var(--blob-2) 0%, transparent 70%),
  radial-gradient(260px 200px at 80% 860px, var(--blob-3) 0%, transparent 70%); }
.lv-buyer-header { position: sticky; top: 0; z-index: 20; padding: calc(18px + env(safe-area-inset-top)) var(--gutter) 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lv-island { position: absolute; top: calc(70px + env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter); z-index: 30; padding: 16px; border-radius: 24px; background: var(--glass-bg-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-line-strong); box-shadow: var(--shadow-island), var(--glass-inset); animation: lvPop .18s ease-out; }
.lv-island-row { display: flex; gap: 12px; align-items: center; }
.lv-island-name { font-size: 16px; font-weight: 700; display: block; }
.lv-island-actions { display: flex; gap: 8px; margin-top: 14px; }
.lv-island-actions .lv-btn-primary { flex: 1; }

/* Floating bottom bar (buyer pages) */
.lv-bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 20px calc(24px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; }
.lv-bottombar-inner { pointer-events: auto; height: 64px; padding: 4px; border-radius: var(--r-pill-lg); width: 100%; max-width: 440px; display: flex; align-items: center; gap: 4px; box-shadow: var(--shadow-float), var(--glass-inset); }

/* Forms */
.lv-input { height: var(--h-btn); width: 100%; padding: 0 14px; border-radius: var(--r-btn); border: 1px solid var(--line-2); background: var(--bg); font-size: 15px; }
.lv-input:focus { outline: 3px solid var(--blue-ring); outline-offset: 0; border-color: var(--blue); }
.lv-field { display: flex; flex-direction: column; gap: 6px; }
.lv-field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* Motion */
@keyframes lvCardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes lvSheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lvFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lvPop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .lv-page *, .lv-page *::before, .lv-page *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
