/* ════════════════════════════════════════════════════════════
   KOLO.ci — Global Design System
   CI flag colors: Green #009A44 · Orange #F77F00
   ════════════════════════════════════════════════════════════ */

:root {
  /* Brand colors */
  --green:    #009A44;
  --green-2:  #00C454;
  --green-3:  #006e30;
  --orange:   #F77F00;
  --orange-2: #FFA040;

  /* Background scale */
  --bg:       #06101f;
  --card:     #0d1b2e;
  --card-2:   #111D2E;
  --border:   rgba(255,255,255,.07);

  /* Text */
  --text:     #ffffff;
  --muted:    rgba(255,255,255,.5);
  --subtle:   rgba(255,255,255,.25);

  /* Status */
  --success:  #00C454;
  --warning:  #F5C842;
  --danger:   #E24B4A;
  --info:     #378ADD;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --nav-h:    64px;
  --radius:   12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Bottom nav safe area */
.page { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }

/* Buttons */
.btn-primary {
  background: var(--green); color: var(--bg);
  border: none; border-radius: var(--radius);
  padding: 14px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%;
  box-shadow: 0 6px 20px rgba(0,154,68,.3);
  transition: transform .15s, box-shadow .15s;
}
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 20px; font-size: 14px; cursor: pointer; width: 100%;
}

/* Cards */
.card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

/* Bottom navigation */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--card);
  border-top: 0.5px solid var(--border);
  display: flex; align-items: flex-start;
  padding-top: 8px;
  z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  font-size: 10px; color: var(--muted); cursor: pointer;
  text-decoration: none;
}
.nav-item.active { color: var(--green); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-item-primary .nav-icon {
  background: var(--green); color: var(--bg);
  width: 44px; height: 44px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  margin-top: -18px; font-size: 22px;
  box-shadow: 0 6px 16px rgba(0,154,68,.4);
}
.nav-item-primary { gap: 0; }
.nav-item-primary span:last-child { margin-top: 4px; }

/* ════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.muted  { color: var(--muted); font-size: 14px; }

button { font-family: inherit; }
button[disabled],
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

a { color: inherit; }

/* ════════════════════════════════════════════════════════════
   FORM CONTROLS
   ════════════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.input,
.select,
.textarea {
  width: 100%;
  background: var(--card-2);
  color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 16px; /* ≥16px prevents iOS zoom-on-focus */
  font-family: inherit;
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.4; }
.input:focus,
.select:focus,
.textarea:focus { outline: none; border-color: var(--green); }

/* ════════════════════════════════════════════════════════════
   BRAND
   ════════════════════════════════════════════════════════════ */
.brand      { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.brand .dot { color: var(--orange); }
.brand-mini { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-mini .dot { color: var(--orange); }

/* ── Official KOLO logo lockups ─────────────────────────────────────────────
 * SVGs in src/assets/icons/. The brand background rect has been removed
 * from the source files — logos float on transparency.                   */
.kolo-icon, .brand-h {
  display: block;
  background: transparent;
  overflow: visible;       /* don't clip drop-shadow halos */
}
.kolo-icon {              /* Login splash + auth screens */
  width: 140px; height: 140px;
  margin: 0 auto;
  filter: drop-shadow(0 8px 32px rgba(0,154,68,.22));
}
.brand-h {                /* Horizontal lockup in app headers
                           * Inline SVG sizes itself via the height attribute */
  flex-shrink: 0;
}
.kolo-face-anim {       /* Used by pull-to-refresh */
  display: block;
  height: 40px;
  width: auto;
  margin: 0 auto;
}

/* ════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════ */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px);
  transform: translateX(-50%);
  background: var(--card); color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 200;
  animation: toast-in .2s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ════════════════════════════════════════════════════════════
   SKELETON
   ════════════════════════════════════════════════════════════ */
.skel {
  background: linear-gradient(90deg, var(--card-2) 25%, rgba(255,255,255,.03) 50%, var(--card-2) 75%);
  background-size: 200% 100%;
  animation: skel-pulse 1.4s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes skel-pulse {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════════
   AUTH PAGE (/login)
   ════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center;
}
.auth-logo      { text-align: center; margin-bottom: 32px; }
.auth-logo .tagline { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth-step      { max-width: 480px; margin: 0 auto; width: 100%; }
.auth-step h2   { font-size: 24px; margin-bottom: 6px; font-weight: 700; }
.auth-step p    { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.auth-form      { display: flex; flex-direction: column; gap: 12px; }
.phone-input {
  display: flex; align-items: center;
  background: var(--card-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.phone-input .prefix { padding: 0 8px 0 16px; color: var(--muted); font-size: 16px; }
.phone-input input   {
  flex: 1; background: transparent; border: 0;
  padding: 14px 16px 14px 0; color: var(--text); font-size: 16px;
}
.phone-input input:focus { outline: none; }
.otp-input {
  background: var(--card-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 28px; font-weight: 700; text-align: center;
  letter-spacing: 18px;
  color: var(--text); width: 100%;
}
.otp-input:focus { outline: none; border-color: var(--green); }
.legal {
  color: var(--subtle); font-size: 11px; line-height: 1.5;
  margin-top: 16px; text-align: center;
}
.auth-error,
.form-error {
  margin-top: 12px;
  background: rgba(226,75,74,.12);
  border: 0.5px solid rgba(226,75,74,.4);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ════════════════════════════════════════════════════════════
   PAGE HEADER (sub-pages)
   ════════════════════════════════════════════════════════════ */
.page-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  position: sticky; top: 0; z-index: 50; background: var(--bg);
  border-bottom: 0.5px solid var(--border);
}
.back-btn {
  background: var(--card); border: 0.5px solid var(--border);
  width: 36px; height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; color: var(--text);
}
.page-header h1 { font-size: 17px; font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   HOME PAGE (/)
   ════════════════════════════════════════════════════════════ */
.home-header {
  position: sticky; top: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.loc-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--card); color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12px; cursor: pointer;
}
.loc-chip.active { color: var(--green); border-color: rgba(0,154,68,.3); }

.cat-bar {
  display: flex; gap: 8px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  background: var(--card); color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 999px; padding: 8px 14px;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.cat-chip.active {
  background: var(--green); color: var(--bg);
  border-color: var(--green); font-weight: 600;
}

.ptr-track {
  height: 0; overflow: hidden; text-align: center;
  transition: height .2s ease;
}
.ptr-track.show { height: 48px; }
.ptr-spinner {
  display: inline-block;
  height: 40px; line-height: 40px;
  animation: ptr-bounce 1s ease-in-out infinite;
}
.ptr-spinner img { display: block; height: 40px; width: auto; }
@keyframes ptr-bounce {
  0%, 100% { transform: scale(1);    }
  50%      { transform: scale(1.12); }
}

.feed {
  padding: 0 12px 16px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
@media (min-width: 540px) { .feed { grid-template-columns: repeat(3, 1fr); } }

.listing-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column;
}
.listing-card:active { transform: scale(.98); }
.listing-card .thumb {
  width: 100%; aspect-ratio: 1;
  object-fit: cover; background: var(--card-2);
  display: block;
}
.listing-card .body { padding: 10px 12px 12px; }
.listing-card .title {
  font-size: 13px; line-height: 1.3; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 34px; word-break: break-word;
}
.listing-card .price {
  font-weight: 700; font-size: 14px; color: var(--green-2);
  margin-top: 6px;
}
.listing-card .meta {
  margin-top: 6px; display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--muted); flex-wrap: wrap;
}
.dist-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(0,154,68,.18); color: var(--green-2);
  padding: 2px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 600;
}
.feed-info {
  grid-column: 1 / -1;
  padding: 32px 16px; text-align: center;
  color: var(--muted); font-size: 14px;
}
.feed-info.error { color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   SEARCH PAGE (/search)
   ════════════════════════════════════════════════════════════ */
.search-header {
  position: sticky; top: 0; z-index: 50; background: var(--bg);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
}
.search-back {
  flex: 0 0 auto;
  background: transparent; color: var(--text);
  border: none; cursor: pointer;
  font-size: 22px; line-height: 1;
  padding: 6px 8px;
}
.search-input-wrap {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
}
.search-icon { font-size: 14px; opacity: .7; }
.search-input {
  flex: 1; min-width: 0;
  background: transparent; color: var(--text);
  border: none; outline: none;
  font-size: 15px; font-family: inherit;
}
.search-input::placeholder { color: var(--muted); }
.search-clear {
  background: transparent; color: var(--muted);
  border: none; cursor: pointer;
  font-size: 13px; padding: 2px 4px;
}

.search-empty {
  grid-column: 1 / -1;
  padding: 16px 4px;
}
.search-section-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 8px 4px 12px;
}
.recent-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 4px;
}
.recent-chip {
  background: var(--card); color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.recent-chip:active { background: var(--card-2); }
.recent-clear {
  background: transparent; color: var(--muted);
  border: none; cursor: pointer;
  font-size: 12px; padding: 8px 10px;
  font-family: inherit;
}
.search-hint {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted); font-size: 14px; line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════
   SELL PAGE (/sell)
   ════════════════════════════════════════════════════════════ */
.sell-form { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.photo-slot {
  aspect-ratio: 1; background: var(--card-2);
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; position: relative; overflow: hidden;
  font-size: 11px; padding: 4px; text-align: center;
}
.photo-slot.has-photo { border-style: solid; padding: 0; border-color: var(--border); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .remove {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.65); color: white;
  border: 0; width: 22px; height: 22px; border-radius: 999px;
  font-size: 12px; cursor: pointer; line-height: 22px;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.q-meter {
  background: var(--card-2); border-radius: var(--radius);
  padding: 12px 14px; border: 0.5px solid var(--border);
}
.q-meter .top { display: flex; justify-content: space-between; align-items: baseline; }
.q-meter .label { color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; }
.q-meter .value { font-size: 20px; font-weight: 700; color: var(--green-2); }
.q-bar {
  height: 6px; background: rgba(255,255,255,.06); border-radius: 999px;
  overflow: hidden; margin-top: 10px;
}
.q-fill {
  height: 100%; background: linear-gradient(90deg, var(--orange), var(--green));
  transition: width .3s ease;
}
.q-meter .hint { color: var(--muted); font-size: 11px; margin-top: 8px; }

.label-row { display: flex; justify-content: space-between; align-items: center; }
.voice-btn {
  background: var(--card-2); border: 0.5px solid var(--border);
  border-radius: 999px; padding: 4px 10px;
  color: var(--muted); font-size: 11px; cursor: not-allowed;
  display: inline-flex; align-items: center; gap: 4px;
}

/* ════════════════════════════════════════════════════════════
   LISTING DETAIL (/listing/:id)
   ════════════════════════════════════════════════════════════ */
.listing-detail .gallery {
  display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.listing-detail .gallery::-webkit-scrollbar { display: none; }
.listing-detail .gallery img {
  flex: 0 0 100%;
  width: 100%; aspect-ratio: 1;
  object-fit: cover; scroll-snap-align: start;
  background: var(--card-2);
}
.listing-detail .gallery .gallery-empty {
  flex: 0 0 100%; aspect-ratio: 1; background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--subtle); font-size: 36px;
}
.detail-container { padding: 16px; }
.price-row {
  font-size: 28px; font-weight: 800; color: var(--green-2);
  margin-bottom: 4px;
}
.detail-container h1 {
  font-size: 18px; font-weight: 600; line-height: 1.3; margin-bottom: 12px;
}
.detail-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.tag {
  background: var(--card-2); border: 0.5px solid var(--border);
  border-radius: 999px; padding: 4px 10px;
  font-size: 11px; color: var(--muted);
}
.seller-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius-lg);
  padding: 14px; border: 0.5px solid var(--border);
  margin-bottom: 16px;
}
.seller-avatar {
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--green); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.seller-info       { flex: 1; min-width: 0; }
.seller-info .name { font-weight: 600; font-size: 14px; }
.seller-info .badges {
  font-size: 11px; color: var(--muted);
  margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap;
}
.trust-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(11,191,122,.16); color: var(--success);
  border-radius: 999px; padding: 3px 8px;
  font-size: 11px; font-weight: 600;
}
.trust-badge.med { background: rgba(245,200,66,.15); color: var(--warning); }
.trust-badge.low { background: rgba(226,75,74,.15); color: var(--danger); }
.description {
  color: var(--text); font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; margin-bottom: 16px;
}

.cta-bar {
  position: fixed; bottom: var(--nav-h); left: 0; right: 0;
  background: var(--bg);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--border);
  display: flex; gap: 12px; z-index: 90;
}
.cta-bar .btn-primary,
.cta-bar .btn-secondary { flex: 1; }
.with-cta { padding-bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom)); }

/* ════════════════════════════════════════════════════════════
   MODAL (payment picker, etc.)
   ════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 300;
  animation: fade-in .15s;
}
.modal {
  background: var(--card);
  width: 100%; max-width: 480px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  animation: slide-up .2s ease;
}
.modal h3 { font-size: 17px; margin-bottom: 16px; font-weight: 600; }
.payment-options {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px;
}
.payment-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--card-2);
  border: 0.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; text-align: left; width: 100%;
  color: var(--text); font-size: 14px; font-weight: 500;
}
.payment-opt.selected {
  border-color: var(--green); background: rgba(0,154,68,.10);
}
.payment-opt-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: var(--bg); border-radius: var(--radius-sm);
}
.payment-opt .opt-sub {
  display: block; color: var(--muted); font-size: 11px;
  font-weight: 400; margin-top: 2px;
}

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

/* ════════════════════════════════════════════════════════════
   CHAT PAGE (/chat/:dealId)
   ════════════════════════════════════════════════════════════ */
.chat-page {
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh;          /* iOS keyboard-aware */
  overflow: hidden;
}
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.chat-header .back-btn { flex-shrink: 0; }
.chat-header .title-block { flex: 1; min-width: 0; }
.chat-header .title {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-header .sub {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px;
}
.status-pill {
  display: inline-flex; align-items: center;
  background: rgba(0,154,68,.16); color: var(--green-2);
  border-radius: 999px; padding: 2px 8px;
  font-size: 10px; font-weight: 600;
}
.status-pill.warn { background: rgba(245,200,66,.15); color: var(--warning); }
.status-pill.alert{ background: rgba(226,75,74,.16); color: var(--danger); }
.status-pill.info { background: rgba(55,138,221,.16); color: var(--info); }
.summary-btn {
  background: var(--card); border: 0.5px solid var(--border);
  width: 36px; height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; color: var(--text);
  flex-shrink: 0;
}

.chat-context {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.chat-context img {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--card-2); flex-shrink: 0;
}
.chat-context .info { flex: 1; min-width: 0; }
.chat-context .info .item {
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-context .info .price {
  font-size: 12px; color: var(--green-2); font-weight: 700;
}

.chat-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 4px;
  display: flex; flex-direction: column; gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.chat-list .ptr-spinner-inline {
  align-self: center; padding: 8px;
  font-size: 14px; color: var(--muted);
}

.msg {
  display: flex; flex-direction: column;
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px; line-height: 1.4;
  word-break: break-word;
}
.msg.them {
  align-self: flex-start;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.me {
  align-self: flex-end;
  background: var(--green); color: var(--bg);
  border-bottom-right-radius: 4px;
}
.msg .time {
  font-size: 10px; opacity: 0.7;
  margin-top: 3px; text-align: right;
}
.msg.them .time { color: var(--muted); }
.msg.system {
  align-self: center;
  background: transparent; color: var(--muted);
  font-size: 11px; padding: 4px 10px;
  border: 0.5px dashed var(--border);
  border-radius: 999px;
  max-width: 90%;
}
.msg.placeholder { font-style: italic; opacity: 0.7; }

.chat-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 24px;
}

.chat-input-bar {
  display: flex; gap: 8px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 0.5px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--card-2);
  color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 16px;          /* prevents iOS zoom-on-focus */
  font-family: inherit;
  resize: none;
  max-height: 120px;
  min-height: 42px;
  line-height: 1.4;
}
.chat-input:focus { outline: none; border-color: var(--green); }
.send-btn {
  background: var(--green); color: var(--bg);
  border: 0; border-radius: 999px;
  width: 42px; height: 42px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  align-self: flex-end;
}
.send-btn[disabled] { opacity: 0.4; }

.chat-disabled-banner {
  text-align: center; padding: 10px 12px;
  background: var(--card);
  color: var(--muted); font-size: 12px;
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
}

/* AI summary modal extras */
.summary-content { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.summary-card {
  background: var(--card-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px; line-height: 1.5;
}
.summary-card .label {
  display: block; margin-bottom: 4px;
  color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
}
.summary-redflags {
  background: rgba(226,75,74,.10);
  border-color: rgba(226,75,74,.4);
  color: var(--danger);
}
.summary-redflags .label { color: var(--danger); opacity: 0.8; }
.summary-redflags ul { margin: 0; padding-left: 18px; }
.summary-redflags li { margin-top: 2px; }

/* ════════════════════════════════════════════════════════════
   PROFILE PAGE (/profile)
   ════════════════════════════════════════════════════════════ */
.profile-page { padding-bottom: var(--nav-h); }
.prof-loading {
  text-align: center; color: var(--muted);
  padding: 32px 16px; font-size: 14px;
}
.prof-empty {
  color: var(--muted); font-size: 13px;
  text-align: center; padding: 16px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.prof-link {
  color: var(--green-2); text-decoration: none;
  font-weight: 600; font-size: 13px;
}

/* Hero */
.prof-hero {
  text-align: center;
  padding: 24px 16px 16px;
}
.prof-name {
  font-size: 18px; font-weight: 700;
  margin-top: 16px;
}
.prof-rank {
  font-size: 13px; color: var(--muted);
  margin-top: 4px;
}
.prof-badges {
  display: flex; flex-wrap: wrap;
  gap: 6px; justify-content: center;
  margin-top: 14px;
}

/* Trust ring */
.trust-ring-lg {
  position: relative;
  width: 140px; height: 140px;
  margin: 0 auto;
}
.trust-ring-svg {
  position: absolute; inset: 0;
}
.trust-ring-face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.trust-score-line {
  margin-top: 12px;
  font-size: 14px; color: var(--muted);
  display: flex; align-items: baseline;
  justify-content: center; gap: 2px;
}
.trust-score-line .num {
  font-size: 28px; font-weight: 800; color: var(--text);
  letter-spacing: -0.02em;
}
.trust-score-line .out { color: var(--muted); font-size: 14px; }

/* Sections */
.prof-section {
  padding: 16px;
  border-top: 0.5px solid var(--border);
}
.prof-section h2 {
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 12px;
}

/* Stats grid */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-value {
  font-size: 22px; font-weight: 700;
  color: var(--text); line-height: 1.1;
}
.stat-label {
  font-size: 10px; color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase; letter-spacing: .05em;
}

/* Merchant Pro upsell card */
.merchant-pro {
  margin: 0 16px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--orange) 0%, #d65f00 100%);
  color: var(--bg);
  display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(247,127,0,.25);
}
.merchant-pro::after {
  /* subtle highlight ring */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% -20%, rgba(255,255,255,.18), transparent 60%);
  pointer-events: none;
}
.mp-icon  { font-size: 28px; flex-shrink: 0; }
.mp-body  { flex: 1; min-width: 0; }
.mp-title { font-size: 15px; font-weight: 800; }
.mp-sub   { font-size: 12px; margin-top: 2px; opacity: .85; line-height: 1.3; }
.mp-cta {
  background: var(--bg); color: #fff;
  border: 0; border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 11px; font-weight: 700;
  font-family: inherit; cursor: pointer; flex-shrink: 0;
  white-space: nowrap;
}
.mp-cta:active { transform: scale(.98); }

/* My listings grid (compact) */
.my-listings-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Settings */
.settings-list {
  display: flex; flex-direction: column; gap: 8px;
}
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; color: var(--text);
}
.lang-toggle {
  display: inline-flex; gap: 0;
  background: var(--card-2);
  border-radius: 999px; padding: 2px;
}
.lang-opt {
  background: transparent; color: var(--muted);
  border: 0; padding: 5px 12px;
  font-size: 11px; font-weight: 700;
  border-radius: 999px;
  font-family: inherit; cursor: pointer;
  letter-spacing: .04em;
}
.lang-opt.active {
  background: var(--green); color: var(--bg);
}

/* iOS-style switch */
.switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--card-2);
  border-radius: 999px;
  transition: background-color .2s;
}
.switch .slider::before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.switch input:checked + .slider              { background: var(--green); }
.switch input:checked + .slider::before      { transform: translateX(20px); }

.settings-logout {
  background: rgba(226,75,74,.10);
  color: var(--danger);
  border: 1px solid rgba(226,75,74,.35);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 14px; font-weight: 600;
  margin-top: 4px;
  font-family: inherit; cursor: pointer;
}
.settings-logout:active { transform: scale(.99); }

