@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/IBMPlexSansArabic-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/IBMPlexSansArabic-Medium.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/IBMPlexSansArabic-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/IBMPlexSansArabic-Bold.woff2') format('woff2'); }
:root {
  --ink: #0c2d48; --muted: #5a7288; --line: #dbe7ef; --bg: #f1f6fa; --card: #fff;
  --brand: #0a78b0; --brand-d: #075e8b; --cyan: #18b4d6; --soft: #e8f5fb;
  --s: #17876a; --w: #c2513b; --o: #0a78b0; --t: #b57614;
  --shadow: 0 1px 2px rgba(12,45,72,.05), 0 8px 24px -12px rgba(12,45,72,.18);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.7; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { text-wrap: balance; }

/* الترويسة */
header.top { position: relative; overflow: hidden; color: #fff; padding: 28px 20px 30px;
  background: radial-gradient(900px 300px at 0% 0%, rgba(24,180,214,.55), transparent 60%), linear-gradient(135deg, #0c2d48 0%, #0a78b0 62%, #18b4d6 100%); }
header.top::after { content: ''; position: absolute; inset-inline-start: -60px; bottom: -110px; width: 280px; height: 280px; border-radius: 50%; border: 36px solid rgba(255,255,255,.07); }
header.top .in, main { max-width: 1080px; margin: 0 auto; position: relative; z-index: 1; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 600; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 1px 12px; margin-bottom: 8px; }
header.top h1 { margin: 0; font-size: clamp(1.25rem, 2.6vw, 1.7rem); font-weight: 700; line-height: 1.4; }
header.top p { margin: 4px 0 0; opacity: .9; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.32); border-radius: 999px; padding: 1px 12px; font-size: .8rem; }
.chip.solid { background: #fff; color: var(--brand-d); border-color: #fff; font-weight: 600; }

main { padding: 22px 16px 120px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); scroll-margin-top: 70px; }
.card > h2 { margin: 0 0 4px; font-size: 1.12rem; display: flex; align-items: center; gap: 10px; }
.card > h2 .n { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--soft); color: var(--brand); font-size: .9rem; font-weight: 700; }
.hint { color: var(--muted); font-size: .88rem; margin: 0 0 14px; }

/* الحقول */
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=tel], input[type=email], select, textarea { width: 100%; border: 1px solid #cfdde7; border-radius: 10px; padding: 8px 12px; background: #fff; min-height: 42px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 44px; display: block; }
input:hover, select:hover, textarea:hover { border-color: #a9c3d4; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(24,180,214,.28); }
:disabled { background: #f3f7fa !important; color: var(--muted); cursor: not-allowed; }
.ltr { direction: ltr; text-align: right; }
.grid { display: grid; gap: 12px; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }

/* الأزرار */
.btn { border: 1px solid #cfdde7; background: #fff; border-radius: 10px; padding: 8px 16px; cursor: pointer; font-weight: 500; min-height: 42px; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--brand); background: #f7fbfd; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(24,180,214,.4); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn.block { width: 100%; }
.btn.add { border-style: dashed; color: var(--brand); width: 100%; margin-top: 10px; background: transparent; }
.btn.add:hover { background: var(--soft); }
.btn.x { border: 0; background: none; color: #9aa9b5; min-height: 0; padding: 2px 8px; font-size: 1.2rem; line-height: 1; border-radius: 8px; }
.btn.x:hover { color: #b03a2e; background: #fbecea; }
.btn.sm { padding: 3px 12px; font-size: .85rem; min-height: 32px; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; min-height: 0; text-decoration: underline; }

/* الدخول */
.login { max-width: 480px; margin: -18px auto 0; padding: 26px; }
.steps { display: flex; gap: 6px; margin: 0 0 20px; padding: 0; list-style: none; }
.steps li { flex: 1; font-size: .78rem; color: var(--muted); padding-top: 10px; border-top: 4px solid var(--line); font-weight: 500; }
.steps li.on { border-color: var(--brand); color: var(--brand-d); font-weight: 700; }
.steps li.done { border-color: var(--s); color: var(--s); }
.login h2 { margin: 0 0 4px; font-size: 1.2rem; }
.login .field { margin-bottom: 12px; }
.err { color: #a12a2a; min-height: 1.6em; font-size: .88rem; margin: 6px 0; }
.back { display: flex; gap: 8px; margin-top: 4px; }
.back .btn.primary { flex: 1; }

/* شريط التقدم */
.nav { position: sticky; top: 0; z-index: 4; background: rgba(241,246,250,.92); backdrop-filter: blur(6px); margin: -22px -16px 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; overflow-x: auto; }
.nav a { flex: none; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; font-size: .85rem; display: flex; gap: 8px; align-items: center; }
.nav a:hover { border-color: var(--brand); }
.nav a b { background: #eef3f6; color: var(--muted); border-radius: 999px; padding: 0 8px; font-size: .78rem; font-variant-numeric: tabular-nums; }
.nav a.ok b { background: #dff3ea; color: #12684f; }

/* SWOT */
.quad { border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.quad header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: color-mix(in srgb, var(--c) 9%, #fff); border-bottom: 1px solid color-mix(in srgb, var(--c) 22%, #fff); }
.quad .letter { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--c); color: #fff; font-weight: 700; font-family: Georgia, serif; }
.quad h3 { margin: 0; font-size: 1rem; color: var(--c); line-height: 1.3; }
.quad small { color: var(--muted); display: block; font-size: .78rem; }
.quad .count { margin-inline-start: auto; background: #fff; border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); color: var(--c); border-radius: 999px; padding: 0 10px; font-size: .8rem; font-weight: 600; }
.quad .list { padding: 12px 14px 14px; flex: 1; }
.empty { color: #8fa3b3; font-size: .86rem; text-align: center; padding: 14px 0 4px; margin: 0; }
.row { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fafcfd; position: relative; }
.row:focus-within { border-color: #a9d3e6; background: #fff; }
.row .x { position: absolute; top: 4px; inset-inline-end: 4px; }
.row .sub { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.row .first { padding-inline-end: 30px; }
.row .idx { font-size: .75rem; color: var(--brand); font-weight: 700; margin-bottom: 2px; }

/* الشريط السفلي */
.bar { position: fixed; bottom: 0; inset-inline: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; z-index: 5; box-shadow: 0 -8px 24px -16px rgba(12,45,72,.3); }
.bar .state { color: var(--muted); font-size: .86rem; min-width: 160px; }
.notice { background: var(--soft); border: 1px solid #bfe1f0; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: .92rem; }
.notice.ok { background: #e6f5ee; border-color: #b3dfcd; color: #0f5a44; font-weight: 500; }

/* لوحة المشرف */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: start; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; background: #f6fafc; white-space: nowrap; }
tbody tr:hover td { background: #f9fcfe; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
tr.exec td:first-child, tr.ceo td:first-child { font-weight: 600; }
tr.sub td:first-child { padding-inline-start: 28px; color: #2c4a61; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: isolate; letter-spacing: .08em; }
.nowrap { white-space: nowrap; }
.pill { border-radius: 999px; padding: 1px 10px; font-size: .78rem; white-space: nowrap; font-weight: 500; }
.pill.submitted { background: #dff3ea; color: #12684f; }
.pill.draft { background: #fdf0d5; color: #855600; }
.pill.none { background: #eef2f5; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--c, var(--line)); }
.tile b { display: block; font-size: 1.8rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .85rem; }
.meter { height: 8px; border-radius: 999px; background: #e3ecf2; overflow: hidden; margin-bottom: 16px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--s), var(--cyan)); border-radius: 999px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.scroll { overflow-x: auto; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(960px, 94vw); max-height: 90vh; color: var(--ink); box-shadow: 0 30px 80px -20px rgba(12,45,72,.5); }
dialog::backdrop { background: rgba(12,45,72,.5); }
dialog .body { padding: 20px; }
dialog h3 { margin: 18px 0 6px; font-size: 1rem; color: var(--brand); }
#askBox { width: min(440px, 92vw); }
#askBox p { margin: 0 0 16px; }
.hide { display: none !important; }
@media (max-width: 760px) { .g3, .g2 { grid-template-columns: 1fr; } .tiles { grid-template-columns: 1fr 1fr; } .row .sub { grid-template-columns: 1fr; } .card { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .bar, .btn, .nav { display: none !important; } body { background: #fff; } main { padding-bottom: 0; } .card { break-inside: avoid; box-shadow: none; } }

/* إضافة وتعديل داخل السطر */
.item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: #fff; }
.item .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.item .txt[title] { cursor: pointer; }
.item:hover { border-color: #a9d3e6; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: .72rem; background: #eef3f6; color: var(--muted); border-radius: 999px; padding: 0 9px; white-space: normal; }
.tag.hi { background: #fbe9e6; color: #a3402d; }
.tag.hi2 { background: var(--soft); color: var(--brand-d); }
.act { display: flex; gap: 2px; flex: none; }
.btn.ic { border: 0; background: none; min-height: 0; padding: 2px 7px; color: #8fa3b3; border-radius: 8px; font-size: 1.05rem; line-height: 1.3; }
.btn.ic:hover { background: var(--soft); color: var(--brand); }
.btn.ic.del:hover { background: #fbecea; color: #b03a2e; }
.inl { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 8px; border-radius: 10px; margin-bottom: 6px; }
.inl > :first-child { grid-column: 1 / -1; }
.inl input, .inl select { min-height: 36px; padding: 4px 10px; font-size: .9rem; }
.inl .btn { min-height: 36px; }
.inl.new { border: 1px dashed #b9d3e2; background: #f7fbfd; margin: 8px 0 0; }
.inl.edit, .row.edit { border: 1px solid var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(24,180,214,.15); }
.rowact { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

.why { max-width: 720px; margin: -18px auto 16px; border-inline-start: 5px solid var(--cyan); }
.why h2 { font-size: 1.15rem; margin: 0 0 6px; }
.why h3 { font-size: .95rem; margin: 14px 0 4px; color: var(--brand-d); }
.why p { margin: 0 0 8px; }
.why ol { margin: 0 0 12px; padding-inline-start: 22px; }
.why li { margin-bottom: 2px; }
.why + .login { margin-top: 0; max-width: 720px; }

.foot { position: fixed; bottom: 0; inset-inline: 0; z-index: 6; min-height: 34px; margin: 0; padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: #fff; font-size: .8rem; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 8px; text-align: center; line-height: 1.5; }
.bar { bottom: var(--foot-h, 34px); padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
main { padding-bottom: calc(var(--bar-h, 0px) + var(--foot-h, 34px) + 28px); }
@media (max-width: 420px) { .foot { font-size: .72rem; column-gap: 5px; } }

/* حقل الرقم السري: ست خانات من اليسار لليمين */
.pin { display: flex; gap: 8px; justify-content: center; direction: ltr; margin: 10px 0 4px; }
.pin .pin-box { flex: 1 1 0; min-width: 0; max-width: 54px; width: auto; aspect-ratio: 1 / 1.12; padding: 0; text-align: center; font-size: 1.6rem; font-weight: 700; letter-spacing: 0; direction: ltr; border: 1px solid #cfdde7; border-radius: 10px; background: #fff; }
.pin .pin-box:focus-visible { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(24,180,214,.35); }

/* الجوال: لا تمرير أفقي، أهداف لمس 44px، وخط 16px حتى لا يكبّر iOS الصفحة */
html { -webkit-text-size-adjust: 100%; }
img, table { max-width: 100%; }
input, select, textarea { font-size: 16px; }
.btn, .btn.sm, .btn.ic, .btn.x { min-height: 44px; }
.btn.ic, .btn.x { min-width: 44px; }
.inl input, .inl select, .inl .btn { min-height: 44px; font-size: 16px; }
.nav a { min-height: 40px; }
.item .txt, .tag, td, th { overflow-wrap: anywhere; }
th { white-space: normal; }
.tabs .btn { flex: 1 1 auto; }
@media (max-width: 760px) {
  main { padding-inline: 12px; }
  .nav { margin-inline: -12px; padding-inline: 12px; }
  .inl { grid-template-columns: 1fr; }
  .inl > :first-child { grid-column: auto; }
  .login { padding: 20px 16px; }
  .why { padding: 18px 16px; }
  .tiles { gap: 8px; }
  .tile { padding: 10px 12px; }
  dialog .body { padding: 14px; }
}
@media (max-width: 380px) { .pin { gap: 5px; } .steps li { font-size: .7rem; } .btn { padding-inline: 10px; } }
@media print { .foot { display: none !important; } main { padding-bottom: 0; } }

/* الشريط السفلي: صف واحد دائمًا، أيقونات فقط على الشاشات الصغيرة */
.bar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 2px; padding: 4px max(10px, env(safe-area-inset-left, 0px)) 4px max(10px, env(safe-area-inset-right, 0px)); /* مسافة الحافة السفلية الآمنة يتولاها التذييل تحته */ }
.bar .state { min-width: 0; min-height: 0; font-size: .74rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
.bar .acts { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 6px; }
.bar .acts .btn { flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.bar .acts .btn svg { flex: none; }
.bar .acts .btn.primary { width: auto; padding: 0 14px; }
.bar .lbl { display: none; font-size: .88rem; }
.bar .btn.primary .lbl-s { display: inline; }
.bar .btn.primary .lbl-l { display: none; }
@media (min-width: 761px) {
  .bar { flex-direction: row; align-items: center; gap: 12px; padding: 6px 16px; }
  .bar .state { flex: 1 1 auto; font-size: .84rem; }
  .bar .acts { justify-content: flex-end; gap: 8px; flex: none; }
  .bar .acts .btn { width: auto; height: 40px; min-height: 40px; padding: 0 14px; }
  .bar .lbl { display: inline; }
  .bar .btn.primary .lbl-s { display: none; }
  .bar .btn.primary .lbl-l { display: inline; }
}

/* شارة اسم المدير كزر لتعديل بياناته */
.chip.edit { display: inline-flex; align-items: center; min-height: 44px; padding: 2px 14px; font: inherit; font-size: .8rem; color: inherit; cursor: pointer; }
.chip.edit:hover { background: rgba(255,255,255,.26); }
.chip.edit:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(255,255,255,.6); }
