/* Friendly, light, fast. No external fonts or libraries. Works right-to-left and left-to-right. */
:root {
  --bg: #fff9f0;
  --card: #ffffff;
  --ink: #23302b;
  --muted: #66766d;
  --brand: #17845b;
  --brand-dark: #0f6444;
  --brand-soft: #e6f5ee;
  --accent: #f6b23c;
  --accent-ink: #3b2800;
  --danger: #c8452f;
  --line: #eaded0;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 40, 10, .08);
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.6; padding-bottom: 76px;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid #f6b23c; outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { inset-inline-start: 8px; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic-s { width: 1em; height: 1em; vertical-align: -.15em; }
.center { text-align: center; }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1.05rem; }
.hint { color: var(--muted); font-size: .88rem; margin: .35rem 0 0; }
.label-like { display: block; font-weight: 600; margin-bottom: .25rem; }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand-dark); font-weight: 800; font-size: 1.3rem; }
.logo-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--brand); color: #fff; }
.top-nav { display: flex; align-items: center; gap: 14px; }
.link-plain { color: var(--ink); text-decoration: none; font-weight: 600; padding: 8px 4px; }
.link-plain:hover { color: var(--brand); }
.link-center { display: block; text-align: center; margin-top: .5rem; }
.lang-switch { border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: #fff; color: var(--ink);
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-sell { background: var(--accent); color: var(--accent-ink); }
.btn-sell:hover { background: #eaa127; }
.btn-ghost { border-color: var(--line); background: #fff; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-danger { border-color: #efc4bb; color: var(--danger); background: #fff; }
.btn-danger:hover { background: #fdf0ed; }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.1rem; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: .9rem; border-radius: 12px; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* messages */
.flash { margin: 14px 0; padding: 12px 16px; border-radius: 12px; font-weight: 600; }
.flash-ok { background: var(--brand-soft); color: var(--brand-dark); }
.flash-error { background: #fdeceb; color: #9b2c1c; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin: 12px 0; font-weight: 600; }
.banner-sold { background: var(--brand-soft); color: var(--brand-dark); }
.banner-warn { background: #fff1d6; color: #7a4d00; }
.banner-info { background: #eaf3ff; color: #1b4a80; }

/* hero and search */
.hero { background: linear-gradient(135deg, #17845b, #22a06f); color: #fff; border-radius: 24px; padding: 26px 18px 20px; margin: 16px 0; }
.hero h1 { font-size: 1.7rem; margin-bottom: .25rem; }
.hero-sub { opacity: .95; margin-bottom: 16px; }
.search-row { display: flex; gap: 8px; background: #fff; border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.search-row input[type=search] { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; padding: 0 8px; color: var(--ink); outline: none; }
.search-go span { display: none; }
.mic-btn { width: 48px; height: 48px; flex: none; border-radius: 14px; border: 0; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; cursor: pointer; }
.mic-btn.listening, .mic-big.listening { animation: pulse 1.2s infinite; background: #fde3df; color: var(--danger); }
.voice-status { margin: 10px 4px 0; font-weight: 600; }
.filters { margin-top: 12px; }
.filters summary { cursor: pointer; font-weight: 700; padding: 6px 4px; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: " \25BE"; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.filter-grid label span { display: block; font-size: .85rem; margin-bottom: 2px; opacity: .95; }
.filter-actions { display: flex; gap: 8px; margin-top: 12px; }
.filters .btn-primary { background: var(--accent); color: var(--accent-ink); }
.filters .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }

/* forms */
input[type=text], input[type=search], input[type=tel], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid rgba(23,132,91,.18); }
.stack > * + * { margin-top: 14px; }
.field { display: block; border: 0; padding: 0; margin: 0; }
.field > span, .field > label > span, .field legend { display: block; font-weight: 700; margin-bottom: 4px; padding: 0; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 500; }
.check input { width: 20px; height: 20px; flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-card { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }

/* category tiles on home */
.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 18px 0; }
.cat-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); text-align: center; font-weight: 700; font-size: .95rem; }
.cat-tile:hover { outline: 2px solid var(--brand); }
.cat-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-dark); }

/* results and cards */
.sec-title { font-size: 1.25rem; margin: 22px 0 12px; }
.sec-sub { color: var(--muted); font-weight: 500; }
.sec-small { font-size: 1.05rem; margin-top: 18px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.card:hover { outline: 2px solid var(--brand); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: #f2ece2; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #b9ab95; }
.chip { position: absolute; top: 8px; inset-inline-start: 8px; background: rgba(255,255,255,.95); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 700; }
.card-body { padding: 10px 12px 12px; }
.card-price { font-weight: 800; color: var(--brand-dark); font-size: 1.05rem; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; min-height: 2.8em; margin: 2px 0 6px; }
.card-meta { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .82rem; flex-wrap: wrap; }
.dot { opacity: .6; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 24px 0; }
.pager-info { color: var(--muted); }
.empty { text-align: center; padding: 36px 16px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); margin: 16px 0; }
.empty-ic { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); margin-bottom: 10px; }
.empty-ic .ic { width: 30px; height: 30px; }
.empty-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.empty-sub { color: var(--muted); }

/* ad page */
.crumbs { display: flex; gap: 8px; padding: 12px 0 0; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.ad { display: grid; gap: 16px; margin-top: 10px; }
.ad-main { background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.gallery-main { display: block; background: #f2ece2; border-radius: 14px; overflow: hidden; }
.gallery-main img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; }
.gallery-none { display: grid; place-items: center; aspect-ratio: 4 / 3; background: #f2ece2; border-radius: 14px; color: #b9ab95; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs a { flex: none; border: 2px solid transparent; border-radius: 10px; overflow: hidden; }
.gallery-thumbs a.on { border-color: var(--brand); }
.gallery-thumbs img { display: block; width: 72px; height: 54px; object-fit: cover; }
.ad-head { margin-top: 14px; }
.ad-head h1 { font-size: 1.4rem; }
.ad-price { font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); }
.ad-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); margin-top: 4px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; }
.facts > div { background: var(--bg); border-radius: 12px; padding: 8px 12px; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.ad-desc { white-space: normal; overflow-wrap: anywhere; }
.ad-foot { color: var(--muted); font-size: .85rem; margin-top: 14px; }
.box { background: #fff; border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.ad-side > * + * { margin-top: 12px; }
.seller-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); flex: none; }
.avatar-lg { width: 64px; height: 64px; }
.seller-name { font-weight: 800; font-size: 1.1rem; margin: 0; }
.seller-sub { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .88rem; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 999px; background: #efe7da; font-size: .8rem; font-weight: 700; color: var(--ink); }
.badge-ok, .badge-active { background: var(--brand-soft); color: var(--brand-dark); }
.badge-sold { background: #e2ecff; color: #1b4a80; }
.badge-expired { background: #fff1d6; color: #7a4d00; }
.badge-removed { background: #fdeceb; color: #9b2c1c; }
.contact-links { display: grid; gap: 10px; }
.contact-phone { text-align: center; font-size: 1.4rem; font-weight: 800; direction: ltr; }
.btn-wa { background: #25a244; color: #fff; }
.btn-wa:hover { background: #1d8a38; }
.tips-title { font-weight: 800; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.tips ul { margin: 0; padding-inline-start: 20px; color: var(--muted); }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.report summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.report form { margin-top: 12px; }

/* post page */
.post h1 { margin-top: 18px; }
.voice-card { background: linear-gradient(135deg, #e6f5ee, #fff3d9); border-radius: 22px; padding: 18px; text-align: center; margin: 12px 0 16px; box-shadow: var(--shadow); }
.voice-head h2 { margin-bottom: 2px; }
.voice-head p { color: var(--muted); }
.voice-lang { display: inline-flex; background: #fff; border-radius: 999px; padding: 4px; gap: 4px; margin: 6px 0 12px; }
.voice-lang button { border: 0; background: transparent; border-radius: 999px; padding: 6px 16px; font: inherit; font-weight: 700; cursor: pointer; color: var(--muted); }
.voice-lang button.on { background: var(--brand); color: #fff; }
.mic-big { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 116px; height: 116px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; box-shadow: 0 6px 18px rgba(23,132,91,.35); }
.mic-big .ic { width: 38px; height: 38px; }
.mic-big.listening { color: var(--danger); box-shadow: none; }
.voice-live { min-height: 1.6em; font-weight: 700; margin: 12px 0 2px; }
.voice-example { color: var(--muted); font-size: .9rem; margin: 0; }
.cat-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.cat-opt { display: block; cursor: pointer; }
.cat-opt input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.cat-opt-in { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1.5px solid var(--line); border-radius: 14px; text-align: center; font-weight: 700; font-size: .9rem; background: #fff; }
.cat-opt input:checked + .cat-opt-in { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.cat-opt input:focus-visible + .cat-opt-in, .seg input:focus-visible + span { outline: 3px solid #f6b23c; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 700; cursor: pointer; background: #fff; }
.seg input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.js .cat-field:not(.on) { display: none; }
.filled { border-color: var(--accent) !important; background: #fffaf0 !important; box-shadow: 0 0 0 3px rgba(246,178,60,.25); }
.price-hint { background: #fff6e0; border-radius: 10px; padding: 8px 10px; color: #5c3d00; }
.price-hint button { margin-top: 6px; }
.photo-add { position: relative; cursor: pointer; margin-top: 8px; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-previews, .photo-existing { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.ph, .pv { position: relative; display: block; border-radius: 10px; overflow: hidden; background: #f2ece2; }
.ph img, .pv img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pv button { position: absolute; top: 4px; inset-inline-end: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.ph .check { position: absolute; bottom: 0; inset-inline: 0; margin: 0; padding: 2px 6px; background: rgba(255,255,255,.92); font-size: .78rem; }
.ph .check input { width: 16px; height: 16px; }

/* auth and prose */
.auth { max-width: 460px; margin: 24px auto; }
.auth-alt { text-align: center; margin-top: 16px; }
.lang-line { text-align: center; }
.prose { max-width: 720px; margin: 20px auto; background: #fff; padding: 20px; border-radius: 20px; box-shadow: var(--shadow); }
.checks { list-style: none; padding: 0; margin: 12px 0; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checks li .ic { color: var(--brand); margin-top: 4px; }
.req li { border: 0; padding: 2px 0; }
.req .ok { color: var(--brand-dark); }
.req .bad { color: var(--danger); font-weight: 700; }
.install h2 { margin-top: 10px; }

/* my ads */
.my-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.my-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.my-item { display: flex; gap: 12px; background: #fff; border-radius: 18px; padding: 10px; box-shadow: var(--shadow); }
.my-item.st-removed, .my-item.st-expired { opacity: .85; }
.my-thumb { flex: none; width: 96px; height: 72px; border-radius: 12px; overflow: hidden; background: #f2ece2; display: grid; place-items: center; color: #b9ab95; }
.my-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-info { min-width: 0; flex: 1; }
.my-title { font-weight: 800; color: var(--ink); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-price { color: var(--brand-dark); font-weight: 800; }
.my-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .85rem; margin: 4px 0 8px; }
.my-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.my-actions form { margin: 0; }

/* admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: #fff; text-decoration: none; font-weight: 700; color: var(--ink); border: 1.5px solid var(--line); }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .8rem; }
.admin-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.admin-list li { background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.inline { display: inline; margin: 0; }
.admin-search { display: flex; gap: 8px; margin: 8px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.stat-n { font-size: 1.8rem; font-weight: 800; color: var(--brand-dark); }
.stat-l { color: var(--muted); }

/* footer and tab bar */
.foot { margin-top: 36px; border-top: 1px solid var(--line); padding: 18px 0; color: var(--muted); }
.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }
.foot-note { margin: 8px 0 0; font-size: .85rem; }
.tabbar { position: fixed; bottom: 0; inset-inline: 0; display: flex; justify-content: space-around; align-items: center; background: #fff; border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 700; min-width: 64px; padding: 4px 8px; }
.tabbar a.on { color: var(--brand-dark); }
.tabbar .tab-sell { background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 6px 18px; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(200,69,47,.45); } 70% { box-shadow: 0 0 0 16px rgba(200,69,47,0); } 100% { box-shadow: 0 0 0 0 rgba(200,69,47,0); } }
@media (prefers-reduced-motion: reduce) { .listening { animation: none !important; } }

@media (max-width: 719px) {
  .top-nav .btn-sell, .top-nav .link-plain { display: none; }
}
@media (min-width: 720px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .search-go span { display: inline; }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 34px 32px 26px; }
  .hero h1 { font-size: 2.1rem; }
  .ad-main { padding: 18px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .ad { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .ad-side { position: sticky; top: 76px; }
  .filter-grid { grid-template-columns: repeat(6, 1fr); }
}
