/* Dorpus Clinic — Workflow and Pharmacy (clinic_ops.js, clinic_pharmacy.js).
   Builds on clinic.css: same greens, borders and radii. */

.op-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.op-stats-sm { margin-bottom: 4px; }
.op-stats .cl-stat-value { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.op-stats .cl-stat.is-money .cl-stat-value { color: #0f6e5b; }
.cl-stat.is-no_show .cl-stat-value { color: #b42318; }
.op-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.op-two > .cl-card { margin: 0; }
.cl-slot:empty { display: none; }

/* ---- tables ---- */
.op-table-wrap { overflow-x: auto; border: 1px solid #e3e8e6; border-radius: 12px; background: #fff; }
.op-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.op-table th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: #667570; font-weight: 700; padding: 9px 12px; background: #f7f9f8; border-bottom: 1px solid #e3e8e6; white-space: nowrap; }
.op-table td { padding: 9px 12px; border-bottom: 1px solid #eef2f1; vertical-align: middle; }
.op-table tbody tr:last-child td { border-bottom: 0; }
.op-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.op-table tr.op-click { cursor: pointer; }
.op-table tr.op-click:hover td { background: #f4f8f7; }
.op-table tr.op-dim td { color: #9aa6a2; }
.op-empty-cell { text-align: center; color: #667570; padding: 22px 12px !important; }
.op-bad { color: #b42318; font-weight: 600; }
.op-warn { color: #9a6700; font-weight: 600; }
.op-in { color: #0f6e5b; font-weight: 600; }
.op-out { color: #b42318; }
.op-row-tools { display: flex; gap: 6px; justify-content: flex-end; }
.op-row-tools .cl-btn { padding: 0.3rem 0.65rem; font-size: 0.82rem; }
.op-bar { display: block; height: 4px; margin-top: 5px; border-radius: 2px; background: #0f6e5b; width: var(--w, 0%); opacity: 0.55; }

/* ---- worklist ---- */
.op-orders { display: grid; gap: 10px; }
.op-order { display: flex; gap: 16px; justify-content: space-between; padding: 14px 16px; border: 1px solid #e3e8e6; border-left: 4px solid #d5ddda; border-radius: 12px; background: #fff; }
.op-order.is-pending { border-left-color: #d4a017; }
.op-order.is-in_progress { border-left-color: #1d4ed8; }
.op-order.is-done { border-left-color: #0f6e5b; }
.op-order.is-cancelled { opacity: 0.7; }
.op-order.is-urgent { border-left-color: #b42318; background: #fffafa; }
.op-order-main { min-width: 0; display: grid; gap: 4px; }
.op-order-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.op-order-name { font-size: 1.02rem; }
.op-order-fac { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.op-order-notes { margin: 2px 0 0; padding: 6px 10px; background: #f7f9f8; border-radius: 8px; font-size: 0.88rem; }
.op-order-meta { margin: 2px 0 0; font-size: 0.78rem; }
.op-order-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.op-order-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.op-urgent { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #b42318; color: #fff; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.op-result { margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: #f1f8f5; border: 1px solid #d6ebe3; font-size: 0.88rem; }
.op-result-vals { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; }
.op-result-vals dt { color: #4b5c57; }
.op-result-vals dd { margin: 0; font-weight: 600; }
.op-result-imp { margin: 6px 0 0; }
.op-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.op-files:empty { display: none; }
.op-file { display: inline-flex; padding: 3px 9px; border: 1px solid #d5ddda; border-radius: 999px; background: #fff; color: #17312b; font-size: 0.8rem; text-decoration: none; }
.op-file:hover { background: #f2f6f5; }
.op-doc-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.op-doc-head strong { font-size: 1.05rem; }
.op-doc-note { margin: 0; }
.op-attach { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.op-attach .op-files { margin: 0; }
.op-history summary { cursor: pointer; color: #667570; font-size: 0.85rem; }
.op-history p { margin: 4px 0; }

/* ---- setup ---- */
.op-setup-intro { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.op-setup-intro p { margin: 0; max-width: 640px; line-height: 1.5; }
.op-setup-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.op-dept { border: 1px solid #e3e8e6; border-radius: 14px; background: #fff; padding: 14px 16px; margin-bottom: 14px; }
.op-dept-head, .op-room-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.op-dept-head h3 { margin: 0; font-size: 1.08rem; }
.op-dept-head .cl-muted, .op-room-head .cl-muted { display: block; margin-top: 2px; }
.op-head-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.op-head-tools .cl-btn { padding: 0.3rem 0.65rem; font-size: 0.82rem; }
.op-rooms { display: grid; gap: 10px; margin-top: 12px; }
.op-room { border: 1px solid #edf1ef; border-radius: 12px; background: #f9fbfa; padding: 10px 12px; }
.op-room-head h4 { margin: 0; font-size: 0.95rem; }
.op-facs { display: grid; gap: 6px; margin-top: 8px; }
.op-fac { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) auto; gap: 12px; align-items: center; padding: 9px 12px; border: 1px solid #e3e8e6; border-radius: 10px; background: #fff; }
.op-fac.is-off { opacity: 0.6; }
.op-fac-main { display: grid; gap: 2px; min-width: 0; }
.op-fac-name { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.op-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #eef2f1; color: #4b5c57; font-size: 0.72rem; font-weight: 700; }
.op-badge.is-pharmacy { background: #e7f0ff; color: #1d4ed8; }
.op-badge.is-waiting { background: #fff4d6; color: #9a6700; }
.op-staff-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.op-chip { padding: 2px 9px; border-radius: 999px; background: #f1f8f5; border: 1px solid #d6ebe3; font-size: 0.78rem; color: #0f5547; }
.op-chip.is-missing { background: #fff4d6; border-color: #f2dfa6; color: #9a6700; }
.op-none { margin: 6px 0 0; }
.op-fields-wrap[hidden] { display: none; }
.op-fields-wrap p { margin: 0 0 6px; }
.op-field-list { display: grid; gap: 6px; }
.op-field-row { display: flex; gap: 6px; }
.op-field-row input,
.op-cx-send input:not([type]),
#ph-root .cl-toolbar input[type="search"],
#wf-root .cl-toolbar input[type="search"] {
  flex: 1; min-width: 0; border: 1px solid #d5ddda; border-radius: 10px; padding: 0.42rem 0.65rem;
  font: inherit; font-size: 0.9rem; background: #fff; color: #17312b;
}
#ph-root .cl-toolbar input[type="search"] { width: 260px; flex: none; }
.op-field-row input:focus, #ph-root .cl-toolbar input[type="search"]:focus { outline: 2px solid #0f6e5b; outline-offset: 1px; }
.op-field-tools { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.op-staff-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; }
.op-staff-pick .cl-check { gap: 8px; }
.op-staff-pick em { font-style: normal; font-size: 0.78rem; }
.op-active { align-self: end; padding-bottom: 8px; }

/* ---- consultation: send to a facility ---- */
.op-cx-orders { display: grid; gap: 8px; margin-bottom: 10px; }
.op-cx-orders:empty { display: none; }
.op-cx-order { padding: 8px 10px; border: 1px solid #e3e8e6; border-radius: 10px; }
.op-cx-order-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.op-cx-order .cl-muted { margin: 4px 0 0; }
.op-cx-send { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 2fr) auto auto; gap: 8px; align-items: center; }

/* ---- pharmacy: grouped tablists (same pills, quieter labels) ---- */
#ph-root { overflow: visible; }
.ph-nav { display: flex; flex-wrap: nowrap; gap: 8px 14px; align-items: center; flex: 1 1 auto; min-width: 0; overflow: visible; }
.ph-nav-group { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; min-width: 0; }
.ph-nav .cl-seg { display: inline-flex; flex-wrap: nowrap; width: auto; max-width: none; }
.ph-nav .cl-seg button { padding: 0.32rem 0.58rem; font-size: 0.8rem; white-space: nowrap; }
#ph-root > .cl-toolbar.ph-toolbar { align-items: center; flex-wrap: nowrap; gap: 10px; overflow: visible; position: relative; z-index: 40; }
#ph-root > .cl-toolbar.ph-toolbar .cl-toolbar-end { flex: 0 0 auto; margin-left: auto; width: auto; }
.ph-add { z-index: 50; }
.ph-add .cl-menu { min-width: 210px; z-index: 60; }
.ph-add > summary {
  border: 0; background: #0f6e5b; color: #fff; width: 36px; height: 36px; border-radius: 10px;
  font-size: 1.35rem; font-weight: 600; line-height: 1;
}
.ph-add > summary:hover, .ph-add[open] > summary { background: #0c5b4b; }

/* ---- pharmacy: picker & sell ---- */
.op-pick { position: relative; }
.op-pick input { width: 100%; border: 1px solid #d5ddda; border-radius: 12px; padding: 0.65rem 0.85rem; font: inherit; font-size: 0.95rem; background: #fff; }
.op-pick input:focus { outline: 2px solid #0f6e5b; outline-offset: 1px; }
.op-pick-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid #d5ddda; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); padding: 4px; max-height: 320px; overflow-y: auto; }
.op-pick-results[hidden] { display: none; }
.op-pick-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer; }
.op-pick-item:hover, .op-pick-item:focus { background: #f1f8f5; outline: none; }
.op-pick-item em { font-style: normal; }
.op-pick-new { color: #0f6e5b; font-weight: 600; }
.op-pick-none { margin: 8px 10px; }

.op-sell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.op-sell > .cl-card { margin: 0; }
.op-sell-side { position: sticky; top: 12px; display: grid; gap: 10px; }
.op-side-title { margin: 0; font-size: 1rem; }
.op-sell-side .cl-field input, .op-sell-side .cl-field select { width: 100%; }
.op-complete { width: 100%; padding: 0.7rem; font-size: 1rem; }
.op-rx-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.op-cart-lines { display: grid; gap: 8px; margin-top: 12px; }
.op-cart-empty { margin: 10px 2px; }
.op-cart-line { display: grid; grid-template-columns: minmax(0, 1fr) 84px 100px 96px 32px; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid #e3e8e6; border-radius: 12px; }
.op-cart-name { display: grid; gap: 2px; min-width: 0; }
.op-cart-name > span { font-size: 0.8rem; }
.op-cart-qty, .op-cart-price { display: grid; gap: 2px; font-size: 0.72rem; color: #667570; font-weight: 600; }
.op-cart-qty input, .op-cart-price input { width: 100%; border: 1px solid #d5ddda; border-radius: 8px; padding: 0.38rem 0.5rem; font: inherit; font-size: 0.92rem; color: #17312b; }
.op-cart-amount { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.op-cart-totals { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid #e3e8e6; }
.op-sum-row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.op-sum-total { font-size: 1.25rem; font-weight: 800; color: #0f5547; }

/* ---- purchases ---- */
#cl-modal .modal-card.op-wide { width: min(1080px, 100%); }
.op-pu-head, .op-pu-line { display: grid; grid-template-columns: minmax(150px, 1.6fr) 0.9fr 0.95fr 0.6fr 0.55fr 0.7fr 0.75fr 0.8fr 32px; gap: 6px; align-items: center; }
.op-pu-head { font-size: 0.72rem; font-weight: 700; color: #667570; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 2px; }
.op-pu-lines { display: grid; gap: 6px; }
.op-pu-line { padding: 6px 4px; border-bottom: 1px solid #eef2f1; }
.op-pu-line input { width: 100%; min-width: 0; border: 1px solid #d5ddda; border-radius: 8px; padding: 0.36rem 0.45rem; font: inherit; font-size: 0.86rem; }
.op-pu-name { display: grid; min-width: 0; }
.op-pu-name span { font-size: 0.75rem; }
.op-pu-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.op-pu-total { font-size: 1.15rem; }

.op-docs { display: grid; gap: 8px; }
.op-doc { border: 1px solid #e3e8e6; border-radius: 12px; background: #fff; }
.op-doc.is-void { opacity: 0.65; }
.op-doc > summary { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; list-style: none; }
.op-doc > summary::-webkit-details-marker { display: none; }
.op-doc[open] > summary { border-bottom: 1px solid #eef2f1; }
.op-doc > .op-table-wrap { margin: 10px 14px; }
.op-doc-no { font-weight: 700; color: #667570; min-width: 40px; }
.op-doc-main { display: grid; flex: 1; min-width: 0; }
.op-doc-amt { font-variant-numeric: tabular-nums; }
.op-doc-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 12px; }
.cl-card .op-doc-actions { padding: 10px 0 0; }
.cl-card .op-table-wrap { border-radius: 10px; }

@media (max-width: 900px) {
  .op-two, .op-sell { grid-template-columns: 1fr; }
  .op-sell-side { position: static; }
  .op-fac { grid-template-columns: 1fr; }
  .op-head-tools { justify-content: flex-start; }
  .op-setup-intro { flex-direction: column; }
  .op-cx-send { grid-template-columns: 1fr; }
  .op-pu-head { display: none; }
  .op-pu-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .op-pu-name { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .op-order { flex-direction: column; }
  .op-order-side { align-items: flex-start; }
  .op-cart-line { grid-template-columns: 1fr 1fr; }
  .op-cart-name { grid-column: 1 / -1; }
  .op-cart-line .cl-icon-btn { justify-self: end; }
  #ph-root .cl-toolbar input[type="search"] { width: 100%; }
  .op-dept-head, .op-room-head { flex-direction: column; }
}

/* ---- billing (clinic_billing.js) ---- */
.bl-lines { display: grid; gap: 6px; }
.bl-line { display: grid; grid-template-columns: minmax(0, 1fr) 70px 110px 110px 32px; gap: 8px; align-items: center; }
.bl-line-head { font-size: 0.72rem; font-weight: 700; color: #667570; text-transform: uppercase; letter-spacing: 0.04em; }
.bl-line-desc { display: grid; gap: 2px; min-width: 0; }
.bl-line-desc span { font-size: 0.75rem; }
.bl-line input { width: 100%; min-width: 0; border: 1px solid #d5ddda; border-radius: 8px; padding: 0.4rem 0.55rem; font: inherit; font-size: 0.9rem; }
.bl-line input:focus, .bl-pay input:focus, .bl-foot input:focus { outline: 2px solid #0f6e5b; outline-offset: 1px; }
.bl-foot { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; padding-top: 10px; border-top: 1px solid #eef2f1; }
.bl-foot-fields { grid-template-columns: 160px minmax(0, 1fr); }
.bl-pay { display: grid; grid-template-columns: 160px 180px minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px; border-radius: 12px; background: #f1f8f5; border: 1px solid #d6ebe3; }
.bl-pay[hidden] { display: none; }
.bl-pay input, .bl-pay select { width: 100%; }
.bl-pay-btn { height: 38px; }
.bl-sums { max-width: 300px; margin-left: auto; width: 100%; }
.op-pick-results.bl-static { position: static; box-shadow: none; max-height: 340px; }
.op-pick-results.bl-static:empty { display: none; }
.bl-mini-stats p { margin: 0 0 6px; }
.cl-fee-btn.is-due { background: #fff4d6; border-color: #f2dfa6; color: #7a5200; }

@media (max-width: 760px) {
  .bl-line { grid-template-columns: 1fr 1fr 1fr 32px; }
  .bl-line-desc { grid-column: 1 / -1; }
  .bl-line-head { display: none; }
  .bl-foot, .bl-pay, .bl-foot-fields { grid-template-columns: 1fr; }
}

/* Activity log */
.ac-filters { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ac-filters select, .ac-filters input[type="search"] { min-width: 0; }
.ac-filters input[type="search"] { flex: 1 1 200px; }
.ac-chip-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ac-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: #e8f3ef; font-weight: 600; font-size: 0.88rem; }
.ac-table .ac-when { white-space: nowrap; color: #4b5753; }
.ac-table tr.ac-view td { color: #667570; }
.ac-table tr.ac-view strong { font-weight: 500; }
.ac-more { display: flex; justify-content: center; margin: 12px 0; }
.ac-note { margin-top: 10px; font-size: 0.8rem; }
.cl-pt-arch { margin: 0 0 8px; }
.cl-archived { margin-bottom: 10px; }
.ac-table td:nth-child(2), .ac-table td:nth-child(5) { white-space: nowrap; }
.ac-table td:nth-child(4) { min-width: 160px; }

/* Schedules, free slots, queue screen link */
.cl-warn { background: #fff6e0; color: #7a5300; border: 1px solid #f3dc9d; border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; }
.cl-warn[hidden] { display: none; }
.sc-note { margin: 8px 0 0; }
.sc-slots-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-top: 10px; }
.sc-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sc-slot { border: 1px solid #cfdcd8; background: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 0.85rem; cursor: pointer; min-width: 64px; }
.sc-slot:hover:not(:disabled) { border-color: #0f5c4d; }
.sc-slot.active { background: #0f5c4d; border-color: #0f5c4d; color: #fff; }
.sc-slot.is-taken { background: #f1f3f2; color: #9aa6a2; text-decoration: line-through; cursor: not-allowed; }
.sc-slot.is-past { background: #f7f8f8; color: #b5bdba; cursor: not-allowed; }
.sc-modal { display: grid; gap: 12px; }
.sc-doc { border: 1px solid #e3e8e6; border-radius: 12px; padding: 10px 14px; background: #fff; }
.sc-doc > summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.sc-doc > summary::-webkit-details-marker { display: none; }
.sc-doc > summary::before { content: "▸"; color: #667570; }
.sc-doc[open] > summary::before { content: "▾"; }
.sc-doc[open] > summary { margin-bottom: 10px; }
.sc-week { display: grid; gap: 6px; margin: 10px 0; }
.sc-day { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px solid #f0f3f2; }
.sc-dayname { width: 72px; font-weight: 600; }
.sc-sess { display: inline-flex; align-items: center; gap: 4px; }
.sc-sess[hidden], .sc-two[hidden] { display: none; }
.sc-sess input { width: 112px; }
.sc-two { font-size: 0.82rem; color: #4b5753; }
.sc-leave-form { margin-top: 10px; }
.sc-left { justify-content: flex-start; flex-wrap: wrap; }
.sc-url { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; }
.sc-tv { display: grid; gap: 8px; }

/* Laboratory */
.cl-pill.is-lb-verify { background: #f3e8ff; color: #6b21a8; }
.lb-setup { margin-bottom: 12px; }
.lb-flag { display: inline-block; min-width: 28px; text-align: center; padding: 1px 6px; border-radius: 6px; font-size: 0.72rem; font-weight: 800; background: #fff1e0; color: #9a4d00; }
.lb-flag.is-L, .lb-flag.is-H { background: #fff1e0; color: #9a4d00; }
.lb-flag.is-LL, .lb-flag.is-HH { background: #b42318; color: #fff; }
.lb-flag.is-A { background: #fdecea; color: #b42318; }
.lb-inline { margin-left: 6px; }
.lb-urgent-stat .cl-stat-value { color: #b42318; }
.lb-table tr.lb-urgent-row td:first-child { box-shadow: inset 4px 0 0 #b42318; }
.lb-order { display: grid; gap: 10px; }
.lb-order-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.lb-order-head h3 { margin: 0; font-size: 1.15rem; }
.lb-order-head p { margin: 2px 0 0; }
.lb-order-meta { display: grid; gap: 2px; justify-items: end; text-align: right; font-size: 0.86rem; }
.lb-collect { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px; border: 1px dashed #cfdcd8; border-radius: 12px; }
.lb-collect .cl-field { flex: 1 1 240px; margin: 0; }
.lb-item { border: 1px solid #e3e8e6; border-radius: 12px; padding: 10px 12px; background: #fff; display: grid; gap: 8px; }
.lb-item.is-verified { border-color: #cfe7dd; }
.lb-item.is-cancelled { opacity: 0.7; }
.lb-item-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.lb-item-head .cl-pill { margin-left: auto; }
.lb-item textarea { width: 100%; }
.lb-item-tools { display: flex; justify-content: flex-end; gap: 8px; }
.lb-results td { padding: 6px 10px; }
.lb-results .lb-input { width: 110px; padding: 5px 8px; }
.lb-results .lb-input.is-text { width: 200px; }
.lb-results select { min-width: 130px; }
.lb-results tr.lb-row-abn td { background: #fffaf3; }
.lb-abn { color: #b42318; }
.lb-prev { font-size: 0.8rem; white-space: nowrap; }
.lb-compact td, .lb-compact th { padding: 4px 8px; }
.lb-comment { margin: 0; font-style: italic; font-size: 0.88rem; }
.lb-history { margin: 0; font-size: 0.8rem; color: #8a5a00; background: #fff8e8; border-radius: 8px; padding: 4px 8px; }
.lb-amend { border-top: 1px dashed #d5ddda; padding-top: 8px; display: grid; gap: 8px; }
.lb-small { font-size: 0.8rem; }
.lb-actions { flex-wrap: wrap; }
.lb-picker { display: grid; gap: 8px; }
.lb-picker-split {
  display: grid; grid-template-columns: minmax(148px, 200px) minmax(0, 1fr);
  min-height: 260px; max-height: 340px; border: 1px solid #e3e8e6; border-radius: 12px;
  background: #fff; overflow: hidden;
}
.lb-cats {
  display: flex; flex-direction: column; gap: 2px; padding: 8px; background: #f4f7f6;
  border-right: 1px solid #e3e8e6; overflow-y: auto;
}
.lb-cat {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 8px;
  font: inherit; font-size: 0.82rem; font-weight: 650; color: #4b5c57; cursor: pointer;
}
.lb-cat:hover { background: #e8eeec; }
.lb-cat.active { background: #fff; color: #0f6e5b; box-shadow: 0 1px 3px rgba(16, 42, 36, 0.08); }
.lb-cat em {
  min-width: 18px; padding: 0 6px; border-radius: 999px; background: #0f6e5b; color: #fff;
  font-style: normal; font-size: 0.7rem; font-weight: 700; text-align: center;
}
.lb-tests { padding: 8px; overflow-y: auto; display: grid; gap: 2px; align-content: start; }
.lb-test {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  border: 1px solid transparent; background: none; text-align: left; padding: 9px 10px;
  border-radius: 10px; font: inherit; cursor: pointer;
}
.lb-test span { display: grid; gap: 1px; min-width: 0; }
.lb-test strong { font-size: 0.9rem; font-weight: 650; }
.lb-test em { font-style: normal; color: #667570; font-size: 0.8rem; white-space: nowrap; }
.lb-test:hover { background: #f1f8f5; }
.lb-test.active { background: #eef7f3; border-color: #cfe7dd; }
.lb-test.active em { color: #0f6e5b; font-weight: 650; }
.lb-pick { display: grid; gap: 4px; max-height: 320px; overflow: auto; padding-right: 4px; }
.lb-dept { margin: 6px 0 2px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #667570; }
.lb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-chip { display: inline-flex; gap: 6px; align-items: baseline; border: 1px solid #cfdcd8; background: #fff; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.lb-chip em { font-style: normal; color: #667570; font-size: 0.78rem; }
.lb-chip.active { background: #0f5c4d; border-color: #0f5c4d; color: #fff; }
.lb-chip.active em { color: #cfe9e1; }
@media (max-width: 640px) {
  .lb-picker-split { grid-template-columns: 1fr; max-height: none; }
  .lb-cats { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #e3e8e6; }
  .lb-cat { white-space: nowrap; flex: 0 0 auto; }
  .lb-tests { max-height: 260px; }
}
.lb-total { font-weight: 700; }
.lb-new { display: grid; gap: 14px; }
.lb-new > .cl-card { margin: 0; }
.lb-who { display: grid; gap: 8px; }
.lb-chosen { display: flex; gap: 12px; align-items: center; }
.lb-chosen > div { flex: 1; }
.lb-newpt summary { cursor: pointer; font-weight: 600; margin: 4px 0; }
.lb-newpt .cl-btn { margin-top: 8px; }
.lb-tpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.lb-tpl-item { align-items: flex-start; border: 1px solid #e3e8e6; border-radius: 10px; padding: 8px 10px; }
.lb-tpl-item.is-added { opacity: 0.6; }
.lb-tpl-params { display: block; margin-top: 2px; }
.lb-params { display: grid; gap: 8px; }
.lb-param { border: 1px solid #e3e8e6; border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; background: #fbfcfc; }
.lb-param-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 120px auto; gap: 6px; align-items: center; }
.lb-range-grid { display: grid; grid-template-columns: repeat(2, 64px 90px 90px); gap: 6px; align-items: center; }
.lb-range-grid[hidden], .lb-choice-grid[hidden] { display: none; }
.lb-numin { width: 100%; }
.lb-choice-grid { display: grid; gap: 6px; }
.lb-cx-list { display: grid; gap: 10px; margin-bottom: 8px; }
.lb-cx-order { border: 1px solid #e3e8e6; border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; }
.lb-cx-order.is-critical { border-color: #b42318; }
.lb-cx-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lb-cx-top .cl-btn { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.lb-cx-top .cl-btn:first-of-type { margin-left: auto; }
.lb-cx-test { margin: 4px 0 0; font-weight: 600; font-size: 0.88rem; }
.lb-cx-new summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.lb-cx-new > input { width: 100%; margin-top: 8px; }
.lb-cx-send { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
@media (max-width: 700px) {
  .lb-param-top { grid-template-columns: 1fr 1fr; }
  .lb-range-grid { grid-template-columns: 64px 1fr 1fr; }
  .lb-order-meta { justify-items: start; text-align: left; }
}
.lb-picker input[type="search"], .lb-who input[type="search"], .lb-param input, .lb-param select, .lb-cx-new > input,
.lb-results .lb-input, .lb-results select, .ac-filters input[type="search"] {
  border: 1px solid #cfdcd8; border-radius: 8px; padding: 7px 10px; font: inherit; background: #fff;
}

/* Expenses & profit and loss */
.ex-tools, .ex-filters { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ex-filters input[type="search"], .ex-filters select { border: 1px solid #cfdcd8; border-radius: 8px; padding: 7px 10px; font: inherit; background: #fff; }
.ex-filters input[type="search"] { flex: 1 1 200px; }
.ex-note { margin: 0 0 6px; font-size: 0.85rem; }
.ex-why { font-size: 0.78rem; }
.ex-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-quick .cl-btn { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.ex-quick .cl-btn.active { background: #0f5c4d; color: #fff; border-color: #0f5c4d; }
.ex-loss .cl-stat-value { color: #b42318; }
.ex-pnl td.ex-label { min-width: 240px; }
.ex-pnl tr.ex-section td { background: #f7f9f8; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #667570; }
.ex-pnl tr.ex-sum td { font-weight: 700; border-top: 1px solid #d5ddda; }
.ex-pnl tr.ex-net td { font-weight: 800; font-size: 1rem; background: #eef8f4; color: #0b6b4f; }
.ex-pnl tr.ex-net.is-loss td { background: #fdecea; color: #b42318; }

/* Patient record: registration sections, duplicate warning, tabs, timeline */
.cl-reg { display: grid; gap: 10px; }
.cl-reg-sec { border: 1px solid #e3e8e6; border-radius: 10px; padding: 6px 12px; background: #fbfcfc; }
.cl-reg-sec > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.cl-reg-sec[open] > summary { margin-bottom: 6px; }
.cl-dup { border: 1px solid #f3dc9d; background: #fff8e6; border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.cl-dup[hidden] { display: none; }
.cl-dup.is-strong { border-color: #f5c2bd; background: #fdf2f1; }
.cl-dup-title { margin: 0; font-weight: 700; }
.cl-dup-row { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px dashed #e8dcc0; }
.cl-dup-why { font-size: 0.8rem; color: #8a5a00; margin-top: 2px; }
.cl-dup.is-strong .cl-dup-why { color: #b42318; }
.cl-dup-actions { display: flex; justify-content: flex-end; }
.cl-blood { margin-left: 12px; font-weight: 700; }
.cl-pt-tabs { margin: 6px 0 12px; flex-wrap: wrap; }
.cl-pt-overview { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.cl-pt-overview > .cl-card, .cl-pt-side > .cl-card { margin: 0; }
.cl-pt-side { display: grid; gap: 14px; }
.cl-pt-last p { margin: 0 0 4px; }
.cl-vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.cl-vitals-grid > div { display: grid; padding: 6px 8px; border-radius: 8px; background: #f4f8f7; }
.cl-vitals-grid strong { font-size: 1.05rem; }
.cl-tl-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cl-tl-full .cl-tl-item { align-items: start; }
.cl-tl-title { margin: 0 0 2px; }
.cl-tl-line { margin: 0; font-size: 0.88rem; }
.cl-tag.is-visit { background: #e0e9ff; color: #1d4ed8; }
.cl-tag.is-lab { background: #f3e8ff; color: #6b21a8; }
.cl-tag.is-service { background: #e6f4ff; color: #075985; }
.cl-tag.is-invoice { background: #dff3ea; color: #0b6b4f; }
.cl-tag.is-pharmacy { background: #fff1e0; color: #9a4d00; }
.cl-tag.is-appointment { background: #eef2f1; color: #4d5b57; }
@media (max-width: 900px) { .cl-pt-overview { grid-template-columns: 1fr; } }

/* Suppliers & purchase orders */
.sp-tools { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sp-tools input[type="search"] { flex: 1 1 220px; border: 1px solid #cfdcd8; border-radius: 8px; padding: 7px 10px; font: inherit; }
.sp-note { font-size: 0.82rem; margin-top: 8px; }
.sp-why { font-size: 0.78rem; }
.sp-open td { font-weight: 600; background: #f7f9f8; }
.sp-lines { display: grid; gap: 6px; }
.sp-line { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px 100px 32px; gap: 8px; align-items: center; }
.sp-rline { display: grid; grid-template-columns: minmax(0, 1fr) 80px 70px 100px 130px 90px 90px; gap: 6px; align-items: center; }
.sp-head { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #667570; }
.sp-line input, .sp-rline input { width: 100%; border: 1px solid #cfdcd8; border-radius: 8px; padding: 6px 8px; font: inherit; }
.sp-statement .op-table-wrap { max-height: 60vh; overflow: auto; }
@media (max-width: 760px) {
  .sp-line { grid-template-columns: 1fr 70px 80px; }
  .sp-line .op-cart-amount, .sp-line > :last-child { display: none; }
  .sp-rline { grid-template-columns: 1fr 1fr 1fr; }
  .sp-head { display: none; }
}
.op-by-branch { margin: 0; font-size: 0.88rem; color: #3b4744; }
.sc-place { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
.sc-place select { max-width: 140px; }
.sc-sess .sc-room { width: 86px; }
.sc-branch-hint { margin: 4px 0 2px; font-size: 0.84rem; }
.op-dept-head h3 .op-branch { margin-left: 8px; vertical-align: middle; font-weight: 600; }

/* Patient overview: three equal-height columns, vitals across the full width */
.cl-pt-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.cl-pt-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cl-pt-col > .cl-card { margin: 0; }
.cl-pt-col > .cl-card:last-child { flex: 1 1 auto; }
.cl-pt-overview .cl-facts { margin-bottom: 0; grid-template-columns: minmax(96px, max-content) 1fr; }
.cl-pt-overview .cl-facts dd.is-empty { color: #a3b0ac; }
.cl-pt-card-foot { margin-top: 10px; }
.cl-pt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cl-pt-stat { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: #f4f8f7; }
.cl-pt-stat strong { font-size: 1.25rem; color: #0f6e5b; }
.cl-pt-stat span { font-size: 0.75rem; color: #667570; }
.cl-pt-stat.is-zero strong { color: #a3b0ac; }
.cl-pt-vitals { margin-top: 14px; }
.cl-pt-vitals .cl-vitals-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cl-pt-vitals .cl-vitals-grid > div { min-height: 58px; align-content: center; }
.cl-pt-vitals .cl-vitals-grid strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-pt-vitals .cl-vitals-grid small { font-size: 0.72rem; font-weight: 600; color: #667570; }
.cl-pt-vitals .cl-vitals-grid > .is-zero strong { color: #a3b0ac; }
@media (max-width: 1100px) { .cl-pt-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cl-pt-overview > .cl-pt-col:last-child { grid-column: 1 / -1; } }
@media (max-width: 760px) { .cl-pt-overview { grid-template-columns: 1fr; } .cl-pt-vitals .cl-vitals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Details across the full width, its fields in three label/value columns */
.cl-pt-details { margin-bottom: 14px; }
.cl-pt-details > .cl-card { margin: 0; }
.cl-pt-details .cl-facts { grid-template-columns: repeat(3, minmax(110px, max-content) minmax(0, 1fr)); gap: 6px 16px; margin: 0; }
.cl-pt-details .cl-facts dd.is-empty { color: #a3b0ac; }
@media (max-width: 1100px) { .cl-pt-details .cl-facts { grid-template-columns: repeat(2, minmax(110px, max-content) minmax(0, 1fr)); } }
@media (max-width: 760px) { .cl-pt-details .cl-facts { grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); } }
