/* ===================== الثوابت المشتركة في كل الشاشات (kit.js / datebox.js / keylang.js / tblfilter.js) ===================== */

/* ---------- عناوين كل الجداول: بنفسجي غامق ---------- */
.tbl thead th, .tbl th { background: #3F1D8C !important; color: #fff !important; border-bottom: 0 !important; font-weight: 800; }
.tbl thead th .faint, .tbl thead th i { color: #E9E3FF !important; }
.tbl thead th.n { text-align: end; }
:root[data-theme="dark"] .tbl thead th, :root[data-theme="dark"] .tbl th { background: #2B1466 !important; color: #F3EFFF !important; }
.lines-tbl thead th { background: #3F1D8C !important; color: #fff !important; }

/* ---------- شريط أزرار التقارير: رجوع · طباعة · PDF · Excel ---------- */
.rbar { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn.rb-back { background: #F97316 !important; border-color: #EA580C !important; color: #fff !important; font-weight: 800; }
.btn.rb-back i { color: #fff !important; }
.btn.rb-back:hover { background: #EA580C !important; }
.btn.rb-print { background: #EEF2FF; border-color: #C7D2FE; color: #3730A3; }
.btn.rb-pdf { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; font-weight: 800; }
.btn.rb-xls { background: #F0FDF4; border-color: #BBF7D0; color: #15803D; font-weight: 800; }
.btn.rb-pdf:hover { background: #FEE2E2; } .btn.rb-xls:hover { background: #DCFCE7; } .btn.rb-print:hover { background: #E0E7FF; }
.fi3d { display: inline-block; vertical-align: middle; flex: none; }
.btn .fi3d { margin-inline-end: 2px; }
:root[data-theme="dark"] .btn.rb-print { background: #1E1B4B; color: #C7D2FE; border-color: #3730A3; }
:root[data-theme="dark"] .btn.rb-pdf { background: #3B1414; color: #FCA5A5; border-color: #7F1D1D; }
:root[data-theme="dark"] .btn.rb-xls { background: #0F2E1C; color: #86EFAC; border-color: #166534; }
@media print { .rbar, .zoom-ctl { display: none !important; } }

/* ---------- تمييز حروف البحث (زي برنامج العيادات) ---------- */
mark.hit, .acc-dd mark { background: #FDE68A; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] mark.hit, :root[data-theme="dark"] .acc-dd mark { background: rgba(250, 204, 21, .35); }

/* ---------- البحث السريع عن الحساب ---------- */
.acc-dd { position: fixed; z-index: 10040; max-height: 340px; overflow-y: auto; background: var(--surface, #fff); border: 1px solid var(--line, #E5E2F0);
  border-radius: 12px; box-shadow: 0 14px 40px rgba(20, 16, 60, .2); padding: 4px; }
.acc-dd[hidden] { display: none; }
.acc-dd .acc-r { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; width: 100%; text-align: start; border: 0; background: transparent;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text, #111); }
.acc-dd .acc-r .num { font-variant-numeric: tabular-nums; color: var(--text-2, #555); direction: ltr; text-align: right; }
.acc-dd .acc-r .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-dd .acc-r.on, .acc-dd .acc-r:hover { background: var(--violet-50, #F3F0FF); box-shadow: inset 3px 0 0 var(--violet, #845EFF); }
.acc-dd .acc-f { padding: 6px 10px; font-size: 11.5px; color: var(--text-3, #888); border-top: 1px solid var(--line-soft, #eee); }

/* ---------- تكبير / تصغير الشاشة ---------- */
.zoom-ctl { display: inline-flex; gap: 2px; align-items: center; }
.zoom-ctl .btn { height: 34px; min-width: 34px; padding: 0 8px; }
.zoom-ctl .zoom-v { min-width: 58px; font-variant-numeric: tabular-nums; font-weight: 800; }

/* ---------- خانة الفلتر اللي عليها قيمة: لونها يتغيّر (زي العيادات) ---------- */
.filters .input.flt-val, .filters .select.flt-val, .filters .dt-in.flt-val { background: #FFF7ED !important; border-color: #FB923C !important; color: #9A3412; font-weight: 700; }
.filters .field.flt-val > label { color: #C2410C; font-weight: 800; }
:root[data-theme="dark"] .filters .input.flt-val, :root[data-theme="dark"] .filters .select.flt-val { background: #2A1A0E !important; color: #FDBA74; }

/* ---------- أعلى التقرير ثابت والحركة داخل الجدول ---------- */
.table-wrap.fit { overflow: auto; overscroll-behavior: contain; }
.table-wrap.fit .tbl thead th { position: sticky; top: 0; z-index: 3; }
.table-wrap.fit .tbl tfoot td { position: sticky; bottom: 0; z-index: 3; }

/* ---------- فلتر الأعمدة (tblfilter.js) ---------- */
.tbl th.flt { cursor: pointer; user-select: none; }
.tbl th.flt:hover { filter: brightness(1.15); }
.tbl th.flt-on { background: #EA580C !important; color: #fff !important; }
.tbl th .cf-mark { font-size: 13px; }
.cf-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 12px; border-radius: 10px; background: #FFF7ED; border: 1px solid #FED7AA; color: #9A3412; font-size: 13px; }
.cf-bar > i { color: #EA580C; }
.cf-bar .btn { margin-inline-start: auto; height: 28px; color: #9A3412; }
.cf-bar[hidden] { display: none; }
:root[data-theme="dark"] .cf-bar { background: #2A1A0E; border-color: #7C4A1C; color: #FDBA74; }
.col-flt { position: fixed; z-index: 10030; width: 260px; background: var(--surface, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(20, 16, 60, .18); padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.col-flt .cf-sort, .col-flt .cf-all, .col-flt .cf-btns { display: flex; gap: 6px; }
.col-flt .cf-sort button, .col-flt .cf-all button { flex: 1; border: 1px solid var(--line, #e5e7eb); background: var(--surface-2, #f8fafc); border-radius: 8px; padding: 5px; cursor: pointer; font: inherit; font-size: 12.5px; color: inherit; }
.col-flt .cf-list { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; padding: 6px; }
.col-flt .cf-list label { display: flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }

/* ---------- زر «ع / EN» داخل الخانة ---------- */
.kb-float { position: absolute; z-index: 9999; height: 22px; min-width: 28px; padding: 0 6px; border: 1px solid #D9D2FB; border-radius: 7px;
  background: var(--violet-50, #F3F0FF); color: var(--violet-d, #5B21B6); font-weight: 900; font-size: 12px; line-height: 20px; cursor: pointer; font-family: inherit;
  box-shadow: 0 2px 6px rgba(42, 31, 107, .12); opacity: .92; }
.kb-float.en { font-size: 11px; letter-spacing: .4px; }
.kb-float:hover { opacity: 1; border-color: var(--violet, #845EFF); }
.kb-float[hidden] { display: none; }

/* ---------- التقويم الخاص بالبرنامج (ميلادي / هجري) ---------- */
.dt-wrap { position: relative; display: block; }
.dt-wrap.auto { display: inline-block; width: 160px; }
.dt-wrap .dt-in { width: 100%; padding-left: 38px; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
[dir="rtl"] .dt-wrap .dt-in { text-align: right; }
.dt-wrap .dt-in.bad { border-color: var(--bad, #DC2626); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad, #DC2626) 15%, transparent); }
.dt-wrap .dt-cal { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--violet, #845EFF); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
.dt-wrap .dt-cal:hover, .dt-wrap.dt-open .dt-cal { background: var(--violet-50, #F3F0FF); }
.dt-wrap .dt-cal:disabled { color: var(--text-3, #999); cursor: default; background: transparent; }
.dt-wrap .dt-native { position: fixed; opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0; min-height: 0; width: 1px; height: 1px; }
.dt-wrap .dt-h { display: none; position: absolute; left: 36px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 900; color: #0F766E;
  background: #CCFBF1; border-radius: 5px; padding: 0 5px; line-height: 18px; pointer-events: none; }
.dt-wrap.dt-hijri .dt-h { display: block; }
.dt-wrap.dt-hijri .dt-in { padding-left: 64px; }
.dp-pop { position: fixed; z-index: 10050; width: 300px; max-width: calc(100vw - 16px); background: var(--surface, #fff); border: 1px solid var(--line, #E5E2F0); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(20, 16, 60, .18); padding: 10px; font-size: 14px; }
.dp-cal { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; padding: 3px; background: var(--surface-2, #F6F5FB); border-radius: 10px; }
.dp-cal button { border: 0; background: transparent; border-radius: 8px; padding: 5px; font: inherit; font-weight: 800; font-size: 13px; color: var(--text-2, #555); cursor: pointer; }
.dp-cal button.on { background: var(--violet, #845EFF); color: #fff; }
.dp-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-h select { flex: 1; min-width: 0; height: 34px; border: 1px solid var(--line, #E5E2F0); border-radius: 9px; background: var(--surface, #fff); color: var(--text, #111); font: inherit; font-weight: 700; padding: 0 6px; cursor: pointer; }
.dp-h .dp-y { flex: 0 0 82px; }
.dp-nav { flex: 0 0 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2, #555); cursor: pointer; font-size: 18px; display: grid; place-items: center; }
.dp-nav:hover { background: var(--violet-50, #F3F0FF); color: var(--violet, #845EFF); }
.dp-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-g em { font-style: normal; text-align: center; font-size: 11.5px; color: var(--text-3, #888); font-weight: 700; padding: 2px 0 4px; }
.dp-d { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--text, #111); font: inherit; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.dp-d.dp-dh { height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.dp-d.dp-dh small { font-size: 9.5px; font-weight: 600; color: var(--text-3, #888); }
.dp-d.dp-dh.on small { color: #EDE9FE; }
.dp-d:hover:not(:disabled) { background: var(--violet-50, #F3F0FF); }
.dp-d:focus-visible { outline: 2px solid var(--violet, #845EFF); outline-offset: -2px; }
.dp-d.today { box-shadow: inset 0 0 0 1.5px var(--violet, #845EFF); }
.dp-d.on { background: var(--violet, #845EFF); color: #fff; }
.dp-d:disabled { cursor: not-allowed; opacity: .45; }
.dp-f { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line, #E5E2F0); }
.dp-f .grow { flex: 1; }
.dp-f button { border: 1px solid var(--line, #E5E2F0); background: var(--surface, #fff); color: var(--text, #111); border-radius: 8px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.dp-f button:hover:not(:disabled) { background: var(--violet-50, #F3F0FF); color: var(--violet, #845EFF); }
.dp-leg2 { font-size: 11.5px; color: #0F766E; font-weight: 700; }
:root[data-theme="dark"] .dp-pop { box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }

/* ---------- تعميم بنود القائمة (js/menupub.js — منقول من برنامج الفنادق) ---------- */
.nav-item.mp-nav i { margin-inline-end: 4px; }
.mp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 16px; position: sticky; top: 6px; z-index: 5; }
.mp-q { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line, #E3DEF5); background: var(--surface, #fff); }
.mp-q i { color: var(--violet, #845EFF); font-size: 18px; }
.mp-q .input { border: 0; background: transparent; height: 36px; padding: 0; box-shadow: none; }
.mp-show button { height: 34px; }
.mp-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.mp-bar.mp-who { position: static; }
.mp-wl { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--text-2, #4A4370); }
.mp-wl i { color: var(--violet, #845EFF); font-size: 18px; }
#mpWho { flex: 0 1 320px; min-width: 200px; height: 40px; font-weight: 700; }
.mp-wn { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted, #6E6893); }
.mp-wn .ti-circle-check { color: #3F7A00; }
.mp-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.mp-stats span { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--surface-2, #F6F4FD); color: var(--text-2, #4A4370); }
.mp-stats span.ok { background: #F3FBDF; color: #3F5A00; }
.mp-stats span.off { background: #FEF2F2; color: #B42318; }
.mp-stats b { font-family: var(--display, 'Alexandria', sans-serif); font-size: 14px; }
.mp-save { height: 40px; border-radius: 12px; font-weight: 800; padding: 0 18px; margin-inline-start: auto; }
.mp-save.due { box-shadow: 0 0 0 3px rgba(174, 237, 22, .6); }
.mp-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 4px 10px; font-size: 12.5px; color: var(--text-3, #6B6489); }
.mp-note i { color: var(--violet, #845EFF); }
.mp-grid { columns: 3 330px; column-gap: 10px; }
.mp-sec { break-inside: avoid; margin: 0 0 10px; padding: 0; border-radius: 16px; overflow: hidden; display: block; }
.mp-sh { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer;
  background: linear-gradient(115deg, #1A1248, #2E2378 60%, color-mix(in srgb, var(--sc) 55%, #4B36B8)); color: #fff; box-shadow: inset 0 -3px 0 #AEED16; }
.mp-sh input { width: 18px; height: 18px; accent-color: #AEED16; }
.mp-si { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .12); font-size: 18px; color: #AEED16; }
.mp-st { flex: 1; min-width: 0; }
.mp-st b { display: block; font-family: var(--display, 'Alexandria', sans-serif); font-size: 14.5px; font-weight: 800; }
.mp-st small { display: block; font-size: 10.5px; color: #C9BCFF; letter-spacing: .06em; text-transform: uppercase; }
.mp-sn { font-size: 12px; color: #C9BCFF; }
.mp-sn b { color: #fff; font-size: 15px; font-family: var(--display, 'Alexandria', sans-serif); }
.mp-list { padding: 6px 8px 8px; display: grid; gap: 2px; }
.mp-grp { margin: 4px 0 2px; padding-inline-start: 8px; border-inline-start: 2px solid color-mix(in srgb, var(--sc) 35%, var(--line, #E3DEF5)); }
.mp-gh { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--violet-ink, #231A62); }
.mp-gh b { flex: 1; font-weight: 800; }
.mp-gh i { color: var(--sc); }
.mp-gh .num { font-size: 11.5px; color: var(--text-3, #6B6489); }
.mp-it { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 9px; cursor: pointer; transition: background-color .12s ease; }
.mp-it:hover { background: var(--violet-50, #F3EFFF); }
.mp-it input, .mp-gh input { flex: none; width: 16px; height: 16px; accent-color: var(--violet, #845EFF); }
.mp-t { flex: 1; min-width: 0; }
.mp-t b { display: block; font-size: 13px; font-weight: 700; line-height: 1.35; }
.mp-t small { display: block; font-size: 10.5px; color: var(--text-3, #6B6489); direction: ltr; text-align: end; }
.mp-it:not(.on) .mp-t b { color: var(--text-3, #8A84A8); text-decoration: line-through; text-decoration-color: color-mix(in srgb, #E5484D 50%, transparent); }
.mp-b { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; }
.mp-b.ok { background: #F3FBDF; color: #3F5A00; }
.mp-b.todo { background: #FFF4E5; color: #9A4D00; }
:root[data-theme="dark"] .mp-b.ok { background: rgba(174, 237, 22, .14); color: #C9F25A; }
:root[data-theme="dark"] .mp-b.todo { background: rgba(240, 138, 36, .16); color: #FFC285; }
:root[data-theme="dark"] .mp-stats span.ok { background: rgba(174, 237, 22, .14); color: #C9F25A; }
:root[data-theme="dark"] .mp-stats span.off { background: rgba(229, 72, 77, .16); color: #FFB4B4; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2, #F6F4FD); }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 0 12px; font: inherit; font-weight: 700; font-size: 13px; color: var(--text-2, #4A4370); cursor: pointer; }
.seg button.on { background: var(--night, #0A0526); color: #fff; }
