:root{
  --brand:#2b3fae; --brand-2:#1f2f8a;
  --panel-a:#243a85; --panel-b:#172552; --panel-c:#101a3c;
  --ok:#1f8a4c; --ok-2:#1f7a44;
  --danger:#b23b2c;
  --warn-bg:#fbf3e1; --warn-fg:#9a6a08;
  --ok-bg:#e7f5ec; --ok-fg:#1f7a44;
  --dg-bg:#fbe9e6; --dg-fg:#b23b2c;
  --bg:#eef0f4; --card:#fff; --line:#ecedf1; --line-2:#e2e6ee;
  --ink:#1a2233; --muted:#6b7488; --muted-2:#9aa1b2;
  --r-sm:9px; --r-md:12px; --r-lg:16px;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{
  font-family:'IBM Plex Sans Arabic',system-ui,-apple-system,sans-serif;
  background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased;
}
button{font-family:inherit;cursor:pointer}
input,select,textarea{font-family:inherit}
a{color:inherit;text-decoration:none}

/* ---------- Login ---------- */
.login-wrap{display:flex;min-height:100vh}
.login-brand{
  flex:1;position:relative;overflow:hidden;padding:56px 48px;color:#fff;
  background:linear-gradient(150deg,var(--panel-a),var(--panel-b) 55%,var(--panel-c));
  display:flex;flex-direction:column;justify-content:space-between;gap:40px;
}
.login-brand .ring{position:absolute;border-radius:50%;border:1px solid rgba(255,255,255,.08)}
.login-brand .glow{position:absolute;bottom:-140px;right:-100px;width:380px;height:380px;border-radius:50%;
  background:radial-gradient(circle,rgba(54,166,53,.16),transparent 70%)}
.brand-mark{width:52px;height:52px;border-radius:14px;background:#fff;display:flex;align-items:center;justify-content:center;overflow:hidden}
.brand-mark svg{width:30px;height:30px}
.login-head{font-size:34px;font-weight:700;line-height:1.25;margin-bottom:16px;letter-spacing:-.5px}
.login-form{flex:1;display:flex;align-items:center;justify-content:center;background:var(--bg);padding:40px 24px}
.login-card{width:100%;max-width:340px}
.login-card h2{font-size:25px;font-weight:700;margin:2px 0 6px;letter-spacing:-.4px}
.eyebrow{font-size:13px;font-weight:600;color:var(--brand);margin-bottom:7px}
label{display:block;font-size:13px;font-weight:600;margin-bottom:8px}
.field{margin-bottom:18px}
input,select,textarea{
  width:100%;padding:12px 14px;border:1px solid var(--line-2);border-radius:var(--r-sm);
  font-size:14.5px;background:#fff;color:var(--ink);transition:border .15s,box-shadow .15s;
}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(43,63,174,.12)}
.btn{background:var(--brand);color:#fff;border:0;border-radius:var(--r-sm);padding:12px 18px;font-size:14.5px;font-weight:600;transition:filter .15s,opacity .15s}
.btn:hover{filter:brightness(1.06)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-block{width:100%}
.btn-ok{background:var(--ok-2)}
.btn-danger{background:var(--danger)}
.btn-ghost{background:#fff;color:var(--ink);border:1px solid var(--line-2)}
.btn-sm{padding:7px 13px;font-size:13px;border-radius:8px}
.err{background:var(--dg-bg);color:var(--dg-fg);padding:10px 13px;border-radius:var(--r-sm);font-size:13.5px;margin-bottom:14px}
.credits{font-size:12.5px;color:rgba(255,255,255,.7);display:flex;align-items:center;gap:7px;margin-top:7px}
.copyright{font-size:12.5px;color:rgba(255,255,255,.5)}

/* ---------- App shell ---------- */
.shell{display:flex;min-height:100vh}
.sidebar{
  width:250px;background:#fff;border-left:1px solid var(--line);
  display:flex;flex-direction:column;padding:20px 16px;gap:6px;position:sticky;top:0;height:100vh;
}
.side-brand{display:flex;align-items:center;gap:11px;padding:6px 8px 18px;border-bottom:1px solid var(--line);margin-bottom:12px}
.side-brand .m{width:40px;height:40px;border-radius:11px;background:var(--brand);display:flex;align-items:center;justify-content:center}
.side-brand .m svg{width:22px;height:22px;color:#fff}
.side-brand .t{font-size:14px;font-weight:700;line-height:1.35}
.side-brand .t span{display:block;font-size:11.5px;color:var(--muted);font-weight:500}
.nav-label{font-size:11px;color:var(--muted-2);font-weight:600;padding:8px 10px 4px}
.nav-item{
  display:flex;align-items:center;gap:11px;padding:11px 12px;border-radius:10px;
  font-size:14px;font-weight:500;color:#3a4256;border:0;background:transparent;width:100%;text-align:right;transition:background .12s;
}
.nav-item:hover{background:#f4f5f9}
.nav-item.active{background:var(--brand);color:#fff}
.nav-item svg{width:19px;height:19px;flex-shrink:0}
.nav-item .badge{margin-inline-start:auto;background:var(--danger);color:#fff;font-size:11px;font-weight:700;min-width:20px;height:20px;border-radius:999px;display:flex;align-items:center;justify-content:center;padding:0 6px}
.nav-item.active .badge{background:#fff;color:var(--brand)}
.side-foot{margin-top:auto;padding-top:14px;border-top:1px solid var(--line);font-size:12px;color:var(--muted)}
.side-user{display:flex;align-items:center;gap:10px;padding:10px 8px;margin-bottom:8px}
.avatar{width:36px;height:36px;border-radius:50%;background:#e8ebf6;color:var(--brand);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px}

.main{flex:1;min-width:0;display:flex;flex-direction:column}
/* Desktop: a slim bar that only carries the bell (menu button hidden). */
.topbar{display:flex;align-items:center;gap:12px;padding:12px 34px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:40}
.topbar .menu-btn{display:none}
.topbar .t{font-weight:700;font-size:15px}
.topbar > .bell-wrap{margin-inline-start:auto}
.content{padding:30px 34px;max-width:1200px;width:100%;margin:0 auto}
.page-title{font-size:23px;font-weight:700;letter-spacing:-.4px;margin-bottom:4px}
.page-sub{color:var(--muted);font-size:14px;margin-bottom:24px}

/* ---------- Notification bell ---------- */
.bell-wrap{position:relative}
.bell-btn{position:relative;width:40px;height:40px;border-radius:11px;border:1px solid var(--line);background:#fff;color:#3a4256;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s}
.bell-btn:hover{background:#f4f6fb}
.bell-btn svg{width:20px;height:20px}
.bell-dot{position:absolute;top:-4px;inset-inline-start:-4px;min-width:18px;height:18px;padding:0 4px;border-radius:9px;background:#b23b2c;color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center}
.bell-scrim{position:fixed;inset:0;z-index:50}
.bell-panel{position:absolute;inset-inline-start:0;top:48px;width:340px;max-width:88vw;max-height:70vh;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 18px 50px rgba(16,26,60,.18);z-index:60}
.bp-head{padding:14px 16px;font-weight:700;font-size:14.5px;border-bottom:1px solid var(--line)}
.bp-enable{padding:13px 16px;background:#eef1fb;border-bottom:1px solid var(--line);font-size:12.5px;color:#2b3fae}
.bp-on{padding:11px 16px;background:#eaf6ef;color:#1f8a4c;font-size:12px;font-weight:600;border-bottom:1px solid var(--line)}
.bp-list{padding:4px}
.bp-empty{padding:26px 16px;text-align:center;color:var(--muted);font-size:13px}
.bp-item{padding:11px 12px;border-radius:10px;margin:2px}
.bp-item.unread{background:#f4f7ff}
.bp-title{font-weight:600;font-size:13px;margin-bottom:2px}
.bp-body{font-size:12.5px;color:#5a6274;line-height:1.6}

/* ---------- Cards / grid ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r-lg);padding:22px}
.grid{display:grid;gap:16px}
.g-2{grid-template-columns:repeat(2,1fr)}
.g-3{grid-template-columns:repeat(3,1fr)}
.g-4{grid-template-columns:repeat(4,1fr)}
.bal-card .top{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:14px}
.bal-card .name{font-size:15px;font-weight:600}
.bal-card .nums{font-size:14px;color:var(--muted)}
.bal-card .nums b{color:var(--ink);font-size:20px}
.bar{height:9px;background:#eef0f4;border-radius:999px;overflow:hidden}
.bar>i{display:block;height:100%;border-radius:999px;background:var(--brand)}
.bar.sick>i{background:var(--danger)}

.kpi{background:#f7f8fb;border:1px solid var(--line);border-radius:var(--r-md);padding:16px}
.kpi .l{font-size:12.5px;color:var(--muted);margin-bottom:5px}
.kpi .v{font-size:26px;font-weight:700}

.banner{display:flex;align-items:center;gap:14px;background:#eef1fb;border:1px solid #dbe1f6;border-radius:var(--r-md);padding:15px 18px;margin-bottom:22px}
.banner .ic{width:40px;height:40px;border-radius:10px;background:var(--brand);color:#fff;display:flex;align-items:center;justify-content:center}
.banner b{color:var(--brand)}

/* ---------- Tables ---------- */
.tbl-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--r-lg);background:#fff}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th,td{padding:12px 14px;text-align:right;border-bottom:1px solid var(--line);white-space:nowrap}
th{background:#f5f6fa;font-weight:600;color:#3a4256;position:sticky;top:0}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover td{background:#fafbfd}

.pill{display:inline-block;padding:3px 11px;border-radius:999px;font-size:12px;font-weight:600}
.pill.pending{background:var(--warn-bg);color:var(--warn-fg)}
.pill.approved{background:var(--ok-bg);color:var(--ok-fg)}
.pill.rejected{background:var(--dg-bg);color:var(--dg-fg)}
.chip{display:inline-block;padding:2px 9px;border-radius:7px;font-size:12px;background:#eef0f4;color:#3a4256}

/* ---------- Stepper ---------- */
.stepper{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.step{display:flex;align-items:center;gap:9px;background:#f7f8fb;border:1px solid var(--line);border-radius:10px;padding:9px 12px;font-size:12.5px}
.step .dot{width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;flex-shrink:0}
.dot.waiting{background:#c3c8d4}
.dot.pending{background:var(--warn-fg)}
.dot.approved{background:var(--ok-2)}
.dot.rejected{background:var(--danger)}
.step .who{font-weight:600}
.step .role{color:var(--muted);font-size:11.5px}

/* ---------- Forms / misc ---------- */
.type-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:6px}
.type-opt{border:1.5px solid var(--line-2);border-radius:var(--r-md);padding:14px 12px;text-align:center;font-size:13.5px;font-weight:600;color:#3a4256;background:#fff;transition:all .12s}
.type-opt:hover{border-color:#c7cee6}
.type-opt.sel{border-color:var(--brand);background:#f2f4fd;color:var(--brand)}
.preview{background:#f2f4fd;border:1px solid #dbe1f6;border-radius:var(--r-md);padding:14px 16px;font-size:14px;display:flex;justify-content:space-between;align-items:center;margin:6px 0 16px}
.preview b{font-size:19px;color:var(--brand)}
.row{display:flex;gap:14px;flex-wrap:wrap}
.row>*{flex:1;min-width:160px}
.section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.section-head h3{font-size:16px;font-weight:600}
.muted{color:var(--muted)}
.empty{text-align:center;color:var(--muted);padding:40px 20px;font-size:14px}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.spacer{flex:1}
.link-view{color:var(--brand);font-weight:600;font-size:13.5px}
.emp-card{border:1px solid var(--line);border-radius:var(--r-md);padding:16px;background:#fff}
.emp-card .h{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:10px}
.emp-card .nm{font-weight:600;font-size:15px}
.emp-card .meta{font-size:12.5px;color:var(--muted);margin-top:2px}

/* ---------- Modal ---------- */
.overlay{position:fixed;inset:0;background:rgba(16,26,60,.45);display:flex;align-items:center;justify-content:center;z-index:100;padding:20px}
.modal{background:#fff;border-radius:var(--r-lg);padding:24px;max-width:520px;width:100%;max-height:90vh;overflow:auto}
.modal h3{font-size:18px;font-weight:700;margin-bottom:6px}
.modal .actions{display:flex;gap:10px;justify-content:flex-start;margin-top:20px}

/* ---------- Mobile ---------- */
.menu-btn{display:none}
.scrim{display:none}
@media (max-width:820px){
  .login-wrap{flex-direction:column}
  .login-brand{padding:40px 28px;gap:26px}
  .login-head{font-size:27px}
  .sidebar{position:fixed;inset-inline-start:0;top:0;z-index:60;transform:translateX(110%);transition:transform .22s;box-shadow:-8px 0 30px rgba(0,0,0,.15)}
  [dir=rtl] .sidebar{transform:translateX(110%)}
  .sidebar.open{transform:translateX(0)}
  .topbar{display:flex;align-items:center;gap:12px;padding:14px 18px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:40}
  .topbar .menu-btn{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;border:1px solid var(--line-2);background:#fff}
  .topbar .t{font-weight:700;font-size:15px}
  .content{padding:20px 16px}
  .g-2,.g-3,.g-4{grid-template-columns:1fr}
  .g-4{grid-template-columns:repeat(2,1fr)}
  .type-grid{grid-template-columns:repeat(2,1fr)}
  .scrim.show{display:block;position:fixed;inset:0;background:rgba(0,0,0,.3);z-index:55}
}

/* ---- upgrade additions: substitute flow, attachments, new types ---- */
.dot.declined{background:#9a6a08}
.banner.sub{background:#fbf3e1;border-color:#f0e2bf}
.banner.sub b{color:#9a6a08}
.banner.sub .ic{background:#9a6a08}
.sub-card{border-inline-start:3px solid #9a6a08}
.hint{font-size:12.5px;color:#6b7488;background:#f7f8fb;border:1px solid var(--line);border-radius:var(--r-sm,10px);padding:10px 12px;margin-top:12px;line-height:1.7}
.file-drop{display:block;text-align:center;cursor:pointer;border:1.5px dashed #c7ccdb;border-radius:var(--r-md);padding:15px;font-size:13.5px;color:#3a4256;background:#fafbfe;transition:border-color .15s}
.file-drop:hover{border-color:var(--brand)}
.decline-log{margin-top:12px;background:#fbf3e1;border:1px solid #f0e2bf;border-radius:var(--r-sm,10px);padding:10px 13px}
.decline-log .dl-head{font-size:12px;font-weight:600;color:#9a6a08;margin-bottom:6px}
.decline-log .dl-row{font-size:12.5px;line-height:1.7}
.step .dot.declined{background:#9a6a08}

/* ---- shifts + payroll deduction ---- */
.bal-line{margin-top:10px;font-size:13px;color:#3a4256;background:#f7f8fb;border:1px solid var(--line);border-radius:10px;padding:9px 12px}
.warn-box{margin-top:12px;background:#fbf3e1;border:1px solid #e6cf94;border-radius:var(--r-md);padding:12px 14px;font-size:13px;color:#7a5406}
.warn-box b{color:#8a5d05}
.bal-out{color:#b23b2c;font-weight:600;font-size:12.5px;line-height:1.6}
.chip-warn{background:#fbf3e1;color:#9a6a08;border-color:#e6cf94}
.chip-hr{background:#eef1fb;color:#2b3fae;border-color:#d4dbf5}

/* ---- team calendar ---- */
.avatar.sm{width:30px;height:30px;font-size:12px;flex-shrink:0}
.cal-card{background:#fff;border:1px solid var(--line);border-radius:var(--r-md);padding:14px;margin-bottom:20px}
.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.cal-month{font-weight:700;font-size:15px}
.cal-nav{width:36px;height:36px;border-radius:9px;border:1px solid var(--line-2);background:#fff;color:#3a4256;display:flex;align-items:center;justify-content:center}
.cal-nav svg{width:17px;height:17px}
.cal-weekdays{display:grid;grid-template-columns:repeat(7,1fr);text-align:center;font-size:11px;color:var(--muted);font-weight:600;margin-bottom:4px}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.cal-day{position:relative;aspect-ratio:1;min-height:38px;border-radius:9px;border:1px solid transparent;background:#f7f8fb;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:var(--ink);font-size:12.5px}
.cal-day.out{color:#c3c8d6;background:#fbfbfd}
.cal-day.today{border-color:var(--brand)}
.cal-day.sel{background:var(--brand);color:#fff}
.cal-day.sel .cal-dot{background:#fff;color:var(--brand)}
.cal-daynum{font-weight:600}
.cal-dot{min-width:15px;height:15px;padding:0 3px;border-radius:8px;background:#2b3fae;color:#fff;font-size:9.5px;font-weight:700;display:flex;align-items:center;justify-content:center}
.cal-entry{display:flex;align-items:center;gap:11px;background:#fff;border:1px solid var(--line);border-radius:var(--r-sm,10px);padding:11px 13px;margin-bottom:9px}

/* ---- mobile bottom navigation ---- */
.bottom-nav{display:none}
@media (max-width:820px){
  .content.has-bottom-nav{padding-bottom:86px}
  .bottom-nav{
    display:flex;position:fixed;bottom:0;inset-inline:0;z-index:45;
    background:#fff;border-top:1px solid var(--line);
    padding:6px 4px calc(6px + env(safe-area-inset-bottom,0px));
    box-shadow:0 -6px 20px rgba(16,26,60,.06);
  }
  .bn-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;min-height:52px;color:#8890a0;background:transparent}
  .bn-item svg{width:22px;height:22px}
  .bn-label{font-size:10.5px;font-weight:600}
  .bn-item.active{color:var(--brand)}
  .bn-ic{position:relative;display:flex}
  .bn-dot{position:absolute;top:-2px;inset-inline-end:-3px;width:8px;height:8px;border-radius:50%;background:#b23b2c;border:2px solid #fff}
  .bn-item.emph .bn-ic{width:42px;height:42px;border-radius:50%;background:var(--brand);color:#fff;align-items:center;justify-content:center;margin-top:-18px;box-shadow:0 6px 16px rgba(43,63,174,.35)}
  .bn-item.emph .bn-ic svg{width:20px;height:20px}
  .bn-item.emph.active .bn-ic{background:#1f2f8a}
}

/* ---- mobile: modals become bottom sheets (native feel, easier thumb reach) ---- */
@media (max-width:820px){
  .overlay{align-items:flex-end;padding:0}
  .modal{max-width:none;width:100%;max-height:85vh;border-radius:20px 20px 0 0;padding:20px 18px calc(20px + env(safe-area-inset-bottom,0px));animation:sheet-up .22s ease-out}
  @keyframes sheet-up{from{transform:translateY(100%)}to{transform:translateY(0)}}
}
