[hidden] { display: none !important; }
/* منصة نشاطي — الواجهة */
:root {
  --ink: #10293A; --navy: #12364D; --navy-2: #1B4A66;
  --teal: #0A7C80; --teal-dark: #075C5F; --teal-soft: #E3F2F2;
  --bg: #F4F6F7; --card: #FFFFFF; --line: #E1E6EA; --line-2: #EEF1F3; --field: #C9D3DA;
  --muted: #5B6B77;
  --green: #1B6B42; --green-bg: #E6F4EC;
  --amber: #7A4A00; --amber-bg: #FDF3E1;
  --red: #B42318;   --red-bg: #FDECEA;
  --blue: #2B5CB0;  --blue-bg: #EAF0FB;
  --purple: #5B3FB0; --purple-bg: #F1EDFB;
  --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Tajawal", system-ui, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.65; font-size: 15px; }
a { color: var(--teal); } a:hover { color: var(--teal-dark); }
h1 { font-size: 26px; margin: 0 0 4px; line-height: 1.35; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.text-bad { color: var(--red); font-weight: 600; }
.text-good { color: var(--green); font-weight: 600; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* الشريط العلوي */
.topbar { background: var(--navy); color: #fff; height: 64px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand strong { font-size: 18px; }
.brand small { display: block; font-size: 13px; color: #C9D6DF; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--teal); display: grid; place-items: center; }
.brand-mark.big { width: 44px; height: 44px; border-radius: 12px; }
.brand-logo { height: 42px; width: auto; display: block; }
.brand-sep { width: 1px; height: 30px; background: rgba(255,255,255,.28); }
.brand-big .brand-logo { height: 64px; }
.brand-big .brand-sep { height: 48px; }
@media (max-width: 760px) { .topbar .brand-logo { height: 34px; } }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px; border-radius: 12px; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #B9D8DA; color: var(--navy); display: grid; place-items: center; font-weight: 700; }
.who { line-height: 1.3; display: flex; flex-direction: column; }
.who b { font-size: 14px; } .who small { font-size: 12px; color: #C9D6DF; }
.usermenu-panel { position: absolute; left: 0; top: calc(100% + 8px); background: #fff; border-radius: 14px; box-shadow: 0 14px 34px rgba(16,41,58,.18); min-width: 200px; overflow: hidden; }
.usermenu-panel a, .usermenu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; border: 0; background: none; color: var(--ink); text-decoration: none; cursor: pointer; text-align: right; }
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--bg); }
.usermenu-panel form { margin: 0; border-top: 1px solid var(--line-2); }
.usermenu-panel button { color: var(--red); }

/* الهيكل */
.shell { display: flex; gap: 24px; padding: 24px; max-width: 1440px; margin: 0 auto; align-items: flex-start; }
.sidenav { flex: 0 0 248px; align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 8px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; color: var(--ink); text-decoration: none; font-size: 15px; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--teal-soft); color: var(--teal-dark); font-weight: 600; }
.nav-item span { flex: 1; }
.nav-item.locked { color: #8A98A3; cursor: not-allowed; }
.count { background: var(--amber); color: #fff; border-radius: 999px; font-size: 12px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* البطاقات */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.hero-dark { background: var(--navy); color: #fff; border-radius: 18px; padding: 24px; }
.hero-dark .muted { color: #C9D6DF; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; color: var(--ink); display: block; }
a.kpi:hover { border-color: var(--teal); color: var(--ink); }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { display: block; font-size: 28px; line-height: 1.3; }
.kpi.warn { border: 2px solid #C98A1A; padding: 15px 17px; } .kpi.warn span, .kpi.warn b { color: var(--amber); }
.kpi.good b { color: var(--green); }
.kpi.bad b { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 0 0 16px; }
.info div { background: var(--bg); border-radius: 12px; padding: 10px 14px; }
.info dt { font-size: 12px; color: var(--muted); } .info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
.info div { min-width: 0; }
/* النصوص الطويلة بلا مسافات لا تمد الصفحة خارج الشاشة */
.content, .card, .page-head, .page-head > div { min-width: 0; }
.card p, .card li, .card h1, .card h2, .page-head h1, .page-head p, .alert span, .sub { overflow-wrap: anywhere; }

/* قوائم القرارات */
.queue-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.queue-item:last-child { border-bottom: 0; }
.queue-item .body { flex: 1 1 260px; min-width: 0; }
.queue-item .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag-blue { background: var(--blue-bg); color: var(--blue); } .tag-teal { background: var(--teal-soft); color: var(--teal-dark); }
.tag-amber { background: var(--amber-bg); color: var(--amber); } .tag-purple { background: var(--purple-bg); color: var(--purple); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* النماذج */
.form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field small { font-weight: 400; color: var(--muted); }
/* محاذاة الحقول في الصف الواحد حتى لو التف عنوان أحدها لسطرين */
.fields > .field > input:not([type=checkbox]):not([type=radio]):not([type=file]), .fields > .field > select { margin-top: auto; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid var(--field); border-radius: 10px; padding: 0 14px; background: #fff; color: var(--ink); font-weight: 400; }
.field textarea { padding: 10px 14px; min-height: 90px; }
.field input[type=file] { padding: 10px; border-style: dashed; background: #F9FAFB; }
.input-lg { min-height: 54px !important; font-size: 19px; letter-spacing: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; min-height: 0; }
.code-inputs { display: flex; gap: 8px; justify-content: center; direction: ltr; }
.code-inputs input { width: 100%; max-width: 280px; text-align: center; font-size: 28px; letter-spacing: 12px; min-height: 60px; border: 1px solid var(--field); border-radius: 12px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form input, .inline-form select { min-height: 38px; border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--field); background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--teal); color: var(--ink); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-outline { border-color: var(--teal); color: var(--teal); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; font-weight: 600; }
.link-danger { background: none; border: 0; padding: 0; color: var(--red); cursor: pointer; }

/* الجداول */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; color: var(--muted); font-size: 13px; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot th { color: var(--ink); background: var(--bg); }
.table select, .table input { min-height: 38px; border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; background: #fff; }
.row-muted td { color: #8A98A3; }
.sub { display: block; font-size: 12px; color: var(--muted); }
.cell-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.cell-actions form { margin: 0; }

/* شارات وتنبيهات */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-gray { background: var(--line-2); color: var(--muted); } .badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); } .badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.alert { padding: 12px 16px; border-radius: 12px; font-weight: 500; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-warn { background: var(--amber-bg); color: var(--amber); }
.alert-info { background: var(--blue-bg); color: var(--blue); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; background: var(--bg); color: var(--ink); font-weight: 600; font-size: 14px; }
.tabs a.active { background: var(--navy); color: #fff; }

/* خطوات */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.steps a { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.steps a::before { content: ""; height: 6px; border-radius: 6px; background: var(--line); }
.steps .dot { display: none; }
.steps li.active a { color: var(--ink); } .steps li.active a::before { background: var(--teal); }
.steps li.done a { color: var(--green); } .steps li.done a::before { background: #1B7F4B; }
.pill-steps { display: flex; gap: 8px; }
.pill-steps span { flex: 1; text-align: center; padding: 10px 6px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #fff; color: var(--muted); border: 1px solid var(--line); }
.pill-steps .on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill-steps .done { background: var(--green-bg); color: var(--green); border-color: var(--green-bg); }

.progress { height: 8px; background: var(--line-2); border-radius: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 8px; }

/* المستندات */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.doc-card { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.doc-card.ok { border-color: #A9D8BB; } .doc-card.bad { border-color: #F1B5B5; } .doc-card.wait { border-color: #BCD0F2; }
.doc-card form { margin: 0; }
.doc-card input[type=file] { width: 100%; font-size: 13px; }
.doc-card { min-width: 0; }
.doc-file { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.doc-file svg { flex: none; }
.doc-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; unicode-bidi: plaintext; }

.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { padding: 10px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: center; }
.checklist li.ok { background: var(--green-bg); color: var(--green); } .checklist li.no { background: var(--red-bg); color: var(--red); }
.checklist li a { margin-inline-start: auto; font-weight: 600; }

/* صفحات الزوار */
body.guest { background: var(--bg); }
.guest-wrap { min-height: 100vh; display: flex; flex-wrap: wrap; }
.guest-aside { flex: 1 1 360px; background: var(--navy); color: #fff; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 36px; }
.guest-pitch h1 { font-size: 32px; margin-bottom: 24px; }
.guest-pitch ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; color: #DCE6EC; }
.guest-pitch li { display: flex; gap: 12px; align-items: flex-start; }
.guest-pitch li span { width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.1); display: grid; place-items: center; flex-shrink: 0; color: #fff; font-weight: 700; }
.guest-foot { color: #A9BBC7; }
.guest-main { flex: 999 1 520px; min-width: 0; padding: 48px 24px; display: flex; justify-content: center; align-items: flex-start; }
.guest-box { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 20px; }
.guest-box .card { padding: 32px; }
.found-banner { display: flex; align-items: center; gap: 10px; background: var(--green-bg); color: var(--green); padding: 12px 16px; border-radius: 12px; font-weight: 600; }

/* الطباعة */
.print-only { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  .no-print, .topbar, .sidenav, .alert, .btn { display: none !important; }
  .print-only { display: block !important; }
  .shell { padding: 0; } .card { border: 0; padding: 0; }
  .table th { color: #000; border-bottom: 1px solid #000; }
}

@media (max-width: 760px) {
  .shell { padding: 14px; gap: 14px; }
  .shell { flex-direction: column; align-items: stretch; }
  .sidenav { position: sticky; top: 64px; z-index: 15; flex: none; width: auto; min-width: 0; max-width: 100%; max-height: none; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px; border-radius: 14px; box-shadow: 0 6px 16px rgba(16,41,58,.08); }
  .nav-item { flex-shrink: 0; padding: 9px 12px; }
  .who { display: none; }
  .card { padding: 18px; }
  .fields { grid-template-columns: 1fr; }
  .guest-aside { padding: 28px 24px; } .guest-pitch h1 { font-size: 24px; }
  .guest-box .card { padding: 22px; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* المراجعة */
.review-actions { display: flex; flex-direction: column; gap: 6px; }
.review-actions form { margin: 0; display: flex; gap: 6px; }
.reject-form input { flex: 1; min-width: 120px; min-height: 36px; border: 1px solid var(--field); border-radius: 8px; padding: 0 10px; }
.decision-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: end; }
.decision-grid textarea { width: 100%; min-height: 90px; border: 1px solid var(--field); border-radius: 10px; padding: 10px; }
.in-sm { width: 90px; min-height: 38px; border: 1px solid var(--field); border-radius: 8px; padding: 0 8px; }
.signatures { display: none; }
@media print { .signatures { display: flex !important; justify-content: space-between; margin-top: 2rem; } .print-head { display: block !important; text-align: center; } }
.print-head { display: none; }

/* معايير الزيارة */
.criteria { display: flex; flex-direction: column; gap: 10px; }
.criterion { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0; }
.criterion legend { float: right; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.criterion .num { width: 26px; height: 26px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }
.score-opts { clear: both; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.score-opt { position: relative; }
.score-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.score-opt span { display: block; text-align: center; padding: 9px 4px; border: 1px solid var(--field); border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.score-opt input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.score-opt.s3 input:checked + span { background: #1B7F4B; border-color: #1B7F4B; color: #fff; }
.score-opt.s2 input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.score-opt.s1 input:checked + span { background: #C98A1A; border-color: #C98A1A; color: #fff; }
.score-opt.s0 input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.report-frame { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; overflow-x: auto; }
.report-frame table { border-collapse: collapse; }
.share-box { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-box input { flex: 1 1 260px; min-height: 42px; border: 1px solid var(--field); border-radius: 10px; padding: 0 12px; direction: ltr; font-size: 13px; }
@media (max-width: 760px) { .score-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* صور البرامج */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; display: block; border: 1px solid var(--line); }
.photo-grid figure { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.soon { font-size: 11px; background: var(--line-2); color: var(--muted); padding: 2px 8px; border-radius: 999px; }

@media (max-width: 760px) {
  .info { grid-template-columns: 1fr 1fr; }
  .page-head { flex-wrap: wrap; }
}
@media (max-width: 420px) { .info { grid-template-columns: 1fr; } }

/* iPhone يكبّر الصفحة عند الكتابة في أي حقل خطه أصغر من 16px؛ نثبّت 16px في الجوال */
@media (max-width: 900px) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px !important; }
  .code-inputs input { font-size: 28px !important; }
  .input-lg { font-size: 19px !important; }
}
