/* نظام الموارد البشرية: واجهة عربية (RTL)
   فكرة التصميم: لوحة دوام ورقية هادئة، والألوان القوية محجوزة لأنواع الشفتات فقط
   حتى يُقرأ الجدول بنظرة واحدة. */

:root {
  --paper: #f1f3f2;
  --surface: #ffffff;
  --ink: #17262b;
  --muted: #5d6d73;
  --faint: #8a979b;
  --line: #d6dddf;
  --line-strong: #bcc7ca;
  --petrol: #0e4f5c;
  --petrol-hover: #0a3d48;
  --rail: #0f3d48;
  --rail-hover: #164b58;
  --rail-active: #1b5967;
  --rail-text: #d4e3e6;
  --mint: #7fe0c3;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --ok: #1f7a4d;
  --ok-bg: #e6f5ec;
  --warn: #8a5a00;
  --warn-bg: #fff3d1;
  --off: #e6ebec;
  --radius: 8px;
  --font: "Segoe UI", "SF Arabic", "Noto Sans Arabic", "Geeza Pro", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--petrol); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* ---------- الهيكل ---------- */
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--rail);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail-brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.rail-brand strong { display: block; color: #fff; font-size: 17px; line-height: 1.35; }
.rail-brand span { font-size: 13px; color: #9fbcc2; }
.rail nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.rail nav a {
  display: block;
  padding: 10px 20px;
  color: var(--rail-text);
  text-decoration: none;
  border-inline-start: 3px solid transparent;
}
.rail nav a:hover { background: var(--rail-hover); }
.rail nav a[aria-current="page"] { background: var(--rail-active); border-inline-start-color: var(--mint); color: #fff; font-weight: 600; }
.rail nav a:focus-visible { outline-color: var(--mint); outline-offset: -2px; }
.rail-user { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 14px; }
.rail-user .who { color: #fff; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user .role { color: #9fbcc2; font-size: 13px; }
.rail-user .links { margin-top: 8px; display: flex; gap: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--rail-text); text-decoration: underline; cursor: pointer; font-size: 13px; }
.linkbtn:hover { color: #fff; }
.linkbtn:focus-visible { outline-color: var(--mint); }

.main { padding: 26px 32px 60px; min-width: 0; }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }

.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 23px; line-height: 1.3; font-weight: 700; }
.page-head .count { color: var(--muted); font-size: 15px; font-weight: 400; margin-inline-start: 6px; }
.page-head .spacer { flex: 1; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- أزرار وحقول ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 6px 16px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: #f3f6f6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn-primary:hover { background: var(--petrol-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1d17; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--petrol); padding-inline: 8px; }
.btn-quiet:hover { background: #e4ecee; }
.btn-sm { min-height: 30px; padding: 2px 10px; font-size: 14px; }

input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time],
input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--petrol); outline-offset: 0; border-color: var(--petrol); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--petrol); }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
input.ltr, .ltr { direction: ltr; text-align: start; }
html[dir=rtl] input.ltr { text-align: right; }
.tools input[type=search] { width: 230px; }
.tools select { width: auto; min-width: 150px; }
.tools input[type=date] { width: auto; }

.field { display: block; margin-bottom: 14px; }
.field > .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field .req { color: var(--danger); margin-inline-start: 3px; }
.field .hint { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; }
.fieldset { border: 0; border-top: 1px solid var(--line); margin: 6px 0 14px; padding: 12px 0 0; }
.fieldset > .legend { font-weight: 700; font-size: 14px; margin-bottom: 10px; display: block; }

/* ---------- جداول ---------- */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: start; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 14px; background: #f7f9f9; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 10px 14px; border-bottom: 1px solid #e8edee; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: #f6f9f9; }
table.data tr.inactive td { color: var(--faint); }
table.data td.actions { white-space: nowrap; text-align: end; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 13px; background: var(--off); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }

.chip { display: inline-flex; align-items: center; gap: 7px; padding: 2px 11px 2px 9px; border-radius: 999px; background: #eef2f2; font-size: 14px; white-space: nowrap; }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--faint)); display: inline-block; }

/* ---------- الموظفون: قائمة الأقسام + الجدول ---------- */
.split { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.deptlist { list-style: none; margin: 0; padding: 0; }
.deptlist li { margin-bottom: 2px; }
.deptlist button.dept {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: none; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; text-align: start;
  border-inline-start: 3px solid transparent;
}
.deptlist button.dept:hover { background: #e4eaea; }
.deptlist button.dept[aria-current="true"] { background: #fff; border-inline-start-color: var(--petrol); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.deptlist .n { color: var(--muted); font-size: 13px; }
.deptfoot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

.person { display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #dbe7e9; color: var(--petrol); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.person .nm { font-weight: 600; }
.person .jt { color: var(--muted); font-size: 13px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.later { color: var(--muted); font-size: 13px; background: #f3f6f6; border-radius: 6px; padding: 8px 12px; margin-top: 14px; }

/* ---------- جدول الدوام (لوحة الفرشاة) ---------- */
.brush { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.brush .lead { font-weight: 600; font-size: 14px; margin-inline-end: 4px; }
.brush button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer;
}
.brush button i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); display: inline-block; border: 1px solid rgba(0, 0, 0, .12); }
.brush button small { color: var(--muted); font-size: 12px; }
.brush button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; background: #fff; }
.brush button:hover { background: #f6f9f9; }
.brush .hintline { flex-basis: 100%; color: var(--muted); font-size: 13px; }

.roster { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 290px); min-height: 200px; }
.roster table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; table-layout: fixed; }
.roster th, .roster td { padding: 4px; border-bottom: 1px solid #e8edee; border-inline-end: 1px solid #eef2f2; background: var(--surface); }
.roster thead th { position: sticky; top: 0; z-index: 3; background: #f7f9f9; font-weight: 600; font-size: 13px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.roster .c-name { width: 210px; position: sticky; inset-inline-start: 0; z-index: 2; text-align: start; padding: 4px 12px; box-shadow: 1px 0 0 var(--line); }
.roster thead .c-name { z-index: 4; }
.roster .c-total { width: 78px; text-align: center; font-size: 13px; color: var(--muted); }
.roster .grp td { background: #eef3f3; font-weight: 700; font-size: 13px; color: var(--petrol); padding: 5px 12px; position: sticky; inset-inline-start: 0; }
.roster .dayhead { width: auto; }
.roster .dayhead button { all: unset; display: block; width: 100%; cursor: pointer; text-align: center; padding: 2px 0; border-radius: 4px; }
.roster .dayhead button:hover { background: #e4ecee; }
.roster .dayhead button:focus-visible { outline: 2px solid var(--petrol); }
.roster .dayhead .dn { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.roster .dayhead.today { background: #e5f2ef; box-shadow: inset 0 3px 0 var(--petrol); }
.roster .dayhead.past button { color: var(--faint); }
.roster .rowname { all: unset; cursor: pointer; display: block; width: 100%; }
.roster .rowname:hover .nm { text-decoration: underline; }
.roster .rowname:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }
.roster .rowname .nm { font-weight: 600; font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster .rowname .cd { font-size: 12px; color: var(--muted); }
.roster td.today { background: #f2f9f7; }

.cell {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 44px;
  border: 1px solid transparent; border-radius: 6px; font-size: 13px; cursor: pointer; text-align: center; padding: 0 4px;
  user-select: none; position: relative; line-height: 1.2;
}
.cell.unplanned { border: 1px dashed var(--line-strong); color: var(--faint); background: transparent; }
.cell.off { background: var(--off); color: var(--muted); background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgba(0, 0, 0, .045) 7px 9px); }
.cell.shift { background: var(--c); color: var(--t, #fff); font-weight: 600; }
.cell.pending::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px #fff; }
.cell.pending { outline: 2px solid var(--ink); outline-offset: -2px; }
.cell:disabled { cursor: not-allowed; opacity: .55; }
.cell:not(:disabled):hover { filter: brightness(.94); }
.cell:focus-visible { outline: 3px solid var(--petrol); outline-offset: 1px; z-index: 1; }

.savebar {
  position: sticky; bottom: 14px; margin-top: 14px; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
}
.savebar .grow { flex: 1; }
.savebar .btn { border-color: rgba(255, 255, 255, .35); background: transparent; color: #fff; }
.savebar .btn:hover { background: rgba(255, 255, 255, .12); }
.savebar .btn-primary { background: var(--mint); border-color: var(--mint); color: var(--ink); font-weight: 700; }
.savebar .btn-primary:hover { background: #99ecd2; }

.weeknav { display: inline-flex; align-items: center; gap: 4px; }
.weeknav .range { min-width: 190px; text-align: center; font-weight: 600; }

/* ---------- حوارات وإشعارات ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 33, 38, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; z-index: 50; }
.dialog { background: var(--surface); border-radius: 10px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog.wide { max-width: 760px; }
.dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog > header h2 { font-size: 18px; }
.dialog .x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 8px; border-radius: 6px; }
.dialog .x:hover { background: #eef2f2; }
.dialog-body { padding: 18px 20px 6px; }
.dialog > footer { display: flex; justify-content: flex-start; gap: 10px; padding: 14px 20px 18px; }
.formerr { background: var(--danger-bg); color: var(--danger); border-radius: 6px; padding: 8px 12px; margin-bottom: 14px; font-size: 14px; }

.toasts { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; pointer-events: none; }
html[dir=rtl] .toasts { transform: translateX(50%); }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: min(520px, 92vw); pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- الدخول ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 440px); }
.login-art { background: var(--rail); color: #fff; padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.login-art h1 { font-size: 34px; line-height: 1.35; max-width: 14em; }
.login-art p { color: #b5ced3; max-width: 28em; }
.mini-roster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 420px; direction: rtl; }
.mini-roster span { height: 30px; border-radius: 6px; background: var(--c); opacity: .95; }
.mini-roster span.off { background: rgba(255, 255, 255, .13); }
.login-form { padding: 56px 40px; display: flex; flex-direction: column; justify-content: center; background: var(--paper); }
.login-form h2 { font-size: 22px; margin-bottom: 20px; }
.login-form .btn { width: 100%; min-height: 44px; margin-top: 6px; }
.login-form .switch { margin-top: 14px; font-size: 14px; }

/* ---------- صلاحيات المستخدم ---------- */
.permgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.deptpick { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* ---------- سجل التدقيق ---------- */
.diffs { font-size: 13px; color: var(--muted); }
.diffs b { color: var(--ink); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 12px; padding: 12px 4px; color: var(--muted); }

/* ---------- شاشات صغيرة ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; }
  .rail-brand { padding: 12px 16px; display: flex; align-items: baseline; gap: 10px; border-bottom: 0; }
  .rail nav { display: flex; overflow-x: auto; padding: 0; }
  .rail nav a { white-space: nowrap; padding: 10px 14px; border-inline-start: 0; border-bottom: 3px solid transparent; }
  .rail nav a[aria-current="page"] { border-bottom-color: var(--mint); }
  .rail-user { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; }
  .rail-user .links { margin: 0; }
  .main { padding: 18px 14px 50px; }
  .split { grid-template-columns: 1fr; }
  .deptlist { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
  .deptlist li { flex: none; margin: 0; }
  .deptlist button.dept { border: 1px solid var(--line); background: #fff; border-radius: 999px; }
  .deptfoot { flex-direction: row; border-top: 0; margin: 4px 0 0; padding: 0; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 22px; }
  .login-art h1 { font-size: 24px; }
  .login-form { padding: 28px 22px 40px; }
  .grid2, .permgrid { grid-template-columns: 1fr; }
  .tools input[type=search] { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 8px; }
  .roster { max-height: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .dialog { animation: pop .14s ease-out; }
  @keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media print {
  .rail, .tools, .brush, .savebar { display: none !important; }
  .app { display: block; }
  .roster { max-height: none; overflow: visible; }
}

/* ---------- شاشة الموظف (هاتف) ---------- */
body:has(.emp) { background: #e9eeee; }
.emp { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--paper); display: flex; flex-direction: column; box-shadow: 0 0 0 1px var(--line); }
.emp-head { background: var(--rail); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 18px 14px; }
.emp-head strong { font-size: 17px; }
.emp-sub { color: #9fbcc2; font-size: 14px; }
.emp-main { flex: 1; padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }
.emp-tabs { position: fixed; bottom: 0; inset-inline: 0; max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.emp-tabs a { text-align: center; padding: 14px 4px; text-decoration: none; color: var(--muted); font-size: 14px; border-top: 3px solid transparent; }
.emp-tabs a[aria-current="page"] { color: var(--petrol); font-weight: 700; border-top-color: var(--petrol); }
.emp-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 18px 18px; text-align: center; margin-bottom: 12px; }
.emp-clock { font-size: 54px; font-weight: 700; line-height: 1.1; letter-spacing: 1px; color: var(--ink); }
.emp-date { color: var(--muted); margin: 2px 0 14px; }
.emp-loc { border-radius: 8px; padding: 8px 12px; font-size: 14px; background: #eef2f2; color: var(--muted); margin-bottom: 14px; }
.emp-loc.ok { background: var(--ok-bg); color: var(--ok); }
.emp-loc.bad { background: var(--danger-bg); color: var(--danger); }
.emp-loc.warn { background: var(--warn-bg); color: var(--warn); }
.emp-punch { width: 100%; min-height: 62px; border: 0; border-radius: 14px; font-size: 20px; font-weight: 700; background: var(--petrol); color: #fff; cursor: pointer; }
.emp-punch.out { background: #c2570c; }
.emp-punch:disabled { background: #b9c4c6; color: #fff; cursor: not-allowed; }
.emp-punch:not(:disabled):active { transform: scale(.985); }
.emp-note { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 0; }
.emp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.emp-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.emp-k { font-weight: 700; font-size: 14px; color: var(--muted); }
.emp-shift { font-size: 15px; }
.emp-warn { margin-top: 8px; color: var(--warn); font-size: 14px; }
.emp-path { list-style: none; margin: 0; padding: 0; }
.emp-path li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid #eef2f2; }
.emp-path li:last-child { border-bottom: 0; }
.emp-path .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.emp-path .dot.out { background: #c2570c; }
.emp-src { color: var(--faint); font-size: 12px; }
.emp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.emp-stats .stat { background: #f3f6f6; border-radius: 10px; padding: 10px 4px; }
.emp-stats .stat b { display: block; font-size: 24px; line-height: 1.2; }
.emp-stats .stat span { font-size: 13px; color: var(--muted); }
.emp-stats .stat.ok b { color: var(--ok); }
.emp-stats .stat.warn b { color: var(--warn); }
.emp-stats .stat.danger b { color: var(--danger); }
.emp-list { list-style: none; margin: 0; padding: 0; }
.emp-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eef2f2; }
.emp-list li:last-child { border-bottom: 0; }
.emp-list li.today { background: #f2f9f7; margin-inline: -16px; padding-inline: 16px; }

/* الإشعارات والطلبات */
.bell { position: relative; background: transparent; border: 0; color: inherit; font-size: 20px; cursor: pointer; padding: 6px 8px; line-height: 1; }
.bell-n { position: absolute; top: 0; inset-inline-start: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-n[hidden] { display: none; }
.bellrow { margin-top: 6px; }
.emp-head { display: flex; align-items: center; justify-content: space-between; }
.notif-list { list-style: none; margin: 0; padding: 0; min-width: min(420px, 80vw); }
.notif-list li { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.notif-list li.unread { background: var(--warn-bg); border-radius: 6px; padding-inline: 10px; }
.notif-list a { color: inherit; text-decoration: none; display: block; }
.reqs .reqside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.emp-tabs a { font-size: 13px; }

/* كشف الراتب */
.slip { min-width: min(440px, 78vw); }
.slip-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; }
.slip-meta { font-size: 13px; margin: 2px 0 12px; }
.slip-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; text-align: center; }
.slip-days div { background: #f3f6f6; border-radius: 8px; padding: 8px 2px; }
.slip-days b { display: block; font-size: 18px; }
.slip-days span { font-size: 12px; color: var(--muted); }
.slip-table { width: 100%; border-collapse: collapse; }
.slip-table td { padding: 8px 4px; border-bottom: 1px solid #e8edee; }
.slip-table td.amt { text-align: end; }
.slip-table tr.net td { font-size: 18px; font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
table.data tfoot td { padding: 10px 14px; font-weight: 600; background: #f7f9f9; border-top: 1px solid var(--line); }
@media print {
  body.print-slip .app, body.print-slip .emp, body.print-slip .toasts { display: none !important; }
  body.print-slip .overlay { position: static; background: none; display: block; }
  body.print-slip .dialog { box-shadow: none; max-width: none; }
  body.print-slip .dialog header .x, body.print-slip .dialog footer { display: none; }
}

/* لوحة التحكم والتقارير */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; border-inline-start: 4px solid var(--line-strong); }
.kpi b { font-size: 30px; line-height: 1.2; }
.kpis.small .kpi { padding: 8px 14px; flex-direction: row; align-items: center; gap: 10px; }
.kpis.small .kpi b { font-size: 20px; margin-inline-start: auto; }
.kpi-l { color: var(--muted); font-size: 14px; }
.kpi-s { color: var(--faint); font-size: 12px; }
.kpi.ok { border-inline-start-color: var(--ok); } .kpi.ok b { color: var(--ok); }
.kpi.warn { border-inline-start-color: #d98e04; } .kpi.warn b { color: var(--warn); }
.kpi.danger { border-inline-start-color: var(--danger); } .kpi.danger b { color: var(--danger); }
.kpi.leave { border-inline-start-color: #4263eb; } .kpi.leave b { color: #364fc7; }
a.kpi:hover { background: #f7f9f9; }
.dash-grid { display: grid; grid-template-columns: 340px 1fr; gap: 12px; margin-bottom: 12px; }
.dash-grid.two { grid-template-columns: 1fr 1fr; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend b { margin-inline-start: auto; padding-inline-start: 14px; }
.deptbars, .watch { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.deptbars .row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bar { height: 8px; background: #e6ebec; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--petrol); border-radius: 4px; }
.watch { gap: 8px; }
.watch li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid #e8edee; }
.okc { color: var(--ok); font-weight: 600; } .dangerc { color: var(--danger); font-weight: 600; }
@media (max-width: 860px) { .dash-grid, .dash-grid.two { grid-template-columns: 1fr; } }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

.mypunch { max-width: 520px; }

/* الزمنية المأذونة */
.perm-card { border-inline-start: 4px solid var(--ok); }
.perm-card.on { border-inline-start-color: #c2570c; background: #fff8f1; }
.perm-line { padding: 4px 0 10px; }
.perm-line + .perm-line { border-top: 1px solid #eef2f2; padding-top: 10px; }
.perm-line.done, .perm-line.expired, .perm-line.left { opacity: .7; }
.perm-start { width: 100%; min-height: 48px; font-size: 17px; margin-top: 4px; }
