/* ───────────────────────────────────────────────────────────
   Mesto — Real estate agent prototype
   ─────────────────────────────────────────────────────────── */

:root {
  --accent: #C8553D;
  --accentSoft: #F2D7CD;
  --accentInk: #7A2A18;
  --bg: #FAF7F2;
  --panel: #FFFFFF;
  --ink: #1A1A1A;
  --muted: #6B6660;
  --line: rgba(26, 26, 26, 0.08);
  --line-strong: rgba(26, 26, 26, 0.16);
  --shadow-card: 0 1px 2px rgba(26,26,26,0.04), 0 8px 24px rgba(26,26,26,0.06);
  --shadow-pop: 0 2px 6px rgba(26,26,26,0.06), 0 16px 48px rgba(26,26,26,0.10);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; }

/* ── Layout ───────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: 100vh;
  background: var(--bg);
}

.app.is-mobile {
  width: 390px;
  height: 780px;
  margin: 32px auto;
  border-radius: 36px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 24px 64px rgba(0,0,0,0.18);
  border: 8px solid #1A1A1A;
  grid-template-columns: 1fr;
  grid-template-rows: 40% 60%;
}
.app.is-mobile .chat-pane { grid-row: 2; border-right: none; border-top: 1px solid var(--line); }
.app.is-mobile .map-pane { grid-row: 1; }

/* ── Chat pane ────────────────────────────────────────────── */

.chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-width: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
}
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.header-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  display: grid; place-items: center;
  transition: background 150ms, border-color 150ms;
}
.header-btn:hover { background: var(--bg); border-color: var(--line-strong); }

.chat-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.chat-scroll::-webkit-scrollbar { width: 8px; }
.chat-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* ── Onboarding ───────────────────────────────────────────── */

.onboard { padding: 8px 0 16px; }
.onboard-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.onboard-title {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
  text-wrap: pretty;
}
.onboard-body {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 28px;
  text-wrap: pretty;
}
.onboard-chip-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.quick-chips {
  display: flex; flex-direction: column; gap: 8px;
}
.chip {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--ink);
  transition: all 160ms;
}
.chip:hover {
  background: var(--accentSoft);
  border-color: transparent;
  color: var(--accentInk);
}

/* ── Messages ─────────────────────────────────────────────── */

.msg { display: flex; gap: 10px; max-width: 100%; }
.msg--user { justify-content: flex-end; }

.msg--user .msg-bubble {
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  max-width: 86%;
  font-size: 14px;
  line-height: 1.45;
}

.msg--assistant {
  align-items: flex-start;
}
.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  flex: 0 0 auto;
  margin-top: 2px;
}
.msg-avatar-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.msg--assistant .msg-bubble {
  flex: 1 1 auto;
  min-width: 0;
}

.msg-md { font-size: 14px; line-height: 1.55; color: var(--ink); }
.msg-md .md-p { margin: 0 0 8px; }
.msg-md .md-p:last-child { margin-bottom: 0; }
.msg-md .md-spacer { height: 4px; }
.msg-md strong { font-weight: 600; }
.msg-md .md-ol {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  counter-reset: ol;
}
.msg-md .md-ol li {
  counter-increment: ol;
  position: relative;
  padding: 6px 0 6px 28px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.msg-md .md-ol li:last-child { border-bottom: 1px solid var(--line); }
.msg-md .md-ol li::before {
  content: counter(ol);
  position: absolute;
  left: 0; top: 6px;
  width: 20px; height: 20px;
  border-radius: 6px;
  background: var(--accentSoft);
  color: var(--accentInk);
  font-size: 11px;
  font-weight: 600;
  display: grid; place-items: center;
}

/* Typing indicator */
.msg--typing .typing-dots {
  display: inline-flex; gap: 4px;
  padding: 6px 0;
}
.msg--typing .typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.5;
  animation: typing-bounce 1.2s infinite;
}
.msg--typing .typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.msg--typing .typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-3px); opacity: 0.9; }
}

/* Trace */
.typing-trace, .msg-trace {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.msg-trace { margin-top: 10px; }
.msg-trace-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: var(--font);
}
.trace-line {
  display: flex; gap: 6px;
  align-items: baseline;
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trace-icon { color: var(--accent); width: 10px; flex: 0 0 auto; }
.trace-name { color: var(--ink); font-weight: 500; }
.trace-args { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.trace-ms { margin-left: auto; color: var(--muted); opacity: 0.7; flex: 0 0 auto; padding-left: 8px; }
.trace-active .trace-icon { animation: trace-pulse 0.8s infinite; }
.trace-active { opacity: 0.7; }
@keyframes trace-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Listing pills under message */
.msg-listings {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 10px;
}
.msg-listing-pill {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  transition: all 150ms;
}
.msg-listing-pill:hover {
  border-color: var(--accent);
  background: var(--panel);
}
.msg-listing-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.msg-listing-price { color: var(--accent); font-weight: 600; white-space: nowrap; flex: 0 0 auto; margin-left: 8px; }

/* ── Composer ─────────────────────────────────────────────── */

.composer {
  flex: 0 0 auto;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.composer-inner {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  transition: border-color 150ms;
}
.composer-inner:focus-within { border-color: var(--accent); }
.composer-input {
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  resize: none;
  padding: 6px 0;
  max-height: 140px;
}
.composer-send {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: 0;
  display: grid; place-items: center;
  transition: opacity 150ms, transform 150ms;
}
.composer-send:disabled { opacity: 0.3; cursor: not-allowed; }
.composer-send:not(:disabled):hover { transform: translateX(1px); }
.composer-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  padding: 0 4px;
}
.composer-hint kbd {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
}

/* ── Map pane ─────────────────────────────────────────────── */

.map-pane {
  position: relative;
  background: #EAE5DC;
  overflow: hidden;
}
.map-container {
  position: absolute; inset: 0;
}
.maplibregl-ctrl-group { box-shadow: var(--shadow-card) !important; border: 0 !important; }

.map-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.map-empty-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  padding: 14px 18px;
  border-radius: 12px;
  text-align: center;
  pointer-events: auto;
}
.map-empty-title { font-weight: 600; font-size: 14px; }
.map-empty-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Map markers ──────────────────────────────────────────── */

.map-marker {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  transform-origin: bottom center;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1);
}
.map-stylized .map-marker {
  position: absolute;
  transform: translate(-50%, -100%);
}
.map-marker:hover, .map-marker.is-hover { transform: scale(1.06); z-index: 5; }
.map-stylized .map-marker:hover, .map-stylized .map-marker.is-hover {
  transform: translate(-50%, -100%) scale(1.06); z-index: 5;
}
.map-marker.is-active { z-index: 10; }
.map-stylized .map-marker.is-active { transform: translate(-50%, -100%) scale(1.08); }

.map-marker-pin {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.10);
  white-space: nowrap;
  font-family: var(--font);
  transition: all 180ms;
}
.map-marker.is-active .map-marker-pin,
.map-marker.is-hover .map-marker-pin {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.map-marker-stem {
  width: 2px;
  height: 8px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  margin-top: -1px;
}
.map-marker.is-active .map-marker-stem,
.map-marker.is-hover .map-marker-stem {
  background: var(--accent);
  border-color: var(--accent);
}

.map-stylized { background: #F2EDE4; }
.stylized-markers { position: absolute; inset: 0; }

/* ── Results overlay (cards on map) ───────────────────────── */

.results-overlay {
  position: absolute;
  left: 16px; bottom: 16px;
  width: calc(100% - 32px);
  max-width: 720px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 12px 14px 14px;
  z-index: 5;
}
.is-mobile .results-overlay { left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; padding: 8px; }

.results-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 8px;
  font-size: 12px;
  gap: 12px;
  white-space: nowrap;
}
.results-count { font-weight: 600; flex: 0 0 auto; }
.results-sort { color: var(--muted); flex: 0 0 auto; }

.results-list { display: flex; gap: 10px; }
.results-list--horizontal { overflow-x: auto; padding-bottom: 4px; }
.results-list--horizontal::-webkit-scrollbar { height: 6px; }
.results-list--horizontal::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.results-list--vertical { flex-direction: column; }
.results-list--minimal { flex-direction: column; gap: 0; }

/* ── Listing card ─────────────────────────────────────────── */

.listing-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 180ms;
  display: flex;
  flex: 0 0 auto;
}
.listing-card:hover, .listing-card.is-hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}
.listing-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accentSoft), var(--shadow-card);
}

/* horizontal: thumb left, body right; in a row of cards */
.listing-card--horizontal {
  width: 280px;
  flex-direction: row;
}
.listing-card--horizontal .listing-thumb { width: 90px; flex: 0 0 90px; }
.listing-card--horizontal .listing-body { flex: 1; padding: 10px 12px; }

/* vertical: thumb top, body bottom; in a column */
.listing-card--vertical {
  flex-direction: row;
  width: 100%;
}
.listing-card--vertical .listing-thumb { width: 110px; flex: 0 0 110px; }
.listing-card--vertical .listing-body { flex: 1; padding: 12px 14px; }

/* minimal: no thumb, condensed */
.listing-card--minimal {
  flex-direction: row;
  width: 100%;
  border-left: 0; border-right: 0; border-top: 0;
  border-radius: 0;
  background: transparent;
}
.listing-card--minimal:first-child { border-top: 1px solid var(--line); }
.listing-card--minimal:hover, .listing-card--minimal.is-hover {
  background: var(--bg);
  transform: none;
  box-shadow: none;
}
.listing-card--minimal.is-active {
  background: var(--accentSoft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.listing-card--minimal .listing-thumb { display: none; }
.listing-card--minimal .listing-body { padding: 10px 14px; }

.listing-thumb {
  position: relative;
  overflow: hidden;
}
.listing-thumb-shapes {
  position: absolute; inset: 0;
}
.lt-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
  mix-blend-mode: soft-light;
}
.lt-shape-1 { width: 60%; height: 60%; background: rgba(255,255,255,0.45); top: -10%; left: -10%; }
.lt-shape-2 { width: 50%; height: 50%; background: rgba(0,0,0,0.18); bottom: -15%; right: -10%; }
.lt-shape-3 { width: 30%; height: 30%; background: rgba(255,255,255,0.5); top: 40%; right: 20%; }

.listing-id-pill {
  position: absolute; top: 8px; left: 8px;
  background: rgba(255,255,255,0.85);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
}

.listing-body {
  display: flex; flex-direction: column;
  min-width: 0;
}
.listing-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  min-width: 0;
}
.listing-name { font-weight: 600; font-size: 14px; letter-spacing: -0.005em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.listing-price { font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; flex: 0 0 auto; }
.listing-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.listing-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.listing-district {
  background: var(--accentSoft);
  color: var(--accentInk);
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 11px;
}
.meta-dot { color: var(--line-strong); }

.listing-actions { margin-top: 8px; }
.btn-detail {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color 150ms;
}
.btn-detail:hover { text-decoration-color: var(--accent); }

/* ── Detail pane ──────────────────────────────────────────── */

.detail-pane {
  position: absolute;
  top: 16px; right: 16px; bottom: 16px;
  width: 380px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--line);
  overflow-y: auto;
  z-index: 20;
  animation: detail-in 240ms cubic-bezier(.2,.8,.2,1);
}
@keyframes detail-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.is-mobile .detail-pane { top: 8px; right: 8px; bottom: 8px; left: 8px; width: auto; }

.detail-header {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between;
  z-index: 2;
}
.detail-id {
  background: rgba(255,255,255,0.9);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}
.detail-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
  display: grid; place-items: center;
}
.detail-close:hover { background: #fff; }

.detail-hero {
  height: 220px;
  position: relative;
  overflow: hidden;
}
.detail-hero-shapes { position: absolute; inset: 0; }
.dh-shape { position: absolute; border-radius: 50%; filter: blur(8px); }
.dh-1 { width: 60%; height: 60%; background: rgba(255,255,255,0.4); top: -20%; left: -10%; }
.dh-2 { width: 50%; height: 50%; background: rgba(0,0,0,0.15); bottom: -10%; right: -15%; }
.dh-3 { width: 35%; height: 35%; background: rgba(255,255,255,0.55); top: 40%; right: 25%; }
.dh-4 { width: 20%; height: 20%; background: rgba(0,0,0,0.12); bottom: 30%; left: 30%; }

.detail-hero-thumbs {
  position: absolute;
  bottom: 10px; left: 10px; right: 10px;
  display: flex; gap: 6px;
}
.hero-thumb {
  flex: 1;
  height: 36px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.85);
}
.hero-thumb--more {
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255,255,255,0.92) !important;
}

.detail-body { padding: 20px 22px; }
.detail-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.detail-address {
  font-size: 13px;
  color: var(--muted);
}
.detail-price-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.detail-price {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.detail-ppm {
  font-size: 12px;
  color: var(--muted);
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  margin: 16px -22px;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  background: var(--panel);
  padding: 12px 8px;
  text-align: center;
}
.stat-value { font-size: 16px; font-weight: 600; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

.detail-section { margin-top: 20px; }
.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.detail-section-title--small { margin-top: 12px; }

.detail-list { display: flex; flex-direction: column; }
.detail-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: 1px solid var(--line); }
.detail-row-icon {
  color: var(--accent);
  display: grid; place-items: center;
  width: 20px; flex: 0 0 20px;
}
.detail-row-label { flex: 1; color: var(--ink); }
.detail-row-value { color: var(--muted); }

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tag {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  color: var(--ink);
}

.detail-followups { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.followup {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 6px;
  transition: all 150ms;
}
.followup:hover {
  background: var(--accentSoft);
  border-color: transparent;
  color: var(--accentInk);
}

/* ── Modal ────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.32);
  display: grid; place-items: center;
  z-index: 100;
  animation: backdrop-in 180ms;
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel);
  border-radius: 14px;
  padding: 24px;
  width: 360px;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow-pop);
  animation: modal-in 220ms cubic-bezier(.2,.8,.2,1);
}
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.modal-body { margin: 0 0 20px; font-size: 14px; color: var(--muted); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn-ghost, .btn-primary {
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  transition: all 150ms;
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(0.95); }

/* ── Mobile-mode tweaks for inner layout ──────────────────── */

@media (max-width: 768px) {
  .app:not(.is-mobile) {
    grid-template-columns: 1fr;
    grid-template-rows: 40% 60%;
  }
  .app:not(.is-mobile) .map-pane { grid-row: 1; }
  .app:not(.is-mobile) .chat-pane { grid-row: 2; border-right: none; border-top: 1px solid var(--line); }
}
