/* Sellum — one stylesheet, no frameworks. Light/dark via prefers-color-scheme. */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --text: #26211a;
  --muted: #7a7062;
  --border: #e5ddd0;
  --accent: #c2571b;          /* terracotta */
  --accent-hover: #a84a15;
  --accent-soft: #fbe8dc;
  --ok: #2c7a4b;
  --ok-soft: #e2f3e9;
  --error: #b3372f;
  --error-soft: #fbe5e3;
  --feature: #b8860b;
  --feature-soft: #fdf3d7;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(40, 30, 15, 0.08), 0 4px 14px rgba(40, 30, 15, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191512;
    --surface: #221d18;
    --surface-2: #2b241d;
    --text: #ede5da;
    --muted: #a3968a;
    --border: #3a322a;
    --accent: #e07033;
    --accent-hover: #ef8146;
    --accent-soft: #3a2417;
    --ok: #56b380;
    --ok-soft: #1d3328;
    --error: #e2685f;
    --error-soft: #3a201d;
    --feature: #d9a521;
    --feature-soft: #362b10;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
img { max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 1rem; flex-wrap: wrap;
}
.brand {
  font-size: 1.45rem; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-dot { color: var(--accent); }
.nav-search { display: flex; flex: 1 1 220px; max-width: 420px; }
.nav-search input {
  flex: 1; border: 1px solid var(--border); border-right: 0;
  border-radius: 8px 0 0 8px; padding: 0.45rem 0.7rem;
  background: var(--bg); color: var(--text); font-size: 0.95rem;
}
.nav-search button {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 0 8px 8px 0; padding: 0.45rem 0.9rem; cursor: pointer;
}
.site-nav { display: flex; align-items: center; gap: 0.9rem; margin-left: auto; flex-wrap: wrap; }
.site-nav > a { color: var(--text); font-weight: 500; }
.badge-dot {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 0.72rem; padding: 0.05rem 0.45rem; font-weight: 700;
  vertical-align: 2px;
}
.user-menu { position: relative; }
.user-menu summary {
  cursor: pointer; list-style: none; font-weight: 600; color: var(--text);
  padding: 0.3rem 0.5rem; border-radius: 8px;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu[open] summary { background: var(--surface-2); }
.menu-pop {
  position: absolute; right: 0; top: 2.2rem; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; padding: 0.4rem; z-index: 30;
}
.menu-pop a, .menu-pop .linklike {
  padding: 0.45rem 0.7rem; border-radius: 6px; color: var(--text);
  text-align: left; font: inherit; background: none; border: 0; cursor: pointer;
  width: 100%;
}
.menu-pop a:hover, .menu-pop .linklike:hover {
  background: var(--surface-2); text-decoration: none;
}

/* ---------- buttons, chips, flash ---------- */
.btn {
  display: inline-block; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600; text-align: center;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-quiet { background: transparent; }
.btn-feature { background: var(--feature-soft); border-color: var(--feature); color: var(--feature); }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 1.05rem; }
.btn-sm { padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.btn-nav { padding: 0.4rem 0.9rem; }
.btn-stack { display: flex; flex-direction: column; gap: 0.5rem; }
.btn-stack .btn { width: 100%; }

.chip {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  padding: 0.1rem 0.55rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.chip-skill { background: var(--accent-soft); color: var(--accent); }
.chip-trade { background: var(--accent-soft); color: var(--accent); }
.chip-ok, .chip-accepted, .chip-completed, .chip-active, .chip-paid
  { background: var(--ok-soft); color: var(--ok); }
.chip-pending { background: var(--feature-soft); color: var(--feature); }
.chip-declined, .chip-withdrawn, .chip-removed, .chip-error
  { background: var(--error-soft); color: var(--error); }

.flash {
  margin: 0.9rem 0; padding: 0.7rem 1rem; border-radius: var(--radius);
  background: var(--ok-soft); color: var(--ok); font-weight: 600;
}
.flash-error { background: var(--error-soft); color: var(--error); }

/* ---------- hero / home ---------- */
.hero { text-align: center; padding: 3rem 0 2.2rem; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -0.02em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero-sub { font-size: 1.12rem; color: var(--muted); max-width: 560px; margin: 0.6rem auto 1.4rem; }
.hero-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.hero-stats { margin-top: 1.2rem; font-size: 0.9rem; }

section { margin: 2.2rem 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.9rem;
}
.see-all { font-weight: 600; white-space: nowrap; }

.how-it-works { text-align: center; padding: 1rem 0 2rem; }
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem; margin-top: 1.2rem;
}
.step {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.1rem;
}
.step-emoji { font-size: 2rem; margin-bottom: 0.4rem; }
.step p { color: var(--muted); margin: 0.3rem 0 0; }

/* ---------- listing cards ---------- */
.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.card-featured { border-color: var(--feature); box-shadow: 0 0 0 1px var(--feature); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; font-size: 2.6rem;
  background: linear-gradient(135deg, var(--surface-2), var(--accent-soft));
}
.ribbon {
  position: absolute; top: 0.5rem; left: 0.5rem;
  background: var(--feature); color: #fff; font-size: 0.7rem; font-weight: 800;
  padding: 0.12rem 0.5rem; border-radius: 4px; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ribbon-inline { position: static; vertical-align: middle; margin-left: 0.4rem; }
.card-img .chip-skill { position: absolute; bottom: 0.5rem; left: 0.5rem; }
.card-body { padding: 0.7rem 0.85rem 0.85rem; }
.card-title {
  font-size: 0.98rem; margin: 0 0 0.25rem; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price { font-size: 0.95rem; }
.trade-tag { color: var(--accent); }
.card-meta { font-size: 0.82rem; margin-top: 0.2rem; }
.card-wrap .card-under {
  display: flex; gap: 0.6rem; align-items: center; padding: 0.35rem 0.2rem;
  font-size: 0.85rem;
}

.empty {
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 1.4rem; text-align: center;
  color: var(--muted);
}

/* ---------- browse ---------- */
.browse-layout { display: grid; grid-template-columns: 230px 1fr; gap: 1.6rem; margin-top: 1.4rem; }
.filters {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; align-self: start;
  position: sticky; top: 4.4rem;
}
.filters h3 { margin: 0.9rem 0 0.35rem; font-size: 0.82rem; text-transform: uppercase;
              letter-spacing: 0.05em; color: var(--muted); }
.filters h3:first-child { margin-top: 0; }
.filters label { display: block; margin: 0.2rem 0; font-size: 0.95rem; }
.filters select, .filters input[type="text"] {
  width: 100%; padding: 0.4rem 0.5rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--text); font: inherit;
}
.filters .btn { width: 100%; margin-top: 1rem; }
.clear-link { display: block; text-align: center; margin-top: 0.5rem; font-size: 0.88rem; }
.results-head { display: flex; align-items: baseline; gap: 0.8rem; margin-bottom: 1rem; }
.results-head h1 { font-size: 1.35rem; margin: 0; }

.pagination { display: flex; gap: 0.4rem; justify-content: center; margin: 1.6rem 0; }
.pagination a, .pagination .current {
  padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
}
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- listing detail ---------- */
.listing-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.8rem; margin-top: 1.4rem; }
.gallery-hero {
  width: 100%; max-height: 460px; object-fit: contain;
  background: var(--surface-2); border-radius: var(--radius);
}
.gallery-placeholder {
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-2), var(--accent-soft));
}
.gallery-thumbs { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 74px; height: 74px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border);
}
.listing-head { margin-top: 1rem; }
.price-line { display: flex; align-items: center; gap: 0.7rem; margin: 0.8rem 0; }
.price { font-size: 1.7rem; font-weight: 800; }
.price-sm { font-weight: 700; }
.wanted-box {
  background: var(--accent-soft); border-radius: var(--radius);
  padding: 0.7rem 1rem; margin: 0.8rem 0;
}
.listing-desc { white-space: pre-line; margin-top: 1rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.1rem;
}
.panel h2 { font-size: 1.1rem; }
.panel h3 { margin-bottom: 0.7rem; }
.panel textarea, .panel input[type="number"], .panel select {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--text); font: inherit;
  margin: 0.25rem 0 0.6rem;
}
.panel form .btn { width: 100%; }
.seller-link { display: flex; align-items: center; gap: 0.7rem; color: var(--text); }
.seller-link:hover { text-decoration: none; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; }
.rating-line { margin-top: 0.5rem; font-size: 0.92rem; }
.stars { color: var(--feature); letter-spacing: 0.08em; }

.offer-form label { display: block; font-size: 0.92rem; font-weight: 600; }
.offer-box {
  border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem;
  margin-bottom: 0.7rem;
}
.offer-accepted { border-color: var(--ok); background: var(--ok-soft); }
.offer-terms { margin: 0.3rem 0; }
.offer-note { color: var(--muted); font-style: italic; margin: 0.3rem 0; }
.offer-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.5rem; }
.offer-actions form { display: inline; }

/* ---------- forms ---------- */
.form-page, .auth-page { max-width: 640px; margin: 1.6rem auto; }
.auth-page { max-width: 420px; }
.form-page label, .auth-page label {
  display: block; font-weight: 600; margin: 0.9rem 0 0; font-size: 0.95rem;
}
.form-page input, .form-page textarea, .form-page select,
.auth-page input {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; margin-top: 0.3rem;
}
.form-page .btn-lg, .auth-page .btn-lg { margin-top: 1.3rem; width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-error { color: var(--error); font-size: 0.85rem; font-weight: 600; display: block; }
.auth-alt { text-align: center; margin-top: 1.1rem; }

.kind-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem;
               border: 0; padding: 0; margin: 0 0 0.6rem; }
.kind-option {
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1rem; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.kind-option.selected, .kind-option:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft);
}
.kind-option input { position: absolute; opacity: 0; }
.kind-emoji { font-size: 1.8rem; }

.photo-manage { margin-top: 1rem; }
.photo-strip { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.photo-tile { position: relative; }
.photo-tile img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; }
.photo-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: 0; background: var(--error); color: #fff;
  cursor: pointer; font-size: 0.7rem; line-height: 1;
}

.star-picker { border: 0; padding: 0; margin: 1rem 0 0; }
.star-picker legend { font-weight: 600; margin-bottom: 0.4rem; }
.star-option {
  display: flex; gap: 0.7rem; align-items: center; padding: 0.45rem 0.6rem;
  border-radius: 8px; cursor: pointer;
}
.star-option:has(input:checked) { background: var(--accent-soft); }
.star-option span:first-of-type { color: var(--feature); letter-spacing: 0.1em; }

/* ---------- dashboard / stats ---------- */
.dash-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem; margin: 1.3rem 0;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; text-align: center;
  color: var(--text); display: flex; flex-direction: column; gap: 0.15rem;
}
.stat:hover { text-decoration: none; box-shadow: var(--shadow); }
.stat strong { font-size: 1.6rem; color: var(--accent); }
.stat span { color: var(--muted); font-size: 0.88rem; }
.stat-money strong { color: var(--ok); }
.row-line {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border);
}
.row-line:last-child { border-bottom: 0; }

/* ---------- inbox / thread ---------- */
.thread-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1.2rem; }
.thread-row {
  display: flex; gap: 0.9rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.8rem 1rem; color: var(--text);
}
.thread-row:hover { text-decoration: none; box-shadow: var(--shadow); }
.thread-unread { border-left: 4px solid var(--accent); }
.thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thread-preview {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 0.9rem;
}
.thread-side { text-align: right; display: flex; flex-direction: column; gap: 0.25rem;
               align-items: flex-end; font-size: 0.85rem; }

.thread-page { max-width: 720px; margin: 1.4rem auto; }
.thread-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.thread-offers { margin: 0.8rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.offer-inline {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.5rem 0.8rem; font-size: 0.92rem;
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.inline-form { display: inline; }
.messages {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin: 1rem 0;
  display: flex; flex-direction: column; gap: 0.7rem;
  max-height: 60vh; overflow-y: auto;
}
.msg { max-width: 78%; align-self: flex-start; }
.msg-mine { align-self: flex-end; text-align: right; }
.msg-body {
  background: var(--surface-2); border-radius: 12px 12px 12px 4px;
  padding: 0.55rem 0.85rem; white-space: pre-line; display: inline-block;
  text-align: left;
}
.msg-mine .msg-body {
  background: var(--accent); color: #fff; border-radius: 12px 12px 4px 12px;
}
.msg-time { font-size: 0.75rem; margin-top: 0.15rem; }
.msg-compose { display: flex; gap: 0.6rem; align-items: stretch; }
.msg-compose textarea {
  flex: 1; padding: 0.6rem 0.8rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; resize: vertical;
}

/* ---------- profile ---------- */
.profile-head { display: flex; gap: 1.1rem; align-items: center; margin: 1.5rem 0 1rem; }
.profile-bio { white-space: pre-line; max-width: 640px; }
.review-list { display: flex; flex-direction: column; gap: 0.8rem; }
.review {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem 1rem;
}
.review-top { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.review p { margin: 0.4rem 0 0; }

/* ---------- tables / admin ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface);
         border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 0.55rem 0.8rem; text-align: left;
                       border-bottom: 1px solid var(--border); font-size: 0.93rem; }
.table th { background: var(--surface-2); font-size: 0.8rem; text-transform: uppercase;
            letter-spacing: 0.04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.admin-nav { display: flex; gap: 1rem; margin: 0.6rem 0 1.4rem; }
.admin-nav a { font-weight: 600; }
.admin-search { display: flex; gap: 0.6rem; margin-bottom: 1.2rem; max-width: 420px; }
.admin-search input { flex: 1; padding: 0.5rem 0.7rem; border: 1px solid var(--border);
                      border-radius: 8px; background: var(--surface); color: var(--text); }

/* ---------- pricing / prose / errors ---------- */
.prose { max-width: 680px; margin: 1.8rem auto; }
.prose h2 { margin-top: 1.6rem; }
.price-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin: 1.4rem 0; }
.price-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem;
}
.price-card-hi { border-color: var(--feature); box-shadow: 0 0 0 1px var(--feature); }
.price-big { font-size: 2rem; font-weight: 800; margin: 0.4rem 0; }
.price-card ul { padding-left: 1.2rem; }
.price-card li { margin: 0.35rem 0; }

.error-page { text-align: center; padding: 4rem 0; }
.error-emoji { font-size: 3.5rem; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 3rem;
  padding: 1.6rem 0 2.2rem; background: var(--surface);
}
.footer-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-nav { display: flex; gap: 1.1rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .browse-layout, .listing-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .form-row { grid-template-columns: 1fr; }
  .price-cards { grid-template-columns: 1fr; }
  .header-row { gap: 0.6rem; }
  .nav-search { order: 3; flex-basis: 100%; max-width: none; }
}
