/* Edraak visual identity; existing permissions and specialty labels are preserved. */
:root {
  --green: #087f85;
  --green-dark: #102f3c;
  --green-light: #eaf7f6;
  --gold: #5ae0cc;
}
body {
  color: #102f3c;
}
.auth-brand {
  background: linear-gradient(145deg, #102f3c, #164a59) !important;
}
.auth-brand .wordmark {
  letter-spacing: -1px;
}
.edraak-symbol {
  color: #5ae0cc;
  font-family: Arial, sans-serif;
  font-size: 0.8em;
  direction: ltr;
  display: inline-block;
}
.brand-mark {
  background: #102f3c !important;
  color: #5ae0cc !important;
  font-family: Arial, sans-serif;
  direction: ltr;
  font-size: 20px !important;
}
.brand-logo {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.brand-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-page {
  display: grid;
  gap: 12px;
}
.settings-toolbar {
  position: sticky;
  top: 112px;
  z-index: 19;
  padding: 12px 16px;
  box-shadow: 0 3px 12px #102f3c0a;
}
.settings-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-toolbar h1 {
  font-size: 18px;
}
.settings-toolbar .btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.settings-toolbar .form-error:empty {
  display: none;
}
.settings-logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}
.settings-logo-box {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
#settings-form .clinic-logo-preview {
  width: 94px;
  height: 94px;
  padding: 6px;
  border: 0;
}
.settings-logo-controls {
  min-width: 0;
  flex: 1;
}
.settings-logo-controls small,
.settings-logo-controls p {
  display: block;
  margin-top: 5px;
}
.settings-logo-controls .error-text {
  color: #b91c1c;
}
.settings-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px 14px;
  padding: 16px;
}
.settings-fields input,
.settings-fields select {
  min-height: 40px;
  padding: 8px 10px;
}
.settings-fields textarea {
  min-height: 64px;
}
.settings-notes {
  grid-column: 1 / -1;
}
@media (max-width: 1100px) {
  .settings-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .settings-toolbar {
    top: 108px;
    padding: 10px 12px;
  }
  .settings-toolbar h1 {
    font-size: 16px;
  }
  .settings-toolbar-row > div {
    min-width: 0;
  }
  .settings-fields {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }
  .settings-logo-section {
    align-items: flex-start;
    padding: 12px;
    gap: 12px;
  }
}
.btn.primary,
.nav-item.active {
  background: #087f85 !important;
  border-color: #087f85 !important;
  color: #fff !important;
}
.btn.primary:hover {
  background: #07696e !important;
}
.hero,
.hero-mini {
  background: linear-gradient(130deg, #102f3c, #17616c) !important;
}
.auth-brand small {
  color: #b9d8df;
}
.app-footer {
  color: #596f7b;
}
.brand span {
  color: #087f85 !important;
}

/* One persistent language control for every route; no business data in browser storage. */
.locale-toolbar {
  position: sticky;
  top: 0;
  z-index: 45;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 6px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.locale-toolbar label {
  margin: 0;
  font-size: 12px;
}
.locale-toolbar select {
  width: auto;
  min-width: 105px;
  padding: 4px 10px;
}
.sidebar {
  top: 44px;
}
.topbar {
  top: 44px;
}
.auth-screen,
.account-page,
.main-wrap {
  min-height: calc(100vh - 44px);
}
input[type='email'],
input[type='tel'],
input[name='slug'],
.pill-number {
  direction: ltr;
  unicode-bidi: isolate;
}
html[dir='ltr'] .nav-item.active > span:last-child {
  transform: scaleX(-1);
}
html[dir='ltr'] .auth-brand h1 {
  line-height: 1.25;
}
html[dir='ltr'] .metric-live strong {
  font-size: 21px;
}
html[dir='ltr'] .btn {
  white-space: normal;
}
html[dir='ltr'] .group-title {
  letter-spacing: 0.15px;
}
@media (min-width: 768px) and (max-width: 1279px) {
  .sidebar {
    width: 250px;
  }
}
@media (max-width: 767px) {
  html[dir='ltr'] .sidebar {
    transform: translateX(-100%);
  }
  html[dir='ltr'] .sidebar.open {
    transform: translateX(0);
  }
  .locale-toolbar {
    padding-inline: 16px;
  }
  .auth-brand h1 {
    max-width: 24ch;
  }
  .print-screen .no-print {
    flex-wrap: wrap;
  }
}
@media print {
  .locale-toolbar {
    display: none !important;
  }
}
/* Reference selectors remain usable in either writing direction. */
.test-options {
  max-height: 42vh;
  overflow: auto;
  margin-block: 16px;
  border: 1px solid var(--line, #dce5ee);
  border-radius: 12px;
  padding: 12px;
}
.test-options .check {
  align-items: flex-start;
  padding: 10px;
  border-block-end: 1px solid #e5edf3;
}
.test-options small {
  display: block;
  margin-block-start: 5px;
  overflow-wrap: anywhere;
}
.location-options {
  max-height: 260px;
  overflow: auto;
}
.location-options:empty {
  display: none;
}
.location-options .search-result {
  width: 100%;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.paper details {
  display: block;
}
.paper details p {
  font-size: 9px;
  overflow-wrap: anywhere;
}
@media print {
  .paper details > p {
    display: block;
  }
  .paper details > summary {
    display: none;
  }
}

/* Operating workspace follows the Najd reference; Edraak identity stays on public/auth pages. */
.app-layout {
  --green: #065f46;
  --green-dark: #022c22;
  --green-light: #ecfdf5;
  color: #0f172a;
}
.app-layout .btn.primary,
.app-layout .nav-item.active {
  background: #065f46 !important;
  border-color: #065f46 !important;
}
.app-layout .hero-mini {
  background: linear-gradient(to left, #064e3b, #022c22) !important;
}
.ui-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}
.btn {
  gap: 6px;
}
.topbar {
  gap: 12px;
}
.top-quick-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.top-quick-actions .btn {
  font-size: 11px;
  padding: 6px 9px;
  white-space: nowrap;
}
.topbar .search-button {
  max-width: 218px;
  text-align: start;
  overflow: hidden;
}
.topbar .tenant-switch select {
  max-width: 155px;
  font-size: 11px;
}
.topbar > .row {
  gap: 6px;
}
.nav-group > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: #475569;
  padding: 12px;
}
.nav-group > summary::-webkit-details-marker {
  display: none;
}
.nav-group > summary:after {
  content: '⌄';
  margin-inline-start: auto;
}
.nav-group:not([open]) > summary:after {
  content: '‹';
}
.nav-entries {
  border-inline-start: 1px solid #e2e8f0;
  margin-inline-start: 18px;
  padding-inline-start: 6px;
}
.nav-item {
  padding: 7px 12px;
}
.nav-group:has(.active) > summary {
  color: #065f46;
  background: #f0fdf4;
  border-radius: 10px;
}
.pagehead h1 {
  font-size: 20px;
}
.pagehead p {
  max-width: 760px;
}
.panel {
  overflow: hidden;
}
.data-table td {
  line-height: 1.6;
}
.data-table .sub-cell {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
}
.numeric {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}
.workflow-panel {
  padding: 16px;
}
.workflow-panel h3 {
  font-size: 12px;
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.workflow strong {
  display: block;
  font-size: 11px;
}
.workflow small {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-top: 3px;
}
.workflow .step {
  font-size: 10px;
  color: #fff;
  background: #065f46;
}
.lab-list .data-table {
  min-width: 1000px;
}
.lab-list .data-table th,
.lab-list .data-table td {
  padding: 12px 10px;
}
.lab-list .data-table th:last-child {
  min-width: 165px;
}
.lab-row-actions {
  flex-wrap: nowrap;
}
.lab-row-actions .btn {
  font-size: 10px;
  padding: 5px 7px;
  white-space: nowrap;
}
.lab-row-actions .ui-icon {
  width: 13px;
  height: 13px;
}
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 90px;
  max-width: 160px;
}
.category-chip {
  display: inline-block;
  padding: 2px 5px;
  font-size: 9px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  direction: ltr;
  unicode-bidi: isolate;
}
.demo-tag {
  display: block;
  color: #92400e;
  font-size: 10px;
  margin-top: 4px;
}
.urgency-normal {
  background: #f1f5f9;
  color: #64748b;
}
.urgency-urgent {
  background: #fffbeb;
  color: #b45309;
}
.urgency-emergency {
  background: #fff1f2;
  color: #be123c;
}
.dialog-head h2 {
  font-size: 14px;
}
.dialog-head .btn[data-action='close'] {
  font-size: 11px;
}
.dialog {
  max-width: 600px;
}
.dialog.wide {
  max-width: 1024px;
}
@media (max-width: 1349px) {
  .top-quick-actions [data-kind='visits'],
  .top-quick-actions [data-kind='sales'] {
    display: none;
  }
  .topbar [data-view='account'] {
    display: none;
  }
}
@media (max-width: 767px) {
  .topbar .search-button {
    display: none;
  }
  .top-quick-actions {
    margin-inline-start: auto;
  }
  .top-quick-actions .btn span {
    display: none;
  }
  .top-quick-actions .btn {
    padding: 8px;
  }
  .topbar > .row {
    display: none;
  }
  .lab-row-actions {
    flex-direction: column;
  }
  .workflow-panel {
    padding: 12px;
  }
  .pagehead {
    gap: 14px;
  }
  .pagehead .row {
    width: 100%;
  }
  .pagehead .primary {
    width: 100%;
  }
  .lab-list .data-table {
    min-width: 960px;
  }
}
.lab-request-dialog {
  max-width: 540px;
}
.lab-request-dialog .dialog-body {
  padding: 20px;
}
.lab-request-dialog .form-grid {
  gap: 12px;
}
.lab-request-dialog .related-choice {
  position: relative;
}
.lab-request-dialog .related-choice > .btn {
  position: absolute;
  inset-inline-end: 0;
  top: -4px;
  font-size: 10px;
  padding: 3px 6px;
}
.lab-request-dialog .related-choice label {
  padding-inline-end: 125px;
}
.lab-request-dialog h3 {
  font-size: 12px;
  margin: 14px 0 10px;
}
.test-categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}
.test-category {
  display: flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px;
  gap: 8px;
}
.test-category.active {
  border-color: #059669;
  background: #ecfdf5;
}
.test-category > button {
  background: none;
  border: 0;
  padding: 0;
  text-align: start;
  flex: 1;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px;
}
.test-category strong {
  font-size: 11px;
}
.test-category small {
  font-size: 10px;
  grid-column: 1;
}
.test-category span {
  font-size: 10px;
  color: #64748b;
  grid-column: 2;
  grid-row: 1/3;
  align-self: center;
}
.test-category input {
  width: 15px;
  height: 15px;
  accent-color: #065f46;
}
.test-picker-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0 8px;
}
.test-picker-heading h4 {
  font-size: 12px;
}
.lab-request-dialog .test-options {
  max-height: 230px;
  margin: 8px 0;
  padding: 4px 10px;
}
.lab-request-dialog .test-options .check {
  font-size: 11px;
  padding: 8px 0;
}
.lab-request-dialog .test-options small {
  font-size: 10px;
  margin: 2px 0 0;
}
.lab-request-dialog .doc-notice {
  font-size: 10px;
  margin: 8px 0;
}
.lab-results-dialog .dialog-head {
  flex-wrap: wrap;
  gap: 8px;
}
.lab-results-dialog .dialog-head h2 {
  flex: 1;
}
.lab-results-dialog .dialog-head [data-action='close'] {
  order: 3;
}
.lab-results-dialog .dialog-body {
  padding: 0;
}
.lab-patient-strip {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.lab-patient-strip .title-cell {
  font-size: 12px;
}
.lab-patient-strip .sub-cell {
  display: block;
  font-size: 10px;
  color: #64748b;
}
.lab-category-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11px;
}
.results-heading {
  font-size: 11px;
  padding: 12px 24px;
}
.lab-results-dialog .data-table {
  min-width: 930px;
  table-layout: fixed;
}
.lab-results-dialog .data-table th {
  font-size: 10px;
  white-space: normal;
}
.lab-results-dialog .data-table td {
  font-size: 11px;
  padding: 10px 8px;
}
.lab-results-dialog .data-table th:nth-child(1) {
  width: 8%;
}
.lab-results-dialog .data-table th:nth-child(2) {
  width: 23%;
}
.lab-results-dialog .data-table th:nth-child(3) {
  width: 12%;
}
.lab-results-dialog .data-table th:nth-child(4) {
  width: 8%;
}
.lab-results-dialog .data-table th:nth-child(5) {
  width: 22%;
}
.lab-results-dialog .data-table th:nth-child(6) {
  width: 10%;
}
.lab-results-dialog .data-table th:nth-child(7) {
  width: 17%;
}
.lab-results-dialog input {
  padding: 6px;
  font-size: 12px;
  min-width: 0;
  width: 100%;
}
.lab-results-dialog [data-result] {
  direction: ltr;
  font-weight: 700;
}
.lab-results-dialog .result-code {
  font-size: 9px;
  display: block;
  direction: ltr;
  text-align: start;
  color: #64748b;
}
.lab-results-dialog .data-table details {
  font-size: 9px;
  max-width: 200px;
}
.lab-results-dialog .data-table details p {
  overflow-wrap: anywhere;
}
.lab-interpretation {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.lab-interpretation .span2 {
  grid-column: auto;
}
.lab-review-note {
  padding: 0 24px;
}
.lab-results-dialog .form-error {
  padding: 0 24px;
}
.lab-results-dialog .dialog-foot {
  flex-shrink: 0;
  flex-wrap: wrap;
}
.lab-results-dialog .dialog-foot .small {
  max-width: 300px;
}
.dashboard-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.dashboard-metrics .metric-live {
  padding: 16px;
}
.dashboard-metrics .metric-live strong {
  font-size: 19px;
}
.print-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.print-hub-card h2 {
  font-size: 14px;
  margin-top: 12px;
}
.report-symbol {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: #ecfdf5;
  color: #065f46;
  border-radius: 10px;
}
.report-symbol .ui-icon {
  width: 22px;
  height: 22px;
}
.print-screen {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.print-screen .print-toolbar {
  background: #0f172a;
  padding: 12px 20px;
  max-width: none;
  width: 100%;
  margin: 0;
  flex-shrink: 0;
  align-items: center;
  flex-wrap: wrap;
  min-height: 64px;
}
.print-selection,
.print-options {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.print-toolbar select {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
  width: auto;
  max-width: 320px;
  font-size: 11px;
  padding: 7px;
}
.print-toolbar label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 11px;
  color: #cbd5e1;
}
.print-toolbar input[type='checkbox'] {
  width: 14px;
}
.print-toolbar .btn {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}
.print-toolbar .btn.primary {
  background: #065f46 !important;
  border-color: #065f46 !important;
}
.print-workspace {
  width: 100%;
  overflow: auto;
  padding: 32px;
  flex: 1;
}
.print-screen .paper {
  width: 794px;
  max-width: none;
  margin: auto;
  padding: 32px;
  min-height: 1123px;
}
.print-screen .paper.compact {
  padding: 24px;
}
.print-screen .paper.wide {
  padding: 56px;
}
.print-screen .paper-head h1 {
  font-size: 18px;
}
.print-screen .paper-head h2 {
  font-size: 11px;
  margin: 4px 0;
}
.print-screen .paper-head p {
  font-size: 10px;
}
.paper-logo .ui-icon {
  width: 32px;
  height: 32px;
}
.paper-reference {
  min-width: 180px;
  font-size: 11px;
}
.print-party-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0;
}
.print-party-grid .title-cell {
  font-size: 11px;
}
.print-party-grid .sub-cell {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
}
.financial-paper .print-party-grid {
  grid-template-columns: 1fr 1fr;
}
.lab-section h3 {
  font-size: 11px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.lab-section h3 > small {
  margin-inline-start: auto;
}
.print-screen .lab-section .data-table td {
  font-size: 10px;
}
.print-screen .lab-section .data-table th {
  font-size: 9px;
}
.print-screen .lab-section .data-table small {
  font-size: 9px;
}
.print-screen .lab-section .badge {
  white-space: normal;
}
.print-interpretation {
  border: 1px solid #e2e8f0;
  padding: 16px;
  border-radius: 10px;
  background: #f8fafc;
  break-inside: avoid;
}
.print-interpretation h3 {
  font-size: 12px;
  margin: 8px 0;
}
.print-interpretation p {
  line-height: 1.8;
}
.approval-record {
  margin-top: 20px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  font-size: 10px;
  break-inside: avoid;
}
.print-financial-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.print-screen .paper-foot {
  margin-top: 24px;
}
.print-screen .print-document-note {
  margin: 0;
  font-size: 9px;
}
.print-screen .financial-paper thead th {
  background: #f5e7bc;
  color: #59420b;
}
.print-screen .financial-paper h1 {
  color: #765b16;
}
.print-screen .paper-logo[hidden] {
  display: none;
}
@media (max-width: 1100px) {
  .dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .print-hub-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 767px) {
  .test-categories {
    max-height: 180px;
  }
  .lab-patient-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px;
  }
  .lab-category-tabs {
    padding: 12px;
  }
  .lab-interpretation {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .dialog-foot .action-list {
    gap: 6px;
  }
  .dialog-foot .btn {
    font-size: 11px;
    padding: 7px;
  }
  .print-hub-grid {
    grid-template-columns: 1fr;
  }
  .print-workspace {
    padding: 12px;
  }
  .print-toolbar select {
    max-width: 100%;
    flex: 1;
  }
  .print-selection {
    width: 100%;
  }
  .print-selection #preview-record {
    max-width: 200px;
  }
  .print-options .btn {
    padding: 6px;
    font-size: 10px;
  }
  .print-toolbar .print-options {
    width: 100%;
    gap: 6px;
  }
  .print-toolbar #preview-margin {
    max-width: 120px;
  }
}
@media print {
  .print-screen {
    display: block !important;
  }
  .print-workspace {
    padding: 0 !important;
    overflow: visible !important;
  }
  .print-screen .paper {
    width: 100% !important;
  }
  .print-party-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    break-inside: avoid;
  }
  .print-screen .financial-paper .print-party-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .print-financial-bottom {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    break-inside: avoid;
  }
  .print-screen .lab-section {
    break-inside: auto;
  }
  .print-screen .lab-section h3 {
    break-after: avoid;
  }
  .print-screen[data-margin='compact'] .paper {
    padding: 0 0 !important;
  }
  .print-screen[data-margin='wide'] .paper {
    padding: 0 10mm !important;
  }
  .print-screen .paper-head .row {
    flex-wrap: nowrap;
  }
  .print-screen .paper-logo {
    width: 45px;
    height: 45px;
  }
  .print-screen .paper h1 {
    font-size: 16px;
  }
}
.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.dashboard-charts > .panel {
  padding: 16px;
}
.dashboard-charts .subheading {
  font-size: 12px;
}
.dashboard-charts .chart-bars {
  height: 180px;
}
.dashboard-charts .progress-row {
  font-size: 10px;
}
.dashboard-charts .fin-total {
  font-size: 12px;
  padding: 12px;
  margin-top: 12px;
}
.financial-tabs {
  padding: 12px;
  display: flex;
  gap: 8px;
  overflow: auto;
  flex-wrap: wrap;
}
.financial-tabs .btn {
  font-size: 11px;
}
.document-list .data-table {
  min-width: 1050px;
}
.document-list .data-table th {
  white-space: normal;
}
.document-list .data-table td {
  font-size: 11px;
}
.document-list .data-table .btn {
  white-space: nowrap;
  font-size: 10px;
  padding: 5px 7px;
}
.document-list .data-table .ui-icon {
  width: 13px;
  height: 13px;
}
@media (max-width: 1279px) {
  .dashboard-charts {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 767px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
}
.clinic-layout {
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
}
.clinic-list .visit-card {
  display: block;
  width: 100%;
  text-align: start;
  color: #0f172a;
}
.clinic-list .visit-card .sub-cell {
  display: block;
  font-size: 10px;
  margin: 4px 0;
  color: #64748b;
}
.clinic-list .visit-card .badge {
  margin-top: 6px;
}
.clinic-detail > .action-list {
  margin-bottom: 18px;
}
.clinic-detail h3 {
  font-size: 14px;
}
.document-editor-dialog {
  max-width: 896px !important;
}
.document-editor-dialog .form-grid {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.document-editor-dialog .line-group {
  border-bottom: 1px solid #e2e8f0;
}
.document-editor-dialog .doc-line {
  border: 0;
}
.document-editor-dialog .doc-line input,
.document-editor-dialog .doc-line select {
  font-size: 11px;
  padding: 6px;
}
.document-editor-dialog .document-totals {
  margin-inline-start: auto;
  max-width: 420px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.pill-number {
  white-space: nowrap;
}
.topbar .blue {
  background: #eff6ff;
  color: #1e40af;
  border-color: #dbeafe;
}
.topbar .purple {
  background: #faf5ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}
@media (max-width: 1023px) {
  .clinic-layout {
    grid-template-columns: 1fr;
  }
  .clinic-list {
    display: flex;
    overflow: auto;
    gap: 10px;
  }
  .clinic-list .visit-card {
    min-width: 220px;
  }
}
.lab-request-dialog > .form-actions {
  padding: 14px 20px;
  margin: 0;
  background: #f8fafc;
  flex-shrink: 0;
}
.lab-request-dialog > .form-actions[hidden] {
  display: none;
}
.lab-request-dialog .test-category span {
  direction: ltr;
}
.lab-request-dialog #test-count {
  padding-top: 6px;
}
.lab-request-dialog .test-options {
  max-height: 180px;
}
.badge.neutral {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}
.badge.blue {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.profile-heading {
  padding: 4px 0 18px;
  border-bottom: 1px solid #e2e8f0;
}
.profile-heading h2 {
  font-size: 1.4rem;
}
.profile-heading p {
  color: #64748b;
  margin-top: 8px;
}
.profile-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0;
  margin-bottom: 8px;
  white-space: nowrap;
}
.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.profile-fields dt {
  color: #64748b;
  font-size: 0.875rem;
}
.profile-fields dd {
  margin: 4px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#profile-content {
  min-height: 220px;
}
#profile-content .data-table {
  font-size: 0.875rem;
}
#profile-content .data-table td {
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .profile-fields {
    grid-template-columns: 1fr;
  }
}
[data-report-category][hidden] {
  display: none !important;
}
.permission-summary {
  padding: 14px 4px;
  cursor: pointer;
  font-weight: 700;
}
.report-card h2 {
  line-height: 1.7;
}

.clinical-panel {
  padding: 20px;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  margin: 18px 0;
  background: #f8fafc;
}
.clinical-panel h3 {
  margin: 12px 0;
}
.clinical-panel .data-table {
  min-width: 640px;
  table-layout: auto;
}
.clinical-panel .data-table th {
  width: auto !important;
}
.clinical-inline {
  margin-top: 18px;
}
.clinical-inline[hidden] {
  display: none;
}
.sample-label {
  background: white;
  color: black;
  width: 100mm;
  padding: 4mm;
  margin: auto;
  text-align: center;
  border: 1px solid #ddd;
}
.sample-label svg {
  width: 100%;
  height: auto;
}
.sample-label > div {
  font-size: 12px;
}
.sample-label strong,
.sample-label b {
  display: block;
  font-size: 12px;
}
@media print {
  .sample-print .sample-label {
    border: 0;
    margin: 0;
    width: 100mm;
    break-inside: avoid;
  }
  .clinical-panel {
    break-inside: avoid;
  }
}

.verification-qr {
  display: block;
  width: 150px;
  height: 150px;
  margin: 12px 0;
}
.clinical-panel .data-table input {
  width: auto;
}

/* Row actions stay visible; compact labelled records replace wide tables on phones. */
.server-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  padding: 18px;
}
.server-list-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted, #536579);
  font-size: 13px;
}
.server-list-filters label:first-child {
  flex: 1 1 220px;
}
.lab-list .data-table th:last-child,
.lab-list .data-table td:last-child,
.document-list .data-table th:last-child,
.document-list .data-table td:last-child {
  position: sticky;
  inset-inline-end: 0;
  background: #fff;
  z-index: 1;
  box-shadow: 0 0 5px #d5e1e8;
}
.lab-row-actions {
  flex-direction: column;
  align-items: stretch;
  min-width: 130px;
}
.lab-row-actions .btn {
  justify-content: center;
}
@media (max-width: 650px) {
  .lab-list .table-wrap,
  .document-list .table-wrap {
    overflow: visible;
  }
  .lab-list .data-table,
  .lab-list .data-table tbody,
  .document-list .data-table,
  .document-list .data-table tbody {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .lab-list .data-table thead,
  .document-list .data-table thead {
    display: none;
  }
  .lab-list .data-table tr,
  .document-list .data-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 12px;
    margin: 12px;
    border: 1px solid #dbe5ec;
    border-radius: 12px;
    gap: 8px;
  }
  .lab-list .data-table td,
  .document-list .data-table td {
    display: block;
    padding: 6px;
    border: 0;
    white-space: normal;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .lab-list .data-table td:before,
  .document-list .data-table td:before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
  }
  .lab-list .data-table td:last-child,
  .document-list .data-table td:last-child {
    position: static;
    grid-column: 1/-1;
    box-shadow: none;
  }
  .lab-row-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .lab-row-actions .btn {
    flex: 1;
  }
  .workflow-panel .workflow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .workflow-panel .workflow > div {
    padding: 5px;
    min-width: 0;
  }
  .workflow-panel .workflow small {
    display: none;
  }
  .workflow-panel .workflow strong {
    font-size: 11px;
  }
  .workflow-panel .workflow .step {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  .server-list-filters {
    gap: 8px;
    padding: 12px;
  }
  .server-list-filters label {
    flex: 1 1 120px;
    min-width: 0;
  }
  .server-list-filters input,
  .server-list-filters select {
    width: 100%;
    min-width: 0;
  }
  .pagination {
    flex-wrap: wrap;
  }
}

/* External styles keep layout compatible with a strict style-src CSP. */
.space-before {
  margin-top: 16px;
}
.space-before-sm {
  margin-top: 10px;
}
.space-before-lg {
  margin-top: 20px;
}
.push-start {
  margin-inline-start: auto;
}
.account-password-panel {
  max-width: 620px;
}
.category-track {
  display: block;
  width: 100%;
  height: 10px;
  border-radius: 5px;
}
.category-track rect {
  fill: var(--primary, #0e7490);
}
.print-col-38 {
  width: 38%;
}
.print-col-7 {
  width: 7%;
}
.print-col-15 {
  width: 15%;
}
.print-col-12 {
  width: 12%;
}
.print-col-16 {
  width: 16%;
}
.report-col-60 {
  width: 31.57894737%;
}
.report-col-23 {
  width: 12.10526316%;
}
.report-col-19 {
  width: 10%;
}
.report-col-34 {
  width: 17.89473684%;
}
.report-col-28 {
  width: 14.73684211%;
}
.report-col-26 {
  width: 13.68421053%;
}
.report-col-50 {
  width: 26.31578947%;
}
.report-col-31 {
  width: 16.31578947%;
}
.report-col-35 {
  width: 18.42105263%;
}
.report-col-43 {
  width: 22.63157895%;
}

.support-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem;
  padding: 1rem;
  border: 2px solid #b7791f;
  border-radius: 12px;
  background: #fffbeb;
  color: #714316;
  flex-wrap: wrap;
}
.support-banner p {
  margin: 0.3rem 0;
}

.topbar:has(.branch-switch) {
  flex-wrap: wrap;
  height: auto;
  min-height: 64px;
  padding-block: 10px;
}
.branch-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex-shrink: 0;
}
.branch-switch > span {
  white-space: nowrap;
}
.branch-switch select {
  max-width: 15rem;
}
.branch-notice {
  margin: 0.5rem 1rem;
}
.branch-grant {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem;
  border-bottom: 1px solid var(--border, #dbe3ee);
}
.branch-grant input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
}
.branch-grant input[type='datetime-local'] {
  width: auto;
  max-width: 100%;
}
.branch-grant span {
  flex: 1;
  min-width: 8rem;
}
@media (max-width: 767px) {
  .branch-switch {
    width: 100%;
    flex: 0 0 100%;
    order: 10;
  }
  .branch-switch select {
    flex: 1;
    max-width: 100%;
    min-width: 0;
  }
}
