/* SwapStuff's core palette and type treatment come from the approved mobile design. */
:root {
  color-scheme: light;
  --ink: #25221f;
  --muted: #655f59;
  --line: #e8e3dd;
  --soft: #faf8f5;
  --paper: #fff;
  --orange: #c63c0d;
  --orange-dark: #a9320a;
  --orange-bright: #ed4d16;
  --orange-tint: #fff1e9;
  --danger: #9e3329;
  --focus: #7347bd;
  --radius: 18px;
  --content-width: 1190px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; font-size: 1rem; line-height: 1.5; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; }
a { color: var(--orange-dark); text-underline-offset: 0.17em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
::selection { background: #ffdbc6; color: var(--ink); }
h1, h2, h3, p, figure, ul, ol { margin: 0; }
h1, h2, h3 { line-height: 1.12; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.1vw, 3.6rem); font-weight: 760; letter-spacing: -.058em; }
h2 { font-size: clamp(1.45rem, 2.2vw, 2rem); font-weight: 735; letter-spacing: -.044em; }
h3 { font-size: 1.13rem; font-weight: 710; letter-spacing: -.02em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.35rem 0; }
small, .small { font-size: .82rem; }
.muted, .subtle { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 90; left: 12px; top: 5px; padding: .5rem .9rem; border-radius: 8px; background: white; transform: translateY(-150%); }
.skip:focus { transform: none; }

/* The storefront header and the persistent navigation share one reading edge. */
.site-head { background: var(--paper); border-bottom: 1px solid var(--line); }
.head-inner, .site-head:not(:has(.head-inner)) {
  min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.head-inner { max-width: var(--content-width); margin: 0 auto; padding: .8rem clamp(1.1rem, 4vw, 3rem); }
.site-head:not(:has(.head-inner)) { padding: .8rem max(clamp(1.1rem, 4vw, 3rem), calc((100vw - var(--content-width)) / 2 + 3rem)); }
.brand {
  display: inline-flex; align-items: center; flex: 0 0 auto; padding: 0; border: 0; background: transparent;
  color: #d64110; font-family: "Arial Rounded MT Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.78rem, 3.3vw, 2.18rem); font-weight: 850; line-height: .96; letter-spacing: -.071em;
  text-decoration: none; white-space: nowrap;
}
.head-actions, .row, .actions, .topline { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.head-actions { justify-content: flex-end; }
.topline, .between { justify-content: space-between; }
.topline { margin-bottom: 1.15rem; }
.shell { width: min(100%, var(--content-width)); min-height: calc(100vh - 77px); margin: 0 auto; padding: clamp(1.4rem, 3.6vw, 3rem) clamp(1.1rem, 4vw, 3rem) 3.5rem; display: grid; grid-template-columns: clamp(156px, 18vw, 210px) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 5rem); align-items: start; }
.shell:not(:has(.sidebar)) { grid-template-columns: minmax(0, 1fr); }
.sidebar { display: grid; gap: .3rem; align-content: start; position: sticky; top: 1.25rem; min-width: 0; }
.sidebar nav { display: grid; gap: .25rem; }
.nav-link {
  display: flex; align-items: center; gap: .62rem; width: 100%; min-height: 44px; padding: .6rem .78rem;
  border: 1px solid transparent; border-radius: 11px; text-decoration: none; background: transparent; text-align: start;
  color: var(--muted); font-weight: 625; line-height: 1.25;
}
.nav-link svg { width: 1.22rem; height: 1.22rem; flex: none; }
.nav-link[aria-current="page"], .nav-link.active { color: var(--orange-dark); background: var(--orange-tint); font-weight: 740; }
.mobile-nav { display: none; }
.main { min-width: 0; max-width: 100%; }
.stack { display: grid; gap: 1rem; align-content: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr)); gap: 1rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.stack > *, .grid > *, .split > *, .row > * { min-width: 0; }
.hero { display: grid; align-content: start; gap: .6rem; margin-bottom: clamp(1.2rem, 3vw, 2rem); }
.hero p { max-width: 60ch; color: var(--muted); }
.eyebrow { display: inline-flex; align-items: center; gap: .48rem; color: var(--muted); font-size: .69rem; font-weight: 735; letter-spacing: .13em; text-transform: uppercase; line-height: 1.5; }
.eyebrow::before { content: ""; width: 19px; height: 2px; background: var(--orange-bright); border-radius: 2px; }
.card, .tile { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 2.3vw, 1.65rem); }
.card > :first-child, .tile > :first-child { margin-top: 0; }
.card > :last-child, .tile > :last-child { margin-bottom: 0; }
.item-card { padding: 0; overflow: hidden; background: var(--paper); border: 1px solid #e4dbd2; border-radius: var(--radius); }
.item-photo, .gallery { background: #f2e8de; }
.item-photo { width: 100%; aspect-ratio: 1.22; object-fit: cover; }
.item-photo img, .gallery img { width: 100%; height: 100%; object-fit: cover; }
.item-card .item-copy, .item-card .card-body { display: grid; gap: .5rem; padding: clamp(.95rem, 2.3vw, 1.5rem); }
.deck { width: min(100%, 555px); position: relative; touch-action: pan-y; }
.deck .item-photo, .deck .gallery { aspect-ratio: 1.25; }
.gallery { margin: 0; position: relative; overflow: hidden; border-radius: calc(var(--radius) - 3px); }
.item-card > .gallery { border-radius: 0; }
.thumb, img.thumb { display: inline-block; width: 58px; height: 58px; flex-shrink: 0; object-fit: cover; background: #f2e8de; border-radius: 10px; vertical-align: middle; }
.photo-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.photo-strip img { width: 60px; height: 60px; object-fit: cover; border-radius: 9px; }
.photo-strip button { padding: .18rem; background: white; border: 1px solid var(--line); border-radius: 11px; }
.photo-strip button[aria-current="true"], .photo-strip button[aria-pressed="true"] { border-color: var(--orange); }
.offer-row { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; padding: .9rem 0; min-width: 0; }
.offer-row + .offer-row { border-top: 1px solid var(--line); }
.offer-row > :not(.thumb) { min-width: 0; }
.badge { display: inline-flex; align-items: center; gap: .25rem; width: fit-content; max-width: 100%; padding: .23rem .57rem; border-radius: .5rem; background: var(--orange-tint); color: var(--orange-dark); font-size: .73rem; font-weight: 715; line-height: 1.4; }
.stat { font-size: clamp(1.4rem, 2.9vw, 2.15rem); line-height: 1.05; font-weight: 725; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.empty {
  display: grid; justify-items: center; align-content: center; gap: .68rem; min-height: 225px; padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-align: center;
}
.empty::before {
  content: ""; width: 85px; height: 59px; margin-bottom: .25rem;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 68'%3E%3Cg fill='%23fff3ea' stroke='%23d9b9a6' stroke-width='1.5'%3E%3Crect x='10' y='13' width='38' height='42' rx='7' transform='rotate(-13 29 34)'/%3E%3Crect x='50' y='13' width='38' height='42' rx='7' transform='rotate(12 69 34)'/%3E%3C/g%3E%3Cpath d='M32 28h31l-5-5m5 5-5 5m10 8H37l5 5m-5-5 5-5' fill='none' stroke='%23af390e' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.empty > p { max-width: 44ch; color: var(--muted); }
.empty .actions { justify-content: center; margin-top: .3rem; }

/* Inputs retain native keyboard, autofill, picker and validation behaviour. */
.btn, .chip {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; max-width: 100%; padding: .63rem 1rem;
  border: 1px solid #dcd5ce; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: .92rem;
  font-weight: 685; text-align: center; line-height: 1.3; text-decoration: none; transition: background-color .14s ease, border-color .14s ease;
}
.btn svg, .chip svg { width: 1.12em; height: 1.12em; flex-shrink: 0; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.secondary { background: white; color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--orange-dark); }
.btn.danger { background: #fff5f2; border-color: #e8c9c4; color: var(--danger); }
.btn:disabled, .chip:disabled { opacity: .55; cursor: not-allowed; }
.btn.block, .full { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { min-height: 40px; padding: .46rem .83rem; border-radius: 999px; font-size: .865rem; }
.chip.active, .chip[aria-pressed="true"], .chip[aria-selected="true"] { border-color: var(--orange); background: var(--orange-tint); color: var(--orange-dark); }
.form { display: grid; gap: 1rem; width: 100%; max-width: 43rem; align-content: start; }
.form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.form fieldset legend { margin-bottom: .45rem; }
.field { display: grid; gap: .38rem; align-content: start; min-width: 0; }
label, legend { font-weight: 650; }
.field > small, .form small { font-weight: 400; color: var(--muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 46px; padding: .64rem .78rem; border: 1px solid #cec6bd; border-radius: 10px;
  color: var(--ink); background: #fff; font-size: 1rem; font-weight: 450; line-height: 1.4;
}
textarea { min-height: 6rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: #756e66; opacity: 1; }
input[type="file"] { display: block; max-width: 100%; min-height: 44px; color: var(--muted); font-size: .875rem; }
input[type="file"]::file-selector-button { margin-right: .6rem; padding: .58rem .8rem; border: 1px solid #dcd5ce; border-radius: 9px; color: var(--orange-dark); background: white; font: inherit; font-weight: 660; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--orange); width: 1.12em; height: 1.12em; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.notice, .error { padding: .7rem .9rem; border: 1px solid #f0d7c6; border-radius: 11px; background: #fff5ed; color: #663314; font-size: .92rem; }
.error { border-color: #ebc9c3; background: #fff3f1; color: var(--danger); }
.notice:empty, .error:empty, .toast:empty { display: none; }
.chat-log { display: flex; flex-direction: column; gap: .55rem; padding: 1rem 0; min-width: 0; }
.message { align-self: flex-start; max-width: min(86%, 38rem); padding: .58rem .8rem; border-radius: 13px 13px 13px 3px; color: var(--ink); background: #f2ede7; overflow-wrap: anywhere; white-space: pre-line; }
.message.mine { align-self: flex-end; color: #613319; background: var(--orange-tint); border-radius: 13px 13px 3px 13px; }
.message small { display: block; margin-top: .25rem; color: var(--muted); font-size: .73rem; font-variant-numeric: tabular-nums; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); padding: .64rem .92rem; border-radius: 10px; color: white; background: var(--ink); font-size: .9rem; box-shadow: 0 3px 12px #32291e22; }

@media (hover:hover) {
  .nav-link:hover, .btn.secondary:hover, .btn:not(.primary):not(.danger):not(:disabled):hover, .chip:not(:disabled):hover { background: #f7f2ed; }
  .btn.primary:not(:disabled):hover { background: var(--orange-dark); border-color: var(--orange-dark); }
  .btn.danger:not(:disabled):hover { background: #fce7e4; }
  .nav-link[aria-current="page"]:hover, .nav-link.active:hover, .chip.active:hover, .chip[aria-pressed="true"]:hover { background: #ffeadc; }
}
@media (max-width: 850px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .head-inner, .site-head:not(:has(.head-inner)) { min-height: 60px; gap: .5rem; padding: .68rem 1rem; }
  .shell { display: block; min-height: 0; padding: 1.1rem 1rem 2rem; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; margin: 0 0 1rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar .nav-link { width: auto; }
  body:has(.mobile-nav) .sidebar { display: none; }
  body:has(.mobile-nav) .shell { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  .mobile-nav {
    display: flex; justify-content: center; align-items: stretch; gap: .12rem; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    min-height: 58px; padding: .28rem .28rem max(.3rem, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line);
  }
  .mobile-nav .nav-link { display: flex; flex: 1 1 0; flex-direction: column; justify-content: center; gap: .16rem; width: auto; min-width: 0; max-width: 8rem; padding: .35rem .1rem; text-align: center; font-size: .75rem; font-weight: 675; }
  .mobile-nav .nav-link svg { width: 1.12rem; height: 1.12rem; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 152px), 1fr)); gap: .75rem; }
  .hero { margin-bottom: 1rem; }
  .card, .tile { padding: 1rem; }
  .item-card { padding: 0; }
  .empty { min-height: 210px; }
  body:has(.mobile-nav) .toast { bottom: calc(4.6rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .head-inner, .site-head:not(:has(.head-inner)) { padding-inline: .8rem; }
  .shell { padding-inline: .8rem; }
  .head-actions { gap: .3rem; }
  .head-actions .btn { padding-inline: .55rem; }
  .actions { gap: .45rem; }
  .thumb, img.thumb { width: 48px; height: 48px; }
}
@media (pointer:coarse) {
  .chip, .photo-strip button, input[type="file"]::file-selector-button { min-height: 44px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
@media (forced-colors:active) {
  .btn, .chip, .nav-link[aria-current="page"], .nav-link.active { border: 1px solid ButtonText; }
  .chip.active, .chip[aria-pressed="true"] { outline: 2px solid Highlight; }
}
