/* مدار سنتر — فاتح، أزرار داكنة، أرقام غربية، خط Readex Pro */
:root {
  --brand: #0E1B3D;
  --ink: #0B1633;
  --muted: #56627A;
  --ground: #F3F6FB;
  --card: #FFFFFF;
  --line: #DCE3EE;
  --gold: #22D3EE;   /* إشارة سماوية: على الخلفيات الداكنة فقط */
  --accent: #2F5BEA; /* أزرق الثقة: أزرار ثانوية، تحديد، أشرطة */
  --ok: #0E6B5C;
  --ok-soft: #DCEBE6;
  --warn-soft: #F6EEDC;
  --warn-ink: #6B4F1D;
  --danger: #9C2C2C;
  --r: 16px;
  font-family: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color: var(--ink);
  background: var(--ground);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; font-variant-numeric: lining-nums; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--ink); }
h1, h2, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.grow { flex: 1; min-width: 0; }
.flip { transform: scaleX(-1); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- أزرار وحقول ---------- */
.btn { min-height: 52px; border-radius: 16px; border: 0; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 16px; cursor: pointer; width: 100%; text-decoration: none; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--ink); color: var(--ink); }
.btn.danger { background: transparent; border: 1.5px solid #E7C9C9; color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex-shrink: 0; }
.link { background: none; border: 0; color: var(--ink); text-decoration: underline; cursor: pointer; padding: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select { height: 50px; border-radius: 14px; border: 1px solid var(--line); background: #fff; padding: 0 14px; font-size: 16px; width: 100%; }
.field input:focus, .field select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(47,91,234,.28); }
.pw, .suffix { position: relative; display: flex; }
.pw .icon-btn { position: absolute; inset-inline-end: 3px; top: 3px; border: 0; }
.suffix span { position: absolute; inset-inline-end: 14px; top: 14px; color: var(--muted); font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.6; background: #E9EDF5; border-radius: 12px; padding: 10px 12px; }
.note svg { flex-shrink: 0; margin-top: 2px; }

/* ---------- بطاقات وقوائم ---------- */
.card { background: var(--card); border-radius: 20px; padding: 16px; border: 1px solid #E4EAF3; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.list { padding: 6px; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: 14px; text-decoration: none; background: none; border: 0; width: 100%; text-align: start; cursor: pointer; font-size: 15px; }
.row:hover { background: var(--ground); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span { color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; }
.title { font-size: 22px; font-weight: 700; }
.head-row { display: flex; align-items: center; gap: 12px; }
.big { font-size: 20px; }

/* ---------- الدخول ---------- */
.auth { min-height: 100dvh; max-width: 440px; margin: 0 auto; padding: max(32px, env(safe-area-inset-top)) 20px 24px; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-head h1 { font-size: 24px; font-weight: 700; }
.auth-head p { color: var(--muted); font-size: 14px; }
.switch { text-align: center; font-size: 14px; }
.auth > .hint { text-align: center; }
.loader { margin: 0 auto; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { .spark { display: none; } }
.spinner { width: 36px; height: 36px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- الإطار ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; background: var(--ground); }
.top { position: sticky; top: 0; z-index: 2; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 16px 14px; border-radius: 0 0 22px 22px; }
.top strong { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top span { font-size: 12px; opacity: .85; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: #fff; object-fit: contain; flex-shrink: 0; }
.logo.initial { display: grid; place-items: center; color: var(--brand); font-weight: 700; font-size: 20px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.top .pill { opacity: 1; font-size: 12px; }
.pill.ok { background: rgba(255,255,255,.16); color: #fff; }
.pill.off { background: var(--warn-soft); color: var(--warn-ink); }
.view { flex: 1; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; outline: none; }
.tabs { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #E4EAF3; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 6px 2px; }
.tabs a { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; }
.tabs a.on { color: var(--brand); font-weight: 700; }
.credit { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--muted); padding: 4px 0 max(10px, env(safe-area-inset-bottom)); background: transparent; }
.app > .credit { background: #fff; }

.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dl .btn { min-height: 46px; font-size: 15px; }
.kv strong svg { vertical-align: -2px; }

/* ---------- قيد البناء ---------- */
.empty { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 300px; }
.bubble { width: 72px; height: 72px; border-radius: 22px; background: var(--warn-soft); color: var(--ink); display: grid; place-items: center; }
.tag { font-size: 12px; font-weight: 600; background: var(--ink); color: #fff; padding: 5px 12px; border-radius: 999px; }

/* ---------- الهوية ---------- */
.preview { border-radius: 20px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.preview-top { background: var(--c); color: #fff; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.preview-top img, .preview-top .initial { width: 38px; height: 38px; border-radius: 12px; background: #fff; object-fit: contain; display: grid; place-items: center; color: var(--c); font-weight: 700; }
.preview-btn { margin: 12px 14px 4px; height: 44px; border-radius: 14px; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; font-weight: 600; }
.logo-row { display: flex; gap: 12px; align-items: flex-end; }
.logo-row .field { flex: 1; }
.logo-pick { width: 72px; height: 72px; border-radius: 16px; border: 1.5px dashed #9AA6BC; background: #F7F9FD; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; cursor: pointer; overflow: hidden; flex-shrink: 0; }
.logo-pick img { width: 100%; height: 100%; object-fit: contain; }
.logo-row input[type=file]:focus-visible + .logo-pick, .logo-pick:focus-within { outline: 3px solid var(--gold); }
.swatches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.swatches legend { font-size: 13px; color: var(--muted); margin-bottom: 8px; padding: 0; }
.sw { width: 44px; height: 44px; border-radius: 14px; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.on { border-color: var(--accent); box-shadow: none; }

/* ---------- تنبيه ---------- */
.toast { position: fixed; inset-inline: 16px; bottom: 96px; max-width: 420px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; text-align: center; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; z-index: 10; }
.toast.ok, .toast.error { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }

/* ---------- شاشة كبيرة: القائمة على الجانب ---------- */
@media (min-width: 900px) {
  .app { max-width: 1100px; display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr auto; }
  .top { grid-column: 1 / -1; border-radius: 0 0 22px 22px; }
  .tabs { grid-row: 2; grid-column: 1; position: static; grid-auto-flow: row; grid-auto-rows: min-content; align-content: start; border: 0; background: transparent; padding: 16px 8px; gap: 4px; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 14px; font-size: 15px; border-radius: 14px; }
  .tabs a.on { background: #fff; }
  .view { grid-row: 2; grid-column: 2; max-width: 640px; }
  .app > .credit { grid-column: 1 / -1; background: transparent; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* =================== الأقسام الخمسة =================== */
.hdr { background: rgba(255,255,255,.12); border: 0; color: #fff; }
.hdr.on { background: rgba(255,255,255,.25); }
.icon-btn.dark { background: var(--ink); color: var(--gold); border: 0; }
.icon-btn.ghost { border: 0; background: transparent; }
.btn.small { min-height: 40px; width: auto; padding: 0 14px; font-size: 14px; }
.btn.big { min-height: 58px; font-size: 17px; }
.btn.ghost.light { color: #fff; border-color: #fff; }
.link.danger { color: var(--danger); }
.grow { flex: 1; min-width: 0; }
.grow small, .row small { display: block; font-size: 12px; color: var(--muted); }
.center { text-align: center; }
.pad { padding: 12px; }
.muted { color: var(--muted); }
.good { color: var(--ok); }
.bad { color: var(--danger); }
.neg { color: #FFB4B4 !important; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.kv.big { font-size: 17px; align-items: baseline; }
.kv.big strong { font-size: 24px; }

/* تنبيهات أعلى الشاشة */
.banner { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; font-size: 13px; text-decoration: none; }
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }
.banner.bad { background: #FBE9E9; color: var(--danger); }
.pill.okpill { background: var(--ok); color: #fff; }
.pill.warnpill { background: var(--warn-soft); color: var(--warn-ink); }
.pill.goldpill { background: #E6EEFF; color: #1F3FA8; }

/* بحث */
.searchbar { display: flex; gap: 10px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
.search input { border: 0; outline: none; flex: 1; font-size: 16px; background: transparent; color: var(--ink); min-width: 0; }
.search:focus-within { border-color: var(--ink); }

/* شبكة الأصناف */
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ptile { min-height: 104px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start; cursor: pointer; }
.ptile:active { transform: scale(.98); }
.ptile.out { opacity: .55; }
.pname { font-size: 13px; line-height: 1.35; flex: 1; }
.prow { display: flex; justify-content: space-between; align-items: baseline; width: 100%; gap: 4px; }
.prow b { font-size: 14px; }
.prow small, .qty { font-size: 11px; color: var(--muted); }
.prow small.low, .qty.low { color: var(--danger); font-weight: 600; }
.qty { font-size: 15px; font-weight: 600; color: var(--ink); min-width: 40px; text-align: center; }
.pthumb { width: var(--s, 40px); height: var(--s, 40px); border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--ground); }
.pthumb.initial { display: grid; place-items: center; background: #E6EEFF; color: #1F3FA8; font-weight: 700; }

/* السلة */
.cart { position: sticky; bottom: 66px; background: #fff; border-radius: 22px; padding: 14px; box-shadow: 0 -6px 24px rgba(15,29,54,.08); border: 1px solid #E4EAF3; display: flex; flex-direction: column; gap: 10px; z-index: 1; }
.cart.is-empty { position: static; box-shadow: none; }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-lines { display: flex; flex-direction: column; gap: 8px; max-height: 28vh; overflow-y: auto; }
.cline { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 6px; background: var(--ground); border-radius: 12px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; border: 0; background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.stepper strong { min-width: 20px; text-align: center; }
.ltotal { min-width: 64px; text-align: end; }
.paybtn { justify-content: space-between; min-height: 56px; }
.paybtn b { color: var(--gold); font-size: 20px; }

/* الدفع */
.totalcard { background: var(--ink); color: #fff; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.totalcard > span { font-size: 13px; color: #B9C6E4; }
.totalcard strong { font-size: 40px; color: var(--gold); line-height: 1.1; }
.eq { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.eq span { background: rgba(255,255,255,.08); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; }
.eq small { font-size: 11px; color: #B9C6E4; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; background: var(--ground); border-radius: 14px; padding: 4px; }
.seg button { flex: 1 1 auto; min-height: 40px; border-radius: 11px; border: 0; background: transparent; cursor: pointer; font-size: 14px; padding: 0 10px; }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }
.seg-wrap, .catgrid, .roles { border: 0; margin: 0; padding: 0; }
.seg-wrap legend, .catgrid legend, .roles legend { font-size: 13px; color: var(--muted); margin-bottom: 8px; padding: 0; }
.chip { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--ground); flex-shrink: 0; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 0 8px; }
.done h2 { font-size: 24px; }
.bubble.ok { background: var(--ok-soft); color: var(--ok); }

/* المخزون */
.item-head { display: flex; gap: 14px; align-items: center; }
.stock-num { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.stock-num strong { font-size: 40px; }
.stock-num span, .stock-num small { color: var(--muted); font-size: 13px; }
.with-btn { display: flex; gap: 8px; }
.with-btn input { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }

/* المصروفات */
.amount-input { border: 0; outline: none; text-align: center; font-size: 44px; font-weight: 700; width: 100%; background: transparent; color: var(--ink); padding: 6px 0; }
.catgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.catgrid legend { grid-column: 1 / -1; }
.cat { min-height: 76px; border-radius: 16px; border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12px; cursor: pointer; padding: 6px 4px; text-align: center; }
.cat.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.list-head { font-size: 13px; color: var(--muted); padding: 8px 12px 4px; display: flex; gap: 6px; align-items: center; }

/* الأرباح */
.hero-card { background: var(--ink); color: #fff; border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.hero-card > span { font-size: 13px; color: #B9C6E4; }
.hero-card > strong { font-size: 40px; color: var(--gold); line-height: 1.15; }
.hero-card > strong small { font-size: 15px; color: #fff; }
.hero-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.hero-grid div { background: rgba(255,255,255,.08); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; }
.hero-grid small { font-size: 11px; color: #B9C6E4; }
.hero-grid b { font-size: 17px; }
.bar-row { display: flex; flex-direction: column; gap: 4px; }
.bar { height: 8px; border-radius: 999px; background: #E8EDF5; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 999px; }

/* الموظفون */
.staff-row.off { opacity: .6; }
.row-actions { display: flex; gap: 14px; padding: 0 12px 10px 12px; margin-inline-start: 52px; border-bottom: 1px solid #E8EDF5; }
.row-actions .link { padding: 4px 0; font-size: 13px; display: inline-flex; gap: 4px; align-items: center; text-decoration: none; }
.mini-select { height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 0 8px; font-size: 13px; }
.ltr-start { text-align: end; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.role-opt:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.role-opt input { margin-top: 4px; accent-color: var(--ink); }
.role-opt span { display: flex; flex-direction: column; }
.role-opt small { color: var(--muted); font-size: 12px; }

/* المزيد */
.mini-list { margin: 0; padding-inline-start: 18px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.bad-card { border-color: #F1CACA; background: #FFF8F8; }

/* الماسح */
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: #fff; padding: 20px; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .scan-frame { position: relative; width: min(80vw, 320px); height: 160px; border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scanner p, .scanner .btn { position: relative; width: auto; }
@media (min-width: 900px) { .cart { bottom: 12px; } .view { max-width: 760px; } }

/* =================== الفواتير، المرتجعات، المشتريات، الأدوار، الفلاتر =================== */
.subtabs { display: flex; gap: 6px; background: #fff; border: 1px solid #E4EAF3; border-radius: 14px; padding: 4px; }
.subtabs a { flex: 1; text-align: center; min-height: 40px; display: grid; place-items: center; border-radius: 11px; text-decoration: none; font-size: 14px; color: var(--muted); }
.subtabs a.on { background: var(--ink); color: #fff; font-weight: 600; }
.filters { display: flex; flex-direction: column; gap: 8px; }
.flt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.flt { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.flt select, .flt input { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 10px; font-size: 14px; color: var(--ink); width: 100%; }
.flt.date { flex-direction: row; align-items: center; gap: 6px; }
.export-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-btn { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.chip-btn:hover:not(:disabled) { border-color: var(--ink); }
.chip-btn:disabled { opacity: .5; cursor: not-allowed; }
.sumline { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; background: #fff; border-radius: 14px; border: 1px solid #E4EAF3; }
.sumline strong { font-size: 18px; }
.sub-title { font-size: 16px; margin: 8px 0 0; }
.tag-s { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--ground); color: var(--muted); margin-inline-start: 4px; }
.tag-s.ok { background: var(--ok-soft); color: var(--ok); }
.tag-s.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.gold { background: #E6EEFF; color: #1F3FA8; }
.chip.bad { background: #FBE9E9; color: var(--danger); }
.banner.okb { background: var(--ok-soft); color: #0B5548; }
.ret-items, .buy-lines, .perm-group { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ret-items legend, .buy-lines legend, .perm-group legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; padding: 0; font-weight: 600; }
.perm-group { border-top: 1px solid #E8EDF5; padding-top: 10px; }
.ret-line { display: flex; align-items: center; gap: 10px; }
.qty-in { width: 76px; height: 44px; border-radius: 12px; border: 1px solid var(--line); text-align: center; font-size: 16px; }
.seg-opt { flex: 1 1 auto; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg-opt span { display: grid; place-items: center; min-height: 40px; border-radius: 11px; font-size: 14px; padding: 0 10px; }
.seg-opt input:checked + span { background: var(--ink); color: #fff; font-weight: 600; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--gold); }
.buy-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.buy-line select, .buy-line input { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 8px; font-size: 14px; min-width: 0; }
textarea { font: inherit; border-radius: 14px; border: 1px solid var(--line); padding: 10px 14px; font-size: 15px; resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--ink); }
hr { border: 0; border-top: 1px solid #E8EDF5; margin: 4px 0; width: 100%; }
.row:disabled { cursor: default; opacity: 1; }

/* =================== الطباعة =================== */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; color: #000; font-family: 'Readex Pro', Tahoma, sans-serif; direction: rtl; }
  @page { margin: 6mm; }
  .print-inv.paper-80mm { width: 72mm; margin: 0 auto; font-size: 11px; }
  .print-inv.paper-a4 { max-width: 170mm; margin: 0 auto; font-size: 13px; }
  .inv header { text-align: center; margin-bottom: 6px; }
  .inv header img { width: 52px; height: 52px; object-fit: contain; }
  .inv header h1 { font-size: 1.5em; margin: 4px 0 2px; }
  .inv header p { margin: 0; }
  .inv .meta { border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 4px 0; margin: 6px 0; }
  .inv .meta div { display: flex; justify-content: space-between; gap: 6px; }
  .inv .meta small { display: block; }
  .inv table, .rep table { width: 100%; border-collapse: collapse; }
  .inv th, .inv td { text-align: start; padding: 2px 0; }
  .inv th { border-bottom: 1px solid #000; }
  .inv td:not(:first-child), .inv th:not(:first-child) { text-align: end; white-space: nowrap; }
  .inv .totals { border-top: 1px dashed #000; margin-top: 4px; padding-top: 4px; }
  .inv .totals div { display: flex; justify-content: space-between; }
  .inv .totals .grand { font-size: 1.3em; font-weight: 700; }
  .inv .policy { border: 1px solid #000; padding: 4px 6px; margin-top: 6px; font-size: .9em; }
  .inv .policy ul { margin: 2px 0 0; padding-inline-start: 14px; }
  .inv .thanks { text-align: center; margin: 6px 0 2px; }
  .inv .powered, .rep .powered { text-align: center; font-size: .8em; color: #444; margin: 2px 0; }
  .print-rep { font-size: 10px; }
  .rep header h1 { font-size: 16px; margin: 0; }
  .rep header p { margin: 2px 0 8px; color: #444; }
  .rep th, .rep td { border: 1px solid #999; padding: 3px 4px; text-align: start; vertical-align: top; }
  .rep th { background: #eee; }
  .rep tr { break-inside: avoid; }
}
.filters .search { flex: none; height: 46px; }

/* =================== وصولية (WCAG 2.1 AA) =================== */
:root { --field-line: #7A869C; }   /* حدود الحقول بتباين 3.7:1 على الأبيض (1.4.11) */
.field input, .field select, .field textarea, textarea, .flt select, .flt input, .search, .qty-in, .buy-line select, .buy-line input, .mini-select, .chip-btn { border-color: var(--field-line); }
.subtabs a, .seg-opt span, .chip-btn, .mini-select { min-height: 44px; }   /* أهداف لمس 44 بكسل */
.mini-select { height: 44px; }
.stepper button { width: 40px; height: 40px; }
.seg-opt input:focus-visible + span, .logo-row input[type=file]:focus-visible + .logo-pick, .logo-pick:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
