#rifd-pharmacy-requisitions {
  --prq-navy: #1b3a6b;
  --prq-navy-dark: #102b52;
  --prq-mint: #33d6a6;
  --prq-gold: #e8b84b;
  --prq-bg: #f5f7fa;
  --prq-line: #dce4ee;
  position: fixed;
  inset: 0;
  z-index: 2147481450;
  overflow: auto;
  color: #17243a;
  background: var(--prq-bg);
  font-family: Tajawal, "IBM Plex Sans Arabic", Arial, sans-serif;
}

#rifd-pharmacy-requisitions[hidden] { display: none !important; }
body.prq-open { overflow: hidden !important; }

.prq-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  padding: 12px clamp(16px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff;
  background: linear-gradient(125deg, #102b52 0%, #1b3a6b 70%, #214979 100%);
  box-shadow: 0 8px 28px rgba(16, 43, 82, .2);
}

.prq-brand, .prq-top-actions { display: flex; align-items: center; gap: 12px; }
.prq-brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  color: var(--prq-navy-dark); background: var(--prq-mint); font-weight: 900; letter-spacing: -.04em;
}
.prq-brand strong, .prq-brand small { display: block; }
.prq-brand strong { font-size: 18px; font-weight: 900; }
.prq-brand small { margin-top: 2px; color: rgba(255,255,255,.68); font-size: 11px; }

.prq-back, .prq-close {
  border: 1px solid rgba(255,255,255,.2); color: #fff; background: rgba(255,255,255,.08); cursor: pointer;
  transition: .2s ease; font: inherit; font-weight: 800;
}
.prq-back { min-height: 42px; padding: 0 14px; border-radius: 13px; display: flex; align-items: center; gap: 8px; }
.prq-close { width: 42px; height: 42px; border-radius: 50%; font-size: 25px; line-height: 1; }
.prq-back:hover, .prq-close:hover { background: rgba(255,255,255,.17); transform: translateY(-1px); }

.prq-tabs {
  position: sticky; top: 76px; z-index: 18; display: flex; justify-content: center; gap: 8px;
  padding: 11px 16px; background: rgba(245,247,250,.95); border-bottom: 1px solid var(--prq-line); backdrop-filter: blur(14px);
}
.prq-tabs button {
  min-height: 42px; padding: 0 24px; border: 1px solid transparent; border-radius: 13px;
  background: transparent; color: #59708d; cursor: pointer; font: inherit; font-weight: 800;
}
.prq-tabs button.active { color: #fff; background: var(--prq-navy); box-shadow: 0 8px 20px rgba(27,58,107,.18); }

.prq-main { width: min(1480px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 54px; }
.prq-hero {
  position: relative; overflow: hidden; min-height: 156px; margin-bottom: 20px; padding: 28px clamp(24px, 4vw, 48px);
  border-radius: 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  color: #fff; background: linear-gradient(130deg, #132f59, #1b3a6b 63%, #225278); box-shadow: 0 16px 40px rgba(27,58,107,.14);
}
.prq-hero::after { content: "Rx"; position: absolute; inset-inline-end: 5%; top: -44px; font-size: 180px; font-weight: 900; color: rgba(51,214,166,.08); transform: rotate(-7deg); }
.prq-hero > * { position: relative; z-index: 1; }
.prq-hero span { color: var(--prq-mint); font-size: 12px; font-weight: 900; letter-spacing: .06em; }
.prq-hero h1 { margin: 7px 0 4px; font-size: clamp(26px, 3vw, 36px); line-height: 1.2; font-weight: 900; }
.prq-hero p { margin: 0; color: rgba(255,255,255,.72); }

.prq-import {
  width: min(310px, 100%); padding: 15px 17px; border: 1px dashed rgba(255,255,255,.34); border-radius: 16px;
  background: rgba(255,255,255,.08); cursor: pointer;
}
.prq-import input { display: none; }
.prq-import strong, .prq-import small { display: block; }
.prq-import strong { color: #fff; font-weight: 900; }
.prq-import small { margin-top: 3px; color: rgba(255,255,255,.65); font-size: 11px; }

.prq-notice { margin: 0 0 18px; padding: 13px 17px; border-radius: 14px; font-weight: 800; }
.prq-notice.success { color: #087657; background: #def9ef; border: 1px solid #aae9d5; }
.prq-notice.error { color: #a72d39; background: #fff0f1; border: 1px solid #fac7cc; }
.prq-notice.info { color: #1b3a6b; background: #eaf1fb; border: 1px solid #c5d7ef; }

.prq-catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.prq-catalog-layout.full-list { grid-template-columns: minmax(0, 1fr); }
.prq-catalog-card, .prq-basket, .prq-requests-shell, .prq-detail-card {
  border: 1px solid var(--prq-line); border-radius: 20px; background: #fff; box-shadow: 0 12px 34px rgba(20,50,90,.07);
}
.prq-search { margin: 16px; height: 48px; padding: 0 16px; border: 1px solid var(--prq-line); border-radius: 14px; display: flex; align-items: center; gap: 10px; background: #f8fafc; }
.prq-search span { color: var(--prq-navy); font-size: 22px; }
.prq-search input { width: 100%; border: 0; outline: 0; background: transparent; color: #17243a; font: inherit; font-weight: 700; }
.prq-catalog-toolbar { display: flex; align-items: center; gap: 14px; padding-inline-end: 16px; }
.prq-catalog-toolbar .prq-search { flex: 1; }
.prq-catalog-count { color: #64778f; font-size: 12px; font-weight: 900; white-space: nowrap; }

.prq-table-wrap { overflow: auto; }
.prq-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.prq-table th { padding: 13px 14px; color: #6a7e99; background: #f6f8fb; border-block: 1px solid var(--prq-line); text-align: start; white-space: nowrap; font-weight: 900; }
.prq-table td { padding: 11px 14px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
.prq-table tbody tr { transition: .16s ease; }
.prq-table tbody tr:hover { background: #f8fbff; }
.prq-table tbody tr.selected { background: #effcf8; }
.prq-table td strong { display: block; min-width: 230px; color: #183457; font-weight: 850; }
.prq-table input[type="number"] { width: 112px; height: 39px; border: 1px solid #cad6e5; border-radius: 10px; padding: 0 10px; color: #153154; background: #fff; font: 800 14px/1 inherit; }
.prq-table input:focus { outline: 3px solid rgba(51,214,166,.16); border-color: var(--prq-mint); }
.prq-full-list-table th:first-child, .prq-full-list-table td:first-child { width: 54px; color: #8290a3; text-align: center; }
.prq-full-list-table thead th:last-child, .prq-full-list-table td:last-child { position: sticky; inset-inline-end: 0; z-index: 1; background: #fff; box-shadow: -8px 0 16px rgba(31,52,82,.04); }
.prq-full-list-table tr.selected td:last-child { background: #effcf8; }
.prq-full-list-table input[type="number"] { width: 130px; border-width: 2px; }
.prq-full-list-table .prq-section-row th {
  position: static; inset: auto; padding: 12px 16px; color: #fff; background: linear-gradient(115deg, var(--prq-navy-dark), var(--prq-navy));
  border-block: 0; box-shadow: inset 0 1px rgba(255,255,255,.08); text-align: start; white-space: normal;
}
.prq-section-row th > span { display: inline-grid; width: 30px; height: 30px; margin-inline-end: 10px; place-items: center; border-radius: 9px; color: var(--prq-navy-dark); background: var(--prq-mint); font-size: 11px; font-weight: 950; }
.prq-section-row th > strong { display: inline; color: #fff; font-size: 14px; font-weight: 950; }
.prq-section-row th > small { margin-inline-start: 9px; color: rgba(255,255,255,.62); font-size: 10px; }
.prq-section-row th > em { float: inline-end; margin-top: 7px; color: var(--prq-gold); font-size: 10px; font-style: normal; font-weight: 900; }

.prq-order-actions { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-top: 1px solid #cad8e6; background: rgba(255,255,255,.96); box-shadow: 0 -10px 28px rgba(20,50,90,.1); backdrop-filter: blur(10px); }
.prq-order-actions small, .prq-order-actions strong, .prq-order-actions span { display: block; }
.prq-order-actions small { color: #74869c; font-size: 10px; font-weight: 900; }
.prq-order-actions strong { margin-top: 2px; color: var(--prq-navy); font-size: 18px; font-weight: 950; }
.prq-order-actions span { margin-top: 3px; color: #6c7e94; font-size: 11px; }
.prq-order-buttons { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.prq-order-buttons .prq-link { min-height: 40px; padding: 0 10px; color: var(--prq-navy); }
.prq-order-buttons .prq-link.danger { color: #b13b46; }
.prq-review-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 18px; border-top: 1px solid var(--prq-line); background: #f8fafc; }
.prq-review-actions .prq-primary { min-width: 150px; }
.prq-draft-card { grid-template-columns: 1.2fr 1.5fr 1.3fr auto auto; }

.prq-add { min-width: 76px; height: 38px; padding: 0 10px; border: 1px solid #bfd0e4; border-radius: 11px; color: var(--prq-navy); background: #fff; cursor: pointer; font: 800 12px/1 inherit; }
.prq-add span { margin-inline-start: 5px; }
.prq-add.active { color: #087657; border-color: #87dfc4; background: #e6faf4; }

.prq-basket { position: sticky; top: 140px; max-height: calc(100vh - 162px); overflow: hidden; display: flex; flex-direction: column; }
.prq-basket-head { padding: 18px; border-bottom: 1px solid var(--prq-line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.prq-basket-head small, .prq-basket-head strong { display: block; }
.prq-basket-head small { color: #71839a; font-size: 11px; font-weight: 800; }
.prq-basket-head strong { margin-top: 2px; color: var(--prq-navy); font-size: 19px; font-weight: 900; }
.prq-link { border: 0; color: #b13b46; background: transparent; cursor: pointer; font: 800 12px/1 inherit; }
.prq-basket-body { overflow: auto; padding: 10px 14px; }
.prq-basket-row { display: grid; grid-template-columns: 26px 1fr; gap: 9px; padding: 11px 0; border-bottom: 1px solid #edf1f5; }
.prq-basket-row > button { width: 24px; height: 24px; border: 0; border-radius: 50%; color: #a62f3a; background: #fff0f1; cursor: pointer; }
.prq-basket-row strong { display: block; color: #183457; font-size: 12px; line-height: 1.45; }
.prq-basket-row small { display: block; margin-top: 3px; color: #8492a5; font-size: 9px; direction: ltr; text-align: start; }
.prq-basket-row label { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #667a94; font-size: 10px; font-weight: 800; }
.prq-basket-row input { width: 112px; height: 35px; border: 1px solid #ccd7e5; border-radius: 9px; padding: 0 8px; }

.prq-primary, .prq-secondary { min-height: 43px; padding: 0 18px; border-radius: 12px; cursor: pointer; font: 850 13px/1 inherit; transition: .2s ease; }
.prq-primary { border: 1px solid #23be90; color: #0a3d31; background: var(--prq-mint); box-shadow: 0 8px 18px rgba(51,214,166,.23); }
.prq-primary:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }
.prq-secondary { border: 1px solid #c8d4e3; color: var(--prq-navy); background: #fff; }
.prq-primary:not(:disabled):hover, .prq-secondary:hover { transform: translateY(-1px); }
.prq-submit { margin: 12px 14px 14px; }

.prq-empty, .prq-loading { padding: 44px 20px; color: #75869d; text-align: center; font-weight: 800; }
.prq-empty.small { padding: 26px 10px; font-size: 12px; }
.prq-requests-shell { overflow: hidden; }
.prq-filters { padding: 14px 16px; border-bottom: 1px solid var(--prq-line); display: flex; justify-content: flex-end; gap: 8px; }
.prq-filters select, .prq-workflow select { min-height: 42px; padding: 0 14px; border: 1px solid #c8d4e3; border-radius: 11px; color: var(--prq-navy); background: #fff; font: 800 13px/1 inherit; }
.prq-request-list { display: grid; gap: 10px; padding: 14px; }
.prq-request-card { display: grid; grid-template-columns: 1.2fr 1.5fr 1.2fr auto auto; gap: 16px; align-items: center; padding: 16px; border: 1px solid #e0e7ef; border-radius: 15px; background: #fff; }
.prq-request-card small, .prq-request-card strong, .prq-request-card span { display: block; }
.prq-request-card small { color: #7a8ca2; font-size: 10px; font-weight: 800; }
.prq-request-card strong { margin-top: 3px; color: #1c3c67; font-size: 13px; font-weight: 900; }
.prq-request-card div > span { margin-top: 3px; color: #8795a7; font-size: 10px; }
.prq-request-code strong { color: #0c8d69; font-size: 15px; }

.prq-status { width: max-content; padding: 7px 11px; border-radius: 999px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.prq-status.submitted { color: #8b6300; background: #fff5d9; }
.prq-status.processing { color: #195589; background: #e7f2ff; }
.prq-status.ready { color: #087657; background: #def9ef; }
.prq-status.completed { color: #fff; background: #247a68; }
.prq-status.cancelled { color: #9d3742; background: #ffeaec; }

.prq-detail-head { margin-bottom: 18px; padding: 24px 28px; border-radius: 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; color: #fff; background: var(--prq-navy); }
.prq-detail-head small { color: var(--prq-mint); font-weight: 900; }
.prq-detail-head h1 { margin: 5px 0; font-size: 27px; }
.prq-detail-head p { margin: 0; color: rgba(255,255,255,.7); font-size: 12px; }
.prq-detail-head .prq-status.completed { background: var(--prq-mint); color: #093a2f; }
.prq-detail-card { overflow: hidden; }
.prq-detail-actions { padding: 18px; display: grid; gap: 16px; border-top: 1px solid var(--prq-line); }
.prq-export-group, .prq-workflow { display: flex; justify-content: flex-end; gap: 9px; }
.prq-note span { display: block; margin-bottom: 6px; color: #657a96; font-size: 11px; font-weight: 900; }
.prq-note textarea { width: 100%; resize: vertical; padding: 12px; border: 1px solid #c8d4e3; border-radius: 12px; font: 700 13px/1.6 inherit; }

@media (max-width: 980px) {
  .prq-catalog-layout { grid-template-columns: 1fr; }
  .prq-basket { position: static; max-height: none; }
  .prq-request-card { grid-template-columns: 1fr 1fr; }
  .prq-request-card > .prq-status, .prq-request-card > button { justify-self: start; }
}

@media (max-width: 700px) {
  .prq-topbar { min-height: 66px; padding: 10px 12px; }
  .prq-brand strong { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .prq-brand small, .prq-back span { display: none; }
  .prq-back, .prq-close { width: 40px; min-width: 40px; height: 40px; padding: 0; justify-content: center; }
  .prq-tabs { top: 66px; justify-content: stretch; }
  .prq-tabs button { flex: 1; padding: 0 10px; font-size: 12px; }
  .prq-main { width: min(100% - 18px, 1480px); padding-top: 14px; }
  .prq-hero { min-height: 132px; padding: 20px; border-radius: 18px; display: block; }
  .prq-hero h1 { font-size: 24px; }
  .prq-hero p { font-size: 11px; }
  .prq-import { margin-top: 14px; }
  .prq-catalog-card, .prq-basket, .prq-requests-shell, .prq-detail-card { border-radius: 16px; }
  .prq-request-card { grid-template-columns: 1fr; gap: 10px; }
  .prq-detail-head { padding: 20px; align-items: flex-start; }
  .prq-detail-head h1 { font-size: 20px; }
  .prq-export-group, .prq-workflow { flex-wrap: wrap; justify-content: stretch; }
  .prq-export-group button, .prq-workflow > * { flex: 1; }
  .prq-table { min-width: 830px; }
  .prq-catalog-toolbar { display: block; padding: 0; }
  .prq-catalog-count { display: block; margin: -8px 18px 14px; }
  .prq-order-actions { position: static; display: block; }
  .prq-order-buttons { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; }
  .prq-order-buttons .prq-primary { grid-column: 1 / -1; }
  .prq-review-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .prq-review-actions .prq-primary { grid-column: 1 / -1; }
  .prq-draft-card { grid-template-columns: 1fr; }
}

@media print {
  #rifd-pharmacy-requisitions { position: static; overflow: visible; }
  .prq-topbar, .prq-tabs, .prq-hero, .prq-notice, .prq-detail-actions { display: none !important; }
  .prq-main { width: 100%; padding: 0; }
  .prq-detail-card { border: 0; box-shadow: none; }
}
