/* ============================================================
   Sarya HR — Stylesheet
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
svg { fill: currentColor; }

/* ---------- Theme variables ---------- */
:root {
  --brand: #186eb0;
  --brand-dark: #124f80;
  --brand-light: #e8f1fa;
  --brand-rgb: 24, 110, 176;

  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-sidebar: #0f2c43;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --bg-hover: #eef2f7;
  --bg-input: #ffffff;

  --text-primary: #1b2733;
  --text-secondary: #5b6b7c;
  --text-muted: #93a1b0;
  --text-sidebar: #c9d6e4;

  --border: #e2e7ed;
  --border-strong: #cdd6e0;

  --success: #1ea672;
  --success-bg: #e4f7ee;
  --warning: #d98c12;
  --warning-bg: #fdf2dd;
  --danger: #d64545;
  --danger-bg: #fbe7e7;
  --info: #2f7ed8;
  --info-bg: #e7f1fb;
  --default: #6b7785;
  --default-bg: #eceff2;

  --shadow-sm: 0 1px 2px rgba(15, 35, 55, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 35, 55, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 35, 55, 0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-ar: "Cairo", "Tahoma", sans-serif;
  --font-en: "Inter", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #101620;
  --bg-elevated: #182230;
  --bg-sidebar: #0a1420;
  --bg-sidebar-hover: rgba(255,255,255,0.05);
  --bg-hover: #1f2b3a;
  --bg-input: #1b2532;

  --text-primary: #e8edf3;
  --text-secondary: #a3b1c2;
  --text-muted: #6b7889;
  --text-sidebar: #9fb0c4;

  --border: #263244;
  --border-strong: #324158;

  --success: #34c98c;
  --success-bg: #133a2c;
  --warning: #e6a23c;
  --warning-bg: #3a2c10;
  --danger: #e2685f;
  --danger-bg: #3a1c1c;
  --info: #5b9fe8;
  --info-bg: #16293d;
  --default: #8a96a5;
  --default-bg: #232d3a;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
}

html[lang="ar"] body { font-family: var(--font-ar); }
html[lang="en"] body { font-family: var(--font-en); }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0 0 8px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ============================================================
   Login page
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand) 60%, #2aa0d8);
  padding: 24px;
  position: relative;
}
.login-topbar { position: absolute; top: 20px; inset-inline-end: 24px; display: flex; gap: 8px; }
.login-card { background: var(--bg-elevated); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px 36px; width: 100%; max-width: 400px; text-align: center; }
.login-logo { width: 76px; height: 76px; margin: 0 auto 18px; object-fit: contain; }
.login-card h1 { font-size: 22px; color: var(--text-primary); margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: start; }
.login-form input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); }
.login-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.15); }
.login-error { color: var(--danger); background: var(--danger-bg); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.password-field { position: relative; display: flex; }
.password-field input { width: 100%; padding-inline-end: 40px; }
.password-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 4px; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; }
.password-toggle:hover { color: var(--text-primary); }
.password-toggle svg { width: 18px; height: 18px; }
.forgot-pw-link { align-self: center; font-size: 12.5px; color: var(--text-secondary); text-decoration: none; margin-top: -2px; }
.forgot-pw-link:hover { color: var(--brand); text-decoration: underline; }
.temp-pw-display { font-family: monospace; font-size: 20px; font-weight: 700; letter-spacing: 1px; background: var(--bg-input); border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 14px; text-align: center; margin: 12px 0; direction: ltr; }
.btn-block { width: 100%; }
.demo-section { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--border); }
.demo-label { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.demo-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.demo-chip { border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); padding: 6px 12px; border-radius: 20px; font-size: 12px; transition: all .15s; }
.demo-chip:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }
.login-footer { margin-top: 24px; color: rgba(255,255,255,0.85); font-size: 12px; }

/* ============================================================
   Shell layout
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--bg-sidebar); color: var(--text-sidebar);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  transition: transform .2s ease; z-index: 60;
}
.sidebar-brand { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-logo { width: 110px; height: auto; object-fit: contain; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text-sidebar); font-size: 14px; transition: background .15s, color .15s; }
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-label { flex: 1; }
.nav-link:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.role-pill { display: inline-block; font-size: 11px; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,0.08); color: var(--text-sidebar); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--bg-elevated); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.sidebar-toggle { display: none; }
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; flex: 1; max-width: 360px; }
.search-icon svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; display: block; }
.topbar-search input { border: none; background: transparent; outline: none; width: 100%; color: var(--text-primary); }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }

.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; position: relative; transition: background .15s; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--bg-hover); }

.notif-wrap { position: relative; }
.notif-dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-elevated); }
.notif-panel { position: absolute; top: 48px; inset-inline-end: 0; width: 320px; max-height: 400px; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 50; }
.notif-panel[hidden] { display: none; }
.notif-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; transition: background .15s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--brand-light); }
.notif-title { font-weight: 600; margin-bottom: 2px; color: var(--text-primary); }
.notif-body { color: var(--text-secondary); font-size: 12px; }
.notif-date { color: var(--text-muted); font-size: 11px; margin-top: 4px; }

.user-menu { display: flex; align-items: center; gap: 8px; padding-inline-start: 8px; border-inline-start: 1px solid var(--border); margin-inline-start: 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

.page-content { padding: 24px; flex: 1; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header h1 { font-size: 20px; color: var(--text-primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Buttons
   ============================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid transparent; font-size: 13px; font-weight: 600; transition: all .15s; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--bg); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.94); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Cards / KPI / Charts
   ============================================================ */
.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card h3 { font-size: 15px; margin-bottom: 14px; color: var(--text-primary); }

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-icon { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: color-mix(in srgb, var(--accent, var(--brand)) 14%, transparent); color: var(--accent, var(--brand)); }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.kpi-title { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.chart-card canvas { max-height: 260px; }
.chart-card.chart-wide { grid-column: 1 / -1; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { color: var(--text-secondary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; background: var(--bg); }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.row-danger { background: var(--danger-bg); }
.data-table tbody tr.row-warning { background: var(--warning-bg); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }

.perm-matrix .perm-module-row td { background: var(--bg); font-weight: 700; color: var(--brand-dark); padding: 8px 14px; }
.perm-action-label { color: var(--text-secondary); }
.perm-cell { text-align: center; }
.perm-cell input { width: 16px; height: 16px; accent-color: var(--brand); }

.legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-dot.row-danger { background: var(--danger); }
.legend-dot.row-warning { background: var(--warning); }
.legend-dot.badge-success { background: var(--success); }
.legend-dot.badge-warning { background: var(--warning); }
.legend-dot.badge-danger { background: var(--danger); }
.legend-dot.badge-default { background: var(--default); }
.file-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
a.file-chip { text-decoration: none; color: inherit; cursor: pointer; }
a.file-chip:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Filters ---------- */
.filters-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters-row input, .filters-row select { padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary); min-width: 140px; }
.inline-input { width: 90px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary); }

/* ============================================================
   Forms / Modals
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.form-field input, .form-field select, .form-field textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary); width: 100%; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12); }
.form-field input:disabled, .form-field select:disabled { opacity: .6; }
.notice-hint { margin-top: -4px; }
.hint-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(10, 16, 24, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: var(--bg-elevated); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-box.modal-wide { max-width: 820px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-close { font-size: 16px; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ============================================================
   Tabs
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab-btn { background: none; border: none; padding: 10px 18px; font-size: 13.5px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ============================================================
   Badges
   ============================================================ */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-default { background: var(--default-bg); color: var(--default); }

/* ============================================================
   Toast
   ============================================================ */
.toast-host { position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border); border-inline-start: 4px solid var(--brand); border-radius: var(--radius-md); padding: 12px 18px; box-shadow: var(--shadow-lg); font-size: 13px; color: var(--text-primary); min-width: 220px; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-inline-start-color: var(--success); }
.toast-error { border-inline-start-color: var(--danger); }
.toast-warning { border-inline-start-color: var(--warning); }
.toast-info { border-inline-start-color: var(--info); }

/* ============================================================
   Leave balance cards / workflow cards
   ============================================================ */
.balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.balance-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); }
.balance-type { font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.balance-numbers { display: flex; justify-content: space-between; gap: 6px; }
.balance-numbers > div { display: flex; flex-direction: column; align-items: center; flex: 1; }
.balance-numbers .num { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.balance-numbers .num.accent { color: var(--brand); }
.balance-numbers .lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.workflow-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 12px; }
.workflow-name { font-weight: 700; font-size: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.workflow-steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wf-step { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 12px; color: var(--text-secondary); }
.wf-arrow { color: var(--text-muted); }

/* ============================================================
   Calendar
   ============================================================ */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-header h3 { font-size: 15px; margin-bottom: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-grid-head { margin-bottom: 4px; }
.cal-weekday { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-muted); padding-bottom: 4px; }
.cal-cell { min-height: 84px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: var(--bg); display: flex; flex-direction: column; gap: 3px; }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-daynum { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); }
.cal-leave-chip { font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--brand-light); color: var(--brand-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 10px; color: var(--text-muted); }

/* ============================================================
   Timeline (employment stages)
   ============================================================ */
.timeline { position: relative; padding-inline-start: 24px; display: flex; flex-direction: column; gap: 0; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 22px; display: flex; gap: 14px; }
.timeline-dot { position: absolute; inset-inline-start: -24px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid var(--bg-elevated); box-shadow: 0 0 0 2px var(--brand); }
.timeline-body { flex: 1; }
.timeline-date { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-title { font-weight: 700; font-size: 13.5px; color: var(--text-primary); margin-bottom: 4px; }
.timeline-note { font-size: 12.5px; color: var(--text-secondary); }

/* ============================================================
   Clearance checklist
   ============================================================ */
.clearance-card { }
.clearance-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-size: 13.5px; flex-wrap: wrap; }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px; }
.checklist-item.done { background: var(--success-bg); border-color: transparent; }
.checklist-item.done span:first-child { text-decoration: line-through; color: var(--text-muted); }

/* ============================================================
   Employee profile
   ============================================================ */
.profile-header { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; flex-shrink: 0; }
.profile-meta { display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.profile-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.profile-badges { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.info-item { display: flex; flex-direction: column; }
.info-key { font-size: 11.5px; color: var(--text-muted); margin-bottom: 3px; }
.info-val { font-size: 13.5px; color: var(--text-primary); font-weight: 600; }

/* ============================================================
   Role preview grid
   ============================================================ */
.role-preview-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.chart-wide { grid-column: auto; }
}
@media (max-width: 880px) {
  .sidebar-toggle { display: flex; }
  .sidebar { position: fixed; inset-inline-start: 0; transform: translateX(-100%); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar-search { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .user-meta { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .login-card { padding: 28px 20px; }
}

/* ============================================================
   Prin
/* ============================================================
   إضافات النسخة المُعاد تصميمها — تنبيه الرصيد السالب،
   شريط تتبع الموافقات، صفحة التفويضات، بياناتي
   ============================================================ */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.warning-text { color: var(--danger); font-size: 12px; margin-top: 6px; font-weight: 600; }

.balance-card.balance-negative,
.balance-preview.balance-negative {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.balance-track { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }
.balance-preview { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; background: var(--bg); font-size: 13px; }
.balance-preview .lbl { color: var(--text-secondary); }

/* ---------- Approval progress stepper ---------- */
.approval-progress { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.ap-step { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; font-size: 12px; background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary); }
.ap-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.ap-step.ap-pending { color: var(--text-muted); }
.ap-step.ap-active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-light); font-weight: 700; }
.ap-step.ap-active .ap-dot { background: var(--brand); }
.ap-step.ap-done { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.ap-step.ap-done .ap-dot { background: var(--success); }
.ap-step.ap-rejected { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.ap-step.ap-rejected .ap-dot { background: var(--danger); }

/* ---------- Stat grid (بياناتي) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 6px; }
.stat-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; text-align: center; }
.stat-box.stat-negative { border-color: var(--danger); background: var(--danger-bg); }
.stat-value { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.stat-box.stat-negative .stat-value { color: var(--danger); }
.stat-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }

/* ---------- Profile card (بياناتي / لوحة التحكم) ---------- */
.card-title { font-size: 15px; margin-bottom: 14px; color: var(--text-primary); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title-row .card-title { margin-bottom: 0; }
.profile-card .profile-header { margin-bottom: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.info-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 3px; display: block; }
.info-value { font-size: 13.5px; color: var(--text-primary); font-weight: 600; display: block; }

/* ---------- Delegations page ---------- */
.delegation-list { display: flex; flex-direction: column; gap: 10px; }
.delegation-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); cursor: pointer; }
.delegation-label { font-size: 13.5px; color: var(--text-primary); font-weight: 600; }
