/* أي عنصر عليه hidden يختفي فعلاً (حتى لو زرار .btn) */
[hidden] { display: none !important; }
/* ===== Al-Mohab Clinics: additions on top of the accounting look (app.css + nest.css) ===== */

/* ---------- login + connection setup ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-side { background: var(--night); color: #fff; position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; inset-inline-start: -160px; top: -200px; background: radial-gradient(circle, rgba(132, 94, 255, .55), transparent 65%); }
.auth-side::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; inset-inline-end: -120px; bottom: -160px; background: radial-gradient(circle, rgba(186, 42, 186, .4), transparent 65%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand img { height: 58px; }
.auth-brand .name { font-family: var(--display); font-weight: 900; font-size: 34px; line-height: 1; }
.auth-brand .name b { color: var(--lime); }
.auth-brand small { display: block; font-family: var(--font); font-size: 11px; letter-spacing: .16em; color: #A9A3C6; margin-top: 8px; font-weight: 600; }
.auth-hero h1 { font-family: var(--display); font-weight: 900; font-size: 44px; line-height: 1.25; margin: 0 0 12px; }
.auth-hero h1 b { color: var(--lime); }
.auth-hero p { color: #B9B3D6; font-size: 16px; max-width: 460px; margin: 0; }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 520px; }
.auth-feats div { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
.auth-feats i { color: var(--lime); font-size: 20px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: min(460px, 100%); }
.auth-card h2 { font-family: var(--display); font-weight: 900; font-size: 30px; margin: 0 0 4px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .input, .auth-card .select { height: 48px; font-size: 16px; padding: 0 14px; }
.auth-card .btn.primary { width: 100%; height: 50px; font-size: 16px; margin-top: 6px; }
.err-box { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.err-box:empty { display: none; }
.db-pick { display: grid; gap: 8px; }
.db-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); text-align: start; width: 100%; }
.db-opt:hover { border-color: var(--violet-100); background: var(--surface-2); }
.db-opt.on { border-color: var(--violet); background: var(--violet-50); }
.db-opt .ic { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--violet-50); color: var(--violet); font-size: 21px; flex: none; }
.db-opt.on .ic { background: var(--violet); color: #fff; }
.db-opt .t { font-weight: 800; font-size: 15px; }
.db-opt .s { font-size: 12.5px; color: var(--text-3); direction: ltr; text-align: start; unicode-bidi: plaintext; }
.db-opt .ro { margin-inline-start: auto; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; font-size: 13.5px; flex-wrap: wrap; }
.auth-links a, .link { color: var(--violet-d); font-weight: 700; cursor: pointer; background: none; border: 0; padding: 0; }
.pw-wrap { position: relative; }
.pw-wrap .icon-btn { position: absolute; inset-inline-end: 6px; top: 6px; }

.setup-wrap { max-width: 1040px; margin: 0 auto; padding: 32px 20px 60px; }
.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.prof-card { padding: 16px 18px; border-top: 3px solid var(--violet); }
.prof-card .hd { display: flex; align-items: center; gap: 10px; }
.prof-card .hd strong { font-family: var(--display); font-size: 18px; font-weight: 800; }
.prof-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; font-size: 13.5px; }
.prof-card dt { color: var(--text-3); font-weight: 600; }
.prof-card dd { margin: 0; direction: ltr; text-align: start; unicode-bidi: plaintext; font-weight: 600; overflow-wrap: anywhere; }
.prof-card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.test-res { margin-top: 12px; font-size: 13.5px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--violet); color: #fff; }

/* ---------- sidebar database pill ---------- */
.sidebar .dbpill { display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: #fff; cursor: pointer; text-align: start; }
.sidebar .dbpill i { color: var(--lime); }
.sidebar .dbpill .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.sidebar .dbpill .tag { margin-inline-start: auto; background: var(--lime); color: var(--night); font-weight: 800; font-size: 11px; padding: 1px 8px; border-radius: 6px; direction: ltr; }
.sidebar .dbpill .tag.ro { background: #F5B14C; }
.nav-item .soon { background: rgba(255, 255, 255, .08); padding: 0 6px; border-radius: 6px; color: #A9A3C6; }

/* ---------- lists ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.toolbar .search-in { position: relative; flex: 1 1 280px; max-width: 460px; }
.toolbar .search-in i { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--text-3); }
.toolbar .search-in .input { padding-inline-start: 38px; }
.toolbar .grow { flex: 1; }
.toolbar .field { min-width: 150px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.pager .grow { flex: 1; }
.tbl td.strong { font-weight: 700; color: var(--text); }
.tbl tr.clickable:hover td { background: var(--violet-50); }
.tbl td .sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty i { font-size: 34px; color: var(--violet-100); display: block; margin-bottom: 6px; }
.loading { padding: 40px 20px; text-align: center; color: var(--text-3); }
.spin { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--violet-100); border-top-color: var(--violet); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ltr { direction: ltr; unicode-bidi: plaintext; }

/* ---------- home ---------- */
.kpis .kpi .val small { margin-inline-start: 4px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding: 18px 18px 6px; }
.bars .b { flex: 1; min-width: 4px; background: var(--violet-100); border-radius: 6px 6px 2px 2px; position: relative; cursor: default; transition: background .12s; }
.bars .b:hover, .bars .b.today { background: var(--violet); }
.bars .b .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.bars .b:hover .tip { display: block; }
.bars-x { display: flex; justify-content: space-between; padding: 0 18px 14px; font-size: 11.5px; color: var(--text-3); }
.dr-row { display: flex; align-items: center; gap: 10px; padding: 9px 18px; }
.dr-row .av { width: 34px; height: 34px; border-radius: 50%; background: var(--violet-50); color: var(--violet-d); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.dr-row .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-row .meter { height: 6px; border-radius: 6px; background: var(--line-soft); margin-top: 4px; overflow: hidden; }
.dr-row .meter span { display: block; height: 100%; background: var(--lime); }
.home-grid + .home-grid { margin-top: 16px; }

/* ---------- appointments ---------- */
.day-nav { display: flex; align-items: center; gap: 6px; }
.day-nav .day { font-family: var(--display); font-weight: 800; font-size: 17px; min-width: 210px; text-align: center; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.board .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.board .col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--violet-50); font-weight: 800; }
.board .col-h .n { margin-inline-start: auto; background: var(--violet); color: #fff; border-radius: 999px; padding: 0 9px; font-size: 12px; }
.board .col-b { padding: 10px; display: grid; gap: 8px; }
.appt { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--st, var(--violet)); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.appt:hover { box-shadow: var(--shadow-pop); }
.appt .tm { font-family: var(--display); font-weight: 800; font-size: 16px; direction: ltr; display: inline-block; }
.appt .who { font-weight: 700; margin-top: 2px; }
.appt .meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.appt.st-1 { --st: #7DB30A; } .appt.st-2 { --st: #B42318; opacity: .6; } .appt.st-3 { --st: #F08A24; }
.st-badge { font-size: 11.5px; font-weight: 800; padding: 1px 8px; border-radius: 6px; }
.st-badge.s0 { background: var(--violet-50); color: var(--violet-d); }
.st-badge.s1 { background: var(--lime-50); color: var(--lime-ink); }
.st-badge.s2 { background: var(--bad-bg); color: var(--bad); }
.st-badge.s3 { background: var(--peach); color: #C2620F; }
.st-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- patient file ---------- */
.pfile-hero { display: flex; gap: 16px; align-items: center; padding: 18px 20px; flex-wrap: wrap; }
.pfile-hero .av { width: 64px; height: 64px; border-radius: 18px; background: var(--night); color: var(--lime); font-family: var(--display); font-weight: 900; font-size: 26px; display: flex; align-items: center; justify-content: center; flex: none; }
.pfile-hero .nm { font-family: var(--display); font-weight: 900; font-size: 24px; line-height: 1.3; }
.pfile-hero .facts { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.pfile-hero .facts span { display: inline-flex; align-items: center; gap: 5px; }
.pfile-hero .facts i { color: var(--violet); font-size: 16px; }
.pfile-hero .acts { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 12px 14px; font-weight: 700; color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { color: var(--violet-d); border-bottom-color: var(--violet); }
.tabs button .n { background: var(--line-soft); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.inv-head { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; padding: 16px 18px; }
.inv-head .k { font-size: 12px; color: var(--text-3); font-weight: 700; }
.inv-head .v { font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 22px; gap: 22px; }
  .auth-hero h1 { font-size: 30px; }
  .auth-feats { display: none; }
}
@media (max-width: 720px) {
  .day-nav .day { min-width: 0; font-size: 15px; }
  .pfile-hero .acts { margin-inline-start: 0; width: 100%; }
  .toolbar .search-in { max-width: none; }
}
@media print {
  .toolbar, .pager, .tabs, .pfile-hero .acts { display: none !important; }
}

/* ---------- invoice + receipt screens ---------- */
.inv-layout { grid-template-columns: minmax(0, 1fr) 330px; }
.req { color: var(--bad); }
.pat-search, .srv-search { position: relative; flex: 1 1 260px; max-width: 460px; }
.pat-search i, .srv-search i { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--violet); }
.pat-search .input, .srv-search .input { padding-inline-start: 38px; background: var(--surface); }
.srv-search { max-width: none; }
.card-head .pat-search { margin-inline-start: auto; }
/* المريض مش موجود + إضافة مريض جديد (جنب البحث) */
.pat-none { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pat-none[hidden] { display: none; }
.pat-none-msg { display: inline-flex; align-items: center; gap: 4px; color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.pat-none .btn { color: var(--violet); border-color: var(--violet-100); }
.pat-new-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--violet); font-weight: 600; }
.flags { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 0 18px 14px; font-size: 13.5px; }
.flags .grow { flex: 1; }
.flag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.flag input { width: 17px; height: 17px; accent-color: var(--pink); }
.inv-lines td { vertical-align: middle; }
.inv-lines .cell { height: 36px; }
.inv-lines td .sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; }
.add-line { align-items: center; }
.totals { padding: 10px 16px 14px; }
.totals .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.totals .row:last-child { border-bottom: 0; }
.totals .row span { color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.totals .row b { font-weight: 800; }
.totals .row .input { width: 130px; height: 36px; text-align: end; }
.totals .row.big { padding: 10px 0; }
.totals .row.big b { font-family: var(--display); font-size: 24px; font-weight: 900; color: var(--violet-d); }
.totals .row.due b { color: var(--pink); font-size: 16px; }
.unsaved { margin-top: 8px; background: var(--peach); color: #C2620F; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 700; }
.tools a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); font-size: 13.5px; color: var(--text); }
.tools a:hover { background: var(--line-soft); }
.tools a i { color: var(--violet); }
.tools button.primary-tool { background: var(--violet); color: #fff; font-weight: 800; }
.tools button.primary-tool i, .tools button.primary-tool .hint { color: #fff; opacity: .9; }
.tools button.primary-tool:hover { background: var(--violet-d); }
.tools button:disabled { opacity: .6; cursor: progress; }
.seg.sm button { padding: 4px 9px; font-size: 12px; }
.today-list { max-height: 380px; overflow-y: auto; padding: 6px; }
.today-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.today-list a:hover { background: var(--surface-2); }
.today-list a.on { background: var(--violet-50); }
.today-list .no { font-weight: 800; color: var(--violet-d); min-width: 48px; }
.today-list .nm { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-list .nm small { display: block; font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.today-list .am { font-weight: 800; display: inline-flex; gap: 4px; align-items: center; }
.today-list .am i { font-size: 15px; color: var(--text-3); }
.dis-log { padding: 8px 14px 12px; display: grid; gap: 8px; font-size: 13px; }
.dis-log small { display: block; color: var(--text-3); }
.pay-tbl td { vertical-align: middle; }
.pay-tbl .input, .pay-tbl .select { height: 40px; }
.doc-preview { max-width: 820px; }
@media (max-width: 1280px) { .inv-layout { grid-template-columns: 1fr; } }

/* ---------- printed invoice / receipt ---------- */
#printArea { display: none; }
.pdoc { font-family: var(--font); color: #111; background: #fff; padding: 8px; }
.pd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 3px solid #845EFF; padding-bottom: 10px; margin-bottom: 12px; }
.pd-co { font-family: var(--display); font-weight: 900; font-size: 22px; }
.pd-sub { color: #555; font-weight: 700; }
.pd-no { text-align: end; font-size: 13px; line-height: 1.8; }
.pd-no b { font-size: 16px; }
.pd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; margin-bottom: 12px; font-size: 13.5px; }
.pd-grid span { color: #666; margin-inline-end: 8px; }
.pd-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.pd-tbl th { background: #F3EFFF; padding: 7px 8px; text-align: start; border: 1px solid #ddd; }
.pd-tbl td { padding: 7px 8px; border: 1px solid #ddd; }
.pd-tbl td small { display: block; color: #777; }
.pd-tot { margin-inline-start: auto; width: min(360px, 100%); font-size: 13.5px; }
.pd-tot div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #ddd; }
.pd-tot .big { font-size: 17px; font-weight: 900; border-bottom: 2px solid #111; }
.pd-foot { margin-top: 18px; font-size: 12px; color: #555; border-top: 1px solid #ddd; padding-top: 8px; }
/* بيانات المنشأة + QR + رقم الدخول + التذييل (زي invoice_display_dw) */
.pd-coen { font-weight: 800; color: #333; font-size: 13px; }
.pd-coinfo { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: #444; margin-top: 4px; }
.pd-qr { width: 108px; height: 108px; margin-top: 6px; image-rendering: pixelated; }
.pd-entry { display: inline-flex; align-items: center; gap: 10px; border: 2px solid #111; border-radius: 10px; padding: 4px 14px; margin-bottom: 10px; font-weight: 800; }
.pd-entry b { font-size: 26px; font-family: var(--display); }
.pd-bot { text-align: center; font-size: 12px; color: #444; margin-top: 10px; }
.pd-thanks { text-align: center; font-weight: 800; margin-top: 8px; }
.pd-break { page-break-after: always; break-after: page; height: 0; }
/* حراري 80 مم (invoice_display_thermal) */
.pdoc.thermal { width: 72mm; padding: 0; font-size: 11px; }
.pdoc.thermal .pd-head { flex-direction: column; align-items: center; text-align: center; gap: 4px; border-bottom-width: 2px; }
.pdoc.thermal .pd-co { font-size: 15px; }
.pdoc.thermal .pd-coinfo { justify-content: center; font-size: 10px; }
.pdoc.thermal .pd-no { text-align: center; }
.pdoc.thermal .pd-grid { grid-template-columns: 1fr; font-size: 11px; gap: 2px; }
.pdoc.thermal .pd-tbl { font-size: 11px; }
.pdoc.thermal .pd-tbl th, .pdoc.thermal .pd-tbl td { padding: 3px 4px; border: 0; border-bottom: 1px dashed #bbb; }
.pdoc.thermal .pd-tot { width: 100%; font-size: 11.5px; }
.pdoc.thermal .pd-tot .big { font-size: 13px; }
.pdoc.thermal .pd-entry { display: flex; justify-content: center; }
/* عدد النسخ + الحفظ + مدفوعات الفاتورة */
.copies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.copies .btn { height: 54px; font-size: 20px; font-weight: 800; justify-content: center; }
.saved-entry { text-align: center; font-size: 15px; margin-bottom: 12px; }
.saved-entry b { display: block; font-size: 44px; font-family: var(--display); color: var(--violet); }
.rv-mini a { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.rv-mini a:hover { background: var(--surface-2); }
.rv-mini small { display: block; color: var(--text-2); font-size: 12px; }
.rv-state { padding: 10px 16px; font-weight: 700; border-top: 1px solid var(--line); }
.rv-state.due { color: var(--bad); }
.rv-state.ok { color: var(--lime-ink); }
#drawer.wide { width: min(900px, 96vw); }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; }
  body.printing { background: #fff; }
}

/* ---------- doctor examination (كشف الطبيب) ---------- */
.exam-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.exam-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; min-height: 0; }
.ex-head { flex-direction: column; align-items: stretch; gap: 10px; padding-bottom: 0; margin-bottom: 12px; border-bottom: 0; }
.ex-head .ph-text { flex: none; }
.ex-head .page-title { font-size: 30px; }
.ex-head .page-sub { font-size: 13px; }
.ex-head .select { width: 100%; }
.exam-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.exam-list .today-list { max-height: none; overflow-y: auto; flex: 1; }
.today-list a.done .nm { color: var(--text-2); }
.today-list a.done .no { color: var(--lime-ink); }
.today-list .am small { font-weight: 800; }
.exam-bar .pfile-hero { align-items: flex-start; }
.exam-bar .pfile-hero .nm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.exam-acts { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 18px; }
.exam-acts .btn { height: 38px; }
/* شريط بيانات الكشف: مربعات كبيرة ملوّنة (زي البرنامج القديم) */
.exam-bar .pfile-hero { padding: 14px 18px 10px; gap: 12px; }
.exam-bar .pfile-hero .av { width: 50px; height: 50px; border-radius: 14px; font-size: 20px; }
.exam-bar .pfile-hero .nm { font-size: 22px; }
/* أزرار الطبيب: مجموعة واحدة جوه مربع باهت بعنوان */
.exam-bar .exam-acts { position: relative; margin: 18px 18px 16px; padding: 18px 12px 12px; border: 1px solid var(--violet-100);
  border-radius: 12px; background: color-mix(in srgb, var(--violet) 5%, var(--surface)); }
.exam-bar .exam-acts .acts-title { position: absolute; top: -11px; inset-inline-start: 14px; display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 10px; border-radius: 999px; background: var(--violet); color: #fff; font-size: 12.5px; font-weight: 800; line-height: 20px; }
.exam-bar .exam-acts .acts-title i { font-size: 14px; }
.exam-bar .exam-acts .btn:not(.primary) { background: var(--surface); }
/* زرار حفظ الكشف في عمود المرضى تحت رقم الفاتورة */
.ex-save { margin: 10px 12px 0; }
.ex-save:empty { display: none; }
.ex-save .btn-save { width: 100%; height: 44px; font-size: 15.5px; }
.exam-bar .exam-acts { margin-top: 20px; }
/* زرار حفظ الكشف أخضر */
.btn.btn-save { background: #16A34A; border-color: #16A34A; color: #fff; }
.btn.btn-save:hover { background: #15803D; border-color: #15803D; }
/* سؤال «هل تريد حفظ الكشف؟» في نافذة صغيرة في النص */
.modal.ask { top: 28vh; width: min(360px, calc(100vw - 32px)); }
.ask-box { padding: 22px 20px 18px; text-align: center; }
.ask-box .ask-ic { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, #16A34A 14%, var(--surface)); color: #16A34A; font-size: 26px; }
.ask-box h3 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.ask-box p { margin: 0; font-size: 15.5px; color: var(--text-2); }
.ask-box .ask-btns { display: flex; gap: 8px; margin-top: 18px; }
.ask-box .ask-btns .btn { flex: 1; height: 42px; font-size: 15px; }
.btn.btn-save kbd { background: rgba(255, 255, 255, .2); border-color: rgba(255, 255, 255, .35); color: #fff; }
.xinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 0 18px; }
.xinfo + .xinfo { margin-top: 8px; }
.xinfo .xi { --c: var(--text); border: 1px solid var(--line); border-inline-start: 4px solid var(--c); border-radius: 10px; padding: 4px 9px 5px; min-width: 0;
  background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.xinfo .xi small { display: flex; align-items: center; gap: 5px; font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.4; white-space: nowrap; overflow: hidden; }
.xinfo .xi small .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-inline-start: auto; flex: none; animation: xdur 1.6s ease-in-out infinite; }
.xinfo .xi small i { color: var(--c); font-size: 17px; flex: none; }
.xinfo .xi b { display: block; font-size: 20px; font-weight: 800; color: var(--c); line-height: 1.3; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xinfo .xi b small { display: inline; font-size: 14.5px; color: inherit; font-weight: 700; }
.xinfo .xi em { display: block; font-style: normal; font-size: 12.5px; line-height: 1.3; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xinfo .xi.arr { --c: var(--info); }
.xinfo .xi.appt { --c: #0E7C86; }
.xinfo .xi.start { --c: var(--violet); }
.xinfo .xi.end { --c: var(--pink); }
.xinfo .xi.dur { --c: var(--orange); }
@keyframes xdur { 50% { opacity: .55; } }
.xinfo .xi.ok { --c: var(--ok); }
.xinfo .xi.warn { --c: var(--warn); }
.xinfo .xi.bad { --c: var(--bad); }
.xinfo .xi.muted { --c: var(--text-3); }
.xinfo .xi.muted b { font-size: 17px; color: var(--text-2); }
/* بيانات المريض: شريط واحد، كل عنوان وقيمته جنب بعض */
.xinfo.pat { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; margin: 8px 18px 0; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.xinfo.pat .xi { --c: var(--text); display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 0; background: none; border-radius: 0; }
.xinfo.pat .xi small { font-size: 14px; }
.xinfo.pat .xi small i { color: var(--violet); }
.xinfo.pat .xi b { font-size: 16px; margin: 0; white-space: nowrap; }
.xnotes { padding: 0 18px; }
.xnotes .note-row { margin-bottom: 0; }
/* ملاحظات التمريض في تاب الزيارة: الخلفية زي باقي الخانات، والكلام بس اللي لونه أخضر مميز */
.field.nurse-note label { color: #2F7D12; font-weight: 800; }
.field.nurse-note .input { color: #2F7D12; font-weight: 700; }
:root[data-theme="dark"] .field.nurse-note label, :root[data-theme="dark"] .field.nurse-note .input { color: #8BD45A; }
.rx-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.rx-foot p { margin: 0; font-size: 12.5px; }
.rx-tbl td { padding: 5px 8px; }
.rx-tbl .input { height: 38px; }
.rx-tbl .rn span { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; background: var(--violet-50); color: var(--violet-d); font-weight: 800; }
#xf .pad { padding: 18px; }
.pd-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 26px; font-size: 13px; }
.pd-sign .line { border-top: 1px solid #999; margin-top: 34px; padding-top: 4px; color: #666; min-width: 180px; }
.pd-sign .stamp { width: 120px; height: 90px; border: 1.5px dashed #aaa; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; color: #888; font-size: 12px; }
.pdoc h4 { font-family: var(--display); }
@media (max-width: 1100px) { .exam-layout { grid-template-columns: 1fr; } .exam-side { position: static; max-height: none; } .exam-list { flex: none; max-height: 360px; } }

/* home: quick buttons (like the old main screen) under the numbers */
.hero .acts { position: relative; inset: auto; z-index: 2; margin: 0; flex-wrap: wrap; }   /* inset: auto = من غير إزاحة الراس القديم (bottom 24px كان بيطلّعها فوق التاريخ) */
.hero::before, .hero::after { pointer-events: none; }   /* دواير الزينة كانت بتغطي «المواعيد» و«سند قبض» وتاخد الضغطة */

/* ---------- teeth chart (شاشة الأسنان) ---------- */
.chart-wrap { padding: 16px 18px 12px; overflow-x: auto; }
.tchart { min-width: 760px; display: grid; gap: 6px; justify-content: center; }
.jaw { display: flex; justify-content: center; gap: 10px; }
.jaw .q { display: flex; gap: 4px; }
.jaw .mid { width: 2px; background: var(--line); border-radius: 2px; }
.jaw-line { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); border-top: 1px dashed var(--line); padding-top: 2px; margin: 0 4px; }
.tooth { width: 42px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 1.5px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; color: var(--text-2); font-weight: 800; font-size: 12px; }
.tooth.down { flex-direction: column-reverse; }
.tooth svg { width: 30px; height: 38px; }
.tooth.molar svg { width: 36px; }
.tooth path { fill: var(--surface); stroke: #B9B2D6; stroke-width: 2; }
.tooth span { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.tooth small { color: var(--pink); font-size: 10px; }
.tooth:hover { background: var(--violet-50); border-color: var(--violet-100); }
.tooth.old path { fill: var(--lime-50); stroke: #9BC93A; }
.tooth.on path { fill: var(--violet); stroke: var(--violet-d); }
.tooth.on { color: var(--violet-d); }
.tooth.cur { border-color: var(--violet); background: var(--violet-50); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); justify-content: center; margin-top: 10px; }
.chart-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-inline-end: 5px; border: 1.5px solid #B9B2D6; }
.chart-legend .lg.on { background: var(--violet); border-color: var(--violet-d); }
.chart-legend .lg.old { background: var(--lime-50); border-color: #9BC93A; }
.teeth-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; margin-top: 16px; align-items: start; }
.teeth-tbl td { padding: 4px 6px; vertical-align: middle; }
.teeth-tbl td:nth-child(2) { position: relative; }
.teeth-tbl .tl { position: absolute; inset-inline-start: 10px; top: 13px; color: var(--pink); font-weight: 800; font-size: 11px; }
.rules { margin: 10px 0 0; padding-inline-start: 18px; font-size: 12px; color: var(--text-3); }
@media (max-width: 1200px) { .teeth-layout { grid-template-columns: 1fr; } }

/* ---------- doctor discounts / transfers / vital signs ---------- */
.dr-report { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.dr-row.clickable { cursor: pointer; border-radius: 10px; margin: 2px 8px; padding: 9px 10px; }
.dr-row.clickable:hover { background: var(--violet-50); }
.dr-total { padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); font-weight: 700; }
.vital label i { color: var(--violet); }
.vin { display: flex; align-items: center; gap: 8px; }
.vin .input { flex: 1; min-width: 0; height: 46px; font-size: 18px; font-weight: 700; text-align: center; }
.vin span { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.vin.bp b { color: var(--text-3); }
@media (max-width: 1100px) { .dr-report { grid-template-columns: 1fr; } }

/* ---------- reports: patients receivable / users receipts / price list ---------- */
.tbl tr.sub-total td { background: var(--surface-2); font-weight: 800; border-top: 1px solid var(--line); }
.meter-bar { height: 8px; border-radius: 6px; background: var(--line-soft); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--violet); border-radius: 6px; }
.sign-row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 22px 18px 18px; color: var(--text-2); font-size: 13px; }

/* ---------- options / branches ---------- */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 18px; align-items: start; }
.opt-check { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.opt-check:has(input:checked) { border-color: var(--violet); background: var(--violet-50); }
.opt-check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--violet); }
.opt-check small { display: block; color: var(--text-3); font-weight: 500; font-size: 12px; }
.color-in { display: flex; align-items: center; gap: 10px; }
.color-in input[type=color] { width: 64px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); cursor: pointer; }

/* ===== phones / tablets: nothing wider than the screen (22/10/2026) ===== */
/* grid columns may shrink below their content (long names, wide tables scroll inside .table-wrap) */
.jv-layout > *, .inv-layout > *, .exam-layout > *, .teeth-layout > *, .dr-report > *, .home-grid > *, .board > *, .kpis > *, .side-panel > * { min-width: 0; }
.today-list a { min-width: 0; }
@media (max-width: 720px) {
  /* fields that span 2 columns on a computer take the full width on a phone (no hidden 2nd column) */
  .form-grid > [style*="span 2"], .form-grid > [style*="span 3"] { grid-column: 1 / -1 !important; }
  .form-grid, .drawer .form-grid { grid-template-columns: 1fr !important; }
  .card-head { flex-wrap: wrap; }
  .card-head .pat-search { flex: 1 1 100%; max-width: none; margin-inline-start: 0; }
  .toolbar > * { flex: 1 1 100%; max-width: none !important; }
  .toolbar .seg, .day-nav { flex-wrap: wrap; }
  .head-actions { flex-wrap: wrap; }
  .head-actions .btn { flex: 1 1 auto; }
  .exam-acts .btn, .st-btns .btn { flex: 1 1 45%; }
  .exam-bar .exam-acts { margin: 18px 12px 14px; padding: 18px 10px 10px; }
  .ex-save { display: none; }   /* على الجوال الحفظ في الشريط اللي تحت الشاشة */
  .xinfo { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 12px; gap: 6px; }
  .xnotes { padding: 0 12px; }
  .xinfo .xi { padding: 5px 10px; }
  .xinfo .xi b { font-size: 18px; }
  .xinfo.pat { margin: 6px 12px 0; gap: 6px 16px; padding: 8px 12px; }
  .pfile-hero .nm { font-size: 20px; }
  .pfile-hero .facts { gap: 6px 12px; font-size: 13px; }
  .tabs button { padding: 10px; font-size: 13px; }
  .totals .row .input { width: 110px; }
  .sum-cards .v { font-size: 16px; }
  .page-title { font-size: 26px; }
  .tchart { min-width: 700px; }
  .dr-row.clickable { margin: 2px 4px; }
  .prof-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; }
  .exam-list { max-height: 300px; }
  .vin .input { font-size: 16px; }
  .pd-grid { grid-template-columns: 1fr; }
  .jaw .q { gap: 2px; }
  /* bigger touch targets */
  .btn, .select, .input { min-height: 42px; }
  .icon-btn { width: 40px; height: 40px; }
}
/* tablets: two columns where there is room */
@media (min-width: 721px) and (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > [style*="span 2"] { grid-column: 1 / -1 !important; }
}
/* inputs under 16px make iPhone zoom in when typing */
@media (max-width: 1024px) { input.input, select.select, textarea.input { font-size: 16px; } }
/* phone: fixed bar at the bottom with the total and the save button */
.mob-bar { display: none; }
@media (max-width: 720px) {
  .mob-bar { display: flex; align-items: center; gap: 10px; position: fixed; inset-inline: 0; bottom: 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 18px rgba(10, 5, 38, .08); }
  .mob-bar .btn { flex: 1; height: 46px; }
  .mob-bar .mb-t { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
  .mob-bar .mb-t span { font-size: 11.5px; color: var(--text-3); font-weight: 700; }
  .mob-bar .mb-t b { font-family: var(--display); font-weight: 900; font-size: 20px; color: var(--violet-d); }
  body:has(.mob-bar) .main { padding-bottom: 110px; }
  body:has(.mob-bar) .toast { bottom: 84px; }
}
@media print { .mob-bar { display: none !important; } }

/* the side panel never wider than the visible area (100vw counts the scrollbar on tablets) */
.drawer { width: min(820px, 100%); max-width: 100%; }
.modal { width: min(620px, calc(100% - 32px)); }

/* ---------- توريد النقدية للإدارة ---------- */
.kv-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 18px; }
.kv-list.pad { padding: 16px 18px; }
.kv-list > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv-list span { font-size: 12px; color: var(--text-2); font-weight: 600; }
.kv-list b { font-weight: 700; overflow-wrap: anywhere; }
.srf-sum .l { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 10px; }
.srf-sum .l:first-child { margin-top: 0; }
.srf-sum .v { font-size: 20px; font-weight: 800; }
.srf-sum .v.big { font-size: 28px; color: var(--violet-d); }
.tbl tr.sel td { background: var(--violet-50); }

/* ---------- مركز التقارير ---------- */
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.rc-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px 18px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--text); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; min-width: 0; }
.rc-tile:hover, .rc-tile:focus-visible { transform: translateY(-2px); border-color: var(--c); box-shadow: 0 10px 24px rgba(10, 5, 38, .08); }
.rc-tile i { width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.rc-tile b { font-size: 16px; font-family: var(--display); margin-top: 6px; }
.rc-tile small { color: var(--text-2); font-size: 12.5px; }
.rc-n { position: absolute; top: 12px; inset-inline-end: 14px; font-size: 12px; color: var(--text-3); font-weight: 700; }
@media (max-width: 720px) {
  .rc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rc-tile { padding: 14px 12px; }
  .rc-tile i { width: 40px; height: 40px; font-size: 22px; }
  .rc-tile b { font-size: 14.5px; }
}

/* ---------- حسابي ---------- */
.me-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px 24px; border-radius: 22px; background: radial-gradient(120% 140% at 0% 0%, #2B1A6E 0%, var(--night, #0A0526) 60%); color: #fff; }
.me-av { width: 64px; height: 64px; border-radius: 20px; background: var(--lime); color: #0A0526; display: flex; align-items: center; justify-content: center; font: 800 24px var(--display); flex: none; }
.me-who { flex: 1; min-width: 200px; }
.me-name { font: 800 24px var(--display); }
.me-sub { font-size: 13.5px; opacity: .85; margin-top: 3px; }
.me-hero .faint { color: rgba(255, 255, 255, .65); }
.me-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.me-acts .btn:not(.primary) { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff; }
.me-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.me-kpis > div { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--s); border-radius: 18px; padding: 18px; min-width: 0; }
.me-kpis .l { font-size: 13px; color: var(--text-2); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.me-kpis .l i { color: var(--s); font-size: 18px; }
.me-kpis .v { font-size: 30px; font-weight: 800; margin-top: 6px; }
.me-kpis .s { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
@media (max-width: 720px) {
  .me-hero { padding: 18px 16px; gap: 14px; }
  .me-acts { width: 100%; }
  .me-acts .btn { flex: 1 1 140px; justify-content: center; }
  .me-kpis { grid-template-columns: 1fr; gap: 10px; }
  .me-kpis .v { font-size: 26px; }
}

/* ---------- إستيراد البيانات ---------- */
.imp-cols { display: flex; flex-wrap: wrap; gap: 8px; }
.imp-cols span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--violet-50); color: var(--violet-d); font-size: 13px; font-weight: 700; }
.imp-cols b { width: 20px; height: 20px; border-radius: 50%; background: var(--violet); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.imp-paste { width: 100%; min-height: 150px; resize: vertical; font-family: var(--mono, monospace); font-size: 13px; direction: ltr; text-align: left; white-space: pre; }
.imp-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.imp-bar label.btn { cursor: pointer; }
.imp-save { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.tbl tr.imp-bad td { background: var(--bad-bg, #FFF1F2); }
@media (max-width: 720px) { .imp-save .btn { width: 100%; justify-content: center; } }

/* ---------- المستخدمين والصلاحيات ---------- */
.job-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; }
.job-chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: 13.5px; }
.job-chip span { min-width: 26px; height: 24px; padding: 0 6px; border-radius: 8px; background: var(--violet-50); color: var(--violet-d); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.job-chip:hover { border-color: var(--violet); }
.job-chip.warn span { background: var(--peach, #FFE9D6); color: #C2620F; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input, .pchk { width: 18px; height: 18px; accent-color: var(--violet); cursor: pointer; }
.perm-tbl th.c, .perm-tbl td.c { text-align: center; width: 70px; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.nav-item.locked { opacity: .45; pointer-events: none; }
.nav-item .lock-i { font-size: 13px; margin-inline-start: auto; }

/* ---------- المساعد الذكي ---------- */
:root { --viz-1: #845EFF; }
:root[data-theme="dark"] { --viz-1: #8F6FFF; }
.ai-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ai-layout > * { min-width: 0; }
.ai-chat { display: flex; flex-direction: column; height: min(74vh, 760px); }
.ai-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-m { max-width: 92%; padding: 10px 12px; border-radius: 14px; background: var(--surface-2, #F6F4FD); font-size: 14px; line-height: 1.7; }
.ai-m b { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.ai-m p { margin: 0; }
.ai-m.me { align-self: flex-start; background: var(--violet); color: #fff; }
.ai-m.me b { color: rgba(255, 255, 255, .75); }
.ai-m.bot { align-self: flex-end; }
.ai-m.err { background: var(--bad-bg, #FFF1F2); color: var(--bad); }
.ai-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.ai-quick .btn { font-size: 12px; white-space: normal; text-align: start; height: auto; padding: 6px 10px; }
.ai-ask { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-soft); }
.ai-ask textarea { flex: 1; resize: none; min-height: 48px; }
.ai-chart { padding: 12px 16px 4px; }
.ai-chart svg { width: 100%; height: auto; display: block; max-height: 300px; }
.ai-chart .g { stroke: var(--line-soft); stroke-width: 1; }
.ai-chart .base { stroke: var(--line); stroke-width: 1; }
.ai-chart .ax { fill: var(--text-3); font-size: 11px; font-family: var(--body, inherit); }
.ai-chart .bar { fill: var(--viz-1); }
.ai-chart .ln { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; }
.ai-chart .dot { fill: var(--viz-1); stroke: var(--surface); stroke-width: 2; }
.ai-chart [data-tip] { cursor: pointer; }
.ai-chart [data-tip]:hover { opacity: .85; }
.ai-chart.pie { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ai-chart.pie svg { width: 200px; max-width: 60%; }
.ai-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.ai-legend span { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.ai-legend b { color: var(--text); margin-inline-start: 4px; }
.ai-tip { position: fixed; display: none; z-index: 80; pointer-events: none; background: var(--night, #0A0526); color: #fff; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
@media (max-width: 1024px) { .ai-layout { grid-template-columns: 1fr; } .ai-chat { height: min(70vh, 620px); } }
@media print { .ai-chart .ax { font-size: 10px; } }

/* ---------- دليل الاستخدام ---------- */
.help-search { padding: 12px 14px; margin-bottom: 14px; }
.help-cur { margin-bottom: 18px; }
.help-cur .help-item { border-color: var(--violet); }
.help-sec h3 { font-family: var(--display); margin: 18px 0 10px; font-size: 17px; }
.help-item { margin-bottom: 8px; padding: 0; }
.help-item summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary b { display: block; }
.help-item summary small { color: var(--text-3); font-size: 12px; }
.help-item .chev { margin-inline-start: auto; transition: transform .15s; color: var(--text-3); }
.help-item[open] .chev { transform: rotate(180deg); }
.hi-ico { width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--violet-50); color: var(--violet-d); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.help-body { padding: 0 16px 16px 16px; line-height: 1.9; }
.help-body h4 { margin: 10px 0 4px; font-size: 14px; color: var(--violet-d); }
.help-body ol, .help-body ul { margin: 0; padding-inline-start: 22px; }
@media print { .help-item { break-inside: avoid; } .help-item .help-body { display: block !important; } .help-search, .help-body .btn { display: none !important; } }

.exam-flags{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 0}
.exam-flags .badge{font-size:13px;padding:4px 10px}

/* كشف الطبيب: رقم الفاتورة، اللي عليه الدور، الرصيد */
.ex-go{display:flex;gap:6px;margin:10px 12px 0}.ex-go .input{height:34px}
.today-list a.next .no{background:#92400E;color:#fff}
.bal-link{cursor:pointer;text-decoration:underline dotted}
.bal-strip{color:inherit;text-decoration:none;display:inline-flex;align-items:center;gap:4px}.bal-strip:hover{text-decoration:underline}
.ex-foot{display:flex;justify-content:space-between;padding:8px 14px;font-size:12px;border-top:1px solid var(--line, #e5e7eb)}
/* كشف الطبيب: كل فاتورة في كارت لوحدها، وهايلايت لما الماوس يعدّي عليها */
.exam-list .today-list{display:flex;flex-direction:column;gap:7px;padding:8px 10px;background:var(--surface-2)}
.exam-list .today-list a{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:9px 11px;box-shadow:0 1px 2px rgb(20 16 50 / .05);transition:background .15s,border-color .15s,box-shadow .15s,transform .15s}
.exam-list .today-list a:hover{background:var(--violet-50);border-color:var(--violet);box-shadow:0 4px 14px rgb(132 94 255 / .18);transform:translateY(-1px)}
.exam-list .today-list a.on{background:var(--violet-50);border-color:var(--violet);box-shadow:inset -4px 0 0 var(--violet),0 2px 8px rgb(132 94 255 / .14)}
.exam-list .today-list a.next:not(.on){border-color:#D97706}
.exam-list .today-list a.done:not(.on):not(:hover){background:color-mix(in srgb,var(--surface) 70%,var(--surface-2))}
.exam-list .today-list .no{border-radius:8px;padding:3px 6px;text-align:center}
.exam-list .ex-grp{background:none;padding:4px 2px 0}
/* كارت اللي عليه الدور: يتسحب شمال ناحية الكشف فيفتح */
.exam-list .today-list a.next{cursor:grab;touch-action:pan-y;user-select:none}
.exam-list .today-list a.next.swiping{opacity:.35;cursor:grabbing}
.ex-ghost{position:fixed;z-index:9999;pointer-events:none;display:flex;align-items:center;gap:10px;padding:9px 11px;font-size:13px;border-radius:12px;background:var(--surface);border:1px solid var(--line);box-shadow:0 10px 26px rgb(20 16 50 / .25);color:var(--text);direction:rtl;cursor:grabbing}
.ex-ghost .no{font-weight:800;min-width:48px;border-radius:8px;padding:3px 6px;text-align:center;background:#92400E;color:#fff}
.ex-ghost .nm{flex:1;min-width:0;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ex-ghost .nm small{display:block;font-weight:500;color:var(--text-3);font-size:11.5px}
.ex-ghost .am{display:inline-flex;gap:4px;align-items:center;font-weight:800}
.ex-ghost.go{background:var(--violet-50);border:2px solid var(--violet);box-shadow:0 10px 26px rgb(132 94 255 / .35)}
/* المرفقات */
.att-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.att-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.att-tile{display:flex;flex-direction:column;border:1px solid var(--line, #e5e7eb);border-radius:10px;overflow:hidden;background:var(--surface, #fff);padding:0;cursor:pointer;text-align:start;font:inherit;color:inherit}
.att-tile:hover{border-color:var(--brand, #0f766e)}
.att-tile img,.att-pdf{width:100%;height:120px;object-fit:cover;background:#f3f4f6;display:flex;align-items:center;justify-content:center;gap:6px;color:#b91c1c;font-weight:700}
.att-pdf .ti{font-size:34px}
.att-cap{padding:6px 8px;font-size:12px}
.att-view{background:#f3f4f6;border-radius:10px;padding:8px;text-align:center}
.att-view img{max-width:100%;max-height:70vh}
.att-view iframe{width:100%;height:72vh;border:0;background:#fff}
/* محرر الصور */
.img-ed{position:fixed;inset:0;z-index:1000;background:#1f2937;display:flex;flex-direction:column}
.ie-bar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:8px 12px;background:var(--surface, #fff)}
.ie-grp{display:flex;align-items:center;gap:4px;padding-inline-end:10px;border-inline-end:1px solid var(--line, #e5e7eb)}
.ie-grp .icon-btn.on{background:var(--brand, #0f766e);color:#fff}
.ie-grp .select{height:32px;width:auto}.ie-grp .input{height:32px}
.ie-sw{width:24px;height:24px;border-radius:50%;border:2px solid #d1d5db;cursor:pointer;padding:0}
.ie-sw.on{outline:3px solid var(--brand, #0f766e);outline-offset:1px}
#ieCol{width:30px;height:28px;border:0;padding:0;background:none}
.ie-stage{flex:1;overflow:auto;display:flex;align-items:center;justify-content:center;padding:16px}
.ie-stage canvas{max-width:100%;max-height:100%;background:#fff;touch-action:none;cursor:crosshair;box-shadow:0 4px 24px rgba(0,0,0,.4)}

/* كشف الطبيب: محرر الملاحظات، بيانات الزيارة، التحويل، الطباعة */
.memo-ed{border:1px solid var(--line, #e5e7eb);border-radius:10px;overflow:hidden}
.memo-bar{display:flex;align-items:center;gap:4px;padding:4px 6px;border-bottom:1px solid var(--line, #e5e7eb);background:var(--surface-2, #f8fafc)}
.memo-area{min-height:190px;height:auto;padding:10px 12px;border:0;border-radius:0;white-space:pre-wrap;overflow:auto;max-height:420px;line-height:1.7}
.memo-area:focus{outline:none;box-shadow:none}
.visit-info,.tr-sum{display:flex;flex-wrap:wrap;gap:8px 18px;padding:10px 12px;background:var(--surface-2, #f8fafc);border-radius:10px;margin-bottom:12px}
.visit-info span,.tr-sum span{display:flex;flex-direction:column}.visit-info small,.tr-sum small{color:var(--muted, #6b7280);font-size:11.5px}
.tr-docs{display:flex;flex-direction:column;gap:4px;max-height:300px;overflow:auto;margin-top:6px}
.tr-docs button{display:flex;flex-direction:column;align-items:flex-start;text-align:start;padding:8px 10px;border:1px solid var(--line, #e5e7eb);border-radius:8px;background:var(--surface, #fff);cursor:pointer;font:inherit;color:inherit}
.tr-docs button small{color:var(--muted, #6b7280)}.tr-docs button.on{border-color:var(--brand, #0f766e);background:color-mix(in srgb, var(--brand, #0f766e) 10%, transparent)}
.ex-grp{padding:6px 12px;font-size:12px;font-weight:700;color:var(--muted, #6b7280);background:var(--surface-2, #f8fafc)}
.pd-logo{max-height:70px;max-width:140px;object-fit:contain;margin-inline-end:12px}
.pd-printed{display:flex;justify-content:space-between;font-size:10.5px;color:#6b7280;margin-top:8px}

/* الأسنان: بحث الخدمة ومخطط الطباعة */
.srv-pop{position:fixed;z-index:900;max-height:300px;overflow:auto;background:var(--surface, #fff);border:1px solid var(--line, #e5e7eb);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.15);padding:4px}
.srv-pop button{display:grid;grid-template-columns:56px 1fr;gap:0 8px;width:100%;text-align:start;padding:6px 8px;border:0;background:none;border-radius:6px;cursor:pointer;font:inherit;color:inherit}
.srv-pop button small{grid-column:2;color:var(--muted, #6b7280)}
.srv-pop button.on,.srv-pop button:hover{background:color-mix(in srgb, var(--brand, #0f766e) 12%, transparent)}
.pd-chart{display:block;margin:8px auto 10px}

/* شاشات البيانات: كروت الإحصائيات، الترتيب، صورة الطبيب */
.stat-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin-bottom:16px}
.stat-cards .stat{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:14px 16px;border-radius:14px;border:1px solid var(--line, #e5e7eb);background:var(--surface, #fff);border-inline-start:4px solid var(--s);text-align:start;font:inherit;color:inherit;cursor:pointer}
.stat-cards .stat:disabled{cursor:default;opacity:1}
.stat-cards .stat.on{box-shadow:0 0 0 2px var(--s)}
.stat-cards .l{font-size:12.5px;color:var(--muted, #6b7280)}.stat-cards .v{font-size:20px}.stat-cards .s{font-size:12px;color:var(--muted, #6b7280)}
th.sortable{cursor:pointer;user-select:none;white-space:nowrap}th.sortable:hover{color:var(--brand, #0f766e)}th.sorted{color:var(--brand, #0f766e)}
.dr-photo{display:flex;align-items:center;gap:14px;margin-bottom:14px}
.dr-photo img,.dr-photo .ph-none{width:84px;height:84px;border-radius:50%;object-fit:cover;background:#f3f4f6;display:flex;align-items:center;justify-content:center;font-size:38px;color:#9ca3af}

/* المواعيد: كروت الأطباء، حالة Google، عنوان مجموعة الطبيب */
/* كروت الأطباء في المواعيد (d_dr_card): الصورة ورقم الطبيب ، الاسم ، التخصص ، المؤهلات ، «مواعيده» */
.dr-strip{display:flex;align-items:center;gap:6px;margin-bottom:14px}
.dr-strip .dr-nav{flex:0 0 auto;transition:opacity .15s}.dr-strip .dr-nav.hide{opacity:0;pointer-events:none}
[dir="ltr"] .dr-strip .dr-nav i{transform:scaleX(-1)}
.dr-cards{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;flex:1;padding:3px 2px}.dr-cards::-webkit-scrollbar{display:none}
.dr-card{flex:0 0 calc((100% - 24px) / 3);min-width:0;scroll-snap-align:start;display:flex;align-items:stretch;gap:14px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);text-align:start;cursor:pointer;font:inherit;color:inherit;transition:border-color .15s,box-shadow .15s,transform .15s}
.dr-card:hover{border-color:#CDD1D8;box-shadow:var(--shadow-pop)}
.dr-card:focus-visible{outline:2px solid var(--crimson);outline-offset:2px}
.dr-card.on{border-color:var(--crimson);box-shadow:0 0 0 2px color-mix(in srgb, var(--crimson) 25%, transparent);background:color-mix(in srgb, var(--crimson) 4%, var(--surface))}
.dr-card.off{opacity:.6}
.dc-ph{position:relative;flex:0 0 84px;display:flex;flex-direction:column;align-items:center;gap:6px}
.dc-ph img,.dc-ini{width:84px;height:96px;border-radius:12px;object-fit:cover;object-position:top}
.dc-ph img{position:absolute;inset:0 0 auto 0;z-index:1;background:var(--surface-2)}
.dc-ini{display:flex;align-items:center;justify-content:center;font-size:34px;font-weight:700;color:hsl(var(--h) 45% 32%);background:hsl(var(--h) 55% 92%)}
:root[data-theme="dark"] .dc-ini{color:hsl(var(--h) 60% 80%);background:hsl(var(--h) 25% 22%)}
.dc-ph em{font-style:normal;font-size:11.5px;color:var(--text-3)}
.dc-tx{display:flex;flex-direction:column;min-width:0;flex:1;gap:3px}
.dc-tx b{font-size:15px;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dc-sp{font-size:12.5px;font-weight:600;color:var(--crimson);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:root[data-theme="dark"] .dc-sp{color:#E8A0A0}
.dc-sep{display:block;height:1px;background:var(--line);margin:5px 0 4px}
.dc-bio{font-size:12.5px;line-height:1.55;color:var(--text-2);white-space:pre-line;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.9em}
.dc-bio.none{color:var(--text-3);font-style:italic}
.dc-ft{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto;padding-top:6px}
.dc-hr{font-size:11.5px;color:var(--text-3);display:inline-flex;align-items:center;gap:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.dc-go{flex:0 0 auto;display:inline-flex;align-items:center;gap:4px;font-size:12.5px;font-weight:600;padding:4px 10px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line);color:var(--text)}
[dir="ltr"] .dc-go i{transform:scaleX(-1)}
.dc-go .t2,.dr-card.on .dc-go .t1{display:none}.dr-card.on .dc-go .t2{display:inline-block}
.dr-card.on .dc-go{background:var(--crimson);border-color:var(--crimson);color:#fff}
@media (max-width:1100px){.dr-card{flex-basis:calc((100% - 12px) / 2)}}
@media (max-width:640px){.dr-strip .dr-nav{display:none}.dr-cards{gap:10px}.dr-card{flex-basis:86%;padding:12px;gap:12px}.dc-ph{flex-basis:68px}.dc-ph img,.dc-ini{width:68px;height:78px;font-size:28px}}
.gc-dot{display:inline-block;width:9px;height:9px;border-radius:50%;vertical-align:middle}
.grp-row td{background:var(--surface-2, #f8fafc);font-weight:700}
.gc-panel{margin-top:16px}.gc-panel summary{padding:12px 16px;cursor:pointer;font-weight:700}
.err-box.ok{color:var(--lime-ink, #15803d)}

/* زرار ممنوع بالصلاحية */
.perm-off{opacity:.45;cursor:not-allowed!important;filter:grayscale(1)}

/* التقارير: فلتر العمود زي Excel، المستويات، الطباعة */
.rep-tbl th.flt{cursor:pointer;user-select:none;white-space:nowrap}.rep-tbl th.flt:hover{color:var(--brand, #0f766e)}
.rep-tbl th.flt-on{color:#EA580C!important;background:color-mix(in srgb, #EA580C 10%, transparent)}
.rep-bar{flex-wrap:wrap;gap:10px}
.col-flt{position:fixed;z-index:950;width:260px;background:var(--surface, #fff);border:1px solid var(--line, #e5e7eb);border-radius:12px;box-shadow:0 14px 34px rgba(0,0,0,.18);padding:10px;display:flex;flex-direction:column;gap:8px}
.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}
.col-flt .input{height:32px}
.icon-btn.sm{width:28px;height:28px;font-size:15px}
.pd-tbl .pg-row td{background:#f1f5f9;font-weight:700}.pd-tbl .pt-row td{background:#e2e8f0;font-weight:800}
.rv-nav{margin-bottom:14px}

/* الفاتورة: فتح برقم، فواتير النهارده مجمّعة، الطبيب كشف، أدوات السطر، التنقل */
.go-inv .input{width:140px;height:40px}
.today-tools{display:flex;gap:8px;align-items:center;padding:8px 12px 0;flex-wrap:wrap}.today-tools .input{height:34px;flex:1;min-width:140px}
.chk-sm{display:flex;gap:4px;align-items:center;font-size:12.5px;color:var(--muted, #6b7280);white-space:nowrap}
.today-grp{padding:6px 12px;font-size:12px;font-weight:700;color:var(--muted, #6b7280);background:var(--surface-2, #f8fafc);display:flex;justify-content:space-between}
.today-list .no.kshf{background:var(--lime-ink, #15803d);color:#fff}
.ln-note{color:var(--orange, #c2410c)}.ln-acts{white-space:nowrap}.ln-dr{min-width:120px}
.inv-nav{display:flex;gap:6px;align-items:center;margin-bottom:12px;flex-wrap:wrap}.inv-nav form{display:flex}

.admin-box summary{padding:12px 16px;cursor:pointer;font-weight:700}.admin-box .ab-body{padding:0 16px 16px}
.rv-st{margin:10px 0;padding:8px 12px;border-radius:8px;font-weight:700;text-align:center}.rv-st.ok{background:#dcfce7;color:#15803d}.rv-st.due{background:#fee2e2;color:#b91c1c}.rv-st.over{background:#dbeafe;color:#1d4ed8}
#rDue{width:130px;height:34px;text-align:end}

/* الإنجليزي: الأسهم بتتعكس مع الاتجاه */
html[dir="ltr"] .ti-chevron-right, html[dir="ltr"] .ti-chevron-left, html[dir="ltr"] .ti-chevrons-right, html[dir="ltr"] .ti-chevrons-left,
html[dir="ltr"] .ti-arrow-right, html[dir="ltr"] .ti-arrow-left { display:inline-block; transform: scaleX(-1); }
.lang-btn{font-weight:800;font-size:12px;min-width:30px}
html[dir="ltr"] body{font-family:"IBM Plex Sans Arabic", system-ui, sans-serif}

/* ===== جدول الطبيب: المواعيد الفاضية ، الاعتماد ، شريط الجدول ، شاشة الفترة ===== */
.appt .sl-to { font-size: 11.5px; color: var(--text-3); }
.appt .sl-to:not(:empty)::before { content: "– "; }
.appt.slot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-style: dashed; border-inline-start-style: solid; }
.appt.slot .tm { font-size: 14.5px; }
.appt.slot .sl-lbl { font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.appt.slot.open { --st: #16A34A; background: color-mix(in srgb, #16A34A 5%, var(--surface)); border-color: color-mix(in srgb, #16A34A 35%, var(--line)); }
.appt.slot.open .sl-lbl { color: #15803D; }
.appt.slot.open .sl-go { margin-inline-start: auto; font-size: 12px; font-weight: 800; color: #fff; background: #16A34A; border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 3px; opacity: .85; transition: opacity .15s, transform .15s; }
.appt.slot.open:hover .sl-go { opacity: 1; transform: scale(1.04); }
.appt.slot.shut { --st: #9CA3AF; color: var(--text-3); background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); }
:root[data-theme="dark"] .appt.slot.open .sl-lbl { color: #86EFAC; }
.st-badge.s4 { background: #E7F7EC; color: #15803D; }
.st-badge.s5 { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line); }
:root[data-theme="dark"] .st-badge.s4 { background: #12301D; color: #86EFAC; }
.ok-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 800; color: #0E7490; background: #E0F5FA; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
:root[data-theme="dark"] .ok-tag { color: #7DD3E8; background: #0F2E36; }
.board .col-h .n.free { background: #E7F7EC; color: #15803D; font-size: 11.5px; }
.tbl tr.slot-row td { color: var(--text-3); font-size: 13px; }
.tbl tr.slot-row.s4 td { color: #15803D; background: color-mix(in srgb, #16A34A 4%, transparent); }
.chk-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.chk-line input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--violet); flex: none; }
.chk-line span { display: flex; flex-direction: column; gap: 2px; }
.chk-line b { font-size: 13.5px; } .chk-line small { color: var(--text-3); font-size: 12px; }
.chk-line.dis { opacity: .6; cursor: not-allowed; }
.slot-box { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); border: 1px dashed var(--line); }
.slot-box > i { font-size: 28px; color: var(--text-3); }
.slot-box div { display: flex; flex-direction: column; gap: 3px; } .slot-box small { color: var(--text-3); }

.sch-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 7%, var(--surface)), var(--surface) 60%); }
.sch-bar.hint { color: var(--text-2); font-size: 13.5px; background: var(--surface); }
.sch-ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--violet-50); color: var(--violet); font-size: 21px; flex: none; }
.sch-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.sch-who > div { display: flex; flex-direction: column; } .sch-who b { font-size: 15px; } .sch-who small { color: var(--text-3); font-size: 12.5px; }
.sch-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.sch-stats span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.sch-stats b { font-size: 13px; margin-inline-start: 2px; }
.sch-stats .k-b b { color: var(--violet-d); } .sch-stats .k-o b { color: #15803D; } .sch-stats .k-k b { color: #0E7490; }
.sch-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.btn.okb { color: #0E7490; border-color: color-mix(in srgb, #0E7490 40%, var(--line)); }
.btn.dangerb { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

.pl-top { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 14px; align-items: end; }
.pl-top .field span { display: block; margin-top: 4px; }
.pl-range { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--violet-50); }
.pl-r { display: flex; flex-direction: column; } .pl-r small { font-size: 11px; color: var(--text-3); } .pl-r b { font-size: 14px; }
.pl-r.pick b { color: var(--violet); }
.pl-n { font-size: 12px; font-weight: 800; color: var(--violet-d); background: var(--surface); border-radius: 999px; padding: 2px 9px; }
[dir="ltr"] .pl-mh .icon-btn i { transform: scaleX(-1); }
.pl-presets { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 10px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--violet); color: var(--violet); }
.pl-cal { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pl-mh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; } .pl-mh b { font-size: 14.5px; }
.pl-mh > span { width: 34px; }
.pl-mh .m-only { display: none; }
.pl-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pl-g em { font-style: normal; font-size: 11px; color: var(--text-3); text-align: center; padding: 4px 0; }
.pl-g button { position: relative; height: 40px; border: 0; background: transparent; border-radius: 9px; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.pl-g button:hover { background: var(--surface-2); }
.pl-g button.past { color: var(--text-3); font-weight: 500; }
.pl-g button.today { box-shadow: inset 0 0 0 1.5px var(--violet); }
.pl-g button.in { background: var(--violet-50); border-radius: 0; }
.pl-g button.a, .pl-g button.z { background: var(--violet); color: #fff; border-radius: 9px; }
.pl-g button.in.off:not(.a):not(.z) { background: repeating-linear-gradient(135deg, var(--violet-50) 0 4px, transparent 4px 8px); color: var(--text-3); text-decoration: line-through; }
.pl-g .dots { display: flex; gap: 2px; height: 5px; font-style: normal; }
.dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; }
.dot.b { background: var(--violet); } .dot.o { background: #16A34A; } .dot.c { background: #9CA3AF; }
.pl-g button.a .dot, .pl-g button.z .dot { box-shadow: 0 0 0 1px #fff; }
.pl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin: 10px 0 4px; }
.pl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pl-sec { font-size: 12.5px; font-weight: 800; color: var(--text-2); margin: 16px 0 8px; }
.pl-wd { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-wd button { min-width: 58px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; color: var(--text-3); cursor: pointer; }
.pl-wd button.on { background: var(--violet-50); border-color: var(--violet); color: var(--violet-d); }
.pl-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pl-act { display: flex; gap: 10px; align-items: flex-start; text-align: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pl-act > i { font-size: 20px; color: var(--violet); margin-top: 1px; }
.pl-act span { display: flex; flex-direction: column; gap: 2px; } .pl-act b { font-size: 13.5px; } .pl-act small { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.pl-act:hover { border-color: #CDD1D8; }
.pl-act.on { border-color: var(--violet); box-shadow: 0 0 0 2px color-mix(in srgb, var(--violet) 25%, transparent); background: color-mix(in srgb, var(--violet) 4%, var(--surface)); }
.pl-act.danger > i { color: var(--bad); }
.pl-act.danger.on { border-color: var(--bad); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 22%, transparent); background: color-mix(in srgb, var(--bad) 4%, var(--surface)); }
.pl-prev { margin-top: 14px; }
.pl-msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.pl-msg > i { font-size: 20px; } .pl-msg div { display: flex; flex-direction: column; gap: 3px; } .pl-msg small { color: var(--text-2); font-size: 12px; }
.pl-msg.ok { background: #EEF9F1; border-color: #BFE6CC; } .pl-msg.ok > i { color: #16A34A; }
.pl-msg.warn { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); } .pl-msg.warn > i, .pl-msg.err > i { color: var(--bad); }
:root[data-theme="dark"] .pl-msg.ok { background: #12301D; border-color: #1F5132; }
.pl-foot { display: flex; gap: 8px; margin-top: 16px; position: sticky; bottom: -16px; background: var(--surface); padding: 12px 0; border-top: 1px solid var(--line); }
.pl-notify { display: grid; gap: 8px; }
.pl-pat { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.pl-pat div { display: flex; flex-direction: column; } .pl-pat small { color: var(--text-3); font-size: 12px; }
.pl-pat.sent { background: #EEF9F1; border-color: #BFE6CC; }
.spin { animation: spin 1s linear infinite; display: inline-block; } @keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .pl-cal { grid-template-columns: 1fr; } .pl-cal .pl-m + .pl-m { display: none; }
  .pl-mh .m-only { display: inline-flex; } .pl-mh .m-gap { display: none; }
  .pl-top { grid-template-columns: 1fr; }
  .sch-acts { margin-inline-start: 0; width: 100%; } .sch-acts .btn { flex: 1 1 auto; }
}
/* خانة الوقت 24 ساعة + قرايتها بـ ص / م */
.tm-wrap { position: relative; display: block; }
.tm-wrap .tm-in { padding-inline-end: 64px; font-variant-numeric: tabular-nums; }
.tm-wrap .tm-hint { position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-3); pointer-events: none; white-space: nowrap; }
[dir="rtl"] .tm-wrap .tm-in { text-align: right; }
.tm-wrap .tm-in.bad { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent); }
.tm-wrap .tm-in.bad + .tm-hint { color: var(--bad); position: static; transform: none; display: block; margin-top: 4px; }
/* عرض المرفق: سطر المريض (الاسم · الجنسية · العمر) */
.att-pat { margin-top: 12px; font-size: 15px; color: var(--text); }
.att-pat b { font-weight: 800; }

/* ---------- شاشة الأسنان: راس أوضح، أزرار فوق، مخطط أكبر ---------- */
.th-head { display: block; padding-bottom: 12px; margin: -12px 0 14px; }
.th-row { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.th-row .ph-text { flex: 1 1 260px; }
.th-head .th-name { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-family: var(--display); font-size: 28px; font-weight: 900; line-height: 1.25; color: var(--text); }
.th-head .th-name i { color: var(--violet); font-size: 26px; }
.th-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--text-2); }
.th-facts span { display: inline-flex; align-items: center; gap: 5px; }
.th-facts i { color: var(--violet); font-size: 17px; }
.th-facts b { color: var(--text); font-weight: 800; }
.th-acts { margin-inline-start: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.th-acts .th-grp { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--violet-50); border: 1px solid var(--violet-100); }
.th-acts .th-grp .btn { height: 36px; border-color: transparent; background: var(--surface); }
.th-acts .th-grp .btn:hover { border-color: var(--violet-100); color: var(--violet-d); }
.th-acts .th-grp .ti-brand-whatsapp { color: #1FA855; }
.th-acts .th-grp .ti-file-type-pdf { color: var(--bad); }
.th-acts .btn-save { height: 44px; padding: 0 20px; font-size: 15px; }
.chart-legend { margin-top: 6px; }
.chart-wrap { padding: 10px 18px; }
.tchart { min-width: 900px; }
.tooth { width: 54px; font-size: 14px; }
.tooth svg { width: 38px; height: 48px; }
.tooth.molar svg { width: 46px; }
.tooth small { font-size: 12px; }
.jaw-line { font-size: 12px; }
.tchart.kid { min-width: 760px; }
.tchart.kid .tooth { width: 68px; font-size: 16px; }
.tchart.kid .tooth svg { width: 46px; height: 58px; }
.tchart.kid .tooth.molar svg { width: 56px; }
.tchart.kid .tooth small { font-size: 13px; }
@media (min-width: 721px) and (max-width: 1100px) {
  .chart-wrap { padding: 10px 8px; }
  .jaw { gap: 6px; }
  .jaw .q { gap: 3px; }
  .tchart { min-width: 660px; }
  .tooth { width: 40px; font-size: 13px; }
  .tooth svg { width: 30px; height: 40px; }
  .tooth.molar svg { width: 36px; }
  .tchart.kid { min-width: 600px; }
  .tchart.kid .tooth { width: 58px; font-size: 15px; }
  .tchart.kid .tooth svg { width: 42px; height: 54px; }
  .tchart.kid .tooth.molar svg { width: 50px; }
}
@media (max-width: 720px) {
  .th-head { margin-top: 0; }
  .th-head .th-name { font-size: 22px; }
  .th-facts { font-size: 13.5px; gap: 4px 12px; }
  .th-acts { width: 100%; margin-inline-start: 0; }
  .th-acts .btn-save { display: none; }   /* الحفظ في الشريط اللي تحت الشاشة */
  .th-acts .th-grp { flex: 1; }
  .th-acts .th-grp .btn { flex: 1; padding: 0 8px; }
  .th-acts .th-grp .lbl { display: none; }
  .tchart { min-width: 700px; }
  .tooth { width: 42px; font-size: 12px; }
  .tooth svg { width: 30px; height: 38px; }
  .tooth.molar svg { width: 36px; }
  .tchart.kid { min-width: 560px; }
  .tchart.kid .tooth { width: 52px; font-size: 13px; }
  .tchart.kid .tooth svg { width: 38px; height: 48px; }
  .tchart.kid .tooth.molar svg { width: 44px; }
}

/* كارت خصم الطبيب (الأسنان): سطور أضيق، سبب الخصم أغمق وبولد، والشروط أوضح */
.dis-card .card-head { padding: 9px 16px; }
.dis-card .totals { padding: 6px 14px 10px; }
.dis-card .totals .row { padding: 3px 0; }
.dis-card .totals .row span { font-size: 14px; font-weight: 700; color: var(--text); }
.dis-card .totals .row .input { height: 34px; font-weight: 700; }
.dis-card .totals .row.big { padding: 5px 0; }
.dis-card .totals .row.big b { font-size: 22px; }
.dis-card .field { margin-top: 4px !important; gap: 3px; }
.dis-card .field label { font-size: 14px; font-weight: 700; color: var(--text); }
.dis-card #dReason { height: 38px; font-weight: 700; color: var(--text); border: 1.5px solid #8B84A8; background: var(--surface); }
.dis-card #dReason:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-50); }
.dis-card .rules { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.55; }
/* عدد الكشوفات جنب مفتوحة / مقفولة / الكل */
#fltSeg button b { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 3px; border-radius: 999px; font-size: 11px; line-height: 16px;
  background: var(--line-soft); color: var(--text-2); }
#fltSeg button.on b { background: rgba(255, 255, 255, .25); color: #fff; }
#fltSeg button b:empty { display: none; }
/* زرار «المالية» في نص عنوان كارت المرضى + قايمته */
.ex-head-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.ex-fin { position: relative; }
.ex-fin .btn { height: 32px; gap: 5px; background: var(--surface); border-color: var(--violet-100); color: var(--violet-d); font-weight: 800; }
.ex-fin .btn .ti-chevron-down { font-size: 14px; opacity: .7; }
.ex-fin-menu { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 20; min-width: 170px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); }
.ex-fin-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 700; color: var(--text); cursor: pointer; white-space: nowrap; }
.ex-fin-menu a:hover { background: var(--violet-50); color: var(--violet-d); }
.ex-fin-menu a i { color: var(--violet); font-size: 17px; }

/* خانة التاريخ يوم/شهر/سنة (datebox.js): خانة كتابة + زرار تقويم، والخانة الأصلية مخفية */
.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); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 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); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
.dt-wrap .dt-cal:hover { background: var(--violet-50); }
.dt-wrap .dt-cal:disabled { color: var(--text-3); cursor: default; background: transparent; }
.dt-wrap .dt-native { position: fixed; opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0; min-height: 0; }
/* خصم الاستقبال + خصم الطبيب أكبر من قيمة الفاتورة */
.totals .row .input.bad { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
/* مفيش ملاحظة من الزيارة اللي قبل كده: سطر هادي */
.note-row.muted-note { background: var(--surface-2); border-color: var(--line); color: var(--text-3); font-size: 13px; padding: 7px 12px; }
/* رقم سن غلط في سطور الأسنان */
.teeth-tbl .cell.bad { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }

/* أداء الأطباء: كروت الإجمالي تحت الجدول */
.dp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 14px; }
.dp-kpis .kpi .val { font-size: 24px; }
.dp-kpis .kpi .lbl i { color: var(--k); font-size: 16px; }
.dp-hint { margin: 0 14px 14px; font-size: 12px; line-height: 1.7; }

/* الفاتورة: الأزرار في الراس جنب العنوان (بتبدأ من أول خانة البحث عن المريض) */
.inv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding-bottom: 14px; margin-bottom: 14px; }
.inv-top .ph-text { flex: 0 0 auto; }
.inv-top .page-title { font-size: 32px; }
.inv-bar { flex: 1 1 520px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; justify-content: flex-start; }
.inv-grp { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; }   /* كل مجموعة في سطر واحد على الكمبيوتر */
@media (max-width: 1100px) { .inv-grp { flex-wrap: wrap; } }
.inv-grp .btn { height: 38px; }
.inv-grp .go-inv .input { width: 130px; height: 38px; }
.inv-grp.acts { padding: 4px; border-radius: 12px; background: var(--violet-50); border: 1px solid var(--violet-100); }
.inv-grp.acts .btn:not(.btn-save) { height: 34px; background: var(--surface); border-color: transparent; }
.inv-grp.acts .btn:not(.btn-save):hover { border-color: var(--violet-100); color: var(--violet-d); }
.inv-grp.acts .btn-save { height: 34px; }
.inv-grp.acts .btn.inv-save-tmp { border-color: var(--violet-100); font-weight: 700; }   /* حفظ مؤقت: زرار عادي جنب الأخضر */
.inv-send { display: grid; gap: 8px; } .inv-send .btn { justify-content: flex-start; height: 44px; }
.inv-send .btn small { color: var(--text-3); margin-inline-start: auto; }
.inv-grp.acts .ti-brand-whatsapp { color: #1FA855; }
#invErr:empty { display: none; }
@media (max-width: 720px) {
  .inv-bar { flex-basis: 100%; }
  .inv-grp.nav, .inv-grp.acts { width: 100%; }
  .inv-grp.acts .btn-save, .inv-grp.acts .inv-save-tmp { display: none; }   /* الحفظ في الشريط اللي تحت الشاشة */
  .inv-grp.acts .btn { flex: 1; padding: 0 6px; }
  .inv-grp.acts .lbl { display: none; }
}

/* الفاتورة: كارت الحساب مضغوط (سطور أضيق) + رابط ملف المريض في عنوانه */
.inv-tot .card-head { padding: 8px 14px; }
.inv-tot .tot-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--violet-d); }
.inv-tot .tot-link:hover { text-decoration: underline; }
.inv-tot .totals { padding: 4px 14px 8px; }
.inv-tot .totals .row { padding: 3px 0; }
.inv-tot .totals .row span { font-size: 13.5px; font-weight: 700; color: var(--text); }
.inv-tot .totals .row .input { height: 32px; }
.inv-tot .totals .row.big { padding: 4px 0; }
.inv-tot .totals .row.big b { font-size: 22px; }
.inv-tot .unsaved { margin-top: 4px; padding: 4px 10px; }

/* الفاتورة: شريط «جه بحجز» فوق خانات المريض */
.bk-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 10px 18px 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.bk-strip.on { border: 1px solid #16A34A; background: color-mix(in srgb, #16A34A 8%, var(--surface)); }
.bk-strip .bk-chk { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; cursor: pointer; }
.bk-strip.on .bk-chk { color: #15803D; }
.bk-strip .bk-chk input { width: 17px; height: 17px; accent-color: #16A34A; }
.bk-strip .bk-no b { font-size: 15px; }
.bk-strip .bk-info { flex: 1 1 200px; }
/* زرار حذف الفاتورة: أحمر هادي */
.inv-grp.acts .btn.btn-danger-soft { color: var(--bad); }
.inv-grp.acts .btn.btn-danger-soft:hover { border-color: var(--bad); background: var(--bad-bg); }
/* الشاشة الرئيسية: اسم المنشأة والفرع فوق التحية ، ووظيفة المستخدم جنب اسمه */
.hero { padding: 18px 22px; }
.hero .hero-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.hero .hero-co { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hero .hero-date { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.hero .hero-date > i { font-size: 18px; color: var(--lime); }
.hero .hero-date span { display: flex; flex-direction: column; line-height: 1.35; }
.hero .hero-date b { font-size: 13px; font-weight: 700; color: #fff; }
.hero .hero-date small { font-size: 11.5px; color: #B9B3D6; }
.hero .hero-row { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; }
.hero .hero-row .hi { margin: 0; }
.hero .chips:not(:empty) { margin-top: 14px; }
.hero .co-ic { width: 46px; height: 46px; flex: none; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 28px;
  color: var(--night); background: linear-gradient(135deg, var(--lime), #7FD80F); box-shadow: 0 6px 18px rgba(174, 237, 22, .25); }
.hero .co-tx { min-width: 0; }
.hero .co-n { font-family: var(--display); font-weight: 900; font-size: 27px; line-height: 1.25; letter-spacing: -.2px;
  background: linear-gradient(90deg, #FFFFFF, #E2D9FF 70%, #C9B8FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .co-s { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 3px; font-size: 12.5px; color: #B9B3D6; }
.hero .co-e { letter-spacing: 1.2px; text-transform: uppercase; font-weight: 600; }
.hero .co-f { display: inline-flex; align-items: center; gap: 4px; color: var(--lime); font-weight: 700; }
.hero .hi { font-size: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.hero .job-pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font); font-size: 12.5px; font-weight: 700; line-height: 1;
  padding: 5px 11px; border-radius: 999px; color: #E9E3FF; background: rgba(132, 94, 255, .28); border: 1px solid rgba(186, 166, 255, .35); }
.hero .job-pill i { font-size: 15px; color: var(--lime); }
@media (max-width: 640px) { .hero { padding: 16px; } .hero .co-n { font-size: 21px; } .hero .co-ic { width: 40px; height: 40px; font-size: 21px; } .hero .hi { font-size: 19px; }
  .hero .hero-date { width: 100%; } .hero .acts { width: 100%; } .hero .acts .btn { flex: 1 1 auto; justify-content: center; } }
/* الشاشة الرئيسية للاستقبال: مواعيد وفواتير وأطباء النهارده */
.td-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.td-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1280px) { .td-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .td-grid .td-sec:last-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .td-grid { grid-template-columns: 1fr; } .td-grid .td-sec:last-child { grid-column: auto; }
  .td-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .td-kpis .kpi { padding: 10px 10px 12px; } .td-kpis .kpi .lbl { font-size: 11.5px; }
  .td-kpis .kpi .val { font-size: 24px; } .td-kpis .kpi .delta { display: none; } }
.td-sec { display: flex; flex-direction: column; min-width: 0; }
.td-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.td-pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.td-pill b { margin-inline-start: 3px; font-size: 13px; }
.td-pill.v b { color: var(--violet-d); } .td-pill.g b { color: #15803D; } .td-pill.o b { color: #C2620F; } .td-pill.r b { color: var(--bad); } .td-pill.l b { color: var(--lime-ink); }
.td-body { max-height: 520px; overflow-y: auto; padding: 10px; display: grid; gap: 8px; }
.td-appts { display: grid; gap: 8px; }
.td-inv { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; background: var(--surface); }
.td-inv:hover { border-color: var(--violet); box-shadow: var(--shadow-pop); }
.td-inv .no { font-family: var(--display); font-weight: 800; color: var(--violet-d); min-width: 54px; }
.td-inv .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.td-inv .nm b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-inv .nm small { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-inv .tags { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.td-inv .tags .badge { white-space: nowrap; }
.td-dr { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; background: var(--surface); }
.td-dr:hover { border-color: var(--violet); box-shadow: var(--shadow-pop); }
.td-dr .av { position: relative; width: 52px; height: 52px; flex: none; border-radius: 12px; overflow: hidden; background: var(--violet-50); color: var(--violet-d); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.td-dr .av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.td-dr .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.td-dr .tx b { line-height: 1.35; }
.td-dr .tx small { color: var(--text-3); font-size: 12px; }
.td-dr .nums { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.td-dr .nums i { font-style: normal; font-size: 12px; color: var(--text-2); }
.td-dr .nums b { color: var(--text); }
.td-dr .st { flex: none; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 9px; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line); }
.td-dr .st.on { background: #E7F7EC; color: #15803D; border-color: #BFE6CC; }
:root[data-theme="dark"] .td-dr .st.on { background: #12301D; color: #86EFAC; border-color: #1F5132; }
/* كروت الملخص في رئيسية الاستقبال: العنوان والسطر الباهت تحته يمين ، والرقم في نفس السطر على الشمال — أقصر */
@media (min-width: 761px) {
  .td-kpis .kpi { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 12px; row-gap: 2px; padding: 12px 16px; min-height: 0; }
  .td-kpis .kpi .lbl { grid-column: 1; grid-row: 1; font-size: 13.5px; }
  .td-kpis .kpi .delta { grid-column: 1; grid-row: 2; margin: 0; }
  .td-kpis .kpi .val { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 32px; line-height: 1; }
}
/* رئيسية الاستقبال: خط أكبر والسطر التاني بلون واضح (كان باهت وصغير) */
.td-kpis .kpi .lbl { font-size: 14px; font-weight: 700; color: var(--text); }
.td-kpis .kpi .delta { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.td-pill { font-size: 12.5px; color: var(--text); }
.td-pill b { font-size: 13.5px; }
.td-inv .no { font-size: 15px; }
.td-inv .nm b { font-size: 15px; }
.td-inv .nm small { font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: normal; overflow: visible; }
.td-dr .tx b { font-size: 15.5px; }
.td-dr .tx small { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.td-dr .nums i { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.td-dr .nums b { font-size: 13.5px; color: var(--violet-d); }
.td-dr .st { font-size: 12px; }
.td-body .appt .tm { font-size: 17px; }
.td-body .appt .who { font-size: 15px; }
.td-body .appt .meta { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.td-body .appt .sl-to { color: var(--text-2); font-size: 12.5px; }
:root[data-theme="dark"] .td-inv .nm small, :root[data-theme="dark"] .td-dr .tx small, :root[data-theme="dark"] .td-dr .nums i, :root[data-theme="dark"] .td-body .appt .meta { color: #C9C4DE; }
/* أزرار الفاتورة: 5 فوق (المرفقات / المواعيد / طباعة / عرض / واتساب) و5 تحت (جديدة / حفظ مؤقت / سند قبض / حفظ واعتماد / مريض جديد) — فوق بعض بنفس العرض */
.inv-bar { flex: 1 1 560px; max-width: 760px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.inv-grp, .inv-grp.nav, .inv-grp.acts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 5px; border-radius: 12px; }
.inv-grp.nav { background: var(--surface-2); border: 1px solid var(--line); }
.inv-grp .btn, .inv-grp.acts .btn, .inv-grp.acts .btn:not(.btn-save), .inv-grp.acts .btn-save { width: 100%; height: 38px; padding: 0 8px; justify-content: center; font-weight: 700; white-space: nowrap; min-width: 0; }
.inv-grp .btn kbd { display: none; }
@media (min-width: 1300px) { .inv-grp .btn kbd { display: inline-block; } }
.inv-grp.nav .btn { background: var(--surface); border-color: transparent; }
.inv-grp.nav .btn:hover:not(:disabled) { border-color: var(--violet-100); color: var(--violet-d); }
.inv-grp.nav .ti-brand-whatsapp { color: #1FA855; }
.inv-grp.acts .btn.inv-newpat { background: #FFF1E0; border-color: #F8C78F; color: #B45309; }
.inv-grp.acts .btn.inv-newpat:hover { background: #FFE4C2; border-color: #F0A956; color: #92400E; }
:root[data-theme="dark"] .inv-grp.acts .btn.inv-newpat { background: #3A2410; border-color: #7A4A17; color: #FBBF77; }
.inv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.inv-tools .go-inv .input { width: 150px; height: 34px; }
.inv-tools .inv-final { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 720px) {
  .inv-bar { max-width: none; flex-basis: 100%; }
  .inv-grp, .inv-grp.nav, .inv-grp.acts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .inv-grp .lbl { display: none; }
  .inv-grp.acts .btn-save, .inv-grp.acts .inv-save-tmp { display: inline-flex; }   /* الحفظ ظاهر في الشبكة كمان (أيقونة بس) */
  .inv-grp.acts .btn-save, .inv-grp.acts .inv-save-tmp { font-size: 0; } .inv-grp.acts .btn-save i, .inv-grp.acts .inv-save-tmp i { font-size: 18px; }
}
/* أزرار الفاتورة تحت العنوان (مش جنبه على الشمال) — بتبدأ من اليمين زي العنوان */
.inv-top { flex-direction: column; align-items: stretch; }
.inv-top .inv-bar { flex: 0 0 auto; width: 100%; max-width: 820px; }
/* «فتح فاتورة رقم» والأزرار اللي بتظهر أحيانًا على نفس سطر العنوان (توفير مساحة) */
.inv-top .ph-text { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: center; }
.inv-top .ph-text .eyebrow { grid-row: 1; grid-column: 1 / -1; }
.inv-top .ph-text .page-title { grid-row: 2; grid-column: 1; }
.inv-top .ph-text .inv-tools { grid-row: 2; grid-column: 2; margin-top: 0; }
.inv-top .ph-text .page-sub { grid-row: 3; grid-column: 1 / -1; }
@media (max-width: 720px) {
  .inv-top .ph-text { display: block; }
  .inv-top .ph-text .inv-tools { margin-top: 8px; }
}
/* «فتح فاتورة رقم» في سطر «المريض» جنب البحث (الجزء العلوي فاضي للعنوان والأزرار) */
.card-head .go-inv { position: relative; order: 5; flex: 0 0 170px; }
.card-head .go-inv i { position: absolute; inset-inline-start: 11px; top: 11px; color: var(--violet); pointer-events: none; }
.card-head .go-inv .input { width: 100%; height: 40px; padding-inline-start: 34px; background: var(--surface); text-align: right; }
.card-head:not(:has(.pat-search)) .go-inv { margin-inline-start: auto; }
.inv-tools:not(:has(*)) { display: none; }
@media (max-width: 720px) { .card-head .go-inv { flex: 1 1 100%; } }
.card-head .go-inv { flex: 0 0 240px; }
.card-head .go-inv .input { padding: 0 36px 0 12px; }
@media (max-width: 720px) { .card-head .go-inv { flex: 1 1 100%; } }
/* «جه بحجز» في سطر «المريض» قبل البحث ، والبحث أصغر — الحقول تحت بتطلع لفوق */
.card-head .bk-strip { margin: 0; padding: 0 12px; height: 40px; flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; gap: 12px; }
.card-head .bk-strip .bk-info { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.card-head .bk-strip .bk-no { white-space: nowrap; }
.card-head .pat-search { flex: 1 1 200px; max-width: 290px; }
@media (max-width: 720px) {
  .card-head .bk-strip { flex: 1 1 100%; order: 1; }
  .card-head .pat-search { max-width: none; }
}
.card-head .bk-strip { margin-inline-start: auto; }
.card-head .pat-search, .card-head:not(:has(.pat-search)) .go-inv { margin-inline-start: 0; }
.card-head .bk-strip:not(.on) .bk-no, .card-head .bk-strip:not(.on) .bk-info { display: none; }
.card-head .bk-strip .bk-info { max-width: 170px; }
.card-head .pat-search { flex-basis: 180px; }
.card-head .bk-strip .bk-chk { white-space: nowrap; }
.card-head .bk-strip:not(.on) .bk-no { display: none; }
.card-head .pat-search { min-width: 170px; }
.card-head .go-inv { flex: 0 1 240px; min-width: 150px; }
.bk-line { margin: 8px 18px 0; padding: 6px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; color: var(--text-2); }
.bk-line:empty { display: none; }
#bkRow.on ~ * .bk-line, .card:has(#bkRow.on) .bk-line { background: color-mix(in srgb, #16A34A 8%, var(--surface)); color: #15803D; }
@media (max-width: 720px) { .card-head .go-inv { flex: 1 1 100%; } }
/* أزرار الفاتورة على الشمال فوق ، على نفس مستوى العنوان */
.inv-top { flex-direction: row; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
.inv-top .inv-bar { flex: 0 1 760px; width: auto; max-width: 760px; margin-inline-start: auto; }
@media (max-width: 720px) { .inv-top .inv-bar { flex-basis: 100%; max-width: none; } }
/* العنوان («فاتورة جديدة») على الشمال فوق ، والأزرار مكانه على اليمين */
.inv-top .inv-bar { order: 1; margin-inline-start: 0; }
.inv-top .ph-text { order: 2; margin-inline-start: auto; }
@media (max-width: 720px) { .inv-top .ph-text { order: 0; margin-inline-start: 0; } }
@media (min-width: 721px) {
  .inv-top { flex-wrap: nowrap; }
  .inv-top .inv-bar { flex: 1 1 760px; min-width: 0; }
  .inv-top .ph-text { flex: 0 0 auto; }
}
@media (min-width: 721px) and (max-width: 1250px) {
  .inv-top .page-title { font-size: 24px; }
  .inv-grp .btn { padding: 0 4px; gap: 4px; font-size: 13px; }
}
/* الفاتورة: كارت المريض والزيارة أقصر عشان الخدمات تبان من غير نزول */
@media (min-width: 721px) {
  .inv-top { padding-bottom: 10px; margin-bottom: 10px; }
  #hf .card-head { padding: 7px 16px; }
  #hf .form-grid.pad { padding: 8px 16px 10px; gap: 6px 12px; }
  #hf .field { gap: 2px; }
  #hf .field label { font-size: 11.5px; }
  #hf .input, #hf .select { height: 34px; }
  #hf .seg button { padding: 4px 12px; }
  #hf .flags { padding: 0 16px 8px; }
  #hf .card-head .bk-strip, #hf .card-head .go-inv .input, #hf .card-head .pat-search .input { height: 34px; }
  #hf .card-head .go-inv i, #hf .card-head .pat-search i { top: 8px; }
  #hf .bk-line { margin: 6px 16px 0; padding: 4px 12px; }
}
/* الفاتورة: عناوين الخانات أكبر وأوضح */
#hf .field label { font-size: 13.5px; font-weight: 700; color: var(--text); }
@media (min-width: 721px) { #hf .field label { font-size: 13.5px; } }
#hf .flags { font-size: 14px; font-weight: 600; }
.inv-lines th { font-size: 13.5px; }
/* خانة مقفولة (زي الجنسية اللي بتيجي من الهوية) باينة إنها مقفولة */
.select:disabled { background-color: var(--surface-2); color: var(--text); opacity: 1; cursor: not-allowed; }
/* الصف التحتاني بيتقسم على عدد الأزرار اللي ظاهرة (5 أو 6) بنفس العرض الكلي للصف اللي فوق */
.inv-grp.acts { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.inv-grp.acts .btn.inv-pfile { background: var(--violet-50); border-color: var(--violet-100); color: var(--violet-d); }
.inv-grp.acts .btn.inv-pfile:hover { border-color: var(--violet); }
/* أزرار الفاتورة بعرض ثابت (مش بتضيق لما يزيد زرار): الصف التحتاني بيكمل لجنب تحت العنوان */
@media (min-width: 721px) {
  .inv-top { display: grid; grid-template-columns: max-content 1fr; column-gap: 18px; row-gap: 8px; align-items: start; }
  .inv-top .inv-bar { display: contents; }
  .inv-top .inv-grp.nav { grid-column: 1; grid-row: 1; }
  .inv-top .ph-text { grid-column: 2; grid-row: 1; justify-self: end; margin: 0; }
  .inv-top .inv-grp.acts { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .inv-top .inv-grp, .inv-top .inv-grp.nav, .inv-top .inv-grp.acts { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 146px); width: max-content; max-width: 100%; }
}
@media (min-width: 721px) {
  .inv-top { grid-template-columns: minmax(0, 1fr) auto; }
  .inv-top .page-title { white-space: nowrap; }
  .inv-top .inv-grp, .inv-top .inv-grp.nav, .inv-top .inv-grp.acts { width: auto; max-width: 100%; justify-content: start; }
}
/* العنوان واخد ارتفاع الصفين ، فالصف التحتاني لازق في اللي فوقه من غير فراغ */
@media (min-width: 721px) {
  .inv-top .ph-text { grid-row: 1 / 3; align-self: start; }
  .inv-top .inv-grp.acts { grid-column: 1; }
}
@media (min-width: 721px) and (max-width: 1250px) {
  .inv-top .ph-text { grid-row: 1; }
  .inv-top .inv-grp.acts { grid-column: 1 / -1; }
}
/* «الحساب» بيختفي لو مفيش مبالغ ، و«فواتير النهارده» بتطول مكانه (عدد فواتير أكتر قدام الاستقبال) */
.side-panel.no-tot .inv-tot { display: none; }
.side-panel.no-tot .today-list { max-height: 700px; }
/* الإطارين (فوق وتحت) بنفس العرض: عرض الصف التحتاني ، وأزرار الصف اللي فوق بتتوزع عليه بالتساوي */
@media (min-width: 721px) {
  .inv-top .inv-bar { display: grid; grid-column: 1; grid-row: 1 / 3; justify-self: start; align-self: start; width: max-content; max-width: 100%; gap: 8px; }
  .inv-top .inv-grp.nav, .inv-top .inv-grp.acts { grid-column: auto; grid-row: auto; justify-self: stretch; width: auto; max-width: none; }
  .inv-top .inv-grp.nav { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .inv-top .ph-text { grid-row: 1 / 3; }
}
@media (min-width: 721px) and (max-width: 1250px) {
  .inv-top .ph-text { grid-column: 1 / -1; grid-row: 1; }
  .inv-top .inv-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ================================================================ البريد الداخلي */
/* الجرس جنب «هذا الجهاز»: بيظهر ويتهز طول ما فيه بريد وارد ما اتقراش */
.sidebar .db-row { display: flex; align-items: center; gap: 8px; }
.sidebar .db-row .dbpill { flex: 1; min-width: 0; }
.mail-bell { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;
  background: #F5B14C; color: var(--night); text-decoration: none; box-shadow: 0 0 0 0 rgba(245, 177, 76, .6); animation: bellPulse 2s ease-out infinite; }
.mail-bell[hidden] { display: none; }
.mail-bell i { font-size: 21px; transform-origin: 50% 4px; animation: bellRing 2s ease-in-out infinite; }
.mail-bell .n { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #E5322D; color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--night); }
.mail-bell:hover { filter: brightness(1.06); }
.mbar .mail-bell.m { width: 38px; height: 38px; margin-inline-start: auto; }
.mbar .mail-bell.m + .icon-btn { margin-inline-start: 6px; }
@keyframes bellRing { 0%, 50%, 100% { transform: rotate(0); } 5% { transform: rotate(16deg); } 10% { transform: rotate(-14deg); } 15% { transform: rotate(10deg); } 20% { transform: rotate(-8deg); } 25% { transform: rotate(4deg); } 30% { transform: rotate(0); } }
@keyframes bellPulse { 0% { box-shadow: 0 0 0 0 rgba(245, 177, 76, .55); } 70% { box-shadow: 0 0 0 10px rgba(245, 177, 76, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 177, 76, 0); } }
@media (prefers-reduced-motion: reduce) { .mail-bell, .mail-bell i { animation: none; } }
#nav .nav-item .nb { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #E5322D; color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
#nav .nav-item .nb[hidden] { display: none; }

/* الشاشة: القايمة على اليمين والرسالة جنبها */
.mail-shell { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 16px; align-items: start; }
.mail-side { display: flex; flex-direction: column; min-height: 560px; max-height: calc(100vh - 170px); overflow: hidden; }
.mail-tabs { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.mail-tabs .seg { flex: 1; display: flex; }
.mail-tabs .seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mail-filters { padding: 0 14px 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.mail-q { position: relative; }
.mail-q i { position: absolute; inset-inline-start: 11px; top: 11px; color: var(--violet); }
.mail-q .input { padding-inline-start: 36px; }
.mail-dates { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-2); }
.mail-dates label { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 130px; }
.mail-dates .input { height: 34px; flex: 1; min-width: 0; }
.mail-dates .select { height: 34px; flex: 1 1 100%; }
.mail-list { overflow-y: auto; flex: 1; padding: 6px; }
.mail-day { font-size: 12px; font-weight: 800; color: var(--text-3); padding: 10px 10px 4px; }
.mail-it { position: relative; display: flex; gap: 10px; width: 100%; text-align: start; padding: 10px; border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; color: var(--text); }
.mail-it:hover { background: var(--surface-2); }
.mail-it.on { background: var(--violet-50); border-color: var(--violet-100); }
.mail-it .av, .mr-head .av { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: var(--violet-100); color: var(--violet-d); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.mail-it.unread .av { background: var(--violet); color: #fff; }
.mail-it .mi-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mail-it .mi-top { display: flex; align-items: baseline; gap: 8px; }
.mail-it .mi-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 600; }
.mail-it.unread .mi-top b, .mail-it.unread .mi-msg { font-weight: 800; color: var(--text); }
.mail-it .mi-t { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.mail-it .mi-msg { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-it .mi-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.mail-it .mi-tags:empty { display: none; }
.mail-it .tg { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 1px 7px; }
.mail-it .tg.ok { color: #15803D; background: color-mix(in srgb, #16A34A 10%, var(--surface)); }
.mail-it .dot { position: absolute; top: 14px; inset-inline-end: 10px; width: 9px; height: 9px; border-radius: 50%; background: #E5322D; }
.mail-it.unread .mi-t { margin-inline-end: 14px; }

.mail-read { min-height: 560px; padding: 22px 24px; }
.mail-empty { height: 100%; min-height: 500px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--text-2); }
.mail-empty .ic { width: 72px; height: 72px; border-radius: 50%; background: var(--violet-50); color: var(--violet); display: flex; align-items: center; justify-content: center; font-size: 34px; margin-bottom: 6px; }
.mail-empty b { font-size: 17px; color: var(--text); }
.mail-empty .btn { margin-top: 10px; }
.mr-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.mr-head .av.lg { width: 48px; height: 48px; font-size: 16px; }
.mr-who { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.mr-who b { font-size: 17px; }
.mr-who span { color: var(--text-2); font-size: 13.5px; }
.mr-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; color: var(--text-2); }
.mr-meta .badge { display: inline-flex; align-items: center; gap: 4px; }
.mr-body { white-space: pre-wrap; font-size: 16.5px; line-height: 1.9; padding: 18px 2px; color: var(--text); }
.mr-doc { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--violet-50); border: 1px solid var(--violet-100); color: var(--violet-d); text-decoration: none; margin-bottom: 14px; font-weight: 700; }
.mr-doc i { font-size: 20px; }
.mr-doc span:nth-child(2) { flex: 1; }
.mr-doc .go { font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }
.mr-doc:hover { border-color: var(--violet); }
.mr-att { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 14px; }
.mr-att-view { background: var(--surface-2); display: flex; justify-content: center; }
.mr-att-view img { display: block; max-width: 100%; max-height: 460px; object-fit: contain; }
.mr-att-view iframe { width: 100%; height: 480px; border: 0; background: #fff; }
.mr-att-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.mr-acts { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; }

/* كتابة رسالة */
.drawer.mail-dr { width: min(560px, 100vw); }
.mc-sec { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mc-lbl { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: var(--text); }
.mc-lbl i { color: var(--violet); }
.mc-count { margin-inline-start: auto; font-size: 12px; font-weight: 600; color: var(--text-3); }
.mc-count.warn { color: #C2410C; }
.mc-to { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 6px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; color: var(--text); }
.mc-chip .av { width: 26px; height: 26px; border-radius: 50%; background: var(--violet-50); color: var(--violet-d); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.mc-chip.all { padding: 0 12px; }
.mc-chip.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.mc-chip.on .av { background: rgba(255, 255, 255, .25); color: #fff; }
.mc-msg { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.8; font-size: 15px; resize: vertical; }
.mc-doc { display: flex; gap: 8px; }
.mc-doc .select { flex: 0 0 140px; }
.mc-doc .input { flex: 1; }
.mc-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 110px; padding: 14px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text-2); text-align: center; cursor: pointer; font-size: 13px; }
.mc-drop > i { font-size: 30px; color: var(--violet); }
.mc-drop b { color: var(--text); font-size: 14px; }
.mc-drop.over, .mc-drop:focus { border-color: var(--violet); background: var(--violet-50); outline: none; }
.mc-att { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; }
.mc-att img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.mc-att .ic { width: 56px; height: 56px; border-radius: 12px; background: var(--violet-50); color: var(--violet); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.mc-att .ic.pdf { background: #FDECEC; color: #D92D20; }
.mc-att > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mc-att b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-ref { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-inline-start: 3px solid var(--violet); margin-bottom: 14px; }
.mc-ref i { color: var(--violet); margin-top: 3px; }
.mc-ref div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mc-ref b { font-size: 12.5px; color: var(--text-2); }
.mc-ref span { font-size: 14px; color: var(--text); white-space: pre-wrap; }
.mc-foot { display: flex; gap: 8px; margin-top: 6px; }
.mc-foot .btn.primary { flex: 1; height: 44px; font-size: 15px; }

@media (max-width: 900px) {
  .mail-shell { grid-template-columns: 1fr; }
  .mail-read { display: none; }
  .mail-side { max-height: none; min-height: 0; }
  .mr-meta { align-items: flex-start; }
}
/* رسالة جديدة لسه واصلة: الجرس بيتهز أقوى ويلمع كام ثانية */
.mail-bell.fresh { animation: bellGlow .9s ease-in-out 4; background: #FFC24D; }
.mail-bell.fresh i { animation: bellShake .6s ease-in-out 6; }
@keyframes bellShake { 0%, 100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-22deg) scale(1.15); } 40% { transform: rotate(20deg) scale(1.15); } 60% { transform: rotate(-14deg) scale(1.1); } 80% { transform: rotate(10deg) scale(1.05); } }
@keyframes bellGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 194, 77, .7); } 50% { box-shadow: 0 0 0 8px rgba(255, 194, 77, .15), 0 0 18px 4px rgba(255, 194, 77, .55); } }
@media (prefers-reduced-motion: reduce) { .mail-bell.fresh, .mail-bell.fresh i { animation: none; } }

/* ================================================================ تصفير البيانات (ASHRAF) */
.rs-warn { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B; margin-bottom: 14px; }
.rs-warn > i { font-size: 26px; margin-top: 2px; }
.rs-warn div { display: flex; flex-direction: column; gap: 3px; }
.rs-warn b { font-size: 15.5px; }
.rs-warn span { font-size: 13.5px; color: #7F1D1D; }
.rs-warn.sm { margin-bottom: 12px; }
:root[data-theme="dark"] .rs-warn { background: #3B1414; border-color: #7F1D1D; color: #FCA5A5; }
:root[data-theme="dark"] .rs-warn span { color: #FECACA; }
.rs-tools { padding: 14px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.rs-presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.rs-p { height: auto; min-height: 48px; padding: 6px 14px; display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.rs-p small { display: block; font-weight: 600; font-size: 11.5px; color: var(--text-3); margin-inline-start: 2px; }
.rs-p.g1 { background: #FFF7ED; border-color: #FDBA74; color: #9A3412; }
.rs-p.g2 { background: var(--violet-50); border-color: var(--violet-100); color: var(--violet-d); }
.rs-presets .icon-btn { margin-inline-start: auto; align-self: center; }
.rs-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rs-q { position: relative; flex: 1 1 240px; }
.rs-q i { position: absolute; inset-inline-start: 11px; top: 11px; color: var(--violet); }
.rs-q .input { padding-inline-start: 36px; }
.rs-grp { margin-bottom: 12px; overflow: hidden; }
.rs-gh { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.rs-gh .gi { font-size: 22px; }
.rs-gh .gt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rs-gh .gt b { font-size: 15px; }
.rs-gh .gt span { font-size: 12.5px; color: var(--text-2); }
.rs-gh .gn { font-weight: 800; color: var(--text-2); white-space: nowrap; }
.rs-grp.g1 .rs-gh { background: #FFF7ED; } .rs-grp.g1 .gi { color: #EA580C; }
.rs-grp.g2 .rs-gh { background: var(--violet-50); } .rs-grp.g2 .gi { color: var(--violet); }
.rs-grp.g3 .gi, .rs-lock { color: var(--text-3); }
:root[data-theme="dark"] .rs-grp.g1 .rs-gh { background: #3A2410; }
.rs-chk input, .rs-row input { width: 18px; height: 18px; accent-color: #DC2626; cursor: pointer; }
.rs-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.rs-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1.2fr) auto; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13.5px; }
.rs-row:hover { background: var(--surface-2); }
.rs-row.on { background: #FEF2F2; }
:root[data-theme="dark"] .rs-row.on { background: #3B1414; }
.rs-row.locked { cursor: default; opacity: .75; }
.rs-row.empty .tn, .rs-row.empty .tc { color: var(--text-3); }
.rs-row .tn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.rs-row .td { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-row .tc { font-weight: 800; white-space: nowrap; }
.rs-li { color: var(--text-3); }
.rs-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-top: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0, 0, 0, .06); }
.rs-bar #rsSum { flex: 1; min-width: 200px; }
.btn.rs-go { background: #DC2626; border-color: #DC2626; color: #fff; font-weight: 800; height: 44px; padding: 0 18px; }
.btn.rs-go:hover:not(:disabled) { background: #B91C1C; }
.btn.rs-go:disabled { opacity: .45; cursor: not-allowed; }
.rs-cf-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.rs-cf-list div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.rs-cf-list div span:first-child { font-weight: 700; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.rs-cf-chk { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 6px 0 12px; cursor: pointer; }
.rs-cf-chk input { width: 18px; height: 18px; accent-color: #DC2626; }
.rs-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px; text-align: center; }
.rs-done i { font-size: 46px; color: #16A34A; }
.rs-done.part i { color: #EA580C; }
.rs-done b { font-size: 18px; }
@media (max-width: 720px) {
  .rs-rows { grid-template-columns: 1fr; }
  .rs-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .rs-row .td { grid-column: 2 / 3; grid-row: 2; font-size: 12px; }
  .rs-p { flex: 1 1 45%; }
}
/* لوجو المهاب الدائري: خلفيته شفافة فبياخد لون اللي تحته ، ولمعة خفيفة عشان يبان على الخلفية الغامقة */
.sidebar .brand img, .mbar .mbrand img, .auth-brand img { filter: drop-shadow(0 0 6px rgba(255, 255, 255, .18)); }
.sidebar .brand img { height: 50px; }
.mbar .mbrand img { height: 34px; }
.auth-brand img { height: 66px; }
.sidebar .brand img, .mbar .mbrand img, .auth-brand img { filter: brightness(1.35) saturate(1.15) drop-shadow(0 0 5px rgba(255, 255, 255, .16)); }
/* لوجو المهاب بلون واحد بياخد لون الشاشة: الشكل من الماسك والون من --logo-ink (أبيض على الغامق ، بنفسجي على الفاتح) */
.logo-mark { display: inline-block; flex: 0 0 auto; width: 48px; height: 48px; background: var(--logo-ink, currentColor);
  -webkit-mask: url(../assets/logo-mohab-mask.png) center / contain no-repeat; mask: url(../assets/logo-mohab-mask.png) center / contain no-repeat; }
.sidebar .brand .logo-mark { --logo-ink: #fff; width: 50px; height: 50px; }
.mbar .mbrand .logo-mark { --logo-ink: #fff; width: 34px; height: 34px; }
.auth-brand .logo-mark { --logo-ink: #fff; width: 66px; height: 66px; }
.logo-mark.on-light { --logo-ink: var(--violet); }
/* الفاتورة: بيانات المريض والزيارة أكبر وبخط عريض وبلون واضح عشان تتقري بسهولة */
#hf .form-grid .input, #hf .form-grid .select { font-size: 15.5px; font-weight: 700; color: #1E1B4B; border-color: #CFC8F5; background: #FCFBFF; }
#hf .form-grid .input::placeholder { font-weight: 500; color: var(--text-3); font-size: 14px; }
#hf .form-grid .input:focus, #hf .form-grid .select:focus { border-color: var(--violet); background: #fff; box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
#hf .form-grid .input[readonly] { color: #3B3561; background: var(--surface-2); }
#hf .form-grid .select:disabled { color: #3B3561; }
#hf .seg button { font-size: 14.5px; }
@media (min-width: 721px) { #hf .form-grid .input, #hf .form-grid .select { height: 38px; } }
:root[data-theme="dark"] #hf .form-grid .input, :root[data-theme="dark"] #hf .form-grid .select { color: #F1EEFF; background: var(--surface); border-color: #3B3561; }
:root[data-theme="dark"] #hf .form-grid .input[readonly], :root[data-theme="dark"] #hf .form-grid .select:disabled { color: #CFC8F5; }
/* اسم المريض: أكبر وأعرض من باقي الخانات */
#hf .form-grid .input[name="cl_name"] { font-size: 19px; font-weight: 800; color: #120E3A; }
@media (min-width: 721px) { #hf .form-grid .input[name="cl_name"] { height: 44px; } }
:root[data-theme="dark"] #hf .form-grid .input[name="cl_name"] { color: #fff; }
/* جنب الفاتورة: يا «الحساب» يا «فواتير النهارده» — مش الاتنين مع بعض
   الفاتورة فيها مبالغ = الحساب بيظهر وفواتير النهارده بتختفي ، مفيش مبالغ = فواتير النهارده بطول الشاشة كلها */
.side-panel:not(.no-tot) .inv-today { display: none; }
.side-panel.no-tot .inv-today #todayList { max-height: calc(100vh - 250px); min-height: 360px; overflow-y: auto; }
.side-panel.no-tot .inv-today .today-list { max-height: none; overflow: visible; }
@media (max-width: 900px) { .side-panel.no-tot .inv-today #todayList { max-height: 70vh; min-height: 0; } }
/* «الحساب»: الإجمالي موف ، المدفوع أخضر هادي ، الباقي على المريض أحمر لو فيه فلوس (والعنوان أحمر فاتح) — ولو صفر موف */
.inv-tot .totals .row.big span { color: var(--violet-d); }
.inv-tot .totals .row:has([data-t="paid"]) span { color: #4F8A63; }
.inv-tot .totals .row:has([data-t="paid"]) b { color: #3E8E5B; font-size: 16px; }
.inv-tot .totals .row.due b { color: var(--violet-d); }
.inv-tot .totals .row.due span { color: var(--violet); }
.inv-tot .totals .row.due.owing { background: #FEF2F2; border-radius: 10px; padding: 8px 10px; margin: 4px -10px 0; border-bottom: 0; }
.inv-tot .totals .row.due.owing span { color: #F07A7A; font-weight: 700; }
.inv-tot .totals .row.due.owing b { color: #DC2626; font-size: 18px; font-weight: 900; }
:root[data-theme="dark"] .inv-tot .totals .row.due.owing { background: #3B1414; }
:root[data-theme="dark"] .inv-tot .totals .row:has([data-t="paid"]) b { color: #6FCF97; }
/* مدفوعات الفاتورة: كل سند كارت في سطر واحد — المستخدم ، رقم السند والتاريخ ، المبلغ */
.rv-mini { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.rv-mini a.rv-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; white-space: nowrap; transition: border-color .12s, background .12s; }
.rv-mini a.rv-card:hover { border-color: var(--violet); background: var(--violet-50); }
.rv-card .rv-u { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 13px; color: var(--text-2); }
.rv-card .rv-u i { color: var(--violet); font-size: 15px; }
.rv-card .rv-nd { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.rv-card .rv-nd b { color: var(--violet-d); font-size: 13.5px; }
.rv-card .rv-nd b::before { content: '#'; opacity: .6; }
.rv-card .rv-nd i { font-size: 16px; color: #3E8E5B; }
.rv-card .rv-amt { font-size: 15px; font-weight: 900; color: #3E8E5B; min-width: 64px; text-align: left; }
/* «الباقي على المريض» تحت المدفوعات: نفس الأرضية الحمرا الفاتحة اللي في «الحساب» */
.rv-state.due { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 12px 10px; padding: 10px 12px; border: 0; border-radius: 10px;
  background: #FEF2F2; color: #F07A7A; font-size: 13.5px; }
.rv-state.due b { color: #DC2626; font-size: 18px; font-weight: 900; }
:root[data-theme="dark"] .rv-state.due { background: #3B1414; }
.rv-state.ok { margin: 0 12px 10px; border: 0; border-radius: 10px; background: color-mix(in srgb, #16A34A 9%, var(--surface)); color: #3E8E5B; }
/* فواتير النهارده: كل فاتورة كارت (الضغط عليه يفتحها) ، وحرف ملوّن حسب الحالة: باقي = أحمر ، مدفوعة = أخضر ، معتمدة = رمادي */
.inv-today .today-list { display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 10px; }
.inv-today .today-list a.tcard { border: 1px solid var(--line); border-inline-start: 4px solid var(--violet-100); border-radius: 12px; background: var(--surface);
  padding: 9px 10px; box-shadow: 0 1px 2px rgba(20, 16, 60, .04); transition: border-color .12s, background .12s, transform .12s; }
.inv-today .today-list a.tcard:hover { border-color: var(--violet); background: var(--violet-50); transform: translateY(-1px); }
.inv-today .today-list a.tcard.on { border-color: var(--violet); background: var(--violet-50); box-shadow: 0 0 0 2px rgba(124, 92, 255, .18); }
.inv-today .today-list a.tcard.st-due { border-inline-start-color: #EF4444; }
.inv-today .today-list a.tcard.st-paid { border-inline-start-color: #3E8E5B; }
.inv-today .today-list a.tcard.st-final { border-inline-start-color: #9CA3AF; }
.inv-today .today-list a.tcard .nm { font-size: 13.5px; }
.inv-today .today-grp { padding: 10px 14px 2px; }
/* اسم الطبيب فوق فواتيره: كبير وأسود وعريض */
.inv-today .today-grp { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 6px; background: none;
  font-size: 17px; font-weight: 900; color: #0F0B2E; font-family: var(--display); }
.inv-today .today-grp b { font-family: var(--sans, inherit); font-size: 12.5px; font-weight: 800; color: var(--violet-d); background: var(--violet-50); border-radius: 10px; padding: 2px 9px; }
:root[data-theme="dark"] .inv-today .today-grp { color: #fff; }
/* المريض اللي عليه فلوس: الكارت كله بأرضية «الباقي» الحمرا الفاتحة (زي الحساب) ، والاسم والباقي بالأحمر في نفس السطر */
.inv-today .today-list a.tcard.st-due { background: #FEF2F2; border-color: #FCA5A5; border-inline-start-color: #EF4444; }
.inv-today .today-list a.tcard.st-due:hover, .inv-today .today-list a.tcard.st-due.on { background: #FDE4E4; border-color: #F87171; }
.inv-today .today-list a.tcard.st-due .nm { color: #B91C1C; }
.inv-today .today-list a.tcard.st-due .nm small { color: #E07B7B; }
.inv-today .today-list a.tcard.st-due .am { color: #DC2626; font-size: 16px; font-weight: 900; white-space: nowrap; }
.inv-today .today-list a.tcard.st-due .am small { font-size: 11px; font-weight: 700; }
:root[data-theme="dark"] .inv-today .today-list a.tcard.st-due { background: #3B1414; border-color: #7F1D1D; }
:root[data-theme="dark"] .inv-today .today-list a.tcard.st-due .nm { color: #FCA5A5; }
.inv-today .today-list a.tcard .mob { white-space: nowrap; }
.inv-today .today-list a.tcard .mob i { font-size: 12px; margin-inline-end: 2px; }
/* كروت فواتير النهارده أقصر وجنب بعض */
.inv-today .today-list { gap: 4px; padding: 4px 10px 8px; }
.inv-today .today-list a.tcard { padding: 5px 10px; gap: 8px; border-radius: 10px; }
.inv-today .today-list a.tcard .nm { line-height: 1.35; }
.inv-today .today-list a.tcard .nm small { margin-top: 1px; line-height: 1.3; }
.inv-today .today-grp { padding: 10px 14px 4px; }
/* رقم الفاتورة على نفس مستوى اسم المريض ، وتحته علامة «الطبيب كشف» سماعة بيضا على أخضر */
.inv-today .today-list a.tcard { align-items: flex-start; }
.inv-today .today-list a.tcard .no-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 40px; }
.inv-today .today-list a.tcard .no { min-width: 0; font-size: 14px; line-height: 1.35; }
.inv-today .today-list a.tcard .kshf-b { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 22px; border-radius: 7px;
  background: #16A34A; color: #fff; box-shadow: 0 1px 3px rgba(22, 163, 74, .35); }
.inv-today .today-list a.tcard .kshf-b i { font-size: 16px; }
.inv-today .today-list a.tcard .am { align-self: flex-start; line-height: 1.35; }
/* «الحساب»: الأرقام من اليمين جنب عناوينها (عمودين) ، والصفوف اللي فوق أكبر ، والإجمالي والمدفوع والباقي نفس الحجم بالظبط */
.inv-tot .totals .row { display: grid; grid-template-columns: 118px minmax(0, 1fr); justify-content: start; align-items: center; gap: 10px; }
.inv-tot .totals .row > b, .inv-tot .totals .row > .input { justify-self: start; text-align: right; }
.inv-tot .totals .row span { font-size: 14.5px; }
.inv-tot .totals .row b { font-size: 16.5px; }
.inv-tot .totals .row .input { width: 140px; font-size: 16px; font-weight: 700; text-align: right; }
.inv-tot .totals .row.big, .inv-tot .totals .row:has([data-t="paid"]), .inv-tot .totals .row.due { padding-top: 8px; padding-bottom: 8px; }
.inv-tot .totals .row.big b, .inv-tot .totals .row:has([data-t="paid"]) b, .inv-tot .totals .row.due b, .inv-tot .totals .row.due.owing b {
  font-family: var(--display); font-size: 21px; font-weight: 900; }
.inv-tot .totals .row.big span, .inv-tot .totals .row:has([data-t="paid"]) span, .inv-tot .totals .row.due span { font-size: 15px; font-weight: 800; }
.inv-tot .totals .row.due.owing { grid-template-columns: 108px minmax(0, 1fr); }
.inv-tot .totals .row { grid-template-columns: 136px minmax(0, 1fr); }
.inv-tot .totals .row.due.owing { grid-template-columns: 126px minmax(0, 1fr); }
.inv-tot .totals .row span { white-space: nowrap; }
/* مبلغ الكارت: عمود ثابت والرقم بيبدأ من اليمين (الأرقام تحت بعض) */
.inv-today .today-list a.tcard .am { min-width: 68px; justify-content: flex-start; text-align: right; direction: rtl; }
.inv-today .today-list a.tcard .am { min-width: 50px; }
.inv-today .today-list a.tcard { gap: 6px; padding-inline: 8px; }
.inv-today .today-list a.tcard .nm small { font-size: 11px; }
.inv-today .today-list a.tcard .no-col { min-width: 30px; }
.inv-tot button.tot-link { border: 0; background: none; padding: 0; cursor: pointer; font-family: inherit; }

/* ================================================================ ألوان الأزرار حسب الوظيفة — في كل البرنامج
   اللون بييجي من أيقونة الزرار ، فأي زرار بنفس الوظيفة في أي شاشة بياخد نفس اللون:
   حفظ = أخضر (زي «حفظ واعتماد») ، حفظ مؤقت = أخضر فاتح ، فاتورة جديدة = برتقالي ، سند قبض = أصفر ، ملف المريض = موف ،
   فتح-بيانات ملف = برتقالي فاتح ، المرفقات = أزرق ، المواعيد = تركواز ، طباعة = نيلي ، عرض = سماوي ، واتساب = أخضر واتساب */
.btn.btn.btn:has(> .ti-device-floppy), .btn.btn.btn.btn-save { --bb: #16A34A; --bd: #16A34A; --bf: #fff; --bh: #15803D; }
.btn.btn.btn.inv-save-tmp { --bb: #DCFCE7; --bd: #86EFAC; --bf: #166534; --bh: #BBF7D0; }
.btn.btn.btn:has(> .ti-file-plus) { --bb: #F97316; --bd: #F97316; --bf: #fff; --bh: #EA580C; }
.btn.btn.btn:has(> .ti-cash) { --bb: #FEF3C7; --bd: #FCD34D; --bf: #854D0E; --bh: #FDE68A; }
.btn.btn.btn:has(> .ti-folder-open) { --bb: var(--violet-50); --bd: var(--violet-100); --bf: var(--violet-d); --bh: #E9E3FF; }
.btn.btn.btn:has(> .ti-id) { --bb: #FFF1E0; --bd: #F8C78F; --bf: #B45309; --bh: #FFE4C2; }
.btn.btn.btn:has(> .ti-paperclip) { --bb: #EFF6FF; --bd: #93C5FD; --bf: #1D4ED8; --bh: #DBEAFE; }
.btn.btn.btn:has(> .ti-calendar-event) { --bb: #F0FDFA; --bd: #5EEAD4; --bf: #0F766E; --bh: #CCFBF1; }
.btn.btn.btn:has(> .ti-printer) { --bb: #EEF2FF; --bd: #A5B4FC; --bf: #3730A3; --bh: #E0E7FF; }
.btn.btn.btn:has(> .ti-file-search), .btn.btn.btn:has(> .ti-eye) { --bb: #F0F9FF; --bd: #7DD3FC; --bf: #0369A1; --bh: #E0F2FE; }
.btn.btn.btn:has(> .ti-brand-whatsapp) { --bb: #ECFDF5; --bd: #6EE7B7; --bf: #047857; --bh: #D1FAE5; }

.btn.btn.btn:is(:has(> .ti-device-floppy), .btn-save, .inv-save-tmp, :has(> .ti-file-plus), :has(> .ti-cash), :has(> .ti-folder-open), :has(> .ti-id),
  :has(> .ti-paperclip), :has(> .ti-calendar-event), :has(> .ti-printer), :has(> .ti-file-search), :has(> .ti-eye), :has(> .ti-brand-whatsapp)) {
  background: var(--bb); border-color: var(--bd); color: var(--bf); }
.btn.btn.btn:is(:has(> .ti-device-floppy), .btn-save, .inv-save-tmp, :has(> .ti-file-plus), :has(> .ti-cash), :has(> .ti-folder-open), :has(> .ti-id),
  :has(> .ti-paperclip), :has(> .ti-calendar-event), :has(> .ti-printer), :has(> .ti-file-search), :has(> .ti-eye), :has(> .ti-brand-whatsapp)):hover:not(:disabled) {
  background: var(--bh); border-color: var(--bd); color: var(--bf); }
.btn.btn.btn:has(> .ti-brand-whatsapp) > .ti-brand-whatsapp { color: #25D366; }
/* الأزرار الغامقة (حفظ / فاتورة جديدة): أيقونة واختصار الكيبورد بالأبيض */
.btn.btn.btn:is(:has(> .ti-device-floppy), .btn-save, :has(> .ti-file-plus)):not(.inv-save-tmp) i { color: #fff; }
.btn.btn.btn:is(:has(> .ti-device-floppy), .btn-save, :has(> .ti-file-plus)):not(.inv-save-tmp) kbd { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn.btn.btn.inv-save-tmp kbd { background: rgba(22, 101, 52, .1); border-color: rgba(22, 101, 52, .25); color: #166534; }
.btn.btn.btn:disabled, .btn.btn.btn.perm-off { opacity: .5; }
/* الوضع الليلي: نفس الألوان بس أهدى */
:root[data-theme="dark"] .btn.btn.btn:is(.inv-save-tmp, :has(> .ti-cash), :has(> .ti-folder-open), :has(> .ti-id), :has(> .ti-paperclip), :has(> .ti-calendar-event),
  :has(> .ti-printer), :has(> .ti-file-search), :has(> .ti-eye), :has(> .ti-brand-whatsapp)) {
  background: color-mix(in srgb, var(--bd) 16%, var(--surface)); border-color: color-mix(in srgb, var(--bd) 45%, var(--surface)); color: color-mix(in srgb, var(--bd) 70%, #fff); }
/* الفاتورة: عناوين بدرجات لون واحد — بيانات المريض غامق ، الزيارة أفتح ، الخدمات أفتح كتير */
#hf .card-head.ch-pat { background: linear-gradient(135deg, #2A1F6B, #3B2E8F); border-bottom: 0; }
#hf .card-head.ch-pat .card-title, #hf .card-head.ch-pat .card-title i { color: #fff; }
/* الخانات اللي جنب العنوان الغامق: بارزة (3D) — أبيض بظل وحافة فاتحة */
#hf .card-head.ch-pat .bk-strip, #hf .card-head.ch-pat .pat-search .input, #hf .card-head.ch-pat .go-inv .input {
  background: linear-gradient(180deg, #FFFFFF, #F1EEFF); border: 1px solid #fff; border-bottom-color: #C9C0F7;
  box-shadow: 0 3px 0 rgba(10, 6, 40, .35), 0 6px 14px rgba(10, 6, 40, .28), inset 0 1px 0 rgba(255, 255, 255, .9); color: #1E1B4B; }
#hf .card-head.ch-pat .bk-strip { border-style: solid; }
#hf .card-head.ch-pat .bk-strip .bk-chk { color: #1E1B4B; }
#hf .card-head.ch-pat .bk-strip.on { background: linear-gradient(180deg, #F0FDF4, #DCFCE7); border-color: #86EFAC; }
#hf .card-head.ch-pat .pat-search .input:focus, #hf .card-head.ch-pat .go-inv .input:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35), 0 6px 14px rgba(10, 6, 40, .28); }
#hf .card-head.ch-visit { background: linear-gradient(135deg, #5B4BC4, #7262D8); border-bottom: 0; }
#hf .card-head.ch-visit .card-title, #hf .card-head.ch-visit .card-title i { color: #fff; }
.card-head.ch-srv { background: linear-gradient(135deg, #DCD5FF, #E9E4FF); }
.card-head.ch-srv .card-title { color: #2A1F6B; }
:root[data-theme="dark"] .card-head.ch-srv { background: #2B2560; }
:root[data-theme="dark"] .card-head.ch-srv .card-title { color: #E9E4FF; }
/* الخدمات: لو لسه فاضية المساحة صغيرة عشان سطر الإضافة يبان من غير نزول */
.inv-lines tr.ln-empty td { padding: 0; }
.inv-lines tr.ln-empty .empty { padding: 14px 10px; font-size: 13px; flex-direction: row; gap: 8px; justify-content: center; }
.inv-lines tr.ln-empty .empty i { font-size: 20px; margin: 0; }
#hf .card-head .go-inv { flex: 0 1 180px; min-width: 140px; }
#hf .card-head .pat-search { flex: 1 1 220px; max-width: 320px; }
.flags .med-flags { display: inline-flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.flags .med-flags[hidden] { display: none; }
/* بيانات المريض في الفاتورة: الاسم في سطر لوحده ، والست خانات الصغيرة في سطر واحد — للعرض بس (التعديل من «فتح-بيانات ملف») */
#hf .pat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#hf .pat-grid .pat-name { grid-column: 1 / -1; }
#hf .pat-grid .input[readonly], #hf .pat-grid .select:disabled { background: #FCFBFF; color: #1E1B4B; cursor: default; opacity: 1; }
#hf .pat-grid .input[name="cl_name"]::placeholder { font-size: 14px; font-weight: 600; }
#hf .pat-grid .select:disabled { -webkit-appearance: none; appearance: none; background-image: none; padding-inline-end: 10px; }
:root[data-theme="dark"] #hf .pat-grid .input[readonly], :root[data-theme="dark"] #hf .pat-grid .select:disabled { background: var(--surface); color: #F1EEFF; }
@media (max-width: 1100px) { #hf .pat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { #hf .pat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#hf .pat-grid .field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* الهوية والجوال أعرض (10 أرقام) ، النوع والعمر أضيق */
#hf .pat-grid { grid-template-columns: 1.45fr 1.05fr 1.45fr 0.85fr 1fr 0.7fr; column-gap: 10px; }
#hf .pat-grid .input:not([name="cl_name"]), #hf .pat-grid .select { padding-inline: 8px; }
@media (max-width: 1100px) { #hf .pat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { #hf .pat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* «جه بحجز» في نفس سطر بيانات المريض ، والهوية والجوال أضيق */
#hf .pat-grid { grid-template-columns: 1.15fr 0.95fr 1.15fr 0.75fr 0.9fr 0.6fr 1.2fr; }
#hf .pat-grid .bk-strip { margin: 0; height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap;
  border: 1px solid #CFC8F5; border-radius: 10px; background: #FCFBFF; font-size: 14px; }
#hf .pat-grid .bk-strip .bk-chk { font-weight: 800; color: #1E1B4B; }
#hf .pat-grid .bk-strip:not(.on) .bk-no { display: none; }
#hf .pat-grid .bk-strip.on { border-color: #16A34A; background: color-mix(in srgb, #16A34A 9%, #fff); }
#hf .pat-grid .bk-strip.on .bk-chk { color: #15803D; }
#hf .pat-grid .bk-strip .bk-no b { font-size: 14px; }
@media (max-width: 1100px) { #hf .pat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { #hf .pat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#hf .card-head.ch-pat .pat-search { margin-inline-start: auto; }
/* «آخر زيارة · رصيد المريض» في بيانات الزيارة جنب نوع الزيارة ، وسطر التنبيهات الطبية بيختفي لو فاضي */
#hf .vis-info .vis-box { min-height: 38px; display: flex; align-items: center; padding: 0 10px; border: 1px dashed #CFC8F5; border-radius: 10px;
  background: #FCFBFF; font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hf .vis-info .vis-box:empty::before { content: '—'; color: var(--text-3); }
#hf .flags:not(:has(.med-flags:not([hidden]))) { display: none; }
#hf .vis-info .vis-box.owing { background: #FEF2F2; border: 1px solid #FCA5A5; color: #B91C1C; }
#hf .vis-info .vis-box.owing b { color: #DC2626 !important; font-weight: 900; }
:root[data-theme="dark"] #hf .vis-info .vis-box.owing { background: #3B1414; border-color: #7F1D1D; color: #FCA5A5; }
/* سطر الزيارة: التاريخ · الطبيب · نوع الزيارة · آخر زيارة والرصيد — في سطر واحد */
@media (min-width: 900px) { #hf .ch-visit + .form-grid { grid-template-columns: 1fr 1.3fr 1fr 1.25fr; } }
#hf .vis-info .vis-box { display: block; line-height: 36px; }
#hf .vis-info .vis-box { white-space: normal; line-height: 1.35; padding: 4px 10px; font-size: 12.8px; min-height: 38px; display: flex; flex-wrap: wrap; align-content: center; gap: 0 4px; }
@media (min-width: 900px) { #hf .ch-visit + .form-grid { grid-template-columns: 0.95fr 1.2fr 0.95fr 1.45fr; } }
/* مدفوعات الفاتورة: من غير سطر «الباقي» (موجود في الحساب) ، والقايمة بتطول للسندات الكتير */
.side-panel .rv-mini { max-height: 60vh; overflow-y: auto; }
/* «فتح فاتورة رقم» تحت عنوان الفاتورة (تحت التاريخ ورقم الدخول والمستخدم) */
.inv-tools .go-inv { position: relative; flex: 0 0 200px; }
.inv-tools .go-inv i { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--violet); pointer-events: none; }
.inv-tools .go-inv .input { width: 100%; height: 36px; padding: 0 34px 0 10px; text-align: right; font-weight: 700; background: var(--surface); border-color: #CFC8F5; }
.inv-tools .go-inv .input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
.inv-top .ph-text .inv-tools { grid-row: 4; grid-column: 1 / -1; margin-top: 8px; }
/* البحث عن المريض: شريط لطيف فوق «بيانات المريض» — أبيض بارز بظل ، أيقونة بنفسجي ، وبيلمع لما تكتب */
.inv-layout .pat-find { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.inv-layout .pat-find .pat-search { position: relative; flex: 1 1 360px; max-width: 560px; margin: 0; }
.inv-layout .pat-find .pat-search i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); font-size: 19px; color: var(--violet); pointer-events: none; }
.inv-layout .pat-find .pat-search .input { height: 46px; padding-inline-start: 44px; border-radius: 14px; font-size: 15px; font-weight: 600;
  background: linear-gradient(180deg, #FFFFFF, #F7F5FF); border: 1px solid #D9D2FB; color: #1E1B4B;
  box-shadow: 0 2px 0 rgba(42, 31, 107, .08), 0 8px 20px rgba(42, 31, 107, .10); transition: box-shadow .15s, border-color .15s; }
.inv-layout .pat-find .pat-search .input::placeholder { color: #8F86C9; font-weight: 600; }
.inv-layout .pat-find .pat-search .input:focus { border-color: var(--violet); background: #fff; box-shadow: 0 0 0 4px rgba(124, 92, 255, .16), 0 8px 20px rgba(42, 31, 107, .12); }
:root[data-theme="dark"] .inv-layout .pat-find .pat-search .input { background: var(--surface); border-color: #3B3561; color: #F1EEFF; box-shadow: none; }
.inv-layout .pat-find .pat-none { margin: 0; }
/* البحث تحت صفّين الأزرار في الهيدر (مش فوق الكارت) — أقصر شوية عشان الفاتورة تطلع لفوق */
.inv-top .inv-bar .pat-find { margin: 2px 0 0; }
.inv-top .inv-bar .pat-find .pat-search { flex: 1 1 100%; max-width: none; }
.inv-top .inv-bar .pat-find .pat-search .input { height: 40px; border-radius: 12px; font-size: 14.5px; }
.inv-top { padding-bottom: 8px; margin-bottom: 10px; }
.inv-top .pat-find { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inv-top .pat-find .pat-search { position: relative; }
.inv-top .pat-find .pat-search i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); font-size: 19px; color: var(--violet); pointer-events: none; }
.inv-top .pat-find .pat-search .input { width: 100%; padding-inline-start: 44px; font-weight: 600;
  background: linear-gradient(180deg, #FFFFFF, #F7F5FF); border: 1px solid #D9D2FB; color: #1E1B4B;
  box-shadow: 0 2px 0 rgba(42, 31, 107, .08), 0 8px 20px rgba(42, 31, 107, .10); transition: box-shadow .15s, border-color .15s; }
.inv-top .pat-find .pat-search .input::placeholder { color: #8F86C9; font-weight: 600; }
.inv-top .pat-find .pat-search .input:focus { border-color: var(--violet); background: #fff; box-shadow: 0 0 0 4px rgba(124, 92, 255, .16), 0 8px 20px rgba(42, 31, 107, .12); }
:root[data-theme="dark"] .inv-top .pat-find .pat-search .input { background: var(--surface); border-color: #3B3561; color: #F1EEFF; box-shadow: none; }
.inv-top .pat-find .pat-none { margin: 0; }
/* بيانات المريض كلها في سطر واحد على الشاشة الكبيرة: الاسم · الهوية · الملف · الجوال · النوع · الجنسية · العمر · الحجز */
@media (min-width: 1351px) {
  #hf .pat-grid { grid-template-columns: 2fr 1.25fr 0.85fr 1.25fr 0.65fr 0.85fr 0.5fr 0.95fr; column-gap: 8px; }
  #hf .pat-grid .pat-name { grid-column: auto; }
  #hf .pat-grid .input:not([name="cl_name"]), #hf .pat-grid .select { font-size: 13.5px; padding-inline: 6px; }
  #hf .form-grid .input[name="cl_name"] { font-size: 16.5px; height: 38px; text-overflow: ellipsis; }
  #hf .pat-grid .field label { font-size: 12px; }
  #hf .pat-grid .bk-strip { padding: 0 6px; gap: 5px; font-size: 13px; }
  #hf .pat-grid .bk-strip .bk-chk i { display: none; }
}
@media (min-width: 1351px) { #hf .pat-grid { grid-template-columns: 1.75fr 1.22fr 1fr 1.22fr 0.6fr 0.8fr 0.5fr 1.08fr; } }
@media (min-width: 1351px) {
  #hf .pat-grid { grid-template-columns: 1.95fr 1.15fr 0.95fr 1.15fr 0.55fr 0.95fr 0.45fr 1.02fr; }
  #hf .form-grid .input[name="cl_name"] { font-size: 15.5px; }
}
@media (min-width: 1351px) {
  #hf .pat-grid { grid-template-columns: 1.95fr 1.22fr 0.9fr 1.22fr 0.55fr 0.85fr 0.45fr 1fr; }
  #hf .pat-grid .input[name="id"], #hf .pat-grid .input[name="pation_mobil"] { font-size: 13px; padding-inline: 5px; letter-spacing: -.2px; }
}
/* الاسم أعرض (أهم حاجة لموظف الاستقبال) ، والهوية والملف والجوال والجنسية أضيق */
@media (min-width: 1351px) {
  #hf .pat-grid { grid-template-columns: 2.6fr 1.06fr 0.8fr 1.06fr 0.55fr 0.86fr 0.45fr 1fr; }
  #hf .pat-grid .input[name="id"], #hf .pat-grid .input[name="pation_mobil"], #hf .pat-grid .input[name="file_no"] { font-size: 12.5px; padding-inline: 4px; letter-spacing: -.25px; }
  #hf .pat-grid .select[name="pation_gensial"] { font-size: 12.5px; padding-inline: 4px; }
  #hf .form-grid .input[name="cl_name"] { font-size: 17px; }
}
/* عروض ثابتة على قد المحتوى للخانات الصغيرة ، والباقي كله للاسم */
@media (min-width: 1351px) {
  #hf .pat-grid { grid-template-columns: minmax(0, 1fr) 86px 64px 86px 46px 78px 38px 80px; column-gap: 6px; }
}
@media (min-width: 1351px) { #hf .form-grid.pat-grid { column-gap: 6px; } }
/* الاسم حوالي تلتين عرضه اللي فات ، والخانات التانية أعرض وخطها أكبر */
@media (min-width: 1351px) {
  #hf .form-grid.pat-grid { grid-template-columns: minmax(0, 1fr) 100px 78px 100px 56px 92px 52px 101px; }
  #hf .pat-grid .input[name="id"], #hf .pat-grid .input[name="pation_mobil"], #hf .pat-grid .input[name="file_no"],
  #hf .pat-grid .input[name="pation_age"], #hf .pat-grid .select { font-size: 14.5px; padding-inline: 6px; letter-spacing: 0; }
  #hf .pat-grid .bk-strip { font-size: 14px; }
  #hf .form-grid .input[name="cl_name"] { font-size: 17px; }
}
@media (min-width: 1351px) {
  #hf .form-grid.pat-grid { grid-template-columns: minmax(0, 1fr) 96px 72px 96px 50px 84px 46px 96px; }
  #hf .pat-grid .input[name="id"], #hf .pat-grid .input[name="pation_mobil"] { font-size: 14px; padding-inline: 5px; }
}
@media (min-width: 1351px) { #hf .form-grid.pat-grid { grid-template-columns: minmax(0, 1fr) 96px 76px 96px 46px 80px 46px 96px; } }
/* كل الخانات بتكبر مع الشاشة بنسبة: الاسم حوالي ضعف الهوية ، والهوية والملف والجوال أعرض — مع أقل عرض لكل خانة عشان ما تتقصش */
@media (min-width: 1351px) {
  #hf .form-grid.pat-grid { grid-template-columns: minmax(120px, 2.2fr) minmax(96px, 1.4fr) minmax(76px, 1.15fr) minmax(96px, 1.4fr)
    minmax(46px, 0.7fr) minmax(80px, 1fr) minmax(46px, 0.6fr) minmax(96px, 1.15fr); }
}
/* لوحة نتايج البحث عن المريض: عناوين أعمدة ، كل مريض سطر ، الجزء المطابق متعلّم ، اللي عليه رصيد بالأحمر الفاتح */
.pat-search .pat-dd { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 60; width: max(100%, 760px); max-width: calc(100vw - 40px);
  background: var(--surface); border: 1px solid #D9D2FB; border-radius: 14px; box-shadow: 0 18px 44px rgba(20, 14, 70, .22); overflow: hidden; }
.pat-dd .pd-h, .pat-dd .pd-r { display: grid; grid-template-columns: minmax(0, 2.2fr) 0.9fr 1.15fr 1.15fr 0.85fr 0.5fr 0.85fr; gap: 8px; align-items: center; padding: 0 14px; text-align: right; }
.pat-dd .pd-h { height: 34px; background: linear-gradient(135deg, #2A1F6B, #3B2E8F); color: #fff; font-size: 12.5px; font-weight: 800; }
.pat-dd .pd-list { max-height: min(62vh, 520px); overflow-y: auto; }
.pat-dd .pd-r { width: 100%; min-height: 42px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; cursor: pointer; font-size: 14px; color: var(--text); font-family: inherit; }
.pat-dd .pd-r:nth-child(even) { background: #FBFAFF; }
.pat-dd .pd-r:hover, .pat-dd .pd-r.on { background: var(--violet-50); box-shadow: inset 4px 0 0 var(--violet); }
[dir="rtl"] .pat-dd .pd-r:hover, [dir="rtl"] .pat-dd .pd-r.on { box-shadow: inset -4px 0 0 var(--violet); }
.pat-dd .pd-r .nm { font-weight: 800; color: #1E1B4B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pat-dd .pd-r span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pat-dd .pd-r .bal { font-weight: 800; color: #3E8E5B; }
.pat-dd .pd-r.owing { background: #FEF2F2; }
.pat-dd .pd-r.owing .nm, .pat-dd .pd-r.owing .bal { color: #DC2626; }
.pat-dd .pd-r.owing.on, .pat-dd .pd-r.owing:hover { background: #FDE4E4; }
.pat-dd mark { background: #FDE68A; color: inherit; border-radius: 3px; padding: 0 1px; }
.pat-dd .pd-msg { padding: 16px; color: var(--text-2); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pat-dd .pd-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
:root[data-theme="dark"] .pat-dd .pd-r:nth-child(even) { background: rgba(255, 255, 255, .02); }
:root[data-theme="dark"] .pat-dd .pd-r .nm { color: #F1EEFF; }
:root[data-theme="dark"] .pat-dd .pd-r.owing { background: #3B1414; }
.pat-dd .pd-h, .pat-dd .pd-r { grid-template-columns: minmax(0, 2.1fr) 0.85fr 1.1fr 1.1fr 0.8fr 1.35fr 0.8fr; }
.pat-dd .pd-r .dr { color: var(--text-2); font-size: 13px; }
.pat-search .pat-dd { z-index: 400; }
.inv-top { position: relative; z-index: 5; }
/* زرار لغة الكتابة جوه خانة البحث (ع / EN) */
.pat-search .kb-lang { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); height: 26px; min-width: 34px; padding: 0 8px;
  border: 1px solid #D9D2FB; border-radius: 8px; background: var(--violet-50); color: var(--violet-d); font-weight: 900; font-size: 13px; cursor: pointer; font-family: inherit; }
.pat-search .kb-lang.en { font-family: var(--display); font-size: 12px; letter-spacing: .5px; }
.pat-search .kb-lang:hover { border-color: var(--violet); }
.inv-top .pat-find .pat-search .input { padding-inline-end: 52px; }
/* زرار «ع / 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); color: var(--violet-d); 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-family: var(--display); font-size: 11px; letter-spacing: .4px; }
.kb-float:hover { opacity: 1; border-color: var(--violet); }
.kb-float[hidden] { display: none; }
/* خانات بيانات المريض في الفاتورة (هوية · ملف · جوال · نوع · جنسية · عمر): الكتابة في نص الخانة */
#hf .pat-grid .input:not([name="cl_name"]) { text-align: center; }
#hf .pat-grid .select { text-align: center; text-align-last: center; }
/* عناوين خانات المريض والزيارة في النص (والقيم في النص كمان) — الاسم والملاحظات زي ما هم */
#hf .pat-grid .field:not(.pat-name) > label, #hf .vis-grid .field:not(.vis-note) > label { text-align: center; display: block; }
#hf .vis-grid .input:not([name="g_memo"]), #hf .vis-grid .select { text-align: center; text-align-last: center; }
#hf .vis-grid input[type="date"]::-webkit-datetime-edit { display: flex; justify-content: center; }
#hf .vis-grid .seg { display: flex; justify-content: center; }
#hf .vis-grid .vis-info .vis-box { justify-content: center; text-align: center; }
/* البحث عن المريض والطبيب في سطر واحد: نص للبحث ونص للطبيب */
.inv-top .inv-bar .pat-find { flex-wrap: nowrap; }
.inv-top .inv-bar .pat-find .pat-search { flex: 1 1 0; min-width: 0; }
.inv-top .pat-find .dr-pick { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding-inline-start: 12px; margin: 0;
  border: 1px solid #D9D2FB; border-radius: 12px; background: linear-gradient(180deg, #FFFFFF, #F7F5FF);
  box-shadow: 0 2px 0 rgba(42, 31, 107, .08), 0 8px 20px rgba(42, 31, 107, .10); cursor: pointer; }
.inv-top .pat-find .dr-pick:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124, 92, 255, .16); }
.inv-top .pat-find .dr-pick .dr-lbl { flex: none; display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px; color: #3B2E8F; white-space: nowrap; }
.inv-top .pat-find .dr-pick .dr-lbl i { font-size: 18px; color: var(--violet); }
.inv-top .pat-find .dr-pick .select { flex: 1 1 auto; min-width: 0; height: 38px; border: 0; background-color: transparent; box-shadow: none;
  font-size: 15px; font-weight: 800; color: #1E1B4B; text-align: center; text-align-last: center; }
.inv-top .pat-find .dr-pick .select:focus { outline: none; box-shadow: none; }
.inv-top .pat-find .dr-pick .select:disabled { opacity: 1; color: #1E1B4B; cursor: default; }
:root[data-theme="dark"] .inv-top .pat-find .dr-pick { background: var(--surface); border-color: #3B3561; box-shadow: none; }
:root[data-theme="dark"] .inv-top .pat-find .dr-pick .dr-lbl, :root[data-theme="dark"] .inv-top .pat-find .dr-pick .select { color: #F1EEFF; }
@media (max-width: 720px) { .inv-top .inv-bar .pat-find { flex-wrap: wrap; } .inv-top .inv-bar .pat-find > * { flex: 1 1 100%; } }
/* بيانات الزيارة بعد ما الطبيب طلع فوق: التاريخ · نوع الزيارة · آخر زيارة والرصيد (أعرض) */
@media (min-width: 721px) { #hf .form-grid.vis-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); } }
.inv-top .pat-find .pat-none[hidden] { display: none !important; }
.inv-top .inv-bar .pat-find .pat-search, .inv-top .inv-bar .pat-find .dr-pick { flex: 1 1 50%; }
/* بيانات الزيارة في سطر واحد: التاريخ · نوع الزيارة · آخر زيارة والرصيد على قد بياناتهم ، والملاحظات تاخد الباقي */
@media (min-width: 721px) {
  #hf .form-grid.vis-grid { grid-template-columns: 150px max-content 105px 135px minmax(100px, 1fr); }
  #hf .vis-grid .vis-note { grid-column: 5; grid-row: 1; }
  #hf .vis-grid .vis-info .vis-box { padding: 2px 8px; line-height: 1.3; }
  #hf .vis-grid .vis-note .input { text-align: start; }
}
@media (min-width: 721px) and (max-width: 1420px) { #hf .form-grid.vis-grid { grid-template-columns: 140px max-content 96px 124px minmax(90px, 1fr); column-gap: 10px; } }
/* زرار «فواتير النهارده» فوق العمود الجانبي: يظهرها ويخفيها (مقفولة في الأول) */
.today-tgl { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 0 14px; margin: 0 0 12px; cursor: pointer;
  border: 1px solid #D9D2FB; border-radius: 14px; background: linear-gradient(180deg, #FFFFFF, #F4F1FF); color: #2A1F6B; font: inherit; font-size: 15px; font-weight: 800;
  box-shadow: 0 2px 0 rgba(42, 31, 107, .08), 0 6px 16px rgba(42, 31, 107, .08); transition: border-color .15s, box-shadow .15s; }
.today-tgl:hover { border-color: var(--violet); }
.today-tgl > i { font-size: 19px; color: var(--violet); }
.today-tgl .tg-act { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 10px;
  background: var(--violet); color: #fff; font-size: 13px; font-weight: 800; }
.today-tgl.on { border-color: var(--violet); background: var(--violet-50); }
.today-tgl.on .tg-act { background: #fff; color: var(--violet-d); border: 1px solid #D9D2FB; }
:root[data-theme="dark"] .today-tgl { background: var(--surface); border-color: #3B3561; color: #F1EEFF; box-shadow: none; }
.side-panel.today-off .inv-today { display: none !important; }
.side-panel:not(.no-tot):not(.today-off) .inv-today { display: block; }
/* القايمة لما تتفتح: تحت الزرار على طول وبطولها كله (حتى لو الحساب ظاهر — الحساب ينزل تحتها) */
.side-panel:not(.today-off) .inv-today { margin-bottom: 16px; }
.side-panel:not(.no-tot):not(.today-off) .inv-today #todayList { max-height: calc(100vh - 250px); min-height: 360px; overflow-y: auto; }
.side-panel:not(.no-tot):not(.today-off) .inv-today .today-list { max-height: none; overflow: visible; }
@media (max-width: 900px) { .side-panel:not(.no-tot):not(.today-off) .inv-today #todayList { max-height: 70vh; min-height: 0; } }
/* زرار «فواتير النهارده» في نفس سطر البحث والطبيب ، ولما القايمة تظهر: الحساب والمدفوعات يستخبّوا والقايمة تاخد العمود كله */
.inv-top .ph-text .today-tgl { width: 100%; margin: 8px 0 0; min-height: 40px; height: 40px; border-radius: 12px; padding: 0 10px 0 8px; font-size: 14.5px; white-space: nowrap; }
/* الشاشات العريضة: الزرار في العمود الشمال تحت «فتح فاتورة رقم» ، على نفس مستوى سطر البحث والطبيب بالظبط */
@media (min-width: 1251px) {
  .inv-top .ph-text { align-self: stretch; grid-template-rows: auto auto auto auto 1fr; }
  .inv-top .ph-text .eyebrow { display: none; }
  .inv-top .ph-text .today-tgl { grid-row: 5; grid-column: 1 / -1; align-self: end; margin: 0; }
}
.side-panel:not(.today-off) .inv-tot, .side-panel:not(.today-off) .inv-pays { display: none !important; }
.side-panel:not(.today-off) .inv-today { margin-bottom: 0; }
.inv-top .ph-text .today-tgl { gap: 6px; padding: 0 8px 0 6px; font-size: 14px; } .inv-top .ph-text .today-tgl .tg-act { padding: 4px 8px; }
/* شاشات 1351–1440: أقل عرض للخانات أصغر شوية عشان «الحجز» ما يطلعش برّه الكارت */
@media (min-width: 1351px) and (max-width: 1440px) {
  #hf .form-grid.pat-grid { grid-template-columns: minmax(96px, 2.2fr) minmax(90px, 1.4fr) minmax(68px, 1.15fr) minmax(90px, 1.4fr)
    minmax(42px, 0.7fr) minmax(70px, 1fr) minmax(38px, 0.6fr) minmax(84px, 1.15fr); }
  #hf .pat-grid .input[name="id"], #hf .pat-grid .input[name="pation_mobil"], #hf .pat-grid .input[name="file_no"] { font-size: 13.5px; padding-inline: 4px; }
}
/* العمود الشمال في الهيدر (فاتورة رقم · فتح فاتورة رقم · فواتير النهارده) بنفس عرض قايمة فواتير النهارده اللي تحت ، والعنوان وبياناته في النص */
@media (min-width: 1281px) {
  .inv-top { grid-template-columns: minmax(0, 1fr) 330px; column-gap: 16px; }
  .inv-top .inv-bar { width: auto; justify-self: stretch; }
  .inv-top .ph-text { width: 330px; justify-self: stretch; grid-template-columns: minmax(0, 1fr); }
  .inv-top .ph-text .page-title, .inv-top .ph-text .page-sub { grid-column: 1; justify-self: center; text-align: center; }
  .inv-top .ph-text .inv-tools { grid-column: 1; }
  .inv-top .ph-text .inv-tools .go-inv { flex: 1 1 200px; width: auto; }
}
/* الأزرار فوق بقت أضيق شوية (العمود الشمال بعرض فواتير النهارده): من غير علامة F10 / F11 ومسافات أقل عشان الكلام يبان كله */
@media (min-width: 1281px) and (max-width: 1600px) {
  .inv-top .inv-grp .btn kbd { display: none; }
  .inv-top .inv-grp .btn { padding-inline: 6px; gap: 5px; }
}
@media (min-width: 1281px) and (max-width: 1400px) { .inv-top .inv-grp .btn { font-size: 13.5px; } .inv-top .inv-grp .btn i { font-size: 16px; } }
/* فواتير النهارده: رصيد دائن (دفع أكتر من المطلوب) = إطار أخضر والمبلغ وتحته «رصيد دائن» ، واللي عليه فلوس تحت المبلغ «رصيد مدين» */
.inv-today .today-list a.tcard .am.has-l { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.2; }
.inv-today .today-list a.tcard .am .bal-l { font-size: 10.5px; font-weight: 700; opacity: .9; white-space: nowrap; }
.inv-today .today-list a.tcard.st-cr { background: #F0FDF4; border-color: #86EFAC; border-inline-start: 4px solid #16A34A; }
.inv-today .today-list a.tcard.st-cr:hover, .inv-today .today-list a.tcard.st-cr.on { background: #DCFCE7; border-color: #4ADE80; }
.inv-today .today-list a.tcard.st-cr .nm { color: #166534; }
.inv-today .today-list a.tcard.st-cr .am { color: #16A34A; font-size: 16px; font-weight: 900; }
:root[data-theme="dark"] .inv-today .today-list a.tcard.st-cr { background: #0F2A1A; border-color: #166534; }
:root[data-theme="dark"] .inv-today .today-list a.tcard.st-cr .nm { color: #86EFAC; }
/* رصيد المريض في البرنامج كله: رصيد مدين (عليه فلوس) أحمر ، رصيد دائن (ليه فلوس) أخضر — والكلمة بخط صغير تحت المبلغ */
.bal-x { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; vertical-align: middle; }
.bal-x b { font-weight: 800; }
.bal-x small { font-size: 10.5px; font-weight: 700; opacity: .9; white-space: nowrap; }
.bal-x.in { flex-direction: row; align-items: baseline; gap: 5px; }
.bal-x.deb, .bal-x.deb b { color: #DC2626; }
.bal-x.cr, .bal-x.cr b { color: #16A34A; }
.bal-x.zero b { color: inherit; font-weight: 600; }
td.n .bal-x { align-items: flex-end; }
[dir="rtl"] td.n .bal-x { align-items: flex-start; }
.tbl tr.bal-deb > td { background: #FEF2F2; }
.tbl tr.bal-cr > td { background: #F0FDF4; }
.tbl tr.bal-deb > td:first-child { box-shadow: inset -3px 0 0 #EF4444; }
.tbl tr.bal-cr > td:first-child { box-shadow: inset -3px 0 0 #16A34A; }
:root[data-theme="dark"] .tbl tr.bal-deb > td { background: #3B1414; }
:root[data-theme="dark"] .tbl tr.bal-cr > td { background: #0F2A1A; }
:root[data-theme="dark"] .bal-x.deb, :root[data-theme="dark"] .bal-x.deb b { color: #FCA5A5; }
:root[data-theme="dark"] .bal-x.cr, :root[data-theme="dark"] .bal-x.cr b { color: #86EFAC; }
/* صندوق أخضر لأي مكان عليه «owing» (أحمر) لما يبقى الرصيد دائن */
.credit { background: #F0FDF4 !important; border-color: #86EFAC !important; }
:root[data-theme="dark"] .credit { background: #0F2A1A !important; border-color: #166534 !important; }
.inv-tot .totals .row.due.credit { background: #F0FDF4 !important; border: 0 !important; border-radius: 10px; padding: 8px 10px; margin: 4px -10px 0; }
.inv-tot .totals .row.due.credit span { color: #16A34A; font-weight: 700; }
.inv-tot .totals .row.due .bal-x b { font-size: 18px; font-weight: 900; }
.inv-tot .totals .row.due .bal-x { align-items: flex-start; }
.pat-dd .pd-r.credit-r { background: #F0FDF4; }
.pat-dd .pd-r.credit-r .nm { color: #166534; }
.pat-dd .pd-r .bal .bal-x small { font-size: 10px; }
#hf .vis-info .vis-box.credit { color: #166534; }
#hf .vis-info .vis-box .bal-x b { font-weight: 900; }
.bal-strip.owing, .bal-strip.credit { border: 1px solid #FCA5A5; background: #FEF2F2; border-radius: 9px; padding: 1px 8px; }
.bal-strip.credit { border-color: #86EFAC; }
.note-row.bal-note.owing { background: #FEF2F2; border: 1px solid #FCA5A5; border-radius: 10px; padding: 8px 12px; }
.note-row.bal-note.credit { border-radius: 10px; padding: 8px 12px; }
.tbl tbody tr.bal-deb > td { background: #FEF2F2 !important; }
.tbl tbody tr.bal-cr > td { background: #F0FDF4 !important; }
.tbl tbody tr.bal-deb:hover > td { background: #FDE4E4 !important; }
.tbl tbody tr.bal-cr:hover > td { background: #DCFCE7 !important; }
:root[data-theme="dark"] .tbl tbody tr.bal-deb > td { background: #3B1414 !important; }
:root[data-theme="dark"] .tbl tbody tr.bal-cr > td { background: #0F2A1A !important; }
.sum-cards > div.owing { background: #FEF2F2; box-shadow: inset 0 0 0 1px #FCA5A5; }
.sum-cards > div.credit { box-shadow: inset 0 0 0 1px #86EFAC; }
:root[data-theme="dark"] .sum-cards > div.owing { background: #3B1414; }
/* قايمة البحث عن خدمة: كل خدمة سطر واحد (الكود · الاسم العربي · الإنجليزي · السعر) عشان يظهر عدد أكبر */
.srv-pop { max-height: min(62vh, 560px); padding: 4px; }
.srv-pop button { grid-template-columns: 62px minmax(0, 1.25fr) minmax(0, 1fr) max-content; align-items: center; gap: 0 12px; padding: 5px 10px; min-height: 32px; }
.srv-pop button > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-pop button .sc { font-weight: 800; color: #1E1B4B; }
.srv-pop button .sa { font-weight: 700; font-size: 14px; }
.srv-pop button .se { font-size: 12.5px; color: var(--muted, #6b7280); text-align: left; }
.srv-pop button .sp { font-weight: 800; color: var(--violet-d, #4C3BCF); min-width: 64px; text-align: left; }
.srv-pop button:nth-child(even) { background: #FBFAFF; }
.srv-pop button.on, .srv-pop button:hover { background: color-mix(in srgb, var(--brand, #0f766e) 12%, transparent); }
:root[data-theme="dark"] .srv-pop button:nth-child(even) { background: rgba(255, 255, 255, .02); }
:root[data-theme="dark"] .srv-pop button .sc { color: #F1EEFF; }
@media (max-width: 720px) { .srv-pop button { grid-template-columns: 52px minmax(0, 1fr) max-content; } .srv-pop button .se { display: none; } }
/* ترتيب السطر: الكود · الاسم العربي · السعر في النص (من اليمين) · الإنجليزي في أقصى الشمال */
.srv-pop button { grid-template-columns: 62px minmax(0, 1.2fr) 96px minmax(0, 1.1fr); gap: 0 18px; }
.srv-pop button .sp { text-align: right; min-width: 0; padding-inline: 10px; border-inline: 1px solid var(--line-soft, #EEF0F4); }
.srv-pop button .se { text-align: left; font-size: 13.5px; font-weight: 700; color: #4B5563; }
:root[data-theme="dark"] .srv-pop button .se { color: #C9C5E8; }
@media (max-width: 720px) { .srv-pop button { grid-template-columns: 52px minmax(0, 1fr) max-content; } }
/* «آخر زيارة» و«رصيد كلي للمريض» خانتين منفصلتين: الكلام في النص من غير تكرار */
#hf .vis-grid .vis-info .vis-box { justify-content: center; align-items: center; flex-wrap: nowrap; white-space: nowrap; font-size: 14px; font-weight: 700; }
#hf .vis-grid .vis-last .vis-box b { color: var(--bad); font-weight: 900; margin: 0 3px; }
#hf .vis-grid .vis-bal .vis-box .bal-x { align-items: center; }
#hf .vis-grid .vis-bal .vis-box .bal-x b { font-size: 15px; }
/* عمود «الطبيب» في بيانات الخدمات مستخبّي مبدئياً (طبيب الفاتورة فوق) — اسم الخدمة بياخد المكان. لو احتجناه: شيل السطر ده */
.inv-lines .c-dr { display: none; }
/* جدول الخدمات: عرض ثابت لأعمدة الأرقام ، واسم الخدمة ياخد كل الباقي (الأعمدة بالترتيب: # · الخدمة · [الطبيب مستخبّي] · السن · العدد · السعر · خصم% · قيمة الخصم · بعد الخصم · الضريبة · الإجمالي · أزرار) */
@media (min-width: 721px) {
  .inv-lines { table-layout: fixed; width: 100%; }
  .inv-lines thead th { white-space: normal; line-height: 1.2; }
  .inv-lines thead th:nth-child(1) { width: 32px; }
  .inv-lines thead th:nth-child(2) { width: auto; }
  .inv-lines thead th:nth-child(4) { width: 48px; }
  .inv-lines thead th:nth-child(5) { width: 48px; }
  .inv-lines thead th:nth-child(6) { width: 76px; }
  .inv-lines thead th:nth-child(7) { width: 56px; }
  .inv-lines thead th:nth-child(8) { width: 72px; }
  .inv-lines thead th:nth-child(9) { width: 80px; }
  .inv-lines thead th:nth-child(10) { width: 64px; }
  .inv-lines thead th:nth-child(11) { width: 86px; }
  .inv-lines thead th:nth-child(12) { width: 76px; }
  .inv-lines td { overflow: hidden; }
  .inv-lines td .cell { width: 100%; min-width: 0; }
}
@media (min-width: 721px) and (max-width: 1420px) {
  .inv-lines thead th:nth-child(1) { width: 28px; }
  .inv-lines thead th:nth-child(4), .inv-lines thead th:nth-child(5) { width: 42px; }
  .inv-lines thead th:nth-child(6) { width: 68px; }
  .inv-lines thead th:nth-child(7) { width: 50px; }
  .inv-lines thead th:nth-child(8) { width: 64px; }
  .inv-lines thead th:nth-child(9) { width: 72px; }
  .inv-lines thead th:nth-child(10) { width: 56px; }
  .inv-lines thead th:nth-child(11) { width: 78px; }
  .inv-lines thead th:nth-child(12) { width: 66px; }
  .inv-lines th, .inv-lines td { font-size: 13px; }
  .inv-lines td { padding-inline: 4px; }
}
.inv-lines tbody td:nth-child(2) { font-weight: 700; }
/* عناوين جدول الخدمات كلها في سطر واحد: كل عمود على قد عنوانه ، واسم الخدمة ياخد الباقي */
@media (min-width: 721px) {
  .inv-lines thead th { white-space: nowrap !important; padding-inline: 5px; }
  .inv-lines thead th:nth-child(1) { width: 32px; }
  .inv-lines thead th:nth-child(4) { width: 44px; }
  .inv-lines thead th:nth-child(5) { width: 46px; }
  .inv-lines thead th:nth-child(6) { width: 76px; }
  .inv-lines thead th:nth-child(7) { width: 62px; }
  .inv-lines thead th:nth-child(8) { width: 84px; }
  .inv-lines thead th:nth-child(9) { width: 80px; }
  .inv-lines thead th:nth-child(10) { width: 60px; }
  .inv-lines thead th:nth-child(11) { width: 86px; }
  .inv-lines thead th:nth-child(12) { width: 70px; }
}
@media (min-width: 721px) and (max-width: 1420px) {
  .inv-lines thead th:nth-child(1) { width: 26px; }
  .inv-lines thead th:nth-child(4) { width: 42px; }
  .inv-lines thead th:nth-child(5) { width: 44px; }
  .inv-lines thead th:nth-child(6) { width: 68px; }
  .inv-lines thead th:nth-child(7) { width: 60px; }
  .inv-lines thead th:nth-child(8) { width: 80px; }
  .inv-lines thead th:nth-child(9) { width: 74px; }
  .inv-lines thead th:nth-child(10) { width: 56px; }
  .inv-lines thead th:nth-child(11) { width: 78px; }
  .inv-lines thead th:nth-child(12) { width: 62px; }
}
/* «حفظ مؤقت» لما يكون فيه تغييرات ما اتحفظتش: إطار برتقالي بينبض + علامة «!» في الركن */
.btn.need-save { position: relative; animation: needSave 1.6s ease-in-out infinite; border-color: #F59E0B !important; }
.btn.need-save::after { content: '!'; position: absolute; top: -7px; inset-inline-end: -7px; width: 18px; height: 18px; border-radius: 50%;
  background: #F59E0B; color: #fff; font: 900 12px/18px system-ui, sans-serif; text-align: center; box-shadow: 0 0 0 2px #fff; }
@keyframes needSave { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .55); } 50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); } }
@media (prefers-reduced-motion: reduce) { .btn.need-save { animation: none; box-shadow: 0 0 0 3px rgba(245, 158, 11, .45); } }
/* ختم المسؤولية في آخر كل مستند مطبوع: طُبع بواسطة · التاريخ · الساعة */
.print-stamp { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 10px; padding-top: 6px; border-top: 1px dashed #9CA3AF;
  font-size: 10.5px; color: #374151; direction: rtl; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.print-stamp b { font-weight: 800; color: #111827; }
.pdoc.thermal ~ .print-stamp { font-size: 9.5px; gap: 2px 10px; max-width: 74mm; margin-inline: auto; }
/* ================= المفكرة ================= */
.notes-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px; }
.notes-bar .notes-q { position: relative; flex: 1 1 220px; max-width: 360px; margin-inline-start: auto; }
.notes-bar .notes-q i { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--violet); }
.notes-bar .notes-q .input { padding-inline-start: 34px; }
.notes-bar .badge.bad { background: #FEE2E2; color: #B91C1C; }
.notes-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.note-card { background: var(--surface); border: 1px solid #E4DFFB; border-inline-start: 5px solid var(--violet); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 2px 10px rgba(42, 31, 107, .06); }
.note-card.today { border-inline-start-color: #F59E0B; background: #FFFBEB; }
.note-card.late { border-color: #FCA5A5; border-inline-start-color: #EF4444; background: #FEF2F2; }
.note-card.done { opacity: .7; border-inline-start-color: #9CA3AF; }
.note-card.done .nc-t { text-decoration: line-through; }
.nc-when { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4C1D95; }
.nc-when i { color: var(--violet); font-size: 17px; }
.nc-when .nc-left { margin-inline-start: auto; font-size: 12px; font-weight: 700; color: var(--text-2); }
.note-card.late .nc-when, .note-card.late .nc-left { color: #B91C1C; }
.note-card.today .nc-left { color: #B45309; }
.nc-t { margin: 0; font-size: 16.5px; font-weight: 800; color: #1E1B4B; }
.nc-b { margin: 0; font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; max-height: 7.5em; overflow: hidden; }
.nc-files { display: flex; flex-wrap: wrap; gap: 6px; }
.nc-files a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--violet-50); color: var(--violet-d); text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; border-top: 1px dashed #E4DFFB; }
.nc-ways { display: inline-flex; align-items: center; gap: 6px; color: #6B7280; font-size: 17px; }
.nc-ways small { font-size: 11px; }
.nc-ways .ok { color: #16A34A; } .nc-ways .bad { color: #DC2626; }
.nc-acts { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px; }
.btn.nc-done { --bb: #DCFCE7; --bd: #86EFAC; --bf: #166534; --bh: #BBF7D0; }
:root[data-theme="dark"] .note-card { background: var(--surface); border-color: #3B3561; }
:root[data-theme="dark"] .note-card.late { background: #3B1414; }
:root[data-theme="dark"] .note-card.today { background: #33270F; }
:root[data-theme="dark"] .nc-t { color: #F1EEFF; }
.note-form .nf-row { display: flex; flex-wrap: wrap; gap: 10px; }
.note-form .nf-row > .field { flex: 1 1 140px; }
.note-form textarea.input { height: auto; min-height: 90px; resize: vertical; padding-top: 8px; }
.nf-ways { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
.nf-h { font-weight: 800; color: #2A1F6B; }
.nf-way { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px solid #E4DFFB; border-radius: 12px; cursor: pointer; }
.nf-way > i { font-size: 20px; color: var(--violet); }
.nf-way span { display: flex; flex-direction: column; flex: 1 1 200px; }
.nf-way small { color: var(--text-3); font-size: 12px; }
.nf-way > .input { flex: 1 1 100%; display: none; }
.nf-way.on > .input { display: block; }
.nf-way:has(input[type=checkbox]:checked) { border-color: var(--violet); background: var(--violet-50); }
.nf-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.nf-file { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid #E4DFFB; border-radius: 10px; font-size: 13px; }
.nf-file a { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.nf-file small { color: var(--text-3); }
.nf-file.new { border-style: dashed; border-color: var(--violet); }
.nf-pick { cursor: pointer; }
.nf-btns { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
/* تنبيه الميعاد: كارت تحت على الشمال */
#notePops { position: fixed; left: 18px; bottom: 18px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.note-pop { background: #fff; border: 1px solid #D9D2FB; border-top: 4px solid #F59E0B; border-radius: 14px; padding: 10px 12px 12px; box-shadow: 0 18px 44px rgba(20, 14, 70, .28); animation: npIn .35s ease-out; }
.note-pop.out { opacity: 0; transform: translateY(10px); transition: .25s; }
@keyframes npIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.np-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: #B45309; }
.np-h i { font-size: 18px; animation: npRing 1.2s ease-in-out 3; }
.np-h .icon-btn { margin-inline-start: auto; }
@keyframes npRing { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-8deg); } }
.np-t { font-size: 16px; font-weight: 900; color: #1E1B4B; margin: 4px 0 2px; }
.np-w { font-size: 12.5px; color: #4C1D95; display: flex; align-items: center; gap: 4px; }
.np-b { font-size: 13px; color: #374151; margin: 6px 0; white-space: pre-wrap; max-height: 6em; overflow: auto; }
.np-err { font-size: 12px; color: #B91C1C; margin-top: 4px; }
.np-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.np-btns .select.sm { height: 30px; font-size: 12.5px; width: auto; }
.btn.np-wa { --bb: #DCFCE7; --bd: #86EFAC; --bf: #166534; --bh: #BBF7D0; }
:root[data-theme="dark"] .note-pop { background: var(--surface); border-color: #3B3561; }
:root[data-theme="dark"] .np-t { color: #F1EEFF; }

/* ---------- prescription: medicine picker (small cards, English + Arabic name, grouped by first letter) ---------- */
.med-pop { position: fixed; z-index: 90; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 44px rgba(20, 12, 60, .2); }
.mp-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); font-size: 13px; flex: none; }
.mp-head > i { color: var(--violet); font-size: 17px; }
.mp-n { background: var(--violet-50); color: var(--violet-d); font-weight: 800; border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.mp-keys { margin-inline-start: auto; color: var(--text-3); font-size: 11.5px; direction: ltr; }
.mp-body { overflow-y: auto; padding: 0 8px 8px; flex: 1; min-height: 0; }
.mp-grp { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 9px 4px 4px; background: var(--surface); font-size: 12px; font-weight: 900; color: var(--violet-d); letter-spacing: .5px; }
.mp-grp::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.mp-card { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px; margin: 4px 0 0; padding: 5px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .1s, border-color .1s; }
.mp-card:hover { background: var(--violet-50); border-color: var(--violet-100); }
.mp-card.hl { background: var(--violet-50); border-color: var(--violet); box-shadow: inset 3px 0 0 var(--violet); }
.mp-ic { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--violet-50); color: var(--violet); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.mp-card.hl .mp-ic { background: var(--violet); color: #fff; }
.mp-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.mp-tx b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-tx small { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.mp-card mark { background: #FDE68A; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] .mp-card mark { background: rgba(250, 204, 21, .3); }
.mp-more { display: flex; align-items: center; gap: 6px; flex: none; padding: 8px 12px; font-size: 12.5px; color: var(--text-3); background: var(--surface-2); border-top: 1px solid var(--line-soft); }

/* ---------- ألوان أزرار خدمات الطبيب (مكمّلة للألوان المتفق عليها: ملف المريض موف ، المرفقات أزرق ، المواعيد تركواز)
   الأسنان = بينك ، فواتير المريض = ليموني ، تحويل لطبيب = فوشيا ، إجازة مرضية = أحمر فاتح ، إشعار مراجعة = سماوي غامق */
.btn.btn.btn:has(> .ti-dental) { --bb: #FDF2F8; --bd: #F9A8D4; --bf: #BE185D; --bh: #FCE7F3; }
.btn.btn.btn:has(> .ti-file-invoice) { --bb: #F7FEE7; --bd: #BEF264; --bf: #3F6212; --bh: #ECFCCB; }
.btn.btn.btn:has(> .ti-arrows-exchange) { --bb: #FDF4FF; --bd: #F0ABFC; --bf: #A21CAF; --bh: #FAE8FF; }
.btn.btn.btn:has(> .ti-calendar-off) { --bb: #FEF2F2; --bd: #FCA5A5; --bf: #B91C1C; --bh: #FEE2E2; }
.btn.btn.btn:has(> .ti-report-medical) { --bb: #ECFEFF; --bd: #67E8F9; --bf: #0E7490; --bh: #CFFAFE; }
.btn.btn.btn:is(:has(> .ti-dental), :has(> .ti-file-invoice), :has(> .ti-arrows-exchange), :has(> .ti-calendar-off), :has(> .ti-report-medical)) {
  background: var(--bb); border-color: var(--bd); color: var(--bf); }
.btn.btn.btn:is(:has(> .ti-dental), :has(> .ti-file-invoice), :has(> .ti-arrows-exchange), :has(> .ti-calendar-off), :has(> .ti-report-medical)):hover:not(:disabled) {
  background: var(--bh); border-color: var(--bd); color: var(--bf); }
:root[data-theme="dark"] .btn.btn.btn:is(:has(> .ti-dental), :has(> .ti-file-invoice), :has(> .ti-arrows-exchange), :has(> .ti-calendar-off), :has(> .ti-report-medical)) {
  background: color-mix(in srgb, var(--bd) 16%, var(--surface)); border-color: color-mix(in srgb, var(--bd) 45%, var(--surface)); color: color-mix(in srgb, var(--bd) 70%, #fff); }

/* ---------- خدمات الطبيب في الكشف: كل الأزرار في سطر واحد (أصغر شوية) عشان الكشف تحتها يطلع لفوق
   لو المساحة مش مكفية (شاشة أصغر) الأزرار بتبقى مربعات صغيرة: الأيقونة فوق والاسم تحت ، والعدد في الركن */
@media (min-width: 721px) {
  .exam-bar .exam-acts.exam-acts { container-type: inline-size; flex-wrap: nowrap; gap: 6px; margin: 16px 18px 12px; padding: 15px 10px 10px; }
  .exam-bar .exam-acts .btn { position: relative; flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 10px; gap: 5px; font-size: 13.5px; white-space: nowrap; justify-content: center; }
  .exam-bar .exam-acts .btn .badge { padding: 0 6px; font-size: 11.5px; }
  @container (max-width: 1000px) {
    .exam-bar .exam-acts .btn { flex: 1 1 0; flex-direction: column; height: 52px; gap: 2px; padding: 4px 4px 3px; font-size: 12.5px; line-height: 1.2; }
    .exam-bar .exam-acts .btn > .ti:first-child { font-size: 19px; }
    .exam-bar .exam-acts .btn > .badge, .exam-bar .exam-acts .btn > .ti-check { position: absolute; top: 3px; inset-inline-end: 4px; min-width: 18px; height: 17px; line-height: 17px; padding: 0 4px; font-size: 10.5px; }
    .exam-bar .exam-acts .btn > .ti-check { min-width: 0; padding: 0; font-size: 14px; }
    .exam-bar .exam-acts .btn > .badge { background: var(--surface); border: 1px solid var(--bd, var(--line)); color: var(--bf, var(--text-2)); border-radius: 999px; font-weight: 800; }
    .exam-bar .exam-acts .btn > .badge.brand { background: var(--bf, var(--violet)); border-color: var(--bf, var(--violet)); color: #fff; }
  }
}

/* ---------- الوصفة الطبية: سطور أقرب لبعض ، وزرار الطباعة فوق الجدول */
.rx-foot.rx-top { margin: 0 0 8px; }
.rx-tbl.rx-tbl th { padding: 9px 8px; font-size: 15px; font-weight: 800; }
.rx-tbl.rx-tbl td { padding: 2px 6px; border-bottom-color: transparent; }
.rx-tbl.rx-tbl .input { height: 32px; min-height: 32px; font-size: 14px; padding: 0 10px; border-radius: 8px; }
.rx-tbl.rx-tbl .rn span { width: 22px; height: 22px; font-size: 12px; }
/* مفيش ملاحظة من الزيارة السابقة ولا تنبيهات: السطر مايخدش مكان */
.xnotes:not(:has(*)) { display: none; }

/* ---------- الكشف: سطر الطبيب / الملف / الفاتورة أكبر ، والرصيد الكلي في إطار: مدين أحمر ، دائن أخضر */
.exam-bar .pfile-hero .facts { font-size: 15px; gap: 8px 18px; align-items: center; color: var(--text); }
.exam-bar .pfile-hero .facts i { font-size: 17px; }
.exam-bar .pfile-hero .facts .num { font-weight: 700; }
.xbal { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  color: var(--text); text-decoration: none; font-weight: 600; }
.xbal:hover { filter: brightness(.98); }
.xbal .bal-x { display: inline-flex; align-items: baseline; gap: 6px; }
.xbal .bal-x b { font-size: 16.5px; font-weight: 800; }
.xbal .bal-x small { font-size: 12.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.xbal.deb { background: #FEF2F2; border-color: #FCA5A5; border-inline-start: 4px solid #DC2626; }
.xbal.deb .bal-x b, .xbal.deb > i { color: #DC2626 !important; }
.xbal.deb .bal-x small { background: #DC2626; color: #fff; }
.xbal.cr { background: #F0FDF4; border-color: #86EFAC; border-inline-start: 4px solid #16A34A; }
.xbal.cr .bal-x b, .xbal.cr > i { color: #16A34A !important; }
.xbal.cr .bal-x small { background: #16A34A; color: #fff; }
:root[data-theme="dark"] .xbal.deb { background: #3B1414; border-color: #7F1D1D; }
:root[data-theme="dark"] .xbal.cr { background: #0F2A1A; border-color: #166534; }
@media (max-width: 720px) { .exam-bar .pfile-hero .facts { font-size: 14px; } }

/* ================================================================ الكشف: التابات والخانات أكبر وبالعربي + الإنجليزي */
.tabs.x-tabs { container-type: inline-size; gap: 4px; padding: 10px 12px 0; background: linear-gradient(180deg, var(--violet-50), transparent); overflow: hidden; }
.tabs.x-tabs button { flex: 1 1 auto; min-width: 0; justify-content: center; padding: 9px 10px 10px; border-radius: 12px 12px 0 0; gap: 8px; color: var(--text-2); border-bottom-width: 3px; }
.tabs.x-tabs button > i { font-size: 21px; color: var(--violet); opacity: .75; }
.tabs.x-tabs .tb-t { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.tabs.x-tabs .tb-t b { font-size: 15px; font-weight: 800; }
.tabs.x-tabs .tb-t small { font-size: 11.5px; font-weight: 600; color: var(--text-3); direction: ltr; }
.tabs.x-tabs button:hover { background: color-mix(in srgb, var(--violet) 6%, var(--surface)); }
.tabs.x-tabs button.on { background: var(--surface); color: var(--violet-d); box-shadow: 0 -2px 10px rgba(60, 40, 160, .07); }
.tabs.x-tabs button.on > i { opacity: 1; }
.tabs.x-tabs button.on .tb-t small { color: var(--violet); }

/* عنوان الخانة: أيقونة + عربي كبير + إنجليزي صغير */
#xf .field > label.bl { display: flex; align-items: baseline; gap: 7px; font-size: 15px; font-weight: 800; color: var(--text); flex-wrap: wrap; }
#xf .field > label.bl > i { font-size: 18px; color: var(--violet); align-self: center; }
#xf .field > label.bl > small { font-size: 12px; font-weight: 600; color: var(--text-3); direction: ltr; letter-spacing: .2px; }
#xf .xpane .input, #xf .xpane .select { font-size: 16px; }
#xf .xpane input.input, #xf .xpane .select { height: 44px; }
#xf .field.big .input { height: 48px; font-size: 16.5px; border-radius: 11px; }
#xf .field.big { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 14px; padding: 10px 12px 12px; }
#xf .field.big .faint { font-size: 12.5px !important; }

/* عناوين الأقسام جوه التاب */
#xf .x-sec { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; margin: 4px 0 -4px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); }
#xf .x-sec > i { font-size: 19px; color: var(--violet); align-self: center; }
#xf .x-sec b { font-size: 16px; font-weight: 900; color: var(--violet-d); }
#xf .x-sec small { font-size: 12px; color: var(--text-3); font-weight: 700; direction: ltr; }

/* العلامات الحيوية: مربعات بلون لكل علامة ، والرقم كبير ووحدته جنبه */
#xf .vitals { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
#xf .field.vital { border: 1px solid color-mix(in srgb, var(--vt) 30%, var(--line)); border-inline-start: 4px solid var(--vt); border-radius: 14px; padding: 9px 12px 11px;
  background: color-mix(in srgb, var(--vt) 5%, var(--surface)); gap: 6px; }
#xf .field.vital > label.bl { font-size: 14px; row-gap: 0; }
#xf .field.vital > label.bl > small { flex-basis: 100%; padding-inline-start: 25px; }
#xf .field.vital > label.bl > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#xf .field.vital > label.bl > i { color: var(--vt); }
#xf .field.vital .v-in { position: relative; }
#xf .field.vital .v-in .input { height: 46px; font-size: 22px; font-weight: 800; color: var(--vt); padding-inline-end: 58px; text-align: left; background: var(--surface); }
#xf .field.vital .v-in .unit { position: absolute; top: 50%; transform: translateY(-50%); right: 12px; font-size: 12.5px; font-weight: 800; color: var(--text-3); direction: ltr; pointer-events: none; }

/* ملاحظات الطبيب */
#xf .memo-ed { border-radius: 14px; }
#xf .memo-area { min-height: 170px; font-size: 16px; line-height: 1.7; }
#xf .field.next-note { background: color-mix(in srgb, #F59E0B 7%, var(--surface)); border: 1px solid #FCD34D; border-radius: 14px; padding: 10px 12px 12px; }
#xf .field.next-note > label.bl > i { color: #D97706; }
#xf .field.next-note textarea { font-size: 16px; background: var(--surface); }

/* قايمة الشكاوى: كل شكوى في سطر واحد — العربي يمين والإنجليزي شمال */
.mp-tx.one { flex-direction: row; align-items: baseline; gap: 12px; }
.mp-tx.one b { flex: 1; min-width: 0; text-align: right; }
.mp-tx.one small { flex: none; max-width: 48%; text-align: left; direction: ltr; font-size: 13px; }
@media (max-width: 720px) {
  .tabs.x-tabs .tb-t small { display: none; }
  #xf .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#xf .field.nurse-note > label.bl, #xf .field.nurse-note > label.bl > i { color: #2F7D12; }

/* التابات لو المساحة ضيقة: الإنجليزي بيستخبى والخط يصغر شوية — كله في سطر واحد */
@container (max-width: 1150px) {
  .tabs.x-tabs .tb-t small { display: none; }
  .tabs.x-tabs .tb-t b { font-size: 14px; }
  .tabs.x-tabs button { padding: 10px 8px 11px; gap: 6px; }
  .tabs.x-tabs button > i { font-size: 18px; }
}
@container (max-width: 820px) {
  .tabs.x-tabs button > i { display: none; }
  .tabs.x-tabs .tb-t b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tabs.x-tabs .tb-t { min-width: 0; }
}

/* العلامات الحيوية + مدة المرض: 7 مربعات ضيقة في سطر واحد */
#xf .field.vital { padding: 7px 9px 9px; gap: 5px; border-radius: 12px; }
#xf .field.vital > label.bl { font-size: 13.5px; gap: 5px; }
#xf .field.vital > label.bl > i { font-size: 16px; }
#xf .field.vital > label.bl > small { padding-inline-start: 21px; font-size: 11px; }
#xf .field.vital .v-in .input { height: 42px; font-size: 20px; padding-inline: 9px 44px; }
#xf .field.vital .v-in .unit { right: 8px; font-size: 11.5px; }
#xf .field.vital.txt .v-in .input { font-size: 16px; font-weight: 700; color: var(--text); padding-inline: 9px; text-align: start; }
@media (max-width: 1150px) { #xf .vitals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { #xf .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================================================================ الكشف: الإجازة والملاحظات + مطالبة التأمين */
#xf .xg4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
#xf .xpane > .x-sec { margin: 6px 0 10px; }
#xf .xpane > .x-sec:first-child { margin-top: 0; }
@media (max-width: 1100px) { #xf .xg4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } #xf .xg4 > [style*="span 2"] { grid-column: 1 / -1 !important; } }
@media (max-width: 720px) { #xf .xg4 { grid-template-columns: 1fr; } }

/* الإجازة المرضية: مفتاح كبير + 3 مربعات (المدة / البداية / النهاية) — باهتة لحد ما المفتاح يتعلّم */
#xf .sick-box { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(230px, 1.1fr) 3fr; gap: 12px; align-items: stretch;
  border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: var(--surface-2); transition: background .15s, border-color .15s; }
#xf .sick-box.on { background: #FEF2F2; border-color: #FCA5A5; }
:root[data-theme="dark"] #xf .sick-box.on { background: #3B1414; border-color: #7F1D1D; }
#xf .sick-tg { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 8px; }
#xf .sick-tg input { position: absolute; opacity: 0; pointer-events: none; }
#xf .sick-tg .sw { width: 46px; height: 26px; flex: none; border-radius: 999px; background: #CBD5E1; position: relative; transition: background .15s; }
#xf .sick-tg .sw::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .15s; }
#xf .sick-tg input:checked + .sw { background: #DC2626; }
#xf .sick-tg input:checked + .sw::after { inset-inline-start: 23px; }
#xf .sick-tg input:focus-visible + .sw { outline: 2px solid var(--violet); outline-offset: 2px; }
#xf .sick-tg .tt { display: flex; flex-direction: column; line-height: 1.3; }
#xf .sick-tg .tt b { font-size: 16px; font-weight: 800; }
#xf .sick-tg .tt small { font-size: 12px; color: var(--text-3); font-weight: 600; direction: ltr; text-align: right; }
#xf .sick-box.on .sick-tg .tt b { color: #B91C1C; }
#xf .sick-f { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
#xf .sick-box:not(.on) .sick-f { opacity: .55; }
#xf .field.vital .v-in input[type="date"] { font-size: 16px; font-weight: 700; padding-inline: 10px; color: var(--text); }
#xf .field.vital .v-in output.input { display: flex; align-items: center; height: 42px; font-size: 17px; font-weight: 800; color: var(--vt); background: var(--surface); }
@media (max-width: 900px) { #xf .sick-box { grid-template-columns: 1fr; } }
@media (max-width: 560px) { #xf .sick-f { grid-template-columns: 1fr; } }

/* شرايح طبيعة الحالة: عربي + إنجليزي ، المختارة ملوّنة بعلامة صح */
#xf .xchips { display: flex; flex-wrap: wrap; gap: 8px; }
#xf .xchip { position: relative; display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 700; color: var(--text-2); transition: background .1s, border-color .1s; user-select: none; }
#xf .xchip input { position: absolute; opacity: 0; pointer-events: none; }
#xf .xchip > i { display: none; font-size: 14px; align-self: center; }
#xf .xchip small { font-size: 11.5px; color: var(--text-3); font-weight: 600; direction: ltr; }
#xf .xchip:hover { border-color: var(--violet-100); background: var(--violet-50); }
#xf .xchip:has(input:checked) { background: var(--violet); border-color: var(--violet); color: #fff; }
#xf .xchip:has(input:checked) > i { display: inline-block; }
#xf .xchip:has(input:checked) small { color: rgba(255, 255, 255, .8); }
#xf .xchip.red:has(input:checked) { background: #DC2626; border-color: #DC2626; }
#xf .xchip.amber:has(input:checked) { background: #D97706; border-color: #D97706; }
#xf .xchip:has(input:focus-visible) { outline: 2px solid var(--violet); outline-offset: 2px; }

/* أزرار الاختيار (مباشر / تحويل ، CMF نعم / لا) */
#xf .xseg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--surface); height: 44px; }
#xf .xseg button { flex: 1; border: 0; background: transparent; font: inherit; font-size: 14.5px; font-weight: 700; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: baseline; justify-content: center; gap: 5px; padding: 0 8px; line-height: 44px; }
#xf .xseg button + button { border-inline-start: 1px solid var(--line); }
#xf .xseg button small { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
#xf .xseg button.on { background: var(--violet); color: #fff; }
#xf .xseg button.on small { color: rgba(255, 255, 255, .8); }
#xf .xg4 { align-items: end; }
#xf .xg4 .field > label.bl { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }

/* الإجازة المرضية: الأرقام والتواريخ في نص المربع (وأيقونة التقويم مش فوق التاريخ) ، والتاب أقصر */
#xf .sick-f .field.vital .v-in .input { text-align: center; padding-inline: 34px; }
#xf .sick-f .field.vital .v-in output.input { justify-content: center; }
#xf .sick-f .field.vital .v-in input[type="date"] { padding-inline: 8px 30px; }
#xf .sick-f .field.vital .v-in input[type="date"]::-webkit-date-and-time-value { text-align: center; }
#xf .sick-f .field.vital .v-in input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; right: 8px; cursor: pointer; }
#xf .sick-f .field.vital .v-in .unit { right: 10px; }
#xf .x-sick { gap: 10px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#xf .x-sick > .x-sec { margin: 0; }
#xf .x-sick .sick-box { padding: 10px; }
#xf .x-sick .field.big { padding: 8px 10px 10px; }
#xf .x-sick .field.big .input { height: 44px; }
@media (max-width: 720px) { #xf .x-sick { grid-template-columns: 1fr; } }
#xf .x-sick { padding-top: 12px; }
#xf .x-sick .field.big { gap: 4px; }
/* الإجازة المرضية أقصر: الإنجليزي جنب العربي في المربعات ، والملاحظات من غير عنوان قسم */
#xf .x-sick .sick-f .field.vital > label.bl > small { flex-basis: auto; padding-inline-start: 0; }
#xf .x-sick .sick-f .field.vital > label.bl { flex-wrap: nowrap; }
#xf .x-sick .sick-f .field.vital { padding: 6px 9px 8px; }
#xf .x-sick .field.big { padding: 6px 10px 8px; }
#xf .x-sick .field.big .input { height: 40px; }

/* الوصفة: خانات الدواء والجرعة قصيرة (القاعدة العامة لخانات الكشف 44px كانت مكبّراها) — والعشر سطور يبانوا في شاشة واحدة */
#xf .rx-tbl input.input { height: 31px; min-height: 31px; font-size: 14.5px; padding: 0 10px; border-radius: 8px; }
#xf .rx-tbl.rx-tbl td { padding: 2px 6px; }
#xf .rx-tbl .rn span { width: 27px; height: 27px; font-size: 14px; font-weight: 800; box-shadow: inset 0 0 0 1px var(--violet-100); }
#xf .rx-foot.rx-top { margin-bottom: 6px; }
/* الوصفة: زرار الطباعة في سطر العناوين ، والسطور أقصر — العشر سطور في شاشة واحدة */
#xf .x-rx { padding-top: 10px; padding-bottom: 10px; }
#xf .rx-tbl.rx-tbl th { padding: 5px 8px; }
#xf .rx-tbl th small { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-inline-start: 4px; }
#xf .rx-th { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#xf .rx-th .btn { height: 32px; font-size: 13.5px; font-weight: 700; }
#xf .rx-tbl input.input { height: 29px; min-height: 29px; }
#xf .rx-tbl.rx-tbl td { padding: 1px 6px; }

/* ================================================================ تقرير طبي وإشعار مراجعة: شاشة واحدة عريضة */
#drawer.mor-dr { width: min(1120px, 98vw); }
#drawer.mor-dr .db { padding: 14px 20px 16px; }
.mor-f .field > label.bl { display: flex; align-items: baseline; gap: 6px; font-size: 14.5px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; }
.mor-f .field > label.bl > i { font-size: 17px; color: #0E7490; align-self: center; }
.mor-f .field > label.bl > small { font-size: 11.5px; color: var(--text-3); font-weight: 600; direction: ltr; }
.mor-f .input { height: 40px; font-size: 15.5px; }
.mor-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; align-items: start; }
.mor-quick { display: flex; gap: 4px; margin-top: 4px; }
.mor-quick button { flex: 1; border: 1px solid #A5F3FC; background: #ECFEFF; color: #0E7490; border-radius: 7px; font: inherit; font-size: 12px; font-weight: 700; padding: 2px 0; cursor: pointer; }
.mor-quick button:hover { background: #CFFAFE; }
.mor-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.mor-box { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.mor-box.rec { background: color-mix(in srgb, #16A34A 4%, var(--surface)); border-color: #BBF7D0; }
.mor-h { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.mor-h > i { font-size: 19px; color: #0E7490; }
.mor-box.rec .mor-h > i { color: #16A34A; }
.mor-h b { font-size: 15.5px; font-weight: 900; }
.mor-h small { font-size: 11.5px; color: var(--text-3); font-weight: 700; direction: ltr; }
.mor-h .btn { margin-inline-start: auto; height: 30px; font-size: 13px; }
.mor-ln { display: flex; align-items: center; gap: 8px; }
.mor-ln .input { flex: 1; height: 36px; background: var(--surface); }
.mor-n { width: 24px; height: 24px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800;
  background: #ECFEFF; color: #0E7490; box-shadow: inset 0 0 0 1px #A5F3FC; }
.mor-box.rec .mor-n { background: #DCFCE7; color: #166534; box-shadow: inset 0 0 0 1px #86EFAC; }
.mor-ph { margin-top: 4px; border-top: 1px dashed #BBF7D0; padding-top: 6px; }
.mor-ph-h { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 800; color: var(--text-3); margin-bottom: 5px; }
.mor-lang { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.mor-lang button { border: 0; background: var(--surface); font: inherit; font-size: 11.5px; font-weight: 800; padding: 1px 9px; cursor: pointer; color: var(--text-2); }
.mor-lang button.on { background: #16A34A; color: #fff; }
.mor-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mor-chips button { border: 1px solid #BBF7D0; background: var(--surface); color: #166534; border-radius: 999px; font: inherit; font-size: 12.5px; font-weight: 700; padding: 3px 10px; cursor: pointer; }
.mor-chips button:hover { background: #DCFCE7; border-color: #86EFAC; }
.mor-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mor-foot .faint { font-size: 12.5px; }
.mor-f .err-box:not(:empty) { margin-top: 10px; }
:root[data-theme="dark"] .mor-quick button, :root[data-theme="dark"] .mor-n { background: color-mix(in srgb, #0E7490 25%, var(--surface)); color: #A5F3FC; box-shadow: none; border-color: transparent; }
:root[data-theme="dark"] .mor-box.rec .mor-n, :root[data-theme="dark"] .mor-chips button { background: color-mix(in srgb, #16A34A 18%, var(--surface)); color: #BBF7D0; border-color: transparent; }
@media (max-width: 900px) { .mor-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mor-cols { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .mor-top { grid-template-columns: 1fr; } .mor-top > [style*="span"] { grid-column: auto !important; } }
.mor-tip { margin-top: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 5px; }

/* ================================================================ طباعة: تقرير طبي وإشعار مراجعة */
.mor-doc { -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 14px; }
.mor-doc .mr-band { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; background: linear-gradient(90deg, #0E7490, #155E75); color: #fff;
  border-radius: 10px; padding: 10px 16px; margin: 4px 0 12px; }
.mor-doc .mr-band b { font-size: 19px; font-weight: 900; }
.mor-doc .mr-band span { font-size: 12px; font-weight: 800; letter-spacing: 1.5px; direction: ltr; opacity: .9; }
.mor-doc .mr-to { display: flex; align-items: baseline; gap: 10px; padding: 0 4px 10px; font-size: 15px; }
.mor-doc .mr-to span { color: #555; font-weight: 700; }
.mor-doc .mr-to small, .mor-doc .mr-c small { color: #888; font-weight: 600; font-size: 11px; direction: ltr; }
.mor-doc .mr-to b { font-size: 16px; }
.mor-doc .mr-info { display: grid; grid-template-columns: 2fr 1fr 1fr; border: 1px solid #CFE8EE; border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.mor-doc .mr-c { padding: 7px 12px; border-bottom: 1px solid #E3F1F4; border-inline-start: 1px solid #E3F1F4; display: flex; flex-direction: column; gap: 2px; background: #F7FCFD; }
.mor-doc .mr-c:nth-child(3n + 1) { border-inline-start: 0; }
.mor-doc .mr-c:nth-last-child(-n + 3) { border-bottom: 0; }
.mor-doc .mr-c span { font-size: 12px; color: #4B6B73; font-weight: 700; }
.mor-doc .mr-c b { font-size: 15px; color: #111; }
.mor-doc .mr-sec { border: 1px solid #E5E7EB; border-inline-start: 5px solid #0E7490; border-radius: 10px; padding: 8px 14px 6px; margin-bottom: 10px; break-inside: avoid; }
.mor-doc .mr-sec.rec { border-inline-start-color: #16A34A; }
.mor-doc .mr-h { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px dashed #D1D5DB; padding-bottom: 5px; margin-bottom: 4px; }
.mor-doc .mr-h b { font-size: 16px; font-weight: 900; color: #0E7490; }
.mor-doc .mr-sec.rec .mr-h b { color: #15803D; }
.mor-doc .mr-h span { font-size: 11.5px; font-weight: 800; color: #888; letter-spacing: .6px; direction: ltr; text-transform: uppercase; }
.mor-doc ol { margin: 0; padding: 0; list-style: none; counter-reset: mr; }
.mor-doc ol li { counter-increment: mr; display: flex; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px dotted #E5E7EB; font-size: 15px; line-height: 1.6; }
.mor-doc ol li:last-child { border-bottom: 0; }
.mor-doc ol li::before { content: counter(mr); flex: none; width: 22px; height: 22px; border-radius: 50%; background: #ECFEFF; color: #0E7490; border: 1px solid #A5F3FC;
  font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.mor-doc .mr-sec.rec ol li::before { background: #F0FDF4; color: #15803D; border-color: #86EFAC; }
.mor-doc .mr-none { margin: 4px 0; color: #999; }
.mor-doc .mr-next { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 2px solid #0E7490; background: #ECFEFF; border-radius: 12px; padding: 10px 16px; margin: 12px 0; break-inside: avoid; }
.mor-doc .mr-next div { display: flex; flex-direction: column; }
.mor-doc .mr-next div b { font-size: 15px; color: #0E7490; }
.mor-doc .mr-next div span { font-size: 11.5px; color: #4B6B73; font-weight: 700; direction: ltr; text-align: right; }
.mor-doc .mr-next strong { font-size: 19px; font-weight: 900; color: #0B4F5E; }
.mor-doc .mr-note { font-size: 12.5px; color: #555; text-align: center; margin: 10px 0 0; line-height: 1.7; }
.mor-doc .mr-note span { direction: ltr; display: inline-block; color: #777; }
.mor-doc .mr-sign { display: grid; grid-template-columns: 1fr 1fr auto; gap: 24px; align-items: end; margin-top: 22px; break-inside: avoid; }
.mor-doc .mr-sign > div { display: flex; flex-direction: column; gap: 3px; }
.mor-doc .mr-sign span { font-size: 12px; color: #666; font-weight: 700; }
.mor-doc .mr-sign b { font-size: 14.5px; min-height: 20px; }
.mor-doc .mr-sign .ln { border-top: 1px solid #999; margin-top: 30px; padding-top: 4px; font-size: 11.5px; color: #888; }
.mor-doc .mr-sign .stamp { width: 120px; height: 90px; border: 1.5px dashed #9CC9D3; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; color: #7AA7B1; font-size: 12px; }

/* ================================================================ الإجازة المرضية: شاشة واحدة عريضة (نفس شكل إشعار المراجعة) */
.sk-f { display: flex; flex-direction: column; gap: 10px; }
.sk-f .mor-cols { margin-top: 0; }
.sk-f .mor-box { padding: 8px 12px 10px; }
.sk-f .mor-h > i { color: #DC2626; }
.sk-f .sk-pat .mor-h > i { color: #0E7490; }
.sk-f .mor-box.rec .mor-h > i { color: #16A34A; }
.sk-f .mor-top { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.sk-f .field > label.bl > i { color: #64748B; }
.sk-f .input { height: 38px; }
.sk-leave { background: color-mix(in srgb, #DC2626 4%, var(--surface)) !important; border-color: #FECACA !important; }
.sk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; align-items: start; }
.sk-days { display: flex; height: 38px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.sk-days button { width: 38px; flex: none; border: 0; background: #FEF2F2; color: #B91C1C; font-size: 20px; font-weight: 900; cursor: pointer; }
.sk-days button:hover { background: #FEE2E2; }
.sk-days .input { flex: 1; min-width: 0; height: 100%; border: 0; border-radius: 0; text-align: center; font-size: 20px; font-weight: 900; color: #B91C1C; }
.sk-q button { border-color: #FECACA; background: #FEF2F2; color: #B91C1C; }
.sk-q button:hover { background: #FEE2E2; }
.sk-until { display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: #B91C1C; background: var(--surface); }
.sk-recs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.sk-ref { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.sk-yn-in { display: flex; gap: 4px; }
.sk-yn-in .input { flex: 1; min-width: 0; }
.sk-yn-in button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 800; padding: 0 9px; cursor: pointer; color: var(--text-2); }
.sk-yn-in button.on { background: #16A34A; border-color: #16A34A; color: #fff; }
.sk-yn-in button + button.on { background: #DC2626; border-color: #DC2626; }
.sk-f .field.sk-yn > label.bl > span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .sk-f .mor-top, .sk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .sk-f .mor-top, .sk-grid, .sk-recs, .sk-ref { grid-template-columns: 1fr; } }

/* ---------- طباعة الإجازة المرضية: نفس التقرير الطبي بلون أحمر */
.sick-doc .mr-band { background: linear-gradient(90deg, #B91C1C, #991B1B); }
.sick-doc .mr-info { border-color: #F5D0D0; }
.sick-doc .mr-c { background: #FFFAFA; border-color: #F8E1E1; }
.sick-doc .mr-c span { color: #7F4B4B; }
.sick-doc .sk-callout { border: 2px solid #DC2626; background: #FEF2F2; border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; break-inside: avoid; }
.sick-doc .sk-callout p { margin: 0; font-size: 15.5px; line-height: 1.8; }
.sick-doc .sk-callout p b { color: #991B1B; font-size: 17px; }
.sick-doc .sk-callout p.en { direction: ltr; text-align: left; font-size: 12.5px; color: #7F4B4B; }
.sick-doc .sk-callout p.en b { font-size: 13px; }
.sick-doc .sk-dates { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #FCA5A5; }
.sick-doc .sk-dates div { display: flex; flex-direction: column; align-items: center; }
.sick-doc .sk-dates span { font-size: 11.5px; color: #7F4B4B; font-weight: 700; }
.sick-doc .sk-dates b { font-size: 17px; font-weight: 900; color: #7F1D1D; }
.sick-doc .sk-dates i { font-style: normal; font-size: 20px; color: #DC2626; }
.sick-doc .sk-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.sick-doc .sk-tbl th { text-align: start; font-weight: 700; padding: 5px 0; width: 62%; border-bottom: 1px dotted #E5E7EB; }
.sick-doc .sk-tbl th small { display: block; font-size: 11px; color: #888; font-weight: 600; direction: ltr; text-align: right; }
.sick-doc .sk-tbl td { padding: 5px 8px; font-weight: 800; border-bottom: 1px dotted #E5E7EB; }
.sick-doc .sk-tbl tr:last-child th, .sick-doc .sk-tbl tr:last-child td { border-bottom: 0; }
.sick-doc .sk-ref-p { margin: 4px 0; font-size: 14.5px; line-height: 1.8; }
.sick-doc .mr-sign .stamp { border-color: #E5B3B3; color: #C08080; }
/* الإجازة: بيانات المريض في سطر واحد ، التوصيات بعرض الشاشة (3 في السطر) ، الإحالة بتتفتح بزرار */
.sk-f .mor-top.sk-pat-row { grid-template-columns: 2fr 0.7fr 1fr 1fr 1.2fr 1.2fr; }
.sk-f .mor-top.sk-pat-row > [style*="span 2"] { grid-column: auto !important; }
.sk-recs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sk-ref { grid-template-columns: 2fr 1fr 1fr; }
.sk-ref > [style*="span 2"] { grid-column: auto !important; }
.sk-refbox[hidden] { display: none !important; }
.sk-f { gap: 8px; }
.sk-f .mor-foot { margin-top: 4px; }
@media (max-width: 900px) { .sk-f .mor-top.sk-pat-row, .sk-recs, .sk-ref { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================================================================ تحويل المريض لطبيب آخر */
.tr-f { display: flex; flex-direction: column; gap: 10px; }
.tr-flow { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 12px; align-items: stretch; }
.tr-pt { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--surface-2); }
.tr-pt .av, .tr-doc .av { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--violet-50); color: var(--violet-d); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; }
.tr-pt div { display: flex; flex-direction: column; min-width: 0; }
.tr-pt small, .tr-end small { font-size: 11.5px; color: var(--text-3); font-weight: 700; }
.tr-pt b { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-pt em { font-style: normal; font-size: 12.5px; color: var(--text-2); }
.tr-path { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.tr-end { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; min-width: 0; }
.tr-end b { font-size: 15.5px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-end.from { background: var(--surface-2); }
.tr-end.to { border: 2px dashed #F0ABFC; background: #FDF4FF; }
.tr-end.to b { color: #A21CAF; }
.tr-end.to:not(.set) b { font-weight: 600; font-size: 14px; color: #C084FC; }
.tr-end.to.set { border-style: solid; border-color: #C026D3; box-shadow: 0 4px 14px rgba(192, 38, 211, .14); }
.tr-path > i { font-size: 30px; color: #C026D3; }
.tr-moves { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 7px 12px; }
.tr-moves > b { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-weight: 700; }
.tr-moves > b i { color: var(--violet); }
.tr-moves .hl { color: #A21CAF; }
.tr-h { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 6px; }
.tr-h b { display: inline-flex; align-items: center; gap: 6px; font-size: 15.5px; font-weight: 900; }
.tr-h b i { color: #C026D3; font-size: 18px; }
.tr-h small { font-size: 11.5px; color: var(--text-3); font-weight: 700; }
.tr-find { margin-inline-start: auto; position: relative; width: min(320px, 50%); }
.tr-find i { position: absolute; top: 50%; transform: translateY(-50%); right: 10px; color: var(--text-3); }
.tr-find .input { height: 36px; padding-inline-start: 32px; }
.tr-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; margin-bottom: 10px; }
.tr-doc { position: relative; display: flex; align-items: center; gap: 10px; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 10px; cursor: pointer; font: inherit; color: var(--text); }
.tr-docs .tr-doc:hover { border-color: #F0ABFC; background: #FDF4FF; }
.tr-docs .tr-doc.on { border-color: #C026D3; background: #FDF4FF; box-shadow: inset -4px 0 0 #C026D3; color: var(--text); }
.tr-doc.on .av { background: #C026D3; color: #fff; }
.tr-doc .tx { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.tr-doc .tx b { font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-doc .tx small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.tr-doc .tx em { font-style: normal; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-doc .ld { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 44px; line-height: 1.1; }
.tr-doc .ld b { font-size: 17px; font-weight: 900; color: #D97706; }
.tr-doc .ld small { font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.tr-doc .ld.free b { color: #16A34A; }
.tr-doc .ld.busy b { color: #DC2626; }
.tr-doc .same { position: absolute; top: -7px; inset-inline-end: 10px; background: #0E7490; color: #fff; font-size: 10.5px; font-weight: 800; border-radius: 999px; padding: 0 7px; line-height: 16px; }
.tr-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tr-reasons button { display: inline-flex; align-items: baseline; gap: 5px; border: 1px solid #F0ABFC; background: var(--surface); color: #86198F; border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.tr-reasons button small { font-size: 11px; color: var(--text-3); font-weight: 600; direction: ltr; }
.tr-reasons button:hover { background: #FDF4FF; }
.tr-reasons button.on { background: #C026D3; border-color: #C026D3; color: #fff; }
.tr-reasons button.on small { color: rgba(255, 255, 255, .8); }
.tr-f textarea.input { height: auto; padding: 8px 10px; font-size: 15px; width: 100%; }
.tr-go { height: 44px; font-size: 15.5px; padding: 0 22px; }
.tr-go:disabled { opacity: .45; cursor: not-allowed; }
:root[data-theme="dark"] .tr-end.to, :root[data-theme="dark"] .tr-doc.on, :root[data-theme="dark"] .tr-doc:hover { background: color-mix(in srgb, #C026D3 14%, var(--surface)); }
@media (max-width: 900px) { .tr-flow { grid-template-columns: 1fr; } .tr-find { width: 100%; } .tr-h { flex-wrap: wrap; } }

/* ================================================================ المرفقات: صور أكبر في القايمة + عارض على الشاشة كلها */
.att-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; gap: 12px !important; }
.att-tile img, .att-pdf { height: 170px !important; }
.att-tile { transition: transform .1s, box-shadow .1s; }
.att-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20, 12, 60, .15); border-color: var(--violet) !important; }
.att-cap { font-size: 12.5px !important; }

.att-lb { position: fixed; inset: 0; z-index: 990; background: #0B0F17; display: flex; flex-direction: column; color: #E5E7EB; }
.lb-top { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: rgba(255, 255, 255, .04); border-bottom: 1px solid rgba(255, 255, 255, .08); flex: none; }
.lb-info { min-width: 0; flex: 1; }
.lb-pat { font-size: 15px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-pat b { font-weight: 800; }
.lb-meta { font-size: 12.5px; color: #9CA3AF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-meta b { color: #E5E7EB; }
.lb-ed { color: #FBBF24; font-weight: 700; }
.lb-cnt { font-size: 14px; color: #9CA3AF; background: rgba(255, 255, 255, .06); border-radius: 999px; padding: 3px 12px; flex: none; }
.lb-cnt b { color: #fff; font-size: 16px; }
.lb-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.lb-b { height: 36px; min-width: 36px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #E5E7EB; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; }
.lb-b i { font-size: 18px; }
.lb-b:hover { background: rgba(255, 255, 255, .14); }
.lb-b.bad:hover { background: #B91C1C; border-color: #B91C1C; }
.lb-b.close { background: rgba(255, 255, 255, .12); }
.lb-z { min-width: 46px; text-align: center; font-size: 12.5px; color: #9CA3AF; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: stretch; }
.lb-img { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px; }
.lb-img img { width: 100%; height: 100%; object-fit: contain; user-select: none; transition: transform .12s; cursor: zoom-in; }
.lb-img img.zoomed { cursor: grab; transition: none; }
.lb-img iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 54px; height: 90px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .10);
  color: #fff; font-size: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lb-nav.prev { right: 12px; }
.lb-nav.next { left: 12px; }
.lb-strip { flex: none; display: flex; gap: 8px; padding: 8px 14px 10px; overflow-x: auto; background: rgba(255, 255, 255, .03); border-top: 1px solid rgba(255, 255, 255, .08); scrollbar-width: thin; }
.lb-th { position: relative; flex: none; width: 92px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: #1F2937; cursor: pointer; opacity: .55; transition: opacity .1s, border-color .1s; }
.lb-th:hover { opacity: .85; }
.lb-th.on { opacity: 1; border-color: #8B5CF6; box-shadow: 0 0 0 2px rgba(139, 92, 246, .35); }
.lb-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-th .pdf { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: #FCA5A5; font-size: 26px; }
.lb-th .n { position: absolute; bottom: 2px; inset-inline-start: 4px; font-size: 11px; font-weight: 800; color: #fff; background: rgba(0, 0, 0, .55); border-radius: 6px; padding: 0 5px; }
@media (max-width: 720px) { .lb-top { flex-wrap: wrap; } .lb-nav { width: 40px; height: 64px; font-size: 26px; } .lb-z, #lbZo, #lbZi { display: none; } }

/* محرر الصور: الصورة بتملى الشاشة (المقاس بيتحسب في JS) */
.ie-stage canvas { max-width: none !important; max-height: none !important; }
.ie-stage { overflow: hidden !important; }
/* المرفقات: المريض يمين ، والاختيار بين مرفقات الفاتورة / كل مرفقات المريض + إضافة مرفق في نفس السطر شمال */
.att-head2 { gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.att-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-who .av { width: 44px; height: 44px; flex: none; border-radius: 13px; background: var(--violet-50); color: var(--violet-d); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 17px; }
.att-who > div { display: flex; flex-direction: column; min-width: 0; }
.att-who > div > b { font-size: 18px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-who > div > span { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text-2); }
.att-who > div > span i { color: var(--violet); font-size: 16px; }
.att-who > div > span i + * { margin-inline-end: 0; }
.att-who > div > span b { color: var(--text); font-size: 15px; margin-inline-end: 10px; }
.att-seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.att-seg button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-size: 14.5px; font-weight: 800; color: var(--text-2); cursor: pointer; }
.att-seg button i { font-size: 17px; }
.att-seg button .n { min-width: 24px; height: 22px; border-radius: 999px; background: var(--line); color: var(--text-2); font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.att-seg button:hover { background: var(--surface); }
.att-seg button.on { background: var(--violet); color: #fff; box-shadow: 0 2px 8px rgba(124, 92, 255, .3); }
.att-seg button.on .n { background: rgba(255, 255, 255, .25); color: #fff; }
.att-add { height: 46px; font-size: 15px; padding: 0 18px; }

/* ---------- مخطط الأسنان: رأس كحلي زي «بيانات المريض» في الفاتورة ، واختيار دائمة / لبنية أبيض عليه */
.card-head.ch-dark { background: linear-gradient(135deg, #2A1F6B, #3B2E8F); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-block: 10px; }
.card-head.ch-dark .card-title, .card-head.ch-dark .card-title i { color: #fff; }
.card-head.ch-dark .card-title { font-size: 17px; display: flex; align-items: baseline; gap: 8px; }
.card-head.ch-dark .card-title small { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .65); }
.seg.tmode { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); }
.seg.tmode button { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: rgba(255, 255, 255, .8); cursor: pointer; font: inherit; }
.seg.tmode button i { font-size: 20px; }
.seg.tmode button span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.seg.tmode button b { font-size: 15px; font-weight: 900; }
.seg.tmode button small { font-size: 10.5px; font-weight: 700; opacity: .75; direction: ltr; }
.seg.tmode button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.seg.tmode button.on { background: #fff; color: #3B2E8F; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); }
.seg.tmode button.on i { color: var(--violet); }
.seg.tmode button.on small { opacity: .7; color: #3B2E8F; }
/* شرح ألوان مخطط الأسنان: أكبر وكل حالة في شريحة بلونها */
.chart-legend { gap: 10px; font-size: 14.5px; margin-top: 10px; align-items: center; }
.chart-legend .lgp { display: inline-flex; align-items: center; gap: 7px; padding: 5px 14px; border-radius: 999px; font-weight: 800; }
.chart-legend .lgp.on { background: var(--violet-50); color: var(--violet-d); border: 1.5px solid var(--violet); }
.chart-legend .lgp.old { background: #ECFCCB; color: #3F6212; border: 1.5px solid #65A30D; }
.chart-legend .lgp.tip { color: var(--text-2); font-weight: 600; background: var(--surface-2); border: 1px dashed var(--line); }
.chart-legend .lgp.tip i { font-size: 17px; color: var(--violet); }
.chart-legend .lg { width: 16px; height: 16px; margin: 0; border-radius: 5px; }
.chart-legend .lg.old { background: #BEF264; border-color: #65A30D; }
/* السنة اللي اتعالجت قبل كده على المخطط: أخضر أوضح */
.tooth.old path { fill: #D9F99D; stroke: #65A30D; stroke-width: 1.6; }
:root[data-theme="dark"] .chart-legend .lgp.old { background: #1F2E0B; color: #BEF264; }
:root[data-theme="dark"] .tooth.old path { fill: #3F6212; stroke: #A3E635; }
/* شاشة الأسنان: بيانات المريض فوق أكبر ، واسم الطبيب بولد في شريحة */
.th-head .th-facts { font-size: 15.5px !important; gap: 8px 18px !important; color: var(--text) !important; align-items: center; }
.th-head .th-facts > span { display: inline-flex; align-items: center; gap: 6px; }
.th-head .th-facts i { font-size: 18px !important; color: var(--violet); }
.th-head .th-facts b { font-size: 16.5px; font-weight: 900; }
.th-head .th-facts .th-dr { font-weight: 900; font-size: 16px; color: var(--violet-d); background: var(--violet-50); border: 1px solid var(--violet-100); border-radius: 999px; padding: 3px 14px; }
/* عناوين المجموعات في القوايم العربي (أسباب الخصم): عربي يمين بخط أوضح */
.med-pop .mp-body[dir="rtl"] .mp-grp { letter-spacing: 0; font-size: 12.5px; color: var(--violet-d); background: var(--surface); }
.th-head .th-facts .th-dr { margin-inline-start: auto; }   /* اسم الطبيب على أقصى الشمال تحت «رجوع للكشف» بعيد عن بيانات المريض */

/* ================================================================ الأسنان: خدمات الجلسة — رأس كحلي زي خصم الطبيب ، وكل خدمة في سطر شكله كارت */
.srv-card .card-head { padding: 9px 16px; }
.srv-card .srv-add { background: #fff; color: #3B2E8F; border-color: #fff; font-weight: 800; height: 34px; }
.srv-card .srv-add:hover { background: #EDE9FE; }
.srv-card .table-wrap { padding: 4px 10px 6px; }
.teeth-tbl { border-collapse: separate !important; border-spacing: 0 7px; }
.teeth-tbl thead th { background: transparent !important; font-size: 14.5px; font-weight: 900; color: var(--text); padding: 8px 8px 2px; border: 0; }
.teeth-tbl thead th small { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); direction: ltr; }
.teeth-tbl thead th.n small { text-align: inherit; }
.teeth-tbl tbody td { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 7px 6px; font-size: 15px; }
.teeth-tbl tbody td:first-child { border-inline-start: 4px solid #B9B2D6; border-start-start-radius: 12px; border-end-start-radius: 12px; }
.teeth-tbl tbody td:last-child { border-inline-end: 1px solid var(--line); border-start-end-radius: 12px; border-end-end-radius: 12px; }
.teeth-tbl tbody tr:hover td { background: color-mix(in srgb, var(--violet) 4%, var(--surface)); }
.teeth-tbl tbody tr.sel td { background: var(--violet-50) !important; border-color: var(--violet-100); }
.teeth-tbl tbody tr.sel td:first-child { border-inline-start-color: var(--violet); }
.teeth-tbl .rn span { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface); color: var(--violet-d); font-weight: 900; font-size: 13.5px; box-shadow: inset 0 0 0 1px var(--violet-100); }
.teeth-tbl tbody tr.sel .rn span { background: var(--violet); color: #fff; box-shadow: none; }
.teeth-tbl .cell { height: 38px; font-size: 15px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.teeth-tbl .cell[data-f="teeth_no"] { font-size: 17px; font-weight: 900; color: var(--violet-d); text-align: center; }
.teeth-tbl td[data-v] { font-size: 16px; font-weight: 900; color: var(--text); }
.teeth-tbl .tl { top: 50%; transform: translateY(-50%); }
.teeth-tbl tbody tr:not([data-i]) td { background: transparent; border: 0; }
/* إجمالي الجلسة */
.teeth-tbl tfoot td { background: #2A1F6B; color: #fff; border: 0; padding: 10px 8px; font-size: 16px; font-weight: 900; }
.teeth-tbl tfoot td:first-child { border-start-start-radius: 12px; border-end-start-radius: 12px; }
.teeth-tbl tfoot td:last-child { border-start-end-radius: 12px; border-end-end-radius: 12px; }
.teeth-tbl tfoot .tt-l { display: inline-flex; align-items: center; gap: 7px; font-size: 17px; }
.teeth-tbl tfoot .tt-l i { font-size: 20px; color: #C4B5FD; }
.teeth-tbl tfoot .tt-l small { font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .65); }
.teeth-tbl tfoot #tTot { font-size: 20px; color: #fff; }
.teeth-tbl tfoot #tQty { font-size: 17px; color: #DDD6FE; }
/* تدرّج الألوان في الأسنان: المخطط كحلي غامق ← خدمات الجلسة وخصم الطبيب بنفسجي متوسط ← الإجمالي فاتح */
.card-head.ch-dark.ch-mid { background: linear-gradient(135deg, #6B5BD2, #7F70E0); }
.card-head.ch-dark.ch-mid .card-title small { color: rgba(255, 255, 255, .78); }
.srv-card .ch-mid .srv-add { color: #5B4BC4; }
.teeth-tbl tfoot td { background: #F1EEFF; color: #3B2E8F; border-top: 1px solid #DDD6FE; border-bottom: 1px solid #DDD6FE; }
.teeth-tbl tfoot td:first-child { border-inline-start: 4px solid #A99BF0; }
.teeth-tbl tfoot td:last-child { border-inline-end: 1px solid #DDD6FE; }
.teeth-tbl tfoot .tt-l i { color: #7C6BE0; }
.teeth-tbl tfoot .tt-l small { color: #8B80B8; }
.teeth-tbl tfoot #tTot { color: #2A1F6B; }
.teeth-tbl tfoot #tQty { color: #5B4BC4; }
:root[data-theme="dark"] .teeth-tbl tfoot td { background: #221A4D; color: #DDD6FE; border-color: #2E2466; }
:root[data-theme="dark"] .teeth-tbl tfoot #tTot { color: #fff; }
/* إجمالي الجلسة تحت خالص: كارت الخدمات بيتمد لآخر كارت خصم الطبيب والإجمالي في آخره */
.teeth-layout { align-items: stretch !important; }
.teeth-layout > .side-panel { display: flex; flex-direction: column; }
.teeth-layout > .side-panel > .dis-card { flex: 1; }
.srv-card { display: flex; flex-direction: column; }
.srv-card .srv-total { margin: auto 10px 10px; display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 12px;
  background: #F1EEFF; border: 1px solid #DDD6FE; border-inline-start: 4px solid #A99BF0; color: #3B2E8F; }
.srv-card .srv-total .tt-l { display: inline-flex; align-items: center; gap: 7px; font-size: 17px; font-weight: 900; }
.srv-card .srv-total .tt-l i { font-size: 20px; color: #7C6BE0; }
.srv-card .srv-total .tt-l small { font-size: 11.5px; font-weight: 600; color: #8B80B8; }
.srv-card .srv-total .tt-q { font-size: 13.5px; font-weight: 700; color: #6B5FA8; }
.srv-card .srv-total .tt-q b { font-size: 16px; color: #5B4BC4; margin-inline-start: 4px; }
.srv-card .srv-total .tt-v { font-size: 22px; font-weight: 900; color: #2A1F6B; min-width: 120px; text-align: left; }
:root[data-theme="dark"] .srv-card .srv-total { background: #221A4D; border-color: #2E2466; color: #DDD6FE; }
:root[data-theme="dark"] .srv-card .srv-total .tt-v { color: #fff; }

/* ================================================================ الحذف في كل البرنامج: أيقونة السلة في مربع أحمر واضح */
.btn.btn.btn:has(> .ti-trash), .icon-btn:has(> .ti-trash), .lb-b:has(> .ti-trash) {
  background: #FEF2F2 !important; border: 1px solid #FCA5A5 !important; color: #DC2626 !important; opacity: 1 !important; }
.btn.btn.btn:has(> .ti-trash) i, .icon-btn:has(> .ti-trash) i, .lb-b:has(> .ti-trash) i { color: #DC2626 !important; }
.btn.btn.btn:has(> .ti-trash):hover:not(:disabled), .icon-btn:has(> .ti-trash):hover, .lb-b:has(> .ti-trash):hover {
  background: #DC2626 !important; border-color: #DC2626 !important; color: #fff !important; }
.btn.btn.btn:has(> .ti-trash):hover:not(:disabled) i, .icon-btn:has(> .ti-trash):hover i, .lb-b:has(> .ti-trash):hover i { color: #fff !important; }
.icon-btn:has(> .ti-trash) { border-radius: 9px; }
:root[data-theme="dark"] .btn.btn.btn:has(> .ti-trash), :root[data-theme="dark"] .icon-btn:has(> .ti-trash) { background: #3B1414 !important; border-color: #7F1D1D !important; }

/* نافذة تأكيد الحذف */
.ask-box.danger .ask-ic { background: #FEE2E2 !important; color: #DC2626 !important; box-shadow: 0 0 0 6px #FEF2F2; }
.ask-box.danger .ask-ic i { color: #DC2626 !important; }
.ask-box.danger h3 { color: #B91C1C; }
.ask-box.danger .ask-warn { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12.5px; font-weight: 700; color: #B45309; }
.ask-box.danger .ask-del { background: #DC2626 !important; border-color: #DC2626 !important; color: #fff !important; }
.ask-box.danger .ask-del i { color: #fff !important; }
.ask-box.danger .ask-del:hover { background: #B91C1C !important; }
.ask-box.danger [data-x]:focus-visible, .ask-box.danger [data-x]:focus { outline: 2px solid var(--violet); outline-offset: 2px; }
.ask-box.danger .btn.btn.btn.ask-del { background: #DC2626 !important; border-color: #DC2626 !important; color: #fff !important; }
.ask-box.danger .btn.btn.btn.ask-del i { color: #fff !important; }
.ask-box.danger .btn.btn.btn.ask-del:hover { background: #B91C1C !important; border-color: #B91C1C !important; }

/* رقم النسخة (VER) تحت شاشة الدخول وفي آخر القايمة الجانبية */
.app-ver { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--text-3); letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.app-ver b { color: var(--violet-d); font-weight: 900; }
.app-ver span { background: #FEF3C7; color: #92400E; border-radius: 6px; padding: 0 5px; font-size: 11px; }
.app-ver.side { margin-top: 6px; font-size: 11px; color: rgba(255, 255, 255, .45); }
.app-ver.side b { color: rgba(255, 255, 255, .75); }

/* خانات «كارت الطبيب»: لون سماوي + أيقونة الكارت جنب الاسم */
.field.on-card .input, .field.on-card .select, .field.on-card textarea { background: #ECFEFF; border-color: #67E8F9; }
.field.on-card .input:focus, .field.on-card .select:focus, .field.on-card textarea:focus { border-color: #06B6D4; box-shadow: 0 0 0 3px rgba(6, 182, 212, .18); }
.field .card-mk { color: #0891B2; font-size: 15px; vertical-align: -2px; margin-inline-start: 3px; }
.card-legend { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 7px 12px; border: 1px solid #A5F3FC; background: #ECFEFF; border-radius: 10px; font-size: 13px; color: #155E75; }
.card-legend i { font-size: 18px; color: #0891B2; }
:root[data-theme="dark"] .field.on-card .input, :root[data-theme="dark"] .field.on-card .select, :root[data-theme="dark"] .field.on-card textarea { background: #0B2A33; border-color: #155E75; }
:root[data-theme="dark"] .card-legend { background: #0B2A33; border-color: #155E75; color: #A5F3FC; }
/* قسم الدوام: الأوقات ومدة الكشف في نص الخانة */
.fsec:has(.tm-wrap) .field > label { text-align: center; display: block; }
.fsec:has(.tm-wrap) .tm-wrap .tm-in { text-align: center !important; padding-inline: 8px; }
.fsec:has(.tm-wrap) .tm-wrap .tm-hint { position: static; transform: none; display: block; text-align: center; margin-top: 3px; }
.fsec:has(.tm-wrap) .select { text-align: center; text-align-last: center; }

/* «حسابي» (ti-user-circle): ذهبي مميز في البرنامج كله */
.btn.btn.btn:has(> .ti-user-circle) { background: linear-gradient(180deg, #FDE68A, #FACC15); border-color: #EAB308; color: #713F12; font-weight: 800; }
.btn.btn.btn:has(> .ti-user-circle):hover { background: #FACC15; border-color: #CA8A04; color: #713F12; }
.btn.btn.btn:has(> .ti-user-circle) i { color: #854D0E; }
.foot-links a[href="#/me"] { color: #FACC15; font-weight: 800; }

/* ================= زرار «رجوع» في الشريط اللي فوق (موبايل / تابلت) — زي التطبيقات ================= */
.mback { display: none; }
@media (max-width: 1024px) {
  .mbar .mback:not([hidden]) { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px 0 10px; margin-inline-end: 2px;
    border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff;
    font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s; }
  .mbar .mback i { font-size: 19px; color: var(--lime); }
  .mbar .mback:active { transform: scale(.95); background: rgba(255, 255, 255, .2); }
  [dir="ltr"] .mbar .mback i { transform: scaleX(-1); }
  body.has-back .mbar .mbrand span:not(.logo-mark) { display: none; }   /* مساحة للزرار: اللوجو بس */
}

/* ================= الموبايل (فحص كل الشاشات على 360 / 390 / 430) ================= */
@media (max-width: 1024px) {
  .app { grid-template-rows: auto 1fr; }   /* الشريط اللي فوق على قده — من غير مساحة فاضية فوق العنوان */
}
@media (max-width: 720px) {
  /* الجداول كروت: كل صف كارت ، العنوان على اليمين والقيمة جنبه */
  .tbl.mcards { min-width: 0 !important; width: 100%; border-collapse: separate; }
  .tbl.mcards thead { display: none; }
  .tbl.mcards, .tbl.mcards tbody, .tbl.mcards tfoot { display: block; }
  .tbl.mcards tr { display: block; margin: 0 0 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 3px rgba(20, 14, 70, .05); }
  .tbl.mcards tr.clickable:active { background: var(--violet-50); }
  .tbl.mcards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0 !important; border: 0 !important;
    border-bottom: 1px dashed var(--line-soft) !important; text-align: end !important; white-space: normal !important; min-height: 0; height: auto; }
  .tbl.mcards td:last-child { border-bottom: 0 !important; }
  .tbl.mcards td::before { content: attr(data-l); flex: none; max-width: 46%; text-align: start; font-size: 12px; font-weight: 700; color: var(--text-3); }
  .tbl.mcards td:not([data-l])::before, .tbl.mcards td[data-l=""]::before { content: none; }
  .tbl.mcards td:not([data-l]):empty, .tbl.mcards td[data-l]:empty { display: none; }
  .tbl.mcards td.mc-span { display: block; text-align: start !important; font-weight: 800; }
  .tbl.mcards tr.group-row, .tbl.mcards tr.sub-total { background: var(--violet-50); }
  .tbl.mcards tfoot tr { background: var(--surface-2, #F7F5FF); font-weight: 800; }
  .tbl.mcards .sub { display: block; }
  .table-wrap:has(> .tbl.mcards) { overflow: visible; border: 0; background: none; box-shadow: none; }
  .tbl.mcards tr.bal-deb { background: #FEF2F2; border-color: #FCA5A5; } .tbl.mcards tr.bal-cr { background: #F0FDF4; border-color: #86EFAC; }
  .tbl.mcards tr.bal-deb > td, .tbl.mcards tr.bal-cr > td { background: transparent !important; box-shadow: none !important; }

  /* أزرار راس الشاشة: الكلام ظاهر جنب الأيقونة (مش أيقونات بس) */
  .head-actions { flex-wrap: wrap; gap: 6px; }
  .head-actions .btn { flex: 1 1 auto; min-width: 0; }
  .head-actions .btn .lbl { display: inline; font-size: 13px; }

  /* أزرار الفاتورة: أيقونة وتحتها اسمها صغير */
  .inv-grp .btn, .inv-grp.acts .btn { flex-direction: column; justify-content: center; gap: 2px; height: auto; min-height: 50px; padding: 5px 2px !important; font-size: 10.5px !important; line-height: 1.15; white-space: normal; text-align: center; }
  .inv-grp .btn .lbl, .inv-grp.acts .lbl { display: block !important; font-size: 10.5px; font-weight: 700; }
  .inv-grp.acts .btn-save, .inv-grp.acts .inv-save-tmp { font-size: 10.5px !important; }
  .inv-grp .btn kbd, .inv-grp .btn .badge { display: none; }
  .inv-grp .btn i { font-size: 19px !important; }

  /* السند / الفاتورة المعروضة على الشاشة: راس المنشأة تحت بعض */
  #main .pdoc:not(.thermal) .pd-head { flex-direction: column; align-items: stretch; gap: 8px; }
  #main .pdoc .pd-co { font-size: 18px; line-height: 1.3; }
  #main .pdoc { padding: 12px !important; font-size: 13px; }
  #main .pdoc .pd-grid { grid-template-columns: 1fr 1fr; }

  /* تنقّل عرض السند: سطر واحد */
  .rv-nav .toolbar { flex-direction: row !important; flex-wrap: nowrap; align-items: center; gap: 6px; }
  .rv-nav .toolbar > .btn { flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; }
  .rv-nav .toolbar form { flex: 1 1 auto; min-width: 0; }
  .rv-nav .toolbar form .input { width: auto !important; flex: 1 1 auto; min-width: 0; }

  /* فلاتر التاريخ في البريد: كل تاريخ سطر */
  .mail-dates label { flex: 1 1 100%; }

  /* كروت الأرقام (المرضى / الأطباء …): اتنين جنب بعض */
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-cards .stat { padding: 10px 12px; min-height: 0; }
  .stat-cards .stat .v { font-size: 20px; }

  /* النوافذ الجانبية والخانات: عرض الشاشة كله */
  .drawer { width: 100vw !important; max-width: 100vw !important; }
  .drawer .nf-row > .field, .drawer .form-grid > .field { min-width: 0; }
  .input, .select, textarea.input { font-size: 16px; }   /* أقل من 16 = الآيفون بيعمل زووم لوحده لما تكتب */
}
@media (max-width: 720px) {
  /* الفاتورة على الموبايل: صف الأزرار التاني 3 جنب بعض ، وخانات المريض والزيارة اتنين اتنين */
  .inv-top .inv-grp.acts { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  #hf .form-grid.pat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px 10px; }
  #hf .pat-grid .pat-name, #hf .pat-grid .bk-field { grid-column: 1 / -1 !important; }
  #hf .form-grid.vis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px 10px; }
  #hf .vis-grid .vis-note, #hf .vis-grid .field[style*="display:none"] + .field.ins { grid-column: 1 / -1 !important; }
  #hf .vis-grid .vis-note { grid-row: auto !important; }
  #hf .vis-grid .seg { width: 100%; } #hf .vis-grid .seg button { flex: 1; }
}
@media (max-width: 720px) {
  .inv-top .inv-grp.acts { display: grid !important; grid-auto-flow: row !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; width: 100% !important; }
  .inv-top .inv-grp.nav { display: grid !important; grid-auto-flow: row !important; grid-template-columns: repeat(5, minmax(0, 1fr)) !important; width: 100% !important; }
}
@media (max-width: 720px) {
  /* شريط الحفظ اللي تحت: كل حاجة على قد الشاشة (حتى 320) */
  .mob-bar { gap: 6px; padding-inline: 8px; }
  .mob-bar .mb-t { flex: 0 1 auto; min-width: 0; }
  .mob-bar .mb-t b { font-size: 17px; white-space: nowrap; }
  .mob-bar .btn { flex: 1 1 0; min-width: 0; padding-inline: 6px; gap: 4px; font-size: 13px; white-space: nowrap; overflow: hidden; }
  .mob-bar .btn kbd { display: none; }
}

/* تتبع حركة المستخدمين: الإصدار + ويب / ديسكتوب */
.trk-ver { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.trk-ver b { font-weight: 800; font-size: 13px; }

/* =====================================================================
   شاشات المستندات (إيصال التسجيل 604 / الرسوم الدراسية 600 / السندات)
   النموذج على اليمين وملخص المبالغ على الشمال — على الموبايل تحت بعض
   ===================================================================== */
.note-row.warn { background: #FFF6E5; border-color: #F5D9A8; color: #7A4B00; }
:root[data-theme="dark"] .note-row.warn { background: #2A1F0E; border-color: #5A4320; color: #F5C46B; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; margin-bottom: 16px; }
.doc-tot { position: sticky; top: 16px; }
.tot-h { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; margin-bottom: 10px; }
.tot-h .ti { color: var(--violet); font-size: 20px; }
.tot-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.tot-row span { color: var(--text-2); }
.tot-row.big { border: 0; margin-top: 6px; padding: 12px; border-radius: 12px; background: var(--violet-50); font-size: 16px; }
.tot-row.big b { font-size: 20px; color: var(--violet-d); }
.doc-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-no { font-family: var(--display); font-size: 30px; font-weight: 900; line-height: 1.1; }
.doc-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.doc-dl dt { color: var(--text-3); font-size: 13px; }
.doc-dl dd { margin: 0; font-weight: 600; }
.doc-qr { display: block; width: 140px; height: 140px; margin: 14px auto 4px; image-rendering: pixelated; }
.doc-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.doc-nav { margin-bottom: 14px; }
.st-card { display: flex; gap: 14px; align-items: center; }
.st-card .av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--violet-50); color: var(--violet-d); font-weight: 800; flex: none; }
.st-card .nm { font-weight: 800; font-size: 17px; }
.st-card .facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 13px; margin-top: 4px; }
.st-card .facts .ti { color: var(--violet); }
.pick-row { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 6px; cursor: pointer; text-align: start; font: inherit; color: inherit; }
.pick-row:hover { border-color: var(--violet); background: var(--violet-50); }
.pick-row span { color: var(--text-3); }
@media (max-width: 900px) {
  .doc-grid { grid-template-columns: 1fr; }
  .doc-tot { position: static; }
  .doc-dl { grid-template-columns: 110px 1fr; }
}

/* ================================================================ شعار المهاب بألوانه الأصلية (زي برنامج العيادات) */
.logo-mark { background: url(../assets/logo-mohab-color.png?v=2) center / contain no-repeat; -webkit-mask: none; mask: none; }
.sidebar .brand .logo-mark, .mbar .mbrand .logo-mark, .auth-brand .logo-mark { filter: drop-shadow(0 0 6px rgba(255, 255, 255, .28)); }

/* ================================================================ حقول الإدخال في البرنامج كله (زي العيادات):
   لون فاتح مميز بدل الأبيض حتى يظهر الحقل على البطاقة ، وعند الدخول إليه يصبح أبيض بإطار بنفسجي */
:root { --field-bg: #F3F1FC; --field-line: #CFC8EE; --field-hover: #A99CE6; }
:root[data-theme="dark"] { --field-bg: #1F1C33; --field-line: #3B3561; --field-hover: #5B518F; }
.input, .select, textarea.input, select.input { background-color: var(--field-bg); border-color: var(--field-line); color: var(--text); }
.input:hover:not(:focus):not([readonly]):not(:disabled), .select:hover:not(:focus):not(:disabled) { border-color: var(--field-hover); }
.input:focus, .select:focus, textarea.input:focus { background-color: var(--surface); border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15); outline: none; }
:root[data-theme="dark"] .input:focus, :root[data-theme="dark"] .select:focus { box-shadow: 0 0 0 3px rgba(124, 92, 255, .28); }
.input[readonly], .input:disabled, .select:disabled { background-color: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.input::placeholder { color: #8E88AE; }

/* ================================================================ الأزرار: لون واحد هادئ في البرنامج كله (درجات البنفسجي)
   زر عادي = بنفسجي فاتح ، الزر الأساسي (حفظ / إرسال / تنفيذ) = بنفسجي ممتلئ ، الحذف والإلغاء فقط بالأحمر */
:root { --b-bg: #F4F1FF; --b-line: #DDD5FF; --b-ink: #4B3BB0; --b-hover: #E9E3FF; }
:root[data-theme="dark"] { --b-bg: #262142; --b-line: #3D3568; --b-ink: #CFC6FF; --b-hover: #2F2952; }
.btn.btn.btn.btn { background: var(--b-bg); border-color: var(--b-line); color: var(--b-ink); }
.btn.btn.btn.btn i { color: inherit; }
.btn.btn.btn.btn:hover:not(:disabled) { background: var(--b-hover); border-color: var(--b-line); color: var(--b-ink); }
.btn.btn.btn.btn:is(.primary, .btn-save, :has(> .ti-device-floppy), :has(> .ti-send)) { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.btn.btn.btn:is(.primary, .btn-save, :has(> .ti-device-floppy), :has(> .ti-send)):hover:not(:disabled) { background: var(--violet-d); border-color: var(--violet-d); color: #fff; }
.btn.btn.btn.btn:is(.primary, .btn-save, :has(> .ti-device-floppy), :has(> .ti-send)) kbd { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn.btn.btn.btn.ghost { background: transparent; border-color: transparent; }
.btn.btn.btn.btn.ghost:hover:not(:disabled) { background: var(--b-bg); }
.btn.btn.btn.btn:is(.ask-del, :has(> .ti-trash)) { background: #FEF1F1; border-color: #F6C9C9; color: #C2262E; }
.btn.btn.btn.btn:is(.ask-del, :has(> .ti-trash)):hover:not(:disabled) { background: #FDE2E2; border-color: #EFA9A9; color: #A8141C; }
.btn.btn.btn.btn.ask-del { background: #D92D20; border-color: #D92D20; color: #fff; }
.btn.btn.btn.btn.ask-del:hover:not(:disabled) { background: #B42318; border-color: #B42318; color: #fff; }
:root[data-theme="dark"] .btn.btn.btn.btn:is(:has(> .ti-trash)):not(.ask-del) { background: #3A1E24; border-color: #5E2A33; color: #FFB4B4; }
.btn.btn.btn.btn:disabled { opacity: .5; cursor: not-allowed; }
/* الشعار على الخلفيات الغامقة: داخل دائرة بيضاء حتى يظهر لونه الأحمر بوضوح */
.sidebar .brand .logo-mark, .mbar .mbrand .logo-mark, .auth-brand .logo-mark {
  background: #fff url(../assets/logo-mohab-color.png?v=2) center / 84% no-repeat; border-radius: 50%; filter: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .25), 0 4px 14px rgba(0, 0, 0, .25); }
/* أرقام الكروت الكبيرة (ملايين) لا تخرج من الكارت على الشاشات الصغيرة */
.stat .v { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .stat .v { font-size: 21px; } }

/* ================================================================ القائمة قائمتان: البرنامج المالي | البرنامج الأكاديمي */
.prog-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 8px 10px 10px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .07); }
.prog-sw button { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; padding: 4px 6px; border: 0; border-radius: 9px;
  background: transparent; color: rgba(255, 255, 255, .72); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; line-height: 1.2; text-align: center; }
.prog-sw button i { font-size: 16px; }
.prog-sw button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.prog-sw button.on { background: var(--violet); color: #fff; box-shadow: 0 4px 12px rgba(124, 92, 255, .35); }

/* ================================================================ البرنامج الأكاديمي (academic.js) */
.acd-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.acd-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.acd-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--violet-50, #F1EDFF); color: var(--violet-d, #5B3FD6); font-size: 12px; font-weight: 700; white-space: nowrap; }
.acd-chip.room { background: #ECFDF5; color: #047857; }
:root[data-theme="dark"] .acd-chip { background: #2B2550; color: #CFC6FF; }
:root[data-theme="dark"] .acd-chip.room { background: #12352B; color: #8EE3BF; }
.acd-cap { font-weight: 800; }
.acd-cap.full { color: var(--bad); }
.acd-slot { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 560px) { .acd-slot { grid-template-columns: 1fr 1fr; } .acd-slot [data-k=room] { grid-column: 1 / 2; } .acd-slot .icon-btn { justify-self: start; } }
.acd-msgs { display: grid; gap: 6px; margin: 10px 0; }
.acd-msgs div { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; }
.acd-msgs .err { background: var(--bad-bg, #FEF1F1); color: var(--bad, #C2262E); }
.acd-msgs .warn { background: #FFF7E6; color: #92400E; }
.acd-msgs .ok { background: #ECFDF5; color: #047857; }
.tt-wrap { overflow-x: auto; }
.tt { width: 100%; border-collapse: separate; border-spacing: 4px; min-width: 640px; }
.tt th { font-size: 12.5px; color: var(--text-2); font-weight: 800; padding: 6px; text-align: center; }
.tt th small { display: block; font-weight: 600; color: var(--text-3); }
.tt td { vertical-align: top; min-width: 110px; height: 64px; border-radius: 10px; background: var(--surface-2); padding: 4px; }
.tt-cell { border-radius: 8px; padding: 6px 8px; margin-bottom: 4px; background: var(--violet-50, #F1EDFF); border-inline-start: 3px solid var(--violet); font-size: 12px; line-height: 1.5; }
.tt-cell b { display: block; font-size: 13px; color: var(--violet-d, #5B3FD6); }
:root[data-theme="dark"] .tt-cell { background: #2B2550; }
:root[data-theme="dark"] .tt-cell b { color: #CFC6FF; }
.acd-offer { display: grid; gap: 8px; }
.acd-offer-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.acd-offer-row.off { opacity: .72; }
.acd-offer-row .why { font-size: 12px; color: var(--bad); margin-top: 3px; }
.acd-st { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.acd-st b { font-family: var(--display); }
.acd-term { margin-bottom: 14px; }
.acd-term .toolbar { gap: 12px; flex-wrap: wrap; }
.acd-abs-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line-soft, var(--line)); }
.acd-abs-row.absent { background: #FEF1F1; }
:root[data-theme="dark"] .acd-abs-row.absent { background: #3A1E24; }
.acd-mark { width: 84px; text-align: center; }
@media print { .tt { min-width: 0; } .tt td { background: #fff; border: 1px solid #ccc; } .tt-cell { background: #f4f1ff; } }

/* ================================================================ فلتر العمود زي Excel (colfilter.js) — زي برنامج العيادات */
.tbl th.flt { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.flt:hover { color: var(--violet); }
.tbl th.flt-on { color: #EA580C !important; background: color-mix(in srgb, #EA580C 10%, transparent); }
.col-flt { position: fixed; z-index: 950; width: 270px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 34px rgba(17, 12, 46, .2); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.col-flt .cf-h b { font-family: var(--display); }
.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; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--b-line, var(--line));
  background: var(--b-bg, var(--surface-2)); color: var(--b-ink, inherit); border-radius: 9px; padding: 6px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700; }
.col-flt .cf-sort button:hover, .col-flt .cf-all button:hover { background: var(--b-hover, var(--surface-2)); }
.col-flt .cf-list { max-height: 230px; overflow: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 9px; padding: 6px; }
.col-flt .cf-list label { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.col-flt .cf-list label:hover { background: var(--surface-2); }
.col-flt .input { height: 34px; }
.col-flt .cf-btns .btn { flex: 1; }
.cf-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 12px; padding: 8px 12px; border-radius: 10px; background: #FFF4EB; color: #9A3412; font-size: 13px; }
:root[data-theme="dark"] .cf-note { background: #3A2516; color: #FDBA74; }
/* الموبايل: رأس الجدول مخفي (كروت) — شريط بأسماء الأعمدة للفلترة والترتيب */
.cf-bar { display: none; }
@media (max-width: 720px) {
  .cf-bar { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 8px 10px; margin-bottom: 6px; scrollbar-width: thin; }
  .cf-bar span { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
  .cf-bar button { flex: 0 0 auto; border: 1px solid var(--b-line, var(--line)); background: var(--b-bg, var(--surface-2)); color: var(--b-ink, inherit);
    border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 700; white-space: nowrap; cursor: pointer; }
  .cf-bar button.on { background: #FFF4EB; border-color: #FDBA74; color: #C2410C; }
}
