:root {
  --bg: #f4f1ea; --card: #ffffff; --ink: #1f2a2a; --muted: #687472; --line: #e3ddd0; --soft: #f8f6f1;
  --primary: #1d5c57; --primary-2: #2c7a72; --primary-soft: #e3efec; --accent: #b08a52; --accent-soft: #f4ecdf;
  --red: #c0392b; --red-soft: #fbe9e7; --orange: #d27a1f; --orange-soft: #fdf0e1; --yellow: #a88512; --yellow-soft: #fbf5dc;
  --green: #2e7d4f; --green-soft: #e4f3ea; --shadow: 0 1px 2px rgba(20, 40, 38, .06), 0 4px 14px rgba(20, 40, 38, .06);
  --radius: 16px; --font: 'Tajawal', 'Segoe UI', Tahoma, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121817; --card: #1b2321; --ink: #e8eeec; --muted: #9aa8a5; --line: #2c3734; --soft: #161e1c;
    --primary: #4fa79c; --primary-2: #6cc0b4; --primary-soft: #1f3431; --accent: #d1ab6f; --accent-soft: #2e281d;
    --red: #ef6f61; --red-soft: #3a2220; --orange: #f0a04b; --orange-soft: #3a2b1a; --yellow: #e0c04a; --yellow-soft: #34301a;
    --green: #5cc08a; --green-soft: #1d3326; --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121817; --card: #1b2321; --ink: #e8eeec; --muted: #9aa8a5; --line: #2c3734; --soft: #161e1c;
  --primary: #4fa79c; --primary-2: #6cc0b4; --primary-soft: #1f3431; --accent: #d1ab6f; --accent-soft: #2e281d;
  --red: #ef6f61; --red-soft: #3a2220; --orange: #f0a04b; --orange-soft: #3a2b1a; --yellow: #e0c04a; --yellow-soft: #34301a;
  --green: #5cc08a; --green-soft: #1d3326; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.5; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
#app { max-width: 760px; margin: 0 auto; padding: 0 16px 110px; }
#print-root { display: none; }

/* الترويسة */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); display: flex; align-items: center; gap: 10px; padding: 12px 0 10px; }
.topbar h1 { font-size: 20px; margin: 0; flex: 1; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; font-size: 20px; cursor: pointer; flex: none; text-decoration: none; color: var(--ink); }
.hero { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-radius: 0 0 24px 24px; margin: 0 -16px 16px; padding: 18px 16px 20px; }
.hero .row { display: flex; align-items: center; gap: 12px; }
.hero .logo { width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 24px; flex: none; }
.hero h1 { margin: 0; font-size: 19px; font-weight: 800; }
.hero small { opacity: .85; font-size: 13px; }
.hero .icon-btn { background: rgba(255, 255, 255, .14); border-color: transparent; color: #fff; }
.hero .grow { flex: 1; min-width: 0; }

/* المؤشرات */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.kpi { background: rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px 6px; text-align: center; color: #fff; text-decoration: none; display: block; }
.kpi b { display: block; font-size: 24px; font-weight: 800; line-height: 1.2; }
.kpi span { font-size: 12px; opacity: .92; }
.kpi.warn b { color: #ffd59a; } .kpi.bad b { color: #ffb3aa; }

/* الأزرار الرئيسية */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; min-height: 118px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); position: relative; }
.tile .em { font-size: 32px; line-height: 1; }
.tile b { font-size: 18px; font-weight: 800; }
.tile small { color: var(--muted); font-size: 13px; display: block; }
.tile.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.tile.primary small { color: rgba(255, 255, 255, .85); }
.tile .badge { position: absolute; top: 12px; left: 12px; }
.tile:active, .btn:active, .item-row:active { transform: scale(.98); }

.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; text-decoration: none; color: var(--ink); background: var(--accent-soft); border: 1px solid var(--line); }
.banner.red { background: var(--red-soft); } .banner.info { background: var(--primary-soft); }

/* البطاقات والقوائم */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 10px; font-size: 18px; }
.section-title { font-size: 15px; color: var(--muted); margin: 18px 4px 8px; font-weight: 700; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-align: right; cursor: pointer; text-decoration: none; color: var(--ink); }
.item-row .grow { flex: 1; min-width: 0; }
.item-row b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.item-row small { color: var(--muted); font-size: 13px; display: block; }
.qty { min-width: 64px; text-align: center; border-radius: 12px; padding: 6px 8px; background: var(--green-soft); color: var(--green); font-weight: 800; font-size: 20px; line-height: 1.1; flex: none; }
.qty small { display: block; font-size: 11px; font-weight: 500; color: inherit; opacity: .85; }
.qty.low { background: var(--orange-soft); color: var(--orange); } .qty.out { background: var(--red-soft); color: var(--red); }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--soft); }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.orange { background: var(--orange-soft); color: var(--orange); border-color: transparent; }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow); border-color: transparent; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.teal { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.solid { background: var(--red); color: #fff; }

/* النماذج */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; min-height: 50px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 17px; outline: none; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-size: 15px; font-weight: 500; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
details.more { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--primary); padding: 4px 0; }
details.more[open] summary { margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 18px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.btn.big { width: 100%; min-height: 58px; font-size: 19px; border-radius: 16px; }
.btn.sm { min-height: 40px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

.search { display: flex; gap: 8px; margin-bottom: 12px; position: sticky; top: 66px; z-index: 10; background: var(--bg); padding-bottom: 6px; }
.search .input { flex: 1; }
.search .icon-btn { width: 50px; height: 50px; }

/* شريط السلة السفلي */
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
.bottom-bar .inner { max-width: 728px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.bottom-bar .grow { flex: 1; }
.steps { display: flex; gap: 6px; margin: 2px 0 14px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--primary); }

.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .grow { flex: 1; min-width: 0; }
.cart-line small { color: var(--muted); display: block; font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); font-size: 20px; cursor: pointer; }
.stepper input { width: 64px; text-align: center; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 800; background: var(--card); }

/* النوافذ */
.overlay { position: fixed; inset: 0; background: rgba(10, 20, 18, .45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .18s; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h3 { margin: 0 0 12px; font-size: 19px; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -6px auto 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }
.big-qty { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 6px; }
.big-qty button { width: 64px; height: 64px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--soft); font-size: 30px; cursor: pointer; }
.big-qty input { width: 140px; height: 72px; font-size: 36px; text-align: center; font-weight: 800; border: 2px solid var(--primary); border-radius: 18px; background: var(--card); outline: none; }
.muted { color: var(--muted); }
.center { text-align: center; }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.toast-wrap { position: fixed; top: 14px; left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); max-width: 520px; animation: up .2s; }
.toast.ok { background: var(--green); color: #fff; } .toast.bad { background: var(--red); color: #fff; } .toast.warn { background: var(--orange); color: #fff; }

.success { text-align: center; padding: 26px 16px; }
.success .em { font-size: 56px; }
.success h2 { margin: 6px 0; }
.docno { font-size: 26px; font-weight: 800; color: var(--primary); letter-spacing: 1px; direction: ltr; display: inline-block; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.big-num { font-size: 44px; font-weight: 800; line-height: 1; }
.tabs { display: flex; gap: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; cursor: pointer; }
.tabs button.on { background: var(--card); box-shadow: var(--shadow); color: var(--primary); }
.alert-card { display: flex; gap: 12px; align-items: flex-start; }
.dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.out { background: var(--red); } .dot.low { background: var(--orange); } .dot.reorder { background: var(--yellow); }
.mini-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin: 6px 0 10px; }
.mini-stats b { color: var(--ink); }

/* الجداول */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); max-width: 100%; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.t th { background: var(--soft); font-weight: 700; position: sticky; top: 0; }
table.t td.num, table.t th.num { text-align: center; font-variant-numeric: tabular-nums; }
table.t tr.lvl-out td { background: var(--red-soft); } table.t tr.lvl-low td { background: var(--orange-soft); }
.summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.summary div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.summary small { color: var(--muted); display: block; font-size: 12px; }
.summary b { font-size: 18px; }

.count-line { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.count-line .inp { width: 96px; height: 50px; text-align: center; font-size: 20px; font-weight: 800; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.count-line .reason { grid-column: 1 / -1; }
.diff { font-weight: 800; font-size: 14px; }
.diff.minus { color: var(--red); } .diff.plus { color: var(--orange); } .diff.zero { color: var(--green); }
.sig-pad { width: 100%; height: 200px; border: 2px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; }
#qr-reader { width: 100%; min-height: 260px; border-radius: 14px; overflow: hidden; background: #000; }
.photo-prev { max-width: 160px; max-height: 160px; border-radius: 12px; display: block; margin-top: 8px; }
.item-photo { width: 100%; max-height: 260px; object-fit: contain; border-radius: 14px; background: var(--soft); margin-bottom: 12px; }
.login { max-width: 420px; margin: 0 auto; padding-top: 7vh; }
.login .brand { text-align: center; margin-bottom: 22px; }
.login .brand .logo { width: 76px; height: 76px; border-radius: 22px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 38px; margin: 0 auto 12px; }
.login h1 { margin: 0; font-size: 24px; }
.demo-tag { position: fixed; bottom: 8px; left: 8px; z-index: 50; background: var(--accent); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; opacity: .9; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 12px; min-height: 54px; padding: 0 12px; border: 0; background: none; text-decoration: none; color: var(--ink); font-size: 17px; border-radius: 12px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--soft); }
@media (max-width: 380px) { .kpi b { font-size: 20px; } .tile { min-height: 104px; padding: 14px 12px; } .tile b { font-size: 16px; } }

/* الطباعة */
@media print {
  @page { size: A4; margin: 14mm; }
  html, body { background: #fff; color: #000; font-size: 12px; }
  #app, #overlay-root, .toast-wrap, .demo-tag { display: none !important; }
  #print-root { display: block; }
  .p-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1d5c57; padding-bottom: 8px; margin-bottom: 12px; }
  .p-head h1 { font-size: 18px; margin: 0; color: #1d5c57; }
  .p-head h2 { font-size: 15px; margin: 4px 0 0; }
  .p-head .meta { text-align: left; font-size: 11px; color: #333; }
  table.t { font-size: 11px; } table.t th, table.t td { border: 1px solid #999; white-space: normal; padding: 5px 6px; color: #000; background: #fff !important; }
  table.t th { position: static; background: #eef3f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.t thead { display: table-header-group; }
  table.t tfoot { display: table-footer-group; }
  table.t tr { break-inside: avoid; page-break-inside: avoid; }
  .table-wrap { border: 0; overflow: visible; }
  .p-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 40px; }
  .p-sign div { border-top: 1px solid #000; padding-top: 6px; min-height: 60px; }
  .p-sign img { max-height: 70px; display: block; }
  .summary { grid-template-columns: repeat(4, 1fr); } .summary div { border: 1px solid #999; }
  h3 { font-size: 13px; margin: 14px 0 6px; }
}
.print-preview { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; font-size: 13px; overflow-x: auto; }
.print-preview .p-head { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px solid #1d5c57; padding-bottom: 8px; margin-bottom: 10px; }
.print-preview .p-head h1 { font-size: 16px; margin: 0; color: #1d5c57; } .print-preview .p-head h2 { font-size: 14px; margin: 4px 0 0; }
.print-preview .p-head .meta { font-size: 11px; text-align: left; }
.print-preview .p-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; } .print-preview .p-sign div { border-top: 1px solid #333; padding-top: 6px; }
.print-preview .p-sign img { max-height: 60px; display: block; }
.print-preview table.t th, .print-preview table.t td { color: #111; background: #fff; border: 1px solid #ccc; }
.timeline { position: relative; padding-right: 18px; }
.timeline::before { content: ''; position: absolute; right: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 4px 0 12px; }
.tl::before { content: ''; position: absolute; right: -18px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); }
.tl b { display: block; } .tl small { color: var(--muted); display: block; } .tl div { margin-top: 2px; font-size: 14px; }

/* القائمة الجانبية على اليمين */
.side { position: fixed; top: 0; bottom: 0; right: 0; width: 280px; max-width: 86vw; z-index: 120; background: var(--card); border-left: 1px solid var(--line); overflow-y: auto;
  padding: 12px 10px calc(16px + env(safe-area-inset-bottom)); transform: translateX(100%); transition: transform .2s ease; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
.side-back { position: fixed; inset: 0; background: rgba(10, 20, 18, .45); z-index: 110; display: none; }
body.side-open .side { transform: none; } body.side-open .side-back { display: block; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 6px 6px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-head .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.side-head b { display: block; font-size: 16px; } .side-head small { color: var(--muted); font-size: 12px; display: block; } .side-head .grow { flex: 1; min-width: 0; }
.nav-top { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 10px; border: 0; background: none; border-radius: 12px; color: var(--ink);
  text-decoration: none; font-size: 16px; font-weight: 700; cursor: pointer; text-align: right; }
.nav-top:hover { background: var(--soft); } .nav-top.on { background: var(--primary-soft); color: var(--primary); }
.nav-top .em { width: 26px; text-align: center; flex: none; } .nav-top .grow { flex: 1; }
.nav-top .chev { color: var(--muted); transition: transform .15s; } .nav-group.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 36px 6px 0; } .nav-group.open .nav-sub { display: block; }
.nav-sub a, .nav-sub .soon { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; }
.nav-sub a:hover { background: var(--soft); } .nav-sub a.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-sub .soon { color: var(--muted); font-size: 13px; } .nav-sub .grow { flex: 1; }
.side .badge.solid { font-size: 11px; padding: 2px 7px; }
.side-out { margin-top: 8px; border-top: 1px solid var(--line); border-radius: 0; color: var(--red); }
@media (min-width: 1000px) {
  body.has-side .side { transform: none; box-shadow: none; width: 270px; }
  body.has-side .side-back, body.has-side .side-x, body.has-side .menu-btn, body.has-side .hero [data-menu] { display: none; }
  body.has-side { padding-right: 270px; }
  body.has-side .bottom-bar { right: 270px; }
}
.kpis-soft { margin-top: 0; } .kpis-soft .kpi { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.kpis-soft .kpi.warn b { color: var(--orange); }
.sel-chip { width: auto; min-height: 42px; border-radius: 999px; flex: 1; min-width: 140px; }
.banner.red { color: var(--ink); }
/* ملصقات QR */
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.label { display: flex; gap: 8px; align-items: center; border: 1px dashed #999; border-radius: 6px; padding: 6px; break-inside: avoid; page-break-inside: avoid; background: #fff; color: #000; }
.label .qr { width: 78px; height: 78px; flex: none; } .label .qr svg { width: 100%; height: 100%; display: block; }
.label .txt { display: flex; flex-direction: column; min-width: 0; font-size: 11px; line-height: 1.3; } .label .txt b { font-size: 12px; text-align: right; } .label small { color: #444; font-size: 9px; }
@media print { .side, .side-back { display: none !important; } body.has-side { padding-right: 0 !important; } .labels { grid-template-columns: repeat(3, 1fr); } }
.btn-row.actions > .btn { flex: 1 1 auto; min-height: 44px; padding: 8px 14px; font-size: 15px; white-space: nowrap; }
.label { flex-direction: column; text-align: center; gap: 4px; } .label .txt { align-items: center; } .label .txt b { text-align: center; }
.label .txt span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media print { .labels { grid-template-columns: repeat(4, 1fr); } }
/* الإصدار 2.0 – المرحلة الثانية: الجرد الشامل والمشتريات المباشرة */
.pbar { height: 8px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; margin-top: 6px; }
.pbar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
.item-row .pbar { margin-top: 6px; max-width: 260px; }
.loc-row { gap: 10px; }
.loc-row > a.grow { text-decoration: none; color: inherit; min-width: 0; }
.loc-row > a.grow small { display: block; }
.loc-row input[type=checkbox] { width: 22px; height: 22px; flex: none; }
.sm-sel { width: auto; min-height: 40px; padding: 6px 8px; font-size: 14px; max-width: 150px; }
.cnt-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; border-inline-start: 5px solid var(--line); }
.cnt-row small { display: block; color: var(--muted); font-size: 13px; }
.cnt-row.ok { border-inline-start-color: var(--green); background: var(--green-soft); }
.cnt-row.miss { border-inline-start-color: var(--red); background: var(--red-soft); }
.cnt-row.cond { border-inline-start-color: var(--orange); background: var(--orange-soft); }
.cnt-row.else { border-inline-start-color: var(--primary); background: var(--primary-soft); }
.cnt-row.add { border-inline-start-color: var(--accent); background: var(--accent-soft); }
.seg { display: flex; gap: 4px; flex: none; }
.seg button { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-size: 18px; font-weight: 700; cursor: pointer; color: var(--ink); }
.seg button:nth-child(1).on { background: var(--green); border-color: var(--green); color: #fff; }
.seg button:nth-child(2).on { background: var(--red); border-color: var(--red); color: #fff; }
.seg button:nth-child(3).on { background: var(--orange); border-color: var(--orange); color: #fff; }
.cnt-grp { padding: 10px 14px; }
.cnt-grp summary { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cnt-grp summary .btn { margin-inline-start: auto; }
.creds .qrbox { width: 180px; margin: 0 auto 10px; }
.creds .qrbox svg { width: 100%; height: auto; display: block; }
.hcards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.hcard { display: flex; gap: 12px; align-items: center; border: 1px dashed #999; border-radius: 10px; padding: 10px; break-inside: avoid; }
.hcard .qr { width: 110px; flex: none; } .hcard .qr svg { width: 100%; height: auto; display: block; }
.hcard b { display: block; font-size: 17px; margin: 2px 0; } .hcard span, .hcard small { display: block; font-size: 12px; }
.drow { flex-wrap: wrap; }
.drow > .grow { flex: 1 1 calc(100% - 60px); min-width: 0; }
.drow > select, .drow > .row-acts { margin-inline-start: auto; }
.row-acts { display: flex; gap: 6px; align-items: center; }
@media (min-width: 700px) { .drow > .grow { flex-basis: 40%; } }
.dgrp > summary { cursor: pointer; list-style: none; } .dgrp > summary::before { content: '▾ '; } .dgrp:not([open]) > summary::before { content: '◂ '; }
