/* Movoyager Human Capital — dark theme
   Colours from the Movoyager logo: dark blue #1C75BC, light blue #27AAE1. */

:root {
  --navy:        #123A63;
  --navy-deep:   #0A1A2E;
  --cobalt:      #1C75BC;
  --teal:        #4FC3D9;
  --cyan:        #27AAE1;
  --red:         #ED1C24;
  --gray:        #808285;

  --bg:          #0F1F2A;
  --bg-alt:      #122330;
  --surface:     #172F41;
  --surface-2:   #1E3D53;
  --surface-3:   #264861;
  --border:      #2F526B;
  --border-soft: #254053;

  --text:        #F2F7FA;
  --text-dim:    #B2C8D7;
  --text-faint:  #7C9DB4;
  --heading:     #fff;
  --danger-text: #ff8f93;
  --logo-filter: brightness(0) invert(1);

  --accent-grad: linear-gradient(100deg, var(--navy) 0%, var(--cobalt) 45%, var(--cyan) 100%);
  --ok:          #4CC38A;
  --warn:        #E8A93E;
  --danger:      var(--red);

  /* Categorical chart palette — validated dark-mode set (fixed order, CVD-safe) */
  --series-1: #3987e5;  /* blue */
  --series-2: #d95926;  /* orange */
  --series-3: #199e70;  /* aqua */
  --series-4: #c98500;  /* yellow */
  --series-5: #d55181;  /* magenta */
  --series-6: #008300;  /* green */
  --series-7: #9085e9;  /* violet */
  --series-8: #e66767;  /* red */
  --series-other: #577286; /* residual "Other" bucket — neutral, not an identity hue */

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 6px 24px rgba(4, 13, 20, 0.35);
  --font-head: 'Century Gothic', 'Poppins', 'Segoe UI Semibold', 'Segoe UI', sans-serif;
  --font-body: 'Segoe UI', 'Avenir Next', 'Cairo', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 15% -10%, #1A3F5A 0%, var(--bg) 45%) fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-font { font-family: var(--font-head); letter-spacing: 0.2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

a { color: inherit; }
button { font-family: inherit; }

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: 68px 1fr;
  grid-template-areas:
    "topbar topbar"
    "sidebar main";
  height: 100vh;
}

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  background: linear-gradient(180deg, #19384E 0%, #143146 100%);
  border-bottom: 1px solid var(--border-soft);
  z-index: 5;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup img { height: 30px; display: block; filter: var(--logo-filter); }
.connect-hero img.hero-logo { filter: var(--logo-filter); }
.theme-btn { min-width: 34px; font-size: 15px; line-height: 1; }
.brand-titles { display: flex; flex-direction: column; line-height: 1.15; }
.brand-titles .en { font-family: var(--font-head); font-weight: 700; font-size: 15.5px; color: var(--heading); }
.brand-titles .sub { font-size: 11px; color: var(--text-faint); letter-spacing: 0.4px; text-transform: uppercase; }
.brand-titles .sub.slogan { text-transform: none; font-style: italic; letter-spacing: 0.2px; }

.global-search { position: relative; width: 280px; flex: none; }
.global-search .search-box { background: var(--surface); border: 1px solid var(--border-soft); }
.global-search-results {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-alt); border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); max-height: 360px; overflow-y: auto; z-index: 20; padding: 6px;
}
.global-search-results.show { display: block; }
.gs-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.gs-row:hover { background: var(--surface-2); }
.gs-row .who .name { font-weight: 600; color: var(--heading); font-size: 13px; }
.gs-row .who .meta { font-size: 11.5px; color: var(--text-faint); }
.gs-empty { padding: 14px 10px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.conn-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--text-dim);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: none; }
.conn-pill.live .conn-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(76,195,138,0.18); }
.conn-pill.live { color: #d6f5e6; }
.conn-pill.stale .conn-dot { background: var(--warn); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-3); border-color: var(--teal); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--red); color: #ffb4b7; }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex: none; }
.dirty-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 2px; box-shadow: 0 0 0 2px rgba(232,169,62,0.25); }
.btn.dirty .dirty-dot { display: inline-block; }

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-alt);
  border-right: 1px solid var(--border-soft);
  padding: 18px 12px;
  overflow-y: auto;
}
.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-faint); margin: 18px 10px 8px;
}
.nav-group-label:first-child { margin-top: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer; font-size: 13.5px; font-weight: 500;
  margin-bottom: 3px; border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: var(--surface-2);
  color: var(--heading);
  border-color: var(--border);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  background: var(--teal); border-radius: 3px;
}
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  background: var(--surface-3); color: var(--text-dim);
  padding: 2px 7px; border-radius: 999px;
}
.nav-item .badge.warn { background: rgba(232,169,62,0.18); color: var(--warn); }
.nav-item .tag-soon {
  margin-left: auto; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--border); padding: 2px 6px; border-radius: 6px;
}

/* ---------- Main ---------- */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 26px 30px 60px;
}
.view { display: none; animation: fadein .18s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.view-head h1 { margin: 0 0 4px; font-size: 22px; color: var(--heading); }
.view-head p { margin: 0; color: var(--text-dim); font-size: 13.5px; max-width: 640px; }
.view-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.export-toolbar { display: flex; gap: 6px; padding-left: 10px; margin-left: 4px; border-left: 1px solid var(--border-soft); }
.export-toolbar .btn { padding: 8px 12px; }

/* ---------- Cards / KPIs ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }

.kpi-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.kpi-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  background: var(--accent-grad); opacity: 0.12; border-radius: 50%;
}
.kpi-card .label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.kpi-card .value { font-family: var(--font-head); font-size: 30px; font-weight: 700; color: var(--heading); margin-top: 6px; }
.kpi-card .delta { font-size: 12px; margin-top: 6px; color: var(--text-faint); }
.kpi-card .delta.warn { color: var(--warn); }
.kpi-card .delta.ok { color: var(--ok); }

.card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 20px 22px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; color: var(--heading); display: flex; align-items: center; gap: 8px;}
.card h3 .muted { font-weight: 400; font-size: 12px; color: var(--text-faint); }

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* bar list */
.bar-row { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.8px;}
.bar-row .name { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent-grad); border-radius: 6px; }
.bar-row .count { text-align: right; color: var(--text-faint); }

/* ---------- Toolbar / filters ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 16px;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 8px 12px; flex: 1; min-width: 220px;
}
.search-box svg { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.search-box input { background: none; border: none; outline: none; color: var(--text); width: 100%; font-size: 13px; }
.search-box input::placeholder { color: var(--text-faint); }

select, .select {
  background: var(--surface); border: 1px solid var(--border-soft); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12.8px; outline: none;
}
select:hover { border-color: var(--border); }

/* ---------- Payroll range filters (Monthly Payroll) ---------- */
.range-filter-panel {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-top: 10px;
}
.range-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; }
.range-filter-item label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-faint); margin-bottom: 6px;
}
.range-filter-item .range-inputs { display: flex; align-items: center; gap: 6px; }
.range-filter-item .range-inputs input {
  width: 0; flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 8px; color: var(--text); font-size: 12.5px;
}
.range-filter-item .range-inputs span { color: var(--text-faint); font-size: 11px; }
#salFilterCount, #dashFilterCount {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px;
  border-radius: 999px; background: var(--teal); color: #04211d; font-size: 10.5px; font-weight: 700;
  padding: 0 4px; margin-left: 4px;
}

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow-card);}
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-faint); background: var(--surface-2);
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text); vertical-align: middle; }
tbody tr { transition: background .12s ease; cursor: default; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.row-click { cursor: pointer; }

/* Monthly Payroll: Code/Name/Department/OT Hours/Gross/Net/OT Value/Deductions/Advances/
   Final Salary/Payment Method/print icon — 12 columns, still wider than most windows at a
   comfortable font size. Compact the numeric columns and pin the last two (Payment
   Method + the print icon) to the visible edge while scrolling, so they're never hidden. */
#view-salaries table { min-width: 1040px; }
#view-salaries thead th, #view-salaries tbody td { padding: 9px 10px; }
#view-salaries thead th:nth-child(n+3):nth-child(-n+11),
#view-salaries tbody td:nth-child(n+3):nth-child(-n+11) { white-space: nowrap; font-size: 12.5px; }
.ot-hours-cell {
  width: 64px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 6px; color: var(--text); font-size: 12.5px;
  font-family: inherit; text-align: right;
}
.ot-hours-cell:focus { outline: none; border-color: var(--teal); }
#view-salaries thead th:nth-last-child(2), #view-salaries tbody td:nth-last-child(2) {
  position: sticky; right: 48px; background: var(--surface);
}
#view-salaries thead th:last-child, #view-salaries tbody td:last-child {
  position: sticky; right: 0; width: 48px; background: var(--surface);
  box-shadow: -6px 0 8px -6px rgba(0,0,0,0.4);
}
#view-salaries thead th:nth-last-child(2), #view-salaries thead th:last-child { background: var(--surface-2); z-index: 3; }
#view-salaries tbody td:nth-last-child(2), #view-salaries tbody td:last-child { z-index: 2; }
#view-salaries tbody tr:hover td:nth-last-child(2), #view-salaries tbody tr:hover td:last-child { background: var(--surface-2); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--accent-grad); color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.cell-emp { display: flex; align-items: center; gap: 10px; }
.cell-emp .who .name { font-weight: 600; color: var(--heading); }
.cell-emp .who .code { font-size: 11.5px; color: var(--text-faint); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.ok { background: rgba(76,195,138,0.15); color: var(--ok); }
.pill.warn { background: rgba(232,169,62,0.16); color: var(--warn); }
.pill.danger { background: rgba(237,28,36,0.16); color: var(--danger-text); }
.pill.neutral { background: var(--surface-3); color: var(--text-dim); }
/* Strong alert (probation ending in the last 10 days, user 2026-11-10) */
@keyframes alarmpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(237,28,36,.55); } 50% { box-shadow: 0 0 0 6px rgba(237,28,36,0); } }
.pill.alarm { background: var(--red); color: #fff; animation: alarmpulse 1.6s ease-in-out infinite; }
.banner.alarm { background: rgba(237,28,36,.14); border: 2px solid var(--red); animation: alarmpulse 1.6s ease-in-out infinite; }
.banner.alarm > svg { color: #ff6b70; width: 26px; height: 26px; }
.banner.alarm .alarm-title { font-size: 15.5px; color: var(--heading); }
.banner.alarm .alarm-list { margin: 8px 0 0; display: grid; gap: 4px; }
.banner.alarm .alarm-list div { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text); }
tr.row-alarm td { background: rgba(237,28,36,.10); }
tr.row-alarm td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.nav-item .badge.alarm, .btn .badge.alarm { background: var(--red); color: #fff; animation: alarmpulse 1.6s ease-in-out infinite; }
.btn .badge.alarm { margin-left: 6px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }

.empty-state {
  text-align: center; padding: 70px 20px; color: var(--text-faint);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 14px; opacity: .5; }
.empty-state h3 { color: var(--text-dim); margin: 0 0 8px; font-size: 16px; }
.empty-state .btn { margin-top: 16px; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 12px; color: var(--text-faint); }

/* ---------- Drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(6, 14, 20,0.6); backdrop-filter: blur(2px);
  display: none; z-index: 40;
}
.overlay.show { display: block; }
.drawer {
  position: fixed; top: 0; right: -460px; width: 440px; max-width: 92vw; height: 100vh;
  background: var(--bg-alt); border-left: 1px solid var(--border-soft);
  z-index: 41; transition: right .22s ease; display: flex; flex-direction: column;
  box-shadow: -18px 0 40px rgba(0,0,0,0.4);
}
.drawer.show { right: 0; }
.drawer.wide { width: 500px; right: -520px; }
.drawer.wide.show { right: 0; }
.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { margin: 0; font-size: 16px; color: var(--heading); }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 16px 22px; border-top: 1px solid var(--border-soft); display: flex; gap: 10px; justify-content: flex-end; }
.icon-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--heading); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field .hint { font-size: 11px; color: var(--text-faint); margin-top: 5px; }

/* ---------- Banners ---------- */
.banner {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--radius-md); margin-bottom: 20px;
  border: 1px solid var(--border-soft); background: var(--surface);
}
.banner svg { width: 20px; height: 20px; flex: none; color: var(--teal); margin-top: 1px; }
.banner.info { border-color: rgba(39, 170, 225,0.35); }
.banner.info svg { color: var(--cyan); }
.banner b { color: var(--heading); }
.banner p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }

.preview-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(39, 170, 225,0.15); color: var(--cyan); padding: 4px 10px; border-radius: 999px;
}

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 10px; min-width: 240px; animation: toastin .18s ease;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--red); }
@keyframes toastin { from { opacity:0; transform: translateY(8px);} to {opacity:1; transform:none;} }

/* ---------- Landing / connect screen ---------- */
.connect-hero {
  max-width: 640px; margin: 6vh auto; text-align: center;
}
.connect-hero img { height: 64px; margin-bottom: 22px; }
.connect-hero h1 { font-size: 26px; margin: 0 0 10px; color: var(--heading); }
.connect-hero p { color: var(--text-dim); font-size: 14px; margin: 0 auto 26px; max-width: 480px; }
.connect-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-card); text-align: left;
}
.connect-card .path {
  font-family: 'Consolas', monospace; font-size: 12px; color: var(--text-dim);
  background: var(--bg); border: 1px solid var(--border-soft); padding: 10px 12px; border-radius: 8px; margin: 10px 0 18px; word-break: break-all;
}

/* Offer letter print sheet — compact so the whole offer fits on ONE page (Letter / A4). */
.offer-sheet {
  background: #fff; color: #192731; border-radius: var(--radius-lg); padding: 30px 40px;
  max-width: 760px; margin: 0 auto; box-shadow: var(--shadow-card);
}
.offer-sheet .offer-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 14px; }
.offer-sheet .offer-head img { height: 34px; }
.offer-sheet .offer-head .date { font-size: 11.5px; color: #657886; }
.offer-sheet h2 { color: var(--navy); margin: 0 0 2px; font-size: 20px; }
.offer-sheet .sub { color: #657886; font-size: 12px; margin-bottom: 10px; }
.offer-sheet table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; margin: 10px 0; } /* stays inside the frame (base table rule has min-width: 760px) */
.offer-sheet table td { overflow-wrap: anywhere; }
.offer-sheet table td { padding: 5px 0; border-bottom: 1px solid #EAF5FC; font-size: 12.5px; }
.offer-sheet table td:first-child { color: #657886; width: 170px; }
.offer-sheet table td:last-child { font-weight: 600; color: #192731; }
.offer-sheet .terms { font-size: 12px; color: #465F71; line-height: 1.5; margin-top: 12px; }
.offer-sheet p { font-size: 12.5px; color: #394E5D; line-height: 1.5; margin: 7px 0; }
.offer-sheet ul { margin: 4px 0 8px; padding-left: 20px; }
.offer-sheet ul li { font-size: 12.5px; color: #394E5D; line-height: 1.5; }
.offer-sheet .closing { margin-top: 10px; }
.offer-sheet .nowrap { white-space: nowrap; } /* keep the reply e-mail on one line */
.offer-sheet .offer-page2 { padding-top: 0; } /* no page break — one page */
.offer-sheet .signature-block { margin-top: 18px; font-size: 12.5px; color: #192731; line-height: 1.5; }
.offer-sheet .signature-block .name { font-weight: 700; }
/* Employee sign-off: name, signature and date on one row at the end */
.offer-sheet .single-sign { margin-top: 26px; display: flex; gap: 24px; flex-wrap: wrap; }
.offer-sheet .single-sign .line { flex: 1 1 0; min-width: 150px; font-size: 12px; color: #657886; margin-top: 0; }
.offer-sheet .single-sign .line b { display: block; margin-top: 18px; padding-top: 4px; border-top: 1px solid #C8DFEF; color: #192731; letter-spacing: 0; font-weight: 600; min-height: 16px; }
.offer-sheet .sign { display: flex; justify-content: space-between; margin-top: 46px; }
.offer-sheet .sign div { width: 45%; border-top: 1px solid #C8DFEF; padding-top: 8px; font-size: 12px; color: #657886; }

/* Grant statement (Financial Support) print sheet — matches the company's official
   "طلب الحصول على منحة الشركة فى المناسبات الاجتماعية" paper form, RTL Arabic. */
.grant-sheet {
  background: #fff; color: #192731; border-radius: var(--radius-lg); padding: 22px 30px;
  max-width: 760px; margin: 0 auto; box-shadow: var(--shadow-card);
  direction: rtl; text-align: right; font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
/* The app's base `table` rule sets min-width: 760px for normal data tables (so they don't
   get too cramped) — inherited here since these narrower tables don't set their own
   min-width, forcing them past this sheet's 700px content area and off the page's left
   edge in this RTL layout (the excess overflows toward the logical end = physical left). */
.grant-sheet table { min-width: 0; }
.grant-sheet .gs-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 10px; }
.grant-sheet .gs-head img { height: 30px; }
.grant-sheet .gs-head .date { font-size: 11px; color: #657886; direction: ltr; }
.grant-sheet h2 { color: var(--navy); margin: 0 0 3px; font-size: 16px; text-align: center; }
.grant-sheet .gs-sub { color: #657886; font-size: 11px; margin-bottom: 10px; text-align: center; }
.grant-sheet h3.gs-section { font-size: 12px; color: var(--navy); border-bottom: 1px solid #DAEAF6; padding-bottom: 4px; margin: 12px 0 6px; }
.grant-sheet .gs-intro { font-size: 11.5px; line-height: 1.6; color: #394E5D; margin-bottom: 8px; }
.grant-sheet table.gs-fields { width: 100%; border-collapse: collapse; margin-bottom: 2px; }
.grant-sheet table.gs-fields td { padding: 3px 4px; font-size: 11.5px; border-bottom: 1px solid #EAF5FC; }
.grant-sheet table.gs-fields td.gs-label { color: #657886; width: 130px; }
.grant-sheet table.gs-fields td.gs-value { font-weight: 600; color: #192731; }
.grant-sheet table.gs-checklist { width: 100%; border-collapse: collapse; font-size: 10.5px; margin: 4px 0 8px; }
.grant-sheet table.gs-checklist td, .grant-sheet table.gs-checklist th { border: 1px solid #DAEAF6; padding: 3px 7px; text-align: right; line-height: 1.4; }
.grant-sheet table.gs-checklist th { background: #F1F6FA; color: #465F71; font-weight: 700; }
.grant-sheet table.gs-checklist tr.gs-applicable { background: rgba(76,195,138,0.12); }
.grant-sheet table.gs-checklist tr.gs-applicable td:first-child { font-weight: 700; color: var(--navy); }
.grant-sheet table.gs-checklist .gs-docs-note { font-size: 9px; color: #859AA9; display: block; margin-top: 2px; }
.grant-sheet .gs-checkbox { display: inline-block; width: 11px; height: 11px; border: 1.3px solid #465F71; border-radius: 2px; vertical-align: middle; }
.grant-sheet .gs-decision { border: 1.5px solid #DAEAF6; border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 11.5px; line-height: 1.6; }
.grant-sheet .gs-decision.approved { border-color: rgba(76,195,138,0.5); background: rgba(76,195,138,0.08); }
.grant-sheet .gs-decision.declined { border-color: rgba(237,28,36,0.4); background: rgba(237,28,36,0.06); }
.grant-sheet .gs-decision .fill { display: inline-block; min-width: 90px; border-bottom: 1px solid #91B2CA; text-align: center; }
.grant-sheet .gs-sign { display: flex; justify-content: space-between; margin-top: 18px; gap: 20px; }
.grant-sheet .gs-sign div { width: 45%; border-top: 1px solid #C8DFEF; padding-top: 6px; font-size: 11px; color: #657886; }
.grant-sheet .gs-note { font-size: 9.5px; color: #859AA9; margin-top: 10px; line-height: 1.5; }

/* Employment contract print sheet — reuses the .grant-sheet RTL Arabic wrapper/header,
   adds flowing-paragraph styling for the numbered legal clauses (matches Files/Contract.docx
   wording verbatim; only the "Change" placeholders become live data). */
.grant-sheet.contract-doc { max-width: 820px; }
.grant-sheet.contract-doc p { font-size: 11px; line-height: 1.85; color: #394E5D; margin: 9px 0; text-align: justify; }
.grant-sheet.contract-doc p.contract-title { text-align: center; font-weight: 700; color: var(--navy); font-size: 13px; margin: 0 0 10px; }
.grant-sheet.contract-doc .fill-blank { display: inline-block; min-width: 40px; border-bottom: 1px solid #657886; text-align: center; padding: 0 3px; font-weight: 700; color: var(--navy); }
/* Two A4 pages (user 2026-11-17): page 1 = parties, preamble, clauses 1–3; page 2 = clauses 4–10, final clause, signatures.
   On paper each page fills the sheet and its paragraphs are spread evenly. */
.ct-doc { display: flex; flex-direction: column; gap: 14px; }
/* Annual appraisal print form (user 2026-11-17) — English + Arabic on the same page, like the screen */
.grant-sheet.ap-print { padding: 16px 22px; direction: ltr; text-align: left; } /* same reading order as the screen form */
.grant-sheet.ap-print .gs-sign div, .grant-sheet.ap-print table.gs-fields td { text-align: left; }
.grant-sheet.ap-print .ap-en { direction: ltr; unicode-bidi: isolate; }
.grant-sheet.ap-print .ap-ar { direction: rtl; unicode-bidi: isolate; }
.grant-sheet.ap-print .ap-sep { color: #95AAB9; }
.grant-sheet.ap-print h2 { margin-bottom: 8px; font-size: 15px; }
.grant-sheet.ap-print table.ap-info td { font-size: 10.5px; padding: 3px 5px; }
.grant-sheet.ap-print table.ap-info td.gs-label { width: 150px; white-space: nowrap; }
.grant-sheet.ap-print .ap-sub { font-weight: 400; font-size: 9.5px; color: #657886; }
.grant-sheet.ap-print .ap-scale { font-size: 9.5px; color: #465F71; margin: 6px 0 2px; }
.grant-sheet.ap-print .ap-h { font-size: 12px; font-weight: 700; color: var(--navy); margin: 9px 0 4px; }
.grant-sheet.ap-print .ap-h small { color: #657886; font-weight: 400; }
.grant-sheet.ap-print table.ap-t { width: 100%; min-width: 0; border-collapse: collapse; font-size: 10.5px; }
.grant-sheet.ap-print table.ap-t th, .grant-sheet.ap-print table.ap-t td { border: 1px solid #C8DFEF; padding: 3px 4px; text-align: center; }
.grant-sheet.ap-print table.ap-t th { background: #F1F6FA; color: #465F71; font-size: 10px; }
.grant-sheet.ap-print table.ap-t th div { font-size: 8.5px; font-weight: 400; line-height: 1.25; }
.grant-sheet.ap-print table.ap-t td { color: #192731; background: #fff; }
.grant-sheet.ap-print table.ap-t tbody tr:hover { background: none; }
.grant-sheet.ap-print table.ap-t .ap-crit { text-align: left; width: 46%; }
.grant-sheet.ap-print table.ap-t td.ap-crit .ap-en { display: block; color: #657886; font-size: 9.5px; }
.grant-sheet.ap-print table.ap-t td.ap-crit .ap-ar { display: block; font-weight: 600; text-align: left; }
.grant-sheet.ap-print table.ap-t th.ap-crit .ap-sep { display: inline; }
.grant-sheet.ap-print table.ap-t td.ap-crit { display: table-cell; }
.grant-sheet.ap-print table.ap-t td.ap-tick { font-size: 13px; font-weight: 700; color: var(--navy); }
.grant-sheet.ap-print table.ap-total { margin-top: 8px; }
.grant-sheet.ap-print .ap-note { font-size: 10.5px; border-bottom: 1px dotted #bbb; padding: 4px 0; min-height: 20px; display: flex; gap: 8px; }
.grant-sheet.ap-print .ap-note .ap-nl { font-weight: 700; white-space: nowrap; }
.grant-sheet.ap-print .ap-note .ap-nv { flex: 1; }
.grant-sheet.ap-print .ap-sign { margin-top: 16px; }
.grant-sheet.ap-print .ap-instr { font-size: 11px; line-height: 1.7; border: 1px solid #DAEAF6; border-radius: 8px; padding: 8px 12px; margin: 10px 0; background: #F9FDFF; }
.grant-sheet.ap-print .ap-instr .ap-ar { display: block; text-align: right; }
.grant-sheet.ap-cover table.ap-t td { padding: 2px 5px; font-size: 10px; }
.grant-sheet.ap-cover table.ap-t td.ap-crit .ap-ar { display: inline; font-weight: 600; }
.grant-sheet.ap-cover table.ap-t thead { display: table-header-group; } /* header repeats on every printed page */
.grant-sheet.ap-print .ap-sign div { width: 30%; font-size: 10.5px; line-height: 1.9; }
.grant-sheet.contract-doc.ct-page p { font-size: 12px; line-height: 1.9; margin: 7px 0; }
.grant-sheet.contract-doc.ct-page p.contract-title { font-size: 15px; margin: 2px 0 6px; }
.grant-sheet.contract-doc.ct-page .gs-sign { margin-top: 26px; }
.grant-sheet.contract-doc.ct-page .gs-sign div { font-size: 12.5px; line-height: 2; color: #394E5D; }
.ct-foot { text-align: center; font-size: 10px; color: #859AA9; border-top: 1px solid #DAEAF6; padding-top: 5px; margin-top: 10px; }
@media print {
  #printArea .ct-doc { display: block; }
  #printArea .grant-sheet.contract-doc.ct-page { height: 272mm; max-width: none; width: auto; padding: 0; border-radius: 0; display: flex; flex-direction: column; overflow: visible; break-after: page; page-break-after: always; }
  #printArea .grant-sheet.contract-doc.ct-page:last-child { break-after: auto; page-break-after: auto; }
  #printArea .ct-page .ct-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-evenly; }
  #printArea .ct-page .ct-body p { margin: 0; font-size: 13px; line-height: 1.9; }
  #printArea .ct-page .ct-body p.contract-title { font-size: 17px; }
  #printArea .ct-page .gs-head img { height: 38px; }
  #printArea .ct-page .gs-sign div { font-size: 13.5px; }
}
.grant-sheet.contract-doc .company-address {
  margin: -4px 0 9px; color: #657886; text-align: right; font-size: 10.5px; line-height: 1.6;
}

/* Payslip variant — reuses every .grant-sheet building block (fields table, section
   headers, decision box) but flipped to LTR/English, matching Monthly Payroll's own
   language (unlike the Arabic paper forms the grant/advance statements replicate). */
.grant-sheet.payslip-sheet { direction: ltr; text-align: left; }
.grant-sheet.payslip-sheet .gs-head .date { direction: ltr; }
.grant-sheet.payslip-sheet .gs-decision { text-align: center; }

@media print {
  body * { visibility: hidden; }
  .offer-sheet, .offer-sheet * { visibility: visible; }
  .offer-sheet { position: absolute; top: 0; left: 0; width: 100%; margin: 0; box-shadow: none; }

  /* The app shell keeps its full layout height even while invisible (visibility:hidden
     doesn't collapse layout) — a background view with a long table makes the underlying
     document many pages tall. The grant statement lives inside a position:fixed modal,
     and a fixed ancestor's containing block repeats on EVERY generated page when printing
     (the same mechanism browsers use for print headers/footers) — so without collapsing
     the app shell and un-fixing the modal, the one-page statement tiled identically across
     however many pages the hidden app shell happened to be. Scoped to print-grant-mode
     (set right before window.print() for this one flow) so the unrelated generic
     table-export print path — which needs #appShell's .view.active visible — is untouched. */
  body.print-grant-mode #appShell, body.print-grant-mode #connectScreen { display: none !important; }
  body.print-grant-mode #grantStatementOverlay { display: none !important; }
  body.print-grant-mode #grantStatementPanel {
    position: static !important; display: block !important; width: 100% !important;
    max-height: none !important; overflow: visible !important; transform: none !important;
    opacity: 1 !important; box-shadow: none !important; border: none !important; background: transparent !important;
  }
  /* visibility:hidden (the base rule below) keeps its layout space even while invisible —
     the modal's title/description header and the Print button, sitting before/after the
     statement in DOM order, were reserving blank space above and below it, pushing the
     printed content down from the top of the page. display:none removes that space. */
  body.print-grant-mode .modal-head,
  body.print-grant-mode #grantStatementPrintBtnWrap,
  body.print-grant-mode #grantStatementPanel > .modal-body { padding: 0; }
  body.print-grant-mode .modal-head,
  body.print-grant-mode #grantStatementPrintBtnWrap { display: none !important; }

  .grant-sheet, .grant-sheet * { visibility: visible; }
  .grant-sheet { position: static; margin: 0 auto; box-shadow: none; }

  body.print-report-mode .view.active,
  body.print-report-mode .view.active * { visibility: visible; }
  body.print-report-mode .view.active {
    position: absolute; top: 0; left: 0; width: 100%; padding: 24px; background: #fff; color: #192731;
  }
  body.print-report-mode .view.active .toolbar,
  body.print-report-mode .view.active .view-actions,
  body.print-report-mode .view.active .banner,
  body.print-report-mode .view.active .kpi-card::after,
  body.print-report-mode .view.active button { display: none !important; }
  body.print-report-mode .view.active h1,
  body.print-report-mode .view.active h3,
  body.print-report-mode .view.active .label,
  body.print-report-mode .view.active .value,
  body.print-report-mode .view.active .name,
  body.print-report-mode .view.active .code,
  body.print-report-mode .view.active p { color: #192731 !important; }
  body.print-report-mode .view.active .table-wrap,
  body.print-report-mode .view.active .card,
  body.print-report-mode .view.active .kpi-card { background: #fff; border: 1px solid #ddd; box-shadow: none; }
  body.print-report-mode .view.active table { color: #192731; }
  body.print-report-mode .view.active th { background: #F1F6FA; color: #465F71; }
  body.print-report-mode .view.active th, body.print-report-mode .view.active td { border-color: #DAEAF6; }

  body.print-analysis-mode #analysisPanel,
  body.print-analysis-mode #analysisPanel * { visibility: visible; }
  body.print-analysis-mode #analysisPanel {
    display: flex; position: absolute; top: 0; left: 0; transform: none;
    width: 100%; max-height: none; padding: 24px; background: #fff; color: #192731;
    border: none; box-shadow: none;
  }
  body.print-analysis-mode #analysisPanel .modal-body { overflow: visible; max-height: none; }
  body.print-analysis-mode #analysisFilterStep,
  body.print-analysis-mode .modal-foot,
  body.print-analysis-mode .modal-head button { display: none !important; }
  body.print-analysis-mode .modal-head h3,
  body.print-analysis-mode .modal-head p,
  body.print-analysis-mode .card h3,
  body.print-analysis-mode .kpi-card .label,
  body.print-analysis-mode .kpi-card .value,
  body.print-analysis-mode .bar-row .name,
  body.print-analysis-mode .bar-row .count,
  body.print-analysis-mode .donut-legend-row .lg-name,
  body.print-analysis-mode .donut-legend-row .lg-count,
  body.print-analysis-mode .donut-legend-row .lg-pct,
  body.print-analysis-mode .donut-center .value,
  body.print-analysis-mode .donut-center .label,
  body.print-analysis-mode #analysisDataCount { color: #192731 !important; }
  body.print-analysis-mode .card,
  body.print-analysis-mode .kpi-card { background: #fff; border: 1px solid #ddd; box-shadow: none; }
  body.print-analysis-mode #analysisPanel table { color: #192731; }
  body.print-analysis-mode #analysisPanel th { background: #F1F6FA; color: #465F71; }
  body.print-analysis-mode #analysisPanel th,
  body.print-analysis-mode #analysisPanel td { border-color: #DAEAF6; }
  body.print-analysis-mode #analysisPanel .table-wrap { background: #fff; border: 1px solid #ddd; box-shadow: none; }
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Analysis modal ---------- */
.btn.analysis-btn { border-color: var(--teal); color: var(--teal); }
.btn.analysis-btn:hover { background: rgba(99,186,179,0.12); border-color: var(--teal); }

.modal-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%) scale(.98);
  width: min(1080px, 94vw); max-height: 88vh; background: var(--bg-alt);
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  z-index: 41; display: none; flex-direction: column; opacity: 0;
  transition: opacity .16s ease, transform .16s ease;
}
.modal-panel.show { display: flex; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; color: var(--heading); }
.modal-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--text-faint); }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border-soft); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all .12s ease;
}
.chip:hover { border-color: var(--teal); color: var(--text); }
.chip.active { background: var(--accent-grad); border-color: transparent; color: #fff; }

.an-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; margin-top: 14px; }
.an-filter-field { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px; }
.an-filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.an-filter-field label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-faint); }
.an-check-list { max-height: 140px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.an-check-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
.an-check-row input { accent-color: var(--teal); }
.an-numeric-grid { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 4px; }
.an-numeric-grid .an-check-row { font-size: 13px; }
.an-text-filter { width: 100%; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; outline: none; }
.an-text-filter:focus { border-color: var(--teal); }
.an-range-row { display: flex; align-items: center; gap: 8px; }
.an-range-row input { width: 0; flex: 1; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; outline: none; }
.an-range-row input:focus { border-color: var(--teal); }
.an-range-sep { color: var(--text-faint); font-size: 12px; flex: none; }
.link-btn { background: none; border: none; color: var(--teal); font-size: 11px; font-weight: 600; cursor: pointer; padding: 0; flex: none; }
.link-btn:hover { text-decoration: underline; }

.analysis-charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

.muted-note { color: var(--text-faint); font-size: 12px; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--border-soft); font-size: 13px; color: var(--text-dim); }
.checklist li:last-child { border-bottom: none; }
.checklist svg { width: 16px; height: 16px; color: var(--teal); flex: none; margin-top: 2px; }

/* ---------- Donut charts ---------- */
.donut-layout { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut-wrap { position: relative; flex: none; width: 200px; height: 200px; }
.donut-wrap svg { display: block; }
.donut-seg { cursor: pointer; }
.donut-seg:hover, .donut-seg.hovered { filter: brightness(1.15); }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
}
.donut-center .value { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--heading); line-height: 1.1; }
.donut-center .label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.donut-legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.donut-legend-row {
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 9px;
  font-size: 12.5px; padding: 3px 0; cursor: default; border-radius: 6px; transition: background .12s ease;
}
.donut-legend-row:hover, .donut-legend-row.hovered { background: var(--surface-2); }
.donut-legend-row .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.donut-legend-row .lg-name { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend-row .lg-count { color: var(--heading); font-weight: 600; text-align: right; }
.donut-legend-row .lg-pct { color: var(--text-faint); font-size: 11px; text-align: right; min-width: 38px; }
.donut-empty { color: var(--text-faint); font-size: 13px; padding: 20px 0; }

/* ---------- Org chart (CEO → department heads) ---------- */
.org-ceo-row { display: flex; justify-content: center; }
.org-node-ceo {
  background: var(--accent-grad); color: #fff; border-radius: var(--radius-md); padding: 14px 30px; text-align: center;
  min-width: 240px; box-shadow: 0 4px 18px rgba(99,186,179,0.18);
}
.org-node-ceo .org-role { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #d7fff9; font-weight: 700; }
.org-node-ceo .org-name { font-size: 16.5px; font-weight: 700; margin-top: 3px; }
.org-connector-v { width: 2px; height: 22px; background: var(--border); margin: 0 auto; }
.org-connector-label {
  text-align: center; font-size: 11px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 700; margin: 4px 0 16px;
}
.org-connector-label::before, .org-connector-label::after {
  content: ''; display: inline-block; width: 60px; height: 1px; background: var(--border); vertical-align: middle; margin: 0 10px;
}
.org-dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.org-node-dept {
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; border-left: 3px solid var(--cobalt);
}
.org-node-dept:hover { border-color: var(--teal); box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.org-node-dept.active { border-color: var(--teal); background: var(--surface-3); box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.org-node-dept.no-head { border-left-color: var(--border); }
.org-dept-name { font-size: 11.5px; font-weight: 700; color: var(--teal); text-transform: uppercase; letter-spacing: 0.3px; }
.org-dept-head { font-size: 13.5px; font-weight: 700; color: var(--heading); margin-top: 6px; direction: rtl; text-align: right; }
.org-dept-head.none { direction: ltr; text-align: left; font-weight: 400; font-style: italic; color: var(--text-faint); font-size: 12px; }
.org-dept-title { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.org-dept-count { font-size: 11px; color: var(--text-faint); margin-top: 8px; border-top: 1px solid var(--border-soft); padding-top: 6px; }
.org-detail-panel { margin-top: 20px; border-top: 2px solid var(--teal); padding-top: 18px; display: none; }
.org-detail-panel.show { display: block; }
.org-detail-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; gap: 6px; }
.org-detail-header h4 { font-size: 15px; color: var(--heading); font-weight: 700; }
.org-detail-header .org-detail-count { font-size: 12.5px; color: var(--text-faint); }
.org-secondary-list { margin-bottom: 14px; }
.org-secondary-item {
  display: flex; justify-content: space-between; padding: 8px 12px; background: var(--surface-2); border-radius: 6px;
  margin-bottom: 5px; font-size: 13px;
}
.org-secondary-item .name { direction: rtl; text-align: right; font-weight: 600; color: var(--heading); }
.org-secondary-item .title { color: var(--text-faint); font-size: 12px; }
.org-section-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.org-section-table th { text-align: left; padding: 8px 10px; font-size: 11px; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--border-soft); }
.org-section-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); color: var(--text-dim); }
.org-section-table td.num { text-align: right; font-weight: 600; color: var(--heading); }

/* =====================================================================
   v2 (server platform) additions
   ===================================================================== */
.hidden { display: none !important; }
.auth-card { max-width: 400px; margin: 0 auto; }
.auth-card h3 { color: var(--heading); margin: 0 0 6px; font-size: 17px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px; }
.form-error { color: var(--danger-text); font-size: 12.5px; min-height: 18px; margin: 4px 0 10px; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); font-size: 12.5px; }
.user-chip .role { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--teal); font-weight: 700; }

.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.period-bar input[type="month"], .period-bar input[type="date"], .inline-input {
  background: var(--surface); border: 1px solid var(--border-soft); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; color-scheme: dark;
}
.status-steps { display: flex; gap: 6px; align-items: center; }
.status-steps .step { padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-faint); }
.status-steps .step.done { background: rgba(76,195,138,0.15); color: var(--ok); }
.status-steps .step.current { background: var(--accent-grad); color: #fff; }
.status-steps .sep { color: var(--text-faint); font-size: 11px; }

/* Editable grids (effects, attendance) */
.grid-input {
  width: 74px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 6px; color: var(--text); font-size: 12.5px; font-family: inherit; text-align: right;
}
.grid-input.wide { width: 160px; text-align: left; }
.grid-input:focus { outline: none; border-color: var(--teal); }
.grid-input.saved { border-color: var(--ok); }
.grid-input.error { border-color: var(--red); }
.grid-input[disabled] { opacity: .55; }
.grid-select { padding: 5px 8px; font-size: 12.5px; }
table.dense thead th, table.dense tbody td { padding: 8px 10px; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.neg { color: var(--danger-text); }
td.pos { color: var(--ok); }
td.net { color: var(--teal); font-weight: 700; }
.sticky-head thead th { position: sticky; top: 0; z-index: 2; }
.table-scroll { max-height: calc(100vh - 330px); overflow: auto; }

.att-legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; }
.att-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 11px; }
.att-present { background: rgba(76,195,138,0.15); color: var(--ok); }
.att-absent, .att-unpaid { background: rgba(237,28,36,0.16); color: var(--danger-text); }
.att-annual, .att-casual { background: rgba(39, 170, 225,0.15); color: var(--cyan); }
.att-sick { background: rgba(232,169,62,0.16); color: var(--warn); }
.att-holiday, .att-weekend, .att-mission { background: var(--surface-3); color: var(--text-dim); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.tabs .tab { padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .tab.active { color: var(--heading); border-color: var(--teal); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13px; }
.kv .k { color: var(--text-dim); }
.kv .v { text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { font-weight: 700; color: var(--heading); border-top: 1px solid var(--border-soft); padding-top: 6px; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; color: var(--text-dim); }
.check-row input { width: auto; }
.col-toggles { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.col-toggles label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }

.audit-details { font-family: Consolas, monospace; font-size: 11.5px; color: var(--text-faint); max-width: 520px; white-space: pre-wrap; word-break: break-word; }

/* Payslip (printable) */
.payslip { background: #fff; color: #192731; border-radius: var(--radius-lg); padding: 32px 36px; max-width: 760px; margin: 0 auto; }
.payslip .ps-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--navy); padding-bottom: 12px; margin-bottom: 18px; }
.payslip .ps-head img { height: 36px; }
.payslip h2 { color: var(--navy); margin: 0; font-size: 18px; }
.payslip .ps-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; font-size: 12.5px; margin-bottom: 16px; }
.payslip .ps-meta span { color: #657886; }
.payslip table { min-width: 0; font-size: 13px; }
.payslip table td { padding: 7px 4px; border-bottom: 1px solid #EAF5FC; color: #192731; }
.payslip table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.payslip tr.ps-total td { font-weight: 700; border-top: 2px solid var(--navy); font-size: 14px; }
.payslip .ps-note { font-size: 11px; color: #657886; margin-top: 14px; }
.payslip tbody tr:hover { background: none; }

@media print {
  body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea .payslip { box-shadow: none; padding: 0; break-after: page; }
}
#printArea { display: none; }

.menu-btn { display: none; }
@media (max-width: 1100px) {
  .conn-pill .conn-label, #btnPassword { display: none; }
  .user-chip #userName { display: none; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .brand-titles .sub { display: none; }
  .sidebar { display: none; position: fixed; top: 68px; left: 0; bottom: 0; width: 260px; z-index: 30; box-shadow: 18px 0 40px rgba(0,0,0,.45); }
  .sidebar.open { display: block; }
  .main { padding: 18px 16px 60px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
#view-effects table, #view-attendance table, #view-payroll table { min-width: 1100px; }
table.dense td:has(> .cell-emp) { min-width: 220px; }
.cell-emp .who .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

/* ---------- Discipline (SOP) ---------- */
.meter { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; min-width: 90px; }
.meter > span { display: block; height: 100%; background: var(--accent-grad); }
.meter.warn > span { background: var(--warn); }
.meter.full > span { background: var(--red); }
.deadline-late { color: var(--danger-text); font-weight: 700; }
.step-list { display: grid; gap: 8px; margin: 10px 0; }
.step-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.case-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.rule-note { font-size: 12px; color: var(--text-faint); border-inline-start: 3px solid var(--teal); padding: 6px 10px; margin: 8px 0; background: var(--surface); border-radius: 6px; }
.penalty-table input { width: 70px; }
.penalty-table input.wide { width: 260px; }

/* Printable Arabic letters (warnings, decisions, memos) */
.letter { background: #fff; color: #111; direction: rtl; text-align: right; font-family: Arial, "Segoe UI", Tahoma, sans-serif;
  max-width: 780px; margin: 0 auto 20px; padding: 36px 44px; border-radius: var(--radius-lg); font-size: 14.5px; line-height: 1.9; }
.letter .l-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 16px; }
.letter .l-head img { height: 40px; }
.letter .l-head .org { font-weight: 700; color: var(--navy); font-size: 16px; }
.letter .l-meta { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 12px; }
.letter h3 { text-align: center; color: var(--navy); margin: 14px 0; font-size: 16px; }
.letter p { margin: 8px 0; }
.letter .fill { font-weight: 700; border-bottom: 1px dotted #666; padding: 0 4px; }
.letter table { width: 100%; min-width: 0; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; }
.letter table td, .letter table th { border: 1px solid #999; padding: 5px 8px; color: #111; text-align: center; background: #fff; }
.letter tbody tr:hover { background: none; }
.letter .sig { display: flex; justify-content: space-between; gap: 24px; margin-top: 28px; font-size: 13.5px; }
.letter .sig div { flex: 1; }
.letter .foot { margin-top: 18px; font-size: 12px; color: #444; border-top: 1px solid #ccc; padding-top: 8px; }
@media print {
  #printArea .letter { box-shadow: none; padding: 0; margin: 0; break-after: page; max-width: none; }
}

/* Print: everything placed in #printArea (payslips, letters, forms, contracts) must be
   visible — the older "body * { visibility:hidden }" print rule would otherwise blank it. */
@media print {
  #printArea, #printArea * { visibility: visible !important; }
  #printArea { position: static; }
  #printArea .grant-sheet, #printArea .offer-sheet { position: static; box-shadow: none; margin: 0 auto; break-after: page; }
  #printArea .offer-sheet { padding: 0; max-width: none; break-after: auto; border-radius: 0; } /* one page */
}
.drawer .grant-sheet, .drawer .offer-sheet { max-width: 100%; }

/* ---------- Export / Analysis printable report (white, for PDF) ---------- */
.report-print { background: #fff; color: #192731; font-family: Arial, "Segoe UI", sans-serif; padding: 24px; border-radius: 12px; }
.report-print .rp-head { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 14px; }
.report-print .rp-head img { height: 34px; }
.report-print .rp-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.report-print .rp-sub { font-size: 11px; color: #657886; }
.report-print h3 { color: var(--navy); font-size: 14px; margin: 18px 0 8px; }
.report-print table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 10.5px; margin-bottom: 8px; }
.report-print th, .report-print td { border: 1px solid #D5E3ED; padding: 4px 6px; color: #192731; background: #fff; text-align: left; }
.report-print th { background: #F1F6FA; font-weight: 700; color: #465F71; text-transform: none; letter-spacing: 0; }
.report-print tbody tr:hover { background: none; }
.report-print .rp-kpis td { border: 1px solid #DAEAF6; padding: 8px 10px; }
.report-print .rp-kpis .k { font-size: 10px; color: #657886; }
.report-print .rp-kpis .v { font-size: 16px; font-weight: 700; color: var(--navy); }
.report-print .rp-chart .donut-center .value { color: var(--navy); }
.report-print .rp-chart .donut-legend-row .lg-name, .report-print .rp-chart .donut-legend-row .lg-count { color: #192731; }
@media print { #printArea .report-print { padding: 0; border-radius: 0; } #printArea .report-print tr { break-inside: avoid; } }
#anPanel .modal-body .card { background: var(--surface); }
.report-toolbar { border-left: 1px solid var(--border-soft); padding-left: 10px; }

/* Only Admins see salaries (user 2026-10-14): anything marked .sal is hidden for other roles. */
body.no-salaries .sal { display: none !important; }

/* Contracts: the row just renewed flashes green so it's clear the renewal went through */
@keyframes renewedflash { from { background: rgba(46, 204, 113, .35); } to { background: rgba(46, 204, 113, .08); } }
tr.just-renewed td { animation: renewedflash 2.5s ease-out forwards; }

/* NOSI Form 1 / Form 6 — the official government pages (Legal 8.5×14 in) with the values placed on their boxes. */
.nosi-sheet { position: relative; width: 612.12pt; height: 1008.12pt; overflow: hidden; background: #fff; color: #000; direction: rtl; font-family: Arial, "Segoe UI", sans-serif; break-after: page; page-break-after: always; }
.nosi-sheet:last-child { break-after: auto; page-break-after: auto; }
.nosi-sheet > img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.nosi-sheet .nf { position: absolute; display: flex; align-items: center; justify-content: center; font-family: Tahoma, Arial, sans-serif; font-weight: 700; font-size: 12pt; line-height: 1; white-space: nowrap; overflow: hidden; color: #000; }
.nosi-sheet .nf.nt { justify-content: flex-start; padding: 0 2pt; box-sizing: border-box; }
.nosi-sheet .nf.ltr { direction: ltr; justify-content: flex-end; }
.nosi-sheet .nf.bg { background: #fff; }
.nosi-sheet .nf.tick { font-size: 14pt; }
@media print { #printArea .nosi-print { margin: 0; } }

/* ---------- Documents · HR letter (A4, wording/layout from the company's HR letter .docx) ---------- */
.doc-tabs { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.hrl-preview { overflow: auto; background: var(--surface); border-radius: var(--radius-lg); padding: 12px; }
.hrl-preview .hrl-sheet { zoom: .62; box-shadow: var(--shadow-card); margin: 0 auto; } /* zoom set to the column width by documents.js */
.hrl-sheet { position: relative; width: 210mm; height: 297mm; overflow: hidden; background: #fff; color: #192731; box-sizing: border-box;
  padding: 36mm 10mm 0 30mm; font-family: "Century Gothic", "Segoe UI", Arial, sans-serif; font-size: 12pt; line-height: 1.35; }
.hrl-sheet .hrl-logo { position: absolute; top: 12mm; left: 13mm; width: 37mm; }
.hrl-sheet .hrl-date { position: absolute; top: 34mm; right: 12mm; text-align: right; }
.hrl-sheet .hrl-date sup { font-size: 7pt; }
.hrl-sheet .hrl-ref { font-size: 8.5pt; color: #657886; margin-top: 2px; }
.hrl-sheet .hrl-body { position: relative; z-index: 1; }
.hrl-sheet.en .hrl-body { padding-top: 12mm; }
.hrl-sheet p { margin: 0 0 4mm; }
.hrl-sheet p.tight { margin: 0; }
.hrl-sheet ul { margin: 0 0 6mm; padding-left: 8mm; }
.hrl-sheet ul li { margin: 0; }
.hrl-sheet .hrl-role { padding-left: 6mm; margin-bottom: 6mm; }
.hrl-sheet .hrl-mail { color: #2690DB; text-decoration: underline; }
.hrl-sheet.en .hrl-sign { border-top: 1px solid #BBC3C9; margin-right: -2mm; padding-top: 3mm; margin-top: 4mm; }
/* Signature + HR stamp: ONE size on every document (user 2026-10-28) */
.hrl-sheet .hrl-stamp { display: block; width: 95mm; max-width: none; }
.hrl-sheet.en .hrl-stamp { margin: 3mm 0 0 4mm; }
.hrl-sheet .hrl-foot { position: absolute; bottom: 12mm; left: 13mm; font-size: 8pt; color: #457292; line-height: 1.35; z-index: 1; }
.hrl-sheet .hrl-foot > div { display: flex; gap: 4px; align-items: flex-start; }
.hrl-sheet .hrl-foot svg { width: 9px; height: 9px; flex: none; margin-top: 2px; }
.hrl-sheet .hrl-waves { position: absolute; right: 0; bottom: 0; width: 42mm; height: 91mm; }
/* Arabic: mirrored — logo and footer on the right, waves and signature on the left */
.hrl-sheet.ar { direction: rtl; text-align: right; font-family: Arial, "Segoe UI", Tahoma, sans-serif; font-size: 14pt; line-height: 1.5; padding: 36mm 30mm 0 18mm; }
.hrl-sheet.ar .hrl-logo { left: auto; right: 13mm; }
.hrl-sheet.ar .hrl-ref { position: absolute; top: 20mm; left: 18mm; font-size: 9pt; }
.hrl-sheet.ar h2 { text-align: center; font-size: 17pt; margin: 8mm 0 12mm; }
.hrl-sheet.ar .hrl-to { margin-bottom: 8mm; }
.hrl-sheet.ar p { margin-bottom: 6mm; }
.hrl-sheet.ar p.tight { margin: 0; }
.hrl-sheet.ar p.gap { margin-top: 8mm; }
.hrl-sheet.ar .hrl-regards { text-align: center; }
.hrl-sheet.ar .hrl-sign { width: 95mm; margin: 6mm auto 0 0; text-align: center; font-size: 13pt; }
.hrl-sheet.ar .hrl-stamp { margin: 1mm auto 0; }
.hrl-sheet.ar .hrl-foot { left: auto; right: 13mm; font-size: 8pt; }
.hrl-sheet.ar .hrl-waves { right: auto; left: 0; transform: scaleX(-1); }
@media print { #printArea .hrl-sheet { break-after: page; } #printArea .hrl-sheet:last-child { break-after: auto; } }
/* Bank letter for a group of employees — same letterhead, a table of the employees (one or more A4 pages) */
.hrl-sheet.ar.group { font-size: 12.5pt; line-height: 1.45; padding-left: 14mm; padding-right: 14mm; }
.hrl-sheet.ar.group .hrl-ref { line-height: 1.5; }
.hrl-sheet.ar.group h2.hrl-title-en { font-family: "Times New Roman", serif; font-size: 18pt; margin: 2mm 0 6mm; }
.hrl-sheet.ar.group p { margin-bottom: 3mm; }
.hrl-sheet.ar.group p.tight { margin: 0 0 2mm; }
.hrl-sheet.ar.group .hrl-greet { padding-right: 24mm; }
.hrl-sheet.ar.group .hrl-cont { color: #657886; font-size: 10.5pt; margin: 0 0 3mm; }
.hrl-sheet .hrl-table { width: 100%; min-width: 0; border-collapse: collapse; margin: 3mm 0 0; font-size: 10.5pt; table-layout: auto; }
.hrl-sheet .hrl-table th, .hrl-sheet .hrl-table td { border: 1px solid #555; padding: 1.8mm 2mm; text-align: center; color: #111; background: #fff; }
.hrl-sheet .hrl-table th { background: #E3E7EA; font-size: 11.5pt; font-weight: 700; text-transform: none; letter-spacing: 0; }
.hrl-sheet .hrl-table td { font-weight: 700; }
.hrl-sheet .hrl-table td.n, .hrl-sheet .hrl-table th.n { width: 9mm; }
.hrl-sheet .hrl-table tbody tr:hover { background: none; }
.hrl-sheet.ar.group .hrl-sign { margin-top: 6mm; }
/* Leave request (طلب أجازة) — same letterhead; dotted lines to write on, blank or filled */
.hrl-sheet.ar.leave { font-size: 13pt; line-height: 1.6; padding-left: 16mm; padding-right: 16mm; }
.hrl-sheet.ar.leave .lv-top { display: flex; align-items: center; justify-content: space-between; gap: 8mm; margin: 4mm 0 8mm; }
.hrl-sheet.ar.leave .lv-top h2 { flex: 1; margin: 0; font-size: 20pt; text-align: center; }
.hrl-sheet.ar.leave .lv-bal { order: 2; width: 72mm; min-width: 0; border-collapse: collapse; font-size: 11pt; }
.hrl-sheet.ar.leave .lv-bal th, .hrl-sheet.ar.leave .lv-bal td { border: 1px solid #777; padding: 1.5mm 2.5mm; background: #fff; color: #111; text-transform: none; letter-spacing: 0; }
.hrl-sheet.ar.leave .lv-bal th { width: 34mm; text-align: right; font-weight: 700; background: #EFF3F5; }
.hrl-sheet.ar.leave .lv-bal td { text-align: center; font-weight: 700; height: 7mm; }
.hrl-sheet.ar.leave p { margin: 0 0 5.5mm; }
.hrl-sheet.ar.leave .lv-greet { padding-right: 30mm; }
.hrl-sheet .lv-fill { display: inline-block; border-bottom: 1px dotted #444; padding: 0 2mm; min-height: 1.3em; text-align: center; font-weight: 700; vertical-align: bottom; }
.hrl-sheet .lv-blank-date { display: inline-block; min-width: 34mm; text-align: center; letter-spacing: 3mm; border-bottom: 1px dotted #444; }
.hrl-sheet .lv-type { display: inline-flex; align-items: center; gap: 1.5mm; margin: 0 2mm; }
.hrl-sheet .lv-type .box { display: inline-flex; align-items: center; justify-content: center; width: 4.5mm; height: 4.5mm; border: 1px solid #333; font-size: 10pt; line-height: 1; }
.hrl-sheet .lv-type.on { font-weight: 700; }
.hrl-sheet.ar.leave .lv-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; margin-top: 10mm; font-size: 11.5pt; }
.hrl-sheet.ar.leave .lv-signs > div { text-align: right; }
.hrl-sheet.ar.leave .lv-signs b { display: block; text-align: center; margin-bottom: 3mm; }
.hrl-sheet.ar.leave .lv-signs p { margin: 0 0 4mm; white-space: nowrap; }
.hrl-sheet.ar.leave .lv-signs .lv-fill { min-width: 0 !important; width: 36mm; }
.hrl-sheet.ar.leave .lv-mgr { text-align: center; margin-top: 2mm !important; }
/* Overtime request (نموذج عمل أوقات اضافية) — same letterhead and table as the group letter */
.hrl-sheet.ar.ot h2.ot-title { text-align: center; font-size: 17pt; margin: 2mm 0 6mm; }
.hrl-sheet .ot-table td { height: 8.5mm; font-weight: 600; }
.hrl-sheet .ot-table th { background: #c9daf0; }
.hrl-sheet .ot-table .ot-why { width: 34%; }
.hrl-sheet .ot-table td.ot-why { text-align: right; font-weight: 400; font-size: 10pt; }
.hrl-sheet.ar .ot-signs { display: flex; justify-content: space-around; margin-top: 12mm; padding-bottom: 22mm; font-size: 13pt; }
/* Probation report (تقرير صلاحية خلال فترة الاختبار) — same letterhead */
.hrl-sheet.ar.prob h2.pr-title { text-align: center; font-size: 18pt; margin: 0 0 1mm; }
.hrl-sheet.ar.prob .pr-sub { text-align: center; font-weight: 700; font-size: 12pt; margin-bottom: 6mm; }
.hrl-sheet.ar.prob .pr-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 6mm; }
.hrl-sheet.ar.prob .pr-fields p, .hrl-sheet.ar.prob .pr-dates { margin: 0 0 4.5mm; white-space: nowrap; }
.hrl-sheet.ar.prob .pr-fields .lv-fill { min-width: 0 !important; width: 62mm; }
.hrl-sheet.ar.prob .pr-dates { font-size: 12pt; }
.hrl-sheet .pr-table { margin-top: 2mm; }
.hrl-sheet .pr-table th { background: #d9d9de; font-size: 10.5pt; }
.hrl-sheet .pr-table td { vertical-align: top; font-weight: 700; }
.hrl-sheet .pr-table .pr-group { width: 30mm; text-align: center; vertical-align: middle; }
.hrl-sheet .pr-table td.pr-items { text-align: right; }
.hrl-sheet .pr-table .pr-items div, .hrl-sheet .pr-table .pr-max div { min-height: 7mm; line-height: 7mm; }
.hrl-sheet .pr-table .pr-items div { line-height: 1.4; padding: 1.2mm 0; min-height: 0; }
.hrl-sheet .pr-table .pr-max { width: 17mm; text-align: center; }
.hrl-sheet .pr-table .pr-max div { line-height: 1.4; padding: 1.2mm 0; min-height: 0; }
.hrl-sheet .pr-table .pr-sig { width: 20mm; }
.hrl-sheet .pr-table .pr-rate { width: 22mm; }
.hrl-sheet .pr-table tr.pr-total td { vertical-align: middle; height: 9mm; }
.hrl-sheet.ar.prob .pr-verdict { margin: 5mm 0 0; font-size: 12.5pt; }
.hrl-sheet.ar.prob .pr-signs { margin-top: 8mm; padding-bottom: 0; }
/* Medical exam request (طلب توقيع كشف طبى — نموذج 111) — HR letter: same letterhead, HR signature + stamp */
.hrl-sheet.ar.med { font-size: 14pt; line-height: 1.9; }
.hrl-sheet.ar.med h2.md-title { text-align: center; font-size: 17pt; margin: 10mm 0 14mm; }
.hrl-sheet.ar.med .md-to { margin-bottom: 6mm; }
.hrl-sheet.ar.med .md-text { text-align: justify; }
.hrl-sheet.ar.med .md-thanks { text-align: center; margin-top: 14mm; }
.hrl-sheet.ar.med .lv-fill { font-weight: 400; }
/* Absence warnings 1 / 2 (إنذار انقطاع عن العمل) — HR letter: same letterhead, HR signature + stamp */
.hrl-sheet.ar.warn { font-size: 13.5pt; line-height: 1.85; }
.hrl-sheet.ar.warn .wn-end { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; }
.hrl-sheet.ar.warn .wn-end .wn-date { margin-top: 6mm; white-space: nowrap; }
.hrl-sheet.ar.warn .wn-end .hrl-sign { margin: 0; }
.hrl-sheet.ar.warn h2.wn-title { text-align: center; font-size: 17pt; margin: 4mm 0 6mm; }
.hrl-sheet.ar.warn p { margin: 0 0 3mm; }
.hrl-sheet.ar.warn .wn-greet { text-align: center; margin: 2mm 0 4mm; }
.hrl-sheet.ar.warn .wn-text { text-align: justify; text-indent: 8mm; }
.hrl-sheet.ar.warn .wn-sent { margin-top: 6mm; font-size: 12pt; }
.hrl-sheet.ar.warn .wn-regards { text-align: center; margin: 4mm 0 2mm; }
.hrl-sheet.ar.warn .lv-fill { font-weight: 400; text-indent: 0; }
/* Employment application (نموذج طلب توظيف — English / Arabic), 3 pages on the letterhead */
.hrl-sheet.en.app { font-family: "Segoe UI", Calibri, Arial, sans-serif; font-size: 10pt; line-height: 1.3; padding: 36mm 14mm 0 14mm; }
.hrl-sheet.app .ap-co { position: absolute; top: 13mm; right: 14mm; text-align: right; display: flex; flex-direction: column; gap: 1mm; color: #1D435E; font-size: 10pt; }
.hrl-sheet.app .ap-co i { color: #657886; font-size: 9pt; }
.hrl-sheet.app h2.ap-title { text-align: center; color: #1D435E; font-size: 19pt; line-height: 1.25; margin: 0 0 2mm; }
.hrl-sheet.app .ap-hint { text-align: center; color: #657886; font-style: italic; font-size: 9pt; margin-bottom: 3mm; }
.hrl-sheet.app .ap-hint.left { text-align: left; margin: 1mm 0 2mm; }
.hrl-sheet.app .ap-sec { display: flex; justify-content: space-between; color: #1D435E; font-weight: 700; font-size: 12pt; border-bottom: 1.5px solid #2aa3b5; padding: 3mm 0 1.5mm; margin-bottom: 1mm; }
.hrl-sheet.app .ap-grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 4mm; }
.hrl-sheet.app .ap-f { padding: 2.2mm 1mm 0; }
.hrl-sheet.app .ap-l { display: flex; justify-content: space-between; gap: 2mm; font-weight: 700; color: #555; font-size: 9pt; }
.hrl-sheet.app .ap-v { border-bottom: 1px solid #999; min-height: 7mm; padding: 1mm 0 0.5mm; font-weight: 700; color: #111; font-size: 10.5pt; }
.hrl-sheet.app .ap-f.tall .ap-v { min-height: 14mm; }
.hrl-sheet.app .ap-lines > div { border-bottom: 1px solid #bbb; height: 10mm; display: flex; align-items: flex-end; padding-bottom: 1mm; color: #555; }
.hrl-sheet.app .ap-eval { width: 100%; min-width: 0; border-collapse: collapse; margin: 4mm 0 2mm; font-size: 9pt; }
.hrl-sheet.app .ap-eval th, .hrl-sheet.app .ap-eval td { border: 1px solid #aaa; padding: 1.6mm 2mm; text-align: center; color: #192731; background: #fff; text-transform: none; letter-spacing: 0; }
.hrl-sheet.app .ap-eval th { background: #e6f3f6; font-weight: 700; color: #1D435E; }
.hrl-sheet.app .ap-eval .c { text-align: left; width: 34%; }
.hrl-sheet.app .ap-eval .c span[dir] { float: right; }
.hrl-sheet.app .ap-eval tbody tr:hover { background: none; }
.hrl-sheet.app .ap-rec { padding: 4mm 1mm 0; }
.hrl-sheet.app .ap-opts { display: flex; justify-content: space-between; margin-top: 2mm; font-weight: 700; color: #444; }
/* Payment request (طلب صرف) — same letterhead, the finance form's lines */
.hrl-sheet.ar.pay { font-size: 11pt; line-height: 1.5; padding-left: 14mm; padding-right: 14mm; }
.hrl-sheet.ar.advv h2.advv-title { text-align: center; font-size: 17pt; margin: 0 0 4mm; text-decoration: underline; }
.hrl-sheet.ar.advv .advv-det th { width: 26mm; text-align: right; white-space: nowrap; }
.hrl-sheet.ar.advv .advv-det th, .hrl-sheet.ar.advv .advv-det td { padding: 1.4mm 2mm; }
.hrl-sheet.ar.advv .advv-det td { text-align: right; }
.hrl-sheet.ar.advv .advv-plan { margin-top: 4mm; }
.hrl-sheet.ar.advv .advv-plan td, .hrl-sheet.ar.advv .advv-plan th { padding: 1.2mm 2mm; }
.hrl-sheet.ar.advv .advv-ack { margin-top: 5mm; font-weight: 700; }
.hrl-sheet.ar.advv .advv-signs { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; margin-top: 4mm; }
.hrl-sheet.ar.advv .advv-signs > div:first-child { display: grid; grid-template-columns: auto 45mm; gap: 6mm 3mm; align-items: end; font-size: 12pt; white-space: nowrap; }
.hrl-sheet.ar.advv .advv-line { border-bottom: 1px dotted #333; height: 6mm; }
.hrl-sheet.ar.advv .advv-signs .hrl-sign { margin: 0; }
.hrl-sheet.ar.pay h2.py-title { text-align: center; font-size: 17pt; margin: 0 0 5mm; text-decoration: underline; }
.hrl-sheet.ar.pay .py-types { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3mm; font-weight: 700; margin-bottom: 5mm; }
.hrl-sheet.ar.pay .py-types .lv-type { margin: 0 1mm; }
.hrl-sheet.ar.pay .py-budget { justify-content: flex-start; gap: 14mm; margin: 2mm 0 3mm; }
.hrl-sheet.ar.pay .py-row { display: flex; justify-content: space-between; gap: 3mm; margin-bottom: 4mm; white-space: nowrap; }
.hrl-sheet.ar.pay .py-amounts { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 6mm; row-gap: 4mm; margin-bottom: 4mm; }
.hrl-sheet.ar.pay .py-amounts .lv-fill { min-width: 0 !important; width: auto; flex: 1; }
.hrl-sheet.ar.pay .py-amounts .py-f { display: flex; flex: 1; align-items: flex-end; gap: 1mm; }
.hrl-sheet.ar.pay .py-line { margin-bottom: 3mm; white-space: nowrap; }
.hrl-sheet.ar.pay .py-f b { white-space: nowrap; }
.hrl-sheet.ar.pay .py-sec { text-align: center; font-weight: 700; font-size: 12pt; text-decoration: underline; border-top: 1.5px solid #333; padding-top: 3mm; margin: 4mm 0 3mm; }
.hrl-sheet.ar.pay .py-sign { display: flex; justify-content: space-between; margin-bottom: 4mm; white-space: nowrap; }

/* Salary history reports (Archive → Reports, user 2026-11-17) */
.sh-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 10px; }
.sh-filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted, #859AA9); }
.sh-filters select, .sh-filters input { width: 100%; }
.sh-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 6px 2px 0; }
.sh-bar { flex: 1; min-width: 18px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.sh-fill { width: 100%; max-width: 46px; background: #7CC1F3; border-radius: 4px 4px 0 0; }
.sh-fill.sys { background: #36b9a0; }
.sh-lab { font-size: 9.5px; color: var(--muted, #859AA9); white-space: nowrap; margin-top: 3px; }
.sh-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #7CC1F3; vertical-align: -1px; }
.sh-key.sys { background: #36b9a0; }
table.dense tr.total-row td { border-top: 2px solid var(--line, #344E61); }
.sh-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 12px; max-height: 300px; overflow: auto; border: 1px solid var(--line, #344E61); border-radius: 8px; padding: 6px 10px; }
.sh-pick .check-row { align-items: flex-start; }

/* Phones (user 2026-11-20, managers rate from their iPhone): the rating table fits the screen — no sideways scroll */
@media (max-width: 600px) {
  table.ap-rate { font-size: 12px; }
  table.ap-rate th, table.ap-rate td { padding: 6px 3px !important; }
  table.ap-rate th .muted-note { display: none; }
  table.ap-rate td:first-child { word-break: break-word; }
  table.ap-rate input[type=radio] { width: 22px; height: 22px; margin: 0; }
  .topbar .brand-titles .en { font-size: 13px; line-height: 1.2; }
  /* the side panel takes the whole phone screen; its buttons wrap instead of running off the left edge;
     100dvh = the visible height (Safari's bottom bar would otherwise hide the buttons) */
  .drawer, .drawer.wide { width: 100vw; max-width: 100vw; height: 100dvh; border-left: 0; }
  .drawer-head, .drawer-body { padding-left: 14px; padding-right: 14px; }
  .drawer-foot { flex-wrap: wrap; justify-content: stretch; gap: 6px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1 1 auto; }
}

/* ---------- Light theme (Movoyager logo colours on white) — switch: ☀/☾ in the top bar ---------- */
html[data-theme="light"] {
  --navy:        #123A63;
  --cobalt:      #1C75BC;
  --cyan:        #27AAE1;
  --teal:        #1C75BC;

  --bg:          #F3F7FB;
  --bg-alt:      #FFFFFF;
  --surface:     #FFFFFF;
  --surface-2:   #EAF3FA;
  --surface-3:   #DCEAF5;
  --border:      #BFD6E8;
  --border-soft: #DCE7F0;

  --text:        #1B2B38;
  --text-dim:    #4A6274;
  --text-faint:  #6E8698;
  --heading:     #0F3352;
  --danger-text: #C4161C;
  --ok:          #1E9461;
  --warn:        #B9770E;
  --logo-filter: none;

  --accent-grad: linear-gradient(100deg, #1C75BC 0%, #27AAE1 100%);
  --shadow-card: 0 4px 16px rgba(20, 60, 100, 0.08);
  --series-other: #9AB0C2;
  color-scheme: light;
}
html[data-theme="light"] body { background: linear-gradient(180deg, #EEF5FB 0%, var(--bg) 320px) fixed; }
html[data-theme="light"] .topbar { background: #FFFFFF; border-bottom: 1px solid var(--border); box-shadow: 0 1px 6px rgba(20, 60, 100, 0.06); }
html[data-theme="light"] .brand-titles .sub.slogan { color: var(--cobalt); }
html[data-theme="light"] .sidebar { border-right: 1px solid var(--border-soft); }
html[data-theme="light"] .nav-item.active { background: #E3F1FB; color: var(--cobalt); border-color: #C3DDF0; }
html[data-theme="light"] .btn:hover { border-color: var(--cyan); }
html[data-theme="light"] .banner.alarm > svg { color: #C4161C; }
html[data-theme="light"] .btn.danger { color: #C4161C; }
html[data-theme="light"] .overlay { background: rgba(15, 40, 65, 0.35); }
html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { color-scheme: light; }
