/* Jamii Board - mobile-first, thumb-friendly */
:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1d1c1a;
  --muted: #6b6760;
  --line: #e4e0d7;
  --brand: #0f5c3c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f0e9;
  --accent: #b8321f;
  --accent-soft: #fbe9e5;
  --request: #8a5a00;
  --request-soft: #fdf1d8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--brand); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: var(--brand-ink); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 12px; }
.logo { color: inherit; text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #fff; color: var(--brand); font-size: .95rem; }
.topbar nav { display: flex; gap: 8px; align-items: center; }
.topbar nav a.link { color: #d8eadf; text-decoration: none; font-size: .95rem; padding: 8px 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-light { background: #fff; color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--accent); }
.btn-wa { background: #1fa855; font-size: 1.05rem; min-height: 54px; width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* Hero + search */
.hero { padding: 20px 0 6px; }
.hero h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); }
.search { position: relative; margin: 14px 0 10px; }
.search input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); background: #fff; padding: 0 16px 0 44px; font-size: 1rem; box-shadow: var(--shadow); }
.search input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.search svg { position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; color: var(--muted); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.segmented { display: inline-flex; background: #ebe7de; border-radius: 12px; padding: 3px; }
.segmented button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: .92rem; color: var(--muted); cursor: pointer; min-height: 38px; }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.select { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 12px; flex: 1; min-width: 160px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: .92rem; font-weight: 600; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip .count { color: var(--muted); font-weight: 500; font-size: .82rem; }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip[aria-pressed="true"] .count { color: #cfe5d8; }

.result-bar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; margin: 4px 0 10px; gap: 8px; }
.result-bar button { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 6px 0; }

/* Cards */
.list { display: grid; gap: 10px; padding-bottom: 20px; }
.card { display: block; background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; border: 1px solid transparent; position: relative; }
.card:hover { border-color: var(--line); }
.card.featured { border-color: #e7c66b; background: linear-gradient(0deg, #fff, #fffaf0); }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.card h3 { font-size: 1.05rem; margin: 0 0 4px; line-height: 1.3; }
.card .desc { margin: 0 0 8px; color: #45423d; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .86rem; }
.meta .price { color: var(--ink); font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 8px; border-radius: 6px; }
.badge-offer { background: var(--brand-soft); color: var(--brand); }
.badge-request { background: var(--request-soft); color: var(--request); }
.badge-cat { background: #f0ede6; color: #4a463f; text-transform: none; letter-spacing: 0; font-weight: 600; }
.badge-featured { background: #fbecc0; color: #7a5600; }
.badge-sample { background: #ece9ff; color: #4b3fb0; }

.empty { text-align: center; padding: 36px 16px; background: #fff; border-radius: var(--radius); border: 1px dashed var(--line); color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.more { display: flex; justify-content: center; padding: 6px 0 24px; }

/* Panels / detail */
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 16px 0; }
.detail h1 { font-size: 1.4rem; line-height: 1.25; margin: 8px 0 6px; }
.detail .desc-full { white-space: pre-wrap; margin: 14px 0; font-size: 1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.fact { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.fact span { display: block; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.fact b { font-size: 1rem; }
.share-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.share-row .btn { flex: 1; }
.notice { border-radius: 12px; padding: 12px 14px; font-size: .95rem; margin: 12px 0; }
.notice-info { background: var(--brand-soft); color: #0c4a30; }
.notice-warn { background: var(--request-soft); color: #6b4600; }
.notice-bad { background: var(--accent-soft); color: #7e1f12; }
.small { font-size: .88rem; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; margin-top: 14px; padding: 6px 0; }

/* Forms */
.form h1 { font-size: 1.35rem; margin: 18px 0 4px; }
.field { margin: 14px 0; }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { display: block; font-weight: 400; font-size: .86rem; color: var(--muted); margin-top: -2px; margin-bottom: 6px; }
.field input[type=text], .field input[type=tel], .field input[type=email], .field input[type=password], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 10px 14px; font-size: 1rem;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--accent); }
.field .err { color: var(--accent); font-size: .88rem; margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.type-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-pick label { display: block; border: 2px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; background: #fff; font-weight: 700; }
.type-pick label small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; }
.type-pick input { position: absolute; opacity: 0; }
.type-pick input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.type-pick input:focus-visible + label { outline: 2px solid var(--brand); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }
.counter { text-align: right; font-size: .8rem; color: var(--muted); }
.hp { position: absolute; left: -9999px; }

.copy-box { display: flex; gap: 8px; margin: 8px 0; }
.copy-box input { flex: 1; min-height: 46px; border-radius: 10px; border: 1px solid var(--line); padding: 0 12px; font-size: .9rem; background: var(--bg); }

/* Safety page */
.prose h2 { font-size: 1.1rem; margin: 22px 0 6px; }
.prose ul { padding-left: 20px; margin: 6px 0; }
.prose li { margin: 4px 0; }

/* Footer */
footer { color: var(--muted); font-size: .86rem; padding: 24px 0 40px; border-top: 1px solid var(--line); margin-top: 20px; }
footer a { color: var(--muted); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: #1d1c1a; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: .95rem; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Dialog */
dialog { border: 0; border-radius: 16px; padding: 20px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin: 0 0 10px; font-size: 1.15rem; }
.radio-list label { display: flex; gap: 10px; align-items: center; padding: 8px 0; font-weight: 500; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* Skeleton */
.skeleton { height: 108px; border-radius: var(--radius); background: linear-gradient(90deg, #ece8df 0%, #f5f2ec 50%, #ece8df 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Admin */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.3rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.admin-card { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; }
.admin-card .desc { white-space: pre-wrap; font-size: .93rem; margin: 6px 0; color: #45423d; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.flag { color: var(--accent); font-weight: 700; }
