/* MenuCraft - shared styles. Simple, warm, mobile-first. Works left-to-right and right-to-left. */
:root {
  --brand: #c8321e;
  --brand-dark: #a02514;
  --accent: #f2a33a;
  --bg: #fff8f0;
  --card: #ffffff;
  --ink: #2b1a12;
  --muted: #7a655a;
  --line: #ecdccd;
  --ok: #1d7a3c;
  --ok-bg: #e5f5ea;
  --warn: #8a5a00;
  --warn-bg: #fff1d6;
  --bad: #b3261e;
  --bad-bg: #fde7e5;
  --info-bg: #eef5ff;
  --info: #1f4f8f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(80, 40, 20, .08);
  --surface: #ffffff;       /* cards, inputs, chips */
  --surface-2: #f3e7db;     /* small tags */
  --pic-bg: #fde9d4;        /* behind item photos */
  --brand-soft: #fff3ee;    /* light tint of the brand colour */
  --brand-ink: #a02514;     /* brand colour that is readable as text */
  --on-brand: #ffffff;      /* text on the brand colour */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Tahoma, sans-serif;
  padding-bottom: 90px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.top { background: var(--brand); color: var(--on-brand); position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .2px; }
.logo .emoji { font-size: 26px; }
.top .tools { display: flex; gap: 8px; align-items: center; }
.pill-btn {
  background: rgba(128, 128, 128, .22); color: inherit; border: 1px solid currentColor;
  border-radius: 999px; padding: 6px 14px; font-weight: 600; min-height: 38px;
}
.pill-btn:hover { background: rgba(128, 128, 128, .38); }

/* ---------- status banner ---------- */
.status { margin: 14px 0 8px; padding: 10px 14px; border-radius: var(--radius); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.status.open { background: var(--ok-bg); color: var(--ok); }
.status.closed { background: var(--bad-bg); color: var(--bad); }
.status small { display: block; font-weight: 500; opacity: .9; }
.note-box { margin: 8px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); }
.info-box { margin: 8px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--info-bg); color: var(--info); border: 1px solid #cfe0f7; }
.info-box b { display: block; }
.err-box { margin: 8px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--bad-bg); color: var(--bad); font-weight: 600; }

/* ---------- category chips ---------- */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 10px; position: sticky; top: 58px; background: var(--bg); z-index: 10; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 16px; font-weight: 600; min-height: 44px; }
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------- menu ---------- */
.cat-title { margin: 18px 0 8px; font-size: 20px; }
.item {
  display: flex; gap: 12px; align-items: stretch; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; margin-bottom: 10px;
}
.item .pic { width: 84px; height: 84px; border-radius: 12px; background: var(--pic-bg); flex: 0 0 84px; display: flex; align-items: center; justify-content: center; font-size: 34px; overflow: hidden; }
.item .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item h3 { margin: 0 0 2px; font-size: 17px; }
.item p { margin: 0; color: var(--muted); font-size: 14px; }
.item .row { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-weight: 800; color: var(--brand-ink); }
.item.off { opacity: .55; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 700; min-height: 44px;
  background: var(--brand); color: var(--on-brand);
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.btn.small { padding: 6px 14px; min-height: 38px; }
.btn.ghost { background: var(--surface); color: var(--brand-ink); border: 2px solid var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.green { background: #178a45; color: #fff; }
.btn.green:hover { background: #126f38; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--brand-ink); font-weight: 700; padding: 6px 8px; text-decoration: underline; min-height: 44px; }

/* ---------- cart bar ---------- */
.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; max-width: 696px; margin: 0 auto;
  background: var(--brand); color: var(--on-brand); border: 0; border-radius: 16px; padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
}
.cart-bar .count { background: var(--on-brand); color: var(--brand); border-radius: 999px; padding: 2px 11px; margin-inline-end: 10px; }

/* ---------- sheets / modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 15, 8, .5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 16px 16px 24px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.x-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: 44px; height: 44px; font-size: 20px; line-height: 1; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; } }

.opt-group { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; border: 1px solid var(--line); }
.opt-group h4 { margin: 0 0 6px; display: flex; justify-content: space-between; gap: 8px; }
.opt-group h4 span { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.opt-group h4 span.req { background: var(--brand); color: var(--on-brand); }
.opt-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); min-height: 44px; }
.opt-row:first-of-type { border-top: 0; }
.opt-row input { width: 22px; height: 22px; accent-color: var(--brand); flex: 0 0 22px; }
.opt-row label { flex: 1; cursor: pointer; }
.opt-row .p { color: var(--muted); font-weight: 600; }

.qty { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; font-weight: 800; color: var(--brand-ink); border-radius: 999px; }
.qty b { min-width: 24px; text-align: center; }

.cart-line { display: flex; gap: 10px; background: var(--surface); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .info small { color: var(--muted); display: block; }
.cart-line .info .price { display: block; }
.cart-line .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.sum { background: var(--surface); border-radius: var(--radius); padding: 10px 14px; border: 1px solid var(--line); margin: 12px 0; }
.sum .r { display: flex; justify-content: space-between; padding: 3px 0; }
.sum .r.total { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 8px; font-size: 19px; font-weight: 800; }
.sum .r.disc { color: var(--ok); }

/* ---------- forms ---------- */
.field { margin: 12px 0; }
.field label.lbl { display: block; font-weight: 700; margin-bottom: 4px; }
.field small.hint { display: block; color: var(--muted); margin-top: 3px; }
.input, .field input[type=text], .field input[type=tel], .field input[type=number], .field input[type=time],
.field input[type=date], .field input[type=password], .field input[type=email], .field input[type=url],
.field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 11px 12px; min-height: 46px;
}
.field textarea { min-height: 78px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--brand-ink); outline-offset: 1px; border-color: var(--brand); }
.field .invalid { border-color: var(--bad); }
.field .err { color: var(--bad); font-size: 14px; font-weight: 600; margin-top: 3px; }
.radio-card { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; min-height: 48px; }
.radio-card input { accent-color: var(--brand); width: 20px; height: 20px; }
.radio-card.sel { border-color: var(--brand); background: var(--brand-soft); }
.promo-row { display: flex; gap: 8px; }
.promo-row input { flex: 1; text-transform: uppercase; }
.ok-text { color: var(--ok); font-weight: 700; }
.bad-text { color: var(--bad); font-weight: 700; }

/* ---------- map ---------- */
.map-box { height: 52vh; min-height: 280px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #e8dccf; }
.map-tools { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.map-tools input { flex: 1; min-width: 160px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 44px; }

/* ---------- done screen ---------- */
.done { text-align: center; padding: 20px 8px; }
.done .big { font-size: 56px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60; background: #2b1a12; color: #fff;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; max-width: 92vw; text-align: center;
}
footer.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0 10px; }
.demo-banner { background: #2b1a12; color: #ffd9a0; text-align: center; font-size: 13px; padding: 6px 10px; }

/* ---------- manager (shared bits) ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; position: sticky; top: 58px; background: var(--bg); z-index: 10; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.new { background: #fde2dd; color: var(--bad); }
.badge.received { background: var(--warn-bg); color: var(--warn); }
.badge.ontheway { background: var(--info-bg); color: var(--info); }
.badge.delivered { background: var(--ok-bg); color: var(--ok); }
.badge.cancelled { background: #eee; color: #666; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.muted { color: var(--muted); }
table.plain { width: 100%; border-collapse: collapse; }
table.plain td, table.plain th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.sched-row { display: grid; grid-template-columns: 90px auto 1fr 1fr; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 520px) { .sched-row { grid-template-columns: 80px auto 1fr 1fr; gap: 6px; } }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.switch input { width: 22px; height: 22px; accent-color: var(--brand); }

/* language menu (more than two languages) */
.tools { position: relative; }
.lang-menu { position: absolute; top: 100%; inset-inline-end: 0; z-index: 60; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px; min-width: 150px; }
.lang-menu button { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 10px 12px; min-height: 44px; border-radius: 8px; font: inherit; color: var(--ink); cursor: pointer; }
.lang-menu button.on { font-weight: 800; background: var(--brand-soft); }
.shop-desc { margin: 8px 0; color: var(--muted, #555); }

/* ---------- logo + cover (set by brand.js) ---------- */
.logo-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface); flex: 0 0 36px; }
.cover { max-height: 190px; overflow: hidden; background: var(--surface-2); }
.cover img { display: block; width: 100%; height: 190px; object-fit: cover; }