@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url(/fonts/tajawal-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url(/fonts/tajawal-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url(/fonts/tajawal-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url(/fonts/tajawal-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122; }:root {
  --bg: #0A1A3A;          /* كحلي */
  --bg-deep: #07122B;     /* كحلي أغمق للرأس */
  --card: #11265A;
  --text: #E8C766;        /* ذهبي */
  --muted: #B39A58;       /* ذهبي خافت */
  --line: #2C4A85;
  --brand: #D4AF37;       /* ذهبي للأزرار */
  --brand-dark: #B8951F;
  --on-brand: #0A1A3A;    /* كحلي فوق الذهبي */
  --danger: #FF9A8F;
  --ok: #8FE0AE;
  --warn: #F4C86A;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--text); }
header.top { background: var(--bg-deep); color: var(--text); border-bottom: 2px solid var(--brand); padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header.top h1 { font-size: 17px; margin: 0; flex: 1 1 0; min-width: 0; line-height: 1.4; font-weight: 600; }
header.top h1 .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
header.top .who { font-size: 14px; color: var(--muted); }
header.top button.ghost { color: var(--text); border-color: var(--brand); }
.logo { height: 56px; width: auto; display: block; }
.login-logo { display: block; margin: 0 auto 8px; max-width: 300px; width: 80%; height: auto; }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
h1, h2, h3 { color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { cursor: pointer; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); text-align: right; font: inherit; color: var(--text); }
.tile:hover { border-color: var(--brand); background: #163070; }
.tile b { display: block; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: 13px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
input[readonly] { background: var(--bg-deep); color: var(--muted); }
textarea { min-height: 90px; resize: vertical; }
button, .btn { background: var(--brand); color: var(--on-brand); border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover, .btn:hover { background: var(--brand-dark); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 400; }
button.ghost:hover { border-color: var(--brand); background: transparent; }
button.danger { background: #E5736A; color: #fff; }
button.small { padding: 4px 10px; font-size: 13px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: var(--card); color: var(--text); border: 1px solid var(--line); font-weight: 400; }
.tabs button.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.badge { padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--line); color: var(--text); }
.badge.pending { color: var(--warn); }
.badge.approved { color: var(--ok); }
.badge.rejected { color: var(--danger); }
.err { color: var(--danger); margin-top: 8px; min-height: 1.2em; }
.msg { color: var(--ok); margin-top: 8px; }
.auto { background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; font-size: 14px; }
.auto div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.auto span { color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.login { max-width: 380px; margin: 6vh auto; }
.modal { position: fixed; inset: 0; background: rgba(3, 10, 28, .75); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal .card { max-width: 440px; width: 100%; margin: 0; }
.secret { font-family: Consolas, monospace; font-size: 20px; letter-spacing: 2px; background: var(--bg); padding: 10px; border-radius: 8px; text-align: center; direction: ltr; user-select: all; }
.print-head { display: none; }
@media print {
  header.top, .tabs, button, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; padding: 0; background: #fff; }
  h1, h2, h3, th, td, label, span, small { color: #000 !important; }
  td, th { border-bottom: 1px solid #999; }
  .badge { background: none; border: 1px solid #000; }
  .print-head { display: block; text-align: center; border-bottom: 2px solid #000; margin-bottom: 12px; padding-bottom: 8px; }
}


.tpl-box { border: 1px dashed var(--brand); border-radius: 10px; padding: 12px; margin: 12px 0 4px; background: var(--bg); }
/* ───────── المستندات الرسمية (A4) ───────── */
.doc { background: #fff; color: #111; font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif; width: 210mm; max-width: 100%; min-height: 297mm; box-sizing: border-box; margin: 0 auto 16px; padding: 14mm 14mm 12mm; border: 3px double #000; line-height: 1.7; font-size: 15px; display: flex; flex-direction: column; }
.doc * { color: #111; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dh-right { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.dh-emblem { height: 116px; width: auto; }
.dh-text { font-size: 11.5px; line-height: 1.5; font-weight: 700; text-align: center; }
.dh-state { font-size: 15px; }

.dh-left { text-align: center; }
.dh-logo { height: 70px; width: auto; display: block; margin: 0 auto 2px; }
.dh-year { font-size: 12px; font-weight: 700; margin-top: 32px; }
.dh-rule { height: 5px; margin: 8px 0 6px; border-top: 2px solid #000; border-bottom: 1px solid #000; }
.dh-rule span { display: none; }
.dh-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; padding-bottom: 6px; border-bottom: 1px dashed #999; margin-bottom: 14px; }
.title-box { width: 230px; margin: 8px auto 10px; text-align: center; font-size: 24px; font-weight: 700; border: 2px solid #000; padding: 4px 0; letter-spacing: 1px; }
table.info { width: 100%; border-collapse: collapse; margin: 6px 0 8px; }
table.info th, table.info td { border: 1.5px solid #000; padding: 6px 10px; text-align: center; font-size: 14px; }
table.info th { background: #D9D9D9; white-space: nowrap; width: 1%; padding: 6px 16px; }
.sec-label { font-weight: 700; text-decoration: underline; margin: 8px 0 2px; }
.body-text p { margin: 4px 0; text-align: justify; }
.sigline { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 4px; font-size: 13px; font-weight: 700; }
.sigline.left { justify-content: flex-start; }
.sigline.left i { flex: 1 1 auto; }
.sigline.short i { flex: 0 0 3cm; }
.sigline i { flex: 0 0 170px; border-bottom: 1.5px dotted #111; height: 1px; }
.dotline { border-bottom: 1.5px dotted #555; height: 21px; }
.addressee { display: flex; justify-content: space-between; font-weight: 700; margin-top: 8px; }
.greeting { margin: 8px 0 12px; font-weight: 700; }
.subject { text-align: center; font-size: 18px; font-weight: 700; margin: 14px 0; }
.closing { text-align: center; font-weight: 700; margin: 22px 0 14px; }
.manager { margin-top: 28px; padding-left: 10%; text-align: left; font-size: 14px; line-height: 1.8; width: 60%; }
.attach { margin-top: 30px; font-size: 13px; }
.mgr-foot { margin-top: auto; margin-inline-start: auto; width: 74mm; text-align: center; padding-top: 14px; font-size: 14.5px; line-height: 1.6; }
.mgr-foot .sign-space { height: 13mm; }
@media print {
  @page { size: A4; margin: 8mm; }
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; height: auto !important; }
  main { padding: 0 !important; max-width: none !important; margin: 0 !important; }
  .card { margin: 0 !important; }
  .doc { width: auto; max-width: none; margin: 0; border: 3px double #000; box-sizing: border-box; min-height: 258mm; height: auto; overflow: visible; padding: 10mm 12mm 8mm; page-break-inside: auto; page-break-after: avoid; break-after: avoid; }
  .doc, .doc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc * { color: #111 !important; }
  
}

/* ───────── الجوال ───────── */
@media (max-width: 640px) {
  header.top { gap: 8px 10px; padding: 10px 12px; }
  .logo { height: 46px; }
  header.top h1 { font-size: 15px; line-height: 1.35; }
  header.top .who { order: 3; flex: 0 0 100%; font-size: 13px; }
  header.top > a.btn, header.top > button { order: 4; padding: 8px 14px; font-size: 14px; }
  main { padding: 12px; }
  .tabs button { padding: 8px 14px; font-size: 14px; }
  .card { padding: 12px; }
  .doc { padding: 12px 14px 18px; font-size: 14px; min-height: 0; }
  .dh-emblem { height: 84px; }
  .dh-logo { height: 54px; }
  .dh-text { font-size: 10.5px; }
  .dh-year { margin-top: 16px; font-size: 11px; }
}
.printpage { background: #d9d9d9; margin: 0; padding: 12px; }
.print-bar { max-width: 794px; margin: 0 auto 12px; display: flex; gap: 8px; align-items: center; }

/* ───────── حقل متعدد الاختيارات ───────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipb { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }
.chipb:hover:not(.on):not(:disabled) { border-color: var(--brand); background: #163070; }
.chipb.on, .chipb.on:hover { background: var(--brand); border-color: var(--brand); color: #0b1a3a; font-weight: 700; }
button:disabled { opacity: .45; cursor: not-allowed; }
.chipb.ghost { background: transparent; border-style: dashed; color: var(--muted); }
.multi { display: flex; flex-wrap: wrap; gap: 8px 16px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg); }
.chk { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.chk input[type=checkbox] { width: auto; }
.multi .other { width: auto; flex: 1; min-width: 130px; padding: 4px 8px; }

/* ───────── نموذج متابعة التكليف (مربعات اختيار) ───────── */
.doc.compact { font-size: 11.8px; line-height: 1.4; padding: 5mm 8mm 3mm; }
.doc.compact .dh-emblem { height: 68px; }
.doc.compact .dh-logo { height: 46px; }
.doc.compact .dh-text { font-size: 9.5px; line-height: 1.35; }
.doc.compact .dh-year { margin-top: 8px; font-size: 10px; }
.doc.compact .dh-rule { margin: 3px 0 2px; }
.doc.compact .dh-meta { font-size: 10.5px; padding-bottom: 2px; margin-bottom: 3px; }
.fu-title { text-align: center; font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.fu-sec { background: #e3e3e3; border-right: 4px solid #000; font-weight: 700; padding: 0 8px; margin: 3px 0 2px; font-size: 12px; }
.fu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; border: 1px solid #000; border-radius: 6px; padding: 1px 7px; margin-bottom: 3px; }
.fu-row > b { flex: 0 0 auto; }
.fu-row .v { flex: 1; min-width: 0; }
.fu-2, .fu-3 { display: flex; gap: 4px; }
.fu-2 > .fu-row, .fu-3 > .fu-row { flex: 1; min-width: 0; }
.fu-3 > .fu-row:first-child { flex: 2.4; }
.ck { display: inline-flex; align-items: center; gap: 3px; margin-inline-end: 10px; white-space: nowrap; }
.cb { width: 10px; height: 10px; border: 1.2px solid #000; display: inline-block; position: relative; flex: 0 0 auto; }
.cb.on::after { content: "✔"; position: absolute; top: -6px; right: -2px; font-size: 13px; line-height: 1; }
.dl { display: inline-block; min-width: 55px; border-bottom: 1px dotted #000; height: 1em; vertical-align: bottom; }
.fu-line { display: inline-block; width: 100%; max-width: 42mm; border-bottom: 1px solid #000; height: 1.05em; vertical-align: bottom; }
table.fu-t { width: 100%; border-collapse: collapse; margin-bottom: 2px; font-size: 10.5px; }
table.fu-t th, table.fu-t td { border: 1px solid #000; padding: 0 6px; text-align: center; height: 17px; }
table.fu-t th { background: #e3e3e3; }
.fu-box { border: 1px solid #000; border-radius: 6px; padding: 0 7px 1px; margin-bottom: 2px; }
.fu-box .ln { border-bottom: 1px solid #000; height: 13px; }
.fu-box p { margin: 0; }
@media print { .doc.compact { padding: 5mm 8mm 3mm; } }
.mgr-foot.nosign { padding-top: 4px; width: 70mm; font-size: 13px; line-height: 1.4; }
.doc.compact .mgr-foot { margin-top: 3px; }
