:root {
  --asphalt: #22262e;
  --ink: #22262e;
  --ink-2: #5b6270;
  --ink-3: #868d99;
  --paper: #ffffff;
  --wash: #eef1f5;
  --line: #dce1e8;
  --line-2: #e9edf2;
  --sticker: #ffd23f;
  --sticker-deep: #f2b900;
  --sticker-ink: #2a2100;
  --route: #3157e0;
  --route-ink: #2443b8;
  --route-soft: #e7edfd;
  --profit: #128a5b;
  --profit-soft: #e2f4ec;
  --late: #d9363e;
  --late-soft: #fdebec;
  --fb: #1877f2;
  --ou: #00a87e;
  --cl: #6e4bc2;
  --other: #6b7280;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 20px;
  --shadow: 0 1px 2px rgba(34, 38, 46, 0.06), 0 6px 18px rgba(34, 38, 46, 0.06);
  --shadow-lift: 0 2px 6px rgba(34, 38, 46, 0.08), 0 18px 40px rgba(34, 38, 46, 0.14);
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--wash);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.015em;
}
p {
  margin: 0;
}
a {
  color: var(--route);
}
img {
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--route);
  outline-offset: 2px;
  border-radius: 6px;
}
[hidden] {
  display: none !important;
}
.muted {
  color: var(--ink-2);
}
.fine {
  font-size: 13px;
  color: var(--ink-3);
}
.fine a {
  color: inherit;
}
.center {
  text-align: center;
}
.spacer {
  flex: 1;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.icon {
  display: inline-flex;
  flex: none;
}
.icon svg {
  display: block;
}

/* ---------- brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark svg {
  display: block;
}
.brand-light {
  color: #fff;
}

/* ---------- buttons */
.btn {
  --bg: var(--paper);
  --fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active {
  transform: translateY(1px) scale(0.99);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  --bg: var(--sticker);
  --fg: var(--sticker-ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.btn-primary:hover:not([disabled]) {
  --bg: #ffc914;
}
.btn-dark {
  --bg: var(--asphalt);
  --fg: #fff;
}
.btn-dark:hover:not([disabled]) {
  --bg: #343a45;
}
.btn-ghost {
  --bg: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.btn-ghost:hover:not([disabled]) {
  --bg: var(--paper);
  box-shadow: inset 0 0 0 1.5px #c6cdd7;
}
.btn-soft {
  --bg: var(--profit-soft);
  --fg: var(--profit);
}
.btn-danger {
  --bg: var(--late);
  --fg: #fff;
}
.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13.5px;
  gap: 6px;
}
.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 16px;
}
.btn-block {
  width: 100%;
}
.btn.busy {
  pointer-events: none;
}
.danger-text {
  color: var(--late) !important;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--wash);
  color: var(--ink);
}
.linkish {
  border: 0;
  background: none;
  padding: 0;
  color: var(--route);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.linkish.small {
  font-size: 13px;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- form controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}
.label {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  padding: 0;
}
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.hint {
  font-size: 13px;
  color: var(--ink-2);
}
.hint.pos {
  color: var(--profit);
  font-weight: 600;
}
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  font-size: 16px; /* 16px keeps iOS from zooming */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6270' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
textarea.input {
  resize: vertical;
  min-height: 72px;
  line-height: 1.4;
}
.input:focus {
  outline: none;
  border-color: var(--route);
  box-shadow: 0 0 0 3px var(--route-soft);
}
.input[aria-invalid='true'] {
  border-color: var(--late);
}
.input-sm {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 15px;
}
select.input-sm {
  padding-right: 32px;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14.5px;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--route);
  flex: none;
}
.row-2,
.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row-3 {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 520px) {
  .row-3 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- price sticker: the round garage-sale dot */
.sticker {
  --s: 52px;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff3b8 0 8%, transparent 30%), var(--sticker);
  color: var(--sticker-ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 2px 5px rgba(120, 90, 0, 0.18);
  transform: rotate(-6deg);
}
.sticker-long {
  font-size: 12.5px;
}
.sticker-free {
  font-size: 13px;
}
.sticker-sm {
  --s: 38px;
  font-size: 12px;
}
.sticker-sm.sticker-long {
  font-size: 10px;
}
.sticker-lg {
  --s: 64px;
  font-size: 18px;
}

/* ---------- marketplace tag */
.source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--other);
}
.source-facebook .source-dot {
  background: var(--fb);
}
.source-offerup .source-dot {
  background: var(--ou);
}
.source-craigslist .source-dot {
  background: var(--cl);
}

.pro-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--asphalt);
  color: var(--sticker);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  vertical-align: 2px;
}

/* ---------- sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 26, 33, 0.48);
  animation: fade 0.18s ease;
}
.sheet-backdrop.out {
  animation: fade 0.18s ease reverse forwards;
}
.sheet {
  width: min(560px, 100%);
  max-height: min(860px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  animation: rise 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  outline: none;
}
.sheet-wide {
  width: min(760px, 100%);
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 10px 24px;
}
.sheet-title {
  flex: 1;
  font-size: 22px;
}
.sheet-body {
  padding: 6px 24px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px calc(14px + var(--safe-b));
  border-top: 1px solid var(--line-2);
}
@media (max-width: 640px) {
  .sheet-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .sheet {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    animation: slideup 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  .sheet-head::before {
    content: '';
    position: absolute;
    left: 50%;
    width: 40px;
    height: 4px;
    top: 8px;
    border-radius: 4px;
    background: var(--line);
    transform: translateX(-50%);
  }
  .sheet-head {
    position: relative;
    padding: 22px 12px 8px 20px;
  }
  .sheet-body {
    padding: 4px 20px 20px;
  }
  .sheet-foot .btn {
    padding: 0 14px;
  }
}
body.has-sheet {
  overflow: hidden;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}
@keyframes slideup {
  from {
    transform: translateY(100%);
  }
}

/* ---------- toasts */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-b));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--asphalt);
  color: #fff;
  font-size: 14.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lift);
  pointer-events: auto;
  animation: rise 0.2s ease;
}
.toast-error {
  background: var(--late);
}
.toast.out {
  opacity: 0;
  transform: translateY(6px);
  transition: 0.2s ease;
}
.toast-action {
  border: 0;
  background: none;
  color: var(--sticker);
  font-weight: 700;
  cursor: pointer;
}
@media (min-width: 900px) {
  .toasts {
    bottom: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
