/* ==========================================================================
   Quadrat — Real Estate Investment Platform (iOS PWA build)
   Dark elegant finance. Adapted for full-device viewport + safe areas.
   ========================================================================== */

/* ─── Design Tokens — Dark elegant finance ──────────────────────────────── */
:root {
  --ink-900: #f1f1ec;
  --ink-800: #d9d9d2;
  --ink-700: #a8a89f;
  --ink-600: #7c7d75;
  --ink-500: #5a5c55;
  --ink-400: #3f413c;
  --ink-300: #2e302c;
  --ink-200: #25262335;
  --ink-150: #262723;
  --ink-100: #1d1e1b;
  --ink-50:  #18191634;
  --paper:   #0e0f0d;
  --surface: #16171493;
  --surface-2: #1c1d1a;
  --surface-3: #242521;
  --white:   #f5f5f0;

  --brand-gold: #c8a95a;
  --brand-gold-soft: rgba(200, 169, 90, 0.12);
  --brand-gold-strong: #d4b66a;

  --positive-ink: #8bc29a;
  --positive-bg:  rgba(139, 194, 154, 0.14);
  --positive-stroke: #6ea87d;
  --positive-tint: rgba(139, 194, 154, 0.25);

  --negative-ink: #d99a8b;
  --negative-bg:  rgba(217, 154, 139, 0.14);
  --negative-stroke: #c4806e;

  --neutral-ink: #a8a89f;
  --neutral-bg:  rgba(168, 168, 159, 0.1);

  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.16);

  --font-body: "Helvetica Neue", "Helvetica", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-display: "Mabry Pro", "Helvetica Neue", "Helvetica", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Safe-area shims (these resolve to 0 on non-iOS) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  width: 100%;
  /* Dynamic viewport height: accounts for the iOS home indicator area
     correctly in standalone PWA mode so `position: fixed; bottom: 0` truly
     reaches the physical bottom of the screen. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #0e0f0d;
  overscroll-behavior: none;
}
body {
  font-family: var(--font-body);
  color: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

#root {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
}

/* ─── App shell (replaces .phone/.phone-inner from prototype) ─────────── */
.app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--paper);
}
.screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* ─── Screen transition stage ──────────────────────────────────────────── */
/* Holds the AnimatePresence tree. Clipped so sliding screens don't bleed
   out, and position:relative so absolutely-positioned layers stack. */
.screen-stage {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}
.screen-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
}

/* Left-edge swipe-back grab handle. Narrow invisible strip that owns the
   gesture from the first pixel — `touch-action: none` means iOS commits
   every pointer down/move/up to us without trying to decide whether it's a
   scroll or a swipe. That was the cause of the "snaps back without lifting
   my finger" glitch. */
.swipe-grab {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 24px;
  z-index: 5;
  background: transparent;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ─── Safe-area spacer (replaces fake status bar from prototype) ──────── */
/* Exactly env(safe-area-inset-top). No height, no margin, no extra padding. */
.safe-top {
  padding: env(safe-area-inset-top) 0 0 0;
  margin: 0;
  height: 0;
  flex-shrink: 0;
  pointer-events: none;
}

/* ─── Scroll area ──────────────────────────────────────────────────────── */
.app-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* Tab bar is 70px + safe-bottom (fixed); leave a small gap above it. */
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}
.app-scroll::-webkit-scrollbar { width: 0; }

/* ─── Typography ───────────────────────────────────────────────────────── */
.h-page {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  line-height: 1.2;
}
.h-title-lg {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  line-height: 1.25;
}
.h-section {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-900);
  letter-spacing: -0.005em;
}
.eyebrow {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-600);
  font-weight: 500;
}
.meta {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-600);
  line-height: 1.4;
}
.body {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-800);
}
.link {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-900);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ─── Topbar & Section scaffold ────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px 4px;
  flex-shrink: 0;
}
.section { padding: 0 16px; margin-top: 22px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

/* ─── Icon button ──────────────────────────────────────────────────────── */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-900);
  position: relative;
  transition: background 120ms ease;
}
.icon-btn:hover { background: var(--ink-150); }
.icon-btn.ghost-dark:hover { background: rgba(241,241,236,0.08); }
.icon-btn .dot {
  position: absolute;
  top: 10px; right: 10px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-gold);
  border: 1.5px solid var(--paper);
}

/* ─── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  height: 48px;
  padding: 0 22px;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--brand-gold);
  color: #0e0f0d;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.btn-primary:hover { background: var(--brand-gold-strong); }
.btn-secondary {
  background: transparent;
  color: var(--ink-900);
  border: 1px solid var(--ink-300);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink-400); }
.btn-full { flex: 1; width: 100%; }

/* ─── Card ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-2);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.card.clickable:hover {
  border-color: var(--ink-300);
  transform: translateY(-1px);
}
.card.clickable:active { transform: translateY(0); }

/* ─── Property row ─────────────────────────────────────────────────────── */
.prop-row {
  display: flex;
  gap: 12px;
  padding: 10px;
}
.prop-row .thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--r-xs);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ink-150);
}
.prop-row .info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 2px;
}
.prop-row .info-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.prop-row .title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prop-row .loc {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
  flex-shrink: 0;
}
.prop-row .info-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.prop-row .price { display: flex; align-items: baseline; }
.prop-row .price .val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}
.prop-row .price .unit {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
  margin-left: 2px;
}
.prop-row .sub {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
}

/* IBO tag */
.ibo-tag {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--brand-gold);
  color: #0e0f0d;
}
.ibo-tag.pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
}

/* ─── Property wide card (horizontal scroll) ──────────────────────────── */
.prop-wide {
  flex-shrink: 0;
  width: 220px;
  background: var(--surface-2);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease;
}
.prop-wide:hover {
  border-color: var(--ink-300);
  transform: translateY(-2px);
}
.prop-wide .hero {
  width: 100%;
  height: 130px;
  position: relative;
  background: var(--ink-150);
}
.prop-wide .hero .save {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(14,15,13,0.7);
  border: 1px solid rgba(241,241,236,0.2);
  color: var(--ink-900);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 150ms ease;
}
.prop-wide .hero .save.saved {
  background: var(--brand-gold);
  color: #0e0f0d;
  border-color: var(--brand-gold);
}
.prop-wide .body-pad {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prop-wide .name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}
.prop-wide .sub {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
  margin-top: 2px;
}
.prop-wide .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.prop-wide .big {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}
.prop-wide .unit {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
  margin-left: 2px;
}
.prop-wide .delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--positive-ink);
  padding: 3px 7px;
  border-radius: var(--r-pill);
  background: var(--positive-bg);
}
.prop-wide .delta.neg {
  color: var(--negative-ink);
  background: var(--negative-bg);
}

/* ─── Sparkline ────────────────────────────────────────────────────────── */
.spark-pos .line { stroke: var(--positive-stroke); }
.spark-pos .fill { fill: var(--positive-tint); }
.spark-neg .line { stroke: var(--negative-stroke); }
.spark-neg .fill { fill: rgba(217,154,139,0.25); }

/* ─── Badge ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--positive-bg);
  color: var(--positive-ink);
  white-space: nowrap;
}
.badge.neg { background: var(--negative-bg); color: var(--negative-ink); }
.badge.neu { background: var(--neutral-bg); color: var(--ink-700); }

/* ─── Stat chip (detail screen) ────────────────────────────────────────── */
.stat-chip {
  flex: 1;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stat-chip .label {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-600);
  font-weight: 500;
}
.stat-chip .val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

/* ─── Hero image (detail) ──────────────────────────────────────────────── */
.hero-img {
  width: 100%;
  height: 220px;
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
  background: var(--ink-150);
}

/* ─── Hero carousel (property detail) ──────────────────────────────────── */
/* Horizontal scroll-snap container for the 3-slide property showcase:
   photo → map → developer. Uses native iOS momentum scroll. */
.hero-carousel {
  width: 100%;
  height: 220px;
  border-radius: var(--r-sm);
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--ink-150);
  /* Don't let the detail-layer back-swipe claim horizontal gestures inside
     the carousel — the grab handle only listens on the leftmost 24px, but
     this makes it unambiguous. */
  touch-action: pan-x;
}
.hero-carousel::-webkit-scrollbar { display: none; }
.hero-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 220px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
}
.hero-slide-inner {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Map slide (mock) ─────────────────────────────────────────────────── */
.hero-map {
  background: var(--ink-100);
}
.hero-map-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.hero-map-pin-dot {
  position: absolute;
  inset: 4px;
  background: var(--brand-gold);
  border-radius: 50%;
  border: 2px solid var(--ink-100);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.hero-map-pin-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: var(--brand-gold);
  opacity: 0.25;
  animation: map-pin-pulse 1.8s ease-out infinite;
}
@keyframes map-pin-pulse {
  0%   { transform: scale(0.6); opacity: 0.35; }
  70%  { transform: scale(1.4); opacity: 0;    }
  100% { transform: scale(1.4); opacity: 0;    }
}
.hero-map-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(14, 15, 13, 0.72);
  color: var(--ink-900);
  border-radius: var(--r-xs);
  font-family: var(--font-body);
  font-size: 11px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.hero-map-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Developer slide (mock) ───────────────────────────────────────────── */
.hero-dev {
  background: var(--ink-100);
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}
.hero-dev-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-gold);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--ink-300);
}
.hero-dev-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.005em;
  text-align: center;
}
.hero-dev-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(var(--positive-rgb, 120, 180, 120), 0.12);
  color: var(--positive-ink);
  border: 1px solid rgba(var(--positive-rgb, 120, 180, 120), 0.25);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-dev-stats {
  display: flex;
  gap: 18px;
  margin-top: 4px;
}
.hero-dev-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-dev-stats .val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-900);
}
.hero-dev-stats .label {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--ink-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.hero-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-400);
  cursor: pointer;
  transition: background 120ms ease, width 120ms ease;
}
.hero-dot.active {
  background: var(--ink-900);
  width: 20px;
  border-radius: 3px;
}

/* ─── Progress bar ─────────────────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 6px;
  background: var(--ink-150);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--brand-gold);
  border-radius: 999px;
  transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Key-value list ───────────────────────────────────────────────────── */
.kv {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-150);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: baseline;
}
.kv:last-child { border-bottom: 0; }
.kv-label {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-600);
}
.kv-val {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
  text-align: right;
}
.kv-hint {
  grid-column: 1 / -1;
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--ink-500);
  margin-top: 4px;
}

/* ─── Segmented control ────────────────────────────────────────────────── */
.segmented {
  display: flex;
  background: var(--ink-100);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  flex: 1;
  height: 34px;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-600);
  border-radius: calc(var(--r-sm) - 2px);
  cursor: pointer;
  transition: all 150ms ease;
}
.segmented button.active {
  background: var(--surface-3);
  color: var(--ink-900);
  box-shadow: var(--shadow-sm);
}

/* ─── Chips ────────────────────────────────────────────────────────────── */
.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 16px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink-300);
  background: var(--surface-2);
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink-400); }
.chip.active {
  background: var(--brand-gold);
  color: #0e0f0d;
  border-color: var(--brand-gold);
}

/* ─── Search bar ───────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  align-items: center;
}
.search-input {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  background: var(--surface-2);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-900);
  outline: none;
  transition: border-color 120ms ease;
}
.search-input input:focus {
  border-color: var(--ink-400);
}
.search-input input::placeholder { color: var(--ink-500); }

.filter-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink-150);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-900);
  position: relative;
  transition: all 120ms ease;
}
.filter-btn:hover { border-color: var(--ink-300); }
.filter-btn.active {
  background: var(--brand-gold);
  color: #0e0f0d;
  border-color: var(--brand-gold);
}
.filter-btn .filter-count {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--brand-gold);
  color: #0e0f0d;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--paper);
}

/* ─── Range slider ─────────────────────────────────────────────────────── */
.range-wrap { padding: 20px 12px 4px; }
.range-track {
  position: relative;
  height: 4px;
  background: var(--ink-300);
  border-radius: 999px;
  margin-bottom: 12px;
}
.range-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--brand-gold);
  border-radius: 999px;
}
.range-thumb {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  background: var(--surface-3);
  border: 2px solid var(--brand-gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: var(--shadow-sm);
}
.range-thumb:active { cursor: grabbing; }
.range-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-800);
}

/* ─── Menu row (sort sheet) ────────────────────────────────────────────── */
.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--ink-150);
  transition: background 120ms ease;
}
.menu-row:hover { background: var(--surface-2); }
.menu-row:last-child { border-bottom: 0; }
.menu-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}
.menu-hint {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
  margin-top: 2px;
}

/* ─── Tab bar ──────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  /* Total bar height = 56px of icon-area + small clearance above the home
     indicator. We do NOT add the full env(safe-area-inset-bottom) to height
     because that produced a tall bar with icons hugging the top — the
     "buttons way too high" look. Instead the bar is 56 + (safe-area - 22)
     tall: just enough to clear the home indicator with ~12px breathing room
     on an iPhone with home-indicator (where safe-inset is ~34px). On devices
     without a home indicator (safe-inset=0), the bar collapses to 56+8=64px. */
  height: calc(56px + max(8px, env(safe-area-inset-bottom) - 22px));
  padding-top: 8px;
  padding-bottom: max(8px, calc(env(safe-area-inset-bottom) - 22px));
  padding-left: calc(8px + env(safe-area-inset-left));
  padding-right: calc(8px + env(safe-area-inset-right));
  /* Fully opaque solid background. No transparency, no backdrop-filter. */
  background: #0e0f0d;
  border-top: 1px solid var(--ink-150);
  display: flex;
  z-index: 1000;
  margin: 0;
  transform: none;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: 0;
  padding: 6px 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-500);
  transition: color 120ms ease;
  border-radius: var(--r-sm);
}
.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tab.active { color: var(--brand-gold); }
.tab.active .tab-icon { transform: translateY(-1px); }

/* When any bottom-sheet is open, hide the tabbar so it doesn't sit above the
   sheet (it's portaled to <body> at z-index 1000, otherwise it would clip the
   bottom action row). The Sheet component toggles `body.sheet-open`. !important
   wins over the inline opacity:1 the TabBar component sets when its `hidden`
   prop is false. */
body.sheet-open .tabbar {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 200ms cubic-bezier(0.22, 0.61, 0.36, 1), visibility 200ms;
}


/* ─── Sheet (bottom drawer) ────────────────────────────────────────────── */
.sheet-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
  animation: fade-in 200ms ease;
}
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88%;
  background: var(--surface-2);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--ink-300);
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: slide-up 240ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.35);
  padding-bottom: var(--safe-bottom);
}
.sheet-grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--ink-400);
  margin: 8px auto 4px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}
.sheet-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-900);
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
}
.sheet-body::-webkit-scrollbar { width: 0; }

.footer-actions {
  padding: 12px 16px calc(16px + var(--safe-bottom));
  background: var(--surface-2);
  border-top: 1px solid var(--ink-150);
  position: relative;
}
/* When inside a sheet, the sheet itself already adds safe-bottom padding —
   avoid double-padding and a visible gap below the button row. */
.sheet .footer-actions {
  padding-bottom: 16px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ─── Invest flow specifics ─────────────────────────────────────────────── */
.amount-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 24px 16px 16px;
}
.amount-display .dollar {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  color: var(--ink-600);
}
.amount-display .num {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 56px;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  line-height: 1;
}
.chip-amounts {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 0 16px 20px;
  flex-wrap: wrap;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px 8px 8px;
  gap: 2px;
}
.numkey {
  height: 52px;
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--ink-900);
  cursor: pointer;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms ease;
}
.numkey:hover { background: var(--surface-3); }
.numkey:active { background: var(--ink-300); }

.order-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}
.order-row .label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-600);
}
.order-row .val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
}
.order-row.total {
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--ink-150);
}
.order-row.total .val {
  font-size: 16px;
}

.success-wrap {
  padding: 48px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.success-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--positive-bg);
  color: var(--positive-ink);
  border: 1px solid rgba(139,194,154,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop-in 400ms cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pop-in {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* ─── Donut legend ─────────────────────────────────────────────────────── */
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--font-body);
  font-size: 12px;
}
.legend-item .name {
  flex: 1;
  color: var(--ink-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-item .pct {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-900);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-dot.d-1 { background: #c8a95a; }
.legend-dot.d-2 { background: #8bc29a; }
.legend-dot.d-3 { background: #8aa3c4; }
.legend-dot.d-4 { background: #c08b6e; }
.legend-dot.d-5 { background: #7c7d75; }

/* ─── Profile hero ─────────────────────────────────────────────────────── */
.profile-hero {
  padding: 20px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--ink-300);
  color: var(--ink-900);
  display: flex;
  gap: 14px;
  align-items: center;
}
.profile-hero .name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.profile-hero .sub {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-600);
  margin-top: 2px;
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-gold);
  color: #0e0f0d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
  border: 2px solid rgba(241,241,236,0.1);
}
.avatar-violet { background: var(--brand-gold); }

/* ─── Toast ────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: absolute;
  bottom: calc(90px + var(--safe-bottom));
  left: calc(16px + var(--safe-left));
  right: calc(16px + var(--safe-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-3);
  border: 1px solid var(--ink-300);
  color: var(--ink-900);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Install hint (shown when app hasn't been added to Home Screen) ──── */
.install-hint {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  padding: 12px 14px;
  background: var(--surface-3);
  border: 1px solid var(--ink-300);
  border-radius: var(--r-md);
  color: var(--ink-800);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: flex;
  gap: 10px;
  align-items: center;
}
.install-hint button {
  margin-left: auto;
  border: 0; background: transparent; color: var(--ink-600);
  font-size: 20px; line-height: 1; padding: 4px 8px; cursor: pointer;
}

/* ─── Loading splash ───────────────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  background: var(--paper);
  z-index: 9999;
  padding: 0 24px;
}
.splash-logo {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--brand-gold);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  padding: 8px; gap: 4px;
}
.splash-logo span {
  background: #0e0f0d; border-radius: 2px;
}
.splash-status {
  font-family: var(--font-body, system-ui, -apple-system, sans-serif);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-500, #7c7d75);
  text-align: center;
  min-height: 16px;
  max-width: 280px;
  line-height: 1.4;
  transition: color 180ms ease;
}

/* ─── AI Property Analyst ─────────────────────────────────────────────────
   Pill CTA on the property detail screen + the bottom-sheet chat itself.
   Uses the same `.sheet`/`.sheet-overlay`/`.sheet-grabber` skeleton as the
   other modals so layout/safe-area treatment stays consistent; entrance is
   spring-animated by framer-motion (CSS animation overridden inline). */

.ask-ai-cta {
  background: transparent;
  border: 1px solid rgba(200, 169, 90, 0.4);
  color: var(--brand-gold);
  border-radius: var(--r-pill);
  height: 48px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 80ms ease;
}
.ask-ai-cta:hover {
  background: var(--brand-gold-soft);
  border-color: var(--brand-gold);
}
.ask-ai-cta:active { transform: scale(0.98); }

/* The AI sheet itself — fills 85% of the screen and uses motion for entrance.
   `animation: none` is set inline to suppress the slide-up keyframe. */
/* AI Analyst — full-screen view (replaces the bottom-sheet pattern, which
   fought iOS standalone PWA's layout-viewport shift on keyboard open). With
   a full-screen view there's no background to shift, scroll, or peek
   through; the iOS soft keyboard just works. Slide-up entrance via
   framer-motion spring. */
.ai-screen {
  /* Defaults — JS overrides top/left/width/height inline from visualViewport
     so the screen always matches the visible area (no layout-viewport shift
     when the iOS keyboard opens). */
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 100dvh;
  background: var(--paper);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ai-screen-in 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes ai-screen-in {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* While the AI analyst is open, hide everything else. With nothing visible
   behind, iOS layout-viewport shifts / keyboard auto-scroll / left-edge swipe
   gestures all become invisible. handleClose() removes this class BEFORE the
   exit fade, so the property page is back in place by the time the AI screen
   fades out — no "spawn out of nowhere" reveal. */
body.analyst-open .screen-stage {
  visibility: hidden;
}

/* Invisible left-edge strip that owns the swipe-back gesture. iOS treats
   `touch-action: none` as "this element fully owns the pointer" — no
   ambiguity with scroll, no flicker. Same approach as the property
   detail's .swipe-grab. */
.ai-screen-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 24px;
  z-index: 10;
  background: transparent;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.ai-screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 12px;
  border-bottom: 1px solid var(--ink-150);
  flex-shrink: 0;
}
.ai-screen-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--ink-100);
}
.ai-screen-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--brand-gold-soft);
  border: 1px solid rgba(200, 169, 90, 0.28);
  border-radius: var(--r-pill);
  padding: 4px 9px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.ai-sheet-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-sheet-loc {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-600);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.ai-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}
.ai-chat-scroll::-webkit-scrollbar { width: 0; }

/* Empty state — welcome line + 2x2 prompt grid */
.ai-empty { padding: 16px 0 8px; }
.ai-empty-title {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  line-height: 1.4;
}
.ai-empty-title b {
  color: var(--ink-900);
  font-weight: 500;
}
.ai-empty-spark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  background: var(--brand-gold-soft);
  flex-shrink: 0;
}
.ai-suggested {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ai-prompt-chip {
  background: var(--surface-3);
  border: 1px solid var(--ink-150);
  color: var(--ink-800);
  padding: 12px;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 80ms ease;
  line-height: 1.3;
}
.ai-prompt-chip:hover {
  border-color: rgba(200, 169, 90, 0.4);
  background: var(--surface-2);
}
.ai-prompt-chip:active { transform: scale(0.98); }

/* Messages */
.ai-msgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-msg-row { display: flex; width: 100%; }
.ai-msg-row.user { justify-content: flex-end; }

.ai-msg {
  max-width: 84%;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.ai-msg.user {
  background: var(--surface-3);
  border: 1px solid var(--ink-150);
  color: var(--ink-900);
  padding: 10px 13px;
  border-radius: 14px 14px 4px 14px;
}
.ai-msg.assistant {
  color: var(--ink-900);
  padding: 6px 8px;
  margin-left: -8px;
  border-radius: 6px;
  transition: background 320ms ease;
}
.ai-msg.assistant.just-finished {
  background: var(--brand-gold-soft);
}
.ai-msg.error {
  color: var(--negative-ink);
  background: var(--negative-bg);
  border: 1px solid rgba(217, 154, 139, 0.25);
  padding: 10px 13px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  max-width: 100%;
  flex: 1;
}
.ai-retry {
  background: transparent;
  border: 1px solid var(--negative-stroke);
  color: var(--negative-ink);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.ai-retry:hover { background: rgba(217, 154, 139, 0.08); }

/* Markdown content rendered into the assistant bubble */
.ai-md p { margin: 0 0 8px; }
.ai-md p:last-child { margin: 0; }
.ai-md ul, .ai-md ol { margin: 4px 0 8px; padding-left: 18px; }
.ai-md li { margin-bottom: 3px; }
.ai-md strong { color: var(--brand-gold); font-weight: 600; }
.ai-md em { color: var(--ink-800); }
.ai-md code {
  background: var(--ink-100);
  border: 1px solid var(--ink-150);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-800);
}
.ai-md pre {
  background: var(--ink-100);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 6px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre;
}
.ai-md pre code { background: transparent; border: 0; padding: 0; }
.ai-md a { color: var(--brand-gold); text-decoration: underline; }
.ai-md h1, .ai-md h2, .ai-md h3 {
  font-family: var(--font-display);
  font-weight: 500;
  margin: 8px 0 6px;
  font-size: 14px;
  color: var(--ink-900);
}
.ai-md hr { border: 0; border-top: 1px solid var(--ink-150); margin: 8px 0; }
.ai-md blockquote {
  border-left: 2px solid var(--brand-gold);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--ink-700);
}

/* Bouncing dots while we wait for the first token. Staggered 60ms. */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
}
.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-500);
  animation: ai-bounce 1.2s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: 0.06s; }
.ai-typing span:nth-child(3) { animation-delay: 0.12s; }
@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1;   }
}

/* Sticky input bar at the bottom. Respects safe-area-inset-bottom for
   iPhones with a home indicator. */
.ai-input-bar {
  padding: 8px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--ink-150);
  background: var(--surface-2);
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}
.ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--ink-100);
  border: 1px solid var(--ink-300);
  border-radius: 22px;
  padding: 4px 4px 4px 14px;
  transition: border-color 150ms ease;
}
.ai-input-wrap.active { border-color: rgba(200, 169, 90, 0.5); }
.ai-input-wrap:focus-within { border-color: var(--brand-gold); }
.ai-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  max-height: 120px;
  padding: 8px 0;
  min-height: 22px;
}
.ai-input::placeholder { color: var(--ink-500); }
.ai-input:disabled { opacity: 0.55; }
.ai-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--ink-300);
  color: var(--ink-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 80ms ease;
  align-self: center;
  margin-bottom: 2px;
}
.ai-send.active {
  background: var(--brand-gold);
  color: #0e0f0d;
}
.ai-send.active:hover { background: var(--brand-gold-strong); }
.ai-send:active { transform: scale(0.92); }
.ai-send:disabled { cursor: default; }

/* ─── Premium polish pack ─────────────────────────────────────────────────
   Micro-interactions + surface upgrades: staggered list entrances, image
   shimmer skeletons, gradient gold primary buttons, progress sheen, glassy
   toasts, net-worth hero card, tab-icon pop. Appended last so these rules
   win same-specificity conflicts with the base styles above. */

/* Staggered rise-in for lists. Parent gets .stagger; children animate in
   with 45ms cascade. Only the first 8 get delays — anything below the fold
   just appears, which keeps long lists snappy. */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stagger > * { animation: rise-in 360ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 30ms; }
.stagger > *:nth-child(2) { animation-delay: 75ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 165ms; }
.stagger > *:nth-child(5) { animation-delay: 210ms; }
.stagger > *:nth-child(6) { animation-delay: 255ms; }
.stagger > *:nth-child(7) { animation-delay: 300ms; }
.stagger > *:nth-child(8) { animation-delay: 345ms; }

/* Image loading shimmer (PropertyImage shows this until img onLoad). */
@keyframes shimmer-sweep {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.img-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--ink-100) 40%, var(--ink-150) 50%, var(--ink-100) 60%);
  background-size: 200% 100%;
  animation: shimmer-sweep 1.4s linear infinite;
}

/* Primary button: brushed-gold gradient + soft glow + inner highlight. */
.btn-primary {
  background: linear-gradient(160deg, #dcc17c 0%, #c8a95a 55%, #b6964a 100%);
  box-shadow: 0 6px 20px rgba(200, 169, 90, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover {
  background: linear-gradient(160deg, #e2c988 0%, #d4b66a 55%, #c0a054 100%);
}

/* IBO progress bar: continuous light sweep across the gold fill. */
.progress-bar {
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer-sweep 2.4s ease-in-out infinite;
}

/* Toast: frosted glass + gold hairline. */
.toast {
  background: rgba(28, 29, 26, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(200, 169, 90, 0.22);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}

/* Cards compress slightly under the finger — tactile press state. */
.card.clickable:active { transform: scale(0.985); }
.prop-wide:active { transform: scale(0.985); }

/* Net-worth hero card: layered gold radial glow over a graphite gradient,
   with a gold hairline border + deep drop shadow. */
.networth-card {
  background:
    radial-gradient(130% 140% at 8% 0%, rgba(200, 169, 90, 0.12), transparent 55%),
    linear-gradient(155deg, #23241f 0%, #1b1c19 55%, #171815 100%),
    var(--surface-2);
  border: 1px solid rgba(200, 169, 90, 0.24);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(241, 241, 236, 0.06);
}

/* Active tab icon pops with a spring overshoot. */
@keyframes tab-pop {
  0%   { transform: scale(0.85); }
  55%  { transform: scale(1.14); }
  100% { transform: scale(1) translateY(-1px); }
}
.tab.active .tab-icon { animation: tab-pop 280ms cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Segmented control thumb transition is slightly springier. */
.segmented button { transition: all 180ms cubic-bezier(0.22, 0.61, 0.36, 1); }

/* Tab-switch entrance (replaces AnimatePresence cross-fade — see App). */
.tab-fade-in { animation: fade-in 180ms ease-out; }
