/* ===== شاشة المطبخ: نفس هوية موقع المنيو بالظبط =====
   نفس الخط (Cairo من الموقع نفسه)، ونفس الألوان والـ radius، ونفس مفتاح الليلي/النهاري.
   الأساسي نهاري زي المنيو، والليلي بيتحفظ لو المطبخ اختاره. كل زرار 44px على الأقل، والتأكيد 52px. */
@font-face{font-family:'Cairo';font-style:normal;font-weight:400 800;font-display:swap;src:url(assets/fonts/cairo-arabic.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-0891,U+0897-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:'Cairo';font-style:normal;font-weight:400 800;font-display:swap;src:url(assets/fonts/cairo-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* الليلي (نفس قيم المنيو) */
:root {
  --bg: #0B0B0B; --surface: #161616; --surface-2: #202020; --line: #2A2A2A; --band: #262626;
  --text: #F5F5F5; --muted: #A8A8A8;
  --brand: #FECE00; --on-brand: #0B0B0B; --brand-text: #FECE00; --brand-soft: rgba(254, 206, 0, .16);
  --danger: #FF6B6B; --danger-soft: rgba(255, 107, 107, .12); --danger-line: rgba(255, 107, 107, .4);
  --open: #34D399; --on-open: #0B0B0B; --open-soft: rgba(52, 211, 153, .14);
  --wa: #25D366;
  --shadow: 0 12px 30px rgba(0, 0, 0, .45);
  --r: 16px; --r-lg: 24px;
  color-scheme: dark;
}
/* النهاري (نفس قيم المنيو): كل الكلام تباينه 4.5:1 على الأقل */
:root[data-theme="light"] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F2F2F2; --line: #E3E3E3; --band: #E9E9E9;
  --text: #111111; --muted: #5C5C5C;
  --brand: #FECE00; --on-brand: #0B0B0B; --brand-text: #7A5900; --brand-soft: #FFF3C4;
  --danger: #C62828; --danger-soft: #FDECEC; --danger-line: #F1B5B5;
  --open: #12A150; --on-open: #FFFFFF; --open-soft: #E3F6EC;
  --shadow: 0 12px 30px rgba(0, 0, 0, .16);
  color-scheme: only light;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: 'Cairo', Tahoma, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16px;
  min-height: 100vh; min-height: 100dvh;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
input { font-size: 16px; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; }
a { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.accent { color: var(--brand-text); }
.noscript { padding: 24px; text-align: center; }

/* ===== الأزرار (نفس btn-brand و btn-ghost في المنيو) ===== */
.btn {
  min-height: 48px; padding: 0 16px; border-radius: var(--r);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.btn-lg { min-height: 52px; font-size: 17px; font-weight: 800; }
.btn-accent { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 800; }
.btn-good { background: var(--open); border-color: var(--open); color: var(--on-open); font-weight: 800; }
.btn-bad { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); font-weight: 800; }
.btn-bad.armed, .btn-ghost-bad.armed { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-ghost-bad { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.btn-wa { color: var(--text); }
.btn-wa svg { color: var(--wa); }
.link-btn { min-height: 44px; padding: 0 8px; color: var(--brand-text); font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}

/* ===== مفتاح الليلي/النهاري (نفس مفتاح المنيو) ===== */
.theme-btn { display: flex; align-items: center; min-height: 44px; padding: 0 2px; direction: ltr; }
.theme-track { position: relative; flex: none; width: 56px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.theme-knob {
  position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transform: translateX(24px); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme="light"] .theme-knob { transform: translateX(0); }
.theme-knob svg { position: absolute; top: 5px; left: 5px; width: 16px; height: 16px; fill: currentColor; transition: opacity .3s ease, transform .45s ease; }
.theme-knob .i-sun { opacity: 0; transform: rotate(-120deg) scale(.4); }
:root[data-theme="light"] .theme-knob .i-sun { opacity: 1; transform: none; }
:root[data-theme="light"] .theme-knob .i-moon { opacity: 0; transform: rotate(120deg) scale(.4); }

/* ===== الدخول ===== */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; align-content: center; gap: 12px; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.login-card { width: 100%; max-width: 380px; padding: 24px 16px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 24px; font-weight: 800; line-height: 1.3; }
.label { font-size: 14px; font-weight: 700; }
input[type="password"], input[type="text"] {
  width: 100%; min-height: 48px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); outline: none;
}
input[type="password"]:focus, input[type="text"]:focus { border-color: var(--brand-text); }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.msg { min-height: 22px; font-size: 14px; font-weight: 600; color: var(--danger); }

/* ===== الشاشة ===== */
.app { max-width: 900px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.top { padding: 16px 16px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand h1 { font-size: 22px; font-weight: 800; line-height: 1.3; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sys-btn {
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 999px;
  font-size: 14px; font-weight: 800; background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line);
}
.sys-btn svg { flex: none; }
.sys-btn.is-closed { background: var(--open-soft); color: var(--open); border-color: var(--open); }
.sys-btn.armed { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.banner { margin: 12px 16px 0; border-radius: var(--r); padding: 10px 12px; font-size: 14px; line-height: 1.6; }
.banner strong { font-weight: 800; }
.banner-bad { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); }
.banner-warn { background: var(--brand-soft); border: 1px solid var(--brand); color: var(--text); }

.alert {
  position: fixed; top: 76px; left: 12px; right: 12px; z-index: 10; max-width: 876px; margin: 0 auto;
  background: var(--brand); color: var(--on-brand); border-radius: var(--r-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.alert-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.alert-text strong { font-size: 18px; font-weight: 800; }
.alert-text span { font-size: 14px; font-weight: 600; }
.alert-hint { font-size: 12px; font-weight: 700; opacity: .75; }

/* التابات: نفس شكل أقسام المنيو (pills) */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px 16px; }
.tab {
  min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.tab[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--muted);
}
.badge.hot { background: var(--brand); color: var(--on-brand); }
.tab[aria-pressed="true"] .badge { background: var(--on-brand); color: var(--brand); }

.main { flex: 1; padding: 4px 16px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
@media (min-width: 720px) { .main.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.empty { margin-top: 64px; text-align: center; color: var(--muted); font-size: 15px; font-weight: 600; }

/* ===== كارت الطلب ===== */
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.order.st-new { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.order.st-cancelled { opacity: .85; }
.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-no { font-size: 20px; font-weight: 800; line-height: 1.3; }
.order-time { font-size: 13px; color: var(--muted); }
.pill { flex: none; height: 28px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; font-size: 13px; font-weight: 800; }
.pill-new { background: var(--brand-soft); color: var(--brand-text); }
.pill-confirmed { background: var(--open-soft); color: var(--open); }
.pill-cancelled { background: var(--danger-soft); color: var(--danger); }
.items { list-style: none; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 6px; }
.items li { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; font-weight: 600; }
.items .qty { color: var(--brand-text); font-weight: 800; }
.items .line { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.note { background: var(--brand-soft); color: var(--text); border-radius: var(--r); padding: 8px 12px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--muted); }
.meta .area { overflow-wrap: anywhere; }
.meta .total b { font-size: 18px; font-weight: 800; color: var(--text); }
.phone-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 600; }
.phone-row .cust-name { min-width: 0; overflow-wrap: anywhere; }
.phone-row .num { direction: ltr; unicode-bidi: isolate; letter-spacing: .5px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.row-end { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.done-good { font-size: 13px; font-weight: 700; color: var(--open); }
.done-bad { font-size: 13px; font-weight: 700; color: var(--danger); }

/* ===== التقارير ===== */
.gate { margin-top: 24px; padding: 24px 16px; display: flex; flex-direction: column; gap: 12px; }
.gate h2, .rep-head h2 { font-size: 20px; font-weight: 800; line-height: 1.4; }
.gate p { font-size: 14px; color: var(--muted); line-height: 1.7; }
.reports { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.rep-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button { min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { min-width: 0; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat .v { font-size: clamp(20px, 6.5vw, 26px); overflow-wrap: anywhere; font-weight: 800; line-height: 1.3; }
.stat .v.good { color: var(--open); }
.stat .v.bad { color: var(--danger); }
.top-list { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.top-list strong { font-weight: 800; }
.top-row span:first-child { min-width: 0; overflow-wrap: anywhere; }
.top-row { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 600; }
.bar { height: 8px; margin-top: 4px; background: var(--surface-2); border-radius: 999px; }
.bar > div { height: 8px; width: 0; border-radius: 999px; background: var(--brand); }

/* ===== تحت ===== */
.foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px 16px; border-top: 1px solid var(--line); }
.foot-actions { display: flex; align-items: center; gap: 8px; }
.toast {
  position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 12px; right: 12px; z-index: 20;
  max-width: 520px; margin: 0 auto; padding: 12px 16px; border-radius: var(--r);
  background: var(--text); color: var(--bg); font-size: 15px; font-weight: 700; box-shadow: var(--shadow);
}
.toast.bad { background: var(--danger); color: #FFFFFF; }

/* وقت التحويل بس: الألوان بتتحول بنعومة زي المنيو */
.theme-anim, .theme-anim * { transition: background-color .35s ease, color .35s ease, border-color .35s ease !important; }
@media (prefers-reduced-motion: no-preference) {
  .alert { animation: drop .25s ease-out; }
  @keyframes drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .theme-knob, .theme-knob svg { transition: none; } }
