:root { --bg:#f5f3ec; --card:#fff; --ink:#1f2328; --muted:#5f646b; --brand:#2f5d3a; --ok:#1f7a3a; --warn:#a15c00; --err:#b42318; --line:#e3ded3; }
* { box-sizing: border-box; }
body { margin:0; font-family: "Noto Kufi Arabic","Segoe UI",Tahoma,system-ui,sans-serif; background:var(--bg); color:var(--ink); font-size:16px; line-height:1.6; }
header { display:flex; flex-wrap:wrap; gap:.5rem 1rem; align-items:center; padding:.6rem 1rem; background:var(--brand); color:#fff; position:sticky; top:0; z-index:5; }
.brand { font-weight:700; }
.menu-btn { display:none; background:transparent; border:1px solid rgba(255,255,255,.6); margin-inline-start:auto; }
nav { display:flex; flex-wrap:wrap; gap:.25rem; flex:1; }
nav a { color:#fff; text-decoration:none; padding:.25rem .6rem; border-radius:6px; }
nav a.active, nav a:hover { background:rgba(255,255,255,.18); }
#who { font-size:.85rem; display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
#who button, #who a { background:transparent; color:#fff; border:1px solid rgba(255,255,255,.6); padding:.2rem .6rem; border-radius:7px; text-decoration:none; font-size:.85rem; }
@media (max-width: 760px) {
  .menu-btn { display:inline-block; }
  nav { display:none; flex-basis:100%; flex-direction:column; }
  nav.open { display:flex; }
  #who { flex-basis:100%; }
}
main { max-width:1100px; margin:0 auto; padding:1rem; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:1rem; margin-bottom:1rem; }
.skeleton { color:var(--muted); }
h1 { font-size:1.3rem; margin:.2rem 0 1rem; } h2 { font-size:1.1rem; margin:0 0 .6rem; } h3 { font-size:1rem; margin:.8rem 0 .4rem; }
.grid { display:grid; gap:.7rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
label { display:flex; flex-direction:column; gap:.2rem; font-size:.9rem; color:var(--muted); }
label.inline { flex-direction:row; align-items:center; gap:.4rem; color:var(--ink); }
.req::after { content:" *"; color:var(--err); }
input, select, textarea, button { font:inherit; }
input, select, textarea { padding:.5rem .6rem; border:1px solid #cfc8ba; border-radius:8px; background:#fff; color:var(--ink); min-width:0; }
input[type=number], input[type=tel], input[type=time], input[type=date], input[type=datetime-local], input[type=month] { direction:ltr; text-align:right; }
textarea { min-height:3rem; }
button, .btn { padding:.5rem 1rem; border:1px solid var(--brand); background:var(--brand); color:#fff; border-radius:8px; cursor:pointer; text-decoration:none; display:inline-block; }
button.secondary, .btn.secondary { background:#fff; color:var(--brand); }
button.danger { background:var(--err); border-color:var(--err); }
button.ok { background:var(--ok); border-color:var(--ok); }
button:disabled { opacity:.45; cursor:not-allowed; }
.actions { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.7rem; align-items:center; }
table { width:100%; border-collapse:collapse; font-size:.92rem; }
th, td { padding:.45rem .5rem; border-bottom:1px solid var(--line); text-align:right; vertical-align:top; }
th { background:#faf8f3; font-weight:600; }
td.num, th.num { direction:ltr; text-align:right; white-space:nowrap; }
.table-wrap { overflow-x:auto; }
.muted { color:var(--muted); } .small { font-size:.85rem; }
.pill { display:inline-block; padding:.05rem .55rem; border-radius:99px; font-size:.8rem; background:#eee; white-space:nowrap; }
.st-present{background:#d9f2df}.st-late{background:#ffe7c2}.st-absent{background:#fdd}.st-excused{background:#e2ecff}.st-technical{background:#e5dcff}
.st-day_off{background:#d5f5ea}.st-pending{background:#f1f1f1}.st-off{background:#f6f6f6;color:#777}.st-unscheduled{background:#cdeffd}
.msg { border-radius:8px; padding:.55rem .75rem; margin:.4rem 0; font-size:.92rem; }
.msg.err { background:#fdecea; color:var(--err); } .msg.warn { background:#fff4e0; color:var(--warn); } .msg.info { background:#eef4ff; color:#244a8f; } .msg.ok { background:#e8f6ec; color:var(--ok); }
.kpis { display:grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap:.6rem; margin-bottom:.8rem; }
.kpi { background:#fff; border:1px solid var(--line); border-radius:10px; padding:.6rem; } .kpi b { display:block; font-size:1.3rem; }
.today { text-align:center; }
.today .clock { font-size:2rem; font-weight:700; direction:ltr; }
.today .big { font-size:1.2rem; padding:.9rem 1.6rem; min-width:14rem; }
.shiftline { font-size:1.05rem; }
#toast { position:fixed; bottom:1rem; left:50%; transform:translateX(-50%); background:#222; color:#fff; padding:.55rem 1rem; border-radius:8px; display:none; z-index:20; max-width:90vw; }
.login { max-width:400px; margin:3rem auto; }
dialog { border:1px solid var(--line); border-radius:12px; padding:1rem; width:min(520px, 94vw); }
dialog::backdrop { background:rgba(0,0,0,.35); }
.qrbox { text-align:center; } .qrbox img { width:min(320px, 80vw); height:auto; image-rendering:pixelated; border:1px solid var(--line); }
.days { display:flex; flex-wrap:wrap; gap:.4rem .8rem; }
.check { width:1.1rem; height:1.1rem; }
.hide { display:none !important; }
.print-only { display:none; }
@media print { .no-print { display:none !important; } .print-only { display:block; } body { background:#fff; font-size:12px; } main { padding:0; max-width:none; } .card { border:0; padding:0; } }
/* إضافات 2026-11-11: طرق التحضير، تأكيد التواجد، شاشة الفرع، وجداول الجوال بلا تمرير أفقي */
html, body { max-width:100%; overflow-wrap:break-word; }
img, svg, video { max-width:100%; }
.actions.center { justify-content:center; }
.methods { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:.35rem .8rem; margin:.4rem 0 .6rem; }
.presence { background:#fff4e0; border:2px solid var(--warn); border-radius:12px; padding:.8rem; margin-bottom:1rem; }
.presence b { font-size:1.15rem; color:var(--warn); }
.selfie { margin:.5rem auto; max-width:360px; }
.selfie video, .selfie img { width:100%; border-radius:12px; border:1px solid var(--line); transform:scaleX(-1); }
.filebtn { position:relative; }
.kiosk header { display:none; }
.screen { text-align:center; }
.screen h1 { font-size:1.8rem; }
.qrlive svg { width:min(80vmin, 520px); height:auto; }
dialog { max-height:92vh; overflow-y:auto; }
#scrUrl { width:100%; }
@media (max-width: 760px) {
  .today .big { min-width:0; width:100%; }
  .table-wrap { overflow-x:visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display:block; width:100%; }
  table.stack thead { display:none; }
  table.stack tr { border:1px solid var(--line); border-radius:10px; margin-bottom:.6rem; padding:.3rem .5rem; background:#fff; }
  table.stack td { border:0; padding:.25rem 0; display:flex; gap:.6rem; justify-content:space-between; align-items:flex-start; text-align:left; }
  table.stack td.num { direction:rtl; white-space:normal; }
  table.stack td::before { content:attr(data-label); color:var(--muted); font-size:.85rem; text-align:right; flex:0 0 40%; }
  table.stack td:not([data-label])::before, table.stack td[data-label=""]::before { content:none; }
  table.stack td > * { max-width:60%; }
  .grid { grid-template-columns:minmax(0, 1fr); }
  .grid input, .grid select { width:100%; }
}
/* إضافات تعدد المنشآت والمهام */
.task { border:1px solid var(--line); border-radius:10px; padding:.6rem .8rem; margin-bottom:.6rem; }
.task-head { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; justify-content:space-between; }
.pre { white-space:pre-line; }
.ts-open{background:#eef4ff}.ts-in_progress{background:#ffe7c2}.ts-done{background:#d9f2df}.ts-cancelled{background:#eee;color:#777}
/* كفو: المساءلات والشواهد والإشعارات ونسب التنفيذ */
.badge { display:inline-block; min-width:1.3rem; padding:0 .35rem; border-radius:99px; background:#fff; color:var(--brand); font-size:.75rem; font-weight:700; text-align:center; }
.bar { height:.45rem; background:#eee; border-radius:99px; overflow:hidden; margin-top:.25rem; min-width:4rem; }
.bar span { display:block; height:100%; background:var(--ok); }
.evidence { padding-inline-start:1.1rem; margin:.3rem 0; } .evidence li { margin-bottom:.35rem; word-break:break-word; }
.notifs { list-style:none; padding:0; margin:0; } .notifs li { border-bottom:1px solid var(--line); padding:.5rem .2rem; } .notifs li.unread { background:#fff8ec; }
.rv-submitted{background:#ffe7c2}.rv-approved{background:#d9f2df}.rv-returned{background:#fdd}
.pr-low{background:#f1f1f1}.pr-high{background:#ffe7c2}.pr-urgent{background:#fdd;font-weight:700}
.is-pending{background:#ffe7c2}.is-answered{background:#e2ecff}.is-closed{background:#eee}.is-expired{background:#fdd}
.id-accepted{background:#d9f2df}.id-rejected{background:#fdd}.id-deduction{background:#fdd}.id-warning{background:#ffe7c2}
details summary { cursor:pointer; color:var(--brand); margin:.4rem 0; }
textarea { width:100%; }
input[type=file] { max-width:100%; }
@media (max-width: 760px) { .actions input#fq { width:100%; } }

/* ---------- زاد */
.muted { color:var(--muted); font-size:.9rem; }
.search-wrap { position:relative; display:flex; gap:.5rem; align-items:stretch; }
.search-wrap input { flex:1; font-size:1.05rem; }
.results { list-style:none; margin:.4rem 0 0; padding:0; border:1px solid var(--line); border-radius:10px; max-height:300px; overflow:auto; background:#fff; }
.results li { padding:.55rem .7rem; border-bottom:1px solid var(--line); cursor:pointer; display:flex; justify-content:space-between; gap:.5rem; }
.results li:last-child { border-bottom:0; }
.results li:hover, .results li:focus { background:#eef4ee; outline:none; }
.results .meta { color:var(--muted); font-size:.85rem; }
.line-card { border:1px solid var(--line); border-radius:10px; padding:.7rem; margin:.5rem 0; background:#fff; }
.line-card .title { display:flex; justify-content:space-between; gap:.5rem; font-weight:700; }
.line-card .grid3 { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:.5rem; margin-top:.4rem; }
.line-card .hint { font-size:.82rem; color:var(--muted); margin-top:.3rem; }
.alert-over { background:#fff4e5; border:1px solid #f0c27b; color:#7a4300; border-radius:8px; padding:.35rem .6rem; margin-top:.4rem; font-size:.88rem; }
.badge { display:inline-block; padding:.05rem .5rem; border-radius:99px; font-size:.8rem; background:#eceae2; color:var(--ink); }
.badge.warn { background:#fff0d6; color:#7a4300; }
.badge.ok { background:#e3f2e6; color:#1f5f2e; }
.badge.err { background:#fde8e6; color:#8f1d12; }
.os-draft, .os-returned { background:#eceae2; } .os-pending_manager { background:#fff0d6; } .os-at_purchasing, .os-branch_approved { background:#e6eefc; }
.os-purchasing_approved, .os-supplying { background:#e8f4fb; } .os-completed { background:#e3f2e6; } .os-cancelled { background:#fde8e6; }
.tiles { display:grid; gap:.7rem; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); }
.tile { display:block; background:#fff; border:1px solid var(--line); border-radius:12px; padding:1rem; color:var(--ink); text-decoration:none; }
.tile b { display:block; font-size:1.6rem; color:var(--brand); }
dialog.scan { max-width:520px; width:96vw; }
.scan-box video { width:100%; max-height:50vh; background:#000; border-radius:10px; }
.qty { direction:ltr; text-align:right; width:100%; }
.sticky-actions { position:sticky; bottom:0; background:var(--bg); padding:.6rem 0; border-top:1px solid var(--line); }
.timeline { list-style:none; padding:0; margin:0; font-size:.88rem; }
.timeline li { padding:.3rem 0; border-bottom:1px dashed var(--line); }
@media (max-width: 520px) { .line-card .grid3 { grid-template-columns:1fr 1fr; } }

/* حفظ اسم المستخدم + البصمة */
.remember { display:flex; gap:.5rem; align-items:center; font-weight:normal; margin:.4rem 0; }
.remember input { width:auto; min-height:0; margin:0; }

/* زاد — المرحلة الثالثة (بدل الأنماط المضمنة؛ CSP تمنعها) */
.narrow-login { max-width:420px; margin:2rem auto; }
.narrow-pw { max-width:460px; margin:1rem auto; }
.narrow { max-width:520px; }
.mt1 { margin-top:1rem; } .mt06 { margin-top:.6rem; }
.btn-xs { padding:.1rem .5rem; font-size:.85rem; }
.w7 { max-width:7rem; }
.span-all { grid-column:1 / -1; }
.row-warn td { background:#fff6f4; }
tr.voided td { color:var(--muted); text-decoration:line-through; }
tr.voided td:last-child { text-decoration:none; }
.nbadge { display:inline-block; min-width:1.3rem; padding:0 .35rem; border-radius:99px; background:#fff; color:var(--err); font-size:.75rem; font-weight:700; text-align:center; }
.tile-warn { border-color:#f0b7ae; background:#fff6f4; } .tile-warn b { color:var(--err); }
table.cmp td.best, table.cmp th.best { background:#e3f2e6; font-weight:700; }
table.cmp td.worst { background:#fde8e6; color:#8f1d12; font-weight:700; }
table.cmp .bstart { border-inline-start:2px solid var(--line); }
.rs-open { background:#e6eefc; } .rs-awarded { background:#e3f2e6; } .rs-cancelled { background:#fde8e6; }
.checks { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:.3rem .8rem; }
.qline { border-bottom:1px dashed var(--line); padding:.4rem 0; }
.grid2 { display:grid; grid-template-columns:1fr auto; gap:.5rem; align-items:end; }
.invoices { padding-inline-start:1.1rem; } .invoices li { margin-bottom:.3rem; }
.offscreen { position:fixed; top:-1000px; opacity:0; }
.kpi .small { font-weight:normal; }
.scroll-x { overflow-x:auto; max-width:100%; }
.rfq-wrap, table.cmp { min-width:0; }
@media (max-width: 760px) { table.cmp:not(.stack) { font-size:.85rem; } #app .card:has(> .table-wrap > table.cmp:not(.stack)) .table-wrap { overflow-x:auto; } }
