/* ---------- الهيكل ---------- */
#root { height: 100%; }
.shell { display: grid; grid-template-columns: 96px 1fr; height: 100%; }
.side { background: var(--orange); color: #fff; display: flex; flex-direction: column; align-items: stretch; padding: 10px 8px; gap: 6px; overflow-y: auto; border-radius: 0 0 0 0; position: relative; z-index: 5; }
.side .brand { display: grid; place-items: center; padding: 6px 0 10px; }
.side .brand img { width: 64px; height: 64px; border-radius: 16px; background: var(--cream); object-fit: contain; padding: 4px; }
.nav { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 14px; position: relative; opacity: .92; border: 0; background: transparent; }
.nav svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav.active { background: var(--cream); color: var(--orange-d); opacity: 1; }
.nav:not(.active):hover { background: rgba(255, 255, 255, .16); }
.nav .badge { position: absolute; top: 4px; right: 12px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: #fff; color: var(--red); font-size: 13px; display: grid; place-items: center; font-family: var(--font); font-weight: 800; }
.nav .badge.pulse { animation: pulse 1s infinite; background: var(--red); color: #fff; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: color-mix(in srgb, var(--cream) 92%, transparent); backdrop-filter: blur(4px); border-bottom: 2px solid var(--line); }
.topbar h2 { font-size: 26px; color: var(--orange-d); }
.topbar .logo-sm { height: 40px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot.off { background: var(--red); }
.content { flex: 1; overflow: auto; padding: 16px 18px 28px; position: relative; }
.alert-bar { background: var(--red); color: #fff; padding: 12px 18px; display: flex; align-items: center; gap: 14px; font-family: var(--display); font-size: 20px; font-weight: 700; animation: flash 1s infinite; cursor: pointer; }
@keyframes flash { 50% { background: #ff7b2e; } }

/* ---------- الدخول ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; }
.login .box { position: relative; z-index: 2; width: min(420px, 100%); text-align: center; }
.login .box img.logo { width: min(360px, 90%); margin-bottom: 10px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 14px 0 18px; height: 22px; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--orange-m); }
.pin-dots i.on { background: var(--orange); border-color: var(--orange); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.keypad button { min-height: 66px; font-size: 28px; font-family: var(--display); font-weight: 700; border-radius: 18px; border: 2px solid var(--line); background: #fff; box-shadow: 0 3px 0 var(--line); }
.keypad button:active { transform: translateY(2px); box-shadow: none; background: var(--orange-l); }
.keypad button.fn { background: var(--orange-l); color: var(--orange-d); font-size: 22px; }

/* ---------- نقطة البيع ---------- */
.pos { display: grid; grid-template-columns: 1fr 410px; gap: 16px; height: 100%; min-height: 0; }
.pos-l { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; flex-shrink: 0; }
.cat { flex: 0 0 auto; padding: 10px 20px; border-radius: 99px; border: 2px solid var(--orange-m); background: #fff; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--orange-d); }
.cat.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; overflow-y: auto; padding: 4px 4px 20px; align-content: start; flex: 1; min-height: 0; }
.tile { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px 12px; text-align: center; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; box-shadow: 0 3px 0 var(--line); position: relative; }
.tile:active { transform: translateY(2px); box-shadow: none; background: var(--orange-l); }
.tile .n { font-weight: 800; font-size: 17px; line-height: 1.3; }
.tile .p { font-family: var(--display); font-size: 21px; color: var(--orange-d); font-weight: 800; }
.tile .q { position: absolute; top: -8px; left: -8px; background: var(--orange); color: #fff; min-width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; font-weight: 800; padding: 0 6px; }
.tile.low { border-color: #F0B4B1; }
.cart { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 2px solid var(--orange-m); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.cart-h { padding: 12px 16px; background: var(--orange-l); display: flex; align-items: center; gap: 10px; }
.cart-h h3 { font-size: 20px; color: var(--orange-d); flex: 1; }
.seg { display: flex; background: #fff; border: 2px solid var(--orange-m); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 800; font-size: 15px; color: var(--orange-d); }
.seg button.on { background: var(--orange); color: #fff; }
.cart-items { flex: 1; overflow-y: auto; padding: 6px 12px; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 2px; border-bottom: 1px dashed var(--line); align-items: center; }
.line .nm { font-weight: 700; }
.line .tot { font-family: var(--display); font-weight: 800; font-size: 18px; text-align: left; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 11px; border: 2px solid var(--orange-m); background: #fff; font-size: 22px; font-weight: 800; color: var(--orange-d); line-height: 1; }
.stepper b { min-width: 30px; text-align: center; font-size: 18px; }
.cart-empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.cart-f { padding: 12px 16px 16px; border-top: 2px solid var(--line); background: #fff; }
.sum { display: flex; justify-content: space-between; margin: 4px 0; color: var(--muted); font-weight: 700; }
.sum.big { color: var(--ink); font-family: var(--display); font-size: 26px; font-weight: 800; margin: 8px 0 12px; }
.sum.big span:last-child { color: var(--orange-d); }

.appbar { display: flex; gap: 10px; flex-wrap: wrap; }
.apptab { padding: 10px 18px; border-radius: 16px; border: 2px solid var(--orange-m); background: #fff; font-family: var(--display); font-weight: 800; font-size: 19px; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.apptab small { font-family: var(--font); font-size: 13px; color: var(--muted); font-weight: 700; }
.apptab.on { background: var(--orange); color: #fff; border-color: var(--orange); }
.apptab.on small { color: var(--orange-l); }

/* الدفع */
.pay-total { text-align: center; background: #fff; border-radius: 18px; padding: 14px; border: 2px dashed var(--orange-m); margin-bottom: 14px; }
.pay-total .v { font-family: var(--display); font-size: 44px; color: var(--orange-d); font-weight: 800; line-height: 1.2; }
.paytabs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.paytabs button { min-height: 64px; border-radius: 16px; border: 3px solid var(--line); background: #fff; font-family: var(--display); font-size: 22px; font-weight: 800; }
.paytabs button.on { border-color: var(--orange); background: var(--orange-l); color: var(--orange-d); }
.recv { font-family: var(--display); font-size: 40px; font-weight: 800; text-align: center; min-height: 66px; background: #fff; border: 3px solid var(--orange); border-radius: 16px; padding: 4px; direction: ltr; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.quick button { min-height: 52px; border-radius: 14px; border: 2px solid var(--orange-m); background: #fff; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--orange-d); }
.quick button.exact { grid-column: span 4; background: var(--green); color: #fff; border-color: var(--green); font-size: 22px; }
.change { text-align: center; padding: 12px; border-radius: 16px; background: var(--green-l); color: var(--green); font-family: var(--display); font-size: 30px; font-weight: 800; margin-top: 10px; }
.change.short { background: var(--red-l); color: var(--red); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; margin-top: 8px; }
.numpad button { min-height: 54px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-family: var(--display); font-size: 24px; font-weight: 800; }
.numpad button:active { background: var(--orange-l); }

.done-box { text-align: center; padding: 10px 0; }
.done-box .check { width: 88px; height: 88px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 48px; margin: 0 auto 10px; animation: pop .3s; }

/* ---------- جداول وبطاقات عامة ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 180px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
table.t th { background: var(--orange-l); color: var(--orange-d); text-align: right; padding: 12px 14px; font-family: var(--display); font-size: 16px; white-space: nowrap; }
table.t td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.t tr.low td { background: var(--orange-l); }
table.t td.n, table.t th.n { text-align: left; font-variant-numeric: tabular-nums; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi .l { color: var(--muted); font-weight: 700; font-size: 14px; }
.kpi .v { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1.3; }
.kpi.hero { background: var(--orange); color: #fff; border-color: var(--orange-d); }
.kpi.hero .l { color: var(--orange-l); }
.kpi .s { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi.neg .v { color: var(--red); }
.kpi.pos .v { color: var(--green); }
.section-t { font-size: 22px; margin: 22px 0 10px; color: var(--orange-d); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.switch { display: inline-block; position: relative; width: 56px; height: 32px; flex-shrink: 0; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: #d9c3b3; border-radius: 99px; transition: .2s; }
.switch i::after { content: ''; position: absolute; width: 24px; height: 24px; background: #fff; border-radius: 50%; top: 4px; right: 4px; transition: .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { right: 28px; }
.empty { text-align: center; padding: 50px 10px; color: var(--muted); font-size: 18px; }
.empty img { width: 220px; opacity: .8; margin-bottom: 10px; }

/* طلبات العملاء */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.col h3 { font-size: 20px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.ocard { padding: 14px; margin-bottom: 12px; border-width: 2px; }
.ocard.new { border-color: var(--red); animation: glow 1.4s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(211, 48, 43, .18); } }
.ocard .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ocard .no { font-family: var(--display); font-size: 26px; font-weight: 800; color: var(--orange-d); }
.ocard ul { margin: 6px 0; padding: 0 18px 0 0; }
.ocard .btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ocard .btns .btn { flex: 1; }

/* رسم بياني */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding: 10px 6px 0; overflow-x: auto; }
.bar-col { flex: 1; min-width: 26px; max-width: 70px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar { width: 100%; border-radius: 8px 8px 2px 2px; background: var(--orange); min-height: 3px; position: relative; }
.bar.p { background: var(--green); }
.bar-l { font-size: 11px; color: var(--muted); font-weight: 700; direction: ltr; white-space: nowrap; }
.bars { display: flex; align-items: flex-end; gap: 2px; width: 100%; height: 100%; }
.legend { display: flex; gap: 14px; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-left: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 10px; margin: 8px 0; font-weight: 700; }
.hbar .track { background: var(--orange-l); border-radius: 99px; height: 16px; overflow: hidden; }
.hbar .fill { background: var(--orange); height: 100%; border-radius: 99px; }

@media (max-width: 1100px) {
  .pos { grid-template-columns: 1fr 340px; }
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr 68px; }
  .side { flex-direction: row; order: 2; padding: 4px; overflow-x: auto; }
  .side .brand { display: none; }
  .nav { flex: 1; min-width: 64px; font-size: 12px; padding: 6px 2px; }
  .nav svg { width: 24px; height: 24px; }
  .pos { grid-template-columns: 1fr; grid-template-rows: 1fr 46vh; }
  .three, .two { grid-template-columns: 1fr; }
}
@media print { body * { visibility: hidden; } #print-area, #print-area * { visibility: visible; } #print-area { position: absolute; inset: 0; } }

.paygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.paygrid .quick { margin: 8px 0; } .paygrid .quick button, .paygrid .numpad button { min-height: 48px; }
.paygrid .recv { min-height: 60px; font-size: 34px; }
@media (max-width: 760px) { .paygrid { grid-template-columns: 1fr; } }

.nav { padding: 8px 4px; }
@media (max-height: 900px) { .nav { padding: 6px 2px; font-size: 13px; } .nav svg { width: 24px; height: 24px; } .side { gap: 2px; } .side .brand img { width: 52px; height: 52px; } }
.pdf-doc { width: 794px; padding: 36px 40px; background: #fff; color: var(--ink); direction: rtl; font-family: var(--font); }
.pdf-head { display: flex; align-items: center; gap: 20px; border-bottom: 4px solid var(--orange); padding-bottom: 14px; margin-bottom: 18px; }
.pdf-head img { height: 78px; } .pdf-head h2 { font-size: 30px; color: var(--orange-d); }
.pdf-foot { margin-top: 24px; padding-top: 10px; border-top: 2px dashed var(--line); font-size: 13px; text-align: center; }
.pdf-doc table.t { box-shadow: none; } .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpis > div { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.kpis b { display: block; font-family: var(--display); font-size: 22px; } .kpis .muted { font-size: 14px; font-weight: 700; }
.pdf-doc .kpis { grid-template-columns: repeat(4, 1fr); }
.pdf-doc h3 { color: var(--orange-d); margin: 16px 0 8px; font-size: 20px; }
.shiftbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 12px 0; }

/* إصلاح المقاسات: منع تمدّد العمود وخروج السلة من الشاشة */
.pos > *, .pos-l, .cart, .content, .main { min-width: 0; }
.pos-l .cats { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
.pos-l .cats .cat { flex: 0 0 auto; }
html, body { max-width: 100vw; overflow-x: hidden; }
@media (max-width: 1100px) { .topbar { flex-wrap: wrap; gap: 8px; row-gap: 4px; } .topbar h2 { font-size: 20px; } }
@media (max-width: 820px) { .topbar .logo-sm { display: none; } .content { padding: 10px; } }

.lopts { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; line-height: 1.4; }
.optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.optbtn { min-height: 54px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-family: var(--display); font-weight: 800; font-size: 17px; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.optbtn small { font-size: 13px; color: var(--orange-d); font-family: inherit; }
.optbtn.on { border-color: var(--orange); background: var(--orange-l); color: var(--orange-d); }
.optrow { display: grid; grid-template-columns: 1.3fr .6fr .8fr 1fr 1fr auto; gap: 6px; margin-bottom: 6px; } .optrow .input { min-height: 40px; padding: 6px 10px; font-size: 15px; } @media (max-width: 760px) { .optrow { grid-template-columns: 1fr 1fr; } }

/* ===== شاشة الجوال العمودية (سنمي V3 MIX وغيره): عرض ≤ 600px ===== */
.only-m { display: none; }
@media (max-width: 600px) {
  .only-m { display: inline-flex; } .mini { font-weight: 800; color: var(--orange-d); font-size: 15px; }
  html { font-size: 15px; }
  .topbar { padding: 6px 10px; gap: 6px; } .topbar h2, .topbar .logo-sm { display: none; }
  .topbar * { font-size: 12px; } .topbar .switch, .topbar .tg { transform: scale(.8); }
  .content { padding: 8px 8px 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 2px 2px 90px; }
  .tile { min-height: 80px; padding: 8px 6px; border-radius: 14px; } .tile .n { font-size: 14px; } .tile .p { font-size: 17px; }
  .cat { padding: 6px 14px; font-size: 14px; }
  .pos { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .cart { position: fixed; left: 6px; right: 6px; bottom: 72px; z-index: 40; max-height: 58px; transition: max-height .25s; border-radius: 16px; }
  .cart.open { max-height: calc(100vh - 150px); }
  .cart-h { padding: 8px 12px; min-height: 56px; cursor: pointer; } .cart-h h3 { font-size: 15px; flex: none; } .cart-h .mini { flex: 1; text-align: center; justify-content: center; }
  .cart-items { min-height: 60px; } .cart-f { padding: 8px 12px 12px; }
  .btn.lg { min-height: 48px; font-size: 18px; }
  .modal, .sheet { max-width: 100vw; }
  .kpis, .shiftbox, .grid-cards { grid-template-columns: 1fr 1fr; }
  table.t { font-size: 13px; } table.t th, table.t td { padding: 6px 4px; }
  .nav { min-width: 56px; font-size: 11px; }
}

@media (max-width: 600px) {
  .alert-bar { padding: 6px 10px; font-size: 14px; }
  .topbar { display: flex; flex-wrap: wrap; align-items: center; } .topbar .spacer, .topbar .dot { display: none; }
  .topbar > * { flex: 0 1 auto; } .topbar label { gap: 4px; } .topbar b { font-size: 12px; margin-inline-start: auto; }
  .topbar .chip, .topbar .btn { padding: 4px 8px; }
}
@media (max-width: 600px) { .topbar label.row { width: auto; flex: 0 0 auto; } .topbar .switch { transform: none; width: 44px; height: 26px; } .topbar .switch i::after { width: 18px; height: 18px; top: 4px; right: 4px; } .topbar .switch input:checked + i::after { right: 22px; } }

/* رفع الصور */
.imgfield .lbl { font-weight: 800; margin-bottom: 4px; }
.imgprev { width: 100%; max-width: 220px; border-radius: 16px; background: var(--orange-l); border: 2px dashed var(--orange-m); display: grid; place-items: center; overflow: hidden; }
.imgprev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--orange-l); flex-shrink: 0; }

/* مصمم الموقع */
.dz { display: grid; grid-template-columns: minmax(320px, 1fr) 400px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .dz { grid-template-columns: 1fr; } .dz-right { display: none; } }
.dz-right { position: sticky; top: 8px; }
.dz-phone { width: 390px; max-width: 100%; height: min(760px, calc(100vh - 110px)); margin: 0 auto; border: 10px solid var(--ink); border-radius: 34px; overflow: hidden; background: #fff; box-shadow: 0 14px 40px rgba(0,0,0,.25); }
.dz-frame { width: 100%; height: 100%; border: 0; display: block; }
.dz-card { padding: 14px 16px; margin-bottom: 14px; } .dz-card h3 { color: var(--orange-d); margin: 0 0 8px; }
.dz-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dz-row:first-of-type { border-top: 0; }
.dz-l { font-weight: 700; min-width: 140px; } .dz-l small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; max-width: 220px; }
.dz-row > .input, .dz-row > textarea { flex: 1; min-width: 200px; } .dz-inl { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; } .dz-inl .input { flex: 1; }
.dz-seg { display: inline-flex; border: 2px solid var(--orange-m); border-radius: 12px; overflow: hidden; }
.dz-seg button { border: 0; background: #fff; padding: 8px 14px; font-weight: 700; color: var(--orange-d); } .dz-seg button.on { background: var(--orange); color: var(--on-primary, #fff); }
.dz-sec { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); } .dz-sec b { flex: 1; }
.dz-bn, .dz-pr { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; flex-wrap: wrap; }
.dz-bi { flex: 1; min-width: 100px; cursor: pointer; }
.bn-th { width: 120px; aspect-ratio: 2 / 1; border-radius: 10px; overflow: hidden; background: var(--orange-l); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; } .bn-th img { width: 100%; height: 100%; object-fit: cover; }
.pr-th { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--orange-l); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; border: 2px dashed var(--orange-m); } .pr-th img { width: 100%; height: 100%; object-fit: cover; }
.star { border: 2px solid var(--line); background: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 22px; color: #bbb; } .star.on { color: #f5a623; border-color: #f5a623; background: #fff8e8; }

.apptab.scan { background: var(--ink, #2a1608); color: #fff; border-color: transparent; }
.apptab.scan small { color: #ffd9b8; }

/* قوائم فرعية */
.nav.grp { cursor: pointer; font: inherit; font-family: var(--display); font-weight: 700; font-size: 14px; }
.nav.grp .car { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 16px; opacity: .7; }
.nav.grp.open { background: rgba(255, 255, 255, .22); }
.navfly { position: fixed; z-index: 90; background: #fff; border-radius: 18px; box-shadow: 0 10px 34px rgba(0, 0, 0, .22); padding: 8px; min-width: 190px; display: flex; flex-direction: column; gap: 2px; animation: fade .12s; }
.navfly .fi { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 16px; }
.navfly .fi svg { width: 22px; height: 22px; stroke: var(--orange-d); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.navfly .fi:hover { background: var(--orange-l); } .navfly .fi.on { background: var(--orange); color: #fff; } .navfly .fi.on svg { stroke: #fff; }
.nav { padding: 6px 2px; font-size: 13px; } .nav svg { width: 24px; height: 24px; } .side { gap: 1px; }
@media (max-width: 820px) { .nav.grp .car { display: none; } }

.tile .en { display: block; font-family: var(--font); font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.tile.pic { padding: 0 0 10px; overflow: hidden; min-height: 200px; justify-content: flex-start; }
.tile.pic .timg { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; border-radius: 16px 16px 0 0; background: var(--orange-l); }
.tile.pic .n, .tile.pic .p { padding: 0 8px; } .tile.pic .p { margin-top: auto; }
@media (max-width: 820px) { .tile.pic { min-height: 150px; } }
.cats .input { min-width: 150px; flex-shrink: 0; }

/* الرئيسية */
.hhead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; } .hello { font-family: var(--display); font-size: 26px; font-weight: 800; color: var(--orange-d); }
.hgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.hbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 18px; border-radius: 20px; border: 2px solid var(--line); background: #fff; font: inherit; text-align: right; cursor: pointer; box-shadow: 0 3px 0 var(--line); position: relative; }
.hbtn svg { width: 34px; height: 34px; stroke: var(--orange); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } .hbtn b { font-family: var(--display); font-size: 22px; } .hbtn small { color: var(--muted); font-weight: 700; font-size: 14px; }
.hbtn:active { transform: translateY(2px); box-shadow: none; } .hbtn.main { background: var(--orange); color: var(--on-primary, #fff); border-color: var(--orange); } .hbtn.main svg { stroke: currentColor; } .hbtn.main small { color: inherit; opacity: .85; }
.hbtn.hot { border-color: var(--red); background: var(--red-l); }
.hcols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; } .hbox { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; } .hbox h3 { margin: 0 0 10px; font-size: 18px; color: var(--orange-d); }
.hbars { display: flex; align-items: flex-end; gap: 4px; height: 150px; } .hbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; } .hbar i { width: 100%; background: var(--orange); border-radius: 6px 6px 0 0; display: block; } .hbar span { font-size: 11px; color: var(--muted); }
.halert { padding: 9px 12px; border-radius: 12px; margin-bottom: 6px; font-weight: 700; font-size: 15px; } .halert.red { background: var(--red-l); color: var(--red); } .halert.amber { background: #FFF3D6; color: #8A5A00; }
@media (max-width: 820px) { .hcols { grid-template-columns: 1fr; } }

#off-chip{position:fixed;bottom:12px;left:12px;z-index:9999;padding:8px 14px;border-radius:99px;font-weight:700;font-size:13px;cursor:pointer;box-shadow:0 4px 14px #0003;display:none}
#off-chip.off{background:#b42318;color:#fff}
#off-chip.sync{background:#f79009;color:#fff}

/* آيفون: المناطق الآمنة + لوحة رئيسية مضغوطة على الجوال */
@media (max-width: 820px) {
  .shell { padding-top: env(safe-area-inset-top); grid-template-rows: 1fr calc(68px + env(safe-area-inset-bottom)); }
  .side { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .cart { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .navfly { max-width: calc(100vw - 16px); }
}
@media (max-width: 600px) {
  .hhead { margin-bottom: 8px; gap: 8px; } .hello { font-size: 19px; }
  .hgrid { grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
  .hbtn { padding: 10px 12px; gap: 2px; border-radius: 16px; } .hbtn svg { width: 24px; height: 24px; } .hbtn b { font-size: 16px; } .hbtn small { font-size: 12px; }
  .hcols { grid-template-columns: 1fr; gap: 8px; margin-top: 8px; } .hbox { padding: 10px 12px; border-radius: 16px; } .hbox h3 { font-size: 15px; margin-bottom: 6px; }
  .kpi { padding: 10px 12px; } .kpi .l { font-size: 12px; } .kpi .v { font-size: 20px; } .kpi .s { font-size: 11px; }
  .grid-cards { gap: 8px; }
}
.kpi.hero .s { color: #fff; opacity: .85; }

/* جوال: لا تمرير للصفحة كاملة، والجداول تتمرر أفقياً داخل نفسها */
@media (max-width: 820px) {
  html, body, #root { height: 100%; overflow: hidden; }
  @supports (height: 100dvh) { html, body, #root { height: 100dvh; } }
  .shell { height: 100%; grid-template-rows: minmax(0, 1fr) calc(68px + env(safe-area-inset-bottom)); }
  .main { min-height: 0; }
  .content { -webkit-overflow-scrolling: touch; padding-bottom: 20px; }
  table.t { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table.t td, table.t th { white-space: nowrap; }
  .side { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* جوال: الشريط السفلي ثابت دائماً ولا يختفي */
@media (max-width: 820px) {
  .shell { grid-template-rows: minmax(0, 1fr); }
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(68px + env(safe-area-inset-bottom)); box-sizing: border-box; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .cart { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ===== تصميم الجوال النهائي: شريط بخمس تبويبات + المزيد + رئيسية مضغوطة ===== */
.more-btn { display: none; }
.moresheet { display: none; }
@media (max-width: 820px) {
  .mhide, .side .spacer { display: none !important; }
  .more-btn { display: flex; }
  .side { overflow: hidden; justify-content: space-around; gap: 0; }
  .side .nav { flex: 1 1 0; min-width: 0; font-size: 12px; padding: 6px 2px; gap: 3px; border-radius: 14px; }
  .side .nav.active { background: var(--cream); }
  .nav .badge { right: 50%; margin-right: -22px; top: 2px; }
  .moresheet { display: flex; position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 60, .45); align-items: flex-end; animation: fade .15s; }
  .ms-box { width: 100%; max-height: 82dvh; overflow-y: auto; background: #fff; border-radius: 24px 24px 0 0; padding: 8px 14px calc(18px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  .ms-grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 10px; }
  .ms-grp { margin-bottom: 12px; } .ms-t { font-weight: 800; color: var(--muted); font-size: 13px; margin: 0 4px 6px; }
  .ms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ms-it { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 4px; min-height: 76px; border-radius: 16px; background: var(--cream); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font: inherit; font-weight: 700; font-size: 13px; text-align: center; line-height: 1.25; }
  .ms-it svg { width: 26px; height: 26px; stroke: var(--orange); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .ms-it.on { background: var(--orange); color: #fff; border-color: var(--orange); } .ms-it.on svg { stroke: #fff; }
  .ms-it.out { grid-column: 1 / -1; flex-direction: row; background: var(--red-l); color: var(--red); border-color: transparent; min-height: 52px; }
}
@media (max-width: 600px) {
  /* الشريط العلوي: سطر واحد مرتب */
  .topbar { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 6px 10px; scrollbar-width: none; } .topbar::-webkit-scrollbar { display: none; }
  .topbar > * { flex: 0 0 auto; white-space: nowrap; } .topbar b { margin-inline-start: 0; }
  .topbar .chip { font-size: 12px; }
  /* الرئيسية: صغيرة ومرتبة */
  .content { padding: 8px 10px 0; }
  .hhead { margin: 2px 0 8px; } .hello { font-size: 18px; } .hhead .muted { font-size: 12px; }
  .grid-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; border-radius: 16px; } .kpi .l { font-size: 12px; } .kpi .v { font-size: 22px; line-height: 1.2; } .kpi .s { font-size: 11px; line-height: 1.3; }
  .kpi.hero { grid-column: 1 / -1; } .kpi.hero .v { font-size: 28px; }
  .hgrid { grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
  .hbtn { align-items: center; justify-content: center; text-align: center; padding: 10px 2px; min-height: 0; border-radius: 16px; gap: 4px; box-shadow: none; }
  .hbtn svg { width: 24px; height: 24px; } .hbtn b { font-size: 13px; line-height: 1.2; } .hbtn small { display: none; }
  .hbox { padding: 10px 12px; } .hbars { height: 90px; gap: 2px; } .hbar span { font-size: 9px; }
  .halert { font-size: 13px; padding: 8px 10px; }
  .sum { font-size: 14px; }
}

/* لمسات أخيرة للجوال */
@media (max-width: 820px) {
  body, #root { background-image: none !important; }
  .ms-it { min-height: 66px; }
}
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; overflow: visible; row-gap: 6px; justify-content: space-between; }
  .topbar > b, .topbar .dot { display: none; }
  .topbar .chip { font-size: 12px; padding: 3px 8px; }
  .hhead .chip { display: none; }
  .grid-cards .kpi:last-child:nth-child(even) { grid-column: 1 / -1; }
}

/* إصلاح التمرير على الآيفون + هيدر التطبيق */
.mbrand { display: none; }
@media (max-width: 820px) {
  .shell { box-sizing: border-box; }
  .content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .side { height: calc(64px + env(safe-area-inset-bottom)); padding-top: 4px; align-items: flex-start; }
  .side .nav { height: 56px; justify-content: center; }
}
@media (max-width: 600px) {
  .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; padding: 10px 12px 10px; overflow: visible; border-bottom: 1px solid var(--line); background: #fff; }
  .topbar > .logo-sm, .topbar > h2, .topbar > .spacer, .topbar > .dot, .topbar > b { display: none !important; }
  .mbrand { display: flex; align-items: center; gap: 10px; grid-column: 1; grid-row: 1; min-width: 0; }
  .mbrand img { width: 40px; height: 40px; border-radius: 12px; object-fit: contain; background: var(--cream); padding: 2px; flex: none; }
  .mbrand div { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .mbrand b { font-family: var(--display); font-size: 17px; color: var(--orange-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbrand small { font-size: 12px; color: var(--muted); font-weight: 700; }
  .topbar .chip { grid-column: 2; grid-row: 1; font-size: 12px; padding: 5px 10px; white-space: nowrap; }
  .tgs { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tgs > label { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: var(--cream); border: 1px solid var(--line); border-radius: 14px; padding: 7px 12px; width: auto !important; flex: none !important; }
  .tgs > label span { font-size: 13px !important; font-weight: 800; }
}
@media (min-width: 601px) { .tgs { display: contents; } }
@media print { @page { margin: 3mm; } #print-area img { width: 100% !important; max-width: 80mm !important; border: 0 !important; } }

/* تنبيه الالتزامات */
.billbar{background:#FFF4E5;border:1.5px solid #F2B35E;border-radius:14px;margin:10px 12px 0;padding:10px 12px}
.bb-h{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:6px}
.bb-r{display:flex;align-items:center;gap:10px;padding:6px 0;border-top:1px dashed #F2B35E;flex-wrap:wrap}
@media print{.billbar{display:none}}

/* تبويبات الإعدادات */
.settabs{display:flex;gap:8px;overflow-x:auto;padding:2px 0 10px;scrollbar-width:none}
.settabs::-webkit-scrollbar{display:none}
.settabs .cat{flex:0 0 auto;padding:8px 16px;font-size:15px;white-space:nowrap}

@media (max-width:600px){.paytabs button{font-size:17px;min-height:56px;padding:0 4px}}
