:root {
  --green: #1F6B4A;
  --green-dark: #164F37;
  --green-soft: #E3F0E9;
  --green-on: #D5EADF;
  --ground: #F4F6F3;
  --card: #FFFFFF;
  --ink: #17211D;
  --ink-2: #3F4A45;
  --muted: #5B6862;
  --line: #E3E8E5;
  --line-2: #EEF1EF;
  --promo: #FFF4D1;
  --promo-strong: #F3C62F;
  --promo-ink: #5C4600;
  --warn: #8A4B00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 33, 29, 0.08);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body {
  font-family: "IBM Plex Sans Arabic", Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
html[lang="en"] body { font-family: Inter, "IBM Plex Sans Arabic", system-ui, sans-serif; }
a { color: var(--green); text-decoration: none; }
button { font: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.app { max-width: 560px; margin: 0 auto; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); min-height: 100vh; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* header */
.hero { background: var(--green); color: #fff; padding: calc(18px + env(safe-area-inset-top, 0px)) var(--gutter-r) 16px var(--gutter-l); display: flex; flex-direction: column; gap: 10px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand { font-weight: 700; font-size: 22px; }
.brand small { font-family: Inter, system-ui, sans-serif; font-weight: 600; font-size: 14px; opacity: .85; margin-inline-start: 6px; }
.pills { display: flex; gap: 6px; align-items: center; }
.pill { font-size: 12px; background: rgba(255,255,255,.16); padding: 4px 10px; border-radius: 999px; color: #fff; }
.pill-btn { border: 1px solid rgba(255,255,255,.5); background: transparent; min-height: 30px; padding: 3px 12px; font-weight: 600; }
.fresh { font-size: 13px; color: var(--green-on); }
.searchbox { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 0 12px; min-height: 46px; color: var(--muted); }
.searchbox input { border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); flex: 1; outline: none; min-width: 0; }
.bar { background: var(--card); border-bottom: 1px solid var(--line); padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter-r) 14px var(--gutter-l); display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; z-index: 5; }
.backlink { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; font-weight: 600; align-self: flex-start; }
.title { font-weight: 700; font-size: 24px; line-height: 1.2; margin: 0; text-wrap: balance; }
.sub { font-size: 13px; color: var(--muted); }

/* sections */
.section { padding: 14px var(--gutter-r) 0 var(--gutter-l); display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.h2 { font-weight: 700; font-size: 17px; margin: 0; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); }
html[lang="en"] .label { text-transform: uppercase; letter-spacing: .06em; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.note { font-size: 12px; color: var(--muted); text-align: center; padding: 6px 0; }

/* offers strip */
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px var(--gutter-r) 6px var(--gutter-l); margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l)); scroll-snap-type: x mandatory; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.offer-card { flex: none; width: 152px; scroll-snap-align: start; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; color: inherit; }
.offer-name { font-size: 13px; font-weight: 600; line-height: 1.3; height: 34px; overflow: hidden; }
.tag { align-self: flex-start; font-size: 11px; font-weight: 700; background: var(--promo); color: var(--promo-ink); padding: 2px 8px; border-radius: 999px; }
.tag-best { background: var(--promo-strong); color: #2A2200; }
.was { font-size: 12px; color: #6B6F6D; text-decoration: line-through; }
.price { font-weight: 700; }

/* categories */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cat { min-height: 78px; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; color: var(--ink); }
.cat b { font-size: 15px; }
.cat span { font-size: 12px; color: var(--muted); }
.cat em { font-style: normal; font-size: 11px; font-weight: 700; color: #7A5A00; }

/* rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); min-height: 56px; }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; }
.row-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.row-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.row-price { display: flex; flex-direction: column; align-items: flex-end; }
.row-price small { font-size: 11px; color: var(--muted); }
.row-price .price { color: var(--green); font-size: 15px; }
.stale { font-size: 11px; color: var(--warn); }

/* buttons */
.add { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--green); color: #fff; font-size: 22px; line-height: 1; flex: none; }
.added { width: 44px; height: 44px; border-radius: 22px; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; flex: none; border: 0; }
.qty { display: flex; align-items: center; gap: 4px; flex: none; }
.qty button { width: 40px; height: 40px; border-radius: 20px; border: 1px solid #D5DCD8; background: #fff; font-size: 18px; color: var(--ink); }
.qty button.plus { border: 0; background: var(--green); color: #fff; }
.qty span { min-width: 18px; text-align: center; font-weight: 700; }
.btn { min-height: 48px; border-radius: 12px; border: 1px solid var(--green); background: #fff; color: var(--green); font-weight: 600; padding: 0 16px; }
.btn-solid { background: var(--green); color: #fff; border: 0; }
.cta { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 10px var(--gutter-r) 10px var(--gutter-l); background: linear-gradient(to top, var(--ground) 70%, transparent); }
.cta a { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 0 18px; border-radius: 14px; background: var(--green); color: #fff; font-weight: 600; }

/* compare */
.winner { background: var(--green); color: #fff; border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.winner .label { color: #CDE5D8; }
.winner-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 22px; font-weight: 700; }
.splitcard { background: var(--promo); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.splitcard .top { display: flex; justify-content: space-between; font-weight: 700; gap: 8px; }
.splitcard .bottom { font-size: 12px; color: var(--promo-ink); }
.rank { width: 22px; font-size: 13px; color: var(--muted); }
.miss { font-size: 12px; color: var(--warn); }
.empty { padding: 32px 20px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; color: var(--muted); }

/* item */
.big { font-size: 26px; font-weight: 700; color: var(--green); }

/* tabs */
.tabs { position: fixed; inset: auto 0 0 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 4px var(--gutter-r) calc(8px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); z-index: 10; }
.tabs a { flex: 1; max-width: 180px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 500; position: relative; }
.tabs a.on { color: var(--green); font-weight: 600; }
.badge { position: absolute; top: 2px; inset-inline-end: calc(50% - 22px); background: var(--promo-strong); color: #2A2200; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
:focus-visible { outline: 3px solid var(--promo-strong); outline-offset: 2px; }
@media (min-width: 420px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
