/* أرقام لاتينية دائماً: أي رقم هندي (٠-٩ / ۰-۹) يُرسم بشكل 0-9 حتى لو ولّده المتصفح بنفسه (حقول التاريخ والأرقام) */
@font-face { font-family: 'LatinDigits'; src: url('/digits-latin.woff') format('woff'); unicode-range: U+0660-066C, U+06F0-06F9; }
:root {
  /* هوية «كونسبت»: ذهبي #ae841f + رمادي فحمي #4d5858 */
  --gold: #ae841f; --gold-soft: #f6efdc; --gold-line: #e3d3a4; --slate: #4d5858; --slate-dark: #283232;
  --bg: #f7f4ed; --card: #fff; --ink: #2a3434; --muted: #66706f; --line: #e8e2d3;
  --brand: #8a6612; --brand-ink: #fff; --warn: #b45309; --danger: #b91c1c; --ok: #15803d;
  --radius: 10px;
  --input: #fff; --surf: #fafbfc; --surf2: #f1f5f9; --soft: #efebe0; --hover: #f3f7f7; --col: #eceef2; --th: #faf7ef; --linet: #e2e8f0; --topbar: #fff;
  --t-red: #fee2e2; --t-grn: #dcfce7; --t-org: #ffedd5; --t-yel: #fef3c7; --bubble: #f1eee4; color-scheme: light;
  /* ألوان المراحل: لون ثابت للشارة + لون فاتح لتظليل الصف */
  --st-new: #b45309;       --bg-new: #fef3c7;
  --st-design: #1d4ed8;    --bg-design: #dbeafe;
  --st-printing: #7e22ce;  --bg-printing: #ede9fe;
  --st-postpress: #c2410c; --bg-postpress: #ffedd5;
  --st-printed: #0e7490;   --bg-printed: #cffafe;
  --st-designed: #4f46e5;  --bg-designed: #e0e7ff;
  --st-ready: #15803d;     --bg-ready: #dcfce7;
  --st-delivered: #0f766e; --bg-delivered: #d5f3ee;
  --st-accounted: #4b5563; --bg-accounted: #e5e7eb;
  --st-cancelled: #b91c1c; --bg-cancelled: #fee2e2;
  --st-workshop: #a16207; --bg-workshop: #fef3c7;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: LatinDigits, "Segoe UI", Tahoma, "Noto Naskh Arabic", system-ui, sans-serif; font-size: 15px; }
.hidden { display: none !important; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); font-size: 15px; }
input[type=checkbox], input[type=radio] { width: auto; }

.btn { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-block; font-size: 14px; }
.btn:hover { background: var(--gold-soft); border-color: var(--gold-line); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--gold); border-color: var(--gold); filter: none; }
.btn.danger { color: var(--danger); border-color: #f3c4c4; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 12px 20px; font-size: 16px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.lnk { color: var(--brand); text-decoration: none; font-weight: 600; }
.lnk:hover { text-decoration: underline; }

/* دخول */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 80% -10%, #3b4747 0%, var(--slate-dark) 60%); }
.login-card { background: #fffdf8; padding: 28px 28px 24px; border-radius: 16px; width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,.35); border-top: 4px solid var(--gold); }
.login-logo { display: block; width: 100%; max-width: 280px; height: auto; margin: 4px auto 18px; }
.login-card h1 { margin: 0 0 16px; font-size: 15px; font-weight: 600; text-align: center; color: var(--slate); }
.err { color: var(--danger); min-height: 20px; margin-bottom: 8px; font-size: 13px; }

/* الشريط العلوي */
.topbar { display: flex; align-items: center; gap: 16px; background: var(--topbar); border-bottom: 3px solid var(--gold); padding: 8px 16px; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--slate); letter-spacing: .2px; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 8px; background: var(--slate-dark); padding: 3px; }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav button, nav a, .tabs a { text-decoration: none; border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
nav a:hover, nav button:hover, .tabs a:hover { background: var(--gold-soft); color: var(--ink); }
nav a.active, nav button.active { background: var(--gold-soft); color: var(--brand); font-weight: 700; box-shadow: inset 0 -2px 0 var(--gold); }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
main { padding: 16px; max-width: 1900px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .spacer, .toolbar .spacer { flex: 1; }

/* الفلاتر (مثل تقرير متابعة الطلبيات) */
.filters { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.filters .grid-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.filters label { margin-bottom: 8px; }
.stage-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0 8px; }
.stage-chips .t { font-size: 13px; color: var(--muted); margin-inline-end: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-size: 13px; cursor: pointer; margin: 0; border: 2px solid transparent; user-select: none; }
.chip input { margin: 0; }
.chip:not(.on) { opacity: .55; background: var(--card) !important; color: var(--muted) !important; border-color: var(--line); }
.chip.st-new { background: var(--bg-new); color: var(--st-new); } .chip.st-design { background: var(--bg-design); color: var(--st-design); }
.chip.st-printing { background: var(--bg-printing); color: var(--st-printing); } .chip.st-postpress { background: var(--bg-postpress); color: var(--st-postpress); }
.chip.st-ready { background: var(--bg-ready); color: var(--st-ready); } .chip.st-delivered { background: var(--bg-delivered); color: var(--st-delivered); }
.chip.st-accounted { background: var(--bg-accounted); color: var(--st-accounted); } .no-price .pc { display: none; } .no-dz .dz { display: none; } input.p-last { box-shadow: inset 0 0 0 2px #16a34a; } .tag.seg-w { background: #fde68a; color: #92400e; } .no-sm .sm { display: none; }
.chip.st-workshop { background: var(--bg-workshop); color: var(--st-workshop); } .chip.st-cancelled { background: var(--bg-cancelled); color: var(--st-cancelled); }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); margin: 0 0 8px; }
.chip-toggle input { width: auto; margin: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar input[type=text] { max-width: 260px; }
.toolbar select, .toolbar input[type=date] { width: auto; }

/* شارات المراحل والحالات */
.badge { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 99px; color: #fff; white-space: nowrap; background: #6b7280; }
.badge.st-new { background: var(--st-new); } .badge.st-design { background: var(--st-design); } .badge.st-printing { background: var(--st-printing); }
.badge.st-postpress { background: var(--st-postpress); } .badge.st-ready { background: var(--st-ready); } .badge.st-delivered { background: var(--st-delivered); }
.badge.st-accounted { background: var(--st-accounted); } .badge.st-cancelled { background: var(--st-cancelled); } .badge.st-workshop { background: var(--st-workshop); }
.tag.ws { background: var(--bg-workshop); color: var(--st-workshop); }
table.orders tr.row-st-workshop td { background: var(--bg-workshop); } table.orders tr.row-st-workshop td:first-child { border-inline-start-color: var(--st-workshop); }
.cancel-banner { background: var(--bg-cancelled); color: var(--st-cancelled); border: 1px solid var(--st-cancelled); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
table.orders tr.row-st-cancelled td { background: var(--bg-cancelled); color: #7f1d1d; text-decoration: line-through; } table.orders tr.row-st-cancelled td:first-child { border-inline-start-color: var(--st-cancelled); }
table.orders tr.row-st-cancelled td.no-print, table.orders tr.row-st-cancelled td:first-child { text-decoration: none; }
.badge.pay-paid { background: var(--ok); } .badge.pay-partial { background: var(--warn); } .badge.pay-unpaid { background: var(--danger); } .badge.pay-void { background: #6b7280; }
.badge.pf-pending { background: var(--warn); } .badge.pf-approved { background: var(--ok); } .badge.pf-changes { background: var(--danger); } .badge.pf-superseded { background: #9ca3af; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.tag.urgent { background: #fee2e2; color: var(--danger); } .tag.wa { background: #dcfce7; color: var(--ok); }
.tag.late { background: #ffedd5; color: var(--warn); } .tag.debt { background: #fef3c7; color: var(--warn); }
.tag.pf-pending { background: #fef3c7; color: var(--warn); } .tag.pf-approved { background: #dcfce7; color: var(--ok); } .tag.pf-changes { background: #fee2e2; color: var(--danger); }

/* الجداول */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--slate); font-weight: 700; font-size: 13px; background: var(--th); position: sticky; top: 0; white-space: nowrap; }
th[data-sort] { cursor: pointer; } th[data-sort]:hover { color: var(--ink); }
th .arr { font-size: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table th, table td { text-align: right; }
td .sub { font-size: 12px; color: var(--muted); }
tfoot td { font-weight: 700; background: var(--surf); border-top: 2px solid var(--line); }
table.orders tbody tr { cursor: pointer; }
table.orders tbody tr:hover td { filter: brightness(.96); }
table.orders tbody td:first-child { border-inline-start: 6px solid transparent; }
table.orders tr.row-st-new td { background: var(--bg-new); } table.orders tr.row-st-new td:first-child { border-inline-start-color: var(--st-new); }
table.orders tr.row-st-design td { background: var(--bg-design); } table.orders tr.row-st-design td:first-child { border-inline-start-color: var(--st-design); }
table.orders tr.row-st-printing td { background: var(--bg-printing); } table.orders tr.row-st-printing td:first-child { border-inline-start-color: var(--st-printing); }
table.orders tr.row-st-postpress td { background: var(--bg-postpress); } table.orders tr.row-st-postpress td:first-child { border-inline-start-color: var(--st-postpress); }
table.orders tr.row-st-ready td { background: var(--bg-ready); } table.orders tr.row-st-ready td:first-child { border-inline-start-color: var(--st-ready); }
table.orders tr.row-st-delivered td { background: var(--bg-delivered); } table.orders tr.row-st-delivered td:first-child { border-inline-start-color: var(--st-delivered); }
table.orders tr.row-st-accounted td { background: var(--bg-accounted); } table.orders tr.row-st-accounted td:first-child { border-inline-start-color: var(--st-accounted); }
table.clickable tbody tr { cursor: pointer; } table.clickable tbody tr:hover td { background: var(--hover); }
tr.void td { color: #9ca3af; text-decoration: line-through; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }
.pill-ok { color: var(--ok); } .pill-bad { color: var(--danger); } .pill-debt { color: var(--ok); font-weight: 700; }

/* اللوحة (عرض الكروت) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--col); border-radius: var(--radius); padding: 10px; min-height: 140px; border-top: 5px solid var(--line); }
.col.st-new { border-top-color: var(--st-new); } .col.st-design { border-top-color: var(--st-design); } .col.st-printing { border-top-color: var(--st-printing); }
.col.st-postpress { border-top-color: var(--st-postpress); } .col.st-ready { border-top-color: var(--st-ready); } .col.st-delivered { border-top-color: var(--st-delivered); }
.col.st-accounted { border-top-color: var(--st-accounted); } .col.st-cancelled { border-top-color: var(--st-cancelled); } .col.st-workshop { border-top-color: var(--st-workshop); }
.col h3 { margin: 0 0 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.col h3 .count { background: var(--card); border-radius: 99px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.card { background: var(--card); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; border: 1px solid transparent; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card:hover { border-color: var(--brand); }
.card .top { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.card .title { font-weight: 600; margin: 4px 0; overflow-wrap: anywhere; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .who2 { margin-top: 6px; font-size: 12px; } .card .who2.none { color: var(--warn); }

/* لوحات عامة */
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.panel h2 { margin: 0 0 12px; font-size: 16px; color: var(--slate); padding-inline-start: 10px; border-inline-start: 4px solid var(--gold); }
.grid { display: grid; gap: 12px; }
.grid.cols2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.stat .n { font-size: 22px; font-weight: 700; margin-top: 2px; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.link { cursor: pointer; } .stat.link:hover { outline: 2px solid var(--gold); }
.stat { border-top: 3px solid var(--gold-line); }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.tabs button, .tabs a { text-decoration: none; display: inline-block; border: 0; background: transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active, .tabs button.active { color: var(--brand); font-weight: 700; border-bottom-color: var(--gold); }

/* صفحة الزبون */
.cust-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cust-head > div:first-child { flex: 1; min-width: 200px; }
.cust-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.cust-head h2 { margin: 4px 0; font-size: 22px; }
.cust-head h1 { margin: 0 0 4px; font-size: 22px; }
.cust-bal { margin-inline-start: auto; text-align: center; padding: 8px 20px; border-radius: 10px; background: var(--surf2); }
.cust-bal.debt { background: #fee2e2; color: var(--danger); } .cust-bal.clear { background: #dcfce7; color: var(--ok); }
.cust-bal .n { font-size: 24px; font-weight: 700; }

/* نوافذ */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; justify-content: center; align-items: flex-start; padding: 24px 12px; overflow-y: auto; z-index: 20; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 900px; padding: 18px; }
.modal.narrow { max-width: 620px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .modal .cols { grid-template-columns: 1fr; } main { padding: 10px; } }
.section-title { font-weight: 700; margin: 16px 0 8px; font-size: 14px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; align-items: center; }
.timeline { font-size: 13px; }
.timeline div { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.timeline .t { color: var(--muted); font-size: 12px; margin-inline-end: 8px; }
.msg { padding: 6px 10px; border-radius: 10px; margin: 4px 0; max-width: 85%; font-size: 14px; white-space: pre-wrap; }
.msg.in { background: var(--bubble); } .msg.out { background: #dcfce7; margin-inline-start: auto; }
.msg small { display: block; color: var(--muted); font-size: 11px; }
.total-preview { background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-weight: 700; }

/* معاينات التصميم */
.proof { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surf); }
.proof.superseded { opacity: .6; }
.proof-thumb { width: 110px; height: 110px; flex: none; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; text-decoration: none; }
.proof-thumb img { width: 100%; height: 100%; object-fit: contain; }
.proof-thumb .pdf { font-weight: 700; color: var(--danger); font-size: 20px; }
.proof-info { flex: 1; min-width: 0; }
/* التصميم والتعديلات كمحادثة */
.dz-thread { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--soft); border-radius: 12px; max-height: 70vh; overflow-y: auto; }
.dz-msg { max-width: min(560px, 92%); padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.dz-des { align-self: flex-start; border-start-start-radius: 4px; }
.dz-cust { align-self: flex-end; border-start-end-radius: 4px; background: #fff7e6; border-color: #f3d9a4; }
.dz-cust.ok { background: #ecfdf3; border-color: #a7e3bf; }
.dz-msg.superseded { opacity: .65; }
.dz-head { font-size: 13px; margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dz-head .sub { color: var(--muted); font-size: 12px; }
.dz-img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.dz-pdf { display: inline-block; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 8px; font-weight: 600; }
.dz-note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.dz-compose { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.dz-compose textarea { width: 100%; resize: vertical; }
.dz-up { margin-top: 10px; }
.dz-up summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.dz-zoom { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.85); display: grid; place-items: center; cursor: zoom-out; padding: 16px; }
.dz-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.quote { background: #fff7ed; border-inline-start: 4px solid var(--warn); padding: 6px 10px; margin: 6px 0; border-radius: 6px; font-size: 14px; }
/* معاينة التصميم السريعة: زر تحت «تم التصميم» + شاشة الإرسال للزبون */
.mv-stack { display: inline-flex; flex-direction: column; gap: 4px; align-items: stretch; }
.mv-stack .btn { text-align: center; }
.tile .tile-go.tile-dz { margin-top: 4px; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.65); }
.dzp-cur { margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.dzp-cur.dzp-changes { background: #fff5f5; border-color: #f3b3b3; }
.dzp-cur.dzp-approved { background: #ecfdf3; border-color: #a7e3bf; }
.dzp-cur .dz-msg { max-width: 100%; margin-top: 8px; }
.dzp-img { max-height: 240px; }
.dzp-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.dzp-new { margin: 8px 0; padding: 8px; border: 1px dashed var(--line); border-radius: 12px; }
.dzp-none { margin: 6px 0 10px; }
html[data-theme=dark] .dzp-cur.dzp-changes { background: #3a2323; border-color: #6a3a3a; }
html[data-theme=dark] .dzp-cur.dzp-approved { background: #1f3a2a; border-color: #2f5a3f; }
.sendbox { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.sendbox input { flex: 1; min-width: 200px; direction: ltr; font-size: 12px; }
.attach-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* مستندات للطباعة (فاتورة، سند) */
.doc { background: #fff; color: #111; padding: 6px 4px; }
.doc-logo { display: block; height: 58px; width: auto; margin-bottom: 6px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--gold); padding-bottom: 10px; margin-bottom: 14px; gap: 12px; }
.doc-head h1 { margin: 0; font-size: 24px; } .doc-head .sub { color: #555; font-size: 13px; }
.doc-title { text-align: left; } .doc-title h2 { margin: 0; font-size: 22px; } .doc-title div { font-size: 14px; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-bottom: 14px; font-size: 14px; }
.doc-meta b { color: #444; font-weight: 600; margin-inline-end: 6px; }
.doc table th { background: #f1f1f1; color: #222; position: static; }
.doc table td, .doc table th { border: 1px solid #d4d4d4; }
.doc-totals { margin-top: 12px; margin-inline-start: auto; width: 320px; max-width: 100%; }
.doc-totals div { display: flex; justify-content: space-between; padding: 4px 8px; border-bottom: 1px solid #e5e5e5; }
.doc-totals .grand { font-weight: 700; font-size: 17px; background: #f1f1f1; }
.doc-amount { font-size: 28px; font-weight: 700; border: 2px solid #111; padding: 8px 18px; display: inline-block; margin: 10px 0; }
.doc-sign { display: flex; justify-content: space-between; margin-top: 50px; font-size: 14px; }
.doc-sign div { border-top: 1px solid #111; padding-top: 6px; width: 30%; text-align: center; }
.doc-foot { margin-top: 24px; text-align: center; color: #555; font-size: 13px; }
.void-mark { color: var(--danger); font-weight: 700; font-size: 20px; border: 3px solid var(--danger); display: inline-block; padding: 2px 14px; transform: rotate(-6deg); margin: 6px 0; }

.toast { position: fixed; bottom: 20px; inset-inline: 0; margin-inline: auto; width: fit-content; max-width: 90vw; background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; }
.toast.error { background: var(--danger); }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: embed; font-size: 13px; }

/* صفحة الزبون العامة (موافقة المعاينة) */
.public-page { background: var(--bg); }
.pub-logo { display: block; height: 54px; width: auto; margin: 0 auto 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-line); border-color: var(--gold); }
.pub { max-width: 820px; margin: 0 auto; padding: 16px; }
.pub-card { background: var(--card); border-radius: 14px; padding: 20px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.pub-shop { color: var(--brand); font-weight: 700; margin-bottom: 4px; }
.pub h1 { font-size: 20px; margin: 0 0 4px; }
.pub-view { margin: 14px 0; text-align: center; }
.pub-img { max-width: 100%; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: repeating-conic-gradient(#f3f4f6 0 25%, #fff 0 50%) 50% / 20px 20px; }
.pub-pdf { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; }
.pub-note { background: var(--gold-soft); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.pub-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.pub-done { padding: 16px; border-radius: 10px; font-size: 17px; text-align: center; margin: 10px 0; }
.pub-done.ok { background: #dcfce7; color: var(--ok); } .pub-done.warn { background: #fff7ed; color: var(--warn); }

.print-only { display: none; }
@media print {
  @page { margin: 10mm; }
  html, body { background: #fff; font-size: 12px; }
  .topbar, .no-print, .toast, .filters, .toolbar, .tabs, .overlay .modal-head button, nav { display: none !important; }
  .print-only { display: block !important; }
  body[data-print="modal"] #app { display: none !important; }
  body[data-print="view"] #modalRoot { display: none !important; }
  .overlay { position: static; background: none; padding: 0; display: block; overflow: visible; }
  .modal { max-width: none; box-shadow: none; padding: 0; border-radius: 0; }
  main { padding: 0; max-width: none; }
  .table-wrap, .panel, .stat { box-shadow: none; overflow: visible; }
  table.orders tbody tr { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.orders tbody td, .badge, .chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  th { position: static; }
  td, th { padding: 4px 6px; font-size: 11px; }
}

/* المرحلة 3: تعديل السعر من الجدول، مواد الطلبية */
.pe { cursor: text; border-bottom: 1px dashed var(--brand); padding: 1px 3px; border-radius: 3px; }
.pe:hover { background: #fff7d6; }
.pe-input { width: 110px !important; padding: 7px 8px !important; font-size: 15px !important; }
.pe { display: inline-block; min-width: 54px; padding: 5px 9px; text-align: center; }
td.sz-l, td.sz-w, td.sz-n, td.sz-q { min-width: 100px; }
.mat-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.mat-row .mat-name { flex: 1; min-width: 120px; }
.mat-row input { width: 90px; }
.mat-row.issued { opacity: .75; }
.chip-toggle.block { display: flex; margin: 4px 0; }

.line-head { font-size: 12px; color: var(--muted, #6b7280); margin-bottom: 2px; flex-wrap: nowrap; overflow-x: auto; }
.line-head span { flex: none; }
.line.actions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
@media print { .line-head { display: none; } }

/* نافذة بملء الصفحة (طلبية جديدة، فاتورة، مستندات المبيعات) */
.overlay:has(.modal.xl) { padding: 0; align-items: stretch; }
.modal.xl { max-width: none; width: 100%; min-height: 100vh; border-radius: 0; padding: 18px clamp(14px, 3vw, 40px); }
.modal.xl .cols { grid-template-columns: repeat(4, 1fr); }
.modal.xl .line input[name=d] { min-width: 220px; }
@media (max-width: 1000px) { .modal.xl .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .modal.xl .cols { grid-template-columns: 1fr; } }

/* جدول البنود */
.line-table { width: 100%; border-collapse: collapse; background: var(--card, #fff); }
.line-table th { font-size: 12px; font-weight: 600; text-align: right; padding: 8px 6px; background: var(--surf2); border: 1px solid var(--linet); white-space: nowrap; }
.line-table td { padding: 3px; border: 1px solid var(--linet); vertical-align: middle; }
.line-table td.n, .line-table th.n { width: 34px; text-align: center; color: #64748b; font-size: 12px; }
.line-table td.amt { font-weight: 600; text-align: center; background: var(--surf); }
.line-table input, .line-table select { width: 100%; margin: 0; padding: 7px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; box-sizing: border-box; }
.line-table input:hover, .line-table select:hover { border-color: #cbd5e1; }
.line-table input:focus, .line-table select:focus { border-color: var(--gold); background: var(--input); outline: none; }
.line-table .dz-in { margin-top: 3px; }
.line-table .dz-in select { padding: 4px 6px; font-size: 12px; border: 1px dashed var(--line); background: var(--surf); }
.line-table .dz-in select:focus { border-style: solid; border-color: var(--gold); background: var(--input); }
.line-table tbody tr:focus-within { background: #fbf6e8; }
.line-table tbody tr:nth-child(even) { background: var(--surf); }
@media print { .line-table { display: none; } }

/* الحضور */
tr.att-absent td { background: #fef2f2; } tr.att-off td, tr.att-holiday td { background: #f1f5f9; color: #64748b; }
tr.att-leave td, tr.att-sick td { background: #eff6ff; } tr.att-unpaid td { background: #fff7ed; } tr.att-na td { color: #cbd5e1; }
.panel .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.panel .cols .full { grid-column: 1 / -1; }
.modal.wide{max-width:900px;width:95vw}

/* ===== الوضع الداكن ===== */
html[data-theme=dark] {
  --bg: #161c1c; --card: #1f2828; --ink: #e6e9e8; --muted: #9aa6a5; --line: #334040;
  --gold-soft: #2e2a1c; --gold-line: #5a4a1e; --brand: #c9992a; --brand-ink: #1a1a1a; --slate: #b9c4c3;
  --input: #263030; --surf: #232d2d; --surf2: #2a3535; --soft: #2d3838; --hover: #283434; --col: #1b2323; --th: #232d2d; --linet: #3a4848; --topbar: #1f2828;
  --t-red: #4a2222; --t-grn: #1d3a28; --t-org: #43301a; --t-yel: #3f361a; --bubble: #2a3434;
  --bg-new: #3f361a; --bg-design: #1d2e4f; --bg-printing: #34224f; --bg-postpress: #43301a; --bg-printed: #12353d; --bg-designed: #26264f; --bg-ready: #1d3a28; --bg-delivered: #1a3a36; --bg-accounted: #2d3338; --bg-cancelled: #4a2222; --bg-workshop: #3f361a;
  --st-new: #f0a940; --st-design: #7aa2f7; --st-printing: #c4a0f5; --st-postpress: #f09a6a; --st-printed: #4dd0e1; --st-designed: #a5a8ff; --st-ready: #5fd08a; --st-delivered: #4fd1c0; --st-accounted: #9ca3af; --st-cancelled: #f08080; --st-workshop: #e0b84a;
  --danger: #f08080; --ok: #5fd08a; --warn: #f0a940; color-scheme: dark;
}
html[data-theme=dark] table.orders tr.row-st-cancelled td { color: #f3b4b4; }
html[data-theme=dark] .btn.danger { border-color: #6b3030; }
html[data-theme=dark] .login-card { background: #1f2828; }
html[data-theme=dark] .quote, html[data-theme=dark] .pub-done.warn { background: #43301a; }
html[data-theme=dark] .pe:hover { background: #3a3318; }
html[data-theme=dark] .line-table tbody tr:focus-within { background: #2e2a1c; }
html[data-theme=dark] tr.att-absent td { background: #4a2222; } html[data-theme=dark] tr.att-off td, html[data-theme=dark] tr.att-holiday td { background: #2a3535; color: #9aa6a5; }
html[data-theme=dark] tr.att-leave td, html[data-theme=dark] tr.att-sick td { background: #1d2e4f; } html[data-theme=dark] tr.att-unpaid td { background: #43301a; }
html[data-theme=dark] .doc { background: #fff; }
.theme-btn { font-size: 16px; padding: 3px 9px; }
@media print { html[data-theme=dark] { --bg:#fff; --card:#fff; --ink:#2a3434; --muted:#66706f; --line:#e8e2d3; --input:#fff; --surf:#fafbfc; --surf2:#f1f5f9; --soft:#efebe0; --hover:#f3f7f7; --col:#eceef2; --th:#faf7ef; --linet:#e2e8f0; --topbar:#fff; --t-red:#fee2e2; --t-grn:#dcfce7; --t-org:#ffedd5; --t-yel:#fef3c7; --bubble:#f1eee4; --brand:#8a6612; --slate:#4d5858; --danger:#b91c1c; --ok:#15803d; --warn:#b45309; --bg-new:#fef3c7; --bg-design:#dbeafe; --bg-printing:#ede9fe; --bg-postpress:#ffedd5; --bg-printed:#cffafe; --bg-designed: #e0e7ff; --bg-ready:#dcfce7; --bg-delivered:#d5f3ee; --bg-accounted:#e5e7eb; --bg-cancelled:#fee2e2; --bg-workshop:#fef3c7; --st-new:#b45309; --st-design:#1d4ed8; --st-printing:#7e22ce; --st-postpress:#c2410c; --st-printed:#0e7490; --st-designed: #4f46e5; --st-ready:#15803d; --st-delivered:#0f766e; --st-accounted:#4b5563; --st-cancelled:#b91c1c; --st-workshop:#a16207; color-scheme: light; } }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat-row .stat { flex: 1 1 150px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stat-row .stat b { font-size: 20px; display: block; }
.stat-row .stat.bad { border-color: var(--danger); } .stat-row .stat.bad b { color: var(--danger); }
.badge.ck-portfolio { background: #b45309; } .badge.ck-deposited { background: #1d4ed8; } .badge.ck-issued { background: #7e22ce; }
.badge.ck-cleared { background: var(--ok); } .badge.ck-bounced, .badge.ck-cancelled { background: var(--danger); }

.danger-zone { border: 1px solid var(--danger); }
.danger-zone h2 { color: var(--danger); }

.chip.st-printed { background: var(--bg-printed); color: var(--st-printed); } .badge.st-printed { background: var(--st-printed); }
table.orders tr.row-st-printed td { background: var(--bg-printed); } table.orders tr.row-st-printed td:first-child { border-inline-start-color: var(--st-printed); }
.col.st-printed { border-top-color: var(--st-printed); }
.chip.st-designed { background: var(--bg-designed); color: var(--st-designed); } .badge.st-designed { background: var(--st-designed); }
table.orders tr.row-st-designed td { background: var(--bg-designed); } table.orders tr.row-st-designed td:first-child { border-inline-start-color: var(--st-designed); }
.col.st-designed { border-top-color: var(--st-designed); }
.tag.deliv { background: #fef3c7; color: #92400e; }
html[data-theme=dark] .tag.deliv { background: #3f3416; color: #fcd34d; }
/* تسليم جزئي: سُلّم جزء من كمية الطلبية وبقيت مفتوحة */
.tag.part { background: #ede9fe; color: #5b21b6; font-weight: 700; white-space: normal; }
html[data-theme=dark] .tag.part { background: #2e2250; color: #c4b5fd; }
.part-line { margin-top: 3px; }
.part-note { font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; white-space: normal; }
.part-box { margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--surf, #fafbfc); }
.part-box summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.part-box .table-wrap { margin: 6px 0; }
.suggest { position: fixed; z-index: 10000; background: var(--card, #fff); border: 1px solid var(--line, #ddd); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 260px; overflow: auto; }
.suggest .sg-item { padding: 7px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.suggest .sg-item span { color: var(--muted, #666); font-size: 12px; direction: ltr; white-space: nowrap; }
.suggest .sg-item:hover, .suggest .sg-item.on { background: var(--hover, #eef6f6); }
.suggest .sg-item.sg-hint { flex-direction: column; align-items: flex-start; gap: 2px; border-top: 1px dashed var(--line, #ddd); opacity: .92; }
.suggest .sg-item.sg-hint span { direction: rtl; white-space: normal; color: #b45309; }
@media print { .suggest { display: none; } }

input.bad { border-color: #dc2626 !important; }
/* ===== طباعة الليبل 5×3 سم ===== */
#printRoot { display: none; }
.stage-tools { margin-inline-start: auto; display: flex; gap: 6px; }
.lbl { width: 50mm; height: 29.6mm; box-sizing: border-box; padding: 0; overflow: hidden; background: #fff; color: #000; direction: rtl; font-family: inherit; page-break-after: always; break-after: page; display: flex; flex-direction: column; border: .25mm solid #000; border-radius: 1.2mm; }
.lbl .l-top { background: #000; color: #fff; display: flex; justify-content: center; align-items: center; padding: .5mm 2mm; height: 4.6mm; box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lbl .l-shop { font-size: 6pt; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26mm; }
.lbl .l-no { font-size: 9pt; font-weight: 800; direction: ltr; letter-spacing: .4px; }
.lbl .l-main { padding: .8mm 2mm 0; display: flex; flex-direction: column; gap: .2mm; }
.lbl .l-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5mm; }
.lbl .l-qty { font-size: 8.5pt; font-weight: 800; border: .3mm solid #000; border-radius: .8mm; padding: .2mm 1.3mm; line-height: 1.2; white-space: nowrap; }
.lbl .l-cust { font-size: 6.8pt; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #222; }
.lbl .l-item { font-size: 9.5pt; font-weight: 800; line-height: 1.12; max-height: 2.25em; overflow: hidden; flex: 1; min-width: 0; }
.lbl .l-bc { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; padding: .3mm 2mm 0; }
.lbl .bc { width: 42mm; height: 8.5mm; display: block; }
.lbl .l-code { font-size: 6pt; text-align: center; direction: ltr; letter-spacing: 1px; line-height: 1; padding-bottom: .6mm; }
@media print {
  body[data-print="custom"] #app, body[data-print="custom"] #modalRoot, body[data-print="custom"] .toast { display: none !important; }
  body[data-print="custom"] #printRoot { display: block !important; }
  html, body[data-print="custom"] { background: #fff; font-size: 12px; margin: 0 !important; padding: 0 !important; height: auto !important; min-height: 0 !important; }
  #printRoot { margin: 0; padding: 0; }
  #printRoot .lbl:last-child { page-break-after: auto; break-after: auto; }
}

/* جدول بخطوط فاصلة طولية + تعديل مباشر */
table.grid-lines { border-collapse: collapse; }
table.grid-lines th, table.grid-lines td, table.orders.grid-lines th, table.orders.grid-lines td { border: 1px solid rgba(120,110,90,.4) !important; }
html[data-theme=dark] table.grid-lines th, html[data-theme=dark] table.grid-lines td { border-color: rgba(200,200,200,.25) !important; }
.nm { display: flex; gap: 4px; align-items: center; }
table.grid-lines td.n, table.grid-lines th.n { width: 1%; white-space: nowrap; }
.cell { border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: 6px; font: inherit; color: inherit; width: 100%; box-sizing: border-box; }
.cell:hover { border-color: var(--line, #ccc); background: var(--input, #fff); }
.cell:focus { border-color: var(--gold, #b8860b); background: var(--input, #fff); outline: none; }
.cell.num { text-align: right; }
.cust-grid td { padding: 2px 4px; }
.cell.saving { opacity: .6; } .cell.saved { background: #dcfce7 !important; border-color: #16a34a; }
html[data-theme=dark] .cell.saved { background: #14351f !important; }
.items-grid td { padding: 2px 4px; }
@media print { .cell { border: 0 !important; background: none !important; padding: 0; appearance: none; -webkit-appearance: none; } }

/* طباعة كل الأعمدة على ورقة A4 بالطول */
@media print {
  table.fit-a4 { width: 100% !important; table-layout: auto; font-size: 9.5px; }
  table.fit-a4 th, table.fit-a4 td { padding: 3px 4px !important; white-space: normal !important; word-break: break-word; }
  table.fit-a4 .hint { font-size: 8.5px; }
  table.fit-a4 .pill-debt { color: #15803d !important; }
  .table-wrap:has(table.fit-a4) { overflow: visible !important; }
}

th.grp { text-align: center !important; background: var(--surf2); }

/* قوائم الأسعار: الجملة أخضر، المفرق ذهبي */
th.grp-ws { background: #1f7a4d !important; color: #fff; } th.grp-rt { background: #b8891f !important; color: #fff; }
th.sub-ws { background: rgba(31,122,77,.18) !important; } th.sub-rt { background: rgba(184,137,31,.2) !important; }
td.cell-ws { background: rgba(31,122,77,.07); } td.cell-rt { background: rgba(184,137,31,.09); }
.wa-prev { white-space: pre-wrap; background: var(--surf2); border: 1px solid var(--linet); border-radius: 8px; padding: 10px; font-family: inherit; }
.line-table td.att { width: 34px; text-align: center; } .line-table th.att { width: 34px; padding: 4px; }
.att-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; border: 1px dashed #94a3b8; cursor: pointer; font-size: 13px; }
.att-btn.has { border-style: solid; border-color: #1f7a4d; color: #1f7a4d; }
.line-table tfoot td { background: var(--gold-soft); border: 1px solid var(--gold-line); font-weight: 700; padding: 8px 10px; }
.line-table tfoot td.gt-val { font-size: 15px; }
.no-price .line-table tfoot { display: none; }
@media print { .line-table tfoot { display: none; } }

/* الهاتف: جدول الطلبيات يتحول إلى كروت بعرض الشاشة بدون تمرير أفقي */
@media (max-width: 700px) {
  .table-wrap:has(table.orders[data-cards], table.orders:not(.grid-lines)) { overflow-x: visible; }
  table.orders:not(.grid-lines):not(.items-grid) { display: block; width: 100%; min-width: 0 !important; }
  table.orders:not(.grid-lines):not(.items-grid) thead, table.orders:not(.grid-lines):not(.items-grid) tfoot { display: none; }
  table.orders:not(.grid-lines):not(.items-grid) tbody { display: block; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--linet, #e2e8f0); border-radius: 10px; background: var(--card, #fff); }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td { display: block; border: 0; padding: 2px 0; text-align: right; white-space: normal; min-width: 0; word-break: break-word; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td:empty { display: none; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td::before { content: attr(data-l) ': '; color: var(--muted, #64748b); font-size: 11px; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td.selcell::before, table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l=""]::before { content: none; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td:first-child, table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="الصنف / البيان"], table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="المرحلة"], table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l=""] { grid-column: 1 / -1; }
}

/* الترخيص */
.lic-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(15,23,42,.92); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.lic-card { background: var(--card, #fff); color: var(--ink, #1f2937); border-radius: 14px; padding: 22px; width: min(520px, 100%); display: grid; gap: 10px; }
.lic-card textarea { width: 100%; font-family: monospace; font-size: 12px; }
.lic-mid { display: flex; gap: 8px; align-items: center; } .lic-mid code { flex: 1; direction: ltr; text-align: left; background: var(--surf2); padding: 8px; border-radius: 6px; font-size: 14px; }
.lic-banner { background: #fff3cd; color: #6b4e00; text-align: center; padding: 6px 10px; font-weight: 600; font-size: 13px; }
.lic-banner.urgent { background: #f8d7da; color: #7a1c24; }

/* ===== صور الأصناف ===== */
.ithumb { border-radius: 8px; object-fit: cover; background: #f1f1f1; vertical-align: middle; flex: none; }
.with-thumb { display: inline-flex; align-items: center; gap: 8px; }
.with-thumb > .ithumb { width: 34px; height: 34px; }
.card .title.with-thumb { display: flex; }
.ithumb-btn { cursor: pointer; display: inline-flex; flex: none; }
.ithumb-btn:hover .ithumb { outline: 2px solid var(--gold, #b8860b); }
.nm { display: flex; align-items: center; gap: 6px; }
.view-toggle { display: inline-flex; border: 1px solid var(--line, #ccc); border-radius: 8px; overflow: hidden; }
.view-toggle button { border: 0; background: transparent; padding: 6px 12px; font: inherit; cursor: pointer; color: inherit; }
.view-toggle button.on { background: var(--gold, #b8860b); color: #fff; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.icard { background: var(--card, #fff); border: 1px solid var(--line, #ddd); border-radius: 14px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.icard:hover, .icard:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); outline: none; }
.icard.low { border-color: #dc2626; }
.icard.void { opacity: .55; }
.ic-img { position: relative; aspect-ratio: 1 / 1; background: #f4f4f4; }
.ic-img .ithumb { width: 100%; height: 100%; border-radius: 0; display: block; }
.ic-code { position: absolute; top: 6px; inset-inline-start: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; direction: ltr; }
.ic-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.ic-name { flex: 1; font-weight: 600; font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.6em; }
.ic-qty { flex: none; min-width: 46px; text-align: center; background: #e8f5e9; color: #166534; border-radius: 9px; padding: 4px 6px; line-height: 1.15; }
.ic-qty b { display: block; font-size: 16px; } .ic-qty small { display: block; font-size: 10px; opacity: .8; }
.ic-qty.bad { background: #fee2e2; color: #b91c1c; } .ic-qty.svc { background: #eef; color: #446; font-size: 12px; }
.img-editor { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; padding: 10px; border: 1px dashed var(--line, #bbb); border-radius: 12px; flex-wrap: wrap; }
.ie-prev { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ie-prev img { width: 120px; height: 120px; border-radius: 12px; object-fit: cover; background: #f1f1f1; }
.ie-btns { flex: 1; min-width: 200px; display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.ie-btns .hint { flex-basis: 100%; }
.lightbox { text-align: center; } .lightbox .ithumb { width: min(100%, 420px); height: auto; aspect-ratio: 1; }
@media (max-width: 600px) { .item-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } .ic-name { font-size: 13px; } }
@media print { .view-toggle { display: none; } .item-grid { grid-template-columns: repeat(4, 1fr); } .icard { break-inside: avoid; box-shadow: none; } }
@media (max-width: 600px) { #lb > .grid.cols4 { grid-template-columns: repeat(3, 1fr); gap: 6px; } #lb > .grid.cols4 .stat { padding: 8px; } #lb > .grid.cols4 .n { font-size: 17px; } }
.comp-box { border: 1px dashed var(--line, #bbb); border-radius: 12px; padding: 10px; }
.comp-row { display: grid; grid-template-columns: 1.4fr .9fr .8fr 1.5fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
@media (max-width: 600px) { .comp-row { grid-template-columns: 1fr 1fr; } .comp-row [data-c=name] { grid-column: 1 / -1; } }
.ws-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.badge.wj-new { background: #dbeafe; color: #1e40af; } .badge.wj-scheduled { background: #fef3c7; color: #92400e; } .badge.wj-in_progress { background: #ede9fe; color: #5b21b6; } .badge.wj-done { background: #dcfce7; color: #166534; } .badge.wj-cancelled { background: #e5e7eb; color: #4b5563; }

/* ===== تنبيهات الموظف ===== */
.bell-btn { position: relative; }
.bell-btn .bdg { position: absolute; top: -4px; inset-inline-start: -4px; background: var(--danger, #dc2626); color: #fff; font-size: 11px; min-width: 17px; height: 17px; line-height: 17px; border-radius: 9px; text-align: center; padding: 0 4px; }
.nt-panel { position: fixed; top: 52px; inset-inline-end: 12px; width: min(380px, 94vw); max-height: 70vh; overflow: auto; background: var(--card, #fff); color: inherit; border: 1px solid var(--line, #ddd); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 70; }
.nt-panel .nt-head { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line, #ddd); position: sticky; top: 0; background: inherit; }
.nt-panel .nt-item { padding: 10px 12px; border-bottom: 1px solid var(--line, #eee); cursor: pointer; }
.nt-panel .nt-item.unread { background: rgba(37,99,235,.08); font-weight: 600; }
.nt-panel .nt-item small { display: block; opacity: .7; font-weight: 400; }
.nt-empty { padding: 24px; text-align: center; opacity: .6; }
#ntStack { position: fixed; bottom: 16px; inset-inline-start: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; width: min(340px, 92vw); pointer-events: none; }
.nt-toast { pointer-events: auto; cursor: pointer; background: #1f2937; color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); border-inline-start: 4px solid #3b82f6; animation: ntUp .35s ease-out; }
.nt-toast b { display: block; margin-bottom: 2px; }
.nt-toast.out { opacity: 0; transform: translateY(-30px); transition: all .3s; }
@keyframes ntUp { from { transform: translateY(120%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.pr-opts { display: grid; gap: 8px; margin: 6px 0 10px; }
.pr-opt-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line, #ddd); border-radius: 10px; padding: 10px 12px; }
.pr-opt-card.chosen { border-color: #16a34a; background: rgba(22,163,74,.08); }
.pr-opt-card .n { font-weight: 700; font-size: 1.1em; }
.pr-opt { flex-wrap: wrap; }
@media print { #ntStack, .nt-panel { display: none !important; } }

/* ===== شريط القوائم الموحّد (صف أو صفّان كحد أقصى) ===== */
.topbar { gap: 6px 14px; padding: 6px 14px; }
.topbar .brand { order: 1; }
.topbar .who { order: 2; margin-inline-start: auto; }
.topbar nav { order: 3; flex: 1 1 100%; gap: 4px; }
nav button, nav a { flex: 1 1 auto; text-align: center; padding: 6px 10px; font-size: 14px; white-space: nowrap; background: var(--card); border: 1px solid var(--line); }
@media (max-width: 700px) {
  .topbar nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  nav button, nav a { flex: none; }
}

/* ===== الجدول بعرض الصفحة: نخفي الأعمدة الثانوية ثم الكميات والأسعار عند ضيق الشاشة ===== */
table.orders { width: 100%; }
@media (max-width: 1350px) { table.orders .hide-1 { display: none; } }
@media (max-width: 1050px) { table.orders .hide-2 { display: none; } }

/* ===== شبكة المربعات الملوّنة بلون المرحلة ===== */
.tile-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.tile-legend .lg { padding: 4px 12px; border-radius: 999px; color: #fff; font-size: 13px; }
.tile-legend .lg b { margin-inline-start: 4px; background: rgba(255,255,255,.28); border-radius: 9px; padding: 0 7px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 150px; padding: 11px 12px; border-radius: 14px; color: #fff; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .12s; }
.tile:hover { transform: translateY(-2px); filter: brightness(1.06); }
.tile .t-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 17px; }
.tile .t-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-urg { background: #fff; color: #b91c1c; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; }
.tile .t-item { font-weight: 700; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-cust, .tile .t-who { font-size: 13px; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-bot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; }
.tile .t-stage { background: rgba(255,255,255,.25); border-radius: 8px; padding: 2px 8px; font-weight: 700; }
.tile .t-due { background: rgba(0,0,0,.22); border-radius: 8px; padding: 2px 7px; }
.tile .t-due.late { background: #fff; color: #b91c1c; font-weight: 700; }
.tile .tile-go { margin-top: 6px; border: 0; border-radius: 9px; padding: 5px; background: rgba(255,255,255,.92); color: #1f2937; font-weight: 700; cursor: pointer; }
.tile.st-new, .lg.st-new { background: var(--st-new); } .tile.st-design, .lg.st-design { background: var(--st-design); }
.tile.st-designed, .lg.st-designed { background: var(--st-designed); } .tile.st-workshop, .lg.st-workshop { background: var(--st-workshop); }
.tile.st-printing, .lg.st-printing { background: var(--st-printing); } .tile.st-postpress, .lg.st-postpress { background: var(--st-postpress); }
.tile.st-printed, .lg.st-printed { background: var(--st-printed); } .tile.st-ready, .lg.st-ready { background: var(--st-ready); }
.tile.st-delivered, .lg.st-delivered { background: var(--st-delivered); } .tile.st-accounted, .lg.st-accounted { background: var(--st-accounted); }
.tile.st-cancelled, .lg.st-cancelled { background: var(--st-cancelled); opacity: .75; }
@media print { .tile-legend, .tiles { display: none !important; } }
.tile .t-due { white-space: nowrap; }
.filters { padding: 8px 12px; margin-bottom: 8px; }
.filters label { margin-bottom: 4px; }
.filters .grid-f input, .filters .grid-f select { padding-block: 5px; }
.grp-head td { background: var(--surf); border-top: 2px solid var(--border, #cbd5e1); padding: 6px 10px; }
.grp-row td:first-child { border-right: 3px solid var(--accent, #2563eb); }
/* ===== طلبيات: شريط علوي مضغوط + لوحة فلاتر قابلة للطي ===== */
.top-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.top-row #f-q { flex: 1 1 150px; min-width: 0; width: auto; }
.top-row .tabs { border: 0; margin: 0; display: flex; gap: 2px; }
.cnt.on { background: var(--brand, #b8860b); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; margin-inline-start: 2px; }
.fpanel { margin-top: 8px; }
.selbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 8px; position: sticky; top: 0; z-index: 20; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-pop { position: absolute; inset-inline-start: 0; top: calc(100% + 4px); z-index: 40; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: grid; gap: 6px; min-width: 190px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.more-pop .btn { width: 100%; justify-content: flex-start; text-align: start; }
@media (max-width: 700px) {
  .top-row .btl { display: none; }
  .top-row .tabs button { padding: 6px 9px; }
  .fpanel .grid-f { grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .fpanel .stage-chips { gap: 4px; }
  .selbar select { flex: 1 1 120px; width: auto; }
}
@media print { .selbar, .more-menu { display: none !important; } }
.att-x { border: 0; background: none; color: #b91c1c; cursor: pointer; font-size: 12px; padding: 0 2px; line-height: 1; }

/* ===== ألوان مميزة: أزرار القوائم ذهبية + منطقة البحث/الفلاتر ===== */
nav button, nav a { background: var(--gold); border: 1px solid #8f6b12; color: #fff; font-weight: 600; }
nav a:hover, nav button:hover { background: #c29a2b; color: #fff; }
nav a.active, nav button.active { background: #7a5a0e; color: #fff; box-shadow: inset 0 -3px 0 #fff3c4; }
.filters { background: #e8eff0; border: 1px solid #b9c9cb; border-inline-start: 4px solid var(--slate); }
.filters input, .filters select { background: #fff; }
html[data-theme=dark] nav button, html[data-theme=dark] nav a { background: #8a6a16; border-color: #5a4a1e; color: #fff; }
html[data-theme=dark] nav a:hover, html[data-theme=dark] nav button:hover { background: #a37d1c; }
html[data-theme=dark] nav a.active, html[data-theme=dark] nav button.active { background: #c9992a; color: #1a1a1a; }
html[data-theme=dark] .filters { background: #1f3032; border-color: #3a5658; border-inline-start-color: #5f9ea0; }
html[data-theme=dark] .filters input, html[data-theme=dark] .filters select { background: var(--input); }
.filters { padding: 5px 10px; margin-bottom: 6px; }
.fpanel { margin-top: 5px; }
.fpanel .grid-f label { margin-bottom: 4px; }
.stage-tools { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nw { white-space: nowrap; }
.tiny-col { font-size: 10px !important; color: var(--muted); padding: 2px 4px !important; white-space: nowrap; font-weight: 400 !important; }
.tiny-col .tag { font-size: 9px; padding: 0 3px; }

/* ===== جدول بخطوط عمودية فاصلة + ألوان مريحة للعين ===== */
table.orders th, table.orders td { border-inline-start: 1px solid var(--line); }
table.orders th:first-child, table.orders td:first-child { border-inline-start: 0; }
table.orders td, table.orders th { padding-inline: 8px; }
:root { --bg: #f2eee4; --ink: #343e3e; --muted: #6b7473; --line: #ddd6c4; --card: #fdfcf8; --topbar: #fdfcf8; --input: #fffefb; }
html[data-theme=dark] {
  --bg: #1c2222; --card: #252d2d; --topbar: #232b2b; --ink: #cfd5d3; --muted: #8e9a99; --line: #38454a;
  --input: #2b3535; --surf: #283131; --surf2: #2e3838; --soft: #303b3b; --hover: #2c3636; --col: #202727; --th: #283131; --linet: #3d4a4a;
  --bg-new: #3a3420; --bg-design: #23304a; --bg-printing: #322a48; --bg-postpress: #3d3022; --bg-printed: #1c3338; --bg-designed: #2a2c4a; --bg-ready: #213a2d; --bg-delivered: #1f3a37; --bg-accounted: #2d3436; --bg-workshop: #3a3420;
}
.note-cell { min-width: 220px; max-width: 380px; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.5; color: var(--ink); }
/* المتابعة والنوافذ على التلفون: لا تتجاوز عرض الشاشة */
.modal { max-width: min(900px, 100%); overflow-wrap: anywhere; }
.modal textarea { max-width: 100%; }
@media (max-width: 700px) { table.orders.grid-lines { font-size: 13px; } table.orders.grid-lines th, table.orders.grid-lines td { padding: 6px 5px; } }

/* صفوف جدول الطلبيات: ارتفاع مضغوط على قدّ المحتوى */
table.orders tbody tr:not(.grp-head) td { padding-block: 4px; line-height: 1.35; height: auto; }
table.orders .with-thumb > .ithumb { width: 28px; height: 28px; }
table.orders .note-cell { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 200px; max-width: 320px; line-height: 1.35; }
table.orders td .sub { line-height: 1.25; }
table.orders td .tag, table.orders td .badge { white-space: nowrap; }
table.orders .selcell { padding-block: 0; }
/* زر الإجراء (بدء التصميم / نقل المرحلة) يملأ ارتفاع الصف بالضبط */
table.orders td.act-cell { padding: 0 !important; height: 1px; width: 1%; white-space: nowrap; }
table.orders td.act-cell > .btn, table.orders td.act-cell > button { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 32px; margin: 0; border-radius: 0; box-sizing: border-box; padding: 0 12px; }
/* ضغط إضافي لارتفاع صف الطلبيات */
table.orders tbody tr:not(.grp-head) td { padding-block: 1px; line-height: 1.2; font-size: 13px; }
table.orders .with-thumb > .ithumb { width: 22px; height: 22px; border-radius: 5px; }
table.orders .with-thumb { gap: 6px; }
table.orders td .tag, table.orders td .badge { padding-block: 0; font-size: 11px; line-height: 1.3; }
table.orders td .btn.small { padding-block: 2px; }
table.orders td.act-cell > .btn, table.orders td.act-cell > button { min-height: 24px; font-size: 12px; }
table.orders .note-cell { -webkit-line-clamp: 1; line-height: 1.25; font-size: 13px; }

/* طلبية جديدة على الهاتف فقط: شاشة مضغوطة، البنود بعرض الصفحة بدون تمرير أفقي */
#nf .sx { display: none; }
@media (max-width: 700px) {
  .modal.xl:has(#nf) { padding: 10px 8px 16px; }
  .modal.xl:has(#nf) .modal-head { margin-bottom: 8px; }
  #nf .lx, #nf .nf-disc { display: none; }
  #nf .sx { display: inline; }
  #nf label { font-size: 12px; margin-bottom: 6px; min-width: 0; }
  #nf label > input { font-size: 14px; padding: 6px 8px; margin-top: 2px; }
  #nf input[type=date] { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; min-height: 34px; }
  #nf .nf-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 6px; }
  #nf .nf-top .nf-desc { grid-column: auto; }
  #nf .section-title { margin: 6px 0 4px; padding-top: 6px; font-size: 13px; }

  #nf .table-wrap { overflow: visible; }
  #nf .line-table, #nf .line-table tbody, #nf .line-table tfoot { display: block; width: 100%; }
  #nf .line-table thead { display: none; }
  #nf .line-table tr.line { display: flex; flex-wrap: wrap; align-items: flex-end; border: 1px solid var(--linet); border-radius: 8px; margin-bottom: 6px; padding: 3px; gap: 2px; }
  #nf .line-table tr.line td { display: block; border: 0; padding: 1px; min-width: 0; flex: 1 1 22%; }
  #nf .line-table tr.line td.n { flex: 0 0 22px; width: 22px; align-self: center; }
  #nf .line-table tr.line td:has([name=it]) { flex: 1 1 36%; order: 1; }
  #nf .line-table tr.line td:has([name=d]) { flex: 1 1 30%; order: 2; }
  #nf .line-table tr.line td:last-child { flex: 0 0 34px; order: 3; }
  #nf .line-table tr.line td.n { order: 0; }
  #nf .line-table tr.line td:not(.n):not(:has([name=it])):not(:has([name=d])):not(:last-child) { order: 4; }
  #nf .line-table tr.line td:has([name=note]) { flex-basis: 100%; }
  #nf .line-table tr.line td:has([name=sm]), #nf .line-table tr.line td:has([name=dz]), #nf .line-table tr.line td:has([name=wk]) { flex-basis: 30%; }
  #nf .line-table tr.line td.att { flex: 0 0 32px; width: 32px; }
  #nf .line-table input, #nf .line-table select, .modal.xl #nf .line input[name=d] { min-width: 0; }
  #nf .line-table input, #nf .line-table select { padding: 5px 6px; font-size: 13px; border-color: var(--line); }
  #nf .line-table tr.line td:last-child .btn { padding: 4px 8px; }
  #nf .line-table td:has([name=sl])::before { content: 'الطول'; } #nf .line-table td:has([name=sw])::before { content: 'العرض'; }
  #nf .line-table td:has([name=sn])::before { content: 'الكمية'; } #nf .line-table td:has([name=q])::before { content: 'العدد'; }
  #nf .line-table td:has([name=p])::before { content: 'السعر'; } #nf .line-table td:has([name=amt])::before { content: 'المجموع'; }
  #nf .line-table td:has([name=sl])::before, #nf .line-table td:has([name=sw])::before, #nf .line-table td:has([name=sn])::before, #nf .line-table td:has([name=q])::before, #nf .line-table td:has([name=p])::before, #nf .line-table td:has([name=amt])::before { display: block; font-size: 11px; color: var(--muted); padding: 0 2px; }
  #nf .no-price .pc, #nf .no-sm .sm, #nf .no-dz .dz { display: none !important; }
  #nf .line-table tfoot tr { display: flex; justify-content: space-between; border-radius: 8px; overflow: hidden; }
  #nf .line-table tfoot td { display: block; border: 0; padding: 7px 10px; }
  #nf .line-table tfoot td:empty { display: none; }
  #nf .line-table tfoot td.gt-val { flex: 1; text-align: left; }
  #nf #addLine { margin-top: 6px; }

  #nf .nf-opts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px; }
  #nf .nf-opts .chip-toggle { font-size: 12px; margin: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
  #nf .actions .btn.primary { width: 100%; padding: 10px; }
}

/* ===== الهاتف فقط: كل القوائم كروت بعرض الشاشة (التسميات من util.js → mobileCards) ===== */
@media (max-width: 700px) {
  .table-wrap:has(table.m-cards) { overflow: visible !important; max-height: none !important; border: 0; background: none; }
  table.m-cards { display: block; width: 100% !important; min-width: 0 !important; border: 0 !important; background: none; }
  table.m-cards thead { display: none; }
  table.m-cards tbody, table.m-cards tfoot { display: block; }
  table.m-cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 10px; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--linet, #e2e8f0); border-radius: 10px; background: var(--card); }
  table.m-cards td:not(.hidden) { display: block; border: 0 !important; padding: 1px 0 !important; text-align: right !important; white-space: normal !important; min-width: 0; width: auto !important; word-break: break-word; font-size: 13px; background: none; }
  table.m-cards td::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.3; }
  table.m-cards td[data-l=""]::before, table.m-cards tbody td:nth-child(-n+2)::before { content: none; }
  table.m-cards td:empty { display: none !important; }
  table.m-cards td:first-child, table.m-cards tbody td:nth-child(2), table.m-cards td.m-full { grid-column: 1 / -1; }
  table.m-cards tbody td:first-child { font-size: 12px; color: var(--muted); }
  table.m-cards tbody td:nth-child(2) { font-size: 15px; font-weight: 700; color: var(--ink); }
  table.m-cards tr:has(> td:only-child) { padding: 6px 10px; background: var(--surf2); }
  table.m-cards tfoot tr { border-color: var(--gold-line); background: var(--gold-soft); }
  table.m-cards tfoot td:first-child { font-weight: 700; color: var(--ink); }
  table.m-cards input, table.m-cards select { max-width: 100%; }
  .grid.cols2:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .grid > .stat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; }
  .grid > .stat .n { margin: 0; font-size: 20px; }
}


/* ===== الهاتف فقط: الخانات داخل الكروت لا تتداخل + الأصناف (المخزون وقوائم الأسعار): الاسم بسطر وكل المعلومات بصف واحد تحته ===== */
@media (max-width: 700px) {
  table.m-cards .cell, table.m-cards td > input, table.m-cards td > select { width: 100% !important; min-width: 0 !important; max-width: 100%; }
  table.m-cards .nm { display: flex; gap: 4px; align-items: center; min-width: 0; }
  table.m-cards .nm .cell { flex: 1 1 auto; }
  table.m-cards.items-grid tr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; padding: 6px 8px; }
  table.m-cards.items-grid tr::before { content: ''; order: 3; flex: 0 0 100%; height: 0; }
  table.m-cards.items-grid td { order: 4; flex: 1 1 0; grid-column: auto; text-align: center !important; font-size: 12px; }
  table.m-cards.items-grid td::before { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.m-cards.items-grid td:first-child { order: 0; flex: 0 0 auto; align-self: center; }
  table.m-cards.items-grid tbody td:nth-child(2) { order: 2; flex: 1 1 40%; text-align: right !important; }
  table.m-cards.items-grid td:has(.cell[data-f=name], .with-thumb) { order: 1; flex: 1 1 55%; text-align: right !important; font-size: 14px; font-weight: 700; }
  table.m-cards.items-grid td:has(.cell[data-f=name], .with-thumb)::before { content: none; }
  table.m-cards.items-grid tr:has(.cell[data-f=name]) td:nth-child(2) { flex: 0 0 76px; font-weight: 400; font-size: 12px; }
  table.m-cards.items-grid tr:has(.cell[data-f=name]) td:nth-child(2)::before { content: none; }
  table.m-cards.items-grid .cell { padding: 1px 2px; line-height: 1.5; font-size: 12px; text-align: center; }
  table.m-cards.items-grid .cell[data-f=name], table.m-cards.items-grid .cell[data-f=code] { text-align: right; }
  table.m-cards.items-grid select.cell { -webkit-appearance: none; appearance: none; background-image: none; padding-inline: 2px; }
  table.m-cards.items-grid td:has(select) { flex-grow: 1.5; }
  table.m-cards.items-grid .with-thumb img, table.m-cards.items-grid .nm img { width: 28px !important; height: 28px !important; }
}
/* عرض الزبائن: أيقونة لكل زبون */
.ctiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ctile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-inline-start: 5px solid var(--gold); border-radius: 12px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.ctile:hover { background: var(--gold-soft); }
.ctile .c-ico { font-size: 28px; line-height: 1; }
.ctile .c-main { flex: 1; min-width: 0; }
.ctile .c-name { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctile .c-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.ctile .c-chips .lg { font-size: 11px; padding: 1px 6px; border-radius: 9px; }
.ctile .c-cnt { display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 700; font-size: 18px; color: var(--brand); }
.ctile .c-late { font-size: 11px; color: var(--danger); } .ctile .c-urg { font-size: 11px; }
.cust-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cust-head h2 { margin: 0; font-size: 18px; flex: 1; }
.ctile .lg { color: #fff; }

/* مبيعات سريعة */
.qcard { background: var(--card); border: 1px solid var(--line); border-inline-start: 5px solid var(--gold); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.q-head .spacer { flex: 1; } .q-tot { font-size: 18px; color: var(--brand); }
.q-it { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; } .q-it:hover { background: var(--gold-soft); } .q-it .spacer { flex: 1; }
.q-act { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.name-cell[readonly] { cursor: pointer; font-weight: 600; } .name-cell[readonly]:hover { text-decoration: underline; }

/* الشعار لا يُطبع على المستندات */
@media print { .doc-logo { display: none !important; } }

/* كشف الحساب: خطوط عمودية خفيفة بين الخانات + أرقام سوداء */
table.vlines th, table.vlines td { border-inline: 1px solid #cfd4da; }
table.vlines th:first-child, table.vlines td:first-child { border-inline-start: 0; }
table.vlines th:last-child, table.vlines td:last-child { border-inline-end: 0; }
@media print { table.vlines th, table.vlines td { border-inline: 1px solid #bfc4ca !important; } table.vlines th:first-child, table.vlines td:first-child { border-inline-start: 0 !important; } table.vlines th:last-child, table.vlines td:last-child { border-inline-end: 0 !important; } table.vlines td, table.vlines th, p b { color: #000 !important; } }

.stmt-det > td { padding: 2px 6px 6px; }
table.inner { width: 100%; font-size: .92em; margin: 2px 0; }

/* كشف الحساب: بنود الفاتورة فقط (من البيان لآخر صنف) مظلّلة بلون سكني خفيف؛ سطر الفاتورة نفسه بدون تظليل */
td.stmt-inv { background: #eef1f5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html[data-theme=dark] td.stmt-inv { background: #2b3038; }
.stmt-det > td:first-child { background: transparent; }
table.inner th { background: transparent !important; color: inherit !important; font-weight: 800; border-bottom: 1px solid #bfc4ca; }
@media print { td.stmt-inv { background: #eef1f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } table.inner th { background: transparent !important; color: #000 !important; font-weight: 800 !important; } table.inner { background: transparent; } }

/* ===== كشف حساب الزبون (تنسيق الكشوف المعتمدة) ===== */
.stmt-doc { max-width: 900px; margin: 0 auto; }
.stmt-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stmt-acct { font-size: 18px; }
.stmt-meta { font-size: 12.5px; line-height: 1.7; color: var(--slate, #4d5858); text-align: left; }
.stmt-title { font-size: 24px; margin: 8px 0 10px; padding-bottom: 8px; border-bottom: 3px solid var(--gold); }
.stmt-tbl tfoot td { font-weight: 800; border-top: 2px solid var(--slate-dark, #283232); }
.stmt-tbl td.num, .stmt-tbl th.num { text-align: center !important; direction: ltr; font-variant-numeric: tabular-nums; }
.stmt-tbl .stmt-det > td { padding-top: 0; }
table.inner th.num, table.inner td.num { text-align: center !important; direction: ltr; }
.stmt-bal { margin: 14px 0 4px; font-size: 17px; font-weight: 800; text-align: left; direction: ltr; }
.stmt-bal span { text-decoration: underline; }
.stmt-chq { font-weight: 700; font-size: 13px; }
.stmt-aging { width: 62%; margin: 18px auto 0; border-collapse: collapse; font-size: 12px; }
.stmt-aging th { font-weight: 400; border-bottom: 1px solid var(--slate-dark, #283232); text-align: center; padding: 3px 6px; background: transparent !important; color: inherit !important; }
.stmt-aging td { text-align: center; padding: 3px 6px; }
.stmt-foot { margin-top: 18px; font-size: 12px; color: var(--slate, #4d5858); }
/* مستندات A4 بتصميم الكشف: تجميع طلبيات الزبون + الرصيد الشامل */
.stmt-ph { font-size: 12.5px; color: var(--slate, #4d5858); margin-top: 2px; }
.stmt-pg { margin-bottom: 22px; }
.stmt-sheet .stmt-pg + .stmt-pg { border-top: 3px dashed var(--line); padding-top: 18px; }
.stmt-tbl td.stmt-desc { min-width: 180px; text-align: start; }
.stmt-sub { font-size: .88em; color: var(--muted, #555); font-weight: 400; margin-top: 1px; }
.stmt-sec td { background: var(--soft, #efebe0); font-weight: 800; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.stmt-sum td { font-weight: 800; border-top: 1px solid #bfc4ca; }
.stmt-sum td:first-child { text-align: end; }
.stmt-sub-r td { color: var(--muted, #555); }
.stmt-new td:nth-child(-n+2), .stmt-new td:nth-child(4), .stmt-new td.num { white-space: nowrap; }
.stmt-strong td { font-weight: 800; color: inherit; }
.stmt-tbl tr.stmt-r-order td.stmt-desc, .stmt-tbl tr.stmt-r-invoice td.stmt-desc { white-space: normal; }
@media print {
  body[data-print="modal"] #modalRoot .overlay .modal { border: 0 !important; margin: 0 !important; width: auto; }
  .stmt-doc.stmt-pg { margin: 0; padding: 0; border: 0 !important; }
  .stmt-doc.stmt-pg:not(:last-child) { break-after: page; page-break-after: always; }
  .stmt-tbl tr { break-inside: avoid; page-break-inside: avoid; }
  .stmt-sec td { background: #eceef2 !important; color: #000 !important; }
  .stmt-sub-r td, .stmt-sub { color: #333 !important; }
  .stmt-sum td, .stmt-strong td { color: #000 !important; }
}
@media print {
  body[data-print="view"] .stmt-mode .cust-head, body[data-print="view"] .stmt-mode .tabs { display: none !important; }
  .stmt-tbl td, .stmt-tbl th, .stmt-bal, .stmt-chq, .stmt-aging td, .stmt-acct b { color: #000 !important; }
}

/* الهاتف: ترتيب كرت الطلبية — الزبون ثم الصنف ثم الملاحظات ثم الأبعاد والكمية والسعر ثم التسليم والمرحلة ثم المصمم والمبيعات، وزر الإجراء بعرض الكرت في آخره */
@media (max-width: 700px) {
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="#"] { order: 2; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="التاريخ"] { order: 3; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="الزبون"] { order: 4; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="الصنف / البيان"] { order: 5; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="ملاحظات"] { order: 6; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="الطول"] { order: 7; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="العرض"] { order: 8; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="العدد"] { order: 9; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="الكمية"] { order: 10; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="السعر"] { order: 11; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="المجموع"] { order: 12; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="التسليم"] { order: 13; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="المرحلة"] { order: 14; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="المصمم"] { order: 16; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="المبيعات"] { order: 17; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="الزبون"], table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="ملاحظات"], table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td[data-l="المرحلة"] { grid-column: 1 / -1; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td.act-cell { order: 20; grid-column: 1 / -1; width: auto !important; height: auto !important; white-space: normal; padding: 6px 0 2px !important; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td.act-cell > .btn, table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td.act-cell > button { width: 100%; min-height: 40px; font-size: 14px; white-space: normal; }
  table.orders:not(.grid-lines):not(.items-grid) tr[data-order] td.selcell { order: 1; }
}

/* ===== صندوق محادثات واتساب ===== */
.wi-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 0; height: calc(100vh - 150px); min-height: 480px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wi-side, .wi-list, .wi-item { min-width: 0; max-width: 100%; box-sizing: border-box; }
.wi-side { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surf); }
.wi-tools { padding: 10px; } .wi-tools input { margin: 0; }
.wi-filters { display: flex; gap: 4px; padding: 0 10px 8px; flex-wrap: wrap; }
.wi-filters button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; color: var(--muted); }
.wi-filters button.active { background: var(--gold-soft); color: var(--brand); border-color: var(--gold-line); font-weight: 700; }
.wi-filters small { opacity: .8; }
.wi-list { overflow-y: auto; flex: 1; }
.wi-item { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); align-items: flex-start; }
.wi-item:hover { background: var(--hover); } .wi-item.active { background: var(--gold-soft); }
.wi-item.unread b { color: var(--ink); } .wi-item.unread .wi-prev { color: var(--ink); font-weight: 600; }
.wi-av { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--slate); color: #fff; display: grid; place-items: center; font-weight: 700; }
.wi-av.big { width: 38px; height: 38px; }
.wi-mid { flex: 1; min-width: 0; } .wi-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.wi-row small { color: var(--muted); font-size: 11px; flex: none; }
.wi-prev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wi-bdg { background: #16a34a; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 18px; text-align: center; flex: none; }
.wi-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.wi-tag { font-size: 11px; background: var(--surf2); color: var(--muted); border-radius: 6px; padding: 1px 6px; }
.wi-tag.warn { background: var(--t-yel); color: var(--warn); } .wi-tag.mute { background: transparent; padding: 0; }
.wi-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.wi-empty { margin: auto; color: var(--muted); padding: 30px; text-align: center; }
.wi-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wi-hinfo { display: flex; flex-direction: column; flex: 1; min-width: 120px; } .wi-hinfo small { color: var(--muted); }
.wi-back { display: none; }
.wi-win.open { background: var(--t-grn); color: var(--ok); } .wi-win.closed { background: var(--t-red); color: var(--danger); }
.wi-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surf); }
.wi-chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.wi-chip button, .wi-x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; }
.wi-sugg { font-size: 13px; background: var(--t-yel); padding: 3px 10px; border-radius: 999px; }
.wi-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--col); }
.wi-b { max-width: min(78%, 520px); padding: 7px 10px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 1px rgba(0,0,0,.08); align-self: flex-start; word-break: break-word; }
.wi-b.in { align-self: flex-end; border-start-end-radius: 2px; }
.wi-b.out { align-self: flex-start; background: #d9fdd3; color: #14301a; border-start-start-radius: 2px; }
.wi-day { align-self: center; margin: 6px 0 2px; } .wi-day span { background: var(--card); color: var(--muted); font-size: 12px; padding: 3px 12px; border-radius: 10px; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.wi-b.note { align-self: center; max-width: 86%; background: var(--t-yel); color: #5b4a12; border: 1px dashed var(--gold-line); }
.wi-txt { white-space: pre-wrap; font-size: 14px; line-height: 1.5; }
.wi-meta { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: end; } .wi-b.out .wi-meta { color: #4b6b50; }
.wi-tick { letter-spacing: -2px; margin-inline-start: 4px; } .wi-tick.read { color: #2563eb; } .wi-tick.err { color: var(--danger); font-weight: 700; }
.wi-err { font-size: 12px; color: var(--danger); }
.wi-img { max-width: 240px; max-height: 240px; border-radius: 8px; display: block; margin-bottom: 4px; }
.wi-file { display: inline-block; padding: 6px 10px; background: var(--surf2); border-radius: 8px; margin-bottom: 4px; color: var(--ink); text-decoration: none; }
.wi-foot { border-top: 1px solid var(--line); padding: 8px 12px; background: var(--card); }
.wi-modes { display: flex; gap: 6px; margin-bottom: 6px; }
.wi-modes button { border: 0; background: var(--surf2); border-radius: 8px; padding: 4px 12px; cursor: pointer; font-size: 13px; color: var(--muted); }
.wi-modes button.active { background: var(--gold-soft); color: var(--brand); font-weight: 700; }
.wi-compose { display: flex; gap: 8px; align-items: flex-end; } .wi-compose textarea { resize: none; margin: 0; }
.wi-closed { background: var(--t-red); color: var(--danger); padding: 6px 10px; border-radius: 8px; font-size: 13px; margin-bottom: 6px; }
.wi-pfx { margin-bottom: 4px; }
.wi-chat.wi-drop { outline: 3px dashed var(--gold); outline-offset: -6px; }
.wi-compose { position: relative; }
.wi-emo { position: absolute; bottom: 100%; inset-inline-end: 0; width: min(340px, 94vw); max-height: 260px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px 8px; z-index: 20; }
.wi-emo-h { font-size: 12px; color: var(--muted); margin: 4px 2px; } .wi-emo-g { display: flex; flex-wrap: wrap; }
.wi-emo-g button { border: 0; background: none; font-size: 22px; padding: 3px; cursor: pointer; border-radius: 6px; } .wi-emo-g button:hover { background: var(--gold-soft); }
.wi-prevlist { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; margin-bottom: 10px; }
.wi-prevrow { display: flex; gap: 10px; align-items: center; } .wi-prevrow img { max-width: 140px; max-height: 110px; border-radius: 8px; border: 1px solid var(--line); }
.wi-ficon { font-size: 32px; }
.wi-thread { margin-bottom: 12px; } .wi-thead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; } .wi-thead .btn { margin-inline-start: auto; }
.wi-mini { max-height: 320px; border-radius: 8px; }
.wi-qr { width: min(380px, 94vw); } .wi-qrrow { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; } .wi-qrrow:hover { background: var(--gold-soft); } .wi-qrrow small { color: var(--muted); }
.wi-qadd { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; display: flex; flex-direction: column; gap: 4px; } .wi-qadd input, .wi-qadd textarea { margin: 0; }
.wi-aud { width: 240px; max-width: 100%; height: 40px; display: block; margin-bottom: 2px; }
.wi-rec { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; background: var(--card); padding: 0 6px; z-index: 5; }
.wi-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; animation: wiblink 1s infinite; } @keyframes wiblink { 50% { opacity: .25; } }
.wi-modes button:disabled { opacity: .45; cursor: not-allowed; } .wi-modes button.attn { background: var(--t-yel); color: var(--warn); font-weight: 700; }
.wi-pick { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; margin-top: 8px; }
.wi-pickrow { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer; text-align: start; color: var(--ink); }
.wi-pickrow:hover, .wi-pickrow.sel { background: var(--gold-soft); } .wi-pickrow small { color: var(--muted); }
.wi-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#nav .wi-bdg { margin-inline-start: 4px; }
html[data-theme=dark] .wi-b.out { background: #1f4d2c; color: #e6f7e9; } html[data-theme=dark] .wi-b.note { color: #f3e4a8; }
@media (max-width: 760px) {
  .wi-wrap { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 170px); }
  .wi-wrap .wi-chat { display: none; } .wi-wrap.has-chat .wi-side { display: none; } .wi-wrap.has-chat .wi-chat { display: flex; }
  .wi-back { display: inline-block; } .wi-two { grid-template-columns: 1fr; } .wi-b { max-width: 90%; }
}

/* ضغط العمل في صفحة الطلبيات */
.wl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; margin-top: 8px; }
.wl-h { font-size: 12px; opacity: .7; margin-bottom: 4px; } .wl-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 24px; gap: 6px; align-items: center; font-size: 13px; padding: 2px 0; }
.wl-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .wl-bar { background: rgba(128, 128, 128, .18); border-radius: 6px; height: 8px; overflow: hidden; } .wl-bar i { display: block; height: 100%; background: #3a8f6e; border-radius: 6px; } .wl-bar i.hot { background: #d9822b; }

/* تابات الطلبيات الجديدة تحت شريط التحكم */
.draft-dock { position: sticky; z-index: 30; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; padding: 5px 12px 0; background: var(--surf2, #eef1f5); border-bottom: 1px solid var(--line); }
.overlay { top: var(--dockbot, 0px); }
.draft-tab { display: inline-flex; align-items: stretch; max-width: 260px; border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; background: var(--surf); overflow: hidden; }
.draft-tab.on { background: var(--card); box-shadow: inset 0 3px 0 var(--gold); font-weight: 700; }
.draft-tab button, .draft-add { border: 0; background: none; padding: 7px 12px; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-tab button:hover, .draft-add:hover { background: var(--hover); } .draft-tab .x { opacity: .55; padding: 7px 9px; } .draft-add { font-size: 18px; padding: 3px 12px; }

/* تمييز الطول والعرض والعدد والكمية بالألوان حتى لا تختلط على الموظفين */
:root { --szl: #2f7fd0; --szw: #2e9d6a; --szn: #d9822b; --szq: #8a5cc7; }
th.sz-l, th.sz-w, th.sz-n, th.sz-q { border-top: 3px solid; } th small { font-weight: 400; opacity: .7; font-size: 10px; }
.sz-l { --szc: var(--szl); } .sz-w { --szc: var(--szw); } .sz-n { --szc: var(--szn); } .sz-q { --szc: var(--szq); }
th.sz-l, th.sz-w, th.sz-n, th.sz-q { border-top-color: var(--szc); color: var(--szc); }
td.sz-l, td.sz-w, td.sz-n, td.sz-q { background: color-mix(in srgb, var(--szc) 9%, transparent); }
td.sz-l input, td.sz-w input, td.sz-n input, td.sz-q input { border-color: color-mix(in srgb, var(--szc) 55%, var(--line)); }
td.sz-q input { font-weight: 700; }
tr.no-area td.sz-l input, tr.no-area td.sz-w input, tr.no-area td.sz-n input { opacity: .45; cursor: not-allowed; background: var(--soft); }
td.sz-q input.calc { background: var(--soft); cursor: default; border-style: dashed; }
.cof label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted, #666); }
.cof input, .cof select { min-width: 130px; }

/* علامات المشغل على القائمة والخانات */
.nav-bdg { display: inline-block; margin-inline-start: 6px; background: var(--danger, #dc2626); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; text-align: center; padding: 0 5px; vertical-align: middle; box-shadow: 0 0 0 2px #fff; animation: navPulse 1.6s ease-in-out infinite; }
.nav-bdg.dot { min-width: 10px; width: 10px; height: 10px; padding: 0; }
@keyframes navPulse { 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .nav-bdg { animation: none; } }

/* حاسبة الديجيتال */
.dg-stats .dg-hero .n { color: var(--gold-dark, #8a6d1d); }
.dg-preview { max-width: 340px; margin: 12px auto 0; }
.dg-sheet { width: 100%; height: auto; display: block; }
.dg-sheet .paper { fill: #fff; stroke: #b9a25a; stroke-width: .25; }
.dg-sheet .safe { fill: none; stroke: #c9c3b3; stroke-width: .12; stroke-dasharray: .6 .4; }
.dg-sheet rect:not(.paper):not(.safe) { fill: rgba(176, 141, 46, .28); stroke: #8a6d1d; stroke-width: .12; }
.dg-sheet rect.rot:not(.paper) { fill: rgba(46, 125, 176, .25); stroke: #2e6d99; }
.dg-key { display: inline-block; width: 10px; height: 10px; vertical-align: middle; background: rgba(46, 125, 176, .35); border: 1px solid #2e6d99; }
.dg-adv summary { cursor: pointer; padding: 4px 0; }
.dg-paper textarea { min-width: 140px; font-family: inherit; direction: ltr; text-align: left; }
@media (prefers-color-scheme: dark) { .dg-sheet .paper { fill: #f7f4ec; } }
.dg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
.dg-panel { border: 1px dashed var(--gold, #b08d2e); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--gold-soft, #fbf6e8); }
.modal.xl .dg-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.dg-panel .dg-preview { max-width: 220px; }
.dg-xrow { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.dg-xrow input { width: 70px; }
.dg-sheet .rot2 { stroke-dasharray: 2 1; }

/* خانات الأرقام عريضة بحيث ما يظهر غير سهمي الزيادة/النقصان */
.line-table input[type=number], .items-grid input[type=number], input.cell.num { min-width: 104px; text-overflow: clip; }
.line-table td.pc, .line-table td.sz-q { min-width: 112px; }
.tot-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: 16px; z-index: 2; font-weight: 600; }
.tot-box b { font-size: 19px; } .tot-box .net b { color: var(--ok, #15803d); font-size: 22px; }
.tot-box .dsc { display: flex; gap: 6px; align-items: center; } .tot-box .dsc input { width: 110px; } .tot-box .dsc select { width: auto; }
/* الطلبيات السريعة: تظهر مع كل الطلبيات، مميّزة بلون */
tr.row-quick > td { background: #fff7d6 !important; }
tr.row-quick > td:first-child { box-shadow: inset -4px 0 0 #f59e0b; }
.tag.q-tag { background: #f59e0b; color: #fff; font-weight: 700; }
.tile.tile-quick, .card.card-quick { background: #fff7d6; border-color: #f59e0b; box-shadow: inset -4px 0 0 #f59e0b; }
html[data-theme=dark] tr.row-quick > td, html[data-theme=dark] .tile.tile-quick, html[data-theme=dark] .card.card-quick { background: #3a2f0f !important; }

/* ===== بصمة QR: صفحة الموظف وشاشة المشغل ===== */
.qr-pub { max-width: 440px; }
.qr-card { text-align: center; margin-top: 8vh; }
.qr-card h1 { font-size: 22px; margin: 0 0 6px; }
.qr-icon { width: 80px; height: 80px; border-radius: 50%; margin: 4px auto 14px; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; }
.qr-icon.ok { background: var(--bg-ready); color: var(--st-ready); }
.qr-icon.bad { background: var(--bg-cancelled); color: var(--st-cancelled); }
.qr-time { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 8px; }
.qr-err { background: var(--bg-cancelled); color: var(--st-cancelled); padding: 10px 12px; border-radius: 8px; margin: 10px 0; text-align: right; }
.qr-form { display: grid; gap: 12px; margin-top: 14px; }
.qr-form input { font-size: 20px; text-align: center; padding: 12px; }
body.qr-screen { margin: 0; min-height: 100vh; background: #14211e; color: #eef4f1; display: flex; align-items: center; justify-content: center; }
.qrs-wrap { display: grid; grid-template-columns: auto minmax(260px, 360px); gap: 48px; align-items: center; padding: 24px; width: 100%; max-width: 1150px; box-sizing: border-box; }
.qrs-code { background: #fff; border-radius: 24px; padding: 22px; width: min(66vh, 560px); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.qrs-code > div:not(.hidden) { width: 100%; }
.qrs-code svg { display: block; width: 100%; height: auto; }
.qrs-closed { color: #14211e; text-align: center; font-size: 30px; font-weight: 700; line-height: 1.7; }
.qrs-closed small { display: block; font-size: 18px; font-weight: 400; }
.qrs-clock { font-size: 72px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.qrs-win { color: #8fd3c4; font-size: 22px; margin: 10px 0 22px; min-height: 1.4em; }
.qrs-bar { height: 6px; background: #26372f; border-radius: 9px; overflow: hidden; margin-bottom: 26px; }
.qrs-bar i { display: block; height: 100%; width: 0; background: #8fd3c4; transition: width .5s linear; }
.qrs-side h3 { margin: 0 0 8px; font-weight: 500; color: #a9bab4; }
.qrs-recent { list-style: none; margin: 0; padding: 0; }
.qrs-recent li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #26372f; font-size: 19px; }
.qrs-recent li span:last-child { font-variant-numeric: tabular-nums; }
.qrs-recent li.empty { color: #a9bab4; }
.qrs-recent li.new { animation: qrsPop 1.4s ease; }
@keyframes qrsPop { from { background: #1f4d44; } to { background: transparent; } }
.qrs-help { color: #a9bab4; margin-top: 22px; }
@media (max-width: 820px) { .qrs-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; } .qrs-code { width: min(86vw, 480px); } .qrs-side { width: 100%; max-width: 480px; } }
@media (prefers-reduced-motion: reduce) { .qrs-recent li.new { animation: none; } .qrs-bar i { transition: none; } }

/* ===== تجربة تطبيق موبايل: بدون زوم، وبدون قفزة الزوم عند التركيز على حقل ===== */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  button, .btn, nav a, .tabs a, label { -webkit-user-select: none; user-select: none; }
  input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
}

/* ===== واجهة التابلت (لمس + عرض 700–1366): شريط جانبي ثابت وأهداف لمس كبيرة ===== */
@media (pointer: coarse) and (min-width: 701px) and (max-width: 1366px) {
  :root { --rail: 112px; }
  .topbar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--rail); flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); border-bottom: 0; border-inline-end: 3px solid var(--gold); overflow-y: auto; -webkit-overflow-scrolling: touch; z-index: 6; }
  .topbar .brand { order: 1; flex-direction: column; font-size: 13px; text-align: center; gap: 4px; }
  .topbar .brand-mark { width: 44px; height: 44px; }
  .topbar nav { order: 2; flex: 1 0 auto; flex-direction: column; flex-wrap: nowrap; overflow: visible; gap: 6px; }
  .topbar nav button, .topbar nav a { flex: none; width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; white-space: normal; line-height: 1.25; font-size: 14px; padding: 8px 6px; border-radius: 10px; }
  .topbar .who { order: 3; margin: 0; flex-direction: column; align-items: stretch; gap: 6px; font-size: 12px; text-align: center; }
  .topbar .who .btn { width: 100%; min-height: 40px; }
  #app main { margin-inline-start: var(--rail); max-width: none; padding: 16px 18px; }
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn.small { min-height: 40px; padding: 8px 12px; }
  input, select, textarea { min-height: 44px; padding: 10px 12px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
  table.orders th, table.orders td { padding: 12px 8px; }
  .tabs a { padding: 12px 16px; }
  .modal { max-width: min(92vw, 860px); }
  .grid.cols4 { grid-template-columns: repeat(2, 1fr); }
}
.qrs-back { position: fixed; top: calc(10px + env(safe-area-inset-top)); inset-inline-start: 12px; z-index: 20; background: rgba(0,0,0,.55); color: #fff; padding: 10px 16px; border-radius: 22px; font-size: 15px; text-decoration: none; backdrop-filter: blur(4px); }
@media print { .qrs-back { display: none; } }

@media print { #isBox.sec-only .isec:not(.sec-on), #isBox.sec-only .grid { display: none !important; } }

#lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
#lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
#lightbox .lb-x { position: absolute; top: 14px; left: 14px; font-size: 22px; background: #fff2; color: #fff; border: 0; border-radius: 50%; width: 42px; height: 42px; cursor: pointer; }
#lightbox .lb-open { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; opacity: .8; }
.wi-delm { float: left; margin-right: 6px; font-size: 12px; opacity: .85; }
.wi-b:hover .wi-delm { opacity: 1; }

/* تابات الصفحات */
.ptabs { display: flex; gap: 4px; overflow-x: auto; padding: 6px 12px 0; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.ptabs.hidden { display: none; }
.ptabs .pt { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px 8px 0 0; background: rgba(128,128,128,.12); color: inherit; text-decoration: none; white-space: nowrap; font-size: 13px; max-width: 220px; }
.ptabs .pt span { overflow: hidden; text-overflow: ellipsis; }
.ptabs .pt.on { background: var(--gold); color: #fff; font-weight: 700; }
.ptabs .pt button { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0 2px; }
.ptabs .pt button:hover { opacity: 1; }

/* التفاصيل بتابات مش popup */
#modalRoot .overlay { position: static; inset: auto; background: none; display: block; padding: 0 16px; overflow: visible; top: auto; }
#modalRoot .overlay:has(.modal.xl) { padding: 0; }
#modalRoot .overlay .modal { margin: 14px auto; box-shadow: none; border: 1px solid var(--line); }
#app.mtab #view { display: none; }
.ptabs .pt.draft { padding: 0; gap: 0; overflow: hidden; }
.ptabs .pt.draft .pt-l { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 6px 4px 6px 10px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptabs .pt.draft button:last-child { padding: 6px 8px; }
.ptabs .pt.mdl:not(.on) { background: rgba(174,132,31,.18); }
.ptabs .draft-add { background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; padding: 0 10px; }

/* قائمة الأصناف الكاملة */
.item-browse { position: relative; z-index: 2; flex: none; box-sizing: border-box; width: 26px; height: 24px; padding: 0; margin-inline-start: -30px; vertical-align: middle; line-height: 1; }   /* فوق طرف الحقل: ما بتوسّع الصف ولا بتاخد مكان من باقي الأعمدة */
td:has(> .item-browse) { white-space: nowrap; }
.item-browser { position: fixed; z-index: 60; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: 8px; }
.item-browser .ib-q { width: 100%; box-sizing: border-box; margin-bottom: 4px; }
.item-browser .ib-list { max-height: 320px; overflow-y: auto; }
.item-browser .ib-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.item-browser .ib-row:hover { background: var(--hover); }
.item-browser .ib-row span { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* كشف الحساب: السند مظلّل بلون يميّزه عن الفواتير والباقي */
.stmt-tbl tr.stmt-r-receipt td { background: #dcfce7; color: #14532d; }
html[data-theme=dark] .stmt-tbl tr.stmt-r-receipt td { background: rgba(34,197,94,.22); color: #bbf7d0; }
.stmt-tbl tr.stmt-r-receipt, .stmt-tbl tr.stmt-r-receipt td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* تغيير عرض الأعمدة بالسحب */
th { position: sticky; }
.col-rs { position: absolute; top: 0; bottom: 0; inset-inline-end: -4px; width: 9px; cursor: col-resize; z-index: 3; touch-action: none; user-select: none; }
.col-rs:hover, body.col-resizing .col-rs:active { background: color-mix(in srgb, var(--brand) 45%, transparent); }
body.col-resizing { cursor: col-resize; user-select: none; }
@media print { .col-rs { display: none; } }

/* رقم الطلبية: الوحيد اللي يفتحها */
.ord-open { cursor: pointer; color: var(--brand); text-decoration: underline dotted; }
.ord-open:hover { text-decoration: underline; }
table.clickable tbody tr[data-order], .tile[data-order], .card[data-order], .q-it[data-order] { cursor: default; }

/* ===== واجهة الطلبية: مرتبة بتابات وأقسام، وزر الحفظ الأخضر ثابت فوق ===== */
.modal-head.ord-sticky { position: sticky; top: 0; z-index: 6; background: var(--card); padding: 8px 0; margin-top: -4px; border-bottom: 1px solid var(--line); align-items: center; }
.ord-hbtn { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn.save-green { background: #16a34a; border-color: #15803d; color: #fff; font-weight: 700; font-size: 15px; padding: 9px 18px; box-shadow: 0 2px 6px rgba(22,163,74,.35); }
.btn.save-green:hover { background: #15803d; }
.otabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 12px; border-bottom: 2px solid var(--line); }
.otabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; color: var(--muted); font-weight: 600; font: inherit; }
.otabs button:hover { background: var(--gold-soft); color: var(--ink); }
.otabs button.on { background: var(--gold-soft); color: var(--brand); font-weight: 700; box-shadow: inset 0 -3px 0 var(--gold); }
.otab { display: none; } .otab.on { display: block; }
.of-form .ofs { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 8px 12px 4px; min-width: 0; }
.of-form .ofs legend { font-weight: 700; color: var(--brand); font-size: 13px; padding: 0 6px; }
.of-form .ofg { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; align-items: end; }
.of-form .ofg .full { grid-column: 1 / -1; }
.of-form .ofg.ofg-num { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.of-form .ofchips { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 10px; }
.of-form .ofchips .chip-toggle { margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--soft, transparent); }
.of-form .ofg .chip-toggle { margin-bottom: 10px; }
.modal .of-form .cols { display: block; }
@media print { .otab { display: block !important; } .otabs { display: none; } }

/* الطلبية: بعرض الصفحة كامل وتفاصيل بثلاثة أعمدة بدون تمرير */
.modal.ordfull { max-width: min(1500px, 98vw) !important; width: 98vw; padding: 12px 18px; }
.modal.ordfull .actions { margin: 6px 0; gap: 6px; }
.modal.ordfull .actions .btn { padding: 5px 10px; font-size: 13px; }
.modal.ordfull .btn.save-green { padding: 8px 20px; font-size: 15px; }
.modal.ordfull .otabs { margin: 6px 0 8px; }
.modal.ordfull .otabs button { padding: 6px 14px; }
.modal.ordfull .modal-head { margin-bottom: 4px; }
.modal.ordfull .modal-head h2 { font-size: 17px; }
.of-cols { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 10px 12px; align-items: start; }
.of-cols .ofcol { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.of-cols .ofs { margin-bottom: 8px; padding: 4px 10px 2px; }
.of-cols .ofg { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.of-cols .ofg.ofg-num { grid-template-columns: repeat(2, 1fr); }
.of-cols label { margin-bottom: 6px; font-size: 12.5px; }
.of-cols input, .of-cols select { padding: 6px 8px; }
.of-cols textarea { min-height: 54px; }
.of-cols .ofchips { margin: 2px 0 6px; gap: 4px 8px; }
.of-cols .ofchips .chip-toggle { padding: 4px 8px; font-size: 13px; }
@media (max-width: 1000px) { .of-cols { grid-template-columns: 1fr; } .modal.ordfull { width: 100%; } }

/* ترتيب أفقي: بيانات الطلبية بسطر، الكمية والسعر بسطر واحد أفقي، والتنفيذ والخيارات جنب بعض */
.of-cols { grid-template-columns: 1fr; }
.of-cols > .ofs:first-child .ofg { grid-template-columns: repeat(3, 1fr); }
.of-cols .ofg.ofg-num { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; }
.of-cols .ofg.ofg-num label { margin-bottom: 4px; }
.of-cols .ofg.ofg-num label .hint { display: none; }
.of-cols .ofcol { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; align-items: stretch; }
.of-cols .ofcol .ofs { margin-bottom: 0; }
@media (max-width: 1000px) {
  .of-cols > .ofs:first-child .ofg { grid-template-columns: 1fr 1fr; }
  .of-cols .ofg.ofg-num { grid-template-columns: repeat(2, 1fr); }
  .of-cols .ofcol { grid-template-columns: 1fr; }
}
/* ضغط الارتفاع ليتسع بدون تمرير */
.modal.ordfull .of-form > .otab[data-t=d] > .actions { display: none; }   /* زر الحفظ الأخضر فوق أصلاً */
.of-cols { gap: 6px 12px; }
.of-cols .ofs { margin-bottom: 6px; padding: 2px 10px 0; }
.of-cols .ofs legend { font-size: 12px; }
.of-cols label { margin-bottom: 4px; font-size: 12px; }
.of-cols textarea { min-height: 36px; height: 38px; }
.of-cols input, .of-cols select { padding: 5px 8px; }
.modal.ordfull .actions { margin: 4px 0; }
.modal.ordfull .otabs { margin: 4px 0 6px; }

/* تعديل الخانة بالجدول ما يغيّر ارتفاع الصف: الحقل يغطي الخانة بدون ما يزيد حجمها */
table.orders td:has(> .pe-input) { position: relative; }
table.orders td > .pe-input { position: absolute !important; inset: 1px 2px; width: calc(100% - 4px) !important; height: calc(100% - 2px) !important; min-width: 0; margin: 0 !important; padding: 0 6px !important; box-sizing: border-box; font-size: inherit !important; line-height: 1; border-radius: 4px; }

/* أعمدة بعرض مثبّت (بعد السحب): المحتوى ما يطلع فوق العمود اللي جنبه */
table.cr-fixed th, table.cr-fixed td { overflow: hidden; text-overflow: ellipsis; }
table.cr-fixed th { white-space: nowrap; }

/* قائمة الزبائن: الشاشة تعرض كل الأعمدة (ما عدا «آخر سند قبض»)، والطباعة بس: الرقم، الزبون، الهاتف، الرصيد، آخر سند قبض */
.cust-grid .po { display: none; }
@media print {
  .cust-grid .po { display: table-cell; }
  .cust-grid th:not(.pk), .cust-grid td:not(.pk) { display: none !important; }
  .cust-grid { width: 100% !important; table-layout: auto !important; }
  .cust-grid th { width: auto !important; min-width: 0 !important; }
  .cust-grid input.cell, .cust-grid select.cell { border: 0; background: none; padding: 0; width: 100%; min-width: 0 !important; font: inherit; color: inherit; appearance: none; }
}

/* شروط عرض السعر: نص عادي تحت الجدول بدون إطار */
.doc-terms { margin-top: 12px; line-height: 1.8; }

/* جدول البنود المشترك: إخفاء أعمدة الموظفين (عرض السعر) وأعمدة الملاحظات (المشتريات) */
.no-sm .sm, .no-dz .dz, .no-note .nt { display: none !important; }

/* إطار الجدول: السكرول الأفقي داخله، والصفحة ما تتمدد خارج الشاشة */
.table-wrap { max-width: 100%; }
html[data-theme=dark] .dz-cust { background: #3a3220; border-color: #5a4a26; }
html[data-theme=dark] .dz-cust.ok { background: #1f3a2a; border-color: #2f5a3f; }
.dz-working { margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); border: 1px solid var(--gold-line); font-weight: 600; animation: dzPulse 1.6s ease-in-out infinite; }
.dz-live { animation: dzPulse 1.6s ease-in-out infinite; }
@keyframes dzPulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .dz-working, .dz-live { animation: none; } }

/* ====== الموظفون والإعدادات (تصميم جديد) ====== */
.st-page { max-width: 1240px; margin: 0 auto; }
.st-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 24px; margin-bottom: 18px; border-radius: 16px; color: #fff;
  background: linear-gradient(120deg, var(--slate-dark) 0%, #3b4747 60%, #5a4a1e 130%); box-shadow: 0 8px 24px rgba(40,50,50,.18); position: relative; overflow: hidden; }
.st-hero::after { content: ''; position: absolute; inset-inline-end: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(174,132,31,.45), transparent 70%); pointer-events: none; }
.st-hero h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.st-hero p { margin: 4px 0 0; color: #d9dfde; font-size: 13px; }
.st-hero-stats { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.st-hero-stats div { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 8px 14px; min-width: 74px; text-align: center; backdrop-filter: blur(4px); }
.st-hero-stats b { display: block; font-size: 20px; line-height: 1.2; } .st-hero-stats b.ok { color: #6ee7a0; } .st-hero-stats b.bad { color: #fca5a5; }
.st-hero-stats span { font-size: 11px; color: #cfd6d5; }
.st-layout { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.st-nav { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.st-nav button { display: flex; font: inherit; align-items: center; gap: 10px; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 14px; text-align: start; transition: background .15s, color .15s; }
.st-nav button span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surf2); font-size: 15px; flex: none; }
.st-nav button:hover { background: var(--hover); color: var(--ink); }
.st-nav button.on { background: var(--gold-soft); color: var(--brand); font-weight: 700; }
.st-nav button.on span { background: var(--brand); color: var(--brand-ink); }
.st-main { min-width: 0; padding-bottom: 70px; }
.st-sec { display: none; animation: stIn .18s ease; } .st-sec.on { display: block; }
@keyframes stIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.st-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
.st-card h3 { margin: 0 0 14px; font-size: 15px; color: var(--slate); display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.st-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; } .st-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.st-grid .full { grid-column: 1 / -1; } .st-gap { margin-top: 14px; }
.st-row-end { display: flex; justify-content: flex-end; gap: 8px; }
.st-sw { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; margin: 0; border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); }
.st-grid + .st-sw, h3 + .st-sw { border-top: 0; }
.st-sw-t { display: flex; flex-direction: column; gap: 2px; } .st-sw-t b { font-size: 14px; font-weight: 600; } .st-sw-t small { font-size: 12px; color: var(--muted); }
.st-sw.mini { padding: 6px 0; border-top: 0; } .st-sw.mini b { font-size: 13px; font-weight: 500; color: var(--muted); }
.st-sw.inl { gap: 8px; }
input.sw { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); border: 0; padding: 0; margin: 0; position: relative; cursor: pointer; flex: none; transition: background .2s; }
input.sw::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
input.sw:checked { background: var(--brand); } input.sw:checked::after { inset-inline-start: 21px; }
input.sw:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.st-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.st-bar input[type=search] { flex: 1 1 220px; max-width: 360px; border-radius: 10px; padding: 9px 12px; }
.st-bar select { width: auto; border-radius: 10px; }
.emp-sp { flex: 1; }
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 12px; }
.emp-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, border-color .15s, transform .15s; }
.emp-card:hover { border-color: var(--gold-line); box-shadow: 0 6px 18px rgba(40,50,50,.08); transform: translateY(-1px); }
.emp-card.off { opacity: .62; }
.emp-top { display: flex; align-items: center; gap: 12px; }
.emp-av { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; flex: none;
  background: linear-gradient(135deg, hsl(var(--h) 45% 46%), hsl(calc(var(--h) + 30) 50% 36%)); box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.emp-id { min-width: 0; flex: 1; } .emp-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-job { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; } .emp-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--t-grn); }
.emp-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.emp-role { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 60% 93%); }
html[data-theme=dark] .emp-role { color: hsl(var(--h) 70% 78%); background: hsl(var(--h) 30% 22%); }
.emp-load { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--surf2); color: var(--muted); } .emp-load.hi { background: var(--t-org); color: var(--warn); }
.emp-field { margin: 0; font-size: 12px; } .emp-field input { padding: 6px 9px; font-size: 13px; }
.emp-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.emp-actions .btn { font-size: 12px; padding: 4px 9px; }
.emp-chips { display: flex; flex-wrap: wrap; gap: 6px; } .emp-chip { background: var(--surf2); border-radius: 99px; padding: 4px 12px; font-size: 13px; color: var(--muted); } .emp-chip b { color: var(--ink); }
.ws-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.ws-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surf); } .ws-item.off { opacity: .6; }
.ws-m { font-size: 13px; color: var(--muted); } .ws-f { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.st-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.st-status > span { font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--surf2); }
.st-link { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s; } .st-link:hover { border-color: var(--gold); }
.st-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; } .st-inline input { flex: 1 1 160px; }
.st-lic { padding: 0; } .st-lic .panel { box-shadow: none; margin: 0; padding: 18px 20px; background: transparent; } .st-lic .panel h2 { border: 0; padding: 0; font-size: 15px; }
.st-card.danger-zone { border-color: #f3c4c4; } html[data-theme=dark] .st-card.danger-zone { border-color: #6b3030; }
.st-card #rolesBox .panel { box-shadow: none; padding: 0; }
.st-save { position: fixed; bottom: 16px; inset-inline-start: 50%; transform: translateX(50%) translateY(120px); z-index: 20; display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 16px; padding-inline-start: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.18); transition: transform .25s; font-size: 13px; color: var(--muted); }
.st-save.on { transform: translateX(50%) translateY(0); }
.st-save.dirty { border-color: var(--gold); } .st-save.dirty #stDirty { color: var(--warn); font-weight: 600; }
@media (max-width: 900px) {
  .st-layout { grid-template-columns: 1fr; }
  .st-nav { position: sticky; top: 56px; z-index: 4; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 6px; border-radius: 12px; }
  .st-nav button { flex: none; white-space: nowrap; padding: 8px 10px; } .st-nav button span { width: 24px; height: 24px; font-size: 13px; }
}
@media (max-width: 640px) {
  .st-hero { padding: 16px; } .st-hero h1 { font-size: 18px; } .st-hero-stats div { min-width: 60px; padding: 6px 10px; }
  .st-grid, .st-grid.c3 { grid-template-columns: 1fr; } .st-card { padding: 14px; }
  .st-save { inset-inline-start: 16px; inset-inline-end: 16px; transform: translateY(120px); justify-content: space-between; } .st-save.on { transform: none; }
}

/* ====== المساعدين الأذكياء (تصميم جديد) ====== */
.ai-hero { background: linear-gradient(120deg, #1f2a3a 0%, #2d3a4a 55%, #4a3a6a 130%); }
.ai-hero::after { background: radial-gradient(circle, rgba(124,92,196,.5), transparent 70%); }
.ai-hero-r { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.ai-hero-r .btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); } .ai-hero-r .btn.primary { background: var(--gold); border-color: var(--gold); }
.ai-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 6px 14px; border-radius: 99px; background: rgba(255,255,255,.1); color: #fca5a5; }
.ai-state i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; } .ai-state.on { color: #6ee7a0; } .ai-state.on i { animation: aiPulse 1.6s infinite; }
@keyframes aiPulse { 0% { box-shadow: 0 0 0 0 rgba(110,231,160,.6); } 70% { box-shadow: 0 0 0 8px rgba(110,231,160,0); } 100% { box-shadow: 0 0 0 0 rgba(110,231,160,0); } }
.ai-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.ai-agent, .ai-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.ai-agent { display: flex; align-items: center; gap: 12px; } .ai-agent.flat { border: 0; padding: 0 0 12px; background: transparent; }
.ai-kpi { display: flex; flex-direction: column; gap: 2px; } .ai-kpi span { font-size: 12px; color: var(--muted); } .ai-kpi b { font-size: 20px; } .ai-kpi b.ok { color: var(--ok); } .ai-kpi b.bad { color: var(--danger); }
.ai-kpi small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surf2); color: var(--muted); white-space: nowrap; }
.ai-badge.ok { background: var(--t-grn); color: var(--ok); } .ai-badge.bad { background: var(--t-red); color: var(--danger); } .ai-badge.info { background: var(--bg-design); color: var(--st-design); }
.emp-av.sm { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }
.ai-alert { background: var(--t-org); color: var(--warn); border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 14px; }
.ai-convs { display: flex; flex-direction: column; }
.ai-conv { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-top: 1px solid var(--line); } .ai-conv:first-child { border-top: 0; }
.ai-conv.wait { background: linear-gradient(90deg, transparent, var(--t-org)); border-radius: 10px; padding-inline: 10px; }
.ai-conv-m { flex: 1; min-width: 0; } .ai-conv-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-conv-t { font-size: 14px; color: var(--ink); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-conv-a { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.ai-empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 14px; }
.ai-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } .ai-two > .st-card { margin-bottom: 14px; }
.ai-seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.ai-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font: inherit; font-size: 13px; } .ai-seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.ai-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.ai-mini div { background: var(--surf); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; } .ai-mini span { display: block; font-size: 11px; color: var(--muted); } .ai-mini b { font-size: 18px; } .ai-mini b.bad { color: var(--danger); }
.ai-tools div { display: grid; grid-template-columns: 1fr 90px 50px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.ai-tools i { height: 6px; border-radius: 99px; background: var(--surf2); position: relative; overflow: hidden; } .ai-tools i::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--w); background: var(--ok); border-radius: 99px; }
.ai-tools b { text-align: end; font-weight: 600; color: var(--muted); }
.ai-legend { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 400; color: var(--muted); } .ai-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-start: 8px; }
.ai-chart { display: flex; gap: 6px; align-items: flex-end; height: 170px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.ai-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; } .ai-col small { font-size: 10px; color: var(--muted); }
.ai-bars { display: flex; gap: 2px; align-items: flex-end; height: 140px; width: 100%; justify-content: center; } .ai-bars div { width: 28%; max-width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; }
.ai-logc { padding: 6px; } .ai-logc .table-wrap { box-shadow: none; }
.ai-chat-log { height: 380px; overflow: auto; margin: 12px 0; padding: 12px; border-radius: 12px; background: var(--surf); border: 1px solid var(--line); display: flex; flex-direction: column; }
.ai-chat-log .dz-cust { align-self: flex-start; } .ai-chat-log .dz-des { align-self: flex-end; background: var(--gold-soft); border-color: var(--gold-line); }
.ai-chat-in, .ai-memadd { display: flex; gap: 8px; flex-wrap: wrap; } .ai-chat-in input { flex: 1; } .ai-memadd { margin: 12px 0; } .ai-memadd input { flex: 1 1 200px; }
.ai-mem { display: flex; flex-direction: column; gap: 8px; }
.ai-mem-i { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf); }
.ai-q { font-weight: 700; font-size: 14px; } .ai-q::before { content: 'س: '; color: var(--brand); } .ai-a { font-size: 14px; margin-top: 3px; } .ai-a::before { content: 'ج: '; color: var(--ok); font-weight: 700; }
.ai-mem-i small { font-size: 11px; color: var(--muted); }
.ai-svcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }
.ai-svc { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf); }
.ai-svc i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; flex: none; }
.ai-svc.ok i { background: var(--t-grn); color: var(--ok); } .ai-svc.bad i { background: var(--t-red); color: var(--danger); } .ai-svc.bad { border-color: #f3c4c4; }
.ai-svc b { display: block; font-size: 14px; } .ai-svc small { font-size: 12px; color: var(--muted); }
.ai-meter { height: 10px; border-radius: 99px; background: var(--surf2); overflow: hidden; margin: 6px 0; } .ai-meter i { display: block; height: 100%; width: var(--w); background: var(--ok); border-radius: 99px; } .ai-meter i.bad { background: var(--warn); }
@media (max-width: 1100px) { .ai-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .ai-two { grid-template-columns: 1fr; } .ai-conv { flex-wrap: wrap; } .ai-conv-a { flex-direction: row; width: 100%; justify-content: space-between; align-items: center; } }
@media (max-width: 560px) { .ai-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .ai-kpis .ai-agent { grid-column: 1 / -1; padding: 10px 12px; } .ai-kpis .ai-kpi:last-child { grid-column: auto; } .ai-kpi { padding: 10px; } .ai-kpi b { font-size: 15px; } .ai-kpi span { font-size: 11px; } }


/* ===== الموقع الإلكتروني (طلبات + إدارة المحتوى) ===== */
.wx-open { margin-inline-start: auto; font-weight: 600; }
.wx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.wx-kpi { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.wx-kpi .ic { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--gold-soft); flex: none; }
.wx-kpi .n { font-size: 22px; font-weight: 800; line-height: 1.1; } .wx-kpi .l { font-size: 12px; color: var(--muted); }
.wx-kpi.hot { border-color: #f3c4c4; background: linear-gradient(180deg, var(--t-red), var(--card)); } .wx-kpi.hot .ic { background: var(--t-red); } .wx-kpi.hot .n { color: var(--danger); }
.wx-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.wx-bar input[type=search] { flex: 1; min-width: 200px; max-width: 360px; border-radius: 99px; padding: 9px 16px; }
.wx-chk { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.wx-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; background: var(--card); }
.wx-seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-size: 13px; color: var(--muted); }
.wx-seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.wx-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.wx-col { background: var(--surf2); border-radius: 12px; padding: 8px; border: 2px solid transparent; min-height: 120px; transition: border-color .15s, background .15s; }
.wx-col.over { border-color: var(--gold); background: var(--gold-soft); }
.wx-col header { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; font-weight: 700; font-size: 14px; border-bottom: 3px solid var(--gold-line); margin-bottom: 8px; }
.wx-col header b { background: var(--card); border-radius: 99px; padding: 0 10px; font-size: 13px; }
.wx-col.s-new header { border-color: #f59e0b; } .wx-col.s-contacted header { border-color: #3b82f6; } .wx-col.s-converted header { border-color: #16a34a; } .wx-col.s-closed header { border-color: #9ca3af; }
.wx-cards { display: flex; flex-direction: column; gap: 8px; }
.wx-none { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0; }
.wx-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: transform .12s, box-shadow .12s; }
.wx-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: var(--gold-line); }
.wx-card.late { border-inline-start: 4px solid var(--danger); } .wx-card.drag { opacity: .4; }
.wx-card .r1, .wx-card .r3 { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.wx-card .ago { font-size: 12px; color: var(--muted); } .wx-card .ago.late { color: var(--danger); font-weight: 700; }
.wx-card .nm { font-weight: 700; margin: 6px 0 0; font-size: 15px; } .wx-card .ph { font-size: 12.5px; color: var(--muted); text-align: right; } .wx-card .ph span { direction: rtl; }
.wx-card .what { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--ink); } .chip.more { background: var(--soft); border-color: var(--line); color: var(--muted); }
.wx-card .acts { display: flex; gap: 4px; align-items: center; }
.wx-card .acts a { text-decoration: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--soft); }
.wx-card .acts a:hover { background: var(--gold-soft); }
.wx-card .acts button { border: 0; border-radius: 8px; background: var(--brand); color: var(--brand-ink); padding: 6px 10px; cursor: pointer; font-size: 12.5px; font-weight: 700; }
.wx-st { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--soft); white-space: nowrap; }
.wx-st.s-new { background: var(--bg-new); color: var(--st-new); font-weight: 700; } .wx-st.s-contacted { background: var(--bg-design); color: var(--st-design); } .wx-st.s-converted { background: var(--bg-ready); color: var(--st-ready); }
.wx-empty { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }
.wx-empty .big { font-size: 44px; } .wx-empty b { color: var(--ink); font-size: 16px; }
/* نافذة تفاصيل الطلب */
.wx-steps { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.wx-steps > div { flex: 1; min-width: 100px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surf2); color: var(--muted); font-size: 13px; }
.wx-steps i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--card); font-size: 12px; font-weight: 700; flex: none; }
.wx-steps .done { background: var(--t-grn); color: var(--ok); } .wx-steps .done i { background: var(--ok); color: #fff; } .wx-steps .now { outline: 2px solid var(--ok); font-weight: 700; }
.wx-steps .end { background: var(--t-red); color: var(--danger); } .wx-steps .end i { background: var(--danger); color: #fff; }
.wx-who { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--surf2); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.wx-who .av { width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 20px; font-weight: 800; flex: none; }
.wx-who .ph { direction: ltr; text-align: right; font-weight: 600; } .wx-who .q { margin-inline-start: auto; display: flex; gap: 6px; }
.wx-items h4, .wx-msg h4, .wx-card2 h4, .wx-sub { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.wx-items .it { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--card); }
.wx-items .qty { background: var(--gold-soft); border-radius: 99px; padding: 3px 12px; font-weight: 700; white-space: nowrap; }
.wx-msg p { white-space: pre-wrap; background: var(--surf2); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.wx-acts { flex-wrap: wrap; align-items: center; } .wx-acts .spacer { flex: 1; }
/* إدارة المحتوى */
.wx-cms { display: grid; grid-template-columns: 290px 1fr; gap: 14px; align-items: start; }
.wx-side { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; position: sticky; top: 8px; max-height: calc(100vh - 100px); overflow: auto; }
.wx-sidehead { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 10px; }
.wx-dept { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.wx-dept:hover { background: var(--hover); } .wx-dept.on { background: var(--gold-soft); border-color: var(--gold-line); } .wx-dept.off { opacity: .6; }
.wx-dept .th { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--soft); display: grid; place-items: center; flex: none; font-weight: 700; color: var(--muted); }
.wx-dept .th img { width: 100%; height: 100%; object-fit: cover; } .wx-dept .tx { flex: 1; min-width: 0; } .wx-dept .tx b { display: block; font-size: 14px; } .wx-dept .tx small { color: var(--muted); font-size: 12px; }
.wx-dept .mv { display: flex; flex-direction: column; } .wx-dept .mv button { border: 0; background: transparent; cursor: pointer; font-size: 9px; line-height: 1.2; color: var(--muted); padding: 1px 6px; } .wx-dept .mv button:hover:not(:disabled) { color: var(--brand); } .wx-dept .mv button:disabled { opacity: .25; cursor: default; }
.wx-hero { display: flex; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.wx-hero .pic { width: 150px; height: 112px; border-radius: 10px; overflow: hidden; background: var(--soft); display: grid; place-items: center; flex: none; color: var(--muted); }
.wx-hero .pic img { width: 100%; height: 100%; object-fit: cover; } .wx-hero .inf { flex: 1; min-width: 220px; } .wx-hero h3 { margin: 0 0 4px; }
.wx-hero .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.wx-phead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.wx-prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.wx-prod { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .12s, border-color .12s; }
.wx-prod:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: var(--gold-line); } .wx-prod.off { opacity: .6; }
.wx-prod .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; } .wx-prod .opts { display: flex; flex-wrap: wrap; gap: 4px; } .wx-prod .foot { display: flex; justify-content: space-between; margin-top: auto; }
.wx-sw { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-size: 13px; color: var(--ink); }
.wx-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.wx-sw i { width: 40px; height: 22px; border-radius: 99px; background: #cbd5d5; position: relative; flex: none; transition: background .15s; }
.wx-sw i::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: inset-inline-start .15s; }
.wx-sw input:checked + i { background: var(--ok); } .wx-sw input:checked + i::after { inset-inline-start: 20px; }
.wx-sw.sm i { width: 34px; height: 19px; } .wx-sw.sm i::after { width: 15px; height: 15px; } .wx-sw.sm input:checked + i::after { inset-inline-start: 17px; }
/* المواسم */
.wx-seasons { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wx-season { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; } .wx-season:hover { border-color: var(--gold-line); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.wx-season.off { opacity: .6; } .wx-season.hot { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-soft), var(--card)); }
.wx-season .cd { width: 62px; flex: none; text-align: center; background: var(--gold-soft); border-radius: 10px; padding: 8px 0; align-self: flex-start; } .wx-season .cd b { display: block; font-size: 24px; line-height: 1.1; color: var(--brand); } .wx-season .cd small { color: var(--muted); font-size: 11px; }
.wx-season .inf { flex: 1; min-width: 0; } .wx-season .opts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
/* الإعدادات */
.wx-setup { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 14px; align-items: start; }
.wx-card2 { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.wx-check { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; } .wx-check li { display: flex; gap: 8px; align-items: center; color: var(--muted); } .wx-check li i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: 12px; } .wx-check li.ok { color: var(--ink); } .wx-check li.ok i { background: var(--ok); color: #fff; }
.wx-prev { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: sticky; top: 8px; } .wx-prevhead { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); } .wx-prev iframe { width: 100%; height: 560px; border: 0; background: #fff; }
@media (max-width: 860px) { .wx-cms, .wx-setup { grid-template-columns: 1fr; } .wx-side { position: static; max-height: none; } .wx-prev { position: static; } .wx-who .q { margin-inline-start: 0; width: 100%; } .wx-who .q .btn { flex: 1; text-align: center; } }
.wx-pact { display: flex; gap: 6px; flex-wrap: wrap; }
.wx-quick { display: flex; gap: 8px; margin-bottom: 12px; background: var(--card); border: 2px dashed var(--gold-line); border-radius: 12px; padding: 8px; }
.wx-quick input:first-child { flex: 1; border: 0; background: transparent; font-size: 15px; } .wx-quick input:first-child:focus { outline: none; }
.wx-quick input#qaUnit { width: 110px; flex: none; } .wx-quick:focus-within { border-color: var(--gold); background: var(--gold-soft); }
.wx-prod .pimg { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--soft); border: 2px dashed var(--line); display: grid; place-items: center; cursor: pointer; margin: -2px -2px 4px; color: var(--muted); text-align: center; }
.wx-prod .pimg:hover { border-color: var(--gold); background: var(--gold-soft); } .wx-prod .pimg.has { border: 0; }
.wx-prod .pimg span { font-size: 28px; display: flex; flex-direction: column; gap: 2px; } .wx-prod .pimg small { font-size: 12px; }
.wx-prod .pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wx-prod .pimg .x { position: absolute; top: 6px; inset-inline-start: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: none; line-height: 1; }
.wx-prod .pimg:hover .x { display: block; } .wx-prod.dz { outline: 3px dashed var(--gold); background: var(--gold-soft); }
/* لوحة كل مساعد */
.ai-switch { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.ai-tile { display: flex; align-items: center; gap: 12px; text-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.ai-tile:hover { border-color: var(--gold-line); transform: translateY(-1px); }
.ai-tile.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--gold-soft), 0 6px 18px rgba(40,50,50,.08); }
.ai-tile .emp-id { flex: 1; min-width: 0; } .ai-tile .ai-badge { display: inline-block; margin-top: 5px; font-size: 11px; padding: 2px 8px; }
.ai-tile .emp-job { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.ai-acard { text-align: start; cursor: pointer; font: inherit; color: var(--ink); width: 100%; transition: border-color .15s; } .ai-acard:hover { border-color: var(--gold); }
.ai-acard .ai-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-more { margin-top: 10px; font-size: 13px; color: var(--brand); font-weight: 600; }
.ai-hcard { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; } .ai-hcard .ai-agent { padding: 0; } .ai-hcard .st-sw { border: 0; padding: 0; min-width: 260px; }
.ai-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); } .ai-row:first-of-type { border-top: 0; }
.ai-row-m { flex: 1; min-width: 0; font-size: 14px; } .ai-row-m small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.ai-row-a { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; } .ai-row-m[data-fu]:hover b { color: var(--brand); }
@media (max-width: 560px) { .ai-row.has-a { flex-wrap: wrap; } .ai-row.has-a .ai-row-m { flex-basis: calc(100% - 90px); } .ai-row.has-a .ai-row-a { flex-basis: 100%; justify-content: flex-start; } }
.ai-sup { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ai-sup-a { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; } .ai-sup-a label { margin: 0; } .ai-sup-a input { width: 160px; }
.ai-savebar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 14px; width: max-content; margin-inline-start: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 16px; padding-inline-start: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.12); font-size: 13px; color: var(--muted); z-index: 3; }
@media (max-width: 1250px) { .ai-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .ai-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .ai-three { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .ai-switch { grid-template-columns: 1fr 1fr; gap: 8px; } .ai-tile { padding: 10px; gap: 8px; } .ai-tile .emp-av { width: 36px; height: 36px; font-size: 14px; border-radius: 10px; } }

/* شروق */
.soc-post { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); } .soc-post:first-of-type { border-top: 0; }
.soc-post img, .soc-noimg { width: 170px; height: 170px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); flex: none; background: var(--surf2); display: grid; place-items: center; font-size: 34px; }
.soc-m { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; } .soc-h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.soc-topic { font-weight: 700; } .soc-cap { white-space: pre-wrap; font-size: 14px; line-height: 1.7; }
.soc-a { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.soc-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.soc-ph { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--surf); font-size: 13px; display: flex; flex-direction: column; gap: 6px; } .soc-ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.soc-pls { display: flex; gap: 14px; flex-wrap: wrap; }
@media (max-width: 640px) { .soc-post { flex-direction: column; } .soc-post img, .soc-noimg { width: 100%; height: auto; aspect-ratio: 1; } }

.ai-brief { white-space: pre-wrap; background: var(--surf); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-family: inherit; font-size: 13px; line-height: 1.8; margin-top: 10px; }
/* سلمى: نجوم التقييم ونص التقرير */
.care-stars { color: #e0a100; letter-spacing: 1px; font-size: 15px; white-space: nowrap; min-width: 82px; }
.care-stars i { color: var(--line, #ddd); font-style: normal; }
.care-rep { white-space: pre-wrap; line-height: 1.8; background: var(--surf); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
/* صفحة متابعة الزبون /t/… */
.trk { max-width: 620px; }
.trk-head { text-align: center; margin: 8px 0 14px; }
.trk-head h1 { font-size: 22px; margin: 6px 0 2px; }
.trk-sec { font-size: 15px; color: var(--muted, #777); margin: 22px 4px 8px; }
.trk-card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.07); border-inline-start: 4px solid var(--brand); }
.trk-card.is-ready { border-inline-start-color: #16a34a; }
.trk-card.is-done { opacity: .75; border-inline-start-color: var(--line, #ddd); }
.trk-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.trk-ref { font-size: 12px; color: var(--muted, #777); direction: ltr; white-space: nowrap; }
.trk-status { margin: 6px 0 10px; font-weight: 600; }
.trk-tag { background: #fee2e2; color: #b91c1c; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.trk-steps { list-style: none; display: flex; padding: 0; margin: 0 0 10px; gap: 2px; }
.trk-steps li { flex: 1; text-align: center; font-size: 11px; color: var(--muted, #888); position: relative; }
.trk-steps li i { display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 4px; border-radius: 50%; background: var(--surf, #f2f0ea); font-style: normal; font-size: 14px; position: relative; z-index: 1; }
.trk-steps li::before { content: ''; position: absolute; top: 15px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line, #e5e2da); }
.trk-steps li:last-child::before { display: none; }
.trk-steps li.done i { background: var(--brand); color: #fff; }
.trk-steps li.done::before { background: var(--brand); }
.trk-steps li.now i { background: #fff; box-shadow: 0 0 0 2px var(--brand); }
.trk-steps li.now span { color: var(--text, #222); font-weight: 700; }
.trk-proof { display: block; text-align: center; margin-top: 10px; }
.trk-empty { text-align: center; }
.trk-foot { text-align: center; margin: 20px 0 30px; }
.trk-foot .btn { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.ai-alert.ok { background: var(--t-grn); color: var(--ok); }
.ai-order textarea { width: 100%; margin-top: 8px; }
.ai-order #aoRes { margin-top: 8px; }
.ai-draft-note .btn { margin-inline-start: 6px; }

/* عملة تسعير الزبون (دينار/دولار): تسمية العملة بجانب الحقول والأرقام */
.cur-lbl { color: var(--gold); font-weight: 700; font-size: .92em; white-space: nowrap; }
.cur-tag { color: var(--muted); font-size: .78em; font-weight: 700; white-space: nowrap; }
.line-table.in-cur th .cur-lbl, .no-price.in-cur th .cur-lbl { color: var(--gold); }
.line-table.in-cur .pc input { border-color: var(--gold-line); background: #fffdf5; }
.ai-qa { margin: 12px 0; }
.ai-qa textarea { width: 100%; margin-top: 8px; }
.ai-qa-mem { margin-top: 6px; font-size: 13px; }
.ai-qa-mem summary { cursor: pointer; color: var(--muted, #777); }
.ai-qa-mem input[data-q] { width: 100%; }

/* ===== الإجازات والإنذارات والعقود (قانون العمل الفلسطيني) ===== */
.lv-plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--soft); margin: 8px 0; }
.lv-plan.bad { border-color: var(--danger); background: #fef2f2; }
.lv-list { margin: 6px 0 0; padding-inline-start: 20px; font-size: 13px; line-height: 1.8; }
.lv-list.err { color: var(--danger); font-weight: 600; } .lv-list.warn { color: var(--warn); } .lv-list.note { color: var(--muted); }
.lv-warnline { color: var(--warn); font-size: 13px; margin: -4px 0 10px; }
.lv-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 18px; margin-bottom: 8px; }
.lv-info .hint { margin-inline-end: 4px; }
.badge.ds-1 { background: #6b7280; } .badge.ds-2 { background: #ca8a04; } .badge.ds-3 { background: #ea580c; } .badge.ds-4 { background: #dc2626; } .badge.ds-5 { background: #7f1d1d; } .badge.ds-6 { background: #7e22ce; }
.ds-letter p { margin: 8px 0; line-height: 1.9; font-size: 14px; }
.ds-mode { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; background: var(--soft); margin: 2px 0 10px; }
.ds-adv { margin: 0 0 8px; } .ds-adv summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; } .ds-adv[open] summary { margin-bottom: 6px; }
.ds-box { border: 1px solid #cfcfcf; border-radius: 6px; padding: 8px 12px; margin: 8px 0; font-size: 14px; line-height: 1.8; }
.ds-law { font-size: 12.5px; color: #444; border-top: 1px dashed #bbb; padding-top: 8px; }
.ds-sign { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; margin-top: 26px; font-size: 13px; }
.ds-line { border-bottom: 1px solid #333; height: 44px; margin-bottom: 4px; }
.ds-witness { margin-top: 22px; font-size: 12.5px; line-height: 2.2; }
@media print { .badge.ds-1, .badge.ds-2, .badge.ds-3, .badge.ds-4, .badge.ds-5, .badge.ds-6 { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ===== عقود العمل وترويسات الشركة ===== */
.lv-plan.warn { border-color: #d97706; background: #fffbeb; color: #1f2937; } .lv-plan.bad { color: #1f2937; }
.ct-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; } .ct-chips .tag { cursor: pointer; border: 1px solid var(--line); font-size: 13px; padding: 5px 12px; font-family: inherit; }
.ct-emp { background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; line-height: 1.9; }
.ct-emp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 14px; margin-bottom: 8px; } .ct-emp-grid .ct-w2 { grid-column: span 2; }
@media (max-width: 720px) { .ct-emp-grid { grid-template-columns: 1fr 1fr; } }
.ct-info { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ct-docs { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.ct-sheet { background: #fff; color: #111; width: 100%; max-width: 794px; padding: 28px 34px; box-shadow: 0 1px 8px rgba(0,0,0,.18); font-size: 13.5px; line-height: 1.95; text-align: right; }
.ct-title { text-align: center; margin: 4px 0 10px; } .ct-title h1 { margin: 0; font-size: 24px; letter-spacing: .5px; }
.ct-sub { font-size: 16px; font-weight: 700; margin-top: 2px; } .ct-law { font-size: 12px; color: #555; } .ct-no { font-size: 12px; color: #444; margin-top: 2px; }
.ct-open { margin: 8px 0 4px; font-weight: 600; }
.ct-party { border: 1px solid #cfcfcf; border-radius: 6px; padding: 6px 12px; margin: 8px 0; } .ct-party > div { white-space: pre-wrap; } .ct-party b { display: block; margin-bottom: 2px; }
.ct-clause h3 { font-size: 14.5px; margin: 12px 0 2px; color: #222; } .ct-clause p { margin: 3px 0; } .ct-clause ul { margin: 2px 0; padding-inline-start: 22px; }
.ct-closing { margin-top: 14px; font-weight: 600; }
.ct-sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 26px; font-size: 13px; } .ct-sig { text-align: center; } .ct-sigline { border-bottom: 1px solid #111; height: 50px; margin: 6px 0 4px; }
.ct-receipt { margin-top: 18px; font-size: 12.5px; border-top: 1px dashed #aaa; padding-top: 8px; }
.ct-lh { border-bottom: 3px solid var(--lh, #8a6612); padding-bottom: 8px; margin-bottom: 12px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ct-lh-top { display: flex; align-items: center; gap: 16px; } .ct-lh-logo { max-height: 70px; max-width: 170px; object-fit: contain; display: block; }
.ct-lh-name { font-size: 24px; font-weight: 800; color: var(--lh, #8a6612); line-height: 1.3; } .ct-lh-tag { font-size: 13px; color: #444; }
.ct-lh-contact { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: #444; margin-top: 6px; } .ct-lh-contact span + span::before { content: '•'; color: var(--lh, #8a6612); margin-inline-end: 14px; }
.ct-foot { margin-top: 18px; border-top: 2px solid var(--lh, #8a6612); padding-top: 6px; text-align: center; font-size: 12px; color: #444; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ct-paper-gap { display: block; background: repeating-linear-gradient(135deg, #f4f4f4 0 8px, #fff 8px 16px); }
.lh-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 10px 0; background: var(--card); } .lh-card.off { opacity: .6 }
.lh-prev { background: #fff; color: #111; padding: 10px 14px; border-radius: 6px; border: 1px dashed #ccc; margin-bottom: 8px; } .lh-prev .ct-lh { margin-bottom: 0; } .lh-prev .ct-lh-name { font-size: 20px; }
input[type=color] { height: 38px; padding: 3px 4px; cursor: pointer; }
@media print {
  body[data-print="modal"] #modalRoot .modal { background: #fff !important; }   /* لا تُطبع خلفية النافذة الكريمية تحت الورقة عند تفعيل «الرسوم الخلفية» */
  .ct-docs { display: block; } .ct-sheet { box-shadow: none; max-width: none; width: auto; padding: 0; font-size: 13px; line-height: 1.85; }
  .ct-sheet.ct-next { break-before: page; page-break-before: always; }
  .ct-clause { break-inside: avoid; page-break-inside: avoid; } .ct-clause h3 { break-after: avoid; page-break-after: avoid; } .ct-sigs, .ct-receipt, .ct-party { break-inside: avoid; page-break-inside: avoid; }
  .ct-paper-gap { background: none; }
}

/* ===== دردشة الملاحظات + تبويبات الموظفين + ترتيب القوائم (طلبات التسعير، شكاوي ومتابعة) ===== */
.chat-wrap { position: relative; }
.chat-log { display: flex; flex-direction: column; gap: 5px; max-height: min(46vh, 380px); min-height: 96px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf); overscroll-behavior: contain; }
.chat-b { max-width: 84%; padding: 6px 10px 4px; border-radius: 12px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.chat-b.mine { align-self: flex-start; background: var(--t-grn); border-end-start-radius: 4px; }
.chat-b.theirs { align-self: flex-end; background: var(--bubble); border-end-end-radius: 4px; }
.chat-b .who { display: block; font-size: 11.5px; font-weight: 700; color: var(--brand); margin-bottom: 1px; }
.chat-b .tm { display: block; font-size: 10.5px; color: var(--muted); text-align: end; margin-top: 1px; }
.chat-sys { align-self: center; max-width: 94%; font-size: 12px; color: var(--muted); text-align: center; padding: 1px 12px; border-radius: 999px; background: var(--soft); overflow-wrap: anywhere; }
.chat-sys small { opacity: .8; }
.chat-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--surf2); border-radius: 999px; padding: 1px 12px; margin: 5px 0 2px; }
.chat-empty { margin: auto; color: var(--muted); font-size: 13px; text-align: center; padding: 14px 6px; }
.chat-new { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); border: 0; background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 4px 14px; font-size: 12.5px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.chat-new[hidden] { display: none; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-form textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 130px; resize: none; padding: 9px 12px; border-radius: 12px; line-height: 1.5; }
.chat-form .btn { height: 40px; flex: none; }
.chat-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); border: 1px solid transparent; border-radius: 999px; padding: 0 7px; cursor: pointer; white-space: nowrap; vertical-align: middle; }
.chat-chip:hover { background: var(--gold-soft); border-color: var(--gold-line); }
.chat-chip.has { color: var(--ink); background: var(--surf2); border-color: var(--line); }
.chat-chip.to-me { color: #fff; background: var(--brand); border-color: var(--brand); font-weight: 700; }   /* آخر ملاحظة من غيري: بانتظار ردّي */
.chat-chip small { max-width: 84px; overflow: hidden; text-overflow: ellipsis; font-size: 11px; opacity: .9; }
.emp-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 1px 8px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.emp-tabs:empty { display: none; }
.emp-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 13.5px; white-space: nowrap; }
.emp-tab:hover { background: var(--gold-soft); border-color: var(--gold-line); }
.emp-tab.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
.emp-tab .n { font-size: 11.5px; background: var(--surf2); color: var(--muted); border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center; }
.emp-tab.active .n { background: rgba(255,255,255,.25); color: inherit; }
.emp-tab .hot { width: 8px; height: 8px; border-radius: 50%; background: #dc2626; flex: none; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--brand); }
th.sortable .sort-arrow { font-size: 11px; opacity: .8; }
@media print { .chat, .emp-tabs { display: none !important; } }

/* ===== الورق الرسمي: ترويسة كاملة (ملف SVG بصفحة A4) + خط الترويسة Droid Sans Arabic — العقود والإنذارات والمخالفات ===== */
@font-face { font-family: 'LhArabic'; src: url('/fonts/DroidSansArabic.woff') format('woff'); font-display: block; }
@font-face { font-family: 'LhLatin'; src: url('/fonts/DroidSans-Latin.woff') format('woff'); font-weight: 400; font-display: block; }
@font-face { font-family: 'LhLatin'; src: url('/fonts/DroidSans-Latin-Bold.woff') format('woff'); font-weight: 700; font-display: block; }
/* حروف الترويسة: العربي Droid Sans Arabic، واللاتيني/الأرقام Century Gothic (إن وُجد على الجهاز كما بتصميم الترويسة) وإلا Droid Sans المضمّن */
:root { --lh-font: LatinDigits, CenturyGothic, 'Century Gothic', LhLatin, LhArabic, 'Droid Sans Arabic', 'Segoe UI', Tahoma, sans-serif; }
.lh-typo { font-family: var(--lh-font); font-size: 12.5px; line-height: 1.75; color: #1f2626; direction: rtl; text-align: right; }
.lh-measure { position: fixed; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }
.lh-b { display: flow-root; margin: 0 0 7px; }
.lh-docs { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lh-pg { position: relative; flex: none; width: 210mm; height: 296.6mm; overflow: hidden; background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.2); }
.lh-art { position: absolute; display: block; max-width: none; height: auto; pointer-events: none; }
.lh-body { position: absolute; top: var(--lh-top); left: var(--lh-side); width: var(--lh-w); height: var(--lh-h); }
.lh-pg.paper { background-image: repeating-linear-gradient(135deg, #f7f7f7 0 8px, #fff 8px 16px); }   /* معاينة «ورق جاهز»: الصفحة فاضية، الترويسة مطبوعة مسبقاً */
.lh-pgno { position: absolute; top: var(--lh-pgno); left: 0; right: 0; text-align: center; font: 10px/1.4 var(--lh-font); color: #66706f; direction: rtl; }
/* كتل العقد داخل الصفحة */
.lh-typo .ct-title { text-align: center; border-bottom: 1.5px solid #ae841f; padding-bottom: 6px; margin: 0; }
.lh-typo .ct-title h1 { margin: 0; font-size: 21px; letter-spacing: 0; color: #283232; font-weight: 700; line-height: 1.5; }
.lh-typo .ct-sub { font-size: 14px; font-weight: 700; color: #283232; margin: 0; } .lh-typo .ct-law, .lh-typo .ct-no { font-size: 11px; color: #4d5858; margin: 0; }
.lh-typo .ct-open { margin: 0; font-weight: 700; }
.lh-typo .ct-party { border: 1px solid #e3d3a4; background: #fbf8ef; border-radius: 6px; padding: 5px 10px; margin: 0; } .lh-typo .ct-party > div { white-space: pre-wrap; }
.lh-typo .ct-clause h3 { font-size: 13px; margin: 0 0 1px; color: #8a6612; font-weight: 700; }
.lh-typo .ct-clause p { margin: 0; } .lh-typo .ct-clause ul { margin: 0; padding-inline-start: 20px; }
.lh-typo .ct-closing { margin: 0; font-weight: 700; }
.lh-typo .ct-sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin: 6px 0 0; font-size: 12px; } .lh-typo .ct-sig { text-align: center; } .lh-typo .ct-sigline { border-bottom: 1px solid #1f2626; height: 44px; margin: 4px 0; }
.lh-typo .ct-receipt { margin: 0; font-size: 11.5px; border-top: 1px dashed #aaa; padding-top: 6px; }
.lh-typo .hint { color: #4d5858; font-size: 11.5px; }
/* كتل الإنذارات والمحاضر والسجلات */
.lh-typo .lh-b.lh-title { margin-bottom: 11px; } .lh-typo .lh-title { text-align: center; border-bottom: 1.5px solid #ae841f; padding-bottom: 6px; }
.lh-typo .lh-title h2 { margin: 0; font-size: 20px; font-weight: 700; color: #283232; line-height: 1.5; }
.lh-typo .lh-meta { display: flex; justify-content: center; gap: 30px; font-size: 12px; color: #4d5858; }
.lh-typo .lh-info { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 18px; border: 1px solid #e3d3a4; background: #fbf8ef; border-radius: 6px; padding: 5px 10px; }
.lh-typo .lh-p { margin: 0; }
.lh-typo .lh-box { border: 1px solid #cfc7b0; border-radius: 6px; padding: 5px 10px; }
.lh-typo .lh-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.lh-typo .lh-line { border-bottom: 1px solid #1f2626; height: 28px; }
.lh-typo .lh-law { font-size: 11.5px; color: #444; border-top: 1px dashed #bbb; padding-top: 5px; }
.lh-typo .lh-sign { display: grid; grid-template-columns: 1fr 1.3fr; gap: 26px; margin-top: 4px; font-size: 12px; } .lh-typo .lh-sign .lh-line { height: 40px; margin-bottom: 3px; }
.lh-typo .lh-witness { font-size: 11.5px; line-height: 2; }
.lh-typo .lh-foot { text-align: center; color: #4d5858; font-size: 11.5px; }
.lh-typo .lh-b.lh-tr { margin-bottom: 0; }
.lh-typo table.lh-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lh-typo .lh-tbl td, .lh-typo .lh-tbl th { border: 1px solid #cfc7b0; border-top: 0; padding: 3px 6px; font-size: 11.5px; line-height: 1.55; text-align: right; vertical-align: top; overflow-wrap: anywhere; }
.lh-typo .lh-tbl th { background: #f3eedd; font-weight: 700; border-top: 1px solid #cfc7b0; color: #283232; }
.lh-typo .lh-tbl td.num, .lh-typo .lh-tbl th.num { text-align: left; white-space: nowrap; }
.lh-typo .lh-tbl tr.foot td { background: #f7f3e6; font-weight: 700; }
.lh-typo .lh-after-tbl { padding-top: 9px; }
@media print {
  #printRoot .lh-pg { box-shadow: none; margin: 0; break-after: page; page-break-after: always; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printRoot .lh-pg:last-child { break-after: auto; page-break-after: auto; }
  #printRoot .lh-pg.paper { background-image: none; }
  #printRoot { direction: rtl; }
  #printRoot .lh-body .lh-info, #printRoot .lh-body .ct-party, #printRoot .lh-body .lh-tbl th, #printRoot .lh-body .lh-tbl tr.foot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.lh-art-prev { text-align: center; } .lh-art-prev img { height: 210px; width: auto; border: 1px solid #e5e0d0; background: #fff; display: inline-block; }

/* منع التكرار: عملية شغّالة على هذا الزر/النموذج (راجع run في util.js) */
.is-busy, .is-busy * { cursor: progress; }
a.is-busy, [role=button].is-busy { opacity: .6; pointer-events: none; }
