/* ============================================================
   نظام الموارد البشرية — هوية بصرية
   الألوان: بترولي غامق (#12403C) / تركوازي (#177E71) / كهرماني (#D9A13B)
   الخط: IBM Plex Sans Arabic
   ============================================================ */
:root {
  --ink: #14332F;
  --petrol: #12403C;
  --petrol-deep: #0C2B28;
  --teal: #177E71;
  --teal-soft: #E3F0EE;
  --amber: #D9A13B;
  --amber-soft: #FBF2DF;
  --danger: #B2453A;
  --danger-soft: #F9E9E7;
  --bg: #EFF3F2;
  --surface: #FFFFFF;
  --line: #DCE5E3;
  --muted: #6E827E;
  --radius: 12px;
}

* { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; }
body { background: var(--bg); color: var(--ink); font-size: 15px; }
a { color: var(--teal); text-decoration: none; }

/* ---------- التخطيط ---------- */
.app { display: flex; min-height: 100vh; }
.content { flex: 1; padding: 24px 28px; max-width: 1500px; }
@media (max-width: 900px) { .content { padding: 16px 12px; } }

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  width: 245px; flex-shrink: 0; background: var(--petrol); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; gap: 12px;
}
.sidebar .brand img { width: 42px; height: 42px; border-radius: 10px; object-fit: contain; background: #fff; padding: 4px; flex-shrink: 0; }
.sidebar .brand .co { font-weight: 700; font-size: 15px; line-height: 1.3; }
.sidebar .brand .sys { font-size: 11.5px; color: rgba(255,255,255,.55); }
.sidebar nav { padding: 10px 0; overflow-y: auto; flex: 1; }
.sidebar .grp { font-size: 11px; color: rgba(255,255,255,.4); padding: 14px 20px 4px; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.82);
  padding: 9px 20px; font-size: 14px; border-right: 3px solid transparent;
}
.sidebar a.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav-item.active {
  background: rgba(255,255,255,.09); color: #fff;
  border-right-color: var(--amber); font-weight: 600;
}
.sidebar .foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.sidebar .foot .who { color: #fff; font-weight: 600; }
.sidebar .foot .role { color: var(--amber); font-size: 12px; }
.sidebar .foot a { color: rgba(255,255,255,.6); font-size: 12.5px; }
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 4px; }
  .sidebar .grp { display: none; }
  .sidebar a.nav-item { border-right: none; border-bottom: 2px solid transparent; padding: 8px 12px; }
  .sidebar a.nav-item.active { border-bottom-color: var(--amber); }
}

/* ---------- رأس الصفحة ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- البطاقات ---------- */
.card-x { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-x .card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; }
.card-x .card-b { padding: 18px; }

/* بطاقات الإحصائيات */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--teal); }
.stat.amber::before { background: var(--amber); }
.stat.danger::before { background: var(--danger); }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- الجداول ---------- */
.table-x { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-x th { text-align: right; padding: 10px 14px; color: var(--muted); font-size: 12.5px;
  font-weight: 600; border-bottom: 1px solid var(--line); background: #F7FAF9; white-space: nowrap; }
.table-x td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-x tr:last-child td { border-bottom: none; }
.table-x tr:hover td { background: #FAFCFB; }
.table-wrap { overflow-x: auto; }

/* ---------- الشارات ---------- */
.badge-s { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok     { background: var(--teal-soft); color: #0E5D53; }
.badge-warn   { background: var(--amber-soft); color: #8A6113; }
.badge-danger { background: var(--danger-soft); color: #8C3128; }
.badge-info   { background: #E7EEF8; color: #2C568F; }
.badge-muted  { background: #EDF1F0; color: var(--muted); }

/* ---------- الأزرار والنماذج ---------- */
.btn-t { background: var(--teal); color: #fff; border: none; border-radius: 9px; padding: 8px 18px;
  font-weight: 600; font-size: 14px; }
.btn-t:hover { background: #12685E; color: #fff; }
.btn-o { background: #fff; color: var(--petrol); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 16px; font-size: 14px; }
.btn-o:hover { border-color: var(--teal); color: var(--teal); }
.btn-d { background: var(--danger-soft); color: var(--danger); border: none; border-radius: 9px; padding: 6px 14px; font-size: 13px; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.form-control, .form-select { border-color: var(--line); border-radius: 9px; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(23,126,113,.12); }
label.form-label { font-size: 13px; font-weight: 600; color: var(--ink); }

/* ---------- التنبيهات ---------- */
.flash { border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.flash.success { background: var(--teal-soft); color: #0E5D53; border-color: #BFDDD8; }
.flash.error   { background: var(--danger-soft); color: #8C3128; border-color: #EBC6C1; }

/* ---------- صفحة الدخول ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background:
  linear-gradient(160deg, var(--petrol-deep) 0%, var(--petrol) 55%, #17554E 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 36px 32px; width: 100%; max-width: 400px; }
.login-card img.logo { height: 64px; width: auto; max-width: 200px; border-radius: 14px; object-fit: contain; }

/* ---------- شبكة الورديات ---------- */
.roster-grid td { min-width: 110px; }
.shift-chip { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: var(--teal-soft); color: #0E5D53; margin: 1px; }
.shift-chip.night { background: #E9E4F5; color: #4A3A80; }
.shift-chip.eve   { background: var(--amber-soft); color: #8A6113; }

/* ---------- قسيمة الراتب للطباعة ---------- */
@media print {
  .sidebar, .page-head .actions, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card-x { border: none; }
}


/* ---------- الشريط الزمني للورديات ---------- */
.timeline { position: relative; height: 22px; background: #EDF1F0; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); direction: rtl; }
.timeline span { position: absolute; top: 0; bottom: 0; display: block; }
.tl-work { background: var(--teal); opacity: .95; }
.tl-win  { background: var(--teal); opacity: .22; }
.tl-flex { position: static !important; display: grid !important; place-items: center; height: 100%;
  font-size: 11px; color: #0E5D53; background: repeating-linear-gradient(45deg, var(--teal-soft), var(--teal-soft) 8px, #D3E8E4 8px, #D3E8E4 16px); }
.timeline i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,.12); }
.tl-legend { display: inline-block; width: 22px; height: 10px; border-radius: 3px; vertical-align: middle; }
.tl-legend.work { background: var(--teal); }
.tl-legend.win  { background: var(--teal); opacity: .22; border: 1px solid var(--line); }

/* شارة التعيين الشخصي بالجدولة */
.shift-chip.personal { box-shadow: inset 0 0 0 2px var(--amber); }

/* الطباعة للتقارير */
@media print {
  .no-print { display: none !important; }
  .d-print-flex { display: flex !important; }
}
