/* ===== الأساس المشترك: الخط والألوان والمكوّنات ===== */
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/tajawal-arabic-400-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('/vendor/fonts/tajawal-arabic-500-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/tajawal-arabic-700-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-weight: 800; font-display: swap; src: url('/vendor/fonts/tajawal-arabic-800-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/tajawal-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+20AA; }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/tajawal-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+20AA; }

@font-face { font-family: 'Tajawal'; font-weight: 900; font-display: swap; src: url('/vendor/fonts/tajawal-arabic-900-normal.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-weight: 800; font-display: swap; src: url('/vendor/fonts/tajawal-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+20AA; }

:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --surface-2: #f6efe3;
  --line: #eadfcd;
  --text: #2b1d16;
  --muted: #7a6a5e;
  --red: #b3121b;
  --red-dark: #8e0d14;
  --red-soft: #fbe9e7;
  --green: #5b7a1c;
  --green-dark: #46601200;
  --green-soft: #eef3df;
  --amber: #b86e00;
  --amber-soft: #fff2d9;
  --blue: #1f5fa8;
  --blue-soft: #e5effa;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(60, 30, 10, .07), 0 1px 2px rgba(60, 30, 10, .06);
  --shadow-lg: 0 10px 30px rgba(60, 30, 10, .15);
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Tajawal', system-ui, 'Segoe UI', Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--red); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .price { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* أزرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--tap); padding: 0 1.2em; border-radius: 12px;
  border: 1.5px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none;
  transition: transform .08s, background .15s, box-shadow .15s; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--red-dark); }
.btn-primary:hover:not(:disabled) { background: #c41620; }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 3px 0 #3f5512; }
.btn-outline { background: var(--surface); border-color: var(--line); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #f0c7c3; }
.btn-lg { min-height: 56px; font-size: 1.125rem; padding: 0 1.6em; }
.btn-sm { min-height: 38px; padding: 0 .9em; font-size: .9rem; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; font-size: 1.2rem; font-weight: 700;
}
.icon-btn:active { transform: scale(.94); }

/* حقول */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: .95rem; }
.field .req { color: var(--red); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 1rem; outline: none;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(179, 18, 27, .12); }
.input[dir=ltr] { text-align: right; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.chip { display: inline-flex; align-items: center; gap: .35em; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }

/* ألوان حالات الطلب */
.st-new { background: var(--red-soft); color: var(--red); }
.st-preparing { background: var(--amber-soft); color: var(--amber); }
.st-ready { background: var(--green-soft); color: var(--green); }
.st-on_the_way { background: var(--blue-soft); color: var(--blue); }
.st-delivered { background: #e9f6ec; color: #237a3a; }
.st-cancelled { background: #eee; color: #666; }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); color: #6b4300; font-size: .92rem; border: 1px solid #f3dcae; }
.notice.info { background: var(--blue-soft); color: #18406f; border-color: #c9dcf2; }
.notice.error { background: var(--red-soft); color: var(--red-dark); border-color: #f2c4bf; }
.notice.ok { background: var(--green-soft); color: #3c5410; border-color: #d6e3b4; }

/* نافذة منبثقة */
.modal-back { position: fixed; inset: 0; background: rgba(30, 15, 5, .45); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: up .2s; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 20px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }

/* إشعار سريع */
.toast-wrap { position: fixed; inset-inline: 0; bottom: calc(86px + var(--safe-b)); display: flex; justify-content: center; z-index: 2000; pointer-events: none; }
.toast { background: #2b1d16; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 92vw; animation: up .2s; }
.toast.error { background: var(--red-dark); }

/* خطوات حالة الطلب */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding: 0 40px 18px 0; min-height: 44px; }
.steps li::before { content: ''; position: absolute; right: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps .dot { position: absolute; right: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: .8rem; color: #fff; }
.steps li.done .dot { background: var(--green); border-color: var(--green); }
.steps li.done::before { background: var(--green); }
.steps li.current .dot { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 5px rgba(179, 18, 27, .15); }
.steps .t { font-weight: 700; }
.steps li:not(.done):not(.current) .t { color: var(--muted); font-weight: 500; }
.steps .time { font-size: .85rem; color: var(--muted); }

/* نصفي البيتسا */
.half-tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 6px; margin-inline-end: 4px; }
.half-tag.r { background: var(--red-soft); color: var(--red); }
.half-tag.l { background: var(--green-soft); color: var(--green); }
.half-tag.w { background: var(--surface-2); color: var(--text); }

.leaflet-container { font-family: inherit; }

/* مكوّنات مشتركة */
.block { padding: 16px; margin-top: 14px; }
.block h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; color: var(--red); }
.block h2 .step { width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: .9rem; flex: none; }
.totals { padding: 14px; }
.totals .tr { display: flex; justify-content: space-between; margin: 4px 0; }
.totals .grand { font-size: 1.25rem; font-weight: 800; color: var(--red); border-top: 1.5px dashed var(--line); padding-top: 10px; margin-top: 8px; }
.sample-tag { font-size: .72rem; background: var(--amber-soft); color: var(--amber); padding: 1px 8px; border-radius: 6px; font-weight: 700; }
.checkrow { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 500; }
.checkrow input { width: 22px; height: 22px; accent-color: var(--green); }

/* رسم القطع الثماني */
.slices-svg { width: 230px; height: 230px; display: block; touch-action: manipulation; }
.slices-svg.sm { width: 92px; height: 92px; flex: none; }
.slice-detail { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

svg.i { width: 1.2em; height: 1.2em; vertical-align: -0.24em; flex: none; }
