[hidden] { display: none !important; }
:root {
  --bg:           #f5f2ea;
  --surface:      #ffffff;
  --surface-2:    #faf6eb;
  --surface-3:    #f0ead9;
  --ink:          #1a1815;
  --ink-2:        #4a453c;
  --muted:        #8a8275;
  --line:         #e7e0d0;
  --line-strong:  #d6cdb6;
  --gold:         #a67c2e;
  --gold-deep:    #7a5a1f;
  --gold-soft:    #f7eed6;
  --buy:          #3a7a5e;
  --buy-deep:     #1f5741;
  --buy-soft:     #e3f0e8;
  --success:      #4a7c59;
  --danger:       #a8432a;
  --radius:       14px;
  --radius-sm:    10px;
  --radius-lg:    20px;
  --shadow-sm:    0 1px 2px rgba(26,24,21,.04);
  --shadow-md:    0 4px 14px rgba(26,24,21,.07), 0 1px 3px rgba(26,24,21,.04);
  --shadow-lg:    0 16px 40px rgba(26,24,21,.12);
  --font-serif:   'Fraunces', ui-serif, Georgia, serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; overflow-x: hidden; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font-sans);
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ TEXT-OVERFLOW GUARD ============ */
.listing h3, .listing-desc, .listing-location,
.detail-heading h1, .detail-desc, .detail-location span,
.thread-title, .thread-preview, .peer-name, .peer-sub,
.msg, .msg-location .loc-label, .msg-location .loc-coords,
.action-sheet-option .as-title, .action-sheet-option .as-sub,
.area-pick-row-value, .calc-result-value {
  overflow-wrap: anywhere; word-break: break-word; min-width: 0;
}

/* ============ HIDDEN UTIL ============ */
.hidden { display: none !important; }

/* ============ APP HEADER ============ */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 10px; background: var(--bg);
  position: relative; z-index: 5; flex-shrink: 0;
  gap: 8px;
}
.header-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wordmark { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.wordmark .mark { width: 24px; height: 24px; border-radius: 50%; display: block; object-fit: cover; }
.wordmark .name { font-family: var(--font-serif); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 100px; font-size: 12px; color: var(--ink-2);
  max-width: 120px;
}
.user-chip .handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong); flex-shrink: 0;
  transition: background .2s, box-shadow .2s;
}
.status-dot.on  { background: var(--success); box-shadow: 0 0 0 3px rgba(74,124,89,.14); }
.status-dot.off { background: #c9c1ac; }

.icon-btn-sm { width: 34px; height: 34px; }
.icon-btn-sm.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ============ STATUS BANNERS ============ */
.status-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  flex-shrink: 0;
  animation: banner-in .22s ease-out;
}
.status-banner svg { flex-shrink: 0; }
.status-banner > span { flex: 1; min-width: 0; }

@keyframes banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-banner.offline {
  background: #e8e5dd;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.status-banner.offline svg { color: var(--muted); }

.status-banner.update {
  background: linear-gradient(90deg, var(--gold-soft), #f2e5c2);
  color: var(--gold-deep);
  border-bottom: 1px solid rgba(166,124,46,.25);
}
.status-banner.update button {
  padding: 6px 14px;
  background: var(--gold-deep); color: #fff;
  border: none; border-radius: 100px;
  font: 600 12px/1 var(--font-sans);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, transform .06s;
}
.status-banner.update button:hover  { background: #6b4f1a; }
.status-banner.update button:active { transform: translateY(1px); }

/* ============ MAIN / PANELS ============ */
main { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.panel {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  display: none; padding-bottom: 110px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.panel.active { display: block; }

.panel-head { padding: 20px 20px 8px; }
.panel-head h1 {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 26px; letter-spacing: -0.015em; margin: 0 0 4px;
}
.panel-head p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }

.panel-nav {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 8px; flex-shrink: 0;
}
.panel-nav-title {
  flex: 1;
  font-family: var(--font-serif);
  font-weight: 600; font-size: 17px;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel-nav-spacer { width: 38px; flex-shrink: 0; }

/* ============ PULL TO REFRESH ============ */
.ptr-indicator {
  position: absolute; left: 50%; top: 6px;
  width: 34px; height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-deep);
  opacity: 0;
  transform: translateY(-40px);
  transition: opacity .15s, transform .15s;
  pointer-events: none;
  z-index: 3;
}
.ptr-indicator.visible { opacity: 1; }
.ptr-indicator.loading .ptr-spinner { animation: spin 0.9s linear infinite; }

/* ============ SEARCH + FILTER BAR ============ */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px 6px;
}

.search-wrap {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 8px 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-wrap:focus-within {
  border-color: var(--gold); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(166,124,46,.12);
}
.search-wrap > svg { color: var(--muted); flex-shrink: 0; }
.search-wrap input {
  flex: 1; min-width: 0;
  border: none; background: transparent; padding: 0;
  font: inherit; font-size: 14px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.search-wrap input::placeholder { color: #b3a893; }
.search-wrap input:focus { outline: none; }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-wrap input::-webkit-search-decoration { -webkit-appearance: none; }

.search-clear {
  width: 20px; height: 20px; flex-shrink: 0;
  border: none; cursor: pointer; padding: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.08);
  color: var(--ink-2);
  font: 600 14px/1 var(--font-sans);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.search-clear:hover { background: rgba(0,0,0,.14); }

.filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  font: 600 12.5px/1 var(--font-sans);
  color: var(--ink-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.filter-btn:hover { background: var(--surface-2); }
.filter-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-btn svg { flex-shrink: 0; }
.filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  background: var(--gold); color: #fff;
  font-size: 10px; font-weight: 700; font-style: normal;
}

.filter-chips-bar {
  padding: 0 16px 4px;
  overflow-x: auto; scrollbar-width: none;
}
.filter-chips-bar::-webkit-scrollbar { display: none; }
.filter-chips-bar.hidden { display: none; }

.filter-chips { display: flex; align-items: center; gap: 6px; }

/* ============ FILTER SHEET ============ */
.filter-section { display: flex; flex-direction: column; gap: 8px; }
.filter-section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-pill {
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  font: 500 13.5px/1 var(--font-sans);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.filter-pill:hover { background: var(--surface-2); }
.filter-pill.active {
  background: var(--gold-soft); color: var(--gold-deep);
  border-color: var(--gold);
  font-weight: 600;
}

.filter-actions {
  display: grid; grid-template-columns: auto 1fr; gap: 10px;
  margin-top: 8px;
}

/* ============ SKELETONS ============ */
@keyframes shimmer {
  0%   { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}
.skeleton {
  background:
    linear-gradient(
      90deg,
      var(--surface-2) 0%,
      var(--surface-3) 40%,
      var(--surface-2) 80%
    );
  background-size: 600px 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}
.skeleton-card {
  display: flex; gap: 12px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.skeleton-card .skel-thumb {
  width: 84px; height: 84px;
  border-radius: 10px;
  flex-shrink: 0;
}
.skeleton-card .skel-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.skeleton-card .skel-line { height: 12px; }
.skeleton-card .skel-line.w-60 { width: 60%; }
.skeleton-card .skel-line.w-80 { width: 80%; }
.skeleton-card .skel-line.w-40 { width: 40%; }

/* ============ AREA CHIP + PICK ROW ============ */
.area-chip {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 32px); margin: 16px 16px 4px;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit; color: inherit; cursor: pointer; text-align: left;
  box-shadow: var(--shadow-sm);
}
.area-chip:hover { box-shadow: var(--shadow-md); }
.area-chip > svg { color: var(--gold); flex-shrink: 0; }
.area-chip-text { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-chip-action {
  font-size: 12px; font-weight: 600; color: var(--gold-deep);
  padding: 4px 10px; background: var(--gold-soft); border-radius: 100px; flex-shrink: 0;
}

.area-pick-row {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 32px);
  margin: 4px 16px 12px;
  padding: 14px 14px;
  background: var(--gold-soft);
  border: 1px solid rgba(166,124,46,.25);
  border-radius: var(--radius);
  font: inherit; color: inherit; cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s;
}
.area-pick-row:hover { background: #f2e5c2; }
.area-pick-row.unset {
  background: var(--surface-2);
  border-color: var(--line-strong);
  border-style: dashed;
}
.area-pick-row-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(166,124,46,.15);
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
}
.area-pick-row.unset .area-pick-row-icon { background: var(--surface-3); color: var(--muted); }
.area-pick-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.area-pick-row-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gold-deep);
}
.area-pick-row.unset .area-pick-row-label { color: var(--muted); }
.area-pick-row-value {
  font-size: 14px; font-weight: 500; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.area-pick-row-chev { color: var(--gold-deep); flex-shrink: 0; }
.area-pick-row.unset .area-pick-row-chev { color: var(--muted); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; padding: 12px 18px;
  font: 600 14px/1 var(--font-sans); border-radius: var(--radius-sm);
  transition: transform .06s ease, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #2a2622; }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-block { width: 100%; }
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(168,67,42,.3); }
.btn-danger:hover { background: rgba(168,67,42,.06); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--ink); cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(0,0,0,.05); }

/* ============ SIDE TAGS ============ */
.side-tag {
  display: inline-flex; align-items: center;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 7px; border-radius: 100px; white-space: nowrap;
}
.side-tag.sell { background: var(--gold-soft); color: var(--gold-deep); }
.side-tag.buy  { background: var(--buy-soft);  color: var(--buy-deep); }

/* ============ SEGMENTED ============ */
.segmented {
  display: flex; margin: 16px 16px 4px;
  padding: 4px; background: var(--surface-3);
  border-radius: 100px; gap: 4px;
}
.segmented button {
  flex: 1; padding: 11px 12px;
  border: none; background: transparent; color: var(--ink-2);
  font: 600 14px/1 var(--font-sans); border-radius: 100px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.segmented.inbox-tabs { margin: 12px 16px 4px; }
.segmented.inbox-tabs button { padding: 9px 12px; font-size: 13px; }

/* ============ LISTINGS (compact, split) ============ */
.listing-list {
  padding: 8px 16px 24px;
  display: flex; flex-direction: column; gap: 8px;
}

.listing {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: box-shadow .15s, transform .15s;
  position: relative;
}
.listing:hover { box-shadow: var(--shadow-md); }
.listing:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.listing-desc, .listing h3, .detail-desc, .detail-heading h1, .msg { -webkit-user-select: text; user-select: text; }
.detail-desc, .msg { cursor: text; }
.listing:active { transform: scale(.997); }
.listing.expired { opacity: .6; }

.listing-media {
  flex: 0 0 84px;
  width: 84px; height: 84px;
  border-radius: 10px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
  align-self: center;
}
.listing-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-media.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
}
.listing-media .photo-count {
  position: absolute; bottom: 4px; right: 4px;
  padding: 1px 5px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 9.5px; font-weight: 600;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}
.listing-media .expired-badge {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
  color: var(--danger); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}

.listing-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  justify-content: center;
  padding: 2px 0;
}

.listing-title-row {
  display: flex; align-items: flex-start; gap: 8px; min-width: 0;
}
.listing h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600; font-size: 15px;
  letter-spacing: -0.005em;
  line-height: 1.25;
  flex: 1; min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing .price {
  font-family: var(--font-serif);
  font-weight: 600; font-size: 12px;
  color: var(--gold-deep);
  white-space: nowrap;
  padding: 2px 8px;
  background: var(--gold-soft);
  border-radius: 100px;
  flex-shrink: 0;
}

.listing-location {
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--gold-deep);
  font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.listing-location svg { flex-shrink: 0; }

.listing-desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-meta-row {
  display: flex; align-items: center; gap: 5px;
  margin-top: 2px;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
}
.listing-meta-row .meta-sep { color: var(--line-strong); }
.listing-meta-row .metal-type {
  color: var(--ink-2); font-weight: 500;
  white-space: nowrap;
}
.listing-time { white-space: nowrap; }
.listing-owner-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 100px;
  background: var(--surface-3); color: var(--ink-2);
  flex-shrink: 0;
  margin-left: auto;
}
.listing-owner-tag.expired-tag { background: rgba(168,67,42,.1); color: var(--danger); }

/* ============ EMPTY STATES ============ */
.empty {
  padding: 48px 32px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  color: var(--muted);
  gap: 4px;
}
.empty-icon {
  width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); margin-bottom: 8px;
}
.empty p { margin: 0; color: var(--ink); font-family: var(--font-serif); font-weight: 600; font-size: 17px; }
.empty span { font-size: 13.5px; }
.empty .btn { margin-top: 12px; }

/* ============ FORM ============ */
.form-card {
  margin: 8px 16px 24px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 16px; max-width: 100%;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label {
  font-size: 12px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.field-label em { margin-left: 6px; font-style: normal; color: var(--muted); opacity: .7; text-transform: none; letter-spacing: 0; }
.field-help { font-size: 12px; color: var(--muted); line-height: 1.4; }

.field input, .field textarea, .field select {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font: inherit; font-size: 15px; width: 100%; min-width: 0; max-width: 100%;
  transition: border-color .15s, background .15s;
  overflow-wrap: anywhere;
  appearance: none; -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8275' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px;
}
.field input::placeholder, .field textarea::placeholder { color: #b3a893; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--gold); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(166,124,46,.12);
}
.field textarea { resize: vertical; min-height: 96px; }
.form-hint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.form-actions { display: flex; flex-direction: column; gap: 8px; }

.price-group { display: flex; flex-direction: column; gap: 8px; }
.price-extra {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.price-extra:focus-within { border-color: var(--gold); background: var(--surface); box-shadow: 0 0 0 3px rgba(166,124,46,.12); }
.price-extra input {
  flex: 1; min-width: 0; border: none; background: transparent;
  padding: 12px 14px; font: inherit; font-size: 15px; border-radius: 0;
}
.price-extra input:focus { outline: none; box-shadow: none; }
.price-extra .suffix {
  display: inline-flex; align-items: center; padding: 0 14px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  border-left: 1px solid var(--line); background: var(--surface-3);
}

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-add, .photo-tile {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong); background: var(--surface-2);
  color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-size: 11px; font-weight: 500; cursor: pointer; overflow: hidden; padding: 0;
}
.photo-add:hover { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-soft); }
.photo-tile { border-style: solid; border-color: var(--line); position: relative; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; line-height: 1;
}

/* ============ BOTTOM NAV + FAB ============ */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: stretch;
  height: 62px;
  padding: 0 4px calc(env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 20; flex-shrink: 0;
  box-shadow: 0 -2px 12px rgba(26,24,21,.04);
}
.bottom-nav > button[data-tab] {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--muted);
  font: 500 10.5px/1 var(--font-sans);
  padding: 6px 2px;
  position: relative; transition: color .15s;
  min-width: 0;
}
.bottom-nav > button[data-tab].active { color: var(--ink); }
.bottom-nav > button[data-tab].active svg { stroke-width: 2.2; }
.bottom-nav .badge {
  position: absolute; top: 2px; left: 50%; margin-left: 5px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--gold); color: #fff; font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; font-style: normal;
}
.bottom-nav .nav-fab {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0; cursor: pointer;
  min-width: 0; position: relative;
}
.bottom-nav .nav-fab-btn {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: 4px solid var(--bg);
  box-shadow:
    0 4px 12px rgba(26,24,21,.16),
    0 1px 2px rgba(26,24,21,.08);
  position: relative;
  top: -22px;
  transition: transform .12s ease, background .15s;
}
.bottom-nav .nav-fab:active .nav-fab-btn { transform: scale(.94); background: #2a2622; }

@media (min-width: 720px) {
  .bottom-nav {
    max-width: 640px; left: 50%; transform: translateX(-50%);
    border-left: 1px solid var(--line); border-right: 1px solid var(--line);
    border-radius: 20px 20px 0 0;
  }
}

/* ============ ACTION SHEET (shared) ============ */
.action-sheet {
  position: fixed; inset: 0;
  z-index: 850;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.action-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(26,24,21,.45);
  animation: fade-in .18s ease-out;
}
.action-sheet-body {
  position: relative;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 22px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 -12px 40px rgba(0,0,0,.18);
  animation: sheet-up .24s cubic-bezier(.16,1,.3,1);
  max-height: 90dvh; overflow-y: auto;
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.action-sheet-title {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 18px; letter-spacing: -0.01em;
  text-align: center;
  margin: 4px 0 8px;
}
.action-sheet-option {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  transition: background .15s, border-color .15s, transform .08s;
  box-shadow: var(--shadow-sm);
}
.action-sheet-option:active { transform: scale(.99); }
.action-sheet-option.sell:hover { background: var(--gold-soft); border-color: var(--gold); }
.action-sheet-option.buy:hover  { background: var(--buy-soft);  border-color: var(--buy); }
.action-sheet-option .as-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.action-sheet-option.sell .as-icon { background: var(--gold-soft); color: var(--gold-deep); }
.action-sheet-option.buy  .as-icon { background: var(--buy-soft);  color: var(--buy-deep); }
.action-sheet-option .as-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.action-sheet-option .as-title { font-family: var(--font-serif); font-weight: 600; font-size: 16px; }
.action-sheet-option .as-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.action-sheet-option .as-chev { color: var(--muted); flex-shrink: 0; }
.action-sheet-cancel {
  padding: 14px; background: none; border: none;
  font: 600 14px/1 var(--font-sans); color: var(--muted);
  cursor: pointer; margin-top: 4px;
}

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0; background: var(--bg); z-index: 200;
  display: flex; flex-direction: column;
  animation: modal-in .18s ease-out;
}
.modal-top { z-index: 700; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.modal-title {
  flex: 1; font-family: var(--font-serif); font-weight: 600; font-size: 17px;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-spacer { width: 38px; flex-shrink: 0; }
.modal-map { flex: 1; min-height: 0; position: relative; isolation: isolate; z-index: 0; }
.modal-foot {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.modal-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 20px 16px; display: flex; flex-direction: column; gap: 16px;
}
.modal-lead { margin: 0; font-size: 14px; color: var(--ink-2); }

.reason-list { display: flex; flex-direction: column; gap: 8px; }
.reason-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; font-size: 14.5px;
  transition: border-color .15s, background .15s;
}
.reason-option:hover { background: var(--surface-2); }
.reason-option input { accent-color: var(--gold); }
.reason-option:has(input:checked) {
  border-color: var(--gold); background: var(--gold-soft); color: var(--gold-deep);
  font-weight: 500;
}

.modal-foot .radius-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--muted);
}
.modal-foot .radius-row b { font-family: var(--font-serif); font-weight: 600; font-size: 16px; color: var(--ink); }
.modal-foot input[type=range] {
  width: 100%; margin: 0; -webkit-appearance: none; appearance: none;
  background: transparent; height: 24px;
}
.modal-foot input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: var(--line-strong);
}
.modal-foot input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -9px;
  background: var(--gold); border-radius: 50%;
  box-shadow: 0 1px 3px rgba(122,90,31,.4), inset 0 0 0 1px rgba(255,255,255,.25);
  cursor: pointer;
}
.plain-input {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font: inherit; font-size: 15px; width: 100%;
}
.plain-input:focus { outline: none; border-color: var(--gold); background: var(--surface); box-shadow: 0 0 0 3px rgba(166,124,46,.12); }
.loc-coords-view {
  padding: 10px 14px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 500 13px/1.4 ui-monospace, Menlo, monospace; color: var(--ink-2);
  text-align: center;
}

/* ============ LISTING DETAIL ============ */
.detail-overlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 500;
  overflow: hidden; display: flex; flex-direction: column;
  animation: modal-in .2s ease-out;
}
.detail-back, .detail-menu {
  position: absolute; top: 14px; z-index: 10;
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-md);
}
.detail-back { left: 14px; }
.detail-menu { right: 14px; }
.detail-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; min-width: 0;
}
.detail-photos {
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  background: var(--surface-3); aspect-ratio: 4 / 3;
  position: relative; width: 100%; max-width: 100vw;
}
.detail-gallery { display: contents; }
.dg-nav, .dg-count { display: none; }
.detail-photos::-webkit-scrollbar { display: none; }
.detail-photos img {
  flex: 0 0 100%; width: 100%; height: 100%; max-width: 100%;
  scroll-snap-align: center; object-fit: cover; cursor: zoom-in;
}
.detail-photos-placeholder {
  flex: 0 0 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
}
.detail-photo-dots {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; padding: 5px 10px;
  background: rgba(0,0,0,.35); border-radius: 100px;
  backdrop-filter: blur(6px); z-index: 5;
}
.detail-photo-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.5); transition: background .2s, width .2s;
}
.detail-photo-dots span.on { background: #fff; width: 18px; border-radius: 3px; }

.detail-body {
  padding: 20px 20px calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  align-items: flex-start; overflow-x: hidden; min-width: 0;
}
.detail-body .side-tag { align-self: flex-start; }
.detail-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; width: 100%; min-width: 0;
}
.detail-heading h1 {
  margin: 0; font-family: var(--font-serif); font-weight: 600; font-size: 23px;
  line-height: 1.25; letter-spacing: -0.01em; flex: 1; min-width: 0;
}
.detail-heading .price {
  font-family: var(--font-serif); font-weight: 600; font-size: 14px;
  color: var(--gold-deep); white-space: nowrap;
  padding: 4px 12px; background: var(--gold-soft); border-radius: 100px; flex-shrink: 0;
}
.detail-tags {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px;
}
.detail-tag-pill {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: .06em;
}
.detail-tag-pill.metal { background: var(--gold-soft); color: var(--gold-deep); border-color: rgba(166,124,46,.25); }
.detail-tag-pill.expired { background: rgba(168,67,42,.08); color: var(--danger); border-color: rgba(168,67,42,.2); }

.detail-location {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--gold-deep);
  padding: 7px 13px 7px 11px; background: var(--gold-soft);
  border-radius: 100px; align-self: flex-start; max-width: 100%; min-width: 0;
}
.detail-location span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-owner {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.detail-owner .owner-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-3); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 11px;
  border: 1px solid var(--line);
}
.detail-desc {
  margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2);
  white-space: pre-wrap; width: 100%; min-width: 0;
}
.detail-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; width: 100%; }
.detail-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-actions .btn-ghost, .detail-actions .btn-danger { background: #fff; }
.detail-actions .btn-ghost:hover { background: var(--surface-2); }
.detail-actions .btn-danger:hover { background: #fbeeea; }

.sheet {
  position: absolute; left: 16px; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: sheet-in .2s ease-out;
  z-index: 20;
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sheet-action {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 16px; background: none; border: none;
  border-bottom: 1px solid var(--line);
  font: inherit; font-size: 15px; color: var(--ink);
  cursor: pointer; text-align: left;
}
.sheet-action:last-child { border-bottom: none; }
.sheet-action:hover { background: var(--surface-2); }
.sheet-action.danger { color: var(--danger); }
.sheet-action svg { flex-shrink: 0; }

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed; inset: 0; background: #0a0a0a; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.lightbox-img {
  max-width: 100%; max-height: 100%;
  transform-origin: center center; will-change: transform;
  cursor: zoom-in; pointer-events: none; -webkit-user-drag: none;
}
.lightbox-img.zoomed { cursor: grab; }
.lightbox-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(8px);
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 20;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.14); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(8px);
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-dots {
  position: absolute; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 20;
  display: flex; gap: 6px; padding: 6px 12px;
  background: rgba(255,255,255,.1); border-radius: 100px; backdrop-filter: blur(8px);
}
.lightbox-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4); transition: background .2s, width .2s;
}
.lightbox-dots span.on { background: #fff; width: 18px; border-radius: 3px; }

/* ============ CHAT ============ */
.chat-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column;
  z-index: 600; isolation: isolate;
}
.chat-overlay.hidden { display: none; }

.chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 12px 6px; border-bottom: 1px solid var(--line);
  background: var(--bg); flex-shrink: 0;
}
.chat-peer { flex: 1; min-width: 0; padding-left: 4px; }
.peer-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.peer-sub {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}

.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg);
}
.msg {
  max-width: 78%; padding: 10px 14px;
  font-size: 14.5px; line-height: 1.45;
  word-wrap: break-word; white-space: pre-wrap;
  border-radius: 18px;
}
.msg.them {
  align-self: flex-start; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink);
  border-bottom-left-radius: 6px;
}
.msg.mine {
  align-self: flex-end; background: var(--ink); color: #f5f2ea;
  border-bottom-right-radius: 6px;
}
.msg.sys {
  align-self: center; background: none; color: var(--muted);
  font-size: 12px; text-align: center; padding: 8px 16px; max-width: 90%;
}
.msg.msg-media { padding: 4px; max-width: 62%; border-radius: 16px; overflow: hidden; }
.msg.msg-media img { display: block; width: 100%; height: auto; border-radius: 12px; cursor: zoom-in; }

.msg-location {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: none; cursor: pointer;
  font: inherit; text-align: left; max-width: 78%; min-width: 0;
}
.msg-location.them {
  background: var(--gold-soft); color: var(--gold-deep);
  border: 1px solid rgba(166,124,46,.22); border-bottom-left-radius: 6px;
}
.msg-location.mine {
  background: var(--gold-deep); color: #fff;
  border-bottom-right-radius: 6px;
}
.msg-location .loc-pin {
  display: inline-flex; width: 34px; height: 34px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.18); flex-shrink: 0;
}
.msg-location.them .loc-pin { background: rgba(166,124,46,.16); }
.msg-location .loc-text { display: flex; flex-direction: column; min-width: 0; }
.msg-location .loc-label {
  font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-location .loc-coords {
  font-size: 11.5px; opacity: .8;
  font-family: ui-monospace, Menlo, monospace;
}

/* ============ DEAL BAR ============ */
.deal-bar {
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.deal-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  font: inherit; color: inherit; cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.deal-card:not([disabled]):hover { background: #f2e5c2; }
.deal-card[disabled] { cursor: default; }

.deal-card-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(166,124,46,.18);
  color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
}

.deal-card-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.deal-card-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px;
  color: var(--gold-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deal-card-sub {
  font-size: 12px; color: var(--gold-deep); opacity: .85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deal-card-action {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gold-deep);
  padding: 6px 12px;
  background: rgba(255,255,255,.55);
  border-radius: 100px;
  flex-shrink: 0;
}

.deal-bar.pending-mine .deal-card {
  background: var(--surface-2);
  border-color: var(--line);
}
.deal-bar.pending-mine .deal-card-icon { background: var(--surface-3); color: var(--muted); }
.deal-bar.pending-mine .deal-card-title,
.deal-bar.pending-mine .deal-card-sub { color: var(--muted); }
.deal-bar.pending-mine .deal-card-action { display: none; }

.deal-bar.pending-theirs .deal-card {
  background: linear-gradient(135deg, #f7eed6, #f2e5c2);
  box-shadow: 0 4px 14px rgba(122,90,31,.15);
}
.deal-bar.pending-theirs .deal-card-title { font-size: 16px; }
.deal-bar.pending-theirs .deal-card-action {
  background: var(--gold-deep); color: #fff;
}

.deal-bar.agreed .deal-card {
  background: linear-gradient(135deg, #e3f0e8, #d1e6da);
  border-color: rgba(74,124,89,.4);
  cursor: default;
}
.deal-bar.agreed .deal-card-icon { background: rgba(74,124,89,.18); color: var(--buy-deep); }
.deal-bar.agreed .deal-card-title { color: var(--buy-deep); font-size: 16px; }
.deal-bar.agreed .deal-card-sub { color: var(--buy-deep); opacity: .85; }
.deal-bar.agreed .deal-card-action { display: none; }

/* ============ DEAL SHEET ============ */
.deal-tabs {
  display: flex;
  padding: 4px;
  background: var(--surface-3);
  border-radius: 100px;
  gap: 4px;
  margin-bottom: 4px;
}
.deal-tabs button {
  flex: 1; padding: 10px 12px;
  border: none; background: transparent;
  color: var(--ink-2);
  font: 600 13.5px/1 var(--font-sans);
  border-radius: 100px; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.deal-tabs button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.deal-mode { display: flex; flex-direction: column; gap: 12px; }
.deal-hint {
  margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5;
}

.deal-amount-row {
  display: flex; align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.deal-amount-row:focus-within {
  border-color: var(--gold); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(166,124,46,.12);
}
.deal-currency-symbol {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px;
  min-width: 52px;
  background: var(--surface-3);
  color: var(--gold-deep);
  font: 700 17px/1 var(--font-sans);
  border-right: 1px solid var(--line);
  user-select: none;
}
.deal-amount-row input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  padding: 12px 14px;
  font: inherit; font-size: 17px; font-weight: 600;
  color: var(--ink);
}
.deal-amount-row input:focus { outline: none; box-shadow: none; }

.spot-card {
  padding: 16px;
  background: var(--gold-soft);
  border: 1px solid rgba(166,124,46,.25);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.spot-card-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gold-deep); opacity: .85;
}
.spot-card-value {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 24px; letter-spacing: -0.01em;
  color: var(--gold-deep);
}
.spot-card-meta {
  font-size: 11.5px; color: var(--gold-deep); opacity: .7;
}
.spot-card.error {
  background: rgba(168,67,42,.06);
  border-color: rgba(168,67,42,.25);
}
.spot-card.error .spot-card-value { color: var(--danger); font-size: 16px; }
.spot-card.error .spot-card-label,
.spot-card.error .spot-card-meta { color: var(--danger); }

/* ============ CALCULATOR ============ */
.calc-body { gap: 14px; }

.calc-metal-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.calc-metal-pills .filter-pill {
  text-align: center;
  padding: 11px 6px;
}

.calc-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.calc-unit-toggle {
  display: flex;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  gap: 3px;
}
.calc-unit-toggle button {
  flex: 1;
  padding: 9px 6px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font: 500 13px/1 var(--font-sans);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.calc-unit-toggle button.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.calc-spot-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--gold-soft);
  border: 1px solid rgba(166,124,46,.25);
  border-radius: var(--radius-sm);
}
.calc-spot-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--gold-deep);
}
.calc-spot-value {
  flex: 1;
  text-align: right;
  font: 600 14px/1.2 var(--font-sans);
  color: var(--gold-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calc-spot-value.error { color: var(--danger); }

.calc-result-card {
  padding: 18px 16px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 4px;
  text-align: center;
}
.calc-result-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
}
.calc-result-value {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 34px; line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 42px;
  display: flex; align-items: center; justify-content: center;
}
.calc-result-value.placeholder { color: var(--muted); font-size: 22px; font-weight: 500; }
.calc-result-meta {
  font-size: 12px; color: var(--muted); line-height: 1.4;
  min-height: 16px;
}

/* ============ THREAD LIST ============ */
.thread-list { padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.thread {
  display: flex; gap: 12px; align-items: center; text-align: left;
  width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  font: inherit; color: inherit; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s; min-width: 0;
}
.thread:hover { box-shadow: var(--shadow-md); }
.thread-avatar {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 15px;
  color: var(--ink-2); flex-shrink: 0;
}
.thread-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #c9c1ac; border: 2px solid var(--surface);
}
.thread-dot.on { background: var(--success); }
.thread-body { flex: 1; min-width: 0; }
.thread-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; min-width: 0; }
.thread-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.pill {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 100px;
  background: var(--gold-soft); color: var(--gold-deep); flex-shrink: 0;
}
.thread-meta { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.thread-preview {
  font-size: 13px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thread-preview.emphasis { color: var(--gold-deep); font-weight: 500; }

/* ============ PROFILE ============ */
.profile-hero {
  display: flex; align-items: center; gap: 14px;
  margin: 8px 16px 16px; padding: 20px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e4bc5a, var(--gold) 45%, var(--gold-deep) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 28px;
  box-shadow: 0 4px 12px rgba(122,90,31,.25), inset 0 0 0 1px rgba(255,255,255,.25);
  flex-shrink: 0;
}
.profile-hero-body { flex: 1; min-width: 0; }
.profile-hero-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 20px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-hero-id { font-size: 12px; color: var(--muted); margin-top: 2px; }

.profile-card {
  margin: 0 16px 16px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 14px;
}
.profile-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.profile-card-title { font-family: var(--font-serif); font-weight: 600; font-size: 16px; }
.profile-card-count {
  font-size: 12px; color: var(--muted);
  padding: 2px 8px; background: var(--surface-2); border-radius: 100px;
}
.profile-card-sub { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }

.profile-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.profile-row-main { flex: 1; min-width: 0; }
.profile-row-title { font-size: 14.5px; font-weight: 500; }
.profile-row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.switch { position: relative; display: inline-block; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  display: inline-block; width: 44px; height: 26px;
  background: var(--line-strong); border-radius: 100px;
  position: relative; cursor: pointer;
  transition: background .18s;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--gold); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }

.blocked-list { display: flex; flex-direction: column; gap: 8px; }
.blocked-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.blocked-row-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 12px;
  border: 1px solid var(--line); flex-shrink: 0;
}
.blocked-row-body { flex: 1; min-width: 0; }
.blocked-row-name {
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.blocked-row-id {
  font-size: 11.5px; color: var(--muted);
  font-family: ui-monospace, Menlo, monospace;
}
.blocked-row .btn { padding: 6px 12px; font-size: 12px; }

.profile-empty {
  padding: 16px 4px;
  font-size: 13px; color: var(--muted); text-align: center;
}

/* ============ AUTH SCREEN ============ */
.auth-screen {
  position: fixed; inset: 0;
  z-index: 1500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  animation: modal-in .2s ease-out;
}
.auth-screen.hidden { display: none; }

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px 20px;
  display: flex; flex-direction: column; gap: 20px;
}

.auth-brand {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 4px;
}
.auth-brand .mark { width: 32px; height: 32px; border-radius: 50%; display: block; object-fit: cover; }
.auth-brand .name {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 22px; letter-spacing: -0.01em;
}

.auth-tabs {
  display: flex; padding: 4px;
  background: var(--surface-3);
  border-radius: 100px; gap: 4px;
}
.auth-tabs button {
  flex: 1; padding: 10px 12px;
  border: none; background: transparent;
  color: var(--ink-2);
  font: 600 13.5px/1 var(--font-sans);
  border-radius: 100px; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.auth-tabs button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

#authForm { display: flex; flex-direction: column; gap: 14px; }

.auth-warning {
  margin: 0;
  padding: 10px 12px;
  background: var(--gold-soft);
  border: 1px solid rgba(166,124,46,.25);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--gold-deep);
  line-height: 1.5;
}
.auth-error {
  margin: 0;
  padding: 10px 12px;
  background: rgba(168,67,42,.08);
  border: 1px solid rgba(168,67,42,.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--danger);
}
.auth-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ============ PROFILE SIGNED-IN BLOCK ============ */
.profile-signed-in {
  display: flex; align-items: center; gap: 12px;
  margin: 0 16px 16px; padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.profile-signed-in .psi-body { flex: 1; min-width: 0; }
.profile-signed-in .psi-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-signed-in .psi-tier {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 100px;
  margin-left: 6px;
}
.profile-signed-in .psi-tier.free    { background: var(--surface-3); color: var(--ink-2); }
.profile-signed-in .psi-tier.premium { background: var(--gold-soft); color: var(--gold-deep); }
.profile-signed-in .psi-sub {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
}
.profile-signed-in .btn { flex-shrink: 0; }

/* ============ TOAST ============ */
.toast-host {
  position: fixed; z-index: 200000; left: 12px; right: 12px;
  top: calc(env(safe-area-inset-top) + 62px);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; width: 100%; max-width: 520px;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: 14px; padding: 12px 8px 12px 12px;
  box-shadow: 0 10px 30px rgba(20, 16, 6, .22), 0 2px 6px rgba(20, 16, 6, .12);
  font-size: 14.5px; line-height: 1.4; font-weight: 500;
  animation: toast-in .22s ease-out;
}
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .15s, transform .15s; }
.toast-ico { flex: none; margin-top: 1px; color: var(--gold-deep); }
.toast-success { border-left-color: #3f7d58; } .toast-success .toast-ico { color: #3f7d58; }
.toast-warn    { border-left-color: #c98a1a; } .toast-warn .toast-ico    { color: #b7791f; }
.toast-error   { border-left-color: #b3402f; } .toast-error .toast-ico   { color: #b3402f; }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.toast-action {
  align-self: flex-start; border: 0; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600;
  background: var(--ink); color: #f5f2ea; border-radius: 100px; padding: 7px 14px; min-height: 34px;
}
.toast-x {
  flex: none; width: 36px; height: 36px; margin-top: -6px; border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); border-radius: 50%;
}
.toast-x:hover { background: var(--surface-2); color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .toast.leaving { transition: none; } }

/* soft Pro prompts */
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--gold-deep); text-decoration: underline; cursor: pointer; }
.upsell-line { font-size: 13px; color: var(--muted); margin-top: 6px; }
.upsell-card { display: flex; align-items: center; gap: 10px; margin: 10px 16px 0; padding: 10px 6px 10px 14px; border: 1px solid var(--gold); background: var(--gold-soft); border-radius: 12px; font-size: 13.5px; }
.upsell-card .upsell-text { flex: 1; }
.plan-card.flash { animation: plan-flash 1.6s ease-out; }
@keyframes plan-flash { 0%, 60% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
/* ============ CHAT BANNER (accept / waiting) ============ */

.chat-action {
  flex-shrink: 0;
  padding: 0 12px 4px;
}
.chat-action-inner {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
}
.chat-action.waiting .chat-action-inner {
  background: var(--surface-2);
  border-color: var(--line);
}
.chat-action-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px;
  color: var(--ink);
}
.chat-action-sub {
  font-size: 12.5px; color: var(--muted);
}
#acceptBtn {
  margin-top: 10px; padding: 11px 16px;
  font: 600 14px/1 var(--font-sans);
  color: #f7f3e8; background: var(--gold);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
}
#acceptBtn:hover { background: var(--gold-deep); }
#acceptBtn:active { transform: scale(.98); }
#acceptBtn:disabled { opacity: .55; cursor: default; }

/* ============ CHAT COMPOSER ============ */

.composer {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.composer-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2);
  cursor: pointer; transition: background .15s;
}
.composer-icon:hover { background: var(--surface-3); }
.composer-icon:active { transform: scale(.95); }
#chatInput {
  flex: 1; min-width: 0; height: 42px;
  padding: 0 16px;
  font: 15px/1.4 var(--font-sans); color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 21px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
#chatInput::placeholder { color: var(--muted); }
#chatInput:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(166,124,46,.12); }
.composer .send-btn {
  width: 42px; height: 42px; flex-shrink: 0;
  border: none; border-radius: 50%;
  background: var(--gold); color: #f7f3e8;
  cursor: pointer; transition: background .15s;
}
.composer .send-btn:hover { background: var(--gold-deep); }
.composer .send-btn:active { transform: scale(.94); }

/* ============ TRADE CARD + REPUTATION ============ */

.trade-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; margin-top: 8px; padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.trade-card.hidden { display: none !important; }
.trade-card-body { flex: 1; min-width: 0; }
.trade-card-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 14.5px;
  color: var(--ink);
}
.trade-card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.trade-card-side { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.trade-done { color: var(--buy); font-weight: 700; font-size: 16px; }
.star-btn {
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--line-strong);
  font-size: 17px; line-height: 1; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.star-btn:hover { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.star-btn:active { transform: scale(.92); }
.pill.done {
  background: var(--buy-soft); color: var(--buy-deep);
  border-color: rgba(58,122,94,.25);
}
.owner-rep {
  margin-left: 8px; padding: 2px 8px;
  font-size: 12px; white-space: nowrap;
  color: var(--gold-deep); background: var(--gold-soft);
  border: 1px solid rgba(166,124,46,.22); border-radius: 999px;
}
.psi-rep { margin-top: 4px; font-size: 12.5px; color: var(--gold-deep); }

/* ============ TRADE CARD v2 (refined) ============ */

.trade-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; margin-top: 8px; padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.trade-card-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px;
  color: var(--ink);
}
.trade-card-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.trade-confirm-btn {
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--gold); background: transparent;
  color: var(--gold-deep); font: 600 13px/1 var(--font-sans);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.trade-confirm-btn:hover { background: var(--gold-soft); }
.trade-confirm-btn:active { transform: scale(.97); }

.star-row { display: inline-flex; gap: 2px; }
.star-btn {
  width: 32px; height: 32px; padding: 0;
  border: none; background: transparent;
  color: var(--line-strong); font-size: 24px; line-height: 1;
  cursor: pointer; transition: color .15s, transform .1s;
}
.star-btn.lit { color: var(--gold); }
.star-btn:hover { transform: scale(1.15); }

/* ============ USER PROFILE SHEET ============ */

.chat-peer { cursor: pointer; }
#detailOwner.link { cursor: pointer; }
#detailOwner.link:hover { background: rgba(0,0,0,.03); }

.user-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.user-sheet-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.user-sheet-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  color: var(--ink);
}
.user-sheet-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.user-sheet-rep {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 12px;
}
.rep-score-row { display: flex; align-items: baseline; gap: 10px; }
.rep-score {
  font-family: var(--font-serif); font-weight: 600; font-size: 22px;
  color: var(--gold-deep);
}
.rep-score.muted { color: var(--muted); }
.rep-stars-static { font-size: 16px; color: var(--line-strong); letter-spacing: 2px; }
.rep-stars-static .lit { color: var(--gold); }
.rep-meta { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.rep-note { margin-top: 6px; font-size: 12.5px; color: var(--danger); }
.rep-member { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ============ CHAT HEADER AVATAR + INBOX PROFILE TAP ============ */

.chat-head-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
  cursor: pointer; user-select: none;
  transition: transform .1s, box-shadow .15s;
}
.chat-head-avatar:hover { box-shadow: 0 0 0 3px var(--gold-soft); }
.chat-head-avatar:active { transform: scale(.94); }
.thread-avatar { cursor: pointer; }
.thread-avatar:hover .thread-dot { box-shadow: 0 0 0 3px var(--gold-soft); }

/* ============ REPORT SCREENSHOT ============ */

.report-shot-preview {
  display: block; max-width: 100%; max-height: 160px;
  margin-top: 8px; border-radius: 10px;
  border: 1px solid var(--line);
}

/* ============ BRAND + LANGUAGE TOGGLE ============ */

button.wordmark {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
button.wordmark:active .mark { transform: scale(.92); }
.lang-toggle { min-width: 132px; }

/* ============ PLANS / VERIFIED / PROMOTED ============ */

.verified-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; padding: 0 6px; border-radius: 100px;
  background: var(--gold); color: #fff;
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em; line-height: 1;
  flex-shrink: 0;
}
.profile-hero-body { position: relative; }
.profile-hero-name { display: inline-block; }
#profileHeroVerified { position: absolute; margin: 2px 0 0 6px; }
.user-sheet-name { display: inline-block; }
#userSheetVerified { margin: 0 0 2px 6px; vertical-align: middle; }

.plan-card .plan-head { margin-bottom: 10px; }
.plan-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  display: flex; align-items: center; gap: 8px;
}
.plan-name.pro { color: var(--gold-deep); }
.plan-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.plan-usage-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.plan-usage-row:last-of-type { border-bottom: none; }
.plan-usage-row b { font-weight: 600; color: var(--ink); }

.listing.promoted { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow-sm); }
.promo-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 8px; border-radius: 100px;
  background: var(--gold); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}

.modal-foot .modal-note { margin: 8px 0 12px; font-size: 12px; line-height: 1.4; color: var(--ink-soft, #6b665a); }

.plan-usage-title { margin: 14px 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.plan-cmp { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 10px; }
.plan-cmp-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px; align-items: center; border-bottom: 1px solid var(--line); font-size: 13px; }
.plan-cmp-row:last-child { border-bottom: none; }
.plan-cmp-head { font-weight: 600; font-size: 12px; background: var(--surface-2); }
.plan-cmp-label { padding: 9px 10px; color: var(--ink-2); line-height: 1.3; }
.plan-cmp-cell { padding: 9px 4px; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.plan-cmp-cell.pro { color: var(--gold-deep); font-weight: 600; }
.plan-cmp-cell.is-you { background: rgba(200, 154, 44, .10); }
.plan-yes { color: var(--gold-deep); font-weight: 700; }
.plan-no { color: var(--muted); }
.plan-foot { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.4; }
.legal-row { color: inherit; text-decoration: none; }
.legal-row::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 22px; line-height: 1; }
.recovery-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 17px; letter-spacing: .04em; line-height: 1.7; text-align: center; word-break: break-word; padding: 16px 12px; margin: 4px 0 10px; border: 1px dashed var(--gold); border-radius: var(--radius-sm); background: var(--surface-2); user-select: all; }
.recovery-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.recovery-ack { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; margin: 8px 0 14px; }
.recovery-ack input { margin-top: 3px; }
#forgotBtn { margin-top: 4px; }
#recoverModal, #recoveryModal { z-index: 100000; }

/* ---- Safe Trading Guide ---- */
#guideModal { z-index: 100000; }
.guide-sec { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.guide-sec > summary { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); }
.guide-sec > summary::-webkit-details-marker { display: none; }
.guide-sec > summary::after { content: '\203A'; margin-left: auto; transition: transform .15s; color: var(--muted); font-size: 20px; }
.guide-sec[open] > summary::after { transform: rotate(90deg); }
.guide-ico { width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-deep); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.guide-inner { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--ink-2); }
.guide-inner p { margin: 0; }
.guide-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.guide-tip { border-color: var(--gold); background: var(--gold-soft); }
.guide-test { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.guide-test-name { font-weight: 600; color: var(--ink); }
.guide-limit { color: var(--muted); }

.browse-controls { display: contents; }

/* ============================================================
   DESKTOP LAYOUT (>= 1000px)
   The phone layout above is untouched; everything here only applies on wide screens:
   left navigation rail, filter column + card grid on the market page, centred dialogs.
   ============================================================ */
@media (min-width: 1000px) {
  :root { --rail: 96px; --header-h: 64px; --page: 1180px; --col: 760px; }
  .browse-controls { display: block; }

  /* header spans the window, rail sits under it */
  .app-header { height: var(--header-h); padding: 0 32px; }
  .wordmark .mark { width: 28px; height: 28px; }
  .wordmark .name { font-size: 22px; }
  .status-banner { margin-left: var(--rail); }

  .bottom-nav {
    top: var(--header-h); bottom: 0; left: 0; right: auto;
    width: var(--rail); height: auto; max-width: none; transform: none;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 6px; padding: 18px 10px;
    border-top: 0; border-left: 0; border-right: 1px solid var(--line);
    border-radius: 0; box-shadow: none;
  }
  .bottom-nav > button[data-tab] {
    flex: 0 0 auto; width: 100%; height: 68px; border-radius: 14px;
    font-size: 11.5px; gap: 5px;
  }
  .bottom-nav > button[data-tab]:hover { background: var(--surface-2); color: var(--ink); }
  .bottom-nav > button[data-tab].active { background: var(--gold-soft); color: var(--gold-deep); }
  .bottom-nav .badge { top: 8px; left: 50%; margin-left: 8px; }
  .bottom-nav .nav-fab { order: -1; flex: 0 0 auto; height: 62px; margin: 0 0 10px; }
  .bottom-nav .nav-fab-btn { width: 52px; height: 52px; top: 0; border: 0; }
  .bottom-nav .nav-fab:hover .nav-fab-btn { background: #2a2622; }

  main { margin-left: var(--rail); }

  /* every panel is a centred column; the market page uses the wide layout */
  .panel { padding: 8px max(32px, calc((100% - var(--col)) / 2)) 56px; }
  .panel-head { padding: 24px 16px 10px; }
  .panel-head h1 { font-size: 30px; }
  .panel-head p { font-size: 14.5px; }
  .panel-nav { padding: 18px 12px 10px; }
  .ptr-indicator { display: none; }

  .panel[data-panel="browse"] { padding-left: max(32px, calc((100% - var(--page)) / 2)); padding-right: max(32px, calc((100% - var(--page)) / 2)); padding-top: 28px; }
  .panel[data-panel="browse"].active {
    display: grid; grid-template-columns: 300px minmax(0, 1fr); column-gap: 32px;
    align-content: start; align-items: start;
  }
  .browse-controls { grid-column: 1; grid-row: 1; position: sticky; top: 0; }
  .browse-controls .area-chip { width: 100%; margin: 0 0 12px; }
  .browse-controls .filter-bar { padding: 0; }
  .browse-controls .filter-chips-bar { padding: 12px 0 0; overflow: visible; }
  .browse-controls .filter-chips { flex-wrap: wrap; }

  .panel[data-panel="browse"] #listingList {
    grid-column: 2; grid-row: 1;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-content: start;
    padding: 0;
  }
  .listing-list > .empty { grid-column: 1 / -1; }
  .panel[data-panel="mine"] .listing-list { display: grid; grid-template-columns: 1fr; }

  /* market cards: photo on top */
  .panel[data-panel="browse"] .listing { flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
  .panel[data-panel="browse"] .listing-media {
    flex: 0 0 auto; width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; align-self: stretch;
  }
  .panel[data-panel="browse"] .listing-info { padding: 14px 16px 16px; }
  .panel[data-panel="browse"] .listing .price { align-self: flex-start; }
  .panel[data-panel="browse"] .listing:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .panel[data-panel="browse"] .skeleton-card { min-height: 280px; }

  /* dialogs and overlays: centred cards over a dimmed page instead of full screen */
  .modal, .detail-overlay, .chat-overlay {
    inset: auto; top: 32px; bottom: 32px; left: 0; right: 0; margin: 0 auto;
    width: min(760px, calc(100vw - 64px));
    border-radius: 22px; overflow: hidden;
    box-shadow: 0 0 0 100vmax rgba(26,24,21,.42), var(--shadow-lg);
  }
  .modal:has(.modal-map) { width: min(1000px, calc(100vw - 64px)); }
  .detail-overlay { width: min(1040px, calc(100vw - 64px)); }
  /* card hugs its content and is centred, so no empty cream area below the photo */
  .detail-overlay { inset: 0; margin: auto; height: fit-content; max-height: calc(100vh - 64px); }
  .detail-scroll { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-content: start; align-items: start; }
  .detail-gallery { display: block; position: sticky; top: 0; align-self: start; }
  .detail-photos { max-width: 100%; cursor: grab; }
  .detail-photos.dragging { cursor: grabbing; scroll-snap-type: none; }
  .detail-photos.dragging:not([style*="smooth"]) { scroll-behavior: auto; }
  .detail-photos img { user-select: none; -webkit-user-drag: none; }
  .detail-photo-dots { display: none; }
  .dg-nav {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
    width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.92); color: var(--ink); box-shadow: var(--shadow-md);
    opacity: 0; transition: opacity .15s;
  }
  .dg-nav.hidden, .dg-count.hidden { display: none; }
  .detail-gallery:hover .dg-nav, .dg-nav:focus-visible { opacity: 1; }
  .dg-prev { left: 12px; } .dg-next { right: 12px; }
  .dg-count {
    display: block; position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
    padding: 4px 12px; border-radius: 100px; background: rgba(0,0,0,.45); color: #fff;
    font: 600 12px/1.4 var(--font-sans, inherit); letter-spacing: .04em; backdrop-filter: blur(6px);
  }
  .detail-body { padding: 28px 28px 40px; }
  .chat-overlay { width: min(860px, calc(100vw - 64px)); }
  .modal-body { padding: 24px 28px; }

  .action-sheet { justify-content: center; align-items: center; }
  .action-sheet-body { width: min(460px, calc(100vw - 48px)); border-radius: 22px; animation: modal-in .18s ease-out; padding-bottom: 18px; }
  .toast-host { top: calc(var(--header-h) + 8px); }
}

@media (min-width: 1440px) {
  .panel[data-panel="browse"] #listingList { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============ SUPPORT (donations) ============ */
.btn-gold { background: var(--gold); color: #fff; box-shadow: var(--shadow-sm); text-decoration: none; }
.btn-gold:hover { background: var(--gold-deep); }
.support-card { position: relative; background: linear-gradient(160deg, #fffaf0, var(--gold-soft)); border: 1px solid #ecd9a8; }
.support-head { display: flex; align-items: center; gap: 10px; }
.support-ico { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; color: var(--gold); border: 1px solid #ecd9a8; flex-shrink: 0; }
.support-title { font-family: var(--font-serif, Georgia, serif); font-weight: 600; font-size: 17px; color: var(--ink); }
.support-text { margin: 10px 0 12px; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.support-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.support-inline { margin: 0 16px 12px; padding: 14px 16px; border-radius: var(--radius); }
.support-inline .support-text { padding-right: 18px; }
.support-x { position: absolute; top: 8px; right: 8px; }
.trade-support { display: inline-block; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--gold-deep); text-decoration: none; }
.trade-support:hover { text-decoration: underline; }
.support-inline .support-text { margin: 8px 0 10px; font-size: 13.5px; }
.support-inline .support-btn { width: auto; padding: 9px 18px; font-size: 13.5px; }
.support-inline .support-ico { width: 30px; height: 30px; }
.support-inline .support-title { font-size: 16px; }
