/* =========================================================
   نظام المختبرات — أنماط خاصة بالمختبر (فوق app.css)
   ========================================================= */

.hide-sm { }
@media (max-width: 720px) { .hide-sm { display: none !important; } }

.topbar-search input {
  width: 230px; padding: 7px 12px; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.18); color: #fff; font-size: .85rem;
}
.topbar-search input::placeholder { color: rgba(255,255,255,.8); }
.topbar-search input:focus { background: #fff; color: var(--ink-900); box-shadow: none; }

/* ---------- علامات النتائج ---------- */
.flag-n  { color: var(--ok); }
.flag-l  { color: #2563eb; font-weight: 800; }
.flag-h  { color: #dc2626; font-weight: 800; }
.flag-ll { color: #fff; background: #1e3a8a; font-weight: 800; }
.flag-hh { color: #fff; background: #991b1b; font-weight: 800; }
.flag-a  { color: #c2410c; font-weight: 800; }
.flag-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.flag-chip.flag-l { background: #dbeafe; }
.flag-chip.flag-h { background: #fee2e2; }
.flag-chip.flag-a { background: #ffedd5; }
.flag-chip.flag-n { background: var(--ok-bg); }

/* ---------- حالات الطلب ---------- */
.st { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.st-registered  { background: var(--ink-100);   color: var(--ink-600); }
.st-collected   { background: var(--info-bg);   color: #1d4ed8; }
.st-in_progress { background: var(--warn-bg);   color: #a16207; }
.st-completed   { background: var(--purple-bg); color: #6d28d9; }
.st-approved    { background: var(--ok-bg);     color: #15803d; }
.st-delivered   { background: var(--teal-100);  color: var(--teal-700); }
.st-cancelled   { background: var(--danger-bg); color: #b91c1c; text-decoration: line-through; }
.st-pending     { background: var(--ink-100);   color: var(--ink-600); }
.st-entered     { background: var(--purple-bg); color: #6d28d9; }
.st-rejected    { background: var(--danger-bg); color: #b91c1c; }
.urgent { background: var(--danger); color: #fff; padding: 1px 8px; border-radius: 6px; font-size: .72rem; font-weight: 800; }

.tube { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); margin-inline-end: 4px; }
.money-due { color: var(--danger); font-weight: 800; }

/* ---------- بحث المريض في الاستقبال ---------- */
.big-search { font-size: 1.25rem !important; padding: 14px 16px !important; border-radius: 12px !important; }
.pt-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pt-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; color: var(--ink-800);
}
.pt-row:hover { border-color: var(--teal-300); background: var(--teal-50); color: var(--ink-900); }
.pt-row .nm { font-weight: 800; flex: 1; }
.pt-row .meta { font-size: .8rem; color: var(--ink-500); }

.seg { display: inline-flex; border: 1px solid var(--ink-300); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { padding: 9px 16px; cursor: pointer; font-weight: 700; font-size: .9rem; background: #fff; }
.seg input { display: none; }
.seg input:checked + span { color: #fff; }
.seg label:has(input:checked) { background: var(--teal-600); color: #fff; }

/* ---------- اختيار التحاليل ---------- */
.order-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .order-grid { grid-template-columns: 1fr; } }
.picker { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.picker .sec { position: sticky; top: 0; background: var(--ink-50); font-size: .78rem; font-weight: 800; color: var(--ink-600); padding: 5px 12px; border-bottom: 1px solid var(--border); }
.pick {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--ink-100);
  cursor: pointer; user-select: none;
}
.pick:hover { background: var(--teal-50); }
.pick.on { background: var(--teal-100); }
.pick .code { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; color: var(--teal-700); font-weight: 700; min-width: 64px; direction: ltr; text-align: left; }
.pick .nm { flex: 1; }
.pick .nm small { display: block; color: var(--ink-500); font-size: .74rem; }
.pick .pr { font-weight: 700; font-variant-numeric: tabular-nums; }
.pick .kind { font-size: .66rem; background: var(--purple-bg); color: var(--purple); padding: 0 6px; border-radius: 6px; font-weight: 800; }
.summary { position: sticky; top: calc(var(--header-h) + 54px); }
.summary .line { display: flex; justify-content: space-between; padding: 4px 0; font-size: .9rem; }
.summary .line.total { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.sel-list { list-style: none; padding: 0; margin: 0 0 8px; max-height: 220px; overflow: auto; }
.sel-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--ink-200); font-size: .85rem; }
.sel-list button { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 1rem; }

/* ---------- إدخال النتائج ---------- */
table.res { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.res th, table.res td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
table.res th { background: var(--ink-50); font-size: .78rem; color: var(--ink-600); }
table.res .grp td { background: var(--teal-50); font-weight: 800; color: var(--teal-800); font-size: .85rem; }
table.res .tname { font-weight: 700; direction: ltr; text-align: left; }
table.res .tname small { display: block; font-weight: 400; color: var(--ink-500); direction: rtl; text-align: left; }
table.res .val input, table.res .val select { width: 130px; padding: 7px 9px; font-weight: 800; font-size: 1rem; direction: ltr; text-align: center; }
table.res .val input.flag-h, table.res .val select.flag-h { border-color: #dc2626; background: #fef2f2; color: #dc2626; }
table.res .val input.flag-l, table.res .val select.flag-l { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
table.res .val input.flag-hh, table.res .val input.flag-ll { border-color: #7f1d1d; background: #7f1d1d; color: #fff; }
table.res .val input.flag-ll { border-color: #1e3a8a; background: #1e3a8a; }
table.res .val select.flag-a, table.res .val input.flag-a { border-color: #c2410c; background: #fff7ed; color: #c2410c; }
table.res .val input.flag-n, table.res .val select.flag-n { border-color: #86efac; }
table.res .ref, table.res .unit { direction: ltr; text-align: left; font-size: .82rem; color: var(--ink-600); white-space: nowrap; }
table.res .prev { font-size: .78rem; color: var(--ink-500); direction: ltr; text-align: left; white-space: nowrap; }
table.res tr.is-approved { background: #f0fdf4; }
table.res tr.is-rejected { background: #fef2f2; }
table.res .cmt input { width: 100%; min-width: 120px; padding: 5px 8px; font-size: .82rem; }
.flag-out { font-size: .75rem; font-weight: 800; min-width: 44px; display: inline-block; text-align: center; }
.sticky-actions {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--border);
  padding: 10px 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; z-index: 5;
  border-radius: 0 0 var(--radius) var(--radius);
}
@media (max-width: 720px) { .sticky-actions { bottom: 64px; } }

/* ---------- أرشيف المريض ---------- */
table.cmp td, table.cmp th { white-space: nowrap; }
table.cmp td.v { text-align: center; font-weight: 700; direction: ltr; }
.trend-cell svg { width: 160px; height: 48px; display: block; }

/* ---------- التقارير ---------- */
.bar { height: 8px; border-radius: 4px; background: var(--teal-400); min-width: 2px; }
.bar-cell { width: 40%; }

/* ---------- نطاقات المعدلات (الإعدادات) ---------- */
table.ranges input, table.ranges select { padding: 6px 7px; font-size: .85rem; }
table.ranges td { padding: 5px 4px; }
table.ranges .n { width: 76px; }
table.ranges .age { display: flex; gap: 2px; }
table.ranges .age input { width: 58px; }
table.ranges .age select { width: 52px; padding-inline: 2px; }

.copy-box { display: flex; gap: 6px; }
.copy-box input { direction: ltr; font-size: .8rem; }
