/* ============================================================
   REALIO — App Styles
   ============================================================ */

:root {
  --bg: #FAFAF7;
  --bg-card: #FFFFFF;
  --ink: #1A1A1A;
  --ink-soft: #6B6B6B;
  --ink-faint: #A8A8A3;
  --line: #EBEAE4;
  --accent: #D63B2F;
  --accent-soft: #FFF1EE;
  --green: #2F7D5B;
  --green-soft: #E8F2EC;
  --gold: #B8893A;
  --gold-soft: #F7EFE0;
  --shadow-sm: 0 1px 2px rgba(20,20,20,0.04), 0 2px 8px rgba(20,20,20,0.04);
  --shadow-md: 0 4px 12px rgba(20,20,20,0.06), 0 12px 32px rgba(20,20,20,0.08);
  --shadow-lg: 0 8px 24px rgba(20,20,20,0.08), 0 24px 64px rgba(20,20,20,0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  position: relative;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* SPLASH */
.splash {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: 32px;
  transition: opacity 0.4s;
}
.splash.fade { opacity: 0; pointer-events: none; }
.splash-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.splash-logo .logo-mark {
  width: 56px; height: 56px;
  background: var(--ink);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.splash-logo .logo-mark::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 12px solid var(--accent);
}
.splash-logo .logo-mark svg {
  width: 26px; height: 26px;
  margin-top: 6px;
  stroke: white;
  stroke-width: 2.2;
  fill: none;
}
.splash-title {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.splash-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 600;
}
.splash-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* HEADER */
.header {
  flex-shrink: 0;
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  z-index: 10;
}
.logo {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.logo-mark {
  width: 28px; height: 28px;
  background: var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  position: relative;
  overflow: hidden;
}
.logo-mark::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 7px solid var(--accent);
}
.logo-mark svg {
  width: 14px; height: 14px;
  margin-top: 4px;
  stroke: white;
  stroke-width: 2.2;
  fill: none;
}
.logo-text { line-height: 1; }
.logo-text em {
  font-style: italic;
  color: var(--accent);
  font-weight: 600;
}
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; stroke: var(--ink); }
.icon-btn .badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--accent); color: white;
  font-size: 10px; font-weight: 600;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

/* MODE TABS */
.mode-tabs {
  flex-shrink: 0;
  margin: 6px 20px 14px;
  background: #F0EFE9;
  padding: 4px;
  border-radius: 14px;
  display: flex;
  gap: 2px;
}
.mode-tab {
  flex: 1;
  padding: 9px 12px;
  text-align: center;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  border: none;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.mode-tab.active {
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.mode-tab svg { width: 14px; height: 14px; }

/* VIEW */
.view {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view-content {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.view-content.active { display: flex; }

/* STACK / CARDS */
.stack-wrap {
  flex: 1;
  position: relative;
  padding: 6px 20px 12px;
  overflow: hidden;
}
.stack {
  position: relative;
  width: 100%;
  height: 100%;
}
.card {
  position: absolute;
  inset: 0;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: grab;
  transform-origin: center bottom;
  will-change: transform, opacity;
  border: 1px solid var(--line);
}
.card:active { cursor: grabbing; }
.card.dragging { transition: none; }
.card:not(.dragging) { transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s; }

.card-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #e8e6df;
}
.card-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 88%, rgba(0,0,0,0.78) 100%);
}

.photo-dots {
  position: absolute;
  top: 16px;
  left: 16px; right: 16px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.photo-dot {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.4);
  border-radius: 2px;
}
.photo-dot.active { background: rgba(255,255,255,0.95); }

.card-tags {
  position: absolute;
  top: 38px;
  left: 16px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.tag {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.tag.tag-rent { background: rgba(47, 125, 91, 0.95); color: white; }
.tag.tag-sale { background: rgba(214, 59, 47, 0.95); color: white; }

.card-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px 22px 22px;
  color: white;
  z-index: 2;
}
.card-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 4px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.2);
}
.card-loc {
  font-size: 13px;
  opacity: 0.92;
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 14px;
  font-weight: 500;
}
.card-loc svg { width: 12px; height: 12px; }
.card-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.95;
}
.card-meta span { display: flex; align-items: center; gap: 5px; }
.card-meta svg { width: 13px; height: 13px; opacity: 0.9; }
.card-price {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.card-price small { font-size: 12px; font-weight: 400; opacity: 0.8; font-family: var(--sans); }

.swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(-12deg);
  padding: 12px 22px;
  border-radius: 14px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.04em;
  border: 4px solid currentColor;
  opacity: 0;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.15s;
}
.swipe-indicator.like {
  color: #2F7D5B;
  right: 22px;
  transform: translateY(-50%) rotate(12deg);
}
.swipe-indicator.nope { color: var(--accent); left: 22px; }

/* ACTIONS */
.actions {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px 18px;
}
.action-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s;
}
.action-btn:active { transform: scale(0.9); }
.action-btn svg { width: 24px; height: 24px; }
.action-btn.dislike svg { stroke: var(--accent); }
.action-btn.info { width: 48px; height: 48px; align-self: center; }
.action-btn.info svg { width: 20px; height: 20px; stroke: var(--ink-soft); }
.action-btn.like svg { stroke: var(--green); fill: var(--green); }
.action-btn.super { background: var(--gold-soft); width: 48px; height: 48px; align-self: center; }
.action-btn.super svg { stroke: var(--gold); fill: var(--gold); width: 20px; height: 20px; }

/* EMPTY STATE */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--ink-soft);
}
.empty-state h2 {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 600;
}
.empty-state p { margin-bottom: 20px; max-width: 280px; }
.empty-state button {
  background: var(--ink);
  color: white;
  border: none;
  padding: 12px 22px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* SHEETS */
/* SHEETS */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,20,20,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 200;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  max-width: 440px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 28px 28px 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  will-change: transform;
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 44px; height: 5px;
  background: var(--line);
  border-radius: 100px;
  margin: 10px auto 0;
  flex-shrink: 0;
  cursor: pointer;
}
/* Larger invisible tap target around the visible handle (accessibility) */
.sheet-handle-wrap {
  width: 100%;
  padding: 6px 0 8px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: pan-y;
}
.sheet-content {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 28px;
}
.sheet-hero {
  height: 220px;
  background-size: cover;
  background-position: center;
  position: relative;
  margin: 12px 0 0;
  background-color: #e8e6df;
}
.sheet-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.4) 100%);
}
.sheet-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.sheet-close svg { width: 16px; height: 16px; stroke: var(--ink); }

.sheet-body { padding: 24px 24px 0; }
.sheet-tag-row { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.sheet-tag {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sheet-tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.sheet-tag.green { background: var(--green-soft); color: var(--green); border-color: transparent; }

.sheet-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 6px;
}
.sheet-loc {
  font-size: 14px;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 18px;
}
.sheet-loc svg { width: 13px; height: 13px; }

.sheet-price-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.sheet-price {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sheet-price small { font-size: 14px; font-weight: 400; color: var(--ink-soft); margin-left: 4px; font-family: var(--sans); }
.sheet-pm2 { text-align: right; color: var(--ink-soft); font-size: 13px; }
.sheet-pm2 strong { display: block; color: var(--ink); font-size: 16px; font-weight: 600; font-family: var(--serif); }

.sheet-section { margin-bottom: 24px; }
.sheet-section h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
}
.sheet-desc { font-size: 14.5px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; }

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.spec { background: white; padding: 14px 16px; }
.spec-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 3px;
}
.spec-val {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.features { display: flex; flex-wrap: wrap; gap: 8px; }
.feature {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 8px 14px 8px 12px;
  border-radius: 100px;
  font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  color: var(--ink);
  font-weight: 500;
}
.feature-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.sheet-cta {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.sheet-cta a {
  flex: 1;
  text-align: center;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.sheet-cta .primary {
  background: var(--ink);
  color: white;
}
.sheet-cta .secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* FILTERS */
.filter-sheet { z-index: 210; }
.filter-header {
  padding: 14px 16px 14px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.filter-header h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.01em;
}
.sheet-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.sheet-close-btn:active { transform: scale(0.9); }
.sheet-close-btn svg {
  width: 14px;
  height: 14px;
  stroke: var(--ink-soft);
}
.filter-reset {
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 8px 4px;
}
.filter-content {
  overflow-y: auto;
  padding: 18px 20px 20px;
  flex: 1;
}
.filter-group { margin-bottom: 26px; }
.filter-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: white;
  border: 1px solid var(--line);
  padding: 9px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink);
  font-family: inherit;
}
.chip.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.range-wrap {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.range-values {
  display: flex;
  justify-content: space-between;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}
.range-slider {
  position: relative;
  height: 4px;
  background: var(--line);
  border-radius: 100px;
  margin: 8px 4px;
}
.range-fill {
  position: absolute;
  height: 100%;
  background: var(--ink);
  border-radius: 100px;
}
.range-slider input[type=range] {
  position: absolute;
  width: 100%;
  height: 4px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  top: 0; left: 0;
  margin: 0;
}
.range-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--ink);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow-sm);
}
.range-slider input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--ink);
  cursor: pointer;
  pointer-events: auto;
}
.filter-apply {
  margin: 14px 20px 24px;
  padding: 16px;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

/* INVESTOR */
.inv-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 24px;
  -webkit-overflow-scrolling: touch;
}
.inv-summary {
  background: linear-gradient(135deg, #1A1A1A 0%, #2A2520 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.inv-summary::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(184, 137, 58, 0.35) 0%, transparent 70%);
  pointer-events: none;
}
.inv-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.6;
  margin-bottom: 4px;
  position: relative;
}
.inv-summary-val {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  position: relative;
  margin-bottom: 4px;
}
.inv-summary-val small { font-size: 16px; font-weight: 400; opacity: 0.7; font-family: var(--sans); }
.inv-summary-sub {
  font-size: 13px;
  opacity: 0.7;
  position: relative;
  margin-bottom: 18px;
}
.inv-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 16px;
  position: relative;
}
.inv-mini-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-bottom: 2px;
}
.inv-mini-val { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.inv-mini-val small { font-size: 11px; font-weight: 400; opacity: 0.7; font-family: var(--sans); }

.inv-section-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 6px 4px 12px;
  letter-spacing: -0.01em;
}
.inv-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s;
}
.inv-card:active { transform: scale(0.985); }
.inv-card-img {
  width: 84px; height: 84px;
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  background-color: #e8e6df;
}
.inv-card-body { flex: 1; min-width: 0; }
.inv-card-loc {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.inv-card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.inv-stats { display: flex; gap: 12px; }
.inv-stat { display: flex; flex-direction: column; }
.inv-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.inv-stat-val {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}
.inv-stat-val.up { color: var(--green); }
.inv-stat-val.gold { color: var(--gold); }

.inv-locations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.inv-loc-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
}
.inv-loc-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.2;
}
.inv-loc-stats { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.inv-loc-stats strong { color: var(--ink); font-weight: 600; }
.inv-loc-yield {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inv-loc-yield-val {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
}

/* CHAT */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 16px;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 22px;
  font-size: 14.5px;
  line-height: 1.45;
  animation: msgIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  word-wrap: break-word;
  flex-shrink: 0;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.ai {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  color: var(--ink);
}
.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: white;
  border-bottom-right-radius: 6px;
}
.msg-greeting { padding: 16px 18px; }
.msg-greeting .ai-avatar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.ai-avatar-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B8893A 0%, #D63B2F 100%);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
}

.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  flex-shrink: 0;
}
.chat-sug {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 9px 14px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.chat-sug:active { background: var(--accent-soft); }

.ai-rec {
  align-self: flex-start;
  max-width: 88%;
  min-height: 96px;
  flex-shrink: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  animation: msgIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ai-rec:active { transform: scale(0.985); transition: transform 0.1s; }
.ai-rec-img {
  width: 96px;
  align-self: stretch;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  background-color: #e8e6df;
}
.ai-rec-body {
  padding: 12px 14px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.ai-rec-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.ai-rec-loc {
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-rec-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
.ai-rec-price {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.ai-rec-tag {
  font-size: 10px;
  color: var(--green);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.typing {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: 22px;
  border-bottom-left-radius: 6px;
  display: flex; gap: 4px;
  flex-shrink: 0;
}
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: typing 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-wrap {
  flex-shrink: 0;
  padding: 10px 16px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
}
.chat-input:focus { border-color: var(--ink); }
.chat-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chat-send:active { transform: scale(0.92); }
.chat-send svg { width: 18px; height: 18px; stroke: white; fill: white; }
.chat-send:disabled { opacity: 0.4; }

/* TOAST */
.match-toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: white;
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 280px;
  border: 1px solid var(--line);
}
.match-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.match-toast .heart { font-size: 38px; margin-bottom: 8px; }
.match-toast h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.match-toast p { font-size: 13px; color: var(--ink-soft); }

/* INSTALL PROMPT */
.install-banner {
  flex-shrink: 0;
  background: var(--ink);
  color: white;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  margin: 0 20px 8px;
  display: none;
}
.install-banner.show { display: flex; }
.install-banner span { flex: 1; }
.install-banner button {
  background: white;
  color: var(--ink);
  border: none;
  padding: 6px 12px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.install-banner .dismiss {
  background: transparent;
  color: white;
  padding: 4px 8px;
}

@media (max-height: 600px) {
  .card-title { font-size: 22px; }
}

/* FAVORITES SHEET */
.favorites-content {
  overflow-y: auto;
  flex: 1;
  padding: 12px 20px 24px;
  -webkit-overflow-scrolling: touch;
}
.fav-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.fav-item:active {
  transform: scale(0.985);
  border-color: var(--ink-faint);
}
.fav-img {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center;
  background-color: #e8e6df;
  flex-shrink: 0;
}
.fav-body {
  flex: 1;
  min-width: 0;
}
.fav-loc {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fav-meta {
  font-size: 13px;
  color: var(--ink-soft);
}
.fav-meta strong {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 700;
}
.fav-meta small {
  font-size: 11px;
  opacity: 0.7;
}
.fav-remove {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  padding: 0;
}
.fav-remove:active { transform: scale(0.88); }
.fav-remove:hover {
  background: var(--accent-soft);
  border-color: transparent;
}
.fav-remove svg {
  width: 14px;
  height: 14px;
  stroke: var(--ink-soft);
}
.fav-remove:hover svg { stroke: var(--accent); }

/* ============================================================
   NATIVE APP MODE (iOS / Android WebView)
   ============================================================
   Activated when <body> has class "native-app". Adds safe-area
   insets for Dynamic Island / notch / home indicator, disables
   web-only chrome, prevents pull-to-refresh, and tightens UX
   for App Store / Play Store submission.
*/

/* Safe area insets — keep content out of status bar / home indicator */
body.native-app {
  /* fall back to 0 if env() not supported */
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
}

body.native-app .app {
  /* the app shell respects horizontal safe areas */
  padding-left: var(--sa-left);
  padding-right: var(--sa-right);
}

body.native-app .header {
  padding-top: calc(14px + var(--sa-top));
}

body.native-app .splash {
  padding-top: var(--sa-top);
  padding-bottom: var(--sa-bottom);
}

/* Bottom chrome respects home indicator */
body.native-app .actions {
  padding-bottom: calc(18px + var(--sa-bottom));
}
body.native-app .chat-input-wrap {
  padding-bottom: calc(16px + var(--sa-bottom));
}
body.native-app .inv-scroll {
  padding-bottom: calc(24px + var(--sa-bottom));
}

/* Sheet bottoms also need to clear home indicator */
body.native-app .sheet-content,
body.native-app .favorites-content,
body.native-app .filter-content {
  padding-bottom: calc(28px + var(--sa-bottom));
}
body.native-app .filter-apply {
  margin-bottom: calc(24px + var(--sa-bottom));
}

/* Hide web-only UI — install banner is pointless in a native app */
body.native-app .install-banner { display: none !important; }

/* Tighten gestures — disable iOS rubber-band scroll on app shell,
   disable pull-to-refresh, prevent accidental text selection on UI */
body.native-app,
body.native-app .app,
body.native-app .view {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

body.native-app .header,
body.native-app .mode-tabs,
body.native-app .actions,
body.native-app .logo,
body.native-app .icon-btn,
body.native-app .mode-tab,
body.native-app .action-btn,
body.native-app .chip,
body.native-app .filter-apply {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Disable iOS link-style tap highlight on all interactive things */
body.native-app * {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

/* App Store reviewers check this — links to external sites
   shouldn't visually look like web links inside a native app */
body.native-app a {
  color: inherit;
  text-decoration: none;
}

/* iOS-specific touch target hardening */
body.native-app.native-app-ios .icon-btn,
body.native-app.native-app-ios .action-btn,
body.native-app.native-app-ios .mode-tab {
  /* Apple HIG recommends min 44pt touch target */
  min-height: 44px;
  min-width: 44px;
}
