/* Pharmacy is intentionally styled as an Arabic RTL clinical module, while
   keeping its stock and free-dispensing work visually distinct from payments. */
.pharmacy-page{
  --pharmacy-deep:#780c18;
  --pharmacy-main:#a41624;
  --pharmacy-soft:#fff1f3;
  --pharmacy-border:#f5c7ce;
  --pharmacy-muted:#667085;
}
.pharmacy-page .card{overflow:visible}
.pharmacy-page .pharmacy-success-toast{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.7rem;text-align:right}.pharmacy-error-toast{border-color:#f0b5be;background:#fff7f8;color:#a21827}.pharmacy-modal-overlay{display:grid!important;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto minmax(0,1fr);align-items:stretch;justify-items:center;isolation:isolate}.pharmacy-modal-overlay>.pharmacy-modal{grid-column:1;grid-row:2;align-self:center;justify-self:center;margin:0}.pharmacy-modal-overlay:has(.pharmacy-toast-above-modal)>.pharmacy-modal{max-height:calc(100dvh - 12rem)}.pharmacy-modal-toast-layer{grid-column:1;grid-row:1;align-self:center;justify-self:center;z-index:3;display:grid;gap:.55rem;width:min(92dvw,42rem)}.pharmacy-modal-toast-layer .pharmacy-toast-above-modal{position:static!important;top:auto!important;left:auto!important;transform:none!important;z-index:auto!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.7rem;width:100%!important;max-width:none!important;height:auto!important;margin:0!important;padding:.78rem .9rem;text-align:right;box-shadow:0 1rem 2.6rem rgba(58,7,14,.24)}.pharmacy-success-toast-text{min-width:0;overflow-wrap:anywhere}.pharmacy-success-toast-close{display:inline-flex;align-items:center;justify-content:center;inline-size:2rem;block-size:2rem;padding:0;border:1px solid #efb0b8;border-radius:.7rem;background:#fff;color:#971827;font:inherit;line-height:1;box-shadow:0 .35rem .85rem rgba(159,29,39,.1)}.pharmacy-error-toast .pharmacy-success-toast-close{border-color:#eeb7be;color:#a21827}.pharmacy-success-toast-close:hover{border-color:#c43846;background:#fff7f8;color:#74111f}.pharmacy-success-toast-close:focus-visible{outline:2px solid rgba(196,56,70,.35);outline-offset:2px}
@media (max-width:640px){.pharmacy-modal-toast-layer{width:calc(100dvw - 1rem)}}
.pharmacy-heading,.pharmacy-toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.pharmacy-heading p{margin:.3rem 0 0;color:var(--pharmacy-muted);font-weight:600}
.pharmacy-toolbar-actions,.pharmacy-table-actions,.pharmacy-inline-actions{display:flex;align-items:center;flex-wrap:wrap;gap:.55rem}
.pharmacy-tabs{display:flex;flex-wrap:wrap;gap:.55rem;padding:.15rem}
.pharmacy-tab{border:1px solid var(--pharmacy-border);background:#fff;border-radius:999px;color:#7e2030;font:inherit;font-weight:800;padding:.55rem 1rem;cursor:pointer;transition:.18s ease}
.pharmacy-tab:hover,.pharmacy-tab.is-active{background:var(--pharmacy-deep);border-color:var(--pharmacy-deep);color:#fff;box-shadow:0 8px 18px rgba(120,12,24,.16)}
.pharmacy-stat-card{position:relative;overflow:hidden;background:linear-gradient(135deg,#8d1020,#c42033)}
.pharmacy-stat-card::after{content:"";position:absolute;inset:auto -1.6rem -2.2rem auto;width:7rem;height:7rem;border:1.3rem solid rgba(255,255,255,.11);border-radius:50%}
.pharmacy-stat-card .stat-icon{position:relative;z-index:1}.pharmacy-stat-card .stat-value,.pharmacy-stat-card .stat-label{position:relative;z-index:1}
.pharmacy-stat-card.pharmacy-warning{background:linear-gradient(135deg,#b44e08,#db8418)}
.pharmacy-stat-card.pharmacy-success{background:linear-gradient(135deg,#08756c,#109e8e)}
.pharmacy-stat-card.pharmacy-danger{background:linear-gradient(135deg,#a51825,#db3342)}

/* A shared clinic shell gives every system except the laboratory the approved pharmacy sidebar palette. */
.clinic-system-shell .sidebar{
  background:radial-gradient(circle at 50% -18%,rgba(229,117,132,.12),transparent 37%),linear-gradient(165deg,#861724 0%,#67101b 54%,#4c0a13 100%)!important;
}
.clinic-system-shell .sidebar-header{
  background:linear-gradient(180deg,rgba(255,255,255,.065),rgba(20,3,8,.20))!important;
}
.clinic-system-shell .sidebar-logo img{
  border-radius:50%;
  box-shadow:0 .85rem 1.65rem rgba(20,3,8,.36);
}
.clinic-system-shell .sidebar-user,.clinic-system-shell .sidebar-footer{border-color:rgba(255,255,255,.16)!important}
.clinic-system-shell .sidebar-user-inner{background:rgba(255,255,255,.10)!important}
.clinic-system-shell .sidebar-avatar{background:#b12536!important}
.clinic-system-shell .sidebar-link.active{background:linear-gradient(90deg,rgba(255,255,255,.18),rgba(255,255,255,.09))!important}
.clinic-system-shell .sidebar-link.active::before{background:#ffd9dd!important}
.clinic-system-shell .sidebar-overlay{background:rgba(44,4,10,.62)!important}
.pharmacy-notice{display:flex;align-items:flex-start;gap:.65rem;padding:.8rem .95rem;border:1px solid var(--pharmacy-border);border-radius:13px;background:var(--pharmacy-soft);color:#6c1723;font-weight:700;line-height:1.7}
.pharmacy-notice i{margin-top:.22rem;color:var(--pharmacy-main)}
.pharmacy-filter-grid,.pharmacy-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.85rem;align-items:end}
.pharmacy-filter-grid .form-label,.pharmacy-form-grid .form-label,.pharmacy-line .form-label{margin:0;min-width:0;line-height:1.35}
.pharmacy-filter-grid .form-label+:is(.modern-select,.modern-date-picker,.modern-time-picker,.form-input),.pharmacy-form-grid .form-label+:is(.modern-select,.modern-date-picker,.modern-time-picker,.form-input),.pharmacy-line .form-label+:is(.modern-select,.modern-date-picker,.modern-time-picker,.form-input),.pharmacy-dispense-recipient-grid .form-label+:is(.modern-select,.modern-date-picker,.modern-time-picker,.form-input){margin-top:.45rem}
.pharmacy-filter-grid label.form-label,.pharmacy-form-grid label.form-label,.pharmacy-line label.form-label{display:grid;gap:.45rem}
.pharmacy-dispense-recipient-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.85rem;align-items:start}
.pharmacy-dispense-recipient-grid>*{min-width:0}.pharmacy-dispense-recipient-grid .full-field{grid-column:1/-1}
.pharmacy-dispense-recipient-grid .form-label{margin:0;min-width:0;line-height:1.35}
.pharmacy-dispense-recipient-grid label.form-label{display:grid;gap:.45rem}
.pharmacy-beneficiary-field{display:grid;gap:.55rem;align-content:start;min-width:0}
.pharmacy-beneficiary-field .form-label{margin:0;line-height:1.35}
.pharmacy-beneficiary-field .form-label+.modern-select{margin-top:0}
.pharmacy-member-picker{display:grid;gap:.7rem;align-content:start;min-width:0}
.pharmacy-form-grid .full-field,.pharmacy-filter-grid .full-field{grid-column:1 / -1}
.pharmacy-table-wrap{border:1px solid var(--pharmacy-border);border-radius:15px;overflow:auto;background:#fff}
.pharmacy-table{width:100%;min-width:720px;border-collapse:collapse;text-align:center}
.pharmacy-table th{background:#fff5f6;color:#6f1623;font-size:.85rem;font-weight:900;white-space:nowrap}
.pharmacy-table th,.pharmacy-table td{padding:.72rem .6rem;border-bottom:1px solid #fae1e5;vertical-align:middle}
.pharmacy-table tbody tr:last-child td{border-bottom:0}.pharmacy-table tbody tr:hover{background:#fff8f9}
.pharmacy-table .pharmacy-name{display:grid;gap:.12rem;text-align:right}.pharmacy-table .pharmacy-name small{color:var(--pharmacy-muted);font-weight:600}
.pharmacy-status{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-width:5.3rem;padding:.23rem .6rem;border-radius:999px;border:1px solid #f0a7b1;background:#fff5f6;color:#8d1221;font-size:.78rem;font-weight:900}
.pharmacy-status.is-success{border-color:#92d6c5;background:#ecfbf6;color:#087361}.pharmacy-status.is-warning{border-color:#efc580;background:#fff8e7;color:#945500}.pharmacy-status.is-muted{border-color:#d5dce7;background:#f7f9fc;color:#536178}
.pharmacy-empty{padding:1.5rem;text-align:center;color:var(--pharmacy-muted);font-weight:700}
.pharmacy-modal{width:min(920px,calc(100vw - 28px));max-height:calc(100vh - 28px);overflow:auto}
.pharmacy-modal .perm-modal-head{position:sticky;top:-20px;z-index:2;margin:-20px -20px 1rem;padding:20px;background:#fff;border-bottom:1px solid #f6dce0}
.pharmacy-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.7rem}
.pharmacy-summary-item{padding:.75rem .85rem;border:1px solid #eadfeb;border-radius:13px;background:#fff;min-width:0}.pharmacy-summary-item small{display:block;color:var(--pharmacy-muted);margin-bottom:.18rem;font-weight:700}.pharmacy-summary-item strong{display:block;color:#3e1820;overflow-wrap:anywhere}
.pharmacy-dispense-items{margin-top:1.1rem;padding-top:1rem;border-top:1px solid #f6dce0}.pharmacy-dispense-items .card-title{margin-bottom:.2rem}.pharmacy-dispense-empty{margin-top:.8rem;padding:.95rem;border:1px dashed var(--pharmacy-border);border-radius:13px;background:#fffafa}.pharmacy-dispense-summary-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));gap:.6rem;margin-top:.8rem}.pharmacy-dispense-summary-item{display:grid;gap:.14rem;min-width:0;padding:.7rem .8rem;border:1px solid #f1dce1;border-radius:12px;background:linear-gradient(135deg,#fffafa,#fff)}.pharmacy-dispense-summary-item strong{color:#57101b;font-weight:900;overflow-wrap:anywhere}.pharmacy-dispense-summary-item span{color:#6a4350;font-size:.82rem;font-weight:700;overflow-wrap:anywhere}.pharmacy-dispense-summary-item small{color:var(--pharmacy-muted);font-size:.76rem;overflow-wrap:anywhere}
.pharmacy-lines{display:grid;gap:.7rem}.pharmacy-line{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1.7fr) minmax(5rem,.7fr) minmax(0,1.25fr) auto;gap:.55rem;align-items:end;padding:.8rem;border:1px dashed var(--pharmacy-border);border-radius:14px;background:#fffafa}
.pharmacy-purchase-line{grid-template-columns:minmax(0,1.5fr) minmax(0,1.15fr) minmax(0,1.1fr) minmax(5rem,.7fr) minmax(5rem,.8fr) auto}.pharmacy-purchase-entry-line{grid-template-columns:minmax(0,1.5fr) minmax(0,1.15fr) minmax(0,1.1fr) minmax(5rem,.7fr) minmax(5rem,.8fr)}
.pharmacy-line-remove{align-self:end;min-height:2.65rem}
.pharmacy-page .pharmacy-dispense-modal{width:min(980px,calc(100vw - 28px));max-width:none;max-height:calc(100dvh - 28px);overflow:auto;border-radius:1rem}.pharmacy-dispense-modal .perm-modal-head{position:sticky;top:0;z-index:2;margin:0 0 1rem;padding:0 0 .85rem;background:#fff;border-bottom:1px solid #f6dce0;border-radius:calc(1rem - 1px) calc(1rem - 1px) 0 0}.pharmacy-dispense-modal .report-subtitle{margin:0;color:var(--pharmacy-muted);font-weight:700;line-height:1.65}.pharmacy-dispense-entry-editor{padding:.85rem;border:1px dashed var(--pharmacy-border);border-radius:14px;background:#fffafa}.pharmacy-dispense-entry-editor .pharmacy-toolbar .card-title{margin-bottom:.2rem}.pharmacy-dispense-entry-line{grid-template-columns:minmax(0,1.5fr) minmax(0,1.7fr) minmax(5rem,.7fr) minmax(0,1.25fr)}.pharmacy-dispense-entry-actions{margin-top:.75rem}.pharmacy-dispense-entry-feedback{margin:.75rem 0 0;color:#087361;font-size:.82rem;font-weight:800}.pharmacy-dispense-draft-section{margin-top:1rem;padding-top:1rem;border-top:1px solid #f6dce0}.pharmacy-dispense-draft-section .card-title{margin-bottom:0}.pharmacy-dispense-draft-list{display:grid;gap:.55rem;margin-top:.7rem}.pharmacy-dispense-draft-pagination .catalog-pagination{margin-top:.8rem;padding-top:.1rem}.pharmacy-dispense-draft-pagination .catalog-pagination button{border-color:var(--pharmacy-border);color:#6f1623}.pharmacy-dispense-draft-pagination .catalog-pagination button:hover:not(:disabled){border-color:var(--pharmacy-main);background:#fff1f3;color:var(--pharmacy-deep)}.pharmacy-dispense-draft-pagination .catalog-pagination button.is-active{border-color:var(--pharmacy-deep);background:var(--pharmacy-deep);color:#fff;box-shadow:0 .45rem 1rem rgba(120,12,24,.16)}.pharmacy-dispense-draft-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.65rem;align-items:center;padding:.65rem .75rem;border:1px solid #f1dce1;border-radius:12px;background:#fffafa}.pharmacy-dispense-draft-detail{display:grid;gap:.14rem;min-width:0}.pharmacy-dispense-draft-detail strong,.pharmacy-dispense-draft-detail span,.pharmacy-dispense-draft-detail small{overflow-wrap:anywhere}.pharmacy-dispense-draft-detail strong{color:#57101b;font-weight:900}.pharmacy-dispense-draft-detail span{color:#6a4350;font-size:.82rem;font-weight:700}.pharmacy-dispense-draft-detail small{color:var(--pharmacy-muted);font-size:.76rem}.pharmacy-dispense-modal .pharmacy-modal-actions{position:sticky;bottom:0;z-index:2;margin:1rem 0 0;padding:.85rem 0 0;background:#fff;border-top:1px solid #f6dce0;align-items:center}.pharmacy-modal-actions-spacer{flex:1 1 auto}
.pharmacy-recent-list{display:grid;gap:.55rem}.pharmacy-recent-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem .15rem;border-bottom:1px solid #f8e5e8}.pharmacy-recent-row:last-child{border-bottom:0}.pharmacy-recent-main{min-width:0}.pharmacy-recent-main strong,.pharmacy-recent-main span{display:block;overflow-wrap:anywhere}.pharmacy-recent-main span{margin-top:.15rem;color:var(--pharmacy-muted);font-size:.85rem}.pharmacy-recent-date{color:#6f1623;font-size:.82rem;font-weight:900;white-space:nowrap}
.pharmacy-document{background:#fff;color:#21131a;direction:rtl;text-align:right}.pharmacy-document-header{display:flex;align-items:start;justify-content:space-between;gap:1rem;padding-bottom:.85rem;border-bottom:2px solid var(--pharmacy-main)}.pharmacy-document-header h2{margin:0;color:var(--pharmacy-deep);font-size:1.15rem}.pharmacy-document-header p{margin:.25rem 0 0;color:var(--pharmacy-muted);font-size:.83rem}.pharmacy-document-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.55rem;margin:1rem 0}.pharmacy-document-meta>div{padding:.65rem;border:1px solid #efd4d9;border-radius:10px}.pharmacy-document-meta small{display:block;color:var(--pharmacy-muted);margin-bottom:.2rem}.pharmacy-document-meta strong{display:block;overflow-wrap:anywhere}.pharmacy-document table{width:100%;border-collapse:collapse}.pharmacy-document th,.pharmacy-document td{padding:.58rem;border:1px solid #edcbd1;text-align:center}.pharmacy-document th{background:#fff1f3;color:#74111f}.pharmacy-document-notes{margin-top:.8rem;padding:.65rem;border:1px solid #efd4d9;border-radius:10px;background:#fffafa}.pharmacy-document-notes strong{display:block;margin-bottom:.25rem}
.pharmacy-stock-health{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem}.pharmacy-stock-health>div{padding:.7rem .8rem;border:1px solid #f0dde0;border-radius:13px;background:#fff}.pharmacy-stock-health small{display:block;color:var(--pharmacy-muted);font-weight:700}.pharmacy-stock-health strong{display:block;margin-top:.15rem;color:#6f1420;font-size:1.1rem}
@media (max-width:980px){.pharmacy-filter-grid,.pharmacy-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.pharmacy-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.pharmacy-line{grid-template-columns:repeat(2,minmax(0,1fr))}.pharmacy-line-remove{grid-column:1 / -1;justify-self:start}.pharmacy-stock-health{grid-template-columns:1fr}}
@media (max-width:640px){.pharmacy-heading,.pharmacy-toolbar{align-items:stretch;flex-direction:column}.pharmacy-toolbar-actions .btn,.pharmacy-heading>.btn{width:100%;justify-content:center}.pharmacy-filter-grid,.pharmacy-form-grid,.pharmacy-dispense-recipient-grid,.pharmacy-summary-grid,.pharmacy-document-meta,.pharmacy-line{grid-template-columns:1fr}.pharmacy-tabs{display:grid;grid-template-columns:1fr 1fr}.pharmacy-tab{width:100%;padding:.55rem .45rem}.pharmacy-table{min-width:640px}.pharmacy-recent-row{align-items:flex-start;flex-direction:column;gap:.25rem}.pharmacy-modal .perm-modal-head{top:-14px;margin:-14px -14px .85rem;padding:14px}.pharmacy-dispense-modal .perm-modal-head{top:0;margin:0 0 .85rem;padding:0 0 .75rem}.pharmacy-modal{padding:14px!important}.pharmacy-dispense-modal .pharmacy-modal-actions{bottom:0;margin:.85rem 0 0;padding:.75rem 0 0}.pharmacy-dispense-draft-row{grid-template-columns:1fr}.pharmacy-dispense-draft-row .pharmacy-table-actions{display:grid;grid-template-columns:1fr 1fr}.pharmacy-dispense-draft-row .pharmacy-table-actions .btn{width:100%;justify-content:center}.pharmacy-modal-actions-spacer{display:none}}
@media print{.pharmacy-page .hide-on-print,.pharmacy-page .btn,.pharmacy-page .pharmacy-tabs,.pharmacy-page .pharmacy-heading,.pharmacy-page .pharmacy-toolbar{display:none!important}.pharmacy-document{display:block!important}.pharmacy-document-meta{grid-template-columns:repeat(3,minmax(0,1fr))!important}.pharmacy-document thead{display:table-header-group!important}.pharmacy-document th,.pharmacy-document td{font-size:10.5px}.pharmacy-document tr{break-inside:avoid;page-break-inside:avoid}}

/* Pharmacy search kit and phone record surfaces.  The data source and paging
   stay shared with the desktop tables; only the presentation changes on a
   narrow screen. */
.pharmacy-page .pharmacy-search-kit,
.pharmacy-page .pharmacy-users-search-kit{
  display:grid;
  gap:.82rem;
  margin-top:1rem;
  padding:.9rem;
  border:1px solid #f2cbd1;
  border-radius:1rem;
  background:linear-gradient(145deg,#fffafa,#fff);
  box-shadow:0 .55rem 1.3rem rgba(120,12,24,.045);
}
.pharmacy-page .pharmacy-search-kit-heading{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:.75rem;
}
.pharmacy-page .pharmacy-search-kit-heading .card-title{margin:0}
.pharmacy-page .pharmacy-search-kit-heading p{margin:.2rem 0 0;color:var(--pharmacy-muted);font-size:.82rem;font-weight:650;line-height:1.55}
.pharmacy-page .pharmacy-search-kit-count,
.pharmacy-page .pharmacy-search-kit-result,
.pharmacy-page .pharmacy-users-filter-summary{
  margin:0;
  color:#7a2632;
  font-size:.8rem;
  font-weight:800;
  line-height:1.55;
}
.pharmacy-page .pharmacy-search-kit-count{
  flex:0 0 auto;
  padding:.33rem .58rem;
  border:1px solid #f3d5d9;
  border-radius:999px;
  background:#fff;
  white-space:nowrap;
}
.pharmacy-page .pharmacy-search-kit-controls,
.pharmacy-page .pharmacy-users-filter-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,13.25rem),1fr));
  align-items:end;
  gap:.75rem;
}
.pharmacy-page .pharmacy-search-kit-field,
.pharmacy-page .pharmacy-users-search-field{
  display:grid;
  min-width:0;
  gap:.42rem;
  margin:0;
  color:#705361;
  font-size:.8rem;
  font-weight:800;
  line-height:1.35;
}
.pharmacy-page .pharmacy-search-kit-field .modern-select,
.pharmacy-page .pharmacy-search-kit-field .modern-date-picker,
.pharmacy-page .pharmacy-users-search-field .modern-select{margin-top:0}
.pharmacy-page .pharmacy-search-kit-input-wrap,
.pharmacy-page .pharmacy-search-input{position:relative;display:block;min-width:0}
.pharmacy-page .pharmacy-search-kit-input-wrap>i,
.pharmacy-page .pharmacy-search-input>i{
  position:absolute;
  z-index:1;
  inset-block-start:50%;
  inset-inline-start:.82rem;
  transform:translateY(-50%);
  color:#9d5965;
  font-size:.86rem;
  pointer-events:none;
}
.pharmacy-page .pharmacy-search-kit-input-wrap .form-input,
.pharmacy-page .pharmacy-search-input .form-input{padding-inline-start:2.35rem}
.pharmacy-page .pharmacy-search-kit-actions,
.pharmacy-page .pharmacy-filter-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:end;
  gap:.55rem;
}
.pharmacy-page .pharmacy-search-kit-actions .btn,
.pharmacy-page .pharmacy-filter-actions .btn,
.pharmacy-page .pharmacy-search-kit-reset.btn,
.pharmacy-page .pharmacy-users-clear-filters.btn{
  inline-size:auto!important;
  min-inline-size:0!important;
  min-width:0!important;
  block-size:auto;
  min-height:2.55rem;
  padding:.56rem .82rem!important;
  gap:.42rem;
  overflow:visible;
  white-space:normal;
  font-size:.8rem;
}
.pharmacy-page .pharmacy-search-kit-actions .btn:disabled,
.pharmacy-page .pharmacy-filter-actions .btn:disabled,
.pharmacy-page .pharmacy-search-kit-reset.btn:disabled,
.pharmacy-page .pharmacy-users-clear-filters.btn:disabled{opacity:.58;box-shadow:none}
.pharmacy-page .pharmacy-users-filter-summary{padding-top:.05rem}

/* Desktop keeps the familiar data grid.  The paired compact list is enabled
   only for touch-width layouts below. */
.pharmacy-mobile-records,
.pharmacy-catalog-mobile-cards,
.pharmacy-users-mobile-cards,
.pharmacy-document-mobile-items{display:none}
.pharmacy-page .pharmacy-mobile-empty{
  display:grid;
  place-items:center;
  gap:.42rem;
  min-height:7rem;
  padding:1rem;
  border:1px dashed var(--pharmacy-border);
  border-radius:.9rem;
  background:#fffafa;
  color:var(--pharmacy-muted);
  text-align:center;
  font-weight:750;
  line-height:1.6;
}
.pharmacy-page .catalog-pagination{margin-top:1rem;gap:.42rem}
.pharmacy-page .catalog-pagination button{
  min-inline-size:2.6rem;
  min-block-size:2.6rem;
  border-color:#efc7cd;
  border-radius:.76rem;
  color:#751421;
  font-weight:850;
  touch-action:manipulation;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .16s ease;
}
.pharmacy-page .catalog-pagination button:hover:not(:disabled){border-color:#b92838;background:#fff0f2;color:#760e1c;transform:translateY(-1px)}
.pharmacy-page .catalog-pagination button.is-active{border-color:var(--pharmacy-deep);background:linear-gradient(135deg,#8d1020,#b51d2e);color:#fff;box-shadow:0 .45rem 1rem rgba(120,12,24,.16)}

@media (max-width:768px){
  .pharmacy-page .pharmacy-desktop-table,
  .pharmacy-page .pharmacy-catalog-desktop-table,
  .pharmacy-page .pharmacy-users-table-wrap{display:none!important}
  .pharmacy-page .pharmacy-mobile-records,
  .pharmacy-page .pharmacy-catalog-mobile-cards,
  .pharmacy-page .pharmacy-users-mobile-cards,
  .pharmacy-document-mobile-items{
    display:grid!important;
    gap:.78rem;
    margin-top:.85rem;
  }
  .pharmacy-document-table{display:none!important}
  .pharmacy-page .pharmacy-search-kit,
  .pharmacy-page .pharmacy-users-search-kit{margin-top:.82rem;padding:.8rem;gap:.72rem}
  .pharmacy-page .pharmacy-search-kit-controls,
  .pharmacy-page .pharmacy-users-filter-grid{grid-template-columns:1fr;gap:.68rem}
  .pharmacy-page .pharmacy-search-kit-heading{align-items:stretch;flex-direction:column;gap:.5rem}
  .pharmacy-page .pharmacy-search-kit-count{align-self:flex-start;white-space:normal}
  .pharmacy-page .pharmacy-search-kit-actions,
  .pharmacy-page .pharmacy-filter-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem}
  .pharmacy-page .pharmacy-search-kit-actions .btn,
  .pharmacy-page .pharmacy-filter-actions .btn,
  .pharmacy-page .pharmacy-search-kit-reset.btn,
  .pharmacy-page .pharmacy-users-clear-filters.btn{width:100%;justify-content:center}
  .pharmacy-page .pharmacy-mobile-record-card,
  .pharmacy-page .pharmacy-mobile-card,
  .pharmacy-page .pharmacy-user-card,
  .pharmacy-document .pharmacy-mobile-record-card{
    display:grid;
    gap:.72rem;
    min-width:0;
    padding:.86rem;
    border:1px solid #f1d6db;
    border-radius:1rem;
    background:linear-gradient(145deg,#fffafa,#fff);
    box-shadow:0 .55rem 1.3rem rgba(120,12,24,.055);
  }
  .pharmacy-page .pharmacy-mobile-record-card>header,
  .pharmacy-page .pharmacy-mobile-card-head,
  .pharmacy-page .pharmacy-user-card-head,
  .pharmacy-document .pharmacy-mobile-record-card>header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:.68rem;
    min-width:0;
  }
  .pharmacy-page .pharmacy-mobile-record-card h3,
  .pharmacy-page .pharmacy-mobile-card h3,
  .pharmacy-page .pharmacy-mobile-card-title strong,
  .pharmacy-page .pharmacy-user-card h3,
  .pharmacy-document .pharmacy-mobile-record-card h3{
    display:block;
    margin:0;
    color:#60111c;
    font-size:.95rem;
    font-weight:900;
    line-height:1.45;
    overflow-wrap:anywhere;
  }
  .pharmacy-page .pharmacy-mobile-record-card header p,
  .pharmacy-page .pharmacy-mobile-card-title>span,
  .pharmacy-page .pharmacy-user-card-username,
  .pharmacy-document .pharmacy-mobile-record-card header p{
    display:block;
    margin:.14rem 0 0;
    color:var(--pharmacy-muted);
    font-size:.77rem;
    font-weight:650;
    line-height:1.45;
    overflow-wrap:anywhere;
  }
  .pharmacy-page .pharmacy-mobile-card-badge{
    flex:0 0 auto;
    max-inline-size:45%;
    padding:.26rem .52rem;
    border:1px solid #f1c9cf;
    border-radius:999px;
    background:#fff3f5;
    color:#8d1b29;
    font-size:.72rem;
    font-weight:850;
    line-height:1.3;
    overflow-wrap:anywhere;
    text-align:center;
  }
  .pharmacy-page .pharmacy-mobile-record-primary,
  .pharmacy-page .pharmacy-user-card-meta,
  .pharmacy-page .pharmacy-mobile-card-details,
  .pharmacy-document .pharmacy-mobile-record-primary{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:.52rem;
    min-width:0;
  }
  .pharmacy-page .pharmacy-mobile-record-primary>span,
  .pharmacy-page .pharmacy-user-card-meta>div,
  .pharmacy-page .pharmacy-mobile-card-details>div,
  .pharmacy-document .pharmacy-mobile-record-primary>span{
    min-width:0;
    padding:.56rem .6rem;
    border:1px solid #f4e0e3;
    border-radius:.72rem;
    background:#fff;
    color:#65424c;
    font-size:.77rem;
    font-weight:700;
    line-height:1.5;
    overflow-wrap:anywhere;
  }
  .pharmacy-page .pharmacy-mobile-record-primary i,
  .pharmacy-document .pharmacy-mobile-record-primary i{margin-inline-end:.28rem;color:#a32131}
  .pharmacy-page .pharmacy-user-card-meta small,
  .pharmacy-page .pharmacy-mobile-card-details dt{display:block;margin-bottom:.14rem;color:#8c6b73;font-size:.69rem;font-weight:800}
  .pharmacy-page .pharmacy-user-card-meta strong,
  .pharmacy-page .pharmacy-mobile-card-details dd{display:block;margin:0;color:#51202a;font-size:.79rem;font-weight:850;overflow-wrap:anywhere}
  .pharmacy-page .pharmacy-mobile-record-card details{
    overflow:hidden;
    border:1px solid #f3dde1;
    border-radius:.76rem;
    background:#fff;
  }
  .pharmacy-page .pharmacy-mobile-record-card summary{
    padding:.58rem .68rem;
    color:#761522;
    cursor:pointer;
    font-size:.78rem;
    font-weight:850;
  }
  .pharmacy-page .pharmacy-mobile-record-card details[open] summary{border-bottom:1px solid #f3dde1;background:#fff8f9}
  .pharmacy-page .pharmacy-mobile-record-details{display:grid;gap:.48rem;padding:.62rem .68rem;color:#65424c;font-size:.77rem;line-height:1.55;overflow-wrap:anywhere}
  .pharmacy-page .pharmacy-mobile-record-card>footer,
  .pharmacy-page .pharmacy-mobile-card-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem}
  .pharmacy-page .pharmacy-mobile-record-card>footer .btn,
  .pharmacy-page .pharmacy-mobile-card-actions .btn{width:100%;min-width:0;justify-content:center}
  .pharmacy-page .pharmacy-mobile-record-card>footer .btn:only-child{grid-column:1/-1}
  .pharmacy-page .pharmacy-user-card-identity{display:flex;align-items:center;gap:.55rem;min-width:0}
  .pharmacy-page .pharmacy-user-card-identity>div{min-width:0}
  .pharmacy-page .pharmacy-user-card-status{
    flex:0 0 auto;
    max-inline-size:42%;
    padding:.26rem .52rem;
    border:1px solid #f1c9cf;
    border-radius:999px;
    background:#fff3f5;
    color:#8d1b29;
    font-size:.72rem;
    font-weight:850;
    line-height:1.3;
    text-align:center;
  }
  .pharmacy-page .pharmacy-user-card-status.is-active{border-color:#9bd6c5;background:#ecfbf6;color:#087361}
  .pharmacy-page .pharmacy-user-card-actions{display:grid;gap:.55rem}
  .pharmacy-page .pharmacy-user-card-actions>.btn{width:100%;justify-content:center}
  .pharmacy-page .pharmacy-user-card-actions .perm-table-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem}
  .pharmacy-page .pharmacy-user-card-actions .perm-table-actions .btn{width:100%;min-width:0;justify-content:center}
  .pharmacy-page .catalog-pagination{justify-content:center;padding-inline:.15rem}
}

@media (max-width:420px){
  .pharmacy-page .pharmacy-mobile-record-primary,
  .pharmacy-page .pharmacy-user-card-meta,
  .pharmacy-page .pharmacy-mobile-card-details,
  .pharmacy-document .pharmacy-mobile-record-primary{grid-template-columns:1fr}
  .pharmacy-page .pharmacy-search-kit-actions,
  .pharmacy-page .pharmacy-filter-actions,
  .pharmacy-page .pharmacy-mobile-card-actions,
  .pharmacy-page .pharmacy-user-card-actions .perm-table-actions{grid-template-columns:1fr}
  .pharmacy-page .pharmacy-mobile-card-badge,
  .pharmacy-page .pharmacy-user-card-status{max-inline-size:52%}
  .pharmacy-page .catalog-pagination{gap:.3rem}
  .pharmacy-page .catalog-pagination button{min-inline-size:2.42rem;min-block-size:2.42rem}
}

@media print{
  .pharmacy-document-mobile-items{display:none!important}
  .pharmacy-document-table{display:table!important}
}

/* Pharmacy modal headers stay readable under iPhone browser zoom. The close
   action keeps its accessible text in the DOM but is deliberately icon-only
   on screen, preserving room for the RTL title at the right. */
.pharmacy-page .perm-modal .perm-modal-head,
.pharmacy-modal .perm-modal-head{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:.7rem;
  min-width:0;
}
.pharmacy-page .perm-modal .perm-modal-head>:first-child,
.pharmacy-modal .perm-modal-head>:first-child{
  flex:1 1 auto;
  min-width:0;
}
.pharmacy-page .perm-modal .perm-modal-head .card-title,
.pharmacy-modal .perm-modal-head .card-title{
  min-width:0;
  margin:0;
  overflow:hidden;
  color:#58121c;
  font-size:clamp(.78rem,3.8vw,.98rem);
  line-height:1.35;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.pharmacy-page .perm-modal .perm-modal-close,
.pharmacy-modal .perm-modal-close{
  flex:0 0 2.35rem;
  inline-size:2.35rem!important;
  min-inline-size:2.35rem!important;
  min-width:2.35rem!important;
  block-size:2.35rem;
  min-height:2.35rem;
  padding:0!important;
  border-radius:.75rem;
  justify-content:center;
  gap:0;
  overflow:hidden;
  font-size:0;
  line-height:1;
  white-space:nowrap;
}
.pharmacy-page .perm-modal .perm-modal-close>i,
.pharmacy-modal .perm-modal-close>i{margin:0;font-size:.9rem}

/* Long stock labels must never dictate a field's width. On tight phone
   viewports the text scales down slightly, then truncates safely; the full
   value remains available when its picker is opened. */
.pharmacy-page .perm-modal :is(.pharmacy-form-grid,.perm-form-grid,.pharmacy-line,.pharmacy-dispense-recipient-grid),
.pharmacy-modal :is(.pharmacy-form-grid,.perm-form-grid,.pharmacy-line,.pharmacy-dispense-recipient-grid){min-width:0;max-width:100%}
.pharmacy-page .perm-modal :is(.form-label,.modern-select,.modern-date-picker,.modern-select-trigger,.modern-date-trigger,.form-input),
.pharmacy-modal :is(.form-label,.modern-select,.modern-date-picker,.modern-select-trigger,.modern-date-trigger,.form-input){min-width:0;max-width:100%;box-sizing:border-box}
.pharmacy-page .perm-modal :is(.modern-select-value,.modern-date-value),
.pharmacy-modal :is(.modern-select-value,.modern-date-value){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

@media (max-width:480px){
  .pharmacy-page .perm-modal :is(.form-input,.modern-select-trigger,.modern-date-trigger),
  .pharmacy-modal :is(.form-input,.modern-select-trigger,.modern-date-trigger){font-size:clamp(.73rem,3.25vw,.88rem)}
  .pharmacy-page .perm-modal :is(.modern-select-value,.modern-date-value),
  .pharmacy-modal :is(.modern-select-value,.modern-date-value){font-size:inherit;word-spacing:.04rem}
}

@media (max-width:360px){
  .pharmacy-page .perm-modal .perm-modal-head,
  .pharmacy-modal .perm-modal-head{gap:.5rem}
  .pharmacy-page .perm-modal .perm-modal-head .card-title,
  .pharmacy-modal .perm-modal-head .card-title{font-size:.76rem}
  .pharmacy-page .perm-modal .perm-modal-close,
  .pharmacy-modal .perm-modal-close{flex-basis:2.15rem;inline-size:2.15rem!important;min-inline-size:2.15rem!important;min-width:2.15rem!important;block-size:2.15rem;min-height:2.15rem}
}

/* The modal title bar is a solid, elevated surface.  It must stay opaque
   while the dialog body scrolls beneath it, just like the sticky action bar. */
.pharmacy-modal .perm-modal-head,
.pharmacy-page .pharmacy-dispense-modal .perm-modal-head{
  isolation:isolate;
  z-index:320;
  background:#fffdfd;
  background-clip:padding-box;
  box-shadow:0 .55rem 1.1rem rgba(77,12,22,.08);
}

/* Dispensing and supply-line dialogs have a padded scroll container.  Bleed
   the sticky header into that padding so no form control can show beside or
   through the header on Safari while it is scrolled. */
.pharmacy-page .pharmacy-dispense-modal .perm-modal-head{
  top:-20px;
  margin:-20px -20px 1rem;
  padding:20px 20px .85rem;
}

.pharmacy-page .pharmacy-dispense-modal .pharmacy-modal-actions{
  isolation:isolate;
  z-index:320;
  background:#fffdfd;
  background-clip:padding-box;
  box-shadow:0 -.55rem 1.1rem rgba(77,12,22,.07);
  bottom:-20px;
  margin:1rem -20px -20px;
  padding:.85rem 20px 20px;
  border-radius:0 0 calc(1rem - 1px) calc(1rem - 1px);
}

@media (max-width:640px){
  .pharmacy-page .pharmacy-dispense-modal .perm-modal-head{
    top:-14px;
    margin:-14px -14px .85rem;
    padding:14px 14px .75rem;
  }
  .pharmacy-page .pharmacy-dispense-modal .pharmacy-modal-actions{
    bottom:-14px;
    margin:.85rem -14px -14px;
    padding:.75rem 14px 14px;
  }
}

/* Keep catalog and dispensing dialogs clipped when a picker opens. Their
   full-bleed sticky surfaces otherwise paint outside the rounded card because
   the shared picker rule switches ordinary modals to overflow-visible. */
.pharmacy-modal:has(.modern-select-native[open]),
.pharmacy-page .pharmacy-dispense-modal:has(.modern-select-native[open]){
  overflow:auto;
  overscroll-behavior:contain;
}

/* Calendars extend beyond the card. Match sticky surfaces to the actual card
   padding and round their own edges so overflow-visible never squares the
   dialog corners or paints an extra frame outside its border. */
.pharmacy-modal{--pharmacy-modal-inset:16px}
.pharmacy-modal .perm-modal-head,
.pharmacy-page .pharmacy-dispense-modal .perm-modal-head{
  top:calc(0px - var(--pharmacy-modal-inset));
  margin-block-start:calc(0px - var(--pharmacy-modal-inset));
  margin-inline:calc(0px - var(--pharmacy-modal-inset));
  padding-block-start:var(--pharmacy-modal-inset);
  padding-inline:var(--pharmacy-modal-inset);
  border-start-start-radius:calc(1rem - 1px);
  border-start-end-radius:calc(1rem - 1px);
}
.pharmacy-page .pharmacy-dispense-modal .pharmacy-modal-actions{
  bottom:calc(0px - var(--pharmacy-modal-inset));
  margin-inline:calc(0px - var(--pharmacy-modal-inset));
  margin-block-end:calc(0px - var(--pharmacy-modal-inset));
  padding-inline:var(--pharmacy-modal-inset);
  padding-block-end:var(--pharmacy-modal-inset);
}
@media (max-width:640px){
  .pharmacy-modal{--pharmacy-modal-inset:14px}
}
