/* إضافات طلبات الحلا فوق التصميم المشترك. الوردي للإجراء الرئيسي والمتأخر فقط، وكل حالة لها لون هادئ. */
:root {
  --st-new-bg: #E8F0FE; --st-new-ink: #1A56C4;
  --st-confirmed-bg: #F1E8FF; --st-confirmed-ink: #6D28D9;
  --st-preparing-bg: #FFF4E0; --st-preparing-ink: #A35200;
  --st-ready-bg: #E6F4EA; --st-ready-ink: #1E7B30;
  --st-out-bg: #E0F5F5; --st-out-ink: #0E6E6E;
}
@media (prefers-color-scheme: dark) {
  :root {
    --st-new-bg: rgba(62, 166, 255, .18); --st-new-ink: #8AC6FF;
    --st-confirmed-bg: rgba(168, 85, 247, .2); --st-confirmed-ink: #D8B4FE;
    --st-preparing-bg: rgba(251, 140, 0, .2); --st-preparing-ink: #FFC870;
    --st-ready-bg: rgba(43, 166, 64, .18); --st-ready-ink: #5FD37A;
    --st-out-bg: rgba(20, 184, 166, .18); --st-out-ink: #5EEAD4;
  }
}

/* الحالات */
.pill.st-new { background: var(--st-new-bg); color: var(--st-new-ink); }
.pill.st-confirmed { background: var(--st-confirmed-bg); color: var(--st-confirmed-ink); }
.pill.st-preparing { background: var(--st-preparing-bg); color: var(--st-preparing-ink); }
.pill.st-ready { background: var(--st-ready-bg); color: var(--st-ready-ink); }
.pill.st-out { background: var(--st-out-bg); color: var(--st-out-ink); }
.pill.st-delivered { background: var(--surface); color: var(--muted); }
.pill.st-cancelled { background: var(--surface); color: var(--muted); text-decoration: line-through; }
.pill.late { background: var(--accent); color: #fff; }

/* البحث */
.search-box { position: relative; }
.search-box svg { position: absolute; inset-inline-start: var(--s3); top: 11px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; height: 44px; border: 0; border-radius: var(--r-pill); background: var(--surface); outline: none;
  padding-inline: 44px var(--s4); font-size: 16px;
}
.search-input:focus { box-shadow: 0 0 0 2px var(--ink); }

/* الإحصائيات: ثلاث أعمدة، والبطاقة رابط */
.stats.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 380px) { .stats.three { grid-template-columns: repeat(2, 1fr); } }
a.stat { display: block; }
a.stat:hover { background: var(--surface-hover); }
.stat.hot { background: var(--badge-accent-bg); }
.stat.hot .v, .stat.hot .k { color: var(--badge-accent-ink); }
.stat .v.small { font-size: 15px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.late-title { display: flex; align-items: center; gap: var(--s2); color: var(--accent); }

/* صف الطلب */
.order-row { align-items: flex-start; }
.order-row .end { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); flex: none; }
.order-row.is-late .title { color: var(--accent); }
.fl-ico { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface); color: var(--muted); }
.fl-ico.delivery { color: var(--st-out-ink); background: var(--st-out-bg); }
.row .end { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); flex: none; }
button.row.pick { width: 100%; border: 0; background: transparent; text-align: start; font: inherit; color: inherit; cursor: pointer; }
button.row.pick:disabled { cursor: default; }
.list > .row.pick + .row.pick { border-top: 1px solid var(--line); }
.row.off { opacity: .55; }
.rank { width: 24px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }

/* صورة المنتج */
.thumb { width: 44px; height: 44px; border-radius: var(--r-large); flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface); color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-line { display: flex; align-items: center; gap: var(--s3); }
.photo-line .thumb { width: 64px; height: 64px; }

/* تفاصيل الطلب */
.order-hero { display: flex; flex-direction: column; gap: var(--s2); }
.due-big { font-size: 24px; line-height: 32px; font-weight: 700; }
.steps { display: flex; flex-direction: column; gap: var(--s2); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.block.primary { height: 52px; font-size: 16px; }
.kitchen-note { background: var(--st-preparing-bg); color: var(--st-preparing-ink); border-radius: var(--r-large); padding: var(--s3) var(--s4); }
.kitchen-note p { margin: var(--s1) 0 0; font-size: 15px; line-height: 22px; white-space: pre-wrap; color: var(--ink); }
.item-line { align-items: flex-start; }
.item-line .qty { font-size: 18px; font-weight: 700; min-width: 2.6em; line-height: 20px; }
.item-note { color: var(--st-preparing-ink) !important; font-size: 13px !important; line-height: 18px !important; margin-top: 2px; }
.card.kvs { padding-block: var(--s1); }
.kv { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s3) 0; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv > span:first-child { color: var(--muted); }
.kv.total { font-weight: 700; font-size: 16px; }
.kv.total > span:first-child { color: var(--ink); }
.addr { display: flex; align-items: center; gap: var(--s3); font-size: 14px; color: var(--ink); }
.addr > svg { color: var(--muted); flex: none; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 var(--s5) var(--s4); }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.timeline li::after { content: ''; position: absolute; inset-inline-start: 9.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.st-ready::before, .timeline li.st-delivered::before { background: var(--success); }
.timeline li.st-cancelled::before { background: var(--accent); }
.timeline .title { font-weight: 500; }
.timeline .sub { font-size: 12px; color: var(--muted); }

/* النموذج */
.form { display: flex; flex-direction: column; gap: var(--s5); }
.sheet .form { gap: var(--s4); }
.form-section { display: flex; flex-direction: column; gap: var(--s3); }
.form-section > h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 700; }
.req::after { content: ' *'; color: var(--accent); }
input[type="date"].input, input[type="time"].input { direction: ltr; text-align: center; }
.card.form { gap: var(--s3); }
.card.row.picked { border-color: var(--ink); }
.item-edit { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); background: var(--surface); border-radius: var(--r-large); }
.item-edit .input { background: transparent; }
.item-top { display: flex; align-items: center; gap: var(--s2); }
.item-top .title { font-weight: 500; }
.item-top .sub { font-size: 12px; color: var(--muted); }
.item-top .grow { flex: 1; min-width: 0; }
.item-bottom { display: flex; align-items: center; gap: var(--s3); }
.item-bottom .amt { margin-inline-start: auto; font-weight: 500; white-space: nowrap; }
.price-in { display: flex; align-items: center; gap: var(--s1); }
.price-in .input { width: 76px; height: 36px; text-align: center; }
.note-in { height: 36px !important; font-size: 14px !important; }
.stepper { background: var(--bg); }
.stepper .qty-input { width: 44px; height: 32px; border: 0; border-inline: 1px solid var(--line); background: transparent; text-align: center; font-size: 15px; font-weight: 500; outline: none; padding: 0; }
.seg { display: flex; background: var(--surface); border-radius: var(--r-pill); padding: 3px; }
.seg button { flex: 1; height: 38px; border: 0; border-radius: var(--r-pill); background: transparent; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); color: var(--muted); }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-1); }
.total-bar {
  position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: var(--s3);
  background: var(--bg); border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--s4)); padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-b));
}
.total-bar .btn { height: 48px; padding: 0 var(--s5); font-size: 16px; }
.big-total { font-size: 22px; line-height: 30px; font-weight: 700; }
.sheet.tall { height: 85dvh; }
.sheet-scroll { overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s3); }
.group-label { font-size: 12px; font-weight: 500; color: var(--muted); padding-top: var(--s2); }

/* التقويم: رقم الطلبات تحت اليوم */
.cal-day { flex-direction: column; gap: 0; line-height: 16px; }
.cal-count { font-size: 10px; line-height: 12px; font-weight: 700; }
.cal-day.late { box-shadow: inset 0 0 0 2px var(--accent); background: var(--badge-accent-bg); }
.cal-day.today::after { bottom: 2px; }

/* الرسم */
.chart svg { display: block; width: 100%; height: auto; }
.chart rect { fill: var(--accent); opacity: .75; cursor: pointer; }
.chart rect.on { opacity: 1; }
.chart text { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-tip-line { font-size: 13px; color: var(--muted); text-align: center; padding-top: var(--s2); }

/* سجل العمليات */
.audit-row { align-items: flex-start; }
.audit-row .ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); color: var(--muted); }
.audit-row.sensitive .ico { border-color: var(--accent); color: var(--accent); background: var(--badge-accent-bg); }
.audit-row .text { font-size: 14px; line-height: 21px; }
.chip.sm { height: 28px; padding: 0 10px; font-size: 13px; }
