/* ===========================================================================
   OTLO COMPONENTS — Otlo Edition
   Merges otlo-components.css with media-first post card + AI chat styles.
   ========================================================================= */

/* ===========================================================================
   1. TYPOGRAPHY UTILITIES
   ========================================================================= */
.t-display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
}
.t-h1 {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
}
.t-h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-title);
}
.t-h3 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-title);
}
.t-lead {
  font-size: var(--fs-lead);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-title);
}
.t-body      { font-size: var(--fs-body); line-height: var(--lh-normal); }
.t-body-long { font-size: var(--fs-body); line-height: var(--lh-relaxed); }
.t-small     { font-size: var(--fs-small); line-height: var(--lh-normal); }
.t-caption   { font-size: var(--fs-caption); line-height: var(--lh-normal); }
.t-data {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-micro);
  font-variant-numeric: tabular-nums;
}
.t-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}
.t-secondary { color: var(--text-secondary); }
.t-tertiary  { color: var(--text-tertiary); }
.t-brand     { color: var(--text-brand); }

:lang(gu), .is-gujarati {
  font-family: 'Noto Sans Gujarati', var(--font-body);
  line-height: 1.7;
  letter-spacing: 0;
}

/* ===========================================================================
   2. LAYOUT PRIMITIVES
   ========================================================================= */
.screen {
  max-width: 100%;
  padding-inline: var(--gutter);
  padding-bottom: calc(var(--nav-height) + var(--nav-inset) * 2 + var(--safe-bottom) + var(--space-6));
}
@media (min-width: 768px) {
  .screen {
    max-width: 720px;
    padding-inline: var(--space-6);
    padding-bottom: var(--space-8);
  }
}
.stack     { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-lg  { display: flex; flex-direction: column; gap: var(--space-5); }
.row       { display: flex; align-items: center; gap: var(--space-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.spacer    { flex: 1 1 auto; }
.divider {
  height: var(--hairline);
  background: var(--border-subtle);
  border: 0;
}

/* ===========================================================================
   3. GLASS
   ========================================================================= */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border: var(--hairline) solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--glass-shade), var(--shadow-md);
}
.glass--strong { background: var(--glass-bg-strong); }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-bg-strong); }
}
.no-glass .glass {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-color: var(--border-default);
}

/* ===========================================================================
   4. BUTTONS
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding-inline: var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-body);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--dur-instant) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.42; pointer-events: none; }

.btn--primary {
  background: var(--brand-action);
  color: var(--on-brand);
  box-shadow: var(--glow-coral);
}
.btn--primary:hover { background: var(--coral-700); box-shadow: var(--glow-coral-lg); }
[data-theme='dark'] .btn--primary:hover { background: var(--coral-400); }

.btn--secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: var(--hairline) solid var(--border-default);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover { background: var(--surface-hover); }

.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text-primary); }

.btn--danger { background: var(--sig-emergency); color: #FFFFFF; box-shadow: var(--glow-emergency); }

.btn--sm  { min-height: 34px; padding-inline: var(--space-3); font-size: var(--fs-small); border-radius: var(--radius-sm); }
.btn--block { width: 100%; }

/* Legacy button aliases */
.btn-primary { background: var(--brand-action); color: var(--on-brand); box-shadow: var(--glow-coral); }
.btn-primary:hover { background: var(--coral-700); box-shadow: var(--glow-coral-lg); }
.btn-accent { background: var(--accent); color: var(--sand-900); }
.btn-outline { background: var(--surface); color: var(--text-primary); border: var(--hairline) solid var(--border-default); box-shadow: var(--shadow-xs); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn-danger { background: var(--sig-emergency); color: #FFFFFF; box-shadow: var(--glow-emergency); }
.btn-sm { min-height: 34px; padding-inline: var(--space-3); font-size: var(--fs-small); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding-inline: var(--space-6); font-size: var(--fs-lead); border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  background: transparent;
  border: none;
}
.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* FAB */
.btn-fab, .fab {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--nav-height) + var(--nav-inset) * 2 + var(--safe-bottom) + var(--space-3));
  z-index: var(--z-nav);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 52px;
  padding-inline: var(--space-5);
  border-radius: var(--radius-full);
  background: var(--gradient-silk);
  color: var(--on-brand-silk);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-title);
  box-shadow: var(--glow-coral-lg), var(--shadow-lg);
  cursor: pointer;
  border: none;
  transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out);
}
.btn-fab:active, .fab:active { transform: scale(0.94); }

/* ===========================================================================
   5. FILTER CHIPS
   ========================================================================= */
.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: var(--space-1) var(--gutter);
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(90deg, #000 0 88%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0 88%, transparent 100%);
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-height: 36px;
  padding-inline: var(--space-4);
  border-radius: var(--radius-full);
  background: var(--surface);
  border: var(--hairline) solid var(--border-default);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}
.chip:active { transform: scale(0.95); }
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }

.chip.is-active, .chip.active {
  background: var(--chip-wash, var(--brand-wash));
  border-color: transparent;
  color: var(--chip-ink, var(--brand-ink));
  font-weight: var(--fw-semibold);
  box-shadow: inset 0 0 0 1px var(--chip-color, var(--brand-action));
}

.chip__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--chip-color, var(--text-tertiary));
  flex: 0 0 auto;
}
.chip__count {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
}

/* Category colour assignment */
[data-signal='emergency'] { --chip-color: var(--sig-emergency); --chip-ink: var(--sig-emergency-ink); --chip-wash: var(--sig-emergency-bg); }
[data-signal='traffic']   { --chip-color: var(--sig-traffic);   --chip-ink: var(--sig-traffic-ink);   --chip-wash: var(--sig-traffic-bg); }
[data-signal='water']     { --chip-color: var(--sig-water);     --chip-ink: var(--sig-water-ink);     --chip-wash: var(--sig-water-bg); }
[data-signal='verified']  { --chip-color: var(--sig-verified);  --chip-ink: var(--sig-verified-ink);  --chip-wash: var(--sig-verified-bg); }
[data-signal='market']    { --chip-color: var(--sig-market);    --chip-ink: var(--sig-market-ink);    --chip-wash: var(--sig-market-bg); }
[data-signal='civic']     { --chip-color: var(--sig-civic);     --chip-ink: var(--sig-civic-ink);     --chip-wash: var(--sig-civic-bg); }

/* Legacy chip aliases */
.category-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  border: var(--hairline) solid var(--border-default);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
.category-chip:hover {
  border-color: var(--coral-400);
  color: var(--text-brand);
  background: var(--brand-wash);
}
.category-chip.bg-primary, .category-chip.active {
  background: var(--brand-action);
  color: var(--on-brand);
  border-color: transparent;
  box-shadow: 0 2px 8px rgb(255 82 51 / 0.3);
}

/* ===========================================================================
   6. POST CARD — Media-First Design
   The atom of the product. Edge-to-edge media, dynamic grids, freshness bar.
   ========================================================================= */
.post-card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: var(--hairline) solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: slideUp var(--dur-slow) var(--ease-out) forwards;
  opacity: 0;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}
.post-card:hover { box-shadow: var(--shadow-md); }
.post-card:active { transform: scale(0.99); }

/* Category rail — 3px colour down the leading edge */
.post-card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  inset-block: 0;
  width: 3px;
  background: var(--chip-color, transparent);
  opacity: 0.9;
}

/* WHERE — mono eyebrow */
.post-card__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--chip-ink, var(--text-tertiary));
  margin-bottom: var(--space-2);
}
.post-card__eyebrow span { white-space: nowrap; }
.post-card__sep { opacity: 0.4; font-weight: var(--fw-medium); }
.post-card__distance { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

.post-card__title {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-title);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  text-wrap: balance;
}
.post-card__body {
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- MEDIA: Edge-to-edge, breaks out of card padding --- */
.post-card__media {
  margin-top: var(--space-3);
  margin-inline: calc(var(--space-4) * -1);
  overflow: hidden;
  position: relative;
  background: var(--surface-sunken);
}

/* Single image: original aspect ratio, max height */
.post-card__media--single {
  aspect-ratio: auto;
}
.post-card__media--single img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out);
}
.post-card__media--single:hover img {
  transform: scale(1.01);
}

/* Video */
.post-card__media--video {
  aspect-ratio: 16/9;
}
.post-card__media--video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.post-card__media--video::after {
  content: '';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.25);
  pointer-events: none;
  transition: background var(--dur-fast);
}
.post-card__media--video:hover::after {
  background: rgba(0,0,0,0.15);
}
.post-card__media--video .video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 1;
  pointer-events: none;
}
.post-card__media--video .video-play-icon svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
  margin-left: 3px;
}

/* Multi-image grids */
.post-card__media--grid {
  display: grid;
  gap: 2px;
}
.post-card__media--grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out);
}
.post-card__media--grid img:hover {
  transform: scale(1.03);
}

/* 2-up: side by side */
.post-card__media--grid-2 {
  grid-template-columns: 1fr 1fr;
  aspect-ratio: 2/1;
}

/* 3-up: top spans full width, bottom split */
.post-card__media--grid-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1/1;
}
.post-card__media--grid-3 > :first-child {
  grid-column: 1 / -1;
}

/* 4-up: 2x2 grid */
.post-card__media--grid-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1/1;
}

/* Gallery overlay for +N count */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h2);
}

/* --- Footer with confirmations and freshness --- */
.post-card__footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: var(--hairline) solid var(--border-subtle);
}

.confirm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.confirm:hover { background: var(--surface-active); color: var(--text-primary); }
.confirm.is-on {
  background: var(--sig-verified-bg);
  color: var(--sig-verified-ink);
  box-shadow: inset 0 0 0 1px var(--sig-verified);
}
.confirm__count { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Freshness bar */
.freshness {
  position: relative;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  overflow: hidden;
  flex: 1 1 auto;
}
.freshness__fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--freshness, 100%);
  border-radius: inherit;
  background: var(--chip-color, var(--sig-verified));
  transition: width var(--dur-slow) var(--ease-out);
}

/* --- Post actions bar (legacy) --- */
.post-actions {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-3) 0 0;
  border-top: var(--hairline) solid var(--border-subtle);
  margin-top: var(--space-1);
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  background: none;
  border: none;
  font-family: inherit;
}
.btn-action:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.btn-action svg { transition: all var(--dur-fast) var(--ease-spring); }
.btn-action.liked { color: var(--sig-emergency); }
.btn-action.liked svg { filter: drop-shadow(0 0 6px rgb(213 0 50 / 0.4)); }
.btn-action.bookmarked { color: var(--text-brand); }
.btn-action.bookmarked svg { filter: drop-shadow(0 0 6px rgb(255 82 51 / 0.4)); }

/* --- Post header (legacy layout) --- */
.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}
.post-author-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.post-author-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  color: var(--text-primary);
}
.post-meta {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: 3px;
}
.post-content {
  margin-bottom: var(--space-4);
}
.post-title {
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: var(--lh-snug);
}
.post-description {
  font-size: var(--fs-small);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

/* --- Emergency post variant --- */
.post-card--emergency, .emergency-post {
  background: var(--sig-emergency-bg);
  border-color: color-mix(in srgb, var(--sig-emergency) 32%, transparent);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--sig-emergency) 18%, transparent);
  padding-top: calc(var(--space-4) + 26px);
}
.post-card--emergency::before, .emergency-post::before { width: 0; }
.post-card--emergency.pulse, .emergency-post.pulse {
  animation: slideUp var(--dur-slow) var(--ease-out) forwards, pulse 3s ease-in-out infinite;
}

.post-card__cap {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-4);
  background: var(--sig-emergency);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}
.post-card--emergency .post-card__title { color: var(--sig-emergency-ink); }

.live-dot {
  position: relative;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  animation: otlo-pulse 2s var(--ease-out) infinite;
}

/* ===========================================================================
   7. BADGES
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 22px;
  padding-inline: var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--chip-wash, var(--surface-sunken));
  color: var(--chip-ink, var(--text-secondary));
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-micro);
  white-space: nowrap;
}

.badge--verified {
  position: relative;
  background: var(--accent-wash);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold-400) 45%, transparent);
  overflow: hidden;
}
.badge--verified::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-facet);
  transform: translateX(-120%);
  animation: otlo-facet 1.4s var(--ease-out) 0.3s 1;
}

/* Legacy badge aliases */
.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.neighborhood-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  background: var(--surface-sunken);
  font-weight: var(--fw-medium);
}
.badge-primary { background: var(--brand-wash); color: var(--text-brand); }
.badge-danger { background: var(--sig-emergency-bg); color: var(--sig-emergency); }
.badge-success { background: var(--sig-verified-bg); color: var(--sig-verified); }
.badge-warning { background: var(--sig-traffic-bg); color: var(--sig-traffic); }

/* ===========================================================================
   8. BOTTOM NAVIGATION — Glassmorphic Floating
   ========================================================================= */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--nav-inset) + var(--safe-bottom));
  z-index: var(--z-nav);
  width: min(420px, calc(100% - var(--gutter) * 2));
  margin-inline: auto;
  height: var(--nav-height);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  border-radius: var(--radius-2xl);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border: var(--hairline) solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--shadow-nav);
}
.no-glass .bottom-nav {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-color: var(--border-default);
}

.nav-item, .bottom-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--text-tertiary);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: none;
  min-width: 56px;
  transition: color var(--dur-fast) var(--ease-out);
}
.nav-item svg, .bottom-nav-item svg { width: 22px; height: 22px; stroke-width: 1.9; transition: transform var(--dur-fast) var(--ease-spring); }
.nav-item:hover, .bottom-nav-item:hover { color: var(--text-secondary); }

.nav-item.is-active, .bottom-nav-item.active {
  color: var(--text-brand);
  font-weight: var(--fw-semibold);
}
.nav-item.is-active svg, .bottom-nav-item.active svg { stroke-width: 2.3; transform: scale(1.1); }

/* Amber dot — the signature */
.nav-item::after, .bottom-nav-item::after {
  content: '';
  position: absolute;
  bottom: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform var(--dur-base) var(--ease-spring);
}
.nav-item.is-active::after, .bottom-nav-item.active::after { transform: scale(1); }

.nav-item__badge {
  position: absolute;
  top: 8px;
  inset-inline-start: calc(50% + 6px);
  min-width: 16px;
  height: 16px;
  padding-inline: 4px;
  border-radius: var(--radius-full);
  background: var(--sig-emergency);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ===========================================================================
   9. TOP BAR
   ========================================================================= */
.top-bar {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-nav) - 1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border-bottom: var(--hairline) solid var(--border-subtle);
}
.no-glass .top-bar { background: var(--bg-canvas); backdrop-filter: none; }

.locality {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
}
.locality__pin { color: var(--brand); }

/* Legacy header aliases */
.app-header, .header {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-nav) - 1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding-inline: var(--gutter);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border-bottom: var(--hairline) solid var(--border-subtle);
  width: 100%;
}
@media (min-width: 768px) {
  .app-header, .header {
    padding-inline: var(--space-6);
  }
}
.header-left { display: flex; align-items: center; min-width: 44px; }
.header-center { flex: 1; text-align: center; }
.header-center h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  letter-spacing: var(--ls-title);
}
.header-right { display: flex; align-items: center; gap: var(--space-2); min-width: 44px; justify-content: flex-end; }

/* ===========================================================================
   10. MAP PINS
   ========================================================================= */
.pin {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--chip-color, var(--brand));
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgb(var(--shadow-rgb) / 0.35), 0 0 0 3px var(--surface);
  transition: transform var(--dur-base) var(--ease-spring);
}
.pin:hover { transform: scale(1.12); }
.pin svg { width: 17px; height: 17px; }

.pin--cluster {
  width: 42px; height: 42px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border-default);
}
.pin--live::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--chip-color, var(--brand));
  animation: otlo-pulse 2.4s var(--ease-out) infinite;
}

/* ===========================================================================
   11. SKELETONS — Diamond Facet Sweep
   ========================================================================= */
.skeleton {
  position: relative;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-facet);
  transform: translateX(-100%);
  animation: otlo-facet 1.5s var(--ease-in-out) infinite;
}
.skeleton--line  { height: 12px; }
.skeleton--title { height: 20px; width: 72%; border-radius: var(--radius-xs); }
.skeleton--block { height: 120px; border-radius: var(--radius-md); }

/* Legacy skeleton aliases */
.skeleton-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.skeleton-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-facet);
  transform: translateX(-100%);
  animation: otlo-facet 1.5s var(--ease-in-out) infinite;
}
.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
  position: relative;
  margin-bottom: 8px;
}
.skeleton-text::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-facet);
  transform: translateX(-100%);
  animation: otlo-facet 1.5s var(--ease-in-out) infinite;
}
.skeleton-text:last-child { width: 60%; }
.skeleton-rect {
  height: 160px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  overflow: hidden;
  position: relative;
}
.skeleton-rect::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-facet);
  transform: translateX(-100%);
  animation: otlo-facet 1.5s var(--ease-in-out) infinite;
}

/* ===========================================================================
   12. EMPTY STATES
   ========================================================================= */
.empty, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
}
.empty__art, .empty-state-icon {
  width: 96px; height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-icon);
  background: var(--brand-wash);
  color: var(--brand);
  margin-bottom: var(--space-1);
}
.empty__title, .empty-state-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-title);
}
.empty__body, .empty-state-description {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  max-width: 30ch;
  line-height: var(--lh-relaxed);
}

/* ===========================================================================
   13. BOTTOM SHEET
   ========================================================================= */
.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: var(--z-sheet);
  max-height: 88dvh;
  padding: var(--space-3) var(--gutter) calc(var(--space-6) + var(--safe-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(0);
  transition: transform var(--dur-slow) var(--ease-out);
}
.sheet[hidden], .sheet.is-closed { transform: translateY(101%); }
.sheet__grab {
  width: 40px; height: 4px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-full);
  background: var(--border-strong);
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-sheet) - 1);
  background: var(--scrim);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity var(--dur-base) var(--ease-out);
}
.scrim.is-closed { opacity: 0; pointer-events: none; }

/* Legacy bottom sheet aliases */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: calc(var(--z-sheet) - 1);
  animation: fadeIn var(--dur-fast) var(--ease-out);
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: var(--z-sheet);
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto;
}

/* ===========================================================================
   14. FORM FIELDS
   ========================================================================= */
.field, .input {
  width: 100%;
  min-height: 46px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  border: var(--hairline) solid transparent;
  color: var(--text-primary);
  font-size: var(--fs-body);
  font-family: inherit;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.field::placeholder, .input::placeholder { color: var(--text-tertiary); }
.field:focus, .input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand-action);
  box-shadow: 0 0 0 3px var(--brand-wash);
}
.field-label, .input-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}
.textarea { min-height: 120px; resize: vertical; }

.input-group { display: flex; flex-direction: column; gap: var(--space-2); }

.search-bar {
  display: flex;
  align-items: center;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  padding: var(--space-2) var(--space-4);
  transition: all var(--dur-base) var(--ease-out);
  border: var(--hairline) solid transparent;
}
.search-bar input {
  border: none;
  background: transparent;
  flex: 1;
  padding: var(--space-2);
  outline: none;
  font-size: var(--fs-body);
  color: var(--text-primary);
}
.search-bar:focus-within {
  background: var(--surface);
  border-color: var(--brand-action);
  box-shadow: 0 0 0 3px var(--brand-wash);
}

/* ===========================================================================
   15. AI ANSWER BLOCK
   ========================================================================= */
.answer {
  position: relative;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: var(--hairline) solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.answer::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  border-radius: var(--radius-full);
  background: var(--gradient-silk);
}
.answer__text { font-size: var(--fs-body); line-height: var(--lh-relaxed); }
.answer__sources {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: var(--hairline) solid var(--border-subtle);
}
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 26px;
  padding-inline: var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
}

/* AI Summary details */
.ai-summary-details {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--brand-wash);
  border: 1px solid var(--brand-wash-2);
  border-radius: var(--radius-md);
}
.ai-summary-details summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text-brand);
  cursor: pointer;
  list-style: none;
}
.ai-summary-details summary::-webkit-details-marker { display: none; }
.ai-summary-content {
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

/* ===========================================================================
   16. AVATARS
   ========================================================================= */
.avatar {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-wash);
  color: var(--brand-ink);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  flex: 0 0 auto;
  object-fit: cover;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-xs);
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 44px; height: 44px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; border-width: 3px; }

.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-body);
  color: white;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}
.avatar-sm.avatar-initials { font-size: var(--fs-micro); }
.avatar-lg.avatar-initials { font-size: var(--fs-h3); }
.avatar-xl.avatar-initials { font-size: var(--fs-h2); }

.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-inline-start: -8px; box-shadow: 0 0 0 2px var(--surface); }

/* ===========================================================================
   17. TOAST
   ========================================================================= */
.toast {
  position: fixed;
  inset-inline: var(--gutter);
  bottom: calc(var(--nav-height) + var(--nav-inset) * 3 + var(--safe-bottom));
  z-index: var(--z-toast);
  max-width: 420px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border: var(--hairline) solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  transform: translateX(120%);
  opacity: 0;
  transition: all var(--dur-base) var(--ease-out);
}
.toast.toast-show { transform: translateX(0); opacity: 1; }
@media (min-width: 768px) {
  .toast {
    bottom: var(--space-6);
    right: var(--space-6);
    left: auto;
    inset-inline: auto;
  }
}
.toast-success { border-left: 4px solid var(--sig-verified); }
.toast-error { border-left: 4px solid var(--sig-emergency); }
.toast-warning { border-left: 4px solid var(--sig-traffic); }
.toast-info { border-left: 4px solid var(--sig-water); }

.toast-container {
  position: fixed;
  top: calc(var(--safe-area-top, 0px) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

/* ===========================================================================
   18. TRUST SCORE & STAR RATING
   ========================================================================= */
.trust-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-micro);
  border: 1.5px solid;
}
.star-rating {
  display: inline-flex;
  gap: 2px;
  color: var(--gold-400);
}

/* ===========================================================================
   19. LISTING / BUSINESS CARDS
   ========================================================================= */
.listing-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: all var(--dur-base) var(--ease-out);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.listing-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.listing-image {
  aspect-ratio: 1/1;
  object-fit: cover;
  width: 100%;
  background: var(--surface-sunken);
}
.listing-details { padding: var(--space-3); }
.listing-title { font-size: var(--fs-small); font-weight: var(--fw-semibold); }
.listing-price { font-size: var(--fs-body); font-weight: var(--fw-bold); color: var(--text-brand); margin-top: var(--space-1); }
.listing-meta { font-size: var(--fs-micro); color: var(--text-tertiary); margin-top: var(--space-1); display: flex; gap: var(--space-2); }

.business-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  transition: all var(--dur-fast) var(--ease-out);
}
.business-card:hover { box-shadow: var(--shadow-sm); }
.business-logo { width: 56px; height: 56px; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-sunken); flex-shrink: 0; }
.business-info { flex: 1; min-width: 0; }
.business-name { font-weight: var(--fw-semibold); font-size: var(--fs-small); }
.business-category { font-size: var(--fs-micro); color: var(--text-tertiary); }
.business-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); font-size: var(--fs-micro); color: var(--text-tertiary); }

/* ===========================================================================
   20. TABS
   ========================================================================= */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-subtle);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: var(--space-3) var(--space-5);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--dur-fast) var(--ease-out);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: var(--fs-small);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab.active {
  color: var(--text-brand);
  border-bottom-color: var(--brand);
  font-weight: var(--fw-semibold);
}
.tab:hover:not(.active) { color: var(--text-primary); }

/* ===========================================================================
   21. MODAL
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: calc(var(--z-sheet) - 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--dur-fast) var(--ease-out);
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: scaleIn var(--dur-base) var(--ease-spring);
}
.modal-header {
  padding: var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 {
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
}
.modal-content { padding: var(--space-5); }
.modal-close {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  transition: all var(--dur-fast);
  background: none;
  border: none;
  cursor: pointer;
}
.modal-close:hover { background: var(--surface-sunken); color: var(--text-primary); }

/* ===========================================================================
   22. LIGHTBOX
   ========================================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 200ms var(--ease-out);
}
.lightbox img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  display: grid;
  place-items: center;
  font-size: 24px;
  cursor: pointer;
  border: none;
  z-index: 1;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox__counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
}
.lightbox__prev, .lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  font-size: 20px;
}
.lightbox__prev { left: 16px; }
.lightbox__next { right: 16px; }
.lightbox__prev:hover, .lightbox__next:hover { background: rgba(255, 255, 255, 0.25); }

/* ===========================================================================
   23. IMAGE GALLERY (legacy)
   ========================================================================= */
.image-gallery {
  display: grid;
  gap: 3px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-3);
}
.image-gallery.grid-1 { grid-template-columns: 1fr; }
.image-gallery.grid-2 { grid-template-columns: 1fr 1fr; }
.image-gallery.grid-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}
.image-gallery.grid-3 .gallery-item:first-child { grid-column: 1 / -1; }
.image-gallery.grid-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.gallery-item {
  aspect-ratio: 1/1;
  overflow: hidden;
  position: relative;
  background: var(--surface-sunken);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease-out);
}
.gallery-item:hover img { transform: scale(1.05); }

/* ===========================================================================
   24. AI CHAT PAGE
   ========================================================================= */
.ai-chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-canvas);
}

.ai-header {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  height: var(--header-height);
  background: var(--gradient-silk);
  color: var(--on-brand-silk);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}
.ai-header .btn-icon { color: var(--on-brand-silk); }
.ai-header .btn-icon:hover { background: rgba(255,255,255,0.15); }
.ai-header-left { display: flex; align-items: center; }
.ai-header-center { flex: 1; text-align: center; }
.ai-header-right { display: flex; align-items: center; }

.ai-header-title {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  color: var(--on-brand-silk);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ai-header-subtitle {
  font-size: var(--fs-micro);
  opacity: 0.8;
}

.ai-credit-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  color: white;
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  border: 1.5px solid rgba(255,255,255,0.3);
}
.ai-credit-badge:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.ai-chat-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: 140px;
}

.ai-msg {
  display: flex;
  gap: var(--space-3);
  max-width: 90%;
  animation: slideUp var(--dur-base) var(--ease-out);
}
.ai-msg-user { justify-content: flex-end; align-self: flex-end; }
.ai-msg-ai { justify-content: flex-start; align-self: flex-start; }

.ai-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--gradient-silk);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-brand-silk);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgb(255 82 51 / 0.3);
}
.ai-msg-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}
.ai-msg-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: var(--fs-small);
  line-height: var(--lh-relaxed);
  word-wrap: break-word;
}
.ai-msg-bubble-user {
  background: var(--gradient-brand);
  color: var(--on-brand);
  border-bottom-right-radius: var(--radius-xs);
  box-shadow: 0 2px 8px rgb(255 82 51 / 0.25);
}
.ai-msg-bubble-ai {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
}

.ai-typing {
  display: flex;
  gap: 5px;
  padding: 16px 20px;
  align-items: center;
}
.ai-typing span {
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: var(--radius-full);
  animation: bounce 1.4s infinite ease-in-out both;
}
.ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing span:nth-child(2) { animation-delay: -0.16s; }

.ai-quick-categories {
  padding: 0 var(--space-4) var(--space-3);
  flex-shrink: 0;
}
.ai-quick-categories-scroll {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: var(--space-1) 0;
}
.ai-quick-categories-scroll::-webkit-scrollbar { display: none; }

.ai-category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  min-width: 80px;
  flex-shrink: 0;
}
.ai-category-btn:hover {
  border-color: var(--brand);
  background: var(--brand-wash);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.ai-category-icon { font-size: 24px; }
.ai-category-label {
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  white-space: nowrap;
}
.ai-category-btn:hover .ai-category-label { color: var(--text-brand); }

.ai-input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
  z-index: 20;
}
.ai-input-form {
  display: flex;
  gap: var(--space-2);
  max-width: 560px;
  margin: 0 auto;
}
@media (min-width: 1024px) {
  .ai-input-form { max-width: 640px; }
}
.ai-input-field {
  flex: 1;
  padding: 14px 20px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--fs-body);
  background: var(--surface-sunken);
  color: var(--text-primary);
  transition: all var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.ai-input-field:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-wash);
  outline: none;
}

.ai-send-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--gradient-silk);
  color: var(--on-brand-silk);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-spring);
  border: none;
  box-shadow: var(--glow-coral);
  flex-shrink: 0;
}
.ai-send-btn:hover { transform: scale(1.08); box-shadow: var(--glow-coral-lg); }
.ai-send-btn:active { transform: scale(0.95); }

.ai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  animation: fadeIn var(--dur-slow) var(--ease-out);
}
.ai-welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-2xl);
  background: var(--gradient-silk);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-brand-silk);
  margin-bottom: var(--space-5);
  box-shadow: var(--glow-coral-lg);
}
.ai-welcome-title {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-black);
  background: var(--gradient-silk);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2);
}
.ai-welcome-desc {
  font-size: var(--fs-small);
  color: var(--text-tertiary);
  max-width: 340px;
  line-height: var(--lh-relaxed);
  margin-bottom: var(--space-6);
}

.ai-quick-searches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  max-width: 500px;
}
.ai-quick-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.ai-quick-search-btn:hover {
  border-color: var(--brand);
  color: var(--text-brand);
  background: var(--brand-wash);
  transform: translateY(-1px);
}

.ai-results-section { margin-top: var(--space-3); }
.ai-results-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.ai-result-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  margin-bottom: var(--space-2);
}
.ai-result-card:hover {
  background: var(--surface);
  border-color: var(--brand-wash-2);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}
.ai-result-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-result-info { flex: 1; min-width: 0; }
.ai-result-name {
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.ai-result-badge {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-wash);
  color: var(--text-brand);
  text-transform: capitalize;
}
.ai-result-verified { font-size: 10px; font-weight: var(--fw-bold); color: var(--sig-verified); }
.ai-result-rating { font-size: 10px; font-weight: var(--fw-bold); color: var(--gold-400); }
.ai-result-price { font-size: 11px; font-weight: var(--fw-bold); color: var(--text-brand); }
.ai-result-location { font-size: var(--fs-micro); color: var(--text-tertiary); margin-top: 2px; }

.ai-paywall-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--gradient-silk);
  color: var(--on-brand-silk);
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-spring);
  box-shadow: var(--glow-coral-lg);
  margin-top: var(--space-2);
  width: 100%;
}
.ai-paywall-btn:hover { transform: translateY(-2px); }

.ai-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: calc(var(--z-sheet) - 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--dur-fast) var(--ease-out);
  backdrop-filter: blur(4px);
}
.ai-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn var(--dur-base) var(--ease-spring);
}
.ai-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.ai-modal-header h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
}
.ai-modal-subtitle { font-size: var(--fs-small); color: var(--text-tertiary); margin-top: 4px; }
.ai-modal-body { padding: var(--space-5); }
.ai-modal-spinner { display: flex; justify-content: center; padding: var(--space-8); }
.ai-modal-footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); }
.ai-modal-note { font-size: var(--fs-micro); color: var(--text-tertiary); text-align: center; }

.ai-pack-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.ai-pack-card {
  position: relative;
  padding: var(--space-4);
  background: var(--surface-sunken);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.ai-pack-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.ai-pack-popular {
  border-color: var(--brand);
  background: var(--brand-wash);
}
.ai-pack-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 12px;
  background: var(--gradient-silk);
  color: var(--on-brand-silk);
  font-size: 10px;
  font-weight: var(--fw-bold);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.ai-pack-credits {
  font-size: var(--fs-h2);
  font-weight: var(--fw-black);
  color: var(--text-brand);
  line-height: 1;
}
.ai-pack-label { font-size: var(--fs-micro); color: var(--text-tertiary); margin-top: 2px; }
.ai-pack-price { font-size: var(--fs-lead); font-weight: var(--fw-bold); color: var(--text-primary); margin-top: var(--space-2); }
.ai-pack-per-credit { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }

/* ===========================================================================
   25. ACCESSIBILITY
   ========================================================================= */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .live-dot::after,
  .pin--live::after {
    animation: none;
    transform: scale(1.9);
    opacity: 0.45;
  }
}

@media (forced-colors: active) {
  .glass, .bottom-nav, .top-bar, .toast {
    background: Canvas;
    backdrop-filter: none;
    border: 1px solid CanvasText;
  }
  .post-card { border: 1px solid CanvasText; }
}

/* ===========================================================================
   26. UTILITIES
   ========================================================================= */
.hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }
.pulse { animation: pulse 3s ease-in-out infinite; }
.dialog-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-4);
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-default);
  border-top-color: var(--brand);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-sheet);
  backdrop-filter: blur(4px);
}

/* Comment card */
.comment-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}
.comment-card .comment-body { flex: 1; }
.comment-card .comment-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); }
.comment-card .comment-author { font-weight: var(--fw-semibold); font-size: var(--fs-small); color: var(--text-primary); }
.comment-card .comment-time { font-size: var(--fs-micro); color: var(--text-tertiary); }
.comment-card .comment-content { font-size: var(--fs-small); color: var(--text-primary); line-height: var(--lh-relaxed); }
.comment-card .comment-actions { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); }

/* PWA Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: var(--space-4);
  right: var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-nav);
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideUp var(--dur-slow) var(--ease-out);
  border: 1px solid var(--border-subtle);
}
.banner-content strong { display: block; font-size: var(--fs-body); color: var(--text-primary); }
.banner-content p { font-size: var(--fs-micro); color: var(--text-tertiary); margin-top: 2px; }
.banner-actions { display: flex; gap: var(--space-2); }

/* Notification item */
.notification-item {
  padding: var(--space-4);
  display: flex;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--dur-fast);
  cursor: pointer;
}
.notification-item:hover { background: var(--surface-hover); }
.notification-item.unread { background: var(--brand-wash); }

/* ===========================================================================
   25. MESSAGING — Otlo Theme
   ========================================================================= */

/* Messages List Page */
.msg-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-canvas);
}

.msg-tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 56px;
  z-index: 10;
}

.msg-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  transition: color var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.msg-tab:hover { color: var(--text-secondary); }
.msg-tab.active {
  color: var(--text-brand);
  font-weight: var(--fw-semibold);
}
.msg-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-6);
  right: var(--space-6);
  height: 2px;
  background: var(--brand-action);
  border-radius: var(--radius-full);
}

.msg-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--sig-emergency);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--fw-bold);
}

.msg-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--space-6);
}

.msg-list {
  display: flex;
  flex-direction: column;
}

/* Conversation Item */
.msg-conversation-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--gutter);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  border-bottom: var(--hairline) solid var(--border-subtle);
}
.msg-conversation-item:hover { background: var(--surface-hover); }
.msg-conversation-item.unread { background: var(--brand-wash); }

.msg-conv-avatar { flex-shrink: 0; }

.msg-conv-info {
  flex: 1;
  min-width: 0;
}

.msg-conv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.msg-conv-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-conv-time {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-left: var(--space-2);
}

.msg-conv-snippet {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-conversation-item.unread .msg-conv-snippet {
  color: var(--text-primary);
  font-weight: var(--fw-medium);
}

.msg-conv-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--brand-action);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

/* Section Labels */
.msg-section-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--gutter);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--surface-sunken);
}

/* Request Items */
.msg-requests {
  display: flex;
  flex-direction: column;
}

.msg-req-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--gutter);
  border-bottom: var(--hairline) solid var(--border-subtle);
}

.msg-req-avatar { flex-shrink: 0; }

.msg-req-info {
  flex: 1;
  min-width: 0;
}

.msg-req-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  color: var(--text-primary);
}

.msg-req-time {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
}

.msg-req-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.msg-req-accept {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--brand-action);
  color: #FFFFFF;
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.msg-req-accept:hover { background: var(--coral-700); box-shadow: var(--glow-coral); }

.msg-req-reject {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  border: var(--hairline) solid var(--border-default);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.msg-req-reject:hover { background: var(--surface-hover); color: var(--text-primary); }

.msg-req-status {
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.msg-req-status.pending {
  background: var(--sig-traffic-bg);
  color: var(--sig-traffic-ink);
}
.msg-req-status.accepted {
  background: var(--sig-verified-bg);
  color: var(--sig-verified-ink);
}
.msg-req-status.rejected {
  background: var(--surface-sunken);
  color: var(--text-tertiary);
}

/* ===========================================================================
   26. CHAT PAGE — Otlo Theme
   ========================================================================= */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-canvas);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-back { color: var(--text-secondary); }

.chat-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.chat-user-avatar { flex-shrink: 0; }

.chat-user-name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  gap: var(--space-2);
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-loading {
  display: flex;
  justify-content: center;
  padding: var(--space-8);
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-3);
  color: var(--text-tertiary);
}
.chat-empty-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-icon);
  background: var(--brand-wash);
  color: var(--brand);
}

/* Chat Bubbles */
.chat-bubble {
  display: flex;
  gap: var(--space-2);
  max-width: 78%;
  animation: slideUp var(--dur-base) var(--ease-out);
}

.chat-bubble.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble.theirs {
  align-self: flex-start;
}

.chat-bubble-avatar { flex-shrink: 0; align-self: flex-end; }

.chat-bubble-content {
  display: flex;
  flex-direction: column;
}

.chat-bubble.mine .chat-bubble-content {
  align-items: flex-end;
}

.chat-bubble.theirs .chat-bubble-content {
  align-items: flex-start;
}

.chat-text {
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  word-wrap: break-word;
}

.chat-bubble.mine .chat-text {
  background: var(--gradient-brand);
  color: var(--on-brand);
  border-bottom-right-radius: var(--radius-xs);
  box-shadow: 0 2px 8px rgb(255 82 51 / 0.2);
}

.chat-bubble.theirs .chat-text {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs);
}

.chat-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  object-fit: cover;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out);
}
.chat-image:hover { transform: scale(1.02); }

.chat-time {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  margin-top: 2px;
  padding: 0 var(--space-2);
}

/* Chat Input Bar */
.chat-input-bar {
  padding: var(--space-2) var(--space-3);
  padding-bottom: calc(var(--space-2) + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  background: var(--surface-sunken);
  border: var(--hairline) solid transparent;
  transition: all var(--dur-fast) var(--ease-out);
}

.chat-input-wrapper:focus-within {
  background: var(--surface);
  border-color: var(--brand-action);
  box-shadow: 0 0 0 3px var(--brand-wash);
}

.chat-input {
  flex: 1;
  border: none;
  background: none;
  padding: var(--space-2);
  font-size: var(--fs-body);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}
.chat-input::placeholder { color: var(--text-tertiary); }

.chat-img-btn, .chat-send-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease-out);
}

.chat-img-btn {
  background: none;
  color: var(--text-tertiary);
}
.chat-img-btn:hover { color: var(--text-brand); background: var(--brand-wash); }

.chat-send-btn {
  background: var(--brand-action);
  color: #FFFFFF;
}
.chat-send-btn:hover { background: var(--coral-700); box-shadow: var(--glow-coral); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Send Request Button on Profile */
.msg-send-request {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  color: var(--on-brand);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--glow-coral);
  font-family: inherit;
}
.msg-send-request:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow-coral-lg);
}
.msg-send-request:active { transform: scale(0.97); }
.msg-send-request:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
