:root {
  --brand: #451425;       /* عنابي مركز احتواء */
  --brand-2: #5e1d33;
  --gold: #B78E55;        /* ذهبي مركز احتواء */
  --gold-soft: rgba(183, 142, 85, .14);
  --bg: #f6f3f0;
  --card: #fff;
  --text: #2a2a2e;
  --muted: #7b7d8a;
  --line: #ebe6e1;
  --ok: #2e7d5b;   --ok-bg: #e6f4ed;
  --bad: #b3261e;  --bad-bg: #fbe9e7;
  --warn: #a86b00; --warn-bg: #fff3dc;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Bahij TheSansArabic", "Tajawal", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
.bn { display: block; font-family: "Noto Sans Bengali", sans-serif; font-size: .82em; color: var(--muted); line-height: 1.35; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- الهيدر ---------- */
.top {
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 10;
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 38px; width: auto; filter: brightness(0) invert(1); }
.brand b { display: block; font-size: 1.05rem; }
.brand small { color: var(--gold); font-weight: 700; }
.who { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.who .link { color: var(--gold); }
.demo-bar { background: var(--gold); color: var(--brand); text-align: center; font-size: .85rem; padding: 4px 8px; font-weight: 700; }

main { max-width: 820px; margin: 0 auto; padding: 16px 14px 60px; }
main.narrow { max-width: 440px; }
.loading { text-align: center; margin-top: 30vh; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(69, 20, 37, .05); }
h1, h2, h3 { color: var(--brand); margin: 0 0 8px; line-height: 1.3; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.list-title { margin-top: 22px; }

/* ---------- أزرار وحقول ---------- */
.btn { border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-2); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--brand); }
.btn.danger-ghost { background: transparent; border: 1.5px solid var(--bad-bg); color: var(--bad); }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn.sm { padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: wait; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; text-decoration: underline; padding: 0; }
label { display: block; font-weight: 700; color: var(--brand); margin-bottom: 12px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); margin: 0; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

.login { margin-top: 8vh; }
.login .btn.primary { width: 100%; margin-top: 4px; }
.demo-users { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 8px; }

/* ---------- الرئيسية ---------- */
.start .shift-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.start .shift-pick .bn { color: #f1e6dc; }
.list { display: grid; gap: 8px; }
.row-card { width: 100%; text-align: inherit; display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; margin: 0; }
.rc-main { display: grid; gap: 2px; } .rc-main span { color: var(--muted); font-size: .9rem; }
.rc-side { display: grid; justify-items: end; gap: 6px; }
.badge { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.chips { display: flex; gap: 4px; } .chips i { font-style: normal; font-size: .78rem; min-width: 26px; text-align: center; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.c-clean { background: var(--ok-bg); color: var(--ok); } .c-dirty { background: var(--bad-bg); color: var(--bad); } .c-na { background: #eee; color: #666; }

/* ---------- نموذج الفحص ---------- */
.form-head { }
.progress { height: 8px; background: var(--gold-soft); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.progress div { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.hint { background: var(--gold-soft); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; font-size: .9rem; }
.area { padding: 0; overflow: hidden; }
.area summary { padding: 14px 16px; cursor: pointer; font-weight: 800; color: var(--brand); display: flex; justify-content: space-between; align-items: center; list-style: none; }
.area summary::-webkit-details-marker { display: none; }
.area summary::after { content: "▾"; color: var(--gold); margin-inline-start: 8px; }
.area[open] summary::after { content: "▴"; }
.area[open] summary { border-bottom: 1px solid var(--line); }
.acount { margin-inline-start: auto; font-size: .8rem; padding: 2px 8px; border-radius: 99px; }
.acount.ok { background: var(--ok-bg); color: var(--ok); } .acount.warn { background: var(--warn-bg); color: var(--warn); }
.loc { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.loc:last-child { border-bottom: 0; }
.loc.done { background: #fbfdfb; } .loc.pending { background: var(--warn-bg); }
.loc.uploading { opacity: .6; pointer-events: none; }
.loc-name { font-weight: 700; margin-bottom: 8px; }
.loc-ctrl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.sbtn { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-weight: 700; min-width: 76px; }
.sbtn .bn { font-weight: 400; }
.sbtn.s-clean.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.sbtn.s-dirty.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.sbtn.s-na.on { background: #6b6b6b; border-color: #6b6b6b; color: #fff; }
.sbtn.on .bn { color: rgba(255,255,255,.85); }
.photo-btn { margin: 0; display: inline-block; cursor: pointer; color: var(--brand); }
.photo-btn input { display: none; }
.photo-btn > span { display: inline-block; border: 1.5px dashed var(--gold); background: var(--gold-soft); border-radius: 10px; padding: 6px 12px; font-weight: 700; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid var(--gold); }
.loc-warn { color: var(--warn); font-weight: 700; font-size: .88rem; margin-top: 6px; }
.loc-warn:empty { display: none; }
.finish textarea { resize: vertical; }
.sig-wrap { margin-bottom: 14px; }
.sig-label { display: flex; justify-content: space-between; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
#sig { width: 100%; height: 160px; background: #fff; border: 1.5px dashed var(--gold); border-radius: 10px; touch-action: none; }
.sig-old { max-width: 260px; max-height: 120px; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: block; margin: 6px 0; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; } .row-btns .btn { flex: 1; }

/* ---------- الإدارة ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { cursor: pointer; padding: 8px 16px; border-radius: 99px; text-decoration: none; color: var(--brand); font-weight: 700; background: #fff; border: 1px solid var(--line); }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.filters label { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; color: var(--brand); }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); } .stat.warn b { color: var(--warn); }
.stats.small .stat b { font-size: 1.2rem; }
.notes { background: var(--gold-soft); padding: 10px; border-radius: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: #fff; }
.tile img, .tile .nophoto { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #f1eeea; cursor: zoom-in; }
.tile .nophoto { cursor: default; }
.tile-cap { padding: 6px 8px; font-size: .85rem; display: grid; }
.tile-cap i { font-style: normal; font-weight: 700; }
.tile.s-clean { border-color: var(--ok); } .tile.s-clean i { color: var(--ok); }
.tile.s-dirty { border-color: var(--bad); } .tile.s-dirty i { color: var(--bad); }
.tile.s-na i, .tile.empty i { color: var(--muted); }
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 50; cursor: zoom-out; }
#lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 8px; }
.users { display: grid; gap: 8px; }
.user { display: grid; grid-template-columns: 1.6fr 1.2fr 1fr 1.2fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.user input, .user select { margin: 0; }
.u-mail { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 120px); background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 60; max-width: 90vw; text-align: center; border-bottom: 3px solid var(--gold); }
#toast.show { transform: translate(-50%, 0); } #toast.bad { background: var(--bad); border-color: #fff; }

@media (max-width: 640px) {
  .filters { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .user { grid-template-columns: 1fr 1fr; }
  .u-id { grid-column: span 2; }
}
.photo-btn > span .bn { display: inline; margin-inline-start: 4px; }

.who span small { display: block; color: var(--gold); font-size: .78rem; }
.switch { text-align: center; margin: 14px 0 0; }
.u-id { display: grid; gap: 2px; } .u-id .u-mail { padding-inline: 4px; }
.req { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.req:last-child { border-bottom: 0; }
.req-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--gold); color: var(--brand); border-radius: 99px; padding: 0 8px; font-size: .8rem; margin-inline-start: 4px; }
.tabs button.on .pill { background: #fff; }
.role-note { background: var(--gold-soft); color: var(--brand); font-weight: 700; padding: 8px 12px; border-radius: 10px; margin: 0 0 12px; }
.pending-card { text-align: center; }
.r-actions { display: flex; align-items: end; }
.report-head p { margin: 0; color: var(--muted); }
.rtable { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 6px 0 10px; }
.rtable th { background: var(--bg); color: var(--brand); text-align: right; padding: 6px 8px; }
.rtable td { border-top: 1px solid var(--line); padding: 6px 8px; }
.bad-t { color: var(--bad); margin-bottom: 2px; } .warn-t { color: var(--warn); }
@media print {
  .top, .demo-bar, .tabs, .no-print, .role-note, #toast { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; break-inside: avoid; }
}
/* مربعات الإحصائيات القابلة للضغط */
button.stat { font: inherit; width: 100%; cursor: pointer; transition: transform .1s, box-shadow .15s; }
button.stat:hover { box-shadow: 0 2px 6px rgba(69, 20, 37, .12); }
button.stat:active { transform: scale(.97); }
button.stat.active { border: 2px solid var(--brand); background: var(--gold-soft); }
.tile-cap small { font-size: .78rem; }
.tile-cap .link { justify-self: start; margin-top: 2px; font-size: .8rem; }
.drill { margin: 4px 0 12px; padding-top: 4px; border-top: 1px dashed var(--line); }
@media print { .drill { display: none !important; } }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; flex-shrink: 0; }
/* ---------------- تقرير PDF المفصّل ---------------- */
.x-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0; }
.x-checks label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; }
.x-checks input { width: auto; margin: 0; }
#xOut .r-actions, .card .r-actions { gap: 8px; flex-wrap: wrap; }
.x-report { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; color: #222; font-size: 13px; }
.x-head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  border-bottom: 4px solid var(--gold); padding-bottom: 12px; margin-bottom: 14px; }
.x-logo { height: 64px; width: auto; }
.x-title h1 { margin: 0; font-size: 20px; color: var(--brand); }
.x-title p { margin: 2px 0 0; color: #555; }
.x-meta { font-size: 12px; color: #444; line-height: 1.7; }
.x-sec { margin: 0 0 18px; }
.x-sec h2 { font-size: 16px; color: #fff; background: var(--brand); padding: 6px 12px; border-radius: 6px; margin: 0 0 8px; }
.x-sub { font-weight: 700; margin: 8px 0 2px; }
.x-list { margin: 0; padding-inline-start: 20px; }
.x-note { font-size: 11px; color: #777; margin: 4px 0 0; }
.x-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.x-table th { background: var(--gold-soft); color: var(--brand); font-weight: 700; }
.x-table th, .x-table td { border: 1px solid #ddd5cc; padding: 5px 8px; text-align: right; vertical-align: middle; }
.x-total td { background: #f6f3f0; font-weight: 700; }
.x-area { background: #faf8f6; font-weight: 700; color: var(--brand); }
.x-area-row { break-after: avoid; }
.st-clean { color: var(--ok); font-weight: 700; } .st-dirty { color: var(--bad); font-weight: 700; } .st-na { color: #888; }
.x-phc { width: 86px; padding: 3px !important; text-align: center !important; }
.x-th { width: 78px; height: 58px; object-fit: cover; border-radius: 4px; display: block; margin: auto; }
.x-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.x-card { margin: 0; border: 1px solid #ddd5cc; border-radius: 6px; overflow: hidden; break-inside: avoid; }
.x-card.bad { border-top: 3px solid var(--bad); }
.x-ph { width: 100%; height: 120px; object-fit: cover; display: block; }
.x-noph { height: 60px; display: grid; place-items: center; color: #999; background: #f4f1ee; }
.x-card figcaption { padding: 5px 7px; display: grid; gap: 1px; font-size: 11.5px; }
.x-card figcaption span { color: #666; }
.x-insp { border: 1px solid #ddd5cc; border-radius: 8px; padding: 10px; margin-bottom: 12px; }
.x-insp-head { border-bottom: 1px dashed #ddd5cc; padding-bottom: 6px; margin-bottom: 8px; line-height: 1.7; }
.x-insp-head h3 { margin: 0; font-size: 14.5px; color: var(--brand); }
.x-notes { background: #f6f3f0; padding: 6px 10px; border-radius: 6px; margin: 8px 0 0; }
.x-sig { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.x-sig img { height: 50px; border-bottom: 1px solid #ccc; }
.x-approve { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 16px; margin-top: 24px; padding-top: 14px;
  border-top: 2px solid var(--gold); break-inside: avoid; }
.x-approve > div { display: grid; gap: 14px; align-content: start; }
.x-line { display: block; border-bottom: 1px dotted #999; padding-bottom: 2px; min-height: 22px; color: #555; }
.x-stamp { border: 2px dashed #ccc; border-radius: 50%; height: 110px; display: grid !important; place-items: center; color: #aaa; }
.x-foot { text-align: center; font-size: 11px; color: #888; margin-top: 18px; border-top: 1px solid #eee; padding-top: 6px; }
@media (max-width: 640px) {
  .x-report { padding: 12px; } .x-head { grid-template-columns: auto 1fr; } .x-meta { grid-column: 1 / -1; }
  .x-grid { grid-template-columns: repeat(2, 1fr); } .x-approve { grid-template-columns: 1fr; }
  .x-table { font-size: 11.5px; } .x-table th, .x-table td { padding: 4px 5px; }
}
@media print {
  @page { size: A4; margin: 12mm 10mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  .x-report { border: 0; padding: 0; border-radius: 0; font-size: 11.5px; }
  .x-head { grid-template-columns: auto 1fr auto; } .x-meta { grid-column: auto; }
  .x-grid { grid-template-columns: repeat(4, 1fr); } .x-approve { grid-template-columns: 1fr 1fr 110px; }
  .x-sec h2 { break-after: avoid; }
  .x-table tr, .x-insp-head, .x-notes, .x-sig { break-inside: avoid; }
  .x-table thead { display: table-header-group; }
  .x-insp { break-inside: auto; }
}
/* اختيار نموذج الخدمة الغذائية */
.start .form-pick { display: grid; gap: 10px; margin-top: 10px; }
.start .form-pick .btn { display: grid; gap: 2px; text-align: center; }
.start .form-pick small { font-weight: 500; font-size: .82rem; color: #f1e6dc; }
.u-lead-l[hidden] { display: none !important; }
/* ---------------- لوحة التحكم: قائمة جانبية (النظافة / الخدمة الغذائية) ---------------- */
.admin-shell { display: flex; gap: 0; align-items: flex-start; max-width: 1120px; margin: 0 auto; }
.admin-shell > main { flex: 1; min-width: 0; max-width: 860px; }
.side { position: sticky; top: 12px; width: 210px; flex-shrink: 0; margin: 16px 14px 0 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; gap: 6px; }
.side-title { font-size: .8rem; color: var(--muted); font-weight: 700; padding: 2px 6px 4px; }
.side-btn { font: inherit; display: flex; align-items: center; gap: 10px; width: 100%; text-align: right; cursor: pointer;
  border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 10px 12px; color: var(--brand); font-weight: 700; }
.side-btn:hover { background: var(--gold-soft); }
.side-btn.on { background: var(--brand); color: #fff; }
.side-btn .pill { margin-inline-start: auto; }
.side-ic { font-size: 1.15rem; }
.mod-title { margin: 4px 0 10px; color: var(--brand); font-size: 1.25rem; }
@media (max-width: 860px) {
  .admin-shell { display: block; }
  .side { position: static; width: auto; margin: 12px 14px 0; display: flex; gap: 6px; padding: 6px; overflow-x: auto; }
  .side-title { display: none; }
  .side-btn { flex: 1; justify-content: center; padding: 9px 8px; white-space: nowrap; font-size: .92rem; }
}
@media print { .side, .mod-title { display: none !important; } .admin-shell { display: block; } }
@media (max-width: 480px) { .side .side-ic { display: none; } .side-btn { font-size: .88rem; padding: 9px 6px; } }

/* =====================================================================
   التصميم الجديد (معتمد) — IBM Plex Sans Arabic + هوية احتواء
   ===================================================================== */
:root {
  --bg: #F7F3EF; --line: #EADFD6; --line-2: #D9CCC2; --text: #241A1D; --muted: #5E5256; --soft: #FAF6F2;
  --ok: #1F7A4D; --ok-t: #165C39; --ok-bg: #E3F2EA; --ok-bd: #BFE0CD;
  --bad: #B3261E; --bad-t: #8E1D16; --bad-bg: #FBE7E5; --bad-bd: #F1C9C4;
  --warn: #8A5A00; --warn-t: #6E4700; --warn-bg: #FFF1D6; --warn-bd: #F0D69E;
  --tan: #F3E8DA; --radius: 16px;
}
body { font-family: "IBM Plex Sans Arabic", "Tajawal", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; line-height: 1.6; }
.top { border-bottom-width: 4px; padding: 12px 20px; }
.brand b { font-size: 1.1rem; font-weight: 700; }
.brand small { color: #E9D4B4; font-weight: 500; }
.who span { font-weight: 600; }
.who span small { color: #E9D4B4; }
.who .link { color: #fff; text-decoration: none; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 8px 14px; font-weight: 600; min-height: 40px; }
.card { border-radius: var(--radius); border-color: var(--line); box-shadow: none; }
h1, h2, h3 { font-weight: 700; }
.muted { color: var(--muted); }
label { color: #3B2F33; font-weight: 600; font-size: .88rem; }
input:not([type=checkbox]):not([type=file]), select, textarea { border: 1px solid var(--line-2); min-height: 44px; font-size: 1rem; }
.btn { border-radius: 12px; min-height: 44px; font-weight: 700; }
.btn.ghost { border: 1px solid var(--line-2); background: #fff; }
.btn.big { min-height: 56px; }

/* الإحصائيات */
.stats { gap: 14px; }
.stat { text-align: right; border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 6px; align-content: start; }
.stat .st-l { font-size: .88rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat b { font-size: 2rem; line-height: 1; color: var(--brand); }
.stat small { font-size: .8rem; color: var(--muted); }
.stat.ok .st-l::before { content: ""; width: 10px; height: 10px; border-radius: 99px; background: var(--ok); }
.stat.bad .st-l::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--bad); }
.stat.warn .st-l::before { content: ""; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--warn); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); } .stat.warn b { color: var(--warn); }
button.stat.active { border: 2px solid var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--tan); }
.stats.small .stat b { font-size: 1.4rem; }
.filters { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }

/* جدول الفحوصات */
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 10px; }
.list-head h3 { margin: 0; }
.itable { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ith, .itr { display: grid; grid-template-columns: 1.8fr 1.4fr 1.5fr 1.7fr 1.3fr; gap: 12px; align-items: center; padding: 12px 18px; }
.ith { background: var(--soft); font-size: .82rem; font-weight: 600; color: var(--muted); padding-block: 10px; }
.itr { width: 100%; border: 0; border-top: 1px solid #F2EAE3; background: #fff; text-align: right; cursor: pointer; font-size: .95rem; }
.itr:hover { background: #FDFAF7; }
.it-who { display: flex; align-items: center; gap: 10px; }
.av { width: 36px; height: 36px; border-radius: 99px; background: var(--tan); color: var(--brand); display: inline-grid; place-items: center; font-style: normal; font-weight: 700; flex-shrink: 0; }
.it-2 { display: grid; gap: 1px; } .it-2 small { color: var(--muted); font-size: .8rem; }
.it-res { display: flex; flex-wrap: wrap; gap: 6px; }
.it-res em, .chips i { font-style: normal; border-radius: 8px; padding: 3px 8px; font-size: .78rem; font-weight: 700; }
.r-ok, .c-clean { background: var(--ok-bg); color: var(--ok-t); } .r-bad, .c-dirty { background: var(--bad-bg); color: var(--bad-t); }
.st { justify-self: start; border-radius: 99px; padding: 4px 12px; font-size: .78rem; font-weight: 700; white-space: nowrap; border: 1px solid; }
.st-sent { background: var(--ok-bg); color: var(--ok-t); border-color: var(--ok-bd); }
.st-issue { background: var(--bad-bg); color: var(--bad-t); border-color: var(--bad-bd); }
.st-draft { background: var(--warn-bg); color: var(--warn-t); border-color: var(--warn-bd); }
.badge.ok { background: var(--ok-bg); color: var(--ok-t); } .badge.warn { background: var(--warn-bg); color: var(--warn-t); }
.empty-note { padding: 18px; text-align: center; }
@media (max-width: 760px) {
  .ith { display: none; }
  .itable { background: transparent; border: 0; display: grid; gap: 10px; }
  .itr { grid-template-columns: 1fr auto; grid-template-areas: "who st" "a b" "res res"; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; row-gap: 8px; }
  .it-who { grid-area: who; } .itr .st { grid-area: st; justify-self: end; }
  .itr .it-2:nth-of-type(2) { grid-area: a; } .itr .it-2:nth-of-type(3) { grid-area: b; text-align: left; }
  .it-res { grid-area: res; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: span 2; }
}

/* نظرة عامة */
.sec-h { margin: 18px 0 10px; font-size: 1.05rem; }
.ov-head p { margin: 0; }
.ov-alerts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ov-alert { text-align: right; background: #fff; border: 1px solid var(--line); border-top-width: 4px; border-radius: 14px; padding: 14px; display: grid; gap: 4px; cursor: pointer; }
.ov-alert b { font-size: 1.9rem; line-height: 1; } .ov-alert span { font-weight: 700; } .ov-alert small { color: var(--muted); font-size: .8rem; }
.a-bad { border-color: var(--bad-bd); border-top-color: var(--bad); } .a-bad b { color: var(--bad); }
.a-warn { border-color: var(--warn-bd); border-top-color: var(--warn); } .a-warn b { color: var(--warn); }
.a-gold { border-top-color: var(--gold); } .a-gold b { color: var(--brand); }
.ov-depts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ov-dept { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; align-content: start; }
.ov-dh { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ov-dh small { color: var(--muted); font-weight: 600; } .ov-dh h3 { margin: 0; }
.ov-rate { display: flex; align-items: baseline; gap: 8px; } .ov-rate b { font-size: 2.1rem; color: var(--ok); line-height: 1; } .ov-rate span { color: var(--muted); font-size: .88rem; }
.ov-dept .progress { margin: 0; background: #F0E7DF; }
.ov-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: .78rem; color: var(--muted); }
.ov-mini span { background: var(--soft); border-radius: 10px; padding: 8px; display: grid; gap: 2px; }
.ov-mini b { font-size: 1.15rem; color: var(--text); }
.ov-mini .m-bad { background: var(--bad-bg); color: var(--bad-t); } .ov-mini .m-bad b { color: var(--bad-t); }
.ov-mini .m-warn { background: var(--warn-bg); color: var(--warn-t); } .ov-mini .m-warn b { color: var(--warn-t); }
.ov-extra { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.8; }
.ov-feed { margin-top: 18px; padding: 0; overflow: hidden; } .ov-feed .list-head { margin: 0; padding: 14px 18px; border-bottom: 1px solid #EFE6DE; }
.feed-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 18px; border: 0; border-top: 1px solid #F2EAE3; background: #fff; text-align: right; cursor: pointer; }
.feed-row:first-of-type { border-top: 0; }
.f-t { color: var(--muted); font-size: .82rem; min-width: 62px; } .f-d { background: var(--tan); color: var(--brand); border-radius: 8px; padding: 2px 9px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.f-w { flex: 1; }
@media (max-width: 900px) { .ov-alerts { grid-template-columns: 1fr 1fr; } .ov-depts { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .feed-row { flex-wrap: wrap; } .f-w { flex-basis: 100%; order: 3; } }

/* العامل */
.hello { margin: 4px 0 14px; } .hello h1 { margin: 0; font-size: 1.5rem; } .hello p { margin: 2px 0 0; }
.draft-alert { background: #FFF8EC; border: 1px solid var(--warn-bd); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px; margin-bottom: 12px; color: var(--warn-t); }
.draft-alert .link { justify-self: start; font-weight: 700; color: var(--brand); text-decoration: none; }
.start h2 { margin-bottom: 12px; }
.start .shift-pick { gap: 10px; }
.shift-btn { display: grid; justify-items: center; gap: 4px; min-height: 96px; font-size: 1.02rem; }
.shift-btn .sh-ic { font-size: 1.4rem; line-height: 1; }
.btn.ghost.shift-btn { border: 2px solid var(--brand); color: var(--brand); }
.btn.ghost.shift-btn .bn { color: var(--muted); }
.row-card { border-radius: 14px; padding: 12px 14px; }

/* نموذج الفحص */
.form-head .progress { height: 8px; background: #F0E7DF; }
.area { border-radius: var(--radius); }
.area summary { background: var(--soft); }
.loc.done { background: #F6FBF8; } .loc.pending { background: #FFF8F7; }
.loc-warn { color: var(--bad-t); }
.sbtn { min-height: 44px; border-radius: 10px; border: 1px solid var(--line-2); flex: 1; }
.sbtn.s-clean { color: var(--ok-t); } .sbtn.s-dirty { color: var(--bad-t); } .sbtn.s-na { color: var(--muted); font-weight: 600; }
.sbtn.s-clean.on, .sbtn.s-dirty.on, .sbtn.s-na.on { color: #fff; }
.sbtns { flex: 1 1 260px; }
.thumb { border-color: var(--ok); }
.actionbar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; background: #fff; border-top: 1px solid var(--line);
  margin: 12px -14px -60px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.actionbar #submitBtn { flex: 2; min-height: 52px; font-size: 1.05rem; } .actionbar #backBtn { flex: 1; min-height: 52px; }
.admin-shell > main { max-width: 1060px; }
.filters label { min-width: 0; }
.filters input, .filters select { width: 100%; min-width: 0; max-width: 100%; }
.btn.primary .bn { color: #E9D4B4; }
.side { scrollbar-width: none; }
/* اعتماد طلبات التسجيل */
.req.appr { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 14px 0; }
.appr-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; align-items: end; }
.appr-fields label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; min-width: 0; }
.appr-fields select, .appr-fields input:not([type=checkbox]) { width: 100%; min-width: 0; }
.appr-fields label.inline { flex-direction: row; align-items: center; gap: 6px; }

/* =====================================================================
   تصميم «رسمي فخم» — نسخة تجريبية
   ===================================================================== */
:root { --pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2256%22%20height%3D%2256%22%20viewBox%3D%220%200%2056%2056%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23B78E55%22%20stroke-width%3D%221%22%3E%3Cpath%20d%3D%22M28%208l5.9%2014.1L48%2028l-14.1%205.9L28%2048l-5.9-14.1L8%2028l14.1-5.9z%22/%3E%3Cpath%20d%3D%22M14%2014h28v28H14z%22%20transform%3D%22rotate%2845%2028%2028%29%22/%3E%3Cpath%20d%3D%22M14%2014h28v28H14z%22/%3E%3Ccircle%20cx%3D%2228%22%20cy%3D%2228%22%20r%3D%224%22/%3E%3Cpath%20d%3D%22M0%200l8%208M56%200l-8%208M0%2056l8-8M56%2056l-8-8%22/%3E%3C/g%3E%3C/svg%3E"); --gold-2: #D4B483; --shadow: 0 1px 2px rgba(69,20,37,.06), 0 8px 24px -12px rgba(69,20,37,.18); }
body { background:
  radial-gradient(1200px 400px at 100% -10%, rgba(183,142,85,.10), transparent 60%),
  var(--bg); }

/* الهيدر: زخرفة هندسية + خط ذهبي مزدوج */
.top { position: sticky; background: linear-gradient(135deg, #3A0F1E 0%, var(--brand) 55%, #5A1B31 100%); border-bottom: 0;
  box-shadow: 0 2px 0 var(--gold), 0 5px 0 -1px rgba(183,142,85,.35); }
.top::before { content: ""; position: absolute; inset: 0; background-image: var(--pattern); background-size: 56px; opacity: .13; pointer-events: none; }
.top > * { position: relative; }
.brand img { height: 42px; filter: none; background: #fff; border-radius: 12px; padding: 4px 6px; box-shadow: 0 0 0 2px rgba(183,142,85,.6); }
.brand b { letter-spacing: .2px; }

/* البطاقات */
.card, .ov-dept, .ov-alert, .stat, .itable, .side { box-shadow: var(--shadow); }
.card { position: relative; border-color: #EBDFD3; }
.card.start::before, .ov-dept::before { content: ""; position: absolute; inset: 0 18px auto; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.ov-dept { position: relative; }

/* عناوين الأقسام بزخرفة ذهبية */
.sec-h, .list-title, .list-head h3 { display: flex; align-items: center; gap: 10px; }
.sec-h::before, .list-title::before { content: ""; width: 10px; height: 10px; transform: rotate(45deg); background: var(--gold); border-radius: 2px;
  box-shadow: 0 0 0 3px rgba(183,142,85,.2); flex-shrink: 0; }
.sec-h::after, .list-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }

/* ترحيب العامل: بانر */
.hello.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 22px 22px 24px; margin: 4px 0 16px; color: #fff;
  background: linear-gradient(135deg, var(--brand), #6A2139); box-shadow: var(--shadow); }
.hello.hero::before { content: ""; position: absolute; inset: 0; background-image: var(--pattern); background-size: 64px; opacity: .16; }
.hello.hero::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; left: -50px; bottom: -80px;
  border: 26px solid rgba(183,142,85,.22); }
.hello.hero > * { position: relative; z-index: 1; }
.hello.hero h1 { color: #fff; font-size: 1.6rem; }
.hello.hero p.muted { color: #EAD7BC; }
.hello.hero .bn { color: #EAD7BC; }

/* أزرار الفترات */
.shift-btn { min-height: 112px; border-radius: 16px; position: relative; overflow: hidden; }
.shift-btn .sh-ic svg { width: 34px; height: 34px; }
.btn.primary.shift-btn { background: linear-gradient(160deg, #5A1B31, var(--brand)); }
.btn.primary.shift-btn .sh-ic { color: var(--gold-2); }
.btn.ghost.shift-btn { background: #FFFDFB; }
.btn.ghost.shift-btn .sh-ic { color: var(--brand); }
.shift-btn:hover { transform: translateY(-1px); } .shift-btn { transition: transform .15s, box-shadow .15s; }
.start .form-pick .btn { border-radius: 16px; background: linear-gradient(160deg, #5A1B31, var(--brand)); }

/* الحالات الفاضية */
.empty-st { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 26px 16px; color: var(--muted);
  border: 1.5px dashed var(--line-2); border-radius: 16px; background: rgba(255,255,255,.6); }
.empty-st svg { width: 46px; height: 46px; color: var(--gold); padding: 10px; background: var(--gold-soft); border-radius: 14px; box-sizing: content-box; }
.empty-st p { margin: 0; font-weight: 500; }

/* القائمة الجانبية */
.side-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--gold-soft); color: var(--brand); }
.side-ic svg { width: 18px; height: 18px; }
.side-btn.on .side-ic { background: rgba(255,255,255,.14); color: var(--gold-2); }
.side-btn.on { background: linear-gradient(135deg, var(--brand), #5E1D33); box-shadow: inset 0 -2px 0 var(--gold); }
@media (max-width: 480px) { .side .side-ic { display: inline-grid; width: 26px; height: 26px; } }

/* الإحصائيات والتنبيهات */
.ov-alert { transition: transform .15s, box-shadow .15s; } .ov-alert:hover { transform: translateY(-2px); }
.ov-rate b { font-size: 2.4rem; }
.progress div { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.ov-dept .progress div { background: linear-gradient(90deg, #1F7A4D, #3AA571); }

/* شاشة الدخول: لوحة هوية + نموذج */
main.auth-wrap { max-width: 980px; margin: 0 auto; padding: 40px 16px 60px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; align-items: stretch; }
.auth-brand { position: relative; overflow: hidden; color: #fff; border-radius: 22px 0 0 22px; padding: 38px 34px;
  background: linear-gradient(150deg, #3A0F1E, var(--brand) 60%, #6A2139); display: grid; align-content: center; gap: 14px; }
[dir=rtl] .auth-brand { border-radius: 0 22px 22px 0; }
.auth-brand::before { content: ""; position: absolute; inset: 0; background-image: var(--pattern); background-size: 64px; opacity: .14; }
.auth-brand::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; left: -90px; bottom: -110px; border: 34px solid rgba(183,142,85,.2); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo { width: 92px; height: auto; background: #fff; border-radius: 18px; padding: 10px; box-shadow: 0 0 0 3px rgba(183,142,85,.55); }
.auth-brand h2 { color: #fff; font-size: 1.7rem; margin: 6px 0 0; }
.auth-brand p { color: #EAD7BC; margin: 0; }
.auth-brand ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.auth-brand li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.auth-brand li svg { width: 20px; height: 20px; padding: 8px; box-sizing: content-box; border-radius: 12px; background: rgba(255,255,255,.1); color: var(--gold-2);
  border: 1px solid rgba(183,142,85,.45); }
main.auth-wrap .login { margin: 0; border-radius: 22px 0 0 22px; padding: 34px 30px; display: grid; align-content: center; border-color: #EBDFD3; }
main.auth-wrap .login h1 { font-size: 1.6rem; }
main.auth-wrap .login h1::after { content: ""; display: block; width: 48px; height: 3px; background: var(--gold); border-radius: 3px; margin-top: 10px; }
.login .btn.primary { min-height: 50px; background: linear-gradient(135deg, var(--brand), #5E1D33); box-shadow: 0 6px 16px -8px rgba(69,20,37,.7); }
@media (max-width: 760px) {
  main.auth-wrap { grid-template-columns: 1fr; padding: 16px 14px 50px; }
  .auth-brand, [dir=rtl] .auth-brand { border-radius: 20px 20px 0 0; padding: 24px 22px; gap: 10px; }
  .auth-brand ul { display: none; } .auth-logo { width: 68px; } .auth-brand h2 { font-size: 1.35rem; }
  main.auth-wrap .login { border-radius: 0 0 20px 20px; padding: 22px 18px; }
}
@media print { .top::before, .hello.hero::before { display: none; } }

/* عبارة اليوم + رسالة الشكر */
.phrase { margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(183,142,85,.45);
  border-inline-start: 4px solid var(--gold); max-width: 560px; }
.phrase small { display: block; color: var(--gold-2); font-weight: 700; font-size: .78rem; letter-spacing: .3px; }
.phrase p { margin: 2px 0 0; color: #fff; font-weight: 600; font-size: 1.02rem; line-height: 1.6; }
.auth-brand .phrase p { font-size: 1.08rem; }
.thanks { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(36,26,29,.55);
  animation: thIn .2s ease-out; }
.thanks-card { position: relative; overflow: hidden; width: min(380px, 100%); text-align: center; border-radius: 24px; padding: 30px 24px 22px;
  color: #fff; background: linear-gradient(150deg, #3A0F1E, var(--brand) 60%, #6A2139); box-shadow: 0 20px 50px -10px rgba(0,0,0,.5);
  animation: thPop .35s cubic-bezier(.2,1.4,.4,1); }
.thanks-card::before { content: ""; position: absolute; inset: 0; background-image: var(--pattern); background-size: 64px; opacity: .14; }
.thanks-card > * { position: relative; }
.thanks-ic { width: 72px; height: 72px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(183,142,85,.18); border: 2px solid var(--gold); color: var(--gold-2); }
.thanks-ic svg { width: 36px; height: 36px; }
.thanks-card h2 { color: #fff; font-size: 1.35rem; line-height: 1.5; margin: 0 0 6px; }
.thanks-card p { color: #EAD7BC; margin: 0 0 18px; }
.thanks-card .btn { width: 100%; background: var(--gold); color: var(--brand); min-height: 48px; }
@keyframes thIn { from { opacity: 0; } } @keyframes thPop { from { transform: scale(.85); opacity: 0; } }
.admin-shell .hello.hero { margin-top: 0; }

/* لوحة الدخول: محتوى في المنتصف */
.auth-brand { justify-items: center; text-align: center; }
.auth-brand .phrase { border-inline-start: 1px solid rgba(183,142,85,.45); border-top: 3px solid var(--gold); text-align: center; width: 100%; box-sizing: border-box; }
.auth-brand ul { justify-items: center; }
.auth-brand li { justify-content: center; }
.photo-btn span { display: inline-flex; align-items: center; gap: 6px; }
.photo-btn span svg { width: 18px; height: 18px; }
