@font-face { font-family: Cairo; src: url(/fonts/cairo-400.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Cairo; src: url(/fonts/cairo-600.ttf) format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: Cairo; src: url(/fonts/cairo-700.ttf) format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --teal: #1b2f55; --teal-d: #0f1d3a; --teal-l: #eef2f9; --gold: #b8912f; --gold-d: #8f6e1d; --gold-l: #fbf5e4; --ink: #1d2b36; --muted: #6b7a88; --line: #dde4ea;
  --bg: #f4f7f9; --card: #fff; --ok: #8f6e1d; --ok-l: #fbf5e4; --bad: #b3261e; --bad-l: #fbe9e8;
  --warn: #8a5a00; --warn-l: #fff4dc; --navy: #1b2f55; --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Cairo, Tahoma, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.65; font-size: 15px; }
a { color: var(--teal); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.en, small.en { display: block; color: var(--muted); font-size: 12px; font-weight: 400; direction: ltr; text-align: right; }
[dir=ltr] { text-align: left; }
.ltr { direction: ltr; unicode-bidi: embed; }
.hidden { display: none !important; }

/* header */
header.site { background: #fff; border-top: 5px solid var(--gold); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; gap: 16px; min-height: 66px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-inline-end: auto; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand b { display: block; font-size: 16px; color: var(--teal-d); }
.brand small { display: block; font-size: 11px; color: var(--muted); direction: ltr; text-align: right; }
nav#nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
nav#nav a, nav#nav button { text-decoration: none; color: var(--ink); padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; }
nav#nav a:hover, nav#nav button:hover { background: var(--teal-l); }
nav#nav a.on { background: var(--teal); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
nav#nav .who { font-size: 12px; color: var(--muted); padding: 0 6px; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 20px; padding: 2px 10px; cursor: pointer; }
@media (max-width: 820px) {
  .menu-btn { display: block; }
  nav#nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  nav#nav.open { display: flex; }
  .brand small { display: none; }
}
footer.site { border-top: 1px solid var(--line); background: #fff; padding: 18px 0; text-align: center; color: var(--muted); font-size: 13px; }
footer.site small { direction: ltr; display: block; }

/* page heading */
.ph { border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 10px; }
.ph .kicker { color: var(--gold-d); font-size: 12px; font-weight: 700; letter-spacing: .5px; direction: ltr; text-align: right; }
.ph h1 { margin: 2px 0 0; font-size: 24px; color: var(--teal-d); }
.ph h2 { margin: 2px 0 0; font-size: 21px; color: var(--teal-d); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; }
.card > h3 { margin: 0 0 14px; font-size: 17px; color: var(--teal-d); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-title { display: flex; flex-direction: column; margin: 30px 0 12px; }
.sec-title h2 { margin: 0; font-size: 20px; color: var(--teal-d); }
.sec-title .n { color: var(--gold); }

/* forms */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .grid { grid-template-columns: 1fr; } }
.fld label.lb { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.fld label.lb i { color: var(--bad); font-style: normal; margin-inline-start: 3px; }
.fld label.lb small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; direction: ltr; text-align: right; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=date], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid #c9d3dc; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(27, 47, 85, .22); border-color: var(--teal); }
.fld.has-err input, .fld.has-err select, .fld.has-err textarea, .fld.has-err .opts { border-color: var(--bad); }
.err { color: var(--bad); font-size: 12.5px; min-height: 0; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.wc { font-size: 12px; color: var(--muted); direction: ltr; text-align: right; margin-top: 3px; }
.wc.bad { color: var(--bad); }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; border: 1px solid transparent; border-radius: 8px; padding: 2px; }
.opts.inline { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.opt { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 14px; }
.opt input { margin-top: 5px; width: 17px; height: 17px; accent-color: var(--teal); flex: none; }
.opt small { display: block; color: var(--muted); font-size: 11.5px; direction: ltr; text-align: right; }
.cond { background: #f7f8fb; border-inline-start: 3px solid var(--gold); padding: 10px 12px; border-radius: 6px; }
.note { background: var(--teal-l); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; }
.note.warn { background: var(--warn-l); color: var(--warn); }
.note.bad { background: var(--bad-l); color: var(--bad); }
.note small { display: block; direction: ltr; text-align: right; opacity: .85; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; border-radius: 9px; padding: 9px 16px;
  border: 1px solid var(--teal); background: var(--teal); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.4; }
.btn:hover { background: var(--teal-d); }
.btn.ghost { background: #fff; color: var(--teal); }
.btn.ghost:hover { background: var(--teal-l); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.bad { background: var(--bad); border-color: var(--bad); }
.btn.gray { background: #fff; color: var(--ink); border-color: #c9d3dc; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* badges & stats */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.badge.under_review, .badge.pending { background: var(--warn-l); color: var(--warn); }
.badge.approved, .badge.approve { background: var(--ok-l); color: var(--ok); }
.badge.rejected, .badge.reject { background: var(--bad-l); color: var(--bad); }
.badge.recuse { background: #eef0f3; color: #4a5866; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 28px; color: var(--navy); }

/* dashboard */
.dash { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr 1fr 1fr; } .stat b { font-size: 22px; } }
.applist { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow: auto; }
.appitem { text-align: right; font: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.appitem.on { border: 2px solid var(--gold); background: var(--gold-l); }
.appitem b { display: block; font-size: 14px; }
.appitem code { font-size: 11px; color: var(--muted); }
.meta { color: var(--muted); font-size: 13px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { background: #eef3f6; text-align: right; font-size: 13px; padding: 8px; }
.tbl th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.tbl td { border-top: 1px solid var(--line); padding: 8px; vertical-align: top; }
.tbl-wrap { overflow-x: auto; }

/* ---------- status badges ---------- */
.badge.not_started { background: #eef0f3; color: #4a5866; }
.badge.draft { background: #e9eef7; color: #33507f; }
.badge.submitted { background: #e4f0fb; color: #145a96; }
.badge.under_review { background: var(--warn-l); color: var(--warn); }
.badge.incomplete { background: #fdeede; color: #a24d00; }
.badge.approved { background: #e3f4e8; color: #1d6b37; }
.badge.rejected, .badge.archived { background: var(--bad-l); color: var(--bad); }
.badge.open { background: var(--warn-l); color: var(--warn); }
.badge.closed { background: #eef0f3; color: #4a5866; }
.chip { display: inline-block; background: var(--teal-l); color: var(--teal-d); border-radius: 99px; padding: 1px 9px; font-size: 12px; margin: 1px; }
.chip.bad { background: var(--bad-l); color: var(--bad); }
.chip.ok { background: #e3f4e8; color: #1d6b37; }
.chip.warn { background: var(--warn-l); color: var(--warn); }

/* ---------- KPIs & charts ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: var(--gold); }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi b { display: block; font-size: 28px; color: var(--navy); line-height: 1.3; }
.kpi small { color: var(--muted); font-size: 11.5px; }
.kpi.ok b { color: #1d6b37; } .kpi.bad b { color: var(--bad); } .kpi.warn b { color: var(--warn); }
.charts2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 900px) { .charts2 { grid-template-columns: 1fr; } }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap svg { width: 190px; height: 190px; flex: none; }
.legend { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.legend b { margin-inline-start: auto; padding-inline-start: 14px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hb { display: grid; grid-template-columns: 160px 1fr 70px; gap: 10px; align-items: center; font-size: 13.5px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t { height: 16px; background: #eef1f6; border-radius: 4px; overflow: hidden; display: flex; }
.hb-f { display: block; height: 100%; }
.hb-v { text-align: left; font-size: 13px; color: var(--muted); direction: ltr; }
@media (max-width: 520px) { .hb { grid-template-columns: 100px 1fr 56px; } }
.vbars { display: flex; align-items: stretch; gap: 14px; height: 200px; padding-top: 18px; border-bottom: 1px solid var(--line); }
.vb { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.vb-c { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.vb-f { width: 40%; max-width: 30px; border-radius: 4px 4px 0 0; position: relative; }
.vb-f span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--ink); }
.vb-x { font-size: 12px; color: var(--muted); padding-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.filters .fld { min-width: 160px; }
.filters .fld.grow { flex: 1; min-width: 220px; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 14px; background: none; border: 0; padding: 8px 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); }
.tabs button.on { color: var(--teal-d); border-color: var(--gold); font-weight: 700; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f7f9fc; }
.tbl td.num, .tbl th.num { text-align: left; direction: ltr; }
.tbl input, .tbl select { padding: 5px 7px; font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 22px; }
.temp { background: var(--warn-l); border: 1px dashed var(--warn); border-radius: 10px; padding: 12px; margin: 12px 0; }
.temp code { font-size: 17px; direction: ltr; display: inline-block; background: #fff; padding: 2px 10px; border-radius: 6px; user-select: all; }
.perm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
@media (max-width: 680px) { .perm-list { grid-template-columns: 1fr; } }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 90px; }
.money { direction: ltr; unicode-bidi: embed; font-variant-numeric: tabular-nums; }
.diff { background: #fff7e0; }
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--line); }
.timeline li { padding: 6px 16px 10px; position: relative; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; right: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.timeline time { color: var(--muted); font-size: 12px; display: block; direction: ltr; text-align: right; }

/* ---------- employee stepper ---------- */
.stepper { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.stepper button { flex: 1; min-width: 130px; font: inherit; font-size: 13.5px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.stepper button b { width: 26px; height: 26px; border-radius: 50%; background: var(--teal-l); color: var(--teal-d); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stepper button.on { border-color: var(--gold); background: var(--gold-l); }
.stepper button.on b { background: var(--teal); color: #fff; }
.kid { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fcfdfe; }
.kid h4 { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; color: var(--teal-d); }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
@media (max-width: 820px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .g3 { grid-template-columns: 1fr; } }
.req { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.req.miss { border-color: #e9b4b0; background: #fffafa; }
.req.ok { border-color: #b9dcc4; }
.req ul { margin: 4px 0 0; padding-inline-start: 18px; font-size: 13px; }
.hero { background: linear-gradient(135deg, var(--teal-d), var(--teal)); border-bottom: 4px solid var(--gold); color: #fff; border-radius: 16px; padding: 26px 26px; margin-bottom: 20px; }
.hero h1 { margin: 0 0 4px; font-size: 24px; }
.hero p { margin: 6px 0 0; opacity: .92; }
.login-box { max-width: 420px; margin: 30px auto; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 29, 58, .45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; overflow: auto; }
.modal-box { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 620px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal-box h3 { margin: 0 0 14px; color: var(--teal-d); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }

/* ---------- official printable forms ---------- */
.sheet { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto 18px; padding: 10mm 12mm; color: #000; font-size: 11pt; box-shadow: 0 2px 14px rgba(8,21,42,.15); position: relative; }
.sheet .hd { display: grid; grid-template-columns: 1.15fr 1.2fr .8fr; align-items: start; gap: 4mm; }
.sheet .hd .r { font-weight: 700; line-height: 1.6; }
.sheet .hd .c { text-align: center; } .sheet .hd .c img { width: 22mm; }
.sheet .hd .l { text-align: center; font-weight: 700; }
.sheet .ttl { font-weight: 800; font-size: 13pt; text-align: center; }
.sheet table.f { width: 100%; border-collapse: collapse; margin-top: 3mm; }
.sheet table.f th, .sheet table.f td { border: 1px solid #000; padding: 1.4mm 2mm; font-size: 10pt; vertical-align: middle; }
.sheet table.f th { background: #dfe8ef; font-weight: 700; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet table.f td.lb { background: #dfe8ef; font-weight: 700; width: 38mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet table.f td.c, .sheet table.f th.c { text-align: center; }
.sheet .decl { border: 1px solid #000; padding: 2mm 3mm; margin-top: 3mm; font-weight: 700; font-size: 10.5pt; line-height: 1.7; }
.sheet .sigs { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; margin-top: 10mm; font-weight: 700; gap: 4mm; }
.sheet .sigs div small { display: block; font-weight: 400; margin-top: 8mm; direction: ltr; }
.sheet .notes { font-size: 9.5pt; margin-top: 8mm; line-height: 1.7; }
.sheet .notes h5 { margin: 0 0 1mm; font-size: 10pt; background: #dfe8ef; display: inline-block; padding: 0 3mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .notes ol { margin: 0; padding-inline-start: 6mm; }
.sheet .kv { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2mm 8mm; font-size: 10pt; }
.sheet .kv div { border-bottom: 1px dotted #555; padding-bottom: .6mm; min-height: 6mm; }
.sheet .kv div b { font-weight: 700; margin-inline-end: 2mm; }
.sheet .kv .full { grid-column: 1 / -1; }
.sheet h4 { margin: 4mm 0 1.5mm; font-size: 11pt; }
.sheet .small { font-size: 9pt; line-height: 1.6; }
.sheet .meta-top { font-size: 9.5pt; line-height: 1.8; }
.sheet .pf { position: absolute; bottom: 5mm; left: 12mm; right: 12mm; display: flex; justify-content: space-between; font-size: 8pt; color: #444; }
.print-bar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.print-scroll { overflow-x: auto; }
@page { size: A4; margin: 0; }
@media print {
  header.site, footer.site, .noprint, .print-bar, #toast, .modal { display: none !important; }
  body { background: #fff; }
  main.wrap { padding: 0; max-width: none; }
  .print-scroll { overflow: visible; }
  .sheet { box-shadow: none; margin: 0; page-break-after: always; }
  .sheet:last-child { page-break-after: auto; }
  body.print-report { font-size: 11px; }
  body.print-report main.wrap { padding: 10mm; }
  body.print-report .card { border: 0; padding: 0; }
}

/* read-only review lists */
.rv dl { display: grid; grid-template-columns: 220px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.rv dt { color: var(--muted); }
.rv dd { margin: 0; word-break: break-word; }
.rv dd.diff { background: #fff3cd; border-radius: 4px; padding: 0 6px; }
@media (max-width: 680px) { .rv dl { grid-template-columns: 1fr; } .rv dd { margin-bottom: 8px; } }
details.box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
details.box summary { cursor: pointer; font-weight: 700; color: var(--teal-d); }

/* college watermark on printed forms */
.sheet::before { content: ""; position: absolute; inset: 0; background: url(/kmc-logo.png) center 52% / 125mm auto no-repeat; opacity: .07; pointer-events: none; z-index: 0;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet > * { position: relative; z-index: 1; }
.sheet > .pf { position: absolute; }
.sheet table.f td:not(.lb) { background: transparent; }
