:root {
  --bg: #f6f0e7;
  --bg-2: #fffaf4;
  --paper: #ffffff;
  --ink: #171310;
  --ink-soft: #695d53;
  --line: rgba(23, 19, 16, 0.08);
  --line-strong: rgba(23, 19, 16, 0.14);
  --saffron: #f08a1e;
  --saffron-deep: #c66500;
  --green: #18804c;
  --green-soft: #e2f3ea;
  --danger: #b83e3e;
  --danger-soft: #f9e1e1;
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --shadow: 0 14px 40px rgba(23, 19, 16, 0.08);
  --font-ar: "Alexandria", system-ui, sans-serif;
  --font-num: "Manrope", "Alexandria", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { direction: rtl; }
body {
  margin: 0;
  background: radial-gradient(circle at top right, rgba(240,138,30,.18), transparent 22rem), var(--bg);
  color: var(--ink);
  font-family: var(--font-ar);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button {
  cursor: pointer;
  border: 0;
  background: none;
}

.page-shell {
  min-height: 100vh;
  padding: 18px;
}

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top right, rgba(240,138,30,.18), transparent 26rem),
    linear-gradient(180deg, #171310 0%, #211911 100%);
  color: #fff8ef;
  transition: opacity .5s ease, visibility .5s ease;
}

.intro-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-shell {
  width: min(92vw, 520px);
  display: grid;
  gap: 18px;
}

.intro-copy {
  text-align: right;
}

.intro-kicker,
.brand-en {
  display: block;
  font-family: var(--font-num);
  letter-spacing: .18em;
  font-size: 11px;
  font-weight: 800;
  opacity: .7;
}

.intro-copy strong,
.brand-ar {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.intro-copy p {
  margin: 10px 0 0;
  color: rgba(255,248,239,.78);
  font-size: 14px;
}

.intro-stage {
  position: relative;
  min-height: 250px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 34px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  overflow: hidden;
}

.intro-stage::after {
  content: "";
  position: absolute;
  inset: auto -50px -70px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(240,138,30,.18), transparent 72%);
}

.intro-path-svg {
  width: 100%;
  height: auto;
  display: block;
}

.intro-path-svg path {
  stroke: rgba(255,255,255,.42);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 0 12px rgba(240,138,30,.14));
}

.intro-orb {
  position: absolute;
  top: 0;
  left: 0;
  width: 74px;
  height: 74px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f08a1e, #ffba6b);
  box-shadow: 0 16px 32px rgba(240,138,30,.24);
  transform: translate(-50%, -50%);
}

.intro-orb img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.app-frame {
  width: min(100%, 460px);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.82));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 24px 60px rgba(23, 19, 16, 0.14);
  border-radius: 40px;
  overflow: hidden;
  min-height: calc(100vh - 36px);
  position: relative;
  opacity: 0;
  transform: translateY(24px) scale(.985);
  transition: opacity .55s ease, transform .55s ease;
}

body.app-ready .app-frame {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-scroll { padding: 16px 16px 110px; }
.status-row {
  display: flex;
  justify-content: space-between;
  direction: ltr;
  color: #2b241f;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px 8px;
}

.topbar, .section-head, .row-between, .ai-mini, .result-meta, .price-line, .provider-row, .nav-bar, .admin-grid, .admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { gap: 12px; }
.logo-chip, .icon-btn, .provider-badge, .metric, .tag, .nav-item, .sheet-chip, .admin-stat, .table-shell, .upload-box, .panel {
  border: 1px solid var(--line);
  background: var(--paper);
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(23,19,16,.05);
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--saffron), #ffb15b);
  font-weight: 900;
}

.logo-mark--brand {
  padding: 7px;
  background: linear-gradient(135deg, #171310, #3b2b1d);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

.logo-mark--brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-lockup {
  display: grid;
  gap: 2px;
}

.logo-chip strong { display:block; font-size: 18px; }
.logo-chip small { color: var(--ink-soft); font-size: 12px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
}

.hero {
  margin-top: 18px;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(145deg, #1d1712, #33271e);
  color: #fff8ef;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 29px;
  line-height: 1.25;
}
.hero p { margin: 0; color: rgba(255,248,239,.82); font-size: 14px; line-height: 1.7; }

.h-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 6px;
  scrollbar-width: none;
}

.h-row::-webkit-scrollbar { display: none; }

.deal-card {
  min-width: 228px;
  width: 228px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
}

.deal-card__media {
  height: 124px;
  position: relative;
}

.deal-card__media .food-thumb {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.deal-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

.deal-body {
  padding: 12px 14px 14px;
}

.deal-caption {
  color: var(--ink-mute);
  font-size: 11px;
  font-weight: 700;
}

.deal-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  margin: 4px 0 12px;
  min-height: 38px;
}

.old-price {
  color: var(--ink-soft);
  text-decoration: line-through;
  font-family: var(--font-num);
  font-size: 12px;
  margin-inline-start: 6px;
}

.hero small,
.section-head small,
.note,
.trust-note,
.result-meta,
.ai-mini,
.provider-copy small,
.breakdown,
.table-shell table,
.logo-chip small {
  line-height: 1.65;
}

.search-card, .ai-card, .budget-card, .result-card, .admin-card {
  margin-top: 16px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(23,19,16,.07);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 14px 36px rgba(23,19,16,.06);
}

.search-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  border-radius: 18px;
  padding: 15px 16px;
  font-size: 16px;
  outline: 0;
}

.helper-row, .tags-row, .results-list, .provider-list, .sheet-list, .admin-actions {
  display: grid;
  gap: 12px;
}

.helper-row { grid-template-columns: 1fr auto; margin-top: 12px; }
.cta-primary, .cta-secondary {
  border-radius: 16px;
  padding: 13px 16px;
  font-weight: 800;
}
.cta-primary { background: var(--saffron); color: white; }
.cta-secondary { background: #fff4e4; color: var(--saffron-deep); }

.tags-row { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: 4px; }
.tag {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag.active { background: var(--ink); color: white; border-color: var(--ink); }

.section-head { margin-top: 22px; margin-bottom: 12px; }
.section-head h2, .section-head h3 { margin: 0; }
.section-head small { color: var(--ink-soft); }

.ai-card {
  background: linear-gradient(180deg, #fff8ef, #fffaf6);
}
.ai-card .bubble {
  background: #fff;
  border: 1px solid rgba(240,138,30,.18);
  color: var(--ink);
  border-radius: 18px;
  padding: 14px;
  line-height: 1.7;
}
.ai-mini { gap: 8px; justify-content: flex-start; color: var(--ink-soft); font-size: 12px; margin-bottom: 10px; }

.budget-card input[type="range"] { width: 100%; accent-color: var(--saffron); }
.budget-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.budget-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
}
.budget-pill.active { background: var(--ink); color: white; border-color: var(--ink); }

.budget-card {
  background: linear-gradient(145deg, #1a1714 0%, #2d2621 100%);
  color: var(--cream);
  position: relative;
  overflow: hidden;
}

.budget-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  left: -60px;
  top: -40px;
  background: radial-gradient(circle, rgba(240,138,30,.3), rgba(240,138,30,0) 70%);
}

.budget-card .section-head,
.budget-card small,
.budget-card strong,
.budget-card .budget-summary { position: relative; z-index: 1; }

.budget-card .section-head small,
.budget-card .budget-summary {
  color: rgba(255,248,239,.75);
}

.budget-card .budget-pill {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.08);
  color: var(--cream);
}

.budget-card .budget-pill.active {
  background: var(--saffron);
  border-color: var(--saffron);
}

.budget-card input[type="range"] { accent-color: #ffba6b; }

.budget-summary {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.65;
}

.nearby-list {
  display: grid;
  gap: 10px;
}

.nearby-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--sh-1);
}

.nearby-row .food-thumb {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.providers-stack {
  display: flex;
  align-items: center;
}

.providers-stack .provider-dot {
  width: 20px;
  height: 20px;
  margin-inline-start: -6px;
  border: 2px solid #fff;
}

.providers-stack .provider-dot:first-child { margin-inline-start: 0; }

.trust-strip {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--cream-2);
  border-radius: 18px;
  border: 1px solid var(--line);
}

.trust-strip__icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--paper);
  flex: 0 0 auto;
}

.trust-strip strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.trust-strip p {
  margin: 0;
  color: var(--ink-mute);
  font-size: 12px;
  line-height: 1.6;
}

.result-card { padding: 14px; }
.result-top {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: center;
}
.food-thumb {
  width: 100px;
  height: 100px;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  color: white;
  display: grid;
  place-items: end start;
  padding: 10px;
  font-weight: 800;
  font-size: 12px;
}
.food-thumb.broast-gradient { background: linear-gradient(135deg, #ffb24f, #d35400); }
.food-thumb.shawarma-gradient { background: linear-gradient(135deg, #5a2d1a, #d08d45); }
.food-thumb.burger-gradient { background: linear-gradient(135deg, #43311e, #9e5b2c); }
.food-thumb.pizza-gradient { background: linear-gradient(135deg, #d94721, #ffb03b); }
.food-thumb.coffee-gradient { background: linear-gradient(135deg, #4b3326, #a2785f); }
.food-thumb.food-gradient { background: linear-gradient(135deg, #4f433b, #a78d78); }

.result-title { margin: 0 0 4px; font-size: 18px; }
.result-meta { justify-content: flex-start; gap: 10px; flex-wrap: wrap; color: var(--ink-soft); font-size: 12px; }
.metric { border-radius: 999px; padding: 5px 10px; }

.cheapest-strip {
  margin-top: 12px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--savings-soft);
  border-radius: 16px;
  color: var(--ink);
  border: 1px solid rgba(31,138,74,.08);
}

.provider-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.result-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.price-box {
  margin-top: 14px;
  border-radius: 18px;
  background: #fff7ec;
  border: 1px solid rgba(240,138,30,.16);
  padding: 12px;
}
.price-line { gap: 10px; }
.total-price {
  font-family: var(--font-num);
  font-size: 26px;
  font-weight: 900;
}
.total-price small { font-size: 12px; color: var(--ink-soft); font-family: var(--font-ar); }

.provider-badge {
  border-radius: 12px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.provider-dot {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-family: var(--font-num);
  color: #fff;
}

.savings-chip, .trust-note, .sheet-chip {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.savings-chip { background: var(--green-soft); color: var(--green); }
.trust-note { background: #f2efe9; color: var(--ink-soft); display: inline-block; margin-top: 10px; }

.card-actions { display: flex; gap: 10px; margin-top: 14px; }
.card-actions button { flex: 1; }

.nav-bar {
  position: absolute;
  inset-inline: 16px;
  bottom: 14px;
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(23,19,16,.08);
  box-shadow: 0 12px 30px rgba(23,19,16,.08);
  border-radius: 24px;
  padding: 8px;
  gap: 8px;
}
.nav-item {
  flex: 1;
  padding: 10px 8px;
  border-radius: 18px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
}
.nav-item.active { background: #fff4e4; color: var(--saffron-deep); border-color: rgba(240,138,30,.16); }

.sheet, .modal {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  margin: 0 auto;
  width: min(100%, 460px);
  background: #fff;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 40px rgba(23,19,16,.18);
  transform: translateY(108%);
  transition: transform .25s ease;
  max-height: 82vh;
  overflow: auto;
  padding: 18px 18px 30px;
}
.sheet.show, .modal.show { transform: translateY(0); }
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(23,19,16,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 40;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.grabber { width: 48px; height: 6px; border-radius: 999px; background: #e8e0d7; margin: 0 auto 16px; }
.sheet-list { margin-top: 16px; }
.provider-row {
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
}
.provider-row.best { border-color: rgba(24,128,76,.28); background: #f8fffb; }
.provider-copy { flex: 1; }
.provider-copy strong { display: block; margin-bottom: 2px; }
.provider-copy small { color: var(--ink-soft); }
.breakdown { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.sheet-chip { background: #fff7ec; color: var(--saffron-deep); }

.modal h3, .sheet h3 { margin: 6px 0; }
.summary-box {
  background: #faf6f0;
  border-radius: 18px;
  padding: 14px;
  margin-top: 12px;
}
.summary-box .row-between { margin-bottom: 8px; }

.admin-shell { width: min(1100px, 100%); margin: 0 auto; }
.admin-head { margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.admin-grid { align-items: stretch; gap: 16px; flex-wrap: wrap; }
.admin-stat {
  flex: 1;
  min-width: 220px;
  padding: 18px;
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(23,19,16,.04);
}
.admin-stat strong { font-size: 28px; font-family: var(--font-num); display: block; }
.admin-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; margin-top: 16px; }
.upload-box, .table-shell, .panel {
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(23,19,16,.04);
}
.upload-box textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border-radius: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.table-shell table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-shell th, .table-shell td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.note { color: var(--ink-soft); font-size: 13px; }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .page-shell { padding: 10px; }
  .app-frame { border-radius: 30px; min-height: calc(100vh - 20px); }
  .intro-shell { width: min(94vw, 420px); }
  .intro-stage { min-height: 210px; }
  .intro-copy strong,
  .brand-ar { font-size: 26px; }
}
