/* zwfinder — shared design system.
   Surfaces are separated by fill (ground → surface → recessed), never by
   border or box-shadow. Accent sits in the emerald/green-700..600 range;
   status colors are a deliberately different green so "Active" badges never
   get confused with brand actions. */

:root {
  --ground: #f5f6f3;
  --surface: #ffffff;
  --recessed: #ebece7;
  --recessed-2: #dfe1db;

  --ink: #1e2320;
  --ink-muted: #6f766e;
  --ink-faint: #9ba098;

  --accent: #047857; /* emerald-700 */
  --accent-dim: #065f46; /* emerald-800, hover */
  --accent-soft: #d1fae5; /* emerald-100 */
  --accent-ink: #ffffff;

  --ok-fg: #15803d;
  --ok-bg: #dcfce7;
  --pending-fg: #8a6218;
  --pending-bg: #f3e8cc;
  --pause-fg: #6b6b62;
  --pause-bg: #e9e6dd;
  --sold-fg: #3d5a73;
  --sold-bg: #dee6ec;
  --danger-fg: #b1432f;
  --danger-bg: #f6ded7;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--accent-dim); }

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

.num { font-variant-numeric: tabular-nums; }

[x-cloak] { display: none !important; }

/* ---------- app shell ---------- */

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-word { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }

.profile-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  cursor: pointer;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dim);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  flex-shrink: 0;
}

.profile-chip .name { font-size: 13px; font-weight: 600; }

.app-body { max-width: 1180px; margin: 0 auto; padding: 4px 28px 56px; }

@media (max-width: 640px) {
  .app-topbar { padding: 14px 18px; }
  .app-body { padding: 4px 18px 40px; }
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn-primary { background: var(--accent); color: var(--accent-ink); padding: 11px 18px; }

.btn-danger-block {
  appearance: none;
  border: none;
  width: 100%;
  cursor: pointer;
  border-radius: var(--radius-m);
  background: var(--danger-bg);
  color: var(--danger-fg);
  font-weight: 700;
  font-size: 13.5px;
  padding: 12px 16px;
  transition: opacity 0.15s ease;
}
.btn-danger-block:disabled { opacity: 0.55; cursor: default; }

/* Header Save button stays put on desktop; on mobile it scrolls out of
   reach on a long form, so a floating bar takes over once there's
   something unsaved to act on. */
.floating-save { display: none; }
@media (max-width: 560px) {
  .floating-save {
    display: flex;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .floating-save .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 18px;
    box-shadow: 0 12px 28px -8px rgba(4, 26, 17, 0.4);
  }
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }

.btn-quiet { background: var(--recessed); color: var(--ink); padding: 9px 15px; }
.btn-quiet:hover:not(:disabled) { background: var(--recessed-2); }

.btn-lg { padding: 14px 24px; font-size: 15px; }

/* ---------- status badges ---------- */

.status-badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: 0.01em; display: inline-block; }
.status-active { background: var(--ok-bg); color: var(--ok-fg); }
.status-pending_review { background: var(--pending-bg); color: var(--pending-fg); }
.status-paused { background: var(--pause-bg); color: var(--pause-fg); }
.status-sold { background: var(--sold-bg); color: var(--sold-fg); }
.status-expired { background: var(--danger-bg); color: var(--danger-fg); }
.status-draft { background: var(--recessed); color: var(--ink-muted); }

/* ---------- listing grid + cards ---------- */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 24px;
  flex-wrap: wrap;
}
.section-head h1 { font-size: 26px; }
.section-sub { font-size: 13.5px; color: var(--ink-muted); margin-top: 4px; }

.filter-row { display: flex; gap: 8px; padding-bottom: 18px; flex-wrap: wrap; }

.filter-pill {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--recessed);
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.filter-pill.is-current { background: var(--ink); color: var(--ground); }
.filter-pill .count { opacity: 0.65; }
.filter-pill.is-current .count { opacity: 0.55; }

.listing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .listing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .listing-grid { grid-template-columns: 1fr; }
  .listing-card { flex-direction: row; align-items: stretch; }
  .listing-thumb { width: 108px; height: auto; flex-shrink: 0; border-radius: var(--radius-m) 0 0 var(--radius-m); }
  .listing-body { padding: 12px 14px; }
}

.listing-card {
  background: var(--surface);
  border-radius: var(--radius-m);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background 0.15s ease;
}
.listing-card:hover { background: #fbfdfc; }

.listing-thumb { height: 118px; position: relative; display: flex; align-items: flex-end; padding: 10px; background: linear-gradient(155deg, #7fae95, var(--accent)); }

.listing-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.listing-title { font-size: 14.5px; font-weight: 700; line-height: 1.32; }
.listing-meta { font-size: 12.5px; color: var(--ink-muted); display: flex; align-items: center; gap: 6px; }
.listing-meta svg { width: 12px; height: 12px; flex-shrink: 0; opacity: 0.7; }
.listing-price { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--accent-dim); }
.listing-price small { font-family: var(--body); font-weight: 500; color: var(--ink-muted); font-size: 11.5px; }
.listing-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.stat-row { display: flex; gap: 12px; }
.stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.stat svg { width: 13px; height: 13px; opacity: 0.65; }
.edit-link { font-size: 12px; font-weight: 700; color: var(--accent-dim); display: inline-flex; align-items: center; gap: 3px; }
.edit-link svg { width: 12px; height: 12px; }

/* ---------- empty state ---------- */

.empty-state {
  background: var(--surface);
  border-radius: var(--radius-l);
  padding: 56px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-state .icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
}
.empty-state p { color: var(--ink-muted); font-size: 13.5px; max-width: 340px; margin: 0; }

/* ---------- edit page: panels + fields ---------- */

.edit-head { display: flex; align-items: center; gap: 12px; padding: 22px 0 6px; flex-wrap: wrap; }
.back-chip { width: 32px; height: 32px; border-radius: 50%; background: var(--recessed); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.back-chip svg { width: 15px; height: 15px; }
.edit-head .titles { flex: 1; min-width: 180px; }
.edit-head h1 { font-size: 21px; }
.edit-head .saved-hint { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.edit-actions { display: flex; gap: 8px; margin-left: auto; }

.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px 0 8px; align-items: start; }
@media (max-width: 760px) { .edit-grid { grid-template-columns: 1fr; } }

.col { display: flex; flex-direction: column; gap: 16px; }

.panel { background: var(--surface); border-radius: var(--radius-m); padding: 20px 20px 22px; }
.panel-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 16px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

label.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-bottom: 7px; }
.field-help { font-size: 11px; color: var(--ink-faint); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--recessed);
  border: none;
  border-radius: var(--radius-s);
  padding: 11px 13px;
  font-size: 13.5px;
  font-family: var(--body);
  color: var(--ink);
  appearance: none;
}
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.textarea { resize: vertical; min-height: 74px; line-height: 1.5; font-family: var(--body); }

.select-wrap { position: relative; }
.select-wrap svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; pointer-events: none; opacity: 0.55; }

.price-cluster { display: grid; grid-template-columns: 88px 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .price-cluster { grid-template-columns: 1fr; } }

.toggle-row { display: flex; align-items: center; justify-content: space-between; background: var(--recessed); border-radius: var(--radius-s); padding: 12px 14px; }
.toggle-row .label { font-size: 13px; font-weight: 600; }
.toggle-row .help { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }

.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--recessed-2); position: relative; flex-shrink: 0; cursor: pointer; border: none; padding: 0; }
.switch.is-on { background: var(--accent); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform 0.16s ease; }
.switch.is-on .switch-knob { transform: translateX(16px); }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option { appearance: none; border: none; padding: 8px 14px; border-radius: 999px; background: var(--recessed); font-size: 12.5px; font-weight: 600; color: var(--ink-muted); cursor: pointer; }
.chip-option.is-selected { background: var(--accent-soft); color: var(--accent-dim); }

.checkbox-list { display: flex; flex-direction: column; gap: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; background: var(--recessed); border-radius: var(--radius-s); padding: 10px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.checkbox-row input { accent-color: var(--accent); width: 15px; height: 15px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--recessed); padding: 6px 6px 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.tag-pill button { width: 17px; height: 17px; border-radius: 50%; background: var(--recessed-2); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-muted); padding: 0; font-size: 13px; line-height: 1; }
.tag-input { border: none; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; width: 110px; outline: none; }

.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
.photo-tile { aspect-ratio: 1; border-radius: var(--radius-s); position: relative; overflow: hidden; background-size: cover; background-position: center; background-color: var(--recessed); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .primary-tag { position: absolute; left: 6px; bottom: 6px; background: rgba(30, 35, 32, 0.6); color: #fff; font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 999px; letter-spacing: 0.02em; }
.photo-add { aspect-ratio: 1; border-radius: var(--radius-s); background: var(--recessed); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-faint); border: none; }
.photo-add:hover { background: var(--recessed-2); }
.photo-add svg { width: 20px; height: 20px; }

.stat-strip { display: flex; gap: 10px; }
.stat-block { flex: 1; background: var(--recessed); border-radius: var(--radius-s); padding: 13px 14px; }
.stat-block .figure { font-family: var(--display); font-weight: 700; font-size: 21px; display: block; }
.stat-block .figure.accent { color: var(--accent-dim); }
.stat-block .caption { font-size: 11px; color: var(--ink-muted); font-weight: 600; margin-top: 2px; }

.history-list { display: flex; flex-direction: column; gap: 2px; }
.history-row { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 10px; border-radius: var(--radius-s); gap: 10px; }
.history-row:nth-child(odd) { background: var(--recessed); }
.history-row .what { font-size: 12.5px; font-weight: 600; }
.history-row .when { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--ground);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ---------- loading / auth gate ---------- */

.gate {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--ink-muted);
  font-size: 13.5px;
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--recessed-2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }

/* ---------- landing page ---------- */

.landing-hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 72px 24px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.landing-hero .eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-dim); background: var(--accent-soft); padding: 6px 14px; border-radius: 999px;
}
.landing-hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; }
.landing-hero p.lede { font-size: 16px; color: var(--ink-muted); max-width: 520px; line-height: 1.55; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; padding-top: 6px; }

.how-it-works {
  max-width: 1000px;
  margin: 32px auto 64px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 760px) { .how-it-works { grid-template-columns: 1fr; } }
.how-card { background: var(--surface); border-radius: var(--radius-m); padding: 22px 20px; display: flex; flex-direction: column; gap: 8px; }
.how-card .step { font-family: var(--display); font-weight: 800; font-size: 13px; color: var(--accent-dim); }
.how-card h3 { font-size: 15px; }
.how-card p { font-size: 13px; color: var(--ink-muted); line-height: 1.5; margin: 0; }

.landing-foot {
  text-align: center;
  padding: 20px 24px 40px;
  color: var(--ink-faint);
  font-size: 12px;
}
