:root{
  --bg:#eef2f5; --surface:#ffffff; --surface-2:#f7f9fb; --border:#dde4ea;
  --text:#152229; --muted:#66798a; --primary:#0f766e; --primary-2:#115e59;
  --accent:#c2803d; --danger:#b3261e; --ok:#2e7d32; --warn:#b26a00; --info:#1c6dd0;
  --radius:14px; --shadow:0 2px 10px rgba(20,40,60,.07);
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);
  font-family:"Tajawal","Cairo","Segoe UI",Tahoma,Arial,sans-serif;font-size:15px}
button,input,select,textarea{font-family:inherit;font-size:14px}
a{color:var(--primary);text-decoration:none}
.hidden{display:none !important}

/* ------- شاشة الدخول ------- */
.login-wrap{min-height:100vh;display:grid;place-items:center;
  background:linear-gradient(135deg,#0f766e 0%,#134e4a 60%,#0b3b38 100%);padding:20px}
.login-card{background:var(--surface);width:min(420px,100%);padding:32px;border-radius:20px;
  box-shadow:0 20px 45px rgba(0,0,0,.25)}
.login-card h1{margin:0 0 6px;font-size:24px}
.brand-logo{display:block;max-width:220px;max-height:110px;margin:0 auto 18px;object-fit:contain}
.side-logo{display:block;max-width:150px;max-height:56px;margin:0 auto 10px;object-fit:contain}
.login-card p.sub{margin:0 0 22px;color:var(--muted);font-size:14px}
.login-card .quote{margin:0 0 22px;padding:12px 14px;border-radius:10px;
  background:linear-gradient(135deg,#f2f8f7,#eef4f6);border-right:3px solid var(--primary);
  color:var(--primary-2);font-size:13.5px;line-height:1.9;font-weight:500}
.login-card .quote::before{content:"✦ ";opacity:.6}
.demo-note{margin-top:18px;padding:12px;background:var(--surface-2);border:1px dashed var(--border);
  border-radius:10px;font-size:12.5px;color:var(--muted);line-height:1.9}

/* ------- الهيكل ------- */
.layout{display:flex;min-height:100vh}
.sidebar{width:250px;background:#0f2a2e;color:#d7e5e3;display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;overflow-y:auto}
.brand{padding:20px 18px;border-bottom:1px solid rgba(255,255,255,.09)}
.brand h2{margin:0;font-size:17px;color:#fff}
.brand span{font-size:12px;color:#8fb3ae}
.nav{padding:10px;display:flex;flex-direction:column;gap:3px;flex:1}
.nav a{display:flex;align-items:center;gap:10px;padding:11px 13px;border-radius:10px;
  color:#cfe0dd;font-size:14.5px;cursor:pointer}
.nav a:hover{background:rgba(255,255,255,.07)}
.nav a.active{background:var(--primary);color:#fff;font-weight:600}
.nav .ico{width:20px;text-align:center}
.sidebar-footer{padding:12px;border-top:1px solid rgba(255,255,255,.09);font-size:12.5px;color:#9fbdb8}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{background:var(--surface);border-bottom:1px solid var(--border);padding:12px 22px;
  display:flex;align-items:center;justify-content:space-between;gap:14px;position:sticky;top:0;z-index:20}
.topbar h1{margin:0;font-size:19px}
.topbar .who{font-size:13px;color:var(--muted)}
.content{padding:22px;flex:1}

/* ------- عناصر ------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow:var(--shadow);margin-bottom:18px;overflow:hidden}
.card-head{padding:14px 18px;border-bottom:1px solid var(--border);display:flex;
  align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.card-head h3{margin:0;font-size:15.5px}
.card-body{padding:16px 18px}
.grid{display:grid;gap:14px}
.grid.cols-2{grid-template-columns:repeat(auto-fit,minmax(280px,1fr))}
.grid.cols-3{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
.grid.cols-4{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}
.kpi{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:16px;box-shadow:var(--shadow)}
.kpi .label{color:var(--muted);font-size:13px;margin-bottom:8px}
.kpi .value{font-size:27px;font-weight:700}
.kpi .value.ok{color:var(--ok)} .kpi .value.warn{color:var(--warn)}
.kpi .value.danger{color:var(--danger)} .kpi .value.info{color:var(--info)}

.btn{border:1px solid var(--primary);background:var(--primary);color:#fff;padding:8px 15px;
  border-radius:9px;cursor:pointer;font-size:13.5px;display:inline-flex;align-items:center;gap:6px}
.btn:hover{background:var(--primary-2);border-color:var(--primary-2)}
.btn.ghost{background:transparent;color:var(--primary)}
.btn.ghost:hover{background:rgba(15,118,110,.08)}
.btn.gray{background:#5b6b78;border-color:#5b6b78}
.btn.danger{background:var(--danger);border-color:var(--danger)}
.btn.ok{background:var(--ok);border-color:var(--ok)}
.btn.sm{padding:5px 10px;font-size:12.5px;border-radius:7px}
.btn:disabled{opacity:.55;cursor:not-allowed}

.field{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.field label{font-size:13px;color:var(--muted)}
input,select,textarea{padding:9px 11px;border:1px solid var(--border);border-radius:9px;
  background:var(--surface);color:var(--text);width:100%}
input:focus,select:focus,textarea:focus{outline:2px solid rgba(15,118,110,.25);border-color:var(--primary)}
.inline{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}
.inline .field{margin-bottom:0;min-width:150px}

table{width:100%;border-collapse:collapse;font-size:13.5px}
th,td{padding:10px 12px;text-align:right;border-bottom:1px solid var(--border);white-space:nowrap}
th{background:var(--surface-2);color:var(--muted);font-weight:600;font-size:12.5px;
  position:sticky;top:0}
tbody tr:hover{background:#f4f8f9}
.table-wrap{overflow-x:auto;max-height:65vh;overflow-y:auto}
.empty{padding:26px;text-align:center;color:var(--muted)}

.tag{display:inline-block;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600}
.tag.present{background:#e3f4e6;color:#22683a}
.tag.late{background:#fdf0dc;color:#8a5a12}
.tag.absent{background:#fbe3e2;color:#95241d}
.tag.leave{background:#e6efff;color:#1a4f9c}
.tag.holiday{background:#f0e9fb;color:#553092}
.tag.weekend{background:#eceff2;color:#54636f}
.tag.scheduled{background:#eef2f5;color:#66798a}
.tag.missing_out{background:#fdf0dc;color:#8a5a12}
.tag.pending{background:#fdf0dc;color:#8a5a12}
.tag.approved{background:#e3f4e6;color:#22683a}
.tag.rejected{background:#fbe3e2;color:#95241d}
.tag.cancelled{background:#eceff2;color:#54636f}
.tag.on{background:#e3f4e6;color:#22683a}
.tag.off{background:#fbe3e2;color:#95241d}

.bars{display:flex;align-items:flex-end;gap:14px;height:170px;padding:12px 4px}
.bars .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;height:100%;justify-content:flex-end}
.bars .stack{width:100%;max-width:46px;display:flex;flex-direction:column-reverse;gap:2px;justify-content:flex-end;flex:1}
.bars .seg{border-radius:4px;min-height:2px}
.bars .seg.present{background:#3f9d6a} .bars .seg.late{background:#e0a33c}
.bars .seg.absent{background:#d05a52} .bars .seg.leave{background:#5f8fd8}
.bars .cap{font-size:11.5px;color:var(--muted)}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--muted)}
.legend i{display:inline-block;width:11px;height:11px;border-radius:3px;margin-left:5px}

.modal-back{position:fixed;inset:0;background:rgba(10,25,30,.5);display:grid;place-items:center;
  z-index:60;padding:18px}
.modal{background:var(--surface);border-radius:16px;width:min(640px,100%);max-height:88vh;
  overflow-y:auto;box-shadow:0 24px 60px rgba(0,0,0,.3)}
.modal-head{padding:15px 18px;border-bottom:1px solid var(--border);display:flex;
  justify-content:space-between;align-items:center}
.modal-head h3{margin:0;font-size:16px}
.modal-body{padding:18px}
.modal-foot{padding:13px 18px;border-top:1px solid var(--border);display:flex;gap:9px;justify-content:flex-start}
.x{background:none;border:none;font-size:20px;cursor:pointer;color:var(--muted)}

.toast-wrap{position:fixed;bottom:20px;left:20px;display:flex;flex-direction:column;gap:9px;z-index:90}
.toast{background:#152229;color:#fff;padding:12px 17px;border-radius:10px;font-size:13.5px;
  box-shadow:0 8px 24px rgba(0,0,0,.25);animation:slide .25s ease}
.toast.err{background:var(--danger)} .toast.ok{background:var(--ok)}
@keyframes slide{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.muted{color:var(--muted)}
.help{font-size:12.5px;color:var(--muted);line-height:2}
.sub-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.sub-tabs button{border:1px solid var(--border);background:var(--surface);color:var(--muted);
  padding:8px 14px;border-radius:20px;cursor:pointer}
.sub-tabs button.active{background:var(--primary);border-color:var(--primary);color:#fff;font-weight:600}
code{background:var(--surface-2);padding:2px 6px;border-radius:5px;font-size:12.5px;direction:ltr;display:inline-block}
@media(max-width:820px){
  .layout{flex-direction:column}
  .sidebar{width:100%;height:auto;position:static}
  .nav{flex-direction:row;overflow-x:auto}
  .content{padding:14px}
}

/* ------- جرس الإشعارات ------- */
.bell{position:relative;background:none;border:1px solid var(--border);border-radius:10px;
  width:38px;height:34px;cursor:pointer;font-size:16px;line-height:1}
.bell:hover{background:var(--surface-2)}
.bell .badge{position:absolute;top:-7px;left:-7px;background:var(--danger);color:#fff;
  border-radius:11px;min-width:19px;height:19px;font-size:11px;font-weight:700;
  display:grid;place-items:center;padding:0 5px}
.notif{padding:12px 16px;border-bottom:1px solid var(--border);cursor:pointer}
.notif:hover{background:var(--surface-2)}
.notif.unread{background:#f0f7f6;border-right:3px solid var(--primary)}
.notif .t{font-weight:600;font-size:13.5px;margin-bottom:4px}
.notif .b{font-size:12.5px;color:var(--muted);white-space:pre-line;line-height:1.8}
.notif .d{font-size:11.5px;color:var(--muted);margin-top:5px}
.tag.acknowledged{background:#e6efff;color:#1a4f9c}
.tag.objected{background:#fdf0dc;color:#8a5a12}
.tag.draft{background:#eceff2;color:#54636f}
.tag.expired{background:#fbe3e2;color:#95241d}
.tag.soon{background:#fdf0dc;color:#8a5a12}
.money{font-variant-numeric:tabular-nums;font-weight:600}
.total-row td{background:var(--surface-2);font-weight:700}
.install-hint{background:#eef6f5;border:1px solid #cfe3e0;border-radius:10px;padding:10px 14px;
  font-size:13px;display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px}
