:root {
  --green: #2F4A2A; --green-2: #47663F; --leaf: #E3E8D3;
  --ground: #F3EEDF; --card: #FBF8EF; --line: #D9D1BC; --line-2: #B5AC93;
  --brown: #6B4A2F; --brown-2: #85603F; --wheat: #D9A441; --sand: #F1E3C2; --track: #E6DFCB;
  --text: #23291F; --muted: #5C5A4C; --danger: #9B2C1F; --danger-bg: #F6DDD6;
  --font: 'Tajawal', 'Noto Sans Arabic', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { background: #E6DFCB; }
body { margin: 0; font-family: var(--font); color: var(--text); background: #E6DFCB; -webkit-text-size-adjust: 100%; }
#app { max-width: 520px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; background: var(--ground); display: flex; flex-direction: column; }
main { flex: 1; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 20px; }
h1 { margin: 0; font-size: 28px; line-height: 1.35; font-weight: 800; text-wrap: balance; }
h2 { margin: 0; font-size: 20px; font-weight: 800; }
p { margin: 0; }
a { color: var(--green); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid var(--wheat); outline-offset: 2px; }
.muted { color: var(--muted); }
.lead { font-size: 17px; line-height: 1.5; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 20px; font-weight: 800; color: var(--green); }
.lang { display: flex; background: var(--track); border-radius: 24px; padding: 3px; }
.lang button { min-width: 48px; height: 42px; border: 0; border-radius: 21px; background: transparent; color: #4A4838; font-size: 15px; font-weight: 700; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--green); color: #fff; }

.entry { display: flex; align-items: center; gap: 14px; min-height: 100px; padding: 16px 18px; border-radius: 18px; color: #fff; text-decoration: none; }
.entry.buy { background: var(--green); } .entry.sell { background: var(--brown); }
.entry .ico { width: 56px; height: 56px; flex-shrink: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.entry.buy .ico { background: var(--green-2); } .entry.sell .ico { background: var(--brown-2); }
.entry b { display: block; font-size: 24px; font-weight: 800; }
.entry span.sub { font-size: 15px; line-height: 1.5; opacity: .92; }
.dashed { min-height: 52px; padding: 8px 14px; border-radius: 14px; border: 1px dashed var(--brown); background: var(--card); color: var(--text); text-decoration: none; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-align: center; }

.crops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.crop { min-height: 92px; padding: 8px 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--text); font-size: 15px; line-height: 1.2; font-weight: 700; text-align: center; }

.help { min-height: 60px; padding: 8px 16px; border-radius: 14px; background: var(--leaf); color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 12px; }
.help .dot { width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.help b { display: block; font-size: 16px; font-weight: 800; }

.back { width: 48px; height: 48px; flex-shrink: 0; border-radius: 24px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.pagehead { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.pagehead h1 { font-size: 24px; flex: 1; }

.card { display: flex; gap: 12px; padding: 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.thumb { width: 88px; height: 88px; flex-shrink: 0; border-radius: 10px; background: var(--leaf); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img, .hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .t { font-size: 19px; font-weight: 800; } .card .a { font-size: 15px; font-weight: 700; color: var(--brown); }
.card .m { font-size: 14px; color: var(--muted); } .card .p { font-size: 16px; font-weight: 800; color: var(--green); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 12px; font-size: 13px; font-weight: 700; background: var(--leaf); color: var(--text); }
.pill.sand { background: var(--sand); color: #3D3320; } .pill.gray { background: var(--track); } .pill.red { background: var(--danger-bg); color: var(--danger); }

.hero { margin: -16px -20px 0; height: 230px; background: var(--leaf); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero .back { position: absolute; top: 16px; inset-inline-start: 20px; }
.price { font-size: 24px; font-weight: 800; color: var(--green); }
.fact { padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.fact small { display: block; font-size: 14px; color: var(--muted); } .fact b { font-size: 18px; font-weight: 800; }
.note { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--leaf); font-size: 16px; font-weight: 700; }
.note.sand { background: var(--sand); color: #3D3320; font-size: 15px; font-weight: 500; line-height: 1.6; }
.note.err { background: var(--danger-bg); color: var(--danger); }
.note svg { flex-shrink: 0; }

label, .label { font-size: 16px; font-weight: 700; display: block; margin-bottom: 6px; }
input[type="text"], input[type="tel"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; height: 52px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card); font-size: 17px; color: var(--text); }
textarea { height: 88px; padding: 12px 14px; resize: vertical; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--track); }
.seg button { height: 48px; border: 0; border-radius: 10px; background: transparent; color: #3D4236; font-size: 17px; font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--green); color: #fff; }
.photo-btn { width: 100%; min-height: 60px; border-radius: 12px; border: 2px dashed var(--green); background: var(--leaf); color: var(--green); font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; } .previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn { min-height: 58px; padding: 8px 16px; border: 0; border-radius: 14px; background: var(--green); color: #fff; text-decoration: none; font-size: 19px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; width: 100%; text-align: center; }
.btn.brown { background: var(--brown); }
.btn.line { min-height: 52px; background: var(--card); border: 2px solid var(--green); color: var(--green); font-size: 17px; }
.btn.small { min-height: 44px; font-size: 15px; width: auto; padding: 6px 12px; border-radius: 10px; }
.btn.danger { background: var(--card); border: 2px solid var(--danger); color: var(--danger); }
.btn[disabled] { opacity: .6; cursor: default; }
.hint { font-size: 14px; color: var(--muted); text-align: center; }
.center { text-align: center; align-items: center; }
.bigcheck { width: 88px; height: 88px; border-radius: 44px; background: var(--green); display: flex; align-items: center; justify-content: center; margin: 24px auto 0; }

nav.tabs { position: sticky; bottom: 0; height: 72px; background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; padding-bottom: env(safe-area-inset-bottom); }
nav.tabs a { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: 14px; color: var(--muted); font-weight: 500; }
nav.tabs a[aria-current="page"] { color: var(--green); font-weight: 800; }

/* admin */
.atabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--track); }
.atabs button { min-height: 46px; border: 0; border-radius: 10px; background: transparent; font-size: 15px; font-weight: 700; color: #3D4236; cursor: pointer; }
.atabs button[aria-pressed="true"] { background: var(--green); color: #fff; }
.item { padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.item .t { font-size: 18px; font-weight: 800; } .item .m { font-size: 15px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (prefers-reduced-motion: no-preference) { .btn, .entry, .crop { transition: transform .08s; } .btn:active, .entry:active, .crop:active { transform: scale(.98); } }
