/* =========================================================
   HR Pro — نظام الموارد البشرية والرواتب
   تصميم RTL كامل — فاتح/غامق — متجاوب — جاهز للطباعة
   ========================================================= */

:root {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #f1f3fa;
  --border: #e4e7f0;
  --border-strong: #d3d8e6;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --primary-ink: #3730a3;
  --teal: #0d9488;
  --teal-soft: #e6fffa;
  --green: #16a34a;
  --green-soft: #e9f9ef;
  --amber: #d97706;
  --amber-soft: #fff7e6;
  --red: #dc2626;
  --red-soft: #feeeee;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --purple: #9333ea;
  --purple-soft: #f5ecff;
  --pink: #db2777;
  --sidebar: #0b1222;
  --sidebar-2: #111b30;
  --sidebar-text: #c7d2e5;
  --sidebar-muted: #7d8ba6;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar-w: 274px;
  --topbar-h: 74px;
  --font: "Segoe UI", "Tahoma", "Noto Kufi Arabic", "Cairo", sans-serif;
  --num: "Segoe UI", "Cairo", "Tahoma", sans-serif;
}

[data-theme="dark"] {
  --bg: #080d19;
  --bg-soft: #0c1322;
  --surface: #111a2c;
  --surface-2: #0d1524;
  --surface-3: #172136;
  --border: #22304a;
  --border-strong: #2f4062;
  --text: #e9edf5;
  --text-2: #c3cbdc;
  --muted: #94a3b8;
  --muted-2: #6b7a93;
  --primary: #7c7bf5;
  --primary-dark: #6d6ceb;
  --primary-soft: #1c2142;
  --primary-ink: #c7c5ff;
  --teal: #2dd4bf;
  --teal-soft: #10312f;
  --green: #4ade80;
  --green-soft: #10291d;
  --amber: #fbbf24;
  --amber-soft: #2c2410;
  --red: #f87171;
  --red-soft: #2f1518;
  --blue: #60a5fa;
  --blue-soft: #13243f;
  --purple: #c084fc;
  --purple-soft: #251536;
  --sidebar: #070c16;
  --sidebar-2: #0d1525;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg.ic { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mono { font-family: "Consolas", "Courier New", monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ================= layout ================= */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column;
  background: radial-gradient(900px 400px at 100% -10%, #1b2a4d 0%, transparent 55%), var(--sidebar);
  color: var(--sidebar-text);
  border-left: 1px solid rgba(255, 255, 255, .05);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 22px 18px;
}
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #6366f1, #4338ca 65%, #312e81);
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 8px 20px rgba(79, 70, 229, .45), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: #fff; font-size: 17px; font-weight: 700; }
.brand-text small { color: var(--sidebar-muted); font-size: 11px; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 14px 18px; scrollbar-width: thin; scrollbar-color: #263451 transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #263451; border-radius: 8px; }
.nav-group { margin-top: 18px; }
.nav-group:first-child { margin-top: 6px; }
.nav-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .9px;
  color: var(--sidebar-muted); text-transform: uppercase;
  padding: 0 12px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; margin-bottom: 2px;
  border-radius: 10px; color: var(--sidebar-text);
  font-size: 13.4px; font-weight: 500;
  transition: background .16s, color .16s, transform .16s;
  position: relative;
}
.nav-link .ic { width: 18px; height: 18px; color: #8394b5; transition: color .16s; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link:hover .ic { color: #c7d2fe; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .08));
  color: #fff; font-weight: 600;
}
.nav-link.active .ic { color: #a5b4fc; }
.nav-link.active::before {
  content: ""; position: absolute; right: -14px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px 0 0 3px;
  background: #818cf8; box-shadow: 0 0 14px #6366f1;
}
.nav-badge {
  margin-inline-start: auto; min-width: 22px; padding: 1px 7px;
  border-radius: 20px; background: rgba(255, 255, 255, .1);
  color: #c7d2fe; font-size: 10.5px; font-weight: 700; text-align: center;
}
.nav-badge:empty { display: none; }
.nav-badge.warn { background: #f59e0b; color: #1c1200; }

.sidebar-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.storage-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px; padding: 10px 12px;
}
.storage-note .ic { width: 17px; height: 17px; color: #6ee7b7; margin-top: 2px; }
.storage-note strong { display: block; color: #e2e8f0; font-size: 11.5px; }
.storage-note span { display: block; color: var(--sidebar-muted); font-size: 10.5px; line-height: 1.5; }
.version { display: block; text-align: center; color: #566587; font-size: 10px; margin-top: 10px; }
.sidebar-overlay { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none !important; }
.page-head { min-width: 0; }
.page-head h1 { font-size: 20px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-head p { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); transition: .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn.has-dot .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red); border: 2px solid var(--surface);
}
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }

.global-search {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 38px; width: 240px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.global-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.global-search .ic { width: 16px; height: 16px; color: var(--muted); }
.global-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12.5px; }
.global-search input::placeholder { color: var(--muted-2); }
.global-search kbd {
  font-family: var(--font); font-size: 9.5px; color: var(--muted-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; background: var(--surface-2);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; max-height: 340px; overflow: auto; z-index: 60;
}
.search-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer;
}
.search-item:hover { background: var(--surface-3); }
.search-item strong { font-size: 12.5px; display: block; }
.search-item span { font-size: 11px; color: var(--muted); }
.search-item .avatar { width: 30px; height: 30px; font-size: 11px; }

.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 10px; border-radius: 12px; }
.user-chip:hover { background: var(--surface-3); }
.user-chip .avatar { width: 34px; height: 34px; font-size: 13px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 11.5px; font-weight: 600; }
.user-meta small { font-size: 9.5px; color: var(--muted); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(145deg, hsl(var(--h, 235) 70% 62%), hsl(var(--h, 235) 65% 46%));
  color: #fff; font-weight: 700; font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.avatar.sm { width: 30px; height: 30px; font-size: 10.5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; border-radius: 20px; }

.view { padding: 24px 28px 70px; width: 100%; max-width: 1560px; margin: 0 auto; outline: none; }

/* ================= generic ================= */
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.page-tools .spacer { flex: 1; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 15px; font-weight: 700; }
.section-head p { font-size: 11.5px; color: var(--muted); }
.section-head .spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.split.rev { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { font-size: 14px; font-weight: 700; }
.card-head p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.card.tight .card-body { padding: 12px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn .ic { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.teal { background: var(--teal); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.soft { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.btn.soft:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); }
.btn.danger { background: var(--red); border-color: transparent; color: #fff; }
.btn.danger:hover { filter: brightness(1.05); }
.btn.outline-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: transparent; }
.btn.sm { height: 31px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; gap: 5px; }
.btn.sm .ic { width: 14px; height: 14px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 10.5px; border-radius: 7px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 600; line-height: 1.6;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.gray { background: var(--surface-3); color: var(--muted); }
.badge.primary { background: var(--primary-soft); color: var(--primary-ink); }

/* tables */
.table-wrap { overflow: auto; border-radius: inherit; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.8px; }
.table th {
  position: sticky; top: 0; z-index: 2;
  text-align: right; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--muted); background: var(--surface-2);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable { cursor: pointer; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table .left { text-align: left; }
.table.compact td { padding: 8px 10px; }
.table.compact th { padding: 8px 10px; }
.table .cell-main { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.table .cell-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.table .cell-main small { display: block; font-size: 10.5px; color: var(--muted); }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .row-actions { display: flex; gap: 4px; opacity: .55; transition: opacity .15s; justify-content: flex-end; }
tr:hover .row-actions { opacity: 1; }
.table-empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* empty/loading */
.empty {
  padding: 48px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty .empty-icon {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--surface-3); color: var(--muted);
  display: grid; place-items: center; margin-bottom: 4px;
}
.empty .empty-icon .ic { width: 26px; height: 26px; }
.empty h3 { font-size: 14px; }
.empty p { font-size: 12px; color: var(--muted); max-width: 360px; }
.empty .btn { margin-top: 8px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; left: -16px; bottom: -30px; width: 80px; height: 80px;
  border-radius: 50%; background: var(--kpi-tint, var(--primary-soft)); opacity: .35; filter: blur(6px);
}
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--kpi-tint, var(--primary-soft)); color: var(--kpi-color, var(--primary));
}
.kpi-icon .ic { width: 17px; height: 17px; }
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 23px; font-weight: 750; letter-spacing: -.4px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-sub { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kpi-sub .up { color: var(--green); font-weight: 700; }
.kpi-sub .down { color: var(--red); font-weight: 700; }

/* dashboard */
.hero {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 22px 24px; margin-bottom: 18px;
  border-radius: 18px; color: #fff;
  background:
    radial-gradient(600px 200px at 90% -20%, rgba(99,102,241,.55), transparent 60%),
    radial-gradient(400px 180px at 0% 120%, rgba(13,148,136,.4), transparent 60%),
    linear-gradient(120deg, #111a30, #1d2a4a 60%, #172554);
  box-shadow: 0 16px 36px rgba(9, 15, 30, .35);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .5; pointer-events: none;
}
.hero-text { flex: 1; min-width: 240px; position: relative; z-index: 1; }
.hero-text h2 { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.hero-text p { font-size: 12.5px; color: #b9c6e2; margin-top: 3px; }
.hero-stats { display: flex; gap: 26px; position: relative; z-index: 1; }
.hero-stat strong { display: block; font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 10.5px; color: #9fb0d0; }
.hero-actions { display: flex; gap: 8px; position: relative; z-index: 1; }

.chart-bars { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding-top: 8px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.chart-bar .bar-fill {
  width: 100%; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 80%, white), var(--primary));
  min-height: 3px; transition: filter .15s; position: relative;
}
.chart-bar:hover .bar-fill { filter: brightness(1.12); }
.chart-bar .bar-fill.teal { background: linear-gradient(180deg, color-mix(in srgb, var(--teal) 80%, white), var(--teal)); }
.chart-bar .bar-label { font-size: 9.5px; color: var(--muted); text-align: center; white-space: nowrap; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-inline-end: 5px; vertical-align: middle; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut {
  --val: 0; --size: 132px;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--val) * 1%), var(--surface-3) 0);
  display: grid; place-items: center; flex: none; position: relative;
}
.donut::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); }
.donut span { position: relative; text-align: center; font-size: 21px; font-weight: 750; line-height: 1.1; }
.donut span small { display: block; font-size: 9.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; min-width: 130px; flex: 1; }
.donut-legend div { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.donut-legend b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }

.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 18px; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.alert-item:last-child { border-bottom: 0; }
.alert-item:hover { background: var(--surface-2); }
.alert-ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; background: var(--amber-soft); color: var(--amber);
}
.alert-ic .ic { width: 15px; height: 15px; }
.alert-ic.red { background: var(--red-soft); color: var(--red); }
.alert-ic.blue { background: var(--blue-soft); color: var(--blue); }
.alert-ic.green { background: var(--green-soft); color: var(--green); }
.alert-item strong { display: block; font-size: 12px; font-weight: 600; }
.alert-item small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.quick-btn {
  display: flex; align-items: center; gap: 9px; padding: 11px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  font-size: 11.5px; font-weight: 600; text-align: right; transition: .15s;
}
.quick-btn:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-1px); }
.quick-btn .ic { width: 17px; height: 17px; color: var(--primary); }

/* toolbar & inputs */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.searchbox { position: relative; display: flex; align-items: center; }
.searchbox .ic { position: absolute; right: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.searchbox input {
  height: 38px; padding: 0 34px 0 12px; width: 230px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; outline: 0;
  font-size: 12.5px; transition: .15s;
}
.searchbox input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input, .select, textarea.input {
  height: 38px; padding: 0 11px; width: 100%;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  outline: 0; font-size: 12.5px; transition: .15s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 76px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 11px center; padding-left: 30px; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.sm, .select.sm { height: 32px; font-size: 11.5px; border-radius: 8px; }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group .input { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--red); margin-inline-start: 2px; }
.field .hint { font-size: 10px; color: var(--muted); }
.field.full { grid-column: 1 / -1; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--border); }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section h4 { font-size: 12px; font-weight: 700; color: var(--text-2); }
.form-note { grid-column: 1 / -1; font-size: 10.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; user-select: none; }
.check input[type="checkbox"], .check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 23px; border-radius: 20px; background: var(--border-strong); transition: .18s; position: relative; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; right: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .18s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(-17px); }
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 7px; padding: 6px 12px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 9px 14px; border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 20px;
  font-size: 11px; color: var(--text-2);
}
.chip button { border: 0; background: transparent; color: var(--muted); padding: 0; display: grid; place-items: center; }
.chip .ic { width: 12px; height: 12px; }

/* profile */
.profile-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px; border-radius: 18px;
  background:
    radial-gradient(500px 180px at 100% 0%, rgba(99,102,241,.16), transparent 60%),
    var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.profile-head .avatar { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
.profile-id { flex: 1; min-width: 220px; }
.profile-id h2 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-id p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.profile-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.profile-facts { display: flex; gap: 26px; flex-wrap: wrap; margin-inline-start: 12px; }
.profile-facts .fact { font-size: 11px; color: var(--muted); }
.profile-facts .fact strong { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.kv { min-width: 0; }
.kv dt { font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.kv dd { margin: 0; font-size: 12.5px; font-weight: 550; word-break: break-word; }

.progress { height: 7px; background: var(--surface-3); border-radius: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--primary), #8b5cf6); }
.progress.green > span { background: linear-gradient(90deg, #16a34a, #4ade80); }
.progress.amber > span { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress.red > span { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.progress-row .progress { flex: 1; }

.stat-list { display: flex; flex-direction: column; }
.stat-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: 0; }
.stat-row .stat-label { flex: 1; font-size: 12px; color: var(--text-2); }
.stat-row .stat-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* timeline */
.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; inset-inline-start: -17px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--primary);
}
.timeline-item strong { font-size: 12px; display: block; }
.timeline-item small { font-size: 10.5px; color: var(--muted); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 13, 25, .55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px 4vh; overflow-y: auto;
  animation: fadeIn .16s ease;
}
.modal {
  width: 100%; max-width: 560px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lg); animation: popIn .2s cubic-bezier(.2,.8,.3,1);
  display: flex; flex-direction: column; max-height: 90vh; margin: auto 0;
}
.modal.sm { max-width: 420px; }
.modal.lg { max-width: 780px; }
.modal.xl { max-width: 1040px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.modal-close { margin-inline-start: auto; }
.modal-body { padding: 6px 20px 8px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.modal-foot .spacer { flex: 1; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.toast-root { position: fixed; bottom: 22px; left: 22px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 9px; min-width: 240px; max-width: 380px;
  padding: 11px 14px; border-radius: 11px;
  background: var(--sidebar); color: #e8edf7;
  box-shadow: var(--shadow-lg); font-size: 12px; font-weight: 500;
  animation: toastIn .2s ease;
  border: 1px solid rgba(255,255,255,.08);
}
.toast .ic { width: 17px; height: 17px; color: #6ee7b7; }
.toast.error .ic { color: #fca5a5; }
.toast.info .ic { color: #93c5fd; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* popover */
.popover {
  position: fixed; z-index: 150; top: 66px; left: 24px;
  width: 340px; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
}
.popover-head { display: flex; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.popover-head h3 { font-size: 13px; }
.popover-head .badge { margin-inline-start: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif-item:hover { background: var(--surface-2); }
.notif-item strong { font-size: 11.5px; display: block; font-weight: 600; }
.notif-item small { font-size: 10.5px; color: var(--muted); }
.notif-item.unread { background: var(--blue-soft); }
.notif-item.unread strong::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); margin-inline-end: 5px; vertical-align: middle; }
.notif-when { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.notif-toolbar { padding: 6px 15px; border-bottom: 1px solid var(--border); background: var(--surface); text-align: start; }
.notif-all { border: 0; background: none; color: var(--blue); font: inherit; font-size: 11px; cursor: pointer; padding: 3px 0; }
.notif-all:hover { text-decoration: underline; }

/* payslip */
.payslip { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.payslip-head {
  display: flex; align-items: flex-start; gap: 16px; padding: 24px;
  background: linear-gradient(120deg, #111a30, #1e2a4a);
  color: #fff;
}
.payslip-logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(145deg,#6366f1,#4338ca); display: grid; place-items: center; font-weight: 800; }
.payslip-head h2 { font-size: 18px; }
.payslip-head p { font-size: 11.5px; color: #b9c6e2; }
.payslip-head .spacer { flex: 1; }
.payslip-meta { text-align: left; font-size: 11px; color: #b9c6e2; }
.payslip-meta strong { display: block; color: #fff; font-size: 14px; }
.payslip-body { padding: 22px 24px; }
.payslip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.payslip-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.payslip-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.payslip-table td { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.payslip-table td:last-child { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payslip-table tr.total td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--border-strong); padding-top: 9px; }
.net-box {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 20px; padding: 16px 20px; border-radius: 14px;
  background: linear-gradient(120deg, var(--primary-soft), var(--teal-soft));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
.net-box span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.net-box strong { font-size: 25px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary-ink); }
.signatures { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.signatures div { flex: 1; min-width: 140px; border-top: 1px dashed var(--border-strong); padding-top: 6px; text-align: center; font-size: 10.5px; color: var(--muted); }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; min-height: 200px; }
.kanban-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-size: 12px; font-weight: 700; }
.kanban-head .count { margin-inline-start: auto; background: var(--surface-3); color: var(--muted); border-radius: 20px; padding: 0 8px; font-size: 10px; }
.candidate-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px; margin-bottom: 8px; box-shadow: var(--shadow-xs); }
.candidate-card strong { font-size: 12px; display: block; }
.candidate-card small { font-size: 10.5px; color: var(--muted); display: block; margin-bottom: 6px; }
.candidate-card .row { display: flex; gap: 5px; align-items: center; margin-top: 7px; flex-wrap: wrap; }

/* docs / assets */
.doc-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.doc-row:last-child { border-bottom: 0; }
.doc-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
.doc-icon .ic { width: 16px; height: 16px; }
.doc-main { flex: 1; min-width: 0; }
.doc-main strong { display: block; font-size: 12px; }
.doc-main small { display: block; font-size: 10.5px; color: var(--muted); }

/* settings */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-nav { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; position: sticky; top: 92px; }
.settings-nav button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border: 0; background: transparent; border-radius: 9px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-align: right;
}
.settings-nav button:hover { background: var(--surface-2); color: var(--text); }
.settings-nav button.active { background: var(--primary-soft); color: var(--primary-ink); }
.settings-nav .ic { width: 16px; height: 16px; }
.settings-pane { display: none; }
.settings-pane.active { display: block; }
.bracket-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* alerts inline */
.inline-alert {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 13px; border-radius: 11px; font-size: 11.5px;
  background: var(--amber-soft); color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent);
}
.inline-alert.red { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.inline-alert.blue { background: var(--blue-soft); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.inline-alert .ic { width: 16px; height: 16px; margin-top: 1px; }
.inline-alert strong { font-weight: 700; }

/* report */
.report-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.report-title { font-size: 16px; font-weight: 700; }
.report-meta { font-size: 11px; color: var(--muted); }

/* misc */
.hstack { display: flex; align-items: center; gap: 8px; }
.vstack { display: flex; flex-direction: column; gap: 6px; }
.wrap { flex-wrap: wrap; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-blue { color: var(--blue); }
.text-primary { color: var(--primary); }
.fw-700 { font-weight: 700; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.center { text-align: center; }
.left { text-align: left; }
.pointer { cursor: pointer; }

/* الملفات المرفقة والسير الذاتية */
.upload { display: flex; flex-direction: column; gap: 8px; }
.upload-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.upload-zone {
  display: flex; align-items: center; gap: 11px; cursor: pointer;
  padding: 12px 14px; border: 1.5px dashed var(--border-strong); border-radius: 11px;
  background: var(--surface-2); transition: .15s; text-align: start;
}
.upload-zone:hover, .upload-zone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone .ic { width: 20px; height: 20px; color: var(--primary); flex: none; }
.upload-zone strong { display: block; font-size: 12px; font-weight: 650; color: var(--text); }
.upload-zone small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.upload-picked, .upload-existing {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--green); background: var(--green-soft); border-radius: 10px;
}
.upload-existing { border-color: var(--border); background: var(--surface-2); transition: opacity .15s; flex-wrap: wrap; }
.file-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--primary); flex: none; }
.file-ic .ic { width: 16px; height: 16px; }
.file-ic.ok { color: var(--green); background: var(--green-soft); }
.file-meta { min-width: 0; flex: 1; }
.file-meta strong { display: block; font-size: 11.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 330px; }
.file-meta small { display: block; font-size: 10px; color: var(--muted); margin-top: 1px; }
.file-remove { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); cursor: pointer; margin-inline-start: auto; }
.file-remove input { accent-color: var(--red); width: 14px; height: 14px; cursor: pointer; }
.bulk-cv-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.bulk-cv-item + .bulk-cv-item { margin-top: 6px; }
#bulk-picked { max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.file-frame { width: 100%; height: 62vh; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-3); }
.file-image-wrap { display: grid; place-items: center; padding: 8px; background: var(--surface-3); border-radius: 12px; max-height: 64vh; overflow: auto; }
.file-image { max-width: 100%; max-height: 62vh; border-radius: 8px; }
.file-fallback { text-align: center; padding: 34px 18px; }
.file-fallback-ic { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.file-fallback-ic .ic { width: 28px; height: 28px; }
.file-fallback h3 { font-size: 13px; font-weight: 700; word-break: break-word; }
.file-fallback p { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* تفاصيل المرشح */
.cand-head { display: flex; gap: 15px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.cand-head .avatar { width: 58px; height: 58px; border-radius: 17px; font-size: 20px; }
.cand-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.cand-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cand-detail .kv-grid { gap: 12px 22px; }
.cand-cv-box { margin-top: 16px; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.cand-cv-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cand-cv-head h4 { font-size: 12px; font-weight: 700; }
.cand-cv-body { padding: 13px 14px; }
.cand-cv-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cand-cv-empty .file-ic { background: var(--surface-3); color: var(--muted); }
.cand-cv-empty p { flex: 1; font-size: 11px; color: var(--muted); line-height: 1.6; }

/* skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* responsive */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .split, .split.rev { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .global-search { width: 200px; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; right: 0; width: 280px;
    transform: translateX(100%); transition: transform .22s ease;
    box-shadow: -20px 0 50px rgba(0,0,0,.35);
    z-index: 120;
  }
  .sidebar.open { transform: none; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(5,10,20,.55); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid !important; }
  .view { padding: 20px 18px 60px; }
  .topbar { padding: 10px 18px; }
  .user-meta { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .page-head p { display: none; }
  .global-search { width: 40px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .global-search input, .global-search kbd { display: none; }
  .global-search.expanded { position: fixed; top: 12px; right: 12px; left: 12px; width: auto; height: 44px; padding: 0 14px; z-index: 140; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .global-search.expanded input { display: block; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; width: auto; }
  .payslip-grid { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 16px 12px 60px; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .page-head h1 { font-size: 17px; }
  .hero { padding: 18px; }
  .hero-stats { gap: 18px; width: 100%; }
  .user-chip { padding: 2px; }
  .user-chip .avatar { width: 32px; height: 32px; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 9px 8px; }
  .profile-facts { gap: 16px; }
  .popover { left: 12px; right: 12px; width: auto; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi { flex-direction: row; align-items: center; justify-content: space-between; }
  .kpi-top { flex: 1; }
  .kpi-value { font-size: 20px; }
  .kpi-sub { display: none; }
  .quick-grid { grid-template-columns: minmax(0, 1fr); }
}

/* print */
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #000 !important; font-size: 12px; }
  .sidebar, .topbar, .sidebar-overlay, .toast-root, .popover, .modal-overlay, .no-print { display: none !important; }
  .app { display: block; }
  .main { display: block; }
  .view { padding: 0 !important; max-width: none; }
  .card, .payslip, .kpi { box-shadow: none !important; border-color: #ddd !important; break-inside: avoid; }
  .payslip-head { background: #1a2440 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table th { background: #f3f4f6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge { border: 1px solid #ccc; }
  .print-title { display: block !important; }
  a { text-decoration: none; }
}

/* ===== تطبيق سطح المكتب ===== */
.dir-path {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  direction: ltr;
  text-align: left;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}
.desktop-mode .sidebar-foot .version { color: var(--teal); }

/* معاينة الطباعة داخل التطبيق */
.print-layer {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: #fff;
  overflow: auto;
  color: #111;
}
.print-toolbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 2;
}
.print-toolbar-title { font-size: 12px; font-weight: 700; color: var(--text-2); }
.print-doc { max-width: 900px; margin: 0 auto; padding: 26px 28px 40px; background: #fff; }
body.print-open { overflow: hidden; }
@media print {
  body.print-open > *:not(.print-layer) { display: none !important; }
  body.print-open .print-layer { position: static; overflow: visible; }
  body.print-open .print-toolbar { display: none !important; }
  body.print-open .print-doc { max-width: none; padding: 0; }
}

/* =========================================================
   صورة الموظف داخل الحرفين الأولين
   ========================================================= */
.avatar.has-photo { padding: 0; overflow: hidden; background: var(--surface-3); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-head .avatar.has-photo { border-radius: 22px; }
#emp-photo-preview .avatar { width: 78px; height: 78px; border-radius: 22px; font-size: 24px; }
#emp-photo-preview .avatar.has-photo img { border-radius: 22px; }

/* =========================================================
   شاشة قفل التطبيق
   ========================================================= */
body.app-locked { overflow: hidden; }
body.app-locked > .app,
body.app-locked > #modal-root,
body.app-locked > #toast-root { filter: blur(2px); pointer-events: none; user-select: none; }

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 700px at 80% -10%, #4f46e5 0%, #1e1b4b 45%, #0b1020 100%);
  overflow: auto;
  animation: lockIn .28s ease both;
}
.lock-screen.unlocking { animation: lockOut .26s ease both; }
@keyframes lockIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lockOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.985); } }

.lock-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(420px 420px at 18% 22%, rgba(99, 102, 241, .5), transparent 65%),
    radial-gradient(520px 520px at 82% 78%, rgba(13, 148, 136, .38), transparent 65%),
    radial-gradient(300px 300px at 60% 10%, rgba(236, 72, 153, .22), transparent 70%);
  pointer-events: none;
}
.lock-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, #fff 12%, transparent);
  border-radius: 22px;
  padding: 26px 24px 18px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, .55);
  text-align: center;
  color: var(--text);
}
.lock-card.shake { animation: lockShake .34s ease; }
@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-7px); }
  46% { transform: translateX(6px); }
  68% { transform: translateX(-4px); }
  86% { transform: translateX(3px); }
}
.lock-brand { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.lock-brand .lock-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4f46e5, #0d9488); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
}
.lock-brand strong { font-size: 13.5px; }
.lock-brand small { flex-basis: 100%; font-size: 10.5px; color: var(--muted); }
.lock-lockicon {
  width: 58px; height: 58px; border-radius: 18px; margin: 18px auto 10px;
  display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}
.lock-lockicon .ic { width: 26px; height: 26px; }
.lock-card h2 { font-size: 17px; margin: 0 0 4px; }
.lock-msg { font-size: 11.5px; color: var(--muted); margin: 0 0 16px; line-height: 1.7; }
.lock-input-wrap { margin-bottom: 10px; }
.lock-input {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); text-align: center;
  font-size: 17px; letter-spacing: 4px; outline: 0; padding: 0 14px;
  transition: border-color .15s, box-shadow .15s;
}
.lock-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.lock-submit { width: 100%; height: 44px; justify-content: center; font-size: 13px; }
.lock-error { min-height: 16px; margin: 10px 0 0; font-size: 11px; color: #f87171; font-weight: 600; }
.lock-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 9.5px; color: var(--muted); flex-wrap: wrap;
}
.lock-foot span { display: inline-flex; align-items: center; gap: 4px; }
.lock-foot .ic { width: 13px; height: 13px; }

/* =========================================================
   معالج الإعداد الأولي
   ========================================================= */
.onb-steps { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.onb-step {
  display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 10px; color: var(--muted);
}
.onb-step.active { background: color-mix(in srgb, var(--primary) 12%, transparent); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary); font-weight: 700; }
.onb-step.done { color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.onb-num {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); font-size: 9.5px; font-weight: 700; color: var(--muted);
}
.onb-step.active .onb-num { background: var(--primary); color: #fff; }
.onb-step.done .onb-num { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.onb-pane { animation: onbFade .2s ease both; }
@keyframes onbFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.onb-hero { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.onb-hero > .ic {
  width: 38px; height: 38px; padding: 9px; border-radius: 12px; flex: none;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary);
}
.onb-hero h3 { font-size: 14px; margin: 0 0 2px; }
.onb-hero p { font-size: 11px; color: var(--muted); margin: 0; line-height: 1.7; }
.onb-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: start;
  padding: 16px; border-radius: 14px; border: 1px dashed var(--border-strong);
  background: var(--surface-2); cursor: pointer; transition: .15s;
}
.onb-action:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface-2)); transform: translateY(-1px); }
.onb-action .ic { color: var(--primary); width: 20px; height: 20px; margin-bottom: 4px; }
.onb-action strong { font-size: 12.5px; }
.onb-action span { font-size: 10.5px; color: var(--muted); }
.onb-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.onb-summary > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 9px 11px; }
.onb-summary span { display: block; font-size: 9.5px; color: var(--muted); margin-bottom: 2px; }
.onb-summary strong { font-size: 12.5px; }
@media (max-width: 640px) { .onb-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* زر القفل أعلى الصفحة */
#lock-btn .ic { width: 17px; height: 17px; }

/* =========================================================
   المستخدمون والصلاحيات
   ========================================================= */
.user-chip {
  background: transparent; border: 0; color: inherit; font: inherit;
  cursor: pointer; text-align: right;
}
.user-chip-caret { width: 13px; height: 13px; color: var(--muted); flex: none; }
.user-chip .avatar.sm { width: 30px; height: 30px; font-size: 11px; }

.lock-field { text-align: right; margin-bottom: 10px; }
.lock-field label { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.lock-select {
  text-align: right; font-size: 12.5px; letter-spacing: 0; direction: rtl;
  height: 42px; padding: 0 12px; appearance: auto;
}

.account-card { display: flex; align-items: center; gap: 12px; }
.account-avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, hsl(235 70% 62%), hsl(235 65% 46%));
  color: #fff; font-weight: 700; font-size: 17px; flex: none;
}
.account-card strong { display: block; font-size: 13px; }
.account-card small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.perm-table-wrap {
  max-height: 380px; overflow: auto; margin-top: 14px;
  border: 1px solid var(--border); border-radius: 12px;
}
.perm-table { min-width: 520px; }
.perm-table th.num, .perm-table td.num { text-align: center; width: 64px; }
.perm-table td .cell-main { gap: 8px; }
.perm-table td .doc-icon { width: 26px; height: 26px; }
.perm-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* شاشة الإنقاذ عند تلف البيانات */
.rescue-mode .app { display: none !important; }
#rescue-layer {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center;
  padding: 24px; background: radial-gradient(circle at 20% 10%, #1e293b, #0b1220 70%);
  overflow: auto; direction: rtl;
}
.rescue-card {
  width: min(720px, 100%); background: var(--surface, #fff); color: var(--text, #111827);
  border-radius: 22px; padding: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.45);
  text-align: center;
}
.rescue-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px;
  display: grid; place-items: center; background: #fef3c7; color: #b45309;
}
.rescue-icon .ic { width: 34px; height: 34px; }
.rescue-card h1 { font-size: 22px; margin-bottom: 8px; }
.rescue-msg { color: var(--muted, #6b7280); font-size: 13px; margin-bottom: 18px; line-height: 1.8; }
.rescue-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0 10px; }
.rescue-actions .btn { justify-content: center; min-height: 46px; }
.rescue-foot { font-size: 11px; color: var(--muted, #6b7280); margin-top: 14px; }
.rescue-foot .mono { direction: ltr; display: inline-block; }
@media (max-width: 640px) { .rescue-actions { grid-template-columns: 1fr; } .rescue-card { padding: 24px; } }

/* مكدس تفاصيل الأخطاء في تبويب التشخيص */
.diag-stack {
  direction: ltr; text-align: left; font-size: 10.5px; line-height: 1.5;
  background: var(--surface-2, #f8fafc); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px; margin-top: 6px; max-height: 160px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
}

/* =========================================================
   صفحة المساعدة والدليل السريع
   ========================================================= */
.help-tools { margin-bottom: 14px; }
.help-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 12px; height: 42px; min-width: 300px; flex: 0 1 420px;
}
.help-search .ic { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; }
.help-search input {
  border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; width: 100%; height: 100%;
}
.help-hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 22px; padding: 22px 24px; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--primary-soft) 140%);
}
.help-hero-main h2 { margin: 10px 0 6px; font-size: 21px; color: var(--text); }
.help-hero-main p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.help-hero-main .badge { display: inline-flex; align-items: center; gap: 5px; }
.help-hero-main .badge .ic { width: 14px; height: 14px; }
.help-start { margin: 0; padding: 0; list-style: none; counter-reset: hs; display: grid; gap: 8px; }
.help-start li {
  counter-increment: hs; position: relative;
  padding: 8px 40px 8px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
}
.help-start li::before {
  content: counter(hs); position: absolute; right: 10px; top: 9px;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.help-start a { color: var(--text); font-weight: 600; font-size: 13px; text-decoration: none; }
.help-start a:hover { color: var(--primary); }
.help-start small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

.help-section { margin: 22px 0; }
.help-section .card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.help-section .card-head h3 { margin: 0; font-size: 15px; color: var(--text); }
.help-section .card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.help-tile {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px; border-radius: 14px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.help-tile:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: var(--shadow-sm); transform: translateY(-1px);
}
.help-tile-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.help-tile-icon .ic { width: 19px; height: 19px; }
.help-tile-body { min-width: 0; flex: 1; }
.help-tile-body strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.help-tile-body p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.help-tile-body ul { margin: 6px 0 0; padding: 0; list-style: none; }
.help-tile-body li {
  position: relative; padding-right: 14px; margin-top: 3px;
  font-size: 11px; color: var(--text-2); line-height: 1.55;
}
.help-tile-body li::before {
  content: ""; position: absolute; right: 3px; top: 7px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--teal);
}
.help-tile-go { flex: 0 0 auto; width: 16px; height: 16px; color: var(--muted-2); margin-top: 4px; }

.help-tasks { display: grid; gap: 8px; }
.help-task {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.help-task summary {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.help-task summary::-webkit-details-marker { display: none; }
.help-task summary .ic { width: 17px; height: 17px; color: var(--teal); flex: 0 0 auto; }
.help-task summary::after {
  content: "+"; margin-inline-start: auto; color: var(--muted);
  font-size: 17px; font-weight: 400; line-height: 1;
}
.help-task[open] summary::after { content: "−"; }
.help-task[open] summary { border-bottom: 1px solid var(--border); }
.help-task-body { padding: 12px 16px 14px; font-size: 12.5px; color: var(--text-2); }
.help-task-body p { margin: 0 0 6px; }
.help-steps { margin: 0; padding-inline-start: 18px; }
.help-steps li { margin: 4px 0; line-height: 1.7; }
.help-faq summary .ic { color: var(--primary); }
.help-keys { max-width: 560px; }
.help-keys kbd {
  display: inline-block; min-width: 62px; text-align: center;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 6px; background: var(--surface-2);
  font-family: var(--num); font-size: 11.5px; color: var(--text);
}
.help-empty { padding: 10px 0; }

@media (max-width: 1100px) {
  .help-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .help-grid { grid-template-columns: minmax(0, 1fr); }
  .help-search { flex: 1 1 auto; min-width: 0; }
}
@media print {
  .help-tools { display: none !important; }
  .help-grid { grid-template-columns: 1fr 1fr; }
  .help-tile, .help-task { break-inside: avoid; }
  .help-hero { background: #fff !important; }
}

/* اختيار فروع المستخدم (نطاق الصلاحيات) */
.branch-picker {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 8px 0 2px;
}
.branch-picker .chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 400; color: var(--text-2);
  cursor: pointer; user-select: none;
}
.branch-picker .chk input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.branch-picker .chk input:disabled { opacity: .45; cursor: not-allowed; }
.branch-picker .chk input[data-branch-all] { accent-color: var(--teal); }

/* بوابة الموظف — الخدمة الذاتية (M7) */
.self-account-box {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.portal-head .profile-main { flex: 1; min-width: 220px; }
.portal-head .profile-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.portal-head .profile-name h2 {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.3px;
}
.portal-tabs .tab { display: inline-flex; align-items: center; gap: 6px; }
.portal-tabs .tab .ic { width: 15px; height: 15px; }
.portal-period {
  min-width: 138px; text-align: center; padding: 0 4px;
  font-size: 12px; font-weight: 600; color: var(--text); align-self: center;
}
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.portal-balance-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px;
}
.portal-balance {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.portal-balance-value {
  font-size: 24px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.portal-balance-value small { font-size: 11px; font-weight: 400; color: var(--muted); }
.portal-balance-meta {
  display: flex; flex-wrap: wrap; gap: 3px 10px;
  font-size: 11px; color: var(--muted);
}
.portal-balance .progress { margin-top: auto; }
@media (max-width: 820px) {
  .portal-head { align-items: flex-start; }
  .portal-head .profile-facts { width: 100%; margin-inline-start: 0; margin-top: 4px; }
  .portal-period { min-width: 110px; }
}

/* =========================================================
   M19 — تجاوب الموبايل + إشعارات داخل البرنامج + PWA
   ========================================================= */

/* شارة عدد الإشعارات على الجرس */
.icon-btn .notif-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  font-variant-numeric: tabular-nums;
}
.icon-btn .notif-count.hidden { display: none; }

/* تذييل قائمة الإشعارات + زر «كل الإشعارات» */
.notif-foot { padding: 10px 15px; text-align: center; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.notif-more { border: 0; background: none; color: var(--primary); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.notif-more:hover { text-decoration: underline; }

/* نافذة «كل الإشعارات» */
.notif-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.notif-list .notif-item:last-child { border-bottom: 0; }
.notif-filter button { flex: 1; }

/* زر تثبيت التطبيق فوق الجرس */
#pwa-install { color: var(--primary); }
#pwa-install.hidden { display: none; }

/* ---------------- تجاوب الموبايل ---------------- */
@media (max-width: 760px) {
  /* الجداول داخل غلاف: تمرير أفقي آمن بدل كسر التخطيط */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap > .table { min-width: 560px; }
  .table-wrap > .table.compact { min-width: 460px; }

  .topbar-actions { gap: 6px; }
  .icon-btn { width: 36px; height: 36px; }

  /* أهداف لمس مريحة */
  .btn { min-height: 34px; }
  .btn.sm { min-height: 31px; }
  .btn.xs { min-height: 28px; }

  /* النافذة: تذييل ثابت أسفل الشاشة */
  .modal-foot { position: sticky; bottom: 0; border-radius: 0; }

  /* الصفوف والعناوين تلتف بدل الفيض */
  .hstack { flex-wrap: wrap; }
  .card-head { flex-wrap: wrap; }

  /* قائمة الإشعارات تأخذ مساحة أكبر على الشاشة */
  .popover { max-height: 78vh; }
  .toast-root { padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 480px) {
  .page-head h1 { font-size: 15px; }
  .table-wrap > .table { min-width: 480px; }
  .table-wrap > .table.compact { min-width: 420px; }
  .notif-list .notif-item { padding: 10px 12px; }
  .popover { top: 60px; max-height: 84vh; }
}