/* =============================================
   منظومة صرف المعينات السمعية — الطابع الرسمي
   ============================================= */
:root {
  --navy: #14284b;
  --navy-2: #0d1d38;
  --navy-3: #1f3a66;
  --gold: #b8913e;
  --gold-soft: #f6efdf;
  --ink: #1b2330;
  --muted: #5d6675;
  --paper: #f2f3f5;
  --surface: #ffffff;
  --line: #d8dce3;
  --line-strong: #b9c0cc;
  --ok: #1e6b43;
  --ok-bg: #e7f3ec;
  --bad: #9e2a22;
  --bad-bg: #fbeceb;
  --warn: #7f5a00;
  --warn-bg: #fdf4dd;
  --radius: 4px;
  --head: "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
  --body: "Noto Naskh Arabic", Tahoma, "Segoe UI", Arial, sans-serif;
  /* أسماء قديمة تستخدمها بعض الصفحات */
  --petrol: var(--navy);
  --petrol-dark: var(--navy-2);
  --petrol-soft: #e8ecf3;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--paper); line-height: 1.7; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy-3); }
a:hover { color: var(--navy); }
h1, h2, h3, legend, summary, .btn, th { font-family: var(--head); }
h1 { font-size: 1.45rem; margin: 0 0 1rem; color: var(--navy); padding-bottom: .45rem; border-bottom: 2px solid var(--gold); display: inline-block; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; color: var(--navy); }
.num { font-variant-numeric: tabular-nums; font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { background: #e8ecf3; padding: 0 .3em; border-radius: 3px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- الترويسة ---------- */
.gov-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.gov-strip { height: 4px; background: linear-gradient(90deg, var(--gold), #d9bd7a, var(--gold)); }
.gov-inner { max-width: 1200px; margin: 0 auto; padding: .65rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gov-brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.gov-brand:hover { color: #fff; }
.gov-seal { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold); color: var(--gold); display: grid; place-items: center; flex-shrink: 0; background: rgba(255,255,255,.04); }
.gov-titles { display: flex; flex-direction: column; line-height: 1.3; }
.gov-titles strong { font-family: var(--head); font-size: 1.05rem; }
.gov-titles small { color: #c9d2e3; font-size: .8rem; }

.gov-nav { background: var(--navy-2); border-top: 1px solid rgba(255,255,255,.08); }
.gov-nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 1rem; display: flex; align-items: stretch; gap: .2rem; }
.gov-nav a, .nav-group summary { color: #dfe5ef; text-decoration: none; padding: .7rem .9rem; display: flex; align-items: center; gap: .4rem; font-family: var(--head); font-size: .92rem; border-bottom: 3px solid transparent; cursor: pointer; }
.gov-nav a:hover, .nav-group summary:hover { color: #fff; background: rgba(255,255,255,.05); }
.gov-nav a.active, .nav-group.active > summary { color: #fff; border-bottom-color: var(--gold); }
.nav-group { position: relative; }
.nav-group summary { list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "▾"; font-size: .75rem; margin-inline-start: .2rem; }
.nav-menu { position: absolute; top: 100%; inset-inline-start: 0; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); box-shadow: 0 8px 20px rgba(0,0,0,.15); z-index: 60; }
.nav-menu a { color: var(--ink); border: 0; padding: .65rem 1rem; border-bottom: 1px solid var(--line); }
.nav-menu a:hover { background: var(--paper); color: var(--navy); }
.nav-menu a.active { color: var(--navy); background: var(--gold-soft); border-bottom-color: var(--line); }
.nav-user { margin-inline-start: auto; display: flex; align-items: center; gap: .8rem; font-size: .85rem; }
.gov-nav .nav-user a { padding: .4rem 0; border: 0; }
.nav-user-role { color: #9fb0c9; }
.gov-nav .nav-logout { color: #f0c9c5; }
.nav-toggle { display: none; background: transparent; border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius); width: 44px; height: 40px; padding: 9px; cursor: pointer; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }

.wrap { max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.section-title { margin-top: 2rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); display: block; }

.gov-footer { border-top: 3px solid var(--gold); background: var(--navy); color: #c9d2e3; text-align: center; font-size: .8rem; padding: .9rem 1rem calc(.9rem + env(safe-area-inset-bottom, 0px)); }
.gov-footer .muted { color: #8fa0bb; }

/* ---------- الرسائل والوسوم ---------- */
.notice { padding: .75rem 1rem; border-radius: var(--radius); margin: 0 0 .9rem; background: #e8ecf3; border: 1px solid #cfd7e4; border-inline-start: 5px solid var(--navy-3); }
.notice.ok { background: var(--ok-bg); border-color: #bcdcc9; border-inline-start-color: var(--ok); }
.notice.bad { background: var(--bad-bg); border-color: #efc6c2; border-inline-start-color: var(--bad); }
.notice.warn { background: var(--warn-bg); border-color: #ecd9a6; border-inline-start-color: var(--warn); }
.hint { color: var(--muted); font-size: .88rem; margin: .45rem 0 0; }
.tag { font-family: var(--head); font-size: .72rem; padding: .1rem .5rem; border-radius: 2px; white-space: nowrap; border: 1px solid transparent; }
.tag.bad { background: var(--bad-bg); color: var(--bad); border-color: #efc6c2; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd9a6; }
.tag.old { background: #e8ecf3; color: var(--navy-3); border-color: #cfd7e4; }

/* ---------- الحقول والأزرار ---------- */
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: .6rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-3); outline: none; box-shadow: 0 0 0 3px rgba(31,58,102,.15); }
input[readonly] { background: var(--paper); color: var(--muted); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--navy); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 600; color: #2b3445; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-size: .92rem; cursor: pointer; background: var(--navy); color: #fff; border: 1px solid var(--navy); padding: .55rem 1.2rem; border-radius: var(--radius); text-decoration: none; white-space: nowrap; min-height: 44px; }
.btn:hover { background: var(--navy-2); color: #fff; }
.btn-quiet { background: #fff; color: var(--navy); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--paper); color: var(--navy-2); border-color: var(--navy-3); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #7c1f19; }
.btn-small { padding: .3rem .8rem; font-size: .85rem; min-height: 36px; }
.btn-big { padding: .8rem 2.4rem; font-size: 1.02rem; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: #9c7a30; }

.stack { display: flex; flex-direction: column; gap: .9rem; }
.narrow { max-width: 440px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; grid-column: 1 / -1; }
.fields { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.fields .wide { grid-column: span 2; }
.fields .full { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form input, .inline-form select { width: auto; min-width: 0; }
.short { max-width: 170px; }
.tiny { max-width: 74px; }

/* ---------- البطاقات العامة ---------- */
.search-block, .filters, .panel, .panel-form, .details, .table-wrap, .dispense-form fieldset {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(20,40,75,.05);
}

/* ---------- البحث والمسح ---------- */
.search-block { padding: 1.2rem 1.2rem 1rem; margin-bottom: 1.2rem; border-top: 4px solid var(--navy); }
.search-label { font-family: var(--head); font-size: 1rem; color: var(--navy); }
.search-row { display: flex; gap: .5rem; margin-top: .5rem; }
.search-row input { font-size: 1.3rem; padding: .7rem .9rem; letter-spacing: .03em; min-height: 54px; }
.search-row .btn { min-width: 110px; }
.scan-row { margin-top: .9rem; display: flex; }
#scan-open { background: var(--gold); border-color: var(--gold); color: #fff; font-size: 1rem; padding: .7rem 1.4rem; }
#scan-open:hover { background: #9c7a30; }
.scan-panel { margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); background: #fcfbf8; }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.scan-actions .btn { min-height: 52px; font-size: 1rem; }
.scan-status { margin: .8rem 0 .3rem; font-family: var(--head); font-size: .92rem; color: var(--navy); }
.scan-panel progress { width: 100%; height: 8px; accent-color: var(--gold); }
.scan-preview img { max-width: 100%; max-height: 220px; border-radius: var(--radius); margin: .6rem 0; border: 1px solid var(--line); display: block; }
#scan-result { margin-top: .6rem; padding-top: .8rem; border-top: 1px dashed var(--line-strong); }
.scan-err { color: var(--bad); font-size: .9rem; margin: .4rem 0 0; }
.scan-raw-box { margin-top: .8rem; }
.scan-raw-box summary { font-size: .85rem; color: var(--muted); cursor: pointer; }
.scan-raw-box pre { white-space: pre-wrap; font-size: .8rem; background: #fff; padding: .6rem; border-radius: var(--radius); border: 1px solid var(--line); max-height: 200px; overflow: auto; }

/* ---------- حكم الاستحقاق ---------- */
.verdict { border-radius: var(--radius); padding: 1rem 1.3rem; margin-bottom: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-inline-start: 8px solid var(--muted); display: flex; flex-direction: column; gap: .2rem; }
.verdict-status { font-family: var(--head); font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
.verdict-detail { font-size: 1rem; }
.verdict-ok { background: var(--ok-bg); border-color: #bcdcc9; border-inline-start-color: var(--ok); }
.verdict-ok .verdict-status { color: var(--ok); }
.verdict-bad { background: var(--bad-bg); border-color: #efc6c2; border-inline-start-color: var(--bad); }
.verdict-bad .verdict-status { color: var(--bad); }
.verdict-pending .verdict-status { font-size: 1.15rem; color: var(--muted); }

/* ---------- نموذج الصرف ---------- */
.dispense-form fieldset { margin: 0 0 1rem; padding: 1rem 1.1rem 1.2rem; }
.dispense-form legend { font-size: .98rem; color: #fff; background: var(--navy); padding: .2rem .8rem; border-radius: 2px; }
.exception-box, .legacy-box { border-color: #ecd9a6 !important; background: var(--warn-bg) !important; }
.exception-box legend, .legacy-box legend { background: var(--warn) !important; }
.exception-box .check { margin-bottom: .75rem; font-weight: 600; }
.legacy-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .7rem 0; border-bottom: 1px solid #ecd9a6; }
.legacy-item:last-child { border-bottom: 0; }
.legacy-choice { display: flex; gap: 1.2rem; align-items: center; }
.legacy-choice label { white-space: nowrap; }
.confirm-row { display: flex; flex-wrap: wrap; gap: .7rem 1.8rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.dispense-form > .actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--paper) 30%); padding: 1rem 0 calc(.6rem + env(safe-area-inset-bottom, 0px)); }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
.grid th, .grid td { padding: .6rem .75rem; text-align: center; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { background: var(--navy); color: #fff; font-weight: 500; font-size: .85rem; white-space: nowrap; }
.grid tbody tr:nth-child(even) { background: #f8f9fb; }
.grid tbody tr:hover { background: var(--gold-soft); }
.grid tbody tr:last-child td { border-bottom: 0; }
.row-cancelled td { color: #8a929e; text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.row-cancelled td a { color: inherit; }
.row-alert td { background: #fdf3f2; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }

.filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; padding: 1rem; margin-bottom: 1rem; border-top: 4px solid var(--navy); }
.filters label { min-width: 150px; }
.filters label:first-child { flex: 1 1 240px; }
.filter-actions { display: flex; gap: .5rem; }
#results { transition: opacity .15s; }

/* ---------- تفاصيل السجل ---------- */
.record-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.record-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; margin: 0; }
.details > div { padding: .7rem 1rem; border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); }
.details .full { grid-column: 1 / -1; border-bottom: 0; }
.details dt { font-size: .78rem; color: var(--muted); font-family: var(--head); }
.details dd { margin: 0; font-weight: 600; }
.serial { display: inline-block; background: #e8ecf3; padding: 0 .45rem; border-radius: 2px; margin: 1px 0; }
.plain-list { list-style: none; padding: 0; margin: .5rem 0; }
.plain-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.panel { padding: .85rem 1.1rem; margin-top: 1.2rem; }
.panel summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.panel[open] summary { margin-bottom: .8rem; }
.panel.danger summary { color: var(--bad); }
.panel ol { padding-inline-start: 1.3rem; }
.panel li { margin-bottom: .4rem; }
.panel-form { padding: 1rem; }
.settings-section { margin-bottom: 2.4rem; }
.import-report { margin-top: 1.5rem; }
pre.code { background: var(--navy-2); color: #e8eef7; padding: .7rem .9rem; border-radius: var(--radius); overflow-x: auto; font-size: .85rem; margin: .4rem 0; }

/* ---------- الدخول ---------- */
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; background: var(--navy) radial-gradient(circle at 20% 10%, rgba(184,145,62,.18), transparent 45%); }
.auth-box { width: 100%; max-width: 420px; background: var(--surface); border-radius: 6px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.35); border-top: 5px solid var(--gold); }
.auth-head { background: var(--navy-2); color: #fff; text-align: center; padding: 1.4rem 1.2rem 1.1rem; }
.auth-head .gov-seal { margin: 0 auto .6rem; width: 56px; height: 56px; }
.auth-head h1 { color: #fff; border: 0; font-size: 1.2rem; margin: 0; padding: 0; display: block; }
.auth-head p { margin: .2rem 0 0; color: #c9d2e3; font-size: .85rem; }
.auth-body { padding: 1.4rem 1.4rem 1.2rem; }
.auth-note { font-size: .8rem; color: var(--muted); text-align: center; margin: 1rem 0 0; }
.auth-box > h1 { margin: 1.2rem 1.4rem .4rem; }
.auth-box > .notice, .auth-box > form, .auth-box > p { margin-inline: 1.4rem; }
.auth-box > form { margin-bottom: 1.4rem; }

/* ---------- استمارة الاستلام ---------- */
.print-page { background: #e9ebef; display: block; }
.print-actions { max-width: 210mm; margin: 1rem auto; display: flex; gap: 1rem; align-items: center; }
.sheet { background: #fff; max-width: 210mm; margin: 0 auto 2rem; padding: 14mm 14mm 18mm; font-size: 13px; color: #000; }
.sheet-head { text-align: center; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
.sheet-head h1 { font-size: 20px; margin: 4px 0; color: #000; border: 0; display: block; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th, .sheet-table td { border: 1px solid #000; padding: 6px 8px; text-align: start; }
.sheet-table th { background: #f0f0f0; width: 17%; font-weight: 700; }
.pledge { margin-top: 14px; border: 1px solid #000; padding: 8px 12px; }
.pledge h2 { font-size: 15px; margin: 0 0 4px; color: #000; }
.pledge p { margin: 0 0 4px; line-height: 1.9; }
.signatures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 26px; text-align: center; }
.signatures .line { display: block; border-bottom: 1px solid #000; height: 44px; }
.signatures .box { display: block; border: 1px solid #000; height: 60px; width: 60px; margin: 6px auto 0; }
.signatures small { display: block; margin-top: 4px; }
@media print {
  .print-actions { display: none; }
  .print-page { background: #fff; }
  .sheet { margin: 0; padding: 0; max-width: none; }
  @page { size: A4; margin: 12mm; }
}

/* ---------- الموبايل ---------- */
@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .gov-nav { display: none; }
  .gov-nav.open { display: block; }
  .gov-nav-inner { flex-direction: column; padding: .3rem 1rem 1rem; gap: 0; }
  .gov-nav a, .nav-group summary { padding: .85rem .3rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  .gov-nav a.active, .nav-group.active > summary { border-bottom-color: rgba(255,255,255,.08); color: var(--gold); }
  .nav-group[open] .nav-menu, .nav-menu { position: static; box-shadow: none; border: 0; background: transparent; }
  .nav-menu a { color: #dfe5ef; padding-inline-start: 1.3rem; border-bottom: 1px solid rgba(255,255,255,.06); }
  .nav-menu a:hover, .nav-menu a.active { background: transparent; color: var(--gold); }
  .nav-user { margin: .8rem 0 0; flex-direction: column; align-items: flex-start; gap: .2rem; }
  .gov-titles small { display: none; }
  .gov-titles strong { font-size: .95rem; }
  .gov-seal { width: 38px; height: 38px; }
}
@media (max-width: 640px) {
  .wrap { padding: 1rem .75rem 2rem; }
  h1 { font-size: 1.25rem; }
  .fields { grid-template-columns: 1fr; }
  .fields .wide { grid-column: 1 / -1; }
  .search-row input { font-size: 1.15rem; }
  .search-row .btn { min-width: 80px; }
  #scan-open { width: 100%; }
  .scan-row { display: block; }
  .verdict-status { font-size: 1.45rem; }
  .filters label { min-width: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .dispense-form fieldset { padding: .8rem .8rem 1rem; }
  .dispense-form > .actions .btn { width: 100%; }
  .legacy-choice { width: 100%; justify-content: space-between; background: #fff; padding: .5rem .7rem; border-radius: var(--radius); border: 1px solid #ecd9a6; }
  .confirm-row { flex-direction: column; gap: .7rem; }
  .details { grid-template-columns: 1fr 1fr; }
  .record-actions { width: 100%; }
  .record-actions .btn { flex: 1; }
  .grid { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* صندوق الاستثناء: محايد افتراضياً، وأحمر إذا المريض غير مستحق */
.exception-box { background: var(--surface) !important; border-color: var(--line) !important; }
.exception-box legend { background: var(--navy-3) !important; }
.exception-box.required { background: var(--bad-bg) !important; border-color: #efc6c2 !important; }
.exception-box.required legend { background: var(--bad) !important; }
.exc-why { margin-top: 0; color: var(--muted); }
.exc-why.bad { color: var(--bad); font-weight: 700; }

.scan-phone-box { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; margin-top: 1rem; padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.scan-qr { background: #fff; padding: 8px; border: 1px solid var(--line); line-height: 0; }
.scan-qr img, .scan-qr canvas { display: block; }
.scan-phone-box ol { margin: .4rem 0; padding-inline-start: 1.2rem; }

.elig { display: inline-block; font-family: var(--head); font-size: .8rem; padding: .15rem .6rem; border-radius: 2px; border: 1px solid; white-space: nowrap; }
.elig.ok { color: var(--ok); background: var(--ok-bg); border-color: #bcdcc9; }
.elig.bad { color: var(--bad); background: var(--bad-bg); border-color: #efc6c2; }
.elig.mid { color: var(--warn); background: var(--warn-bg); border-color: #ecd9a6; white-space: normal; }
.elig-sub { display: block; font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* سقف الصرف اليومي */
.cap-bar { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--ok); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; }
.cap-bar.low { border-inline-start-color: var(--warn); background: var(--warn-bg); }
.cap-bar.full { border-inline-start-color: var(--bad); background: var(--bad-bg); }
.cap-text { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; font-size: .92rem; }
.cap-text strong { font-family: var(--head); color: var(--navy); }
.cap-track { height: 8px; background: #e3e7ee; border-radius: 4px; margin-top: .5rem; overflow: hidden; }
.cap-fill { height: 100%; background: var(--ok); }
.cap-bar.low .cap-fill { background: var(--warn); }
.cap-bar.full .cap-fill { background: var(--bad); }
.cap-note { margin: .5rem 0 0; color: var(--bad); font-weight: 700; font-size: .9rem; }
.days-row { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; margin-top: .4rem; }
.day-chip { font-size: .85rem; }

/* شعار الجهة */
.gov-seal.has-logo { background: #fff; padding: 3px; overflow: hidden; }
.gov-seal.has-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.auth-head .gov-seal.has-logo { width: 72px; height: 72px; padding: 4px; box-shadow: 0 0 0 4px rgba(184,145,62,.25); }
.logo-setting { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.logo-preview { background: var(--navy); padding: .8rem; border-radius: var(--radius); }
.logo-preview .gov-seal { width: 64px; height: 64px; }
.sheet-logo { display: block; width: 70px; height: 70px; object-fit: contain; margin: 0 auto 6px; }

/* شعار الوزارة بصفحة الدخول */
.auth-logo { background: #fff; text-align: center; padding: 1.1rem 1rem .6rem; }
.auth-logo img { max-width: 220px; width: 70%; height: auto; }
.sheet-logo { width: auto; height: 85px; }
.gov-seal.has-logo { padding: 4px; }

/* أنواع السماعات: عمودين */
.model-add { margin-bottom: .8rem; }
.model-add input { flex: 1; max-width: 520px; }
.models-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.models-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .6rem; }
.models-grid li.off { background: #f6f7f9; }
.models-grid li.off input[name="name"] { color: var(--muted); }
.model-row { display: flex; align-items: center; gap: .6rem; }
.model-row input[name="name"] { flex: 1; min-width: 0; }
.model-row .check { white-space: nowrap; font-size: .85rem; }
@media (max-width: 820px) { .models-grid { grid-template-columns: 1fr; } }
.btn-del { background: #fff; color: var(--bad); border-color: #efc6c2; padding: .3rem .6rem; }
.btn-del:hover { background: var(--bad-bg); color: var(--bad); }
.models-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: 1rem; }
.models-bulk .hint { margin: 0; flex: 1; min-width: 240px; }
.brand-title { font-size: .95rem; color: var(--navy); margin: 1.1rem 0 .5rem; padding-bottom: .3rem; border-bottom: 1px dashed var(--line); direction: ltr; text-align: right; }
.models-save-bar { position: sticky; top: 110px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; background: var(--paper); padding: .6rem 0; }
.models-save-bar .hint { margin: 0; }
.models-save-bar.bottom { position: static; margin-top: 1rem; }
@media (max-width: 820px) { .models-save-bar { top: 64px; } }

/* الحجز */
.booking-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.booking-tabs a { padding: .55rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; font-family: var(--head); color: var(--navy); }
.booking-tabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.booking-ticket { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: var(--radius); padding: 1.2rem; }
.booking-ticket h1 { color: var(--ok); }
.ticket-code { text-align: center; margin: .5rem 0 1rem; }
.ticket-code span { display: block; color: var(--muted); font-size: .85rem; }
.ticket-code b { font-size: 2.4rem; letter-spacing: .25em; color: var(--navy); }
.booking-acts { white-space: nowrap; }
.booking-acts form { display: inline; }
.booking-link { display: block; width: 100%; margin-top: 1rem; text-align: center; }
@media print { .gov-header, .gov-footer, .booking-tabs, .actions { display: none !important; } .booking-ticket { border: 1px solid #000; } }
.bk-st { display: inline-block; font-family: var(--head); font-size: .78rem; padding: .15rem .55rem; border-radius: 2px; border: 1px solid; white-space: nowrap; }
.bk-booked { color: var(--warn); background: var(--warn-bg); border-color: #ecd9a6; }
.bk-done { color: var(--ok); background: var(--ok-bg); border-color: #bcdcc9; }
.bk-noshow, .bk-cancelled { color: var(--bad); background: var(--bad-bg); border-color: #efc6c2; }
.nav-badge { background: var(--gold); color: var(--navy-2); font-family: var(--body); font-weight: 700; font-size: .75rem; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 1rem; display: inline-flex; align-items: center; justify-content: center; margin-inline-start: .3rem; }
.serial-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.serial-form input { width: 150px; min-height: 38px; padding: .35rem .5rem; }
.copy-label { display: inline-block; margin-top: 6px; border: 1.5px solid #000; padding: 2px 12px; font-weight: 700; font-size: 13px; }
.supplier-box { margin-top: 12px; border: 2px dashed #000; padding: 6px 10px 10px; }
.supplier-box h2 { font-size: 14px; margin: 0 0 6px; color: #000; }
.page-break { page-break-before: always; break-before: page; }
@media print { .sheet { page-break-inside: avoid; } }
.pen-cell { height: 40px; }

/* مستندات السجل */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.doc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.doc-thumb { display: block; height: 150px; background: #f3f4f6; border-bottom: 1px solid var(--line); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-pdf { display: grid; place-items: center; height: 100%; font-family: var(--head); font-size: 1.6rem; color: var(--bad); }
.doc-meta { padding: .5rem .7rem; display: flex; flex-direction: column; gap: .15rem; }
.doc-acts { display: flex; gap: .8rem; font-size: .88rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--bad); cursor: pointer; font: inherit; text-decoration: underline; min-height: 0; }
.doc-upload { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.doc-upload input[type=file] { flex: 1; min-width: 220px; }

/* ========== لوحة اليوم ========== */
.today-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.today-head h1 { margin-bottom: .2rem; }
.today-sub { color: var(--muted); font-family: var(--head); }
.today-center select { min-width: 240px; }
.day-state { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.day-state strong { font-family: var(--head); }
.day-state.on { background: var(--ok-bg); border-color: #bcdcc9; color: var(--ok); }
.day-state.off { background: var(--bad-bg); border-color: #efc6c2; color: var(--bad); }
.day-state span { color: var(--ink); font-size: .92rem; }
.quick-search { display: flex; gap: .5rem; margin-bottom: 1.2rem; }
.quick-search input { font-size: 1.15rem; min-height: 54px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; margin-bottom: 1.4rem; }
.stat { display: flex; flex-direction: column; gap: .3rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: var(--ink); transition: box-shadow .15s, transform .15s; }
.stat:hover { box-shadow: 0 6px 16px rgba(20,40,75,.12); transform: translateY(-1px); color: var(--ink); }
.stat.attention { border-top-color: var(--gold); background: #fffdf7; }
.stat-label { font-family: var(--head); font-size: .85rem; color: var(--muted); }
.stat-value { font-size: 2.2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-value small { font-size: 1rem; color: var(--muted); font-weight: 400; }
.stat-bar { height: 6px; background: #e3e7ee; border-radius: 3px; overflow: hidden; }
.stat-bar span { display: block; height: 100%; background: var(--ok); }
.stat-bar span.low { background: var(--warn); }
.stat-bar span.full { background: var(--bad); }
.stat-foot { font-size: .85rem; color: var(--muted); }
.today-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.today-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.today-panel h2 { font-size: 1rem; margin-bottom: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.today-list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.today-list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.today-list li:last-child { border-bottom: 0; }

/* ========== بطاقات المنافذ بالإعدادات ========== */
.center-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; margin-top: 1rem; }
.center-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.center-card.off { border-top-color: var(--line-strong); opacity: .8; }
.cc-head { display: flex; align-items: center; gap: .8rem; }
.cc-name { flex: 1; font-family: var(--head); font-weight: 700; }
.cc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; align-items: end; }
.cc-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--paper); border-radius: var(--radius); min-height: 44px; padding: .3rem; }
.cc-stat span { font-size: .75rem; color: var(--muted); }
.cc-stat b { font-size: 1.2rem; color: var(--navy); }
.cc-booking { padding: .5rem .7rem; background: var(--paper); border-radius: var(--radius); }
.cc-days { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cc-days-label { font-weight: 600; font-size: .9rem; margin-inline-end: .3rem; }
.day-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-pill span { display: inline-block; padding: .35rem .75rem; border: 1px solid var(--line-strong); border-radius: 2rem; font-size: .85rem; cursor: pointer; background: #fff; user-select: none; }
.day-pill input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.day-pill input:focus-visible + span { outline: 3px solid var(--gold); }
.cc-foot { display: flex; justify-content: flex-end; }
@media (max-width: 640px) { .center-cards { grid-template-columns: 1fr; } .cc-grid { grid-template-columns: 1fr 1fr; } .quick-search .btn { min-width: 0; } }

/* منع التمرير الأفقي بالموبايل */
.wrap { overflow-x: clip; }
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 640px) {
  #booking-form .fields { grid-template-columns: 1fr; }
  #booking-form select, #booking-form input { font-size: 16px; } /* يمنع التكبير التلقائي بالآيفون */
  .booking-tabs a { flex: 1; text-align: center; padding: .55rem .5rem; font-size: .9rem; }
  .ticket-code b { font-size: 1.9rem; letter-spacing: .15em; }
}

/* مكان صورة المريض بالاستمارة */
.sheet { position: relative; }
.photo-box { position: absolute; top: 14mm; left: 14mm; width: 30mm; height: 40mm; border: 1.5px dashed #000; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; color: #555; line-height: 1.6; }
@media print { .photo-box { top: 0; left: 0; } }
.bring-list ul { margin: .4rem 0 0; padding-inline-start: 1.3rem; }
.bring-list li { margin: .15rem 0; }
.signatures .committee { grid-column: span 2; }
.signatures .stamp { display: flex; align-items: center; justify-content: center; border: 1.5px dashed #000; height: 70px; margin-top: 6px; color: #888; font-size: 12px; }
.signatures { grid-template-columns: 1fr 2fr; }
.signatures .committee { grid-column: auto; }
.signatures { grid-template-columns: repeat(4, 1fr); margin-top: 10px; }
.sign-title { font-size: 15px; margin: 26px 0 0; color: #000; text-align: center; border-top: 1px solid #000; padding-top: 10px; }
.signatures .committee-member small { color: #555; }
.signatures.recipient-row { grid-template-columns: 1fr; width: 45%; margin-inline-start: 0; margin-top: 22px; }
.signatures.committee-row { grid-template-columns: repeat(3, 1fr); margin-top: 6px; }
.sign-title { border-top: 0; padding-top: 0; margin-top: 28px; }
.signatures.committee-row .line { border-bottom: 0; height: 60px; }

/* ========== استمارة A4 ========== */
.sheet.a4 { width: 210mm; min-height: 297mm; max-width: none; margin: 0 auto 10mm; padding: 14mm 15mm 12mm; font-size: 14px; display: flex; flex-direction: column; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.a4 .photo-box { position: static; width: 28mm; height: 36mm; margin-inline-start: auto; }
.a4-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8mm; padding-bottom: 5mm; border-bottom: 2.5px solid #000; }
.a4-head-right { font-weight: 700; font-size: 14px; line-height: 1.9; }
.a4-head-left { display: flex; }
.a4-logo { height: 30mm; width: auto; display: block; }
.a4-title { text-align: center; margin: 5mm 0 4mm; }
.a4-title h1 { font-size: 24px; margin: 0 0 3mm; color: #000; border: 0; display: block; letter-spacing: .3px; }
.a4-meta { display: flex; justify-content: center; align-items: center; gap: 10mm; font-size: 14px; }
.a4-meta b { font-size: 17px; }
.a4 .copy-label { margin: 0; }
.a4-sec { margin-bottom: 4mm; }
.a4-sec h2, .a4-committee h2 { font-size: 15px; margin: 0 0 2.5mm; color: #000; padding: 1.5mm 3mm; background: #eee; border-inline-start: 4px solid #000; }
.a4-table th, .a4-table td { padding: 2.6mm 3mm; font-size: 14px; }
.a4-table th { width: 22%; }
.a4-table td.big { font-size: 16px; font-weight: 700; }
.a4 .pen-cell { height: 12mm; }
.a4-note { font-size: 12px; color: #444; }
.a4-committee { margin-top: auto; padding-top: 4mm; }
.a4-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; text-align: center; }
.a4-sign div { border: 1px solid #000; height: 30mm; padding-top: 3mm; font-size: 15px; }
.a4-foot { display: flex; justify-content: space-between; margin-top: 6mm; padding-top: 2.5mm; border-top: 1px solid #000; font-size: 11px; color: #444; }
@media print {
  .sheet.a4 { width: auto; min-height: 240mm; margin: 0; padding: 0; box-shadow: none; }
  @page { size: A4; margin: 12mm; }
}

@media print {
  @page { size: A4; margin: 10mm; }
  .a4-committee, .a4-sign, .a4-foot { break-inside: avoid; page-break-inside: avoid; }
  .a4-sign div { height: 26mm; }
}
/* الطباعة: تخطيط مضغوط يضمن صفحة واحدة لكل نسخة حتى بأكثر الحالات صفوفاً */
@media print {
  .sheet.a4 { display: block; min-height: 0; font-size: 13px; }
  .a4-head { padding-bottom: 3mm; gap: 5mm; }
  .a4-head-right { font-size: 13px; line-height: 1.7; }
  .a4-logo { height: 24mm; }
  .a4 .photo-box { width: 26mm; height: 32mm; }
  .a4-title { margin: 3mm 0 3mm; }
  .a4-title h1 { font-size: 21px; margin-bottom: 2mm; }
  .a4-sec { margin-bottom: 3mm; }
  .a4-sec h2, .a4-committee h2 { font-size: 14px; margin-bottom: 1.5mm; padding: 1mm 3mm; }
  .a4-table th, .a4-table td { padding: 1.8mm 2.5mm; font-size: 13px; }
  .a4-table td.big { font-size: 15px; }
  .a4 .pen-cell { height: 10mm; }
  .a4-committee { margin-top: 5mm; padding-top: 0; }
  .a4-sign div { height: 24mm; }
  .a4-foot { margin-top: 4mm; }
}
/* تملأ الصفحة: اللجنة والتذييل بأسفل الورقة دائماً */
@media print {
  .sheet.a4 { display: flex; flex-direction: column; min-height: 248mm; }
  .a4-committee { margin-top: auto; padding-top: 5mm; }
  .a4 .pen-cell { height: 12mm; }
  .a4-sign div { height: 28mm; }
  .a4-table th, .a4-table td { padding: 2.4mm 2.5mm; }
}

/* التبويب الحالي واضح: خلفية ذهبية */
.gov-nav a, .nav-group summary { white-space: nowrap; }
.gov-nav-inner > a.active, .nav-group.active > summary {
  background: var(--gold); color: var(--navy-2) !important; border-bottom-color: #f2d68f; font-weight: 700;
  border-radius: 6px 6px 0 0; box-shadow: inset 0 -3px 0 #f2d68f;
}
.gov-nav-inner > a.active svg { color: var(--navy-2); }
.gov-nav-inner > a.active .nav-badge { background: var(--navy-2); color: #fff; }
.gov-nav-inner > a:not(.active):hover, .nav-group:not(.active) > summary:hover { background: rgba(255,255,255,.08); }
.nav-user { white-space: nowrap; }
.nav-user-role { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 820px) {
  .gov-nav-inner > a.active, .nav-group.active > summary { border-radius: 6px; box-shadow: none; color: var(--navy-2) !important; }
}
.cc-cov summary { cursor: pointer; font-size: .9rem; color: var(--navy); padding: .3rem 0; }
.cc-cov[open] summary { margin-bottom: .4rem; }

/* ---------- البحث الموحد بالترويسة ---------- */
.header-search { display: flex; flex: 0 1 360px; margin-inline-start: auto; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); border-radius: var(--radius); overflow: hidden; }
.header-search input { flex: 1; min-width: 0; min-height: 40px; background: transparent; border: 0; color: #fff; padding: .4rem .8rem; font-size: .95rem; box-shadow: none; }
.header-search input::placeholder { color: #b9c4d8; }
.header-search input:focus { outline: none; background: rgba(255,255,255,.06); }
.header-search:focus-within { border-color: var(--gold); }
.header-search button { background: transparent; border: 0; color: var(--gold); padding: 0 .8rem; cursor: pointer; display: grid; place-items: center; }
.header-search.nav-search { display: none; }
@media (max-width: 820px) {
  .gov-inner > .header-search { display: none; }
  .header-search.nav-search { display: flex; flex: none; margin: .7rem 0 .3rem; }
}

/* ---------- إثبات السكن ---------- */
.residence-box { border-top-color: var(--gold) !important; }
.residence-box .confirm-row { gap: .6rem 1.4rem; }

/* ---------- تبسيط استمارة الصرف ---------- */
.form-errors ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; }
.form-errors li { margin: .15rem 0; }
.field-bad input, .field-bad select, .field-bad textarea { border-color: var(--bad) !important; background: #fff6f5 !important; box-shadow: 0 0 0 2px rgba(180,40,30,.12); }
label.field-bad, .check.field-bad { color: var(--bad); }
fieldset.field-bad { border-color: var(--bad) !important; box-shadow: 0 0 0 2px rgba(180,40,30,.12); }
.exc-toggle-row { margin: .2rem 0 1rem; }
.notes-toggle { margin-top: .6rem; }
.notes-toggle summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.notes-toggle textarea { margin-top: .4rem; width: 100%; }
.today-list .serial-form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.today-list .serial-form input { width: 150px; min-height: 36px; }
.today-list li.row-alert { background: var(--bad-bg); }
#pending { margin-bottom: 1.4rem; }

/* ---------- رأس صفحة المريض ---------- */
.patient-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--navy); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.patient-head h2 { margin: 0 0 .15rem; font-size: 1.3rem; }
.locked-field { background: #eef1f6 !important; color: var(--ink); font-weight: 600; cursor: not-allowed; }

/* ---------- بطاقة المريض: الاسم والحجز والاستحقاق بسطر واحد ---------- */
.patient-card { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.2rem; align-items: stretch; }
.patient-card .verdict { margin: 0; justify-content: center; }
.pc-info { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--navy); border-radius: var(--radius); padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .3rem; justify-content: center; }
.pc-info h2 { margin: 0; font-size: 1.35rem; }
.pc-booking { margin-top: .35rem; font-size: .9rem; padding: .45rem .7rem; border-radius: var(--radius); background: #f3f5f9; border: 1px solid var(--line); }
.pc-booking.ok { background: var(--ok-bg); border-color: #bcdcc9; }
.pc-booking.warn { background: var(--warn-bg); border-color: #ecd9a6; }
@media (max-width: 760px) { .patient-card { grid-template-columns: 1fr; } }

/* =====================================================
   الطابع التركوازي (اعتماد 11/2026)
   ===================================================== */
:root {
  --navy: #1f7f8e; --navy-2: #155d69; --navy-3: #2a96a6;
  --gold: #e8834a; --gold-soft: #fdf0e8;
  --paper: #f3f7f8; --line: #dbe6e9; --line-strong: #b9cdd2;
  --radius: 12px; --petrol: #1f7f8e; --petrol-dark: #155d69; --petrol-soft: #e6f3f5;
}
/* الترويسة والقائمة */
.gov-header { background: #fff; color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 2px 10px rgba(21,93,105,.06); }
.gov-strip { background: linear-gradient(90deg, #2a96a6, #e8834a); }
.gov-brand, .gov-brand:hover { color: var(--navy-2); }
.gov-titles small { color: var(--muted); }
.gov-seal { border-color: var(--navy-3); color: var(--navy-3); }
.gov-nav { background: #fff; border-top: 1px solid var(--line); }
.gov-nav a, .nav-group summary { color: #41545a; }
.gov-nav-inner > a:not(.active):hover, .nav-group:not(.active) > summary:hover { background: #eef6f7; color: var(--navy-2); }
.gov-nav-inner > a.active, .nav-group.active > summary {
  background: var(--navy); color: #fff !important; border-bottom-color: transparent;
  box-shadow: inset 0 -3px 0 var(--gold); border-radius: 10px 10px 0 0;
}
.gov-nav-inner > a.active svg { color: #fff; }
.nav-badge { background: var(--gold); color: #fff; }
.gov-nav-inner > a.active .nav-badge { background: var(--gold); color: #fff; }
.nav-user-role { color: var(--muted); }
.gov-nav .nav-user a { color: var(--navy-2); }
.gov-nav .nav-logout { color: #c0392b; }
.nav-menu { border-top-color: var(--navy); border-radius: 0 0 12px 12px; overflow: hidden; }
.nav-toggle { border-color: var(--line-strong); }
.nav-toggle span { background: var(--navy-2); }
@media (max-width: 820px) {
  .gov-nav a, .nav-group summary { border-bottom-color: var(--line); color: #41545a; }
  .gov-nav-inner > a.active, .nav-group.active > summary { color: #fff !important; border-radius: 10px; box-shadow: none; }
  .nav-menu a { color: #41545a; border-bottom-color: var(--line); }
  .nav-menu a:hover, .nav-menu a.active { color: var(--navy); background: #eef6f7; }
}
/* العناوين والبطاقات */
h1 { color: var(--navy-2); border-bottom-color: var(--gold); }
h2 { color: var(--navy-2); }
.search-block, .filters, .panel, .panel-form, .details, .table-wrap, .dispense-form fieldset,
.today-panel, .center-card, .booking-ticket, .doc-card, .logo-setting, .doc-upload { border-radius: 14px; }
.search-block, .filters, .center-card { border-top: 1px solid var(--line); box-shadow: 0 2px 8px rgba(21,93,105,.06); }
.stat { border-radius: 14px; border-top: 0; box-shadow: 0 2px 8px rgba(21,93,105,.07); }
.stat.attention { background: #fff8f3; border: 1px solid #f6cdb3; }
.stat-value { color: var(--navy-2); }
.dispense-form legend { border-radius: 8px; }
.btn, input, select, textarea { border-radius: 10px; }
.btn-small { border-radius: 8px; }
.notice, .day-state, .verdict, .cap-bar { border-radius: 12px; }
.grid th { background: var(--navy); }
.grid tbody tr:hover { background: #eef6f7; }
.table-wrap { overflow: hidden; overflow-x: auto; }
.tag { border-radius: 6px; }
#scan-open, .btn-gold { background: var(--gold); border-color: var(--gold); }
.day-pill input:checked + span { background: var(--navy); border-color: var(--navy); }
/* التذييل */
.gov-footer { background: #fff; color: var(--muted); border-top: 1px solid var(--line); }
.gov-footer .muted { color: #8a9aa0; }
/* صفحة الدخول */
.auth-page { background: linear-gradient(135deg, #155d69, #2a96a6); }
.auth-box { border-top-color: var(--gold); border-radius: 18px; }
.auth-head { background: var(--navy); }
/* صفحة الحجز للمواطنين */
.booking-hero { background: linear-gradient(135deg, #1f7f8e, #2a96a6); color: #fff; border-radius: 18px; padding: 1.3rem 1.4rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 6px 18px rgba(21,93,105,.18); }
.booking-hero img { width: 64px; height: 64px; background: #fff; border-radius: 50%; padding: 6px; flex-shrink: 0; }
.booking-hero h1 { color: #fff; border: 0; margin: 0; padding: 0; font-size: 1.45rem; display: block; }
.booking-hero p { margin: .25rem 0 0; opacity: .92; }
.booking-tabs a { border-radius: 12px; }
.booking-tabs a.active { background: var(--navy); border-color: var(--navy); }
#booking-form .btn-big { background: var(--gold); border-color: var(--gold); width: 100%; border-radius: 14px; }
#booking-form .btn-big:hover { background: #d4703a; }
.ticket-code b { color: var(--navy); }
/* الطباعة تبقى أبيض وأسود */
@media print { .grid th { background: #f0f0f0; color: #000; } }
/* "ليس يوم صرف" معلومة هادئة مو خطأ */
.day-state.off { background: #f1f5f6; border-color: var(--line); color: #41545a; }
.day-state.off strong { color: var(--navy-2); }
.cap-bar.full .cap-note { color: var(--bad); }
/* شريط المنفذ بيوم ما بيه صرف: هادئ */
.cap-bar.off { background: #f1f5f6; border-color: var(--line); border-inline-start-color: var(--line-strong); }
.cap-bar.off .cap-note { color: #41545a; font-weight: 500; }
.cap-bar { border-radius: 12px; }
/* الرسائل العامة بلون هادئ متناسق */
.notice { background: #eef6f7; border-color: #cfe3e6; border-inline-start-color: var(--navy-3); }
.filters .rec-q { flex: 1 1 260px; }
/* قائمة الإدارة */
.nav-group summary:focus { outline: none; }
.nav-group summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 8px; }
.nav-menu { min-width: 220px; box-shadow: 0 10px 28px rgba(21,93,105,.16); }
.nav-menu a { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; }
.nav-menu a:hover { background: #eef6f7; color: var(--navy-2); }
.nav-menu a.active { background: #e6f3f5; color: var(--navy-2); font-weight: 700; box-shadow: inset 3px 0 0 var(--navy); }
.nav-menu a:nth-child(2) { border-bottom: 2px solid var(--line); }
.alert-badge { background: #c0392b !important; color: #fff !important; }
.privacy-note { font-size: .85rem; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; margin: 0 0 1rem; }
.test-toggle { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; }
/* نتيجة فحص الاستحقاق */
.elig-result { border-radius: 14px; padding: 1rem 1.2rem; margin: 1rem 0; border: 1px solid; }
.elig-result strong { font-family: var(--head); font-size: 1.1rem; display: block; margin-bottom: .3rem; }
.elig-result p { margin: 0 0 .6rem; }
.elig-result.ok { background: var(--ok-bg); border-color: #bcdcc9; } .elig-result.ok strong { color: var(--ok); }
.elig-result.bad { background: var(--bad-bg); border-color: #efc6c2; } .elig-result.bad strong { color: var(--bad); }
.elig-result.warn { background: var(--warn-bg); border-color: #ecd9a6; } .elig-result.warn strong { color: var(--warn); }
.elig-result .btn-big { background: var(--gold); border-color: var(--gold); width: 100%; border-radius: 14px; }
@media (max-width: 640px) { .booking-tabs a { font-size: .82rem; padding: .5rem .3rem; } }
.verified-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem 1rem; background: #eef6f7; border: 1px solid #cfe3e6; border-radius: 12px; padding: .8rem 1rem; align-items: end; }
.verified-box div { display: flex; flex-direction: column; }
.verified-box span { font-size: .78rem; color: var(--muted); }
.verified-box b { color: var(--navy-2); }
.elig-weak { background: #fff; border: 1px dashed #ecd9a6; border-radius: 10px; padding: .5rem .7rem; font-size: .9rem; }
/* قائمة تحقق المستندات */
.doc-check { border-radius: 14px; padding: .9rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.doc-check.has-missing { background: #fffaf2; border-color: #f0dcb5; }
.doc-check.all-done { background: var(--ok-bg); border-color: #bcdcc9; }
.doc-check-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }
.doc-check-head strong { font-family: var(--head); color: var(--navy-2); }
.doc-check.all-done .doc-check-head strong { color: var(--ok); }
.doc-check-miss { background: var(--bad); color: #fff; border-radius: 20px; padding: .15rem .8rem; font-weight: 700; font-size: .9rem; }
.doc-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.doc-chip { display: inline-flex; align-items: center; gap: .3rem; border-radius: 20px; padding: .35rem .85rem; font-size: .9rem; border: 1px solid; font-family: inherit; line-height: 1.4; min-height: 0; }
.doc-chip.ok { background: var(--ok-bg); border-color: #bcdcc9; color: var(--ok); }
.doc-chip.miss { background: #fff; border-color: #efc6c2; color: var(--bad); cursor: pointer; }
.doc-chip.miss:hover { background: var(--bad-bg); }
#doc-upload-form.flash { box-shadow: 0 0 0 3px var(--gold); transition: box-shadow .3s; }
.doc-auto-form { display: flex; align-items: center; gap: 1rem; margin: 0 0 .4rem; }
.doc-add-other { background: none; border: 1px dashed var(--line-strong); color: var(--navy-2); border-radius: 20px; padding: .35rem .9rem; cursor: pointer; font: inherit; font-size: .9rem; min-height: 0; }
.doc-add-other:hover { background: #eef6f7; }
.alert-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
/* بحث السجلات بارز */
.rec-search { flex: 1 1 100%; width: 100%; grid-column: 1 / -1; position: relative; margin-bottom: .4rem; }
.rec-search input { width: 100%; min-height: 56px; font-size: 1.12rem; padding-inline-start: 3rem; border: 2px solid var(--navy-3); border-radius: 14px; background: #fff; box-shadow: 0 2px 10px rgba(21,93,105,.08); }
.rec-search input:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(42,150,166,.18); outline: none; }
.rec-search svg { position: absolute; inset-inline-start: 1rem; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; fill: var(--navy-3); pointer-events: none; }
.nid-add { cursor: pointer; border: 1px dashed var(--line-strong); font: inherit; font-size: .8rem; }
.nid-add:hover { background: #eef6f7; color: var(--navy-2); }
.nid-form { display: flex; gap: .3rem; align-items: center; }
.nid-form input { width: 130px; min-height: 34px; padding: .2rem .5rem; font-size: .9rem; }
.elig-mini { font-size: .75rem; margin-top: .15rem; white-space: nowrap; }
.elig-mini.yes { color: var(--ok); font-weight: 700; }
.elig-mini.no { color: var(--muted); }
/* مستمسكات الحجز */
.bk-doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; }
.bk-doc { border: 1px dashed var(--line-strong); border-radius: 12px; padding: .7rem; display: flex; flex-direction: column; gap: .4rem; background: #fff; }
.bk-doc.ok { border: 1px solid #bcdcc9; background: var(--ok-bg); }
.bk-doc.bad { border: 1px solid #efc6c2; background: var(--bad-bg); }
.bk-doc.bad .bk-doc-msg { color: var(--bad); font-weight: 600; }
.bk-doc-title { font-weight: 700; color: var(--navy-2); }
.bk-doc-preview { width: 100%; max-height: 150px; object-fit: contain; border-radius: 8px; background: #f3f4f6; }
.bk-doc-btn { cursor: pointer; text-align: center; }
.reupload { margin-top: .8rem; padding: .7rem; border: 1px solid #efc6c2; background: var(--bad-bg); border-radius: 12px; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.reupload p { margin: 0; flex: 1 1 100%; }
/* صفحة تدقيق المستمسكات */
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0; }
.review-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.review-card.accepted { border-color: #bcdcc9; }
.review-card.rejected { border-color: #efc6c2; }
.review-head { display: flex; justify-content: space-between; align-items: center; }
.review-img { display: block; background: #f3f4f6; border-radius: 10px; height: 220px; overflow: hidden; }
.review-img img { width: 100%; height: 100%; object-fit: contain; }
.review-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.reject-form { display: flex; gap: .3rem; align-items: center; }
.reject-form select { min-height: 34px; padding: .2rem .4rem; font-size: .85rem; }
a.tag { text-decoration: none; }
.aud-outlets { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; align-items: center; }
.aud-outlets > span:first-child { font-size: .85rem; color: var(--muted); }
.aud-outlet { background: #fff; border: 1px solid #f0dcb5; border-radius: 20px; padding: .15rem .7rem; font-size: .85rem; }
.aud-outlet small { color: var(--muted); }
.originals-check { margin-top: .8rem; padding: .6rem .8rem; background: #fffaf2; border: 1px solid #f0dcb5; border-radius: 10px; display: flex; gap: .5rem; align-items: center; }
.review-status { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; }
.wa-btn { background: #25d366; border-color: #25d366; color: #fff; }
.wa-btn:hover { background: #1ebe5a; color: #fff; }
.bk-pending { background: var(--warn-bg); color: var(--warn); }
.reject-reason { background: #fff; border-radius: 8px; padding: .5rem .7rem; }
.read-reason { flex: 1 1 100%; font-weight: 600; }
.reupload-step { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; flex: 1 1 100%; }
.reupload-step[hidden] { display: none; }
/* مقارنة الرقم المكتوب مع الصورة */
.compare-box { background: #fff8e6; border: 2px solid #f0c36a; border-radius: 10px; padding: .5rem .7rem; display: flex; flex-direction: column; gap: .15rem; text-align: center; }
.compare-box span { font-size: .8rem; color: #7a5a12; }
.compare-box b { font-size: 1.7rem; letter-spacing: .12em; color: #1b2330; line-height: 1.2; }
.compare-box small { font-size: .8rem; color: var(--muted); }
.review-img { height: 300px; }
/* الماسح داخل الصفحة */
.bk-scan-btn { width: 100%; }
.bk-file-link { font-size: .85rem; color: var(--navy-2); text-decoration: underline; cursor: pointer; text-align: center; }
.scanner { position: fixed; inset: 0; background: #000; z-index: 9999; display: none; flex-direction: column; }
.scanner.open { display: flex; }
.scanner-view { position: relative; flex: 1; overflow: hidden; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
.scanner[data-aspect="card"] .scanner-frame { width: 88%; aspect-ratio: 1.586; }
.scanner[data-aspect="a4"] .scanner-frame { height: 72%; aspect-ratio: 0.707; max-width: 92%; }
.scanner-hint { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; color: #fff; font-weight: 700; padding: 0 1rem; text-shadow: 0 1px 4px #000; }
.scanner-bar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom, 0px)); background: #000; }
.scanner-bar .btn { color: #fff; border-color: #666; background: transparent; }
.sc-shot { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: var(--gold); cursor: pointer; }
.sc-gap { width: 70px; }
/* الخانة اللي بيها مشكلة */
.field-error { outline: 3px solid var(--bad) !important; outline-offset: 3px; border-radius: 10px; background: var(--bad-bg); }
.field-error-msg { color: var(--bad); font-weight: 700; font-size: .9rem; margin-top: .35rem; }
/* خطوات الحجز */
.wiz-progress { margin: 0 0 1rem; }
.wiz-bar { height: 8px; background: #e3ecee; border-radius: 6px; overflow: hidden; }
.wiz-bar span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, var(--navy-3), var(--gold)); transition: width .3s; }
.wiz-label { margin-top: .4rem; font-weight: 700; color: var(--navy-2); font-family: var(--head); }
.wiz-step[hidden] { display: none; }
.wiz-nav { display: flex; gap: .6rem; align-items: stretch; margin-top: 1rem; }
.wiz-nav .wiz-back { flex: 0 0 auto; min-width: 110px; }
.wiz-nav .wiz-next, .wiz-nav .wiz-submit { flex: 1; background: var(--gold); border-color: var(--gold); border-radius: 14px; }
.wiz-nav [hidden] { display: none; }
.big-input { font-size: 1.25rem; min-height: 54px; letter-spacing: .05em; }
.big-check { font-size: 1.05rem; padding: .7rem; background: #fffaf2; border: 1px solid #f0dcb5; border-radius: 12px; }
/* قوائم التاريخ */
.date-sel { display: flex; gap: .4rem; }
.date-sel select { flex: 1; min-width: 0; }
.date-sel select:nth-child(2) { flex: 1.8; }
/* أمثلة المستمسكات */
.bk-example { display: flex; gap: .6rem; justify-content: center; }
.bk-example figure { margin: 0; text-align: center; }
.bk-example figcaption { font-size: .78rem; font-weight: 700; margin-top: .2rem; }
.bk-example .good figcaption { color: var(--ok); }
.bk-example .bad figcaption { color: var(--bad); }
.bk-doc.uploaded .bk-example { display: none; }
.bk-doc.uploading .bk-doc-msg { color: var(--navy-2); font-weight: 700; }

/* نص مربعات الاختيار يبقى سطر متصل وما يتوزع أعمدة */
.check > span { flex: 1; min-width: 0; line-height: 1.7; display: block; }
.check > span strong { display: inline; }
.big-check { align-items: flex-start; }
.big-check input { margin-top: .35rem; flex-shrink: 0; }
.sc-shot:disabled { opacity: .5; }
button.bk-file-link { background: none; border: 0; padding: .2rem; font-family: inherit; display: block; margin: .3rem auto 0; }
.bk-gallery { display: block; margin-top: .2rem; }
.scanner-frame { transition: border-color .2s, box-shadow .2s; }
.scanner.ready .scanner-frame { border-color: #2ecc71; border-width: 4px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55), 0 0 18px 4px rgba(46,204,113,.7); }
.scanner.ready .scanner-hint { color: #7dffb0; }
.scanner.ready .sc-shot { background: #2ecc71; }
.sc-shot:disabled { opacity: .35; cursor: not-allowed; }

/* محرر القص */
.cropper { position: fixed; inset: 0; background: #111; z-index: 10000; display: none; flex-direction: column; }
.cropper.open { display: flex; }
.cr-hint { color: #fff; text-align: center; font-weight: 700; padding: .9rem 1rem .5rem; line-height: 1.6; }
.cr-stage { position: relative; flex: 1; overflow: hidden; }
.cr-stage canvas { position: absolute; inset: 0; }
.cr-ov { touch-action: none; }
.cr-mag { display: none; width: 130px !important; height: 130px !important; inset: auto !important; pointer-events: none; border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.6); }
.cr-bar { display: flex; gap: .6rem; padding: .9rem 1rem calc(.9rem + env(safe-area-inset-bottom, 0px)); background: #000; }
.cr-bar .btn { flex: 1; }
.cr-bar .btn-quiet { color: #fff; border-color: #666; background: transparent; }
.cr-bar .cr-ok { background: #2ecc71; border-color: #2ecc71; color: #fff; font-weight: 700; flex: 1.4; }
.rv-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rv-tools form { margin: 0; }
.review-card.accepted { border-color: #7cc49b; box-shadow: 0 0 0 2px rgba(46,160,90,.15); }
.review-card.just-ok { animation: rvOk .6s ease; }
@keyframes rvOk { from { background: #e3f6ea; } to { background: var(--surface); } }
@media print { .search-block, .booking-hero, .site-header, .gov-header, nav, .doc-chips, .booking-ticket form, .booking-ticket h3 { display: none !important; } .ticket-code b { font-size: 2rem; } }
.prev-phone { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 .3rem; } .prev-phone input[name$="phone"] { flex: 1; min-width: 160px; }
.pending-box { background: #fff4f2; border: 1px solid #efc6c2; border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; }
.pending-box summary { cursor: pointer; font-weight: 700; color: #a3322a; }
.pending-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.pending-list a { display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; color: inherit; text-decoration: none; }
.pending-list a:hover { border-color: var(--navy); }
.pending-list a span:first-child { font-weight: 700; flex: 1; }

.cancel-done h2 { color: var(--ok, #1e7b4f); margin-top: 0; }



/* جدول الحجوزات — شبكة منتظمة: كل خلية سطر رئيسي + سطر ثانوي */
.bk-table-wrap { background: #fff; border: 1px solid #e4e9ee; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.bk-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.bk-table col.w-n { width: 44px; } .bk-table col.w-who { width: 24%; } .bk-table col.w-ids { width: 15%; } .bk-table col.w-day { width: 14%; }
.bk-table col.w-birth { width: 11%; } .bk-table col.w-phone { width: 12%; } .bk-table col.w-st { width: 17%; } .bk-table col.w-act { width: 250px; }
.bk-table thead th { background: #f6f8fa; color: #5f6b76; font-size: .78rem; font-weight: 700; padding: .75rem 1rem; border-bottom: 1px solid #e4e9ee; text-align: start; white-space: nowrap; }
.bk-table tbody td { padding: .9rem 1rem; border-bottom: 1px solid #eef1f4; vertical-align: middle; text-align: start; }
.bk-table tbody tr:last-child td { border-bottom: 0; }
.bk-table tbody tr:hover { background: #f8fafb; }
.bk-table .c-n { text-align: center; padding-inline: .4rem; }
.bk-table .c-n .cm { color: #9aa5b1; font-weight: 600; font-size: .85rem; }
.bk-table .cell { display: flex; flex-direction: column; min-width: 0; }
.bk-table .cm { display: block; font-size: .95rem; font-weight: 600; line-height: 1.6rem; height: 1.6rem; color: #1f2933; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.bk-table .cs { display: block; font-size: .8rem; line-height: 1.3rem; height: 1.3rem; color: #7b8794; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-table [dir="ltr"].cm { text-align: right; }
.who { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.who-av { flex: 0 0 2.3rem; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: #e3f1f3; color: #1f7f8e; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.who .cell { flex: 1; }
a.who-name:hover { color: #1f7f8e; text-decoration: underline; }
.code { font-weight: 700; color: #52606d; letter-spacing: .06em; }
a.phone { color: #1f7f8e; }
a.phone:hover { text-decoration: underline; }
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; line-height: 1; padding: .3rem .6rem; border-radius: 999px; vertical-align: middle; }
.pill i { width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.pill-booked { background: #e6f5ef; color: #127a57; } .pill-pending { background: #fff3dc; color: #995800; } .pill-done { background: #e8effd; color: #1b55c3; }
.pill-noshow { background: #fdeceb; color: #b42318; } .pill-cancelled, .pill-rejected { background: #f1f3f6; color: #667085; }
.st-line { display: flex !important; gap: .7rem; }
.mini { font-weight: 600; text-decoration: none; } a.mini:hover { text-decoration: underline; }
.mini-accepted { color: #127a57; } .mini-pending { color: #995800; } .mini-rejected { color: #b42318; }
.st-note { display: block; font-size: .78rem; line-height: 1.3rem; color: #7b8794; margin-top: .15rem; white-space: normal; }
.st-note.bad-note { color: #b42318; }
.bk-table .c-act { text-align: end; }
.act-row { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; white-space: nowrap; }
.act-row form { display: flex; gap: .3rem; margin: 0; }
.btn-primary-sm { display: inline-flex; align-items: center; height: 2.3rem; padding: 0 1rem; border-radius: 9px; background: var(--navy, #1f7f8e); color: #fff !important; font-weight: 700; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.btn-primary-sm:hover { filter: brightness(1.08); }
.act-ghost { display: inline-flex; align-items: center; height: 2.3rem; background: transparent; border: 1px solid transparent; color: #52606d; font: inherit; font-size: .86rem; font-weight: 600; padding: 0 .7rem; border-radius: 9px; cursor: pointer; text-decoration: none; }
.act-ghost:hover { background: #f1f4f7; border-color: #e4e9ee; color: #1f2933; }
.act-danger { color: #b42318; } .act-danger:hover { background: #fdeceb; border-color: #f6c8c3; color: #912018; }
.row-cancelled .cm, .row-cancelled .cs { color: #9aa5b1; }
.row-cancelled .strike { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.row-cancelled .who-av { background: #f1f3f6; color: #9aa5b1; }
@media (max-width: 860px) {
  .bk-table, .bk-table tbody, .bk-table tr, .bk-table td { display: block; width: 100%; }
  .bk-table colgroup, .bk-table thead { display: none; }
  .bk-table tbody tr { padding: .9rem 1rem; border-bottom: 1px solid #eef1f4; }
  .bk-table tbody td { padding: .15rem 0; border: 0; }
  .bk-table .c-n { display: none; }
  .bk-table td[data-label="الولادة"], .bk-table td[data-label="الهاتف"], .bk-table td[data-label="الرقم الوطني"] { display: inline-block; width: auto; margin-inline-end: 1.4rem; vertical-align: top; }
  .bk-table .cm, .bk-table .cs { white-space: normal; height: auto; }
  .act-row { justify-content: flex-start; flex-wrap: wrap; margin-top: .5rem; }
}
.bk-table .row-cancelled td { text-decoration: none; }
.bk-table a.phone.cm { color: #1f7f8e; }
.row-cancelled a.phone.cm { color: #9aa5b1; }
.bk-table col.w-who { width: 22%; } .bk-table col.w-ids { width: 14%; } .bk-table col.w-st { width: 21%; } .bk-table col.w-act { width: 240px; }
@media (max-width: 860px) { .bk-table .cs-empty { display: none !important; } .bk-table td[data-label="الهاتف"] { display: block; } }
/* توسيط محتوى الأعمدة وعناوينها */
.bk-table thead th, .bk-table tbody td, .bk-table th.c-act, .bk-table td.c-act { text-align: center; }
.bk-table .cell { align-items: center; text-align: center; }
.bk-table [dir="ltr"].cm { text-align: center; }
.who { justify-content: center; }
.who .cell { flex: 0 1 auto; align-items: flex-start; text-align: start; }
.st-line { justify-content: center; }
.act-row { justify-content: center; }
.st-note { text-align: center; }
@media (max-width: 860px) {
  .bk-table tbody td, .bk-table .cell { text-align: start; align-items: flex-start; }
  .who, .st-line, .act-row { justify-content: flex-start; }
  .st-note { text-align: start; }
}
.bk-table col.w-act { width: 290px; } .bk-table col.w-st { width: 19%; }
/* عمود الإجراء: زر أساسي + أيقونة حذف بعرض ثابت */
.bk-table col.w-act { width: 170px; }
.bk-table col.w-who { width: 24%; } .bk-table col.w-st { width: 20%; }
.act-row { gap: .5rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 9px; border: 1px solid #e4e9ee; background: #fff; color: #7b8794; cursor: pointer; padding: 0; transition: all .15s; }
.icon-btn:hover { background: #f1f4f7; color: #1f2933; }
.icon-btn.danger:hover { background: #fdeceb; border-color: #f6c8c3; color: #b42318; }
.btn-primary-sm { min-width: 6.5rem; justify-content: center; }
.bk-table td.c-act .act-row { justify-content: flex-end; padding-inline-end: .4rem; } @media (max-width: 860px) { .bk-table td.c-act .act-row { justify-content: flex-start; } }
.mini-info { color: #3949ab; }
.st-note.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 860px) { .st-note.one-line { white-space: normal; } }
.bk-table .cs.st-note { margin-top: 0; height: 1.3rem; }
.bk-table .row-cancelled .cs.bad-note { color: #b42318; }

/* شريط أدوات الحجوزات */
.bk-toolbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: #fff; border: 1px solid #e4e9ee; border-radius: 14px; padding: .65rem .8rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.tb-day { display: flex; align-items: center; gap: .4rem; margin: 0; }
.tb-arrow { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; border: 1px solid #e4e9ee; color: #52606d; font-size: 1.4rem; line-height: 1; text-decoration: none; background: #fff; }
.tb-arrow:hover { background: #f1f4f7; color: #1f7f8e; }
.tb-date { display: flex; align-items: center; gap: .5rem; height: 2.4rem; padding: 0 .7rem; border: 1px solid #e4e9ee; border-radius: 10px; background: #f8fafb; margin: 0; flex-direction: row; }
.tb-wd { font-weight: 800; color: #1f7f8e; white-space: nowrap; }
.tb-date input[type=date] { border: 0; background: transparent; font: inherit; font-weight: 700; color: #1f2933; padding: 0; height: auto; min-height: 0; width: auto; box-shadow: none; }
.tb-date input[type=date]:focus { outline: none; }
.tb-chip { display: inline-flex; align-items: center; height: 2rem; padding: 0 .8rem; border-radius: 999px; background: #e3f1f3; color: #1f7f8e; font-weight: 700; font-size: .85rem; text-decoration: none; }
.tb-chip:hover { background: #d3e9ec; }
.tb-select { height: 2.4rem; min-height: 0; border: 1px solid #e4e9ee; border-radius: 10px; padding: 0 .7rem; background: #fff; font: inherit; width: auto; max-width: 16rem; }
.tb-search { flex: 1; min-width: 14rem; display: flex; align-items: center; gap: .5rem; height: 2.4rem; padding: 0 .75rem; border: 1px solid #e4e9ee; border-radius: 10px; background: #fff; margin: 0; color: #9aa5b1; }
.tb-search:focus-within { border-color: #1f7f8e; box-shadow: 0 0 0 3px rgba(31,127,142,.12); }
.tb-search input { flex: 1; border: 0; background: transparent; font: inherit; height: auto; min-height: 0; padding: 0; box-shadow: none; color: #1f2933; }
.tb-search input:focus { outline: none; }
.tb-clear { color: #9aa5b1; text-decoration: none; font-size: .9rem; }
.tb-clear:hover { color: #b42318; }
.tb-toggle { display: inline-flex; align-items: center; gap: .5rem; color: #52606d; font-size: .88rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tb-toggle .sw { width: 2.1rem; height: 1.2rem; border-radius: 999px; background: #d5dbe1; position: relative; transition: background .15s; }
.tb-toggle .sw::after { content: ""; position: absolute; top: .15rem; right: .15rem; width: .9rem; height: .9rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: right .15s; }
.tb-toggle.on .sw { background: #1f7f8e; }
.tb-toggle.on .sw::after { right: 1.05rem; }
@media (max-width: 760px) {
  .bk-toolbar { gap: .55rem; }
  .tb-day { width: 100%; flex-wrap: wrap; }
  .tb-date { flex: 1; justify-content: space-between; }
  .tb-select { width: 100%; max-width: none; }
  .tb-search { min-width: 100%; }
}
.tb-date { position: relative; cursor: pointer; }
.tb-dval { font-weight: 700; color: #1f2933; }
.tb-cal { color: #7b8794; }
.tb-date input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
@media (max-width: 760px) {
  .tb-day { flex-wrap: wrap; }
  .tb-date { flex: 1 1 auto; min-width: 0; }
  .tb-chip { flex: none; }
  .tb-select { order: 5; flex: 1 1 100%; }
}
.tb-search { position: relative; }
.tb-suggest { position: absolute; top: calc(100% + 6px); right: 0; left: 0; background: #fff; border: 1px solid #e4e9ee; border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.14); z-index: 50; overflow: hidden; max-height: 22rem; overflow-y: auto; }
.sg-item { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name side" "meta side"; gap: .1rem 1rem; padding: .6rem .9rem; text-decoration: none; color: #1f2933; border-bottom: 1px solid #f0f3f5; }
.sg-item:last-child { border-bottom: 0; }
.sg-item:hover, .sg-item.on { background: #f1f8f9; }
.sg-name { grid-area: name; font-weight: 700; }
.sg-meta { grid-area: meta; font-size: .8rem; color: #7b8794; }
.sg-side { grid-area: side; align-self: center; font-size: .8rem; color: #52606d; white-space: nowrap; }
.sg-empty { padding: .8rem .9rem; color: #7b8794; font-size: .9rem; }
.tb-new { display: inline-flex; align-items: center; height: 2.4rem; padding: 0 1rem; border-radius: 10px; background: var(--navy, #1f7f8e); color: #fff !important; font-weight: 700; text-decoration: none; white-space: nowrap; } .tb-new:hover { filter: brightness(1.08); }
.bk-doc .pledge { margin-top: .5rem; font-size: .88rem; }
.pledge-note { color: #b42318; font-weight: 700; font-size: .85rem; margin: .3rem 0 0; }
.bk-doc.pledged { border-color: #f0dcb5; background: #fffaf2; }
.bk-doc.pledged .bk-scan-btn, .bk-doc.pledged .bk-gallery, .bk-doc.pledged .bk-doc-msg { opacity: .45; }
.fixed-val { display: flex; align-items: center; min-height: 2.75rem; padding: 0 .9rem; border: 1px dashed #cfd8df; border-radius: 10px; background: #f6f8fa; font-weight: 700; color: #1f2933; margin-top: .35rem; } .lbl { font-weight: 600; font-size: .92rem; }

/* الطباعة تحافظ على الخلفيات الرمادية بالاستمارة */
.a4, .a4 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.legal-text { line-height: 1.95; margin: 0 0 .6rem; color: #1f2933; text-align: justify; } .legal-warn { margin-top: .9rem; line-height: 1.8; }
/* خطوات الحجز: العنوان يظهر مرة وحدة (بشريط التقدم) */
.wiz-step > legend { display: none; }
/* خطوة تخطيط السمع */
.aud-q { display: block; font-weight: 800; font-size: 1.1rem; color: #1f2933; }
.aud-q .date-sel { margin-top: .7rem; }
.aud-rule { margin: 1rem 0 .35rem; color: #52606d; font-size: .9rem; line-height: 1.8; }
.aud-rule strong { color: #1f2933; }
.aud-rule ul { margin: .3rem 0 0; padding-inline-start: 1.2rem; }
.aud-rule li { margin: .15rem 0; }
.aud-outlets { margin: .5rem 0 .2rem; padding: 0; list-style: none; display: flex; flex-direction: column; align-items: stretch; gap: .35rem; width: 100%; }
.aud-outlets li { margin: 0; padding: .45rem .75rem; background: #f1f7f8; border: 1px solid #d6e7ea; border-radius: 9px; color: #1f2933; font-weight: 600; text-align: right; }
.aud-none { margin: .9rem 0 0; padding: .85rem 1rem; background: #fff4e0; border: 2px solid #e8a317; border-radius: 10px; color: #5c3600; font-size: 1.02rem; font-weight: 600; line-height: 1.9; }
.reason-other { flex: 1 1 100%; min-height: 2.5rem; border: 1px solid #f0c4bf; border-radius: 9px; padding: 0 .7rem; font: inherit; }

.print-only { display: none; }
@media print { .print-only { display: block !important; margin: 1rem 0; font-size: .85rem; line-height: 1.7; border-top: 1px solid #000; padding-top: .6rem; } .terms-print ol { margin: .3rem 1.2rem; padding: 0; } }
@media print { .alert-strip, .test-toggle { display: none !important; } }

/* ===== صفحة الحجوزات: واجهة مصقولة ===== */
.cc-hours { display:flex; flex-wrap:wrap; align-items:center; gap:.6rem 1rem; padding:.5rem .7rem; background: var(--paper); border-radius: var(--radius); }
.cc-hours label { display:flex; align-items:center; gap:.4rem; margin:0; }
.bk-head { display:flex; align-items:baseline; gap:.9rem; flex-wrap:wrap; }
.bk-head h1 { margin-bottom:.4rem; }
.bk-sub { color: var(--muted); font-size:.95rem; font-weight:600; }
.bk-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:.8rem; margin:.2rem 0 1.1rem; }
.bk-stats.off { opacity:.85; }
.bk-offday { grid-column:1/-1; background:#f1f5f6; border:1px dashed var(--line-strong); color:#41545a; border-radius:10px; padding:.45rem .9rem; font-weight:600; font-size:.9rem; }
.bk-stat { position:relative; background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:.8rem 1rem .85rem; box-shadow:0 1px 2px rgba(20,40,75,.04); overflow:hidden; }
.bk-stat::before { content:""; position:absolute; inset-block-start:0; inset-inline:0; height:4px; background:var(--accent,var(--line-strong)); }
.bk-stat .bs-label { display:block; color:var(--muted); font-size:.85rem; font-weight:600; }
.bk-stat .bs-num { display:block; font-size:1.9rem; line-height:1.25; margin-top:.15rem; color:var(--ink); }
.bk-stat .bs-num small { font-size:1rem; color:var(--muted); font-weight:500; }
.bk-stat.s-pending { --accent:#e8a23a; }
.bk-stat.s-booked { --accent:#1f7f8e; }
.bk-stat.s-done { --accent:#2f9460; }
.bk-stat.s-cap { --accent:#14284b; }
.bk-stat .bs-bar { display:block; height:6px; background:#e7ecef; border-radius:99px; margin-top:.35rem; overflow:hidden; }
.bk-stat .bs-bar i { display:block; height:100%; background:linear-gradient(90deg,#1f7f8e,#2a96a6); border-radius:99px; }
.bk-empty { display:flex; flex-direction:column; align-items:center; gap:.35rem; text-align:center; background:var(--surface); border:1px dashed var(--line-strong); border-radius:16px; padding:2.4rem 1rem; color:var(--navy); }
.bk-empty strong { font-size:1.1rem; color:var(--ink); }
.bk-table-wrap { border-radius:14px; box-shadow:0 1px 3px rgba(20,40,75,.06); }
.bk-table tbody tr { transition:background .15s; }
.bk-table tbody tr:hover { background:#f6fbfc; }
.bk-toolbar { border-radius:14px; box-shadow:0 1px 3px rgba(20,40,75,.05); }
@media (max-width:760px) { .bk-stats { grid-template-columns:repeat(2,1fr); } .bk-stat .bs-num { font-size:1.6rem; } }

.cal-d.has { background:#ffe3c2; color:#8a4300; box-shadow:inset 0 0 0 1px #f0b36d; }
.cal-d.has:hover, .cal-d.has.sel { background:var(--petrol); color:#fff; }

/* لوحة اليوم: صف التنبيهات وقائمة الرقم التسلسلي */
.att-label { display:flex; align-items:center; gap:.45rem; font-family:var(--head); font-weight:700; color:#9e2a22; margin:.2rem 0 .55rem; }
.att-label i { width:9px; height:9px; border-radius:50%; background:var(--gold); display:inline-block; }
.att-grid { grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); }
.main-grid { grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); }
.stat.attention { border-inline-start:5px solid var(--gold); }
.stat.att-red { border-color:#f0b8b2; border-inline-start:5px solid #b3372d; background:#fff4f2; cursor:pointer; }
.stat.att-red .stat-value { color:#b3372d; }
.stat.att-yellow { border-inline-start:5px solid #c9a227; background:#fffbea; border-color:#efdca0; }
.stat.att-red .chev { display:inline-block; transition:transform .2s; margin-inline-start:.2rem; }
.stat.att-red.open .chev { transform:rotate(180deg); }
.pend-panel { border-top:4px solid #b3372d; margin-bottom:1.2rem; }
.pend-panel h2 { display:flex; justify-content:space-between; align-items:center; }
.pend-panel .cnt { background:#b3372d; color:#fff; border-radius:20px; padding:0 .7rem; font-size:.9rem; }
.pend-panel[hidden] { display:none; }
/* بطاقات الحجوزات أكبر وأوضح */
.bk-stats { gap:1rem; }
.bk-stat { padding:1.1rem 1.3rem 1.2rem; border-radius:16px; box-shadow:0 2px 8px rgba(21,93,105,.08); }
.bk-stat::before { height:5px; }
.bk-stat .bs-label { font-size:1.1rem; font-weight:700; color:var(--ink); }
.bk-stat .bs-num { font-size:3rem; font-weight:800; line-height:1.15; margin-top:.3rem; }
.bk-stat .bs-num small { font-size:1.35rem; }
.bk-stat .bs-bar { height:9px; margin-top:.5rem; }
@media (max-width:760px) { .bk-stat .bs-num { font-size:2.3rem; } .bk-stat .bs-label { font-size:1rem; } }
.stat-label { font-size:1.2rem; font-weight:700; }
.stat-value { font-size:3rem; }
.stat-foot { font-size:1rem; }

.main-grid { grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); align-items:stretch; }
.wait-card { gap:.4rem; }
.wait-card .wait-n { background:var(--petrol); color:#fff; border-radius:20px; padding:0 .6rem; font-size:.95rem; margin-inline-start:.3rem; }
.wait-list { list-style:none; margin:0; padding:0; max-height:230px; overflow:auto; }
.wait-list li { display:flex; justify-content:space-between; align-items:center; gap:.6rem; padding:.4rem 0; border-top:1px dashed var(--line); }
.wait-list li:first-child { border-top:0; }
.no-tasks { text-align:center; padding:1.2rem 0; font-size:1.05rem; }

.nav-center { max-width:200px; min-height:34px; padding:.15rem .5rem; font-size:.9rem; border:1px solid var(--line-strong); background:#f3f9fa; color:var(--navy-2); font-weight:700; }

/* ترويسة: حبة المنفذ للمدير */
.nav-center-wrap { display:inline-flex; align-items:center; gap:.4rem; background:var(--petrol-soft,#e6f3f5); border:1px solid #b9d9de; color:var(--petrol-dark,#155d69); border-radius:999px; padding:.15rem .8rem .15rem .4rem; margin:0; }
.nav-center-wrap .nc-lbl { font-size:.8rem; font-weight:700; opacity:.8; }
.nav-center-wrap .nav-center { border:0; background:transparent; min-height:30px; max-width:260px; min-width:150px; padding:0 .2rem; font-weight:700; color:inherit; text-overflow:ellipsis; cursor:pointer; box-shadow:none; }
.nav-center-wrap:focus-within { box-shadow:0 0 0 3px rgba(31,127,142,.2); }
.nav-user-role { white-space:nowrap; }
/* حالات فارغة موحّدة */
.empty-card { display:flex; flex-direction:column; align-items:center; gap:.35rem; text-align:center; background:var(--surface); border:1px dashed var(--line-strong); border-radius:16px; padding:2rem 1rem; margin:1rem 0; color:var(--ink); }
.empty-card .ec-ic { font-size:2.2rem; line-height:1; }
.empty-card .ec-ic.ok { width:54px; height:54px; border-radius:50%; background:#e7f3ec; color:#1e6b43; display:flex; align-items:center; justify-content:center; font-size:1.7rem; font-weight:700; }
.empty-card strong { font-size:1.15rem; }
/* جدول كل المنافذ */
.grid tr.cur-row td { background:#e6f3f5; font-weight:700; }
.pill-on, .pill-off { display:inline-block; border-radius:999px; padding:.05rem .7rem; font-size:.85rem; font-weight:700; }
.pill-on { background:#e7f3ec; color:#1e6b43; }
.pill-off { background:#eef1f3; color:#6b7782; }
/* عنوان الصفحة وقائمة بانتظار الحضور في البحث */
.page-title { margin-bottom:.9rem; }
.wait-block { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:1rem 1.2rem; margin-top:1rem; box-shadow:0 2px 8px rgba(21,93,105,.06); }
.wait-block h2 { font-size:1.1rem; margin:0 0 .5rem; display:flex; align-items:center; gap:.5rem; }
.wait-block .wb-n { background:var(--petrol); color:#fff; border-radius:999px; padding:0 .7rem; font-size:.9rem; }
.wait-block ul { list-style:none; margin:0; padding:0; }
.wait-block li { display:flex; justify-content:space-between; align-items:center; gap:.8rem; padding:.55rem 0; border-top:1px dashed var(--line); }
.wait-block li:first-child { border-top:0; }
/* الحجوزات: بطاقة يوم غير صرف وزر الاستثناء */
.bk-offcard { display:flex; align-items:center; gap:.9rem; flex-wrap:wrap; background:#fff8f3; border:1px solid #f6cdb3; border-radius:14px; padding:.8rem 1.1rem; margin:.2rem 0 1rem; }
.bk-offcard .oc-ic { font-size:1.8rem; }
.bk-offcard .oc-t { display:flex; flex-direction:column; flex:1; min-width:200px; }
.bk-offcard .oc-t span { color:var(--muted); font-size:.9rem; }
.tb-toggle.exc-btn { background:var(--petrol,#1f7f8e); color:#fff !important; border-color:var(--petrol,#1f7f8e); padding:.45rem 1rem; border-radius:10px; }
.tb-toggle.exc-btn:hover { background:var(--petrol-dark,#155d69); }
/* إصلاح حبة المنفذ: صف واحد (تجاوز قاعدة label العامة) */
.nav-user .nav-center-wrap { display:inline-flex !important; flex-direction:row !important; align-items:center; gap:.35rem; flex-wrap:nowrap; flex-shrink:0; font-size:.9rem; }
.nav-user .nav-center-wrap svg { flex-shrink:0; }
.nav-user .nav-center-wrap .nc-lbl { display:none; }
.nav-user .nav-center-wrap .nav-center { width:auto; min-width:140px; max-width:240px; height:32px; }
.nav-user .nav-user-role { flex-shrink:0; max-width:none; overflow:visible; }
.nav-user .nav-user-name { flex-shrink:0; }

.nav-logout-form { display: inline; margin: 0; }
button.nav-logout { background: none; border: 0; padding: .4rem 0; font: inherit; cursor: pointer; font-family: var(--head); font-size: .92rem; color: inherit; }
