:root { --bg:#f6f4ef; --card:#fff; --ink:#1f2328; --muted:#5f646b; --brand:#8a1c1c; --ok:#1f7a3a; --warn:#a15c00; --err:#b42318; --line:#e3ded3; }
* { box-sizing: border-box; }
body { margin:0; font-family: "Noto Kufi Arabic","Noto Sans Arabic","Kufam","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%; } }
/* صفحة رابط التأكيد */
.link-page main { max-width: 640px; margin: 0 auto; padding: .75rem; }
.link-page figure { margin: .4rem 0; } .link-page figure img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.link-page .actions button { flex: 1 1 8rem; min-height: 2.8rem; font-size: 1.05rem; }
.prepared-tag { background: #eef4ff; color: #244a8f; }
.link-page [hidden] { display: none !important; }
.link-page .task-card { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin: .85rem 0; background: var(--card, #fff); }
.link-page .task-card h2 { margin-top: 0; font-size: 1.1rem; }
.link-url { flex: 1 1 14rem; min-width: 0; }

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

/* خانة تحديد الموظف في التحضير الجماعي: مساحة لمس كافية على الجوال، ومعطّلة بسبب ظاهر */
.selcell { width:1%; white-space:nowrap; }
.selbox { display:inline-flex; flex-direction:row; align-items:center; gap:.35rem; min-width:2.75rem; min-height:2.75rem; cursor:pointer; margin:0; }
.selbox .check, th .check#all { flex:none; width:1.45rem; height:1.45rem; accent-color:var(--ok, #1f7a4d); }
.selbox.off { cursor:not-allowed; white-space:normal; max-width:7.5rem; }
.selbox.off .check { opacity:.6; }

/* البلاغات: مصغرات الصور */
.rthumb { width:72px; height:72px; object-fit:cover; border-radius:8px; vertical-align:middle; }
.rphoto { width:96px; height:96px; object-fit:cover; border-radius:8px; }

/* طلب التحضير خلال الدوام */
.pplan { border:1px solid #e4d7d0; border-radius:10px; padding:.6rem .8rem; margin:.6rem 0; }
.pplan legend { font-weight:700; padding:0 .3rem; }
#dlg2 { max-width:420px; }

/* صفحة ترحيب شاشة الفرع: الرمز جزء من الصفحة، مناسبة لتلفزيون أفقي وجهاز لوحي */
body.kiosk { background: var(--bg); overflow: hidden; }
body.kiosk main { max-width: none; margin: 0; padding: 0; min-height: 100vh; min-height: 100dvh; }
.welcome-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.welcome-head { background: var(--brand); color: #fff; padding: 1.1rem 2.2rem; }
.welcome-brand { font-size: clamp(1.35rem, 2.8vw, 2.3rem); font-weight: 700; }
.welcome-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: clamp(1.4rem, 3.5vh, 2.5rem) clamp(2.2rem, 6vw, 6.5rem); padding: clamp(1rem, 3vh, 2.5rem) clamp(1.2rem, 4vw, 4rem); }
.welcome-side { flex: 1 1 26rem; max-width: 38rem; }
.welcome-qr { flex: 0 1 auto; }
.welcome-hello { font-size: clamp(1.7rem, 3.6vw, 2.9rem); font-weight: 700; color: var(--brand); margin: 0 0 .6rem; }
.welcome-date { font-size: clamp(1rem, 2vw, 1.45rem); color: var(--muted); }
.welcome-clock { font-size: clamp(2.6rem, 6.2vw, 4.8rem); font-weight: 700; line-height: 1.15; direction: ltr; unicode-bidi: isolate; text-align: right; margin: .3rem 0 1rem; font-variant-numeric: tabular-nums; }
.qr-card { text-align: center; margin: 0 auto; padding: 1.35rem 1.35rem 1.1rem; box-shadow: 0 10px 30px rgba(31, 35, 40, .08); max-width: 480px; }
.welcome-page .qrlive svg { width: min(44vmin, 400px); height: auto; }
.qr-hint { margin: .7rem 0 .35rem; font-size: clamp(1rem, 1.7vw, 1.2rem); color: var(--ink); }
.qr-count { position: relative; width: 3.2rem; height: 3.2rem; margin: .4rem auto 0; }
.qr-count svg { width: 100%; height: 100%; display: block; }
.qr-track { stroke: var(--line); }
.qr-val { stroke: var(--brand); stroke-linecap: round; }
.qr-count span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; }
.welcome-flash { margin-top: 1.2rem; border-radius: 16px; padding: 1.1rem 1.3rem; border: 2px solid var(--ok); background: #e8f6ec; color: var(--ok); animation: welcome-in .35s ease; }
.welcome-flash.in { border-color: var(--ok); background: #e8f6ec; color: var(--ok); }
.welcome-flash.out { border-color: var(--brand); background: #f8ecec; color: var(--brand); }
.welcome-flash .flash-name { font-size: clamp(1.5rem, 3.2vw, 2.3rem); font-weight: 700; line-height: 1.4; }
.welcome-flash .flash-sub { font-size: clamp(1.05rem, 2vw, 1.4rem); margin-top: .2rem; }
@keyframes welcome-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-height: 800px) and (min-width: 901px) {
  .welcome-head { padding: .8rem 2rem; }
  .welcome-body { padding: 1rem 2.5rem; }
  .welcome-page .qrlive svg { width: min(40vmin, 340px); }
}
@media (max-width: 900px), (orientation: portrait) {
  body.kiosk { overflow: auto; }
  .welcome-body { flex-direction: column; text-align: center; }
  .welcome-clock { text-align: center; }
  .welcome-side, .welcome-qr { width: 100%; max-width: 38rem; }
}
/* «امسح الكود»: الكاميرا الخلفية داخل صفحة ورديتي (بلا انعكاس) */
.today .scanbtn { background:#0f6b3a; border-color:#0f6b3a; }
.scanbox { margin:.75rem auto; max-width:420px; text-align:center; }
.scanbox video { width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:12px; border:3px solid #0f6b3a; background:#000; }
.center { text-align:center; }
/* 2026-11-15: الترويسة الثابتة لا تغطي العناوين عند التمرير/القفز إليها */
html { scroll-padding-top: calc(var(--hdr, 120px) + .5rem); }
main h1, main h2, main h3, main .card, main form { scroll-margin-top: calc(var(--hdr, 120px) + .5rem); }
/* زر اختيار الملف بالعربي بدل «Choose Files» */
.field { display:flex; flex-direction:column; gap:.3rem; font-size:.9rem; color:var(--muted); margin:.4rem 0; }
.filepick { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }
.filepick .filebtn { cursor:pointer; margin:0; }
.filepick .fp-name { color:var(--muted); word-break:break-all; }
/* طلب الإجازة: النوع والموافقة على الخصم */
fieldset.ltype { border:1px solid var(--line, #ddd); border-radius:10px; padding:.5rem .8rem; display:flex; gap:1.2rem; flex-wrap:wrap; margin:.4rem 0; }
fieldset.ltype legend { font-size:.9rem; color:var(--muted); padding:0 .3rem; }
label.ack { margin:.4rem 0; font-weight:600; }
/* الراحة وسط الدوام */
.breakset { border:1px solid #e4d7d0; border-radius:10px; padding:.6rem .8rem; margin:.6rem 0; }
.breakset legend { font-weight:700; padding:0 .3rem; }
.today .breakline { margin-top:.3rem; }
.today .breakbtn.ok { background:#0f6b3a; border-color:#0f6b3a; }
.stcell .pill { white-space:normal; }
.stcell > div { margin-top:.15rem; }

/* «يوجد تحديث جديد للتطبيق» — شريط ثابت أسفل الشاشة لا يمنع استخدام الصفحة */
.upd-bar { position: fixed; z-index: 10000; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 12px;
  background: #8a1c1c; color: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.28); }
.upd-bar .upd-text { flex: 1; display: flex; flex-direction: column; line-height: 1.5; }
.upd-bar .upd-text b { font-size: 1.05rem; } .upd-bar .upd-text span { font-size: .9rem; opacity: .9; }
.upd-bar .upd-btn { background: #fff; color: #8a1c1c; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; font-size: 1rem; white-space: nowrap; cursor: pointer; }
@media print { .upd-bar { display: none !important; } }

/* تتبع السائقين */
.track-map { height: 420px; border-radius: 10px; margin: 10px 0; border: 1px solid #ddd; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
tr.sel td { background: #f1f8f4; }
.trk-tip { font-family: inherit; font-size: 12px; direction: rtl; }
.track-note { border-inline-start: 4px solid #0b6e4f; }
/* صفحة تحميل تطبيق الأندرويد */
.dl-page { max-width: 640px; margin: 0 auto; padding: 16px; }
.dl-btn { font-size: 1.2em; padding: 14px 22px; display: inline-block; }
.dl-steps li { margin: 8px 0; line-height: 1.7; }
/* لوحة مدير السواقين وصور السيارة */
.carset { border-top:1px solid var(--line); padding:.5rem 0; }
.carside { margin-top:.3rem; }
fieldset.carpick, fieldset.outcome { border:1px solid var(--line); border-radius:10px; padding:.5rem .8rem; margin:.6rem 0; }
fieldset.outcome .opt { align-items:flex-start; padding:.35rem 0; }
.badge.alt { background:var(--brand); color:#fff; }
