:root {
  --tblr-primary: #0f766e;
  --tblr-primary-rgb: 15, 118, 110;
  --billing-touch-target: 44px;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

.skip-link {
  position: fixed;
  z-index: 1100;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: var(--tblr-border-radius);
  color: var(--tblr-body-color);
  background: var(--tblr-bg-surface);
  box-shadow: var(--tblr-box-shadow);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-sidebar .navbar-brand a {
  display: flex;
  min-width: 0;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.sidebar-brand-logo {
  display: block;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  object-fit: contain;
}

.sidebar-brand-name {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.auth-brand-logo {
  display: block;
  width: 5rem;
  height: 5rem;
  margin-inline: auto;
  object-fit: contain;
}

.daily-cash-date-form {
  max-width: 14rem;
}

.daily-cash-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .75rem;
}

.daily-cash-summary .card-body {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
}

.daily-cash-summary .summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  border-radius: var(--tblr-border-radius);
  color: var(--tblr-teal);
  background: rgba(var(--tblr-teal-rgb), .12);
  font-size: 1.2rem;
}

.daily-cash-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1rem;
  align-items: start;
}

.daily-cash-comparison-card,
.daily-cash-side,
.daily-cash-side > .card {
  min-width: 0;
}

.daily-cash-side {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.daily-cash-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.daily-cash-comparison {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.daily-cash-comparison th,
.daily-cash-comparison td {
  text-align: center;
  vertical-align: middle;
}

.daily-cash-comparison .denomination-column {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 7rem;
  min-width: 7rem;
  text-align: start;
  background: var(--tblr-bg-surface);
}

.daily-cash-comparison .opening-column {
  position: sticky;
  left: 7rem;
  z-index: 2;
  width: 10rem;
  min-width: 10rem;
  background: var(--tblr-bg-surface);
  box-shadow: 1px 0 0 var(--tblr-border-color);
}

.daily-cash-comparison thead .denomination-column,
.daily-cash-comparison thead .opening-column {
  z-index: 5;
  background: var(--tblr-bg-surface-secondary);
}

.daily-cash-comparison tfoot .denomination-column,
.daily-cash-comparison tfoot .opening-column,
.daily-cash-comparison tfoot td {
  background: rgba(var(--tblr-teal-rgb), .08);
}

.daily-cash-comparison .handover-column {
  width: 10rem;
  min-width: 10rem;
}

.daily-cash-comparison .draft-column {
  background: rgba(var(--tblr-teal-rgb), .06);
}

.cash-column-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .2rem;
  min-height: 4.75rem;
  white-space: normal;
}

.cash-column-heading small {
  color: var(--tblr-secondary-color);
  font-weight: 400;
}

.cash-column-button {
  width: 100%;
  padding: .25rem;
  border: 0;
  border-radius: var(--tblr-border-radius-sm);
  color: inherit;
  background: transparent;
  text-align: start;
}

.cash-column-button:hover,
.cash-column-button:focus-visible,
.cash-column-button.active {
  background: rgba(var(--tblr-teal-rgb), .12);
}

.cash-count-input {
  min-width: 5.5rem;
  text-align: center;
}

.cash-equation {
  display: flex;
  align-items: stretch;
  gap: .35rem;
}

.cash-equation > div {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  flex-direction: column;
  justify-content: center;
  padding: .5rem;
  border: 1px solid var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface-secondary);
  text-align: center;
}

.cash-equation > b {
  align-self: center;
}

.cash-equation span,
.cash-result-grid span:first-child {
  color: var(--tblr-secondary-color);
  font-size: .75rem;
}

.cash-equation .expected {
  color: var(--tblr-teal);
  background: rgba(var(--tblr-teal-rgb), .1);
}

.cash-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
}

.cash-result-grid > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: .2rem;
  padding: .65rem;
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface-secondary);
}

.cash-expense-list {
  max-height: 16rem;
  overflow-y: auto;
}

@media (max-width: 991.98px) {
  .daily-cash-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .daily-cash-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-cash-comparison-card {
    overflow: hidden;
  }
}

@media (max-width: 374.98px) {
  .daily-cash-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .cash-equation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .cash-equation > div:last-child {
    grid-column: 1 / -1;
  }
}

.app-sidebar .nav-link,
.app-sidebar .navbar-toggler,
.dropdown-item,
.btn:not(.btn-sm) {
  min-height: var(--billing-touch-target);
}

.app-sidebar .nav-link.disabled {
  cursor: default;
}

.app-sidebar .navbar-collapse {
  overscroll-behavior: contain;
}

.page-title,
.text-break-safe,
.alert,
.empty-title,
.empty-subtitle,
.datagrid-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.page-actions {
  flex-wrap: wrap;
}

.form-control,
.form-select {
  min-height: var(--billing-touch-target);
}

.validation-summary-valid,
.field-validation-valid:empty {
  display: none;
}

.modal-dialog-scrollable .modal-content > form {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.modal-dialog-scrollable .modal-content > form > .modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-dialog-scrollable .modal-content > form > .modal-header,
.modal-dialog-scrollable .modal-content > form > .modal-footer {
  flex: 0 0 auto;
}

.validation-summary ul {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.table-responsive {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.table-responsive:focus-visible {
  outline: var(--tblr-focus-ring-width) solid var(--tblr-focus-ring-color);
  outline-offset: calc(-1 * var(--tblr-focus-ring-width));
}

.modal-dialog-scrollable .modal-content {
  max-height: calc(100dvh - 2rem);
}

@media (max-width: 575.98px) {
  .modal-dialog-scrollable {
    height: calc(100dvh - 1rem);
    min-height: 0;
    margin: 0.5rem;
  }

  .modal-dialog-scrollable .modal-content {
    max-height: calc(100dvh - 1rem);
  }

  .modal-dialog-scrollable .modal-footer {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

.auth-page {
  min-height: 100dvh;
}

.auth-page h1,
.auth-page .card-footer {
  white-space: normal;
  overflow-wrap: anywhere;
}

.password-toggle {
  min-width: var(--billing-touch-target);
  justify-content: center;
}

.pin-input {
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}

.user-mobile-item + .user-mobile-item {
  border-top: var(--tblr-border-width) solid var(--tblr-border-color);
}

.users-search-actions {
  display: flex;
  gap: 0.5rem;
}

.settings-table {
  table-layout: fixed;
  width: 100%;
}

.settings-table th:first-child,
.settings-table td:first-child {
  width: min(32%, 24rem);
}

.settings-table th:last-child,
.settings-table td:last-child {
  width: 8rem;
  min-width: 8rem;
  padding-inline: 0.5rem;
}

.settings-table td:last-child .btn-list {
  justify-content: flex-end;
  gap: 0.25rem;
}

.settings-key,
.settings-value,
.settings-value-text {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.settings-value-text {
  white-space: pre-wrap;
}

.settings-value-toggle {
  min-height: var(--billing-touch-target);
  padding-inline: 0.5rem;
  vertical-align: baseline;
}

.settings-mobile-item + .settings-mobile-item {
  border-top: var(--tblr-border-width) solid var(--tblr-border-color);
}

.settings-search-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 1.75rem;
}

.settings-value-editor {
  min-height: 14rem;
  resize: vertical;
  white-space: pre-wrap;
}

.settings-pagination {
  max-width: 100%;
}

.settings-pagination .pagination {
  flex-wrap: wrap;
}

.settings-pagination .page-link {
  display: inline-flex;
  min-width: var(--billing-touch-target);
  min-height: var(--billing-touch-target);
  align-items: center;
  justify-content: center;
}

@media (max-width: 991.98px) {
  .app-sidebar .navbar-collapse {
    max-height: calc(100dvh - 4.5rem);
    overflow-y: auto;
  }
}

/* Sales checkout workspace */
.sales-workspace { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,2fr); gap:.75rem; align-items:stretch; min-width:0; }
.sales-workspace > * { min-width:0; }
.sales-card { min-width:0; min-height:22rem; height:100%; }
.sales-card > .card-header { min-height:3.5rem; padding:.75rem .9rem; }
.sales-card .card-title { margin:0; font-size:1rem; }
.sales-medicine-list-body { display:flex; flex-direction:column; min-width:0; }
.sales-medicine-list { min-width:0; }
.sales-medicine { display:grid; width:100%; min-height:2.75rem; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:.5rem; border:0; border-radius:var(--tblr-border-radius); padding:.55rem .65rem; background:transparent; color:var(--tblr-body-color); text-align:left; overflow-wrap:anywhere; }
.sales-medicine-name { min-width:0; overflow-wrap:anywhere; }
.sales-medicine.is-out-of-stock .sales-medicine-name { color:var(--tblr-secondary); }
.sales-medicine.is-out-of-stock.is-selected .sales-medicine-name { color:var(--tblr-body-color); }
.sales-medicine-indicators { display:flex; max-width:100%; min-width:0; align-items:flex-start; justify-content:flex-end; flex-wrap:wrap; gap:.3rem; }
.sales-stock-badge { display:inline-flex; align-items:center; gap:.25rem; white-space:nowrap; font-weight:500; }
.sales-icon-badge { min-width:1.6rem; justify-content:center; padding-inline:.35rem; font-size:.85rem; }
.sales-stock-empty { color:var(--tblr-secondary); background:var(--tblr-bg-surface-secondary); }
.sales-stock-low { color:var(--tblr-yellow); background:var(--tblr-yellow-lt); }
.sales-stock-available { color:var(--tblr-teal); background:var(--tblr-teal-lt); }
.sales-medicine:hover { background:var(--tblr-bg-surface-secondary); }
.sales-medicine:focus-visible { outline:2px solid var(--tblr-primary); outline-offset:1px; }
.sales-medicine.is-selected { background:var(--tblr-primary-lt); box-shadow:inset 3px 0 var(--tblr-primary); font-weight:600; }
.sales-medicine.has-expiry-warning { background:color-mix(in srgb,var(--medicine-expiry-color,#dc2626) 7%,var(--tblr-bg-surface)); }
.sales-medicine.has-expiry-warning.is-selected { box-shadow:inset 3px 0 var(--tblr-primary),inset 0 0 0 1px color-mix(in srgb,var(--medicine-expiry-color,#dc2626) 45%,transparent); }
.sales-expiry-badge { display:inline-flex; align-items:center; gap:.25rem; color:var(--medicine-expiry-color,#dc2626); background:color-mix(in srgb,var(--medicine-expiry-color,#dc2626) 12%,var(--tblr-bg-surface)); white-space:normal; }
.sales-medicine-pager { display:flex; justify-content:space-between; align-items:center; gap:.5rem; margin-top:auto; padding-top:.75rem; }
.sales-batch-scroll,.sales-cart-table-wrap { min-width:0; overflow-x:auto; }
.sales-batch-table,.sales-cart-table { margin:0; table-layout:fixed; }
.sales-batch-table th,.sales-batch-table td { padding:.55rem .5rem; vertical-align:middle; }
.sales-batch-table th { font-size:.7rem; white-space:nowrap; }
.sales-batch-table th:nth-child(1) { width:25%; }
.sales-batch-table th:nth-child(2) { width:31%; }
.sales-batch-table th:nth-child(3) { width:20%; }
.sales-batch-table th:nth-child(4) { width:24%; }
.sales-batch-row { cursor:pointer; }
.sales-batch-row:hover { background:var(--tblr-bg-surface-secondary); }
.sales-batch-row[role="row"] { cursor:not-allowed; }
.sales-batch-row:focus-visible { outline:2px solid var(--tblr-primary); outline-offset:-2px; }
.sales-batch-quantity { min-width:3.25rem; max-width:5.5rem; padding:.25rem 1.35rem .25rem .4rem; }
.sales-batch-quantity-cell { text-align:center; }
.medicine-expiry-warning { --medicine-expiry-color:#dc2626; background:color-mix(in srgb,var(--medicine-expiry-color) 9%,var(--tblr-bg-surface)); border-inline-start:3px solid var(--medicine-expiry-color); }
.medicine-expiry-warning.is-near-expiry { animation:expiry-pulse 3s ease-in-out infinite; }
.medicine-expiry-warning.is-expired { animation:none; }
.medicine-expiry-badge { color:var(--medicine-expiry-color,#dc2626); background:color-mix(in srgb,var(--medicine-expiry-color,#dc2626) 12%,var(--tblr-bg-surface)); }
@keyframes expiry-pulse { 50% { box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--medicine-expiry-color,#dc2626) 26%,transparent); } }
.sales-cart-table th,.sales-cart-table td { padding:.42rem .45rem; vertical-align:middle; }
.sales-cart-table th { white-space:nowrap; font-size:.7rem; }
.sales-cart-table th:nth-child(1) { width:5%; }
.sales-cart-table th:nth-child(2) { width:39%; }
.sales-cart-table th:nth-child(3) { width:12%; }
.sales-cart-table th:nth-child(4),.sales-cart-table th:nth-child(5) { width:15%; }
.sales-cart-table th:nth-child(6) { width:5%; }
.sales-cart-medicine { overflow-wrap:anywhere; }
.sales-cart-quantity { width:4.25rem; min-width:3.5rem; padding:.25rem .35rem; text-align:center; }
.sales-cart-line-invalid { background:color-mix(in srgb,var(--tblr-danger) 7%,var(--tblr-bg-surface)); }
.sales-cart-footer { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.75rem; }
.checkout-summary-row { display:flex; align-items:center; justify-content:space-between; gap:.6rem; padding:.35rem 0; }
.checkout-discount { width:7rem; text-align:right; }
.checkout-total-row { display:flex; justify-content:space-between; gap:.5rem; margin-top:.6rem; padding:.55rem; border-radius:var(--tblr-border-radius); background:var(--tblr-teal-lt); font-size:1.05rem; }
.payment-balance { padding:.5rem .65rem; border-radius:var(--tblr-border-radius); background:var(--tblr-bg-surface-secondary); }
.payment-balance.is-balanced { color:var(--tblr-success); background:var(--tblr-success-lt); }
.sales-mobile-steps { display:none; }
.sales-mobile-total { display:none; }
@media (max-width: 991.98px) {
  .sales-workspace { grid-template-columns:minmax(0,1fr); gap:.75rem; }
  .sales-card { min-height:0; height:auto; }
  .sales-mobile-steps { position:sticky; top:0; z-index:10; display:flex; justify-content:space-around; gap:.25rem; padding:.45rem; background:var(--tblr-bg-surface); border:1px solid var(--tblr-border-color); border-radius:var(--tblr-border-radius); }
  .sales-mobile-steps a { min-height:2.75rem; display:flex; align-items:center; justify-content:center; padding:.4rem .55rem; color:var(--tblr-body-color); text-decoration:none; }
  .sales-mobile-total { position:sticky; bottom:0; z-index:20; display:flex; justify-content:space-between; align-items:center; gap:.75rem; padding:.65rem .85rem; margin:.75rem -.5rem 0; background:var(--tblr-bg-surface); border:1px solid var(--tblr-border-color); box-shadow:0 -4px 14px rgb(0 0 0 / 8%); }
  .sales-workspace section { scroll-margin-top:4rem; }
}
@media (max-width: 575.98px) {
  .sales-medicine { grid-template-columns:minmax(0,1fr) auto; }
  .sales-medicine-indicators { justify-content:flex-end; }
  .sales-cart-table { min-width:34rem; }
  .sales-batch-table { min-width:20rem; }
  #checkout-modal .modal-dialog { margin:.35rem; min-height:calc(100% - .7rem); }
  #checkout-modal .modal-content { max-height:calc(100dvh - .7rem); }
  #checkout-modal .modal-footer { position:sticky; bottom:0; z-index:2; background:var(--tblr-bg-surface); }
}
@media (prefers-reduced-motion: reduce) { .medicine-expiry-warning,.medicine-expiry-warning.is-near-expiry { animation:none; } }

@media (max-width: 575.98px) {
  .row > *,
  .card {
    min-width: 0;
  }

  .page-header .page-actions,
  .page-header .page-actions .btn {
    width: 100%;
  }

  .page-header .page-actions .btn {
    justify-content: center;
  }

  .card-body,
  .card-header,
  .card-footer {
    min-width: 0;
  }

  .settings-search-actions,
  .settings-search-actions .btn,
  .users-search-actions,
  .users-search-actions .btn {
    width: 100%;
  }

  .settings-search-actions {
    padding-top: 0;
  }

  .settings-search-actions .btn {
    justify-content: center;
  }

  .users-search-actions .btn {
    justify-content: center;
  }

  .settings-value-editor {
    min-height: 50dvh;
  }
}

@media (min-width: 768px) {
  .settings-pagination {
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* Inline searchable company selector used by the medicine modal. */
.company-combobox-menu {
    max-height: min(18rem, 45vh);
    overflow-y: auto;
}

.vendor-qr-preview { display: block; width: 5rem; height: 5rem; object-fit: contain; border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius); background: var(--tblr-bg-surface); }

.medicine-workspace { display: grid; grid-template-columns: minmax(0,1fr); gap: .75rem; transition: grid-template-columns .2s ease; }
.medicine-workspace.has-selection { grid-template-columns: minmax(0,3fr) minmax(0,2fr); }
.medicine-list-table { table-layout: fixed; }
.medicine-col-name { width: 60%; }
.medicine-col-company { width: 23%; }
.medicine-col-stock { width: 11%; }
.medicine-col-actions { width: 6%; }
.medicine-usage-clamp { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.medicine-usage-wrap { position: relative; }
.medicine-usage-clamp { position: relative; padding-right: 3rem; }
.medicine-more-link { position: absolute; right: 0; bottom: 0; padding: 0; border: 0; background: transparent; color: var(--tblr-primary); font: inherit; font-weight: 600; text-decoration: underline; }
.medicine-usage-wrap.is-expanded .medicine-usage-clamp { display: block; padding-right: 0; overflow: visible; }
.medicine-usage-wrap.is-expanded .medicine-more-link { position: static; display: inline; margin-inline-start: .25rem; }
.medicine-batch-panel:empty { display: none; }
.medicine-select-row { cursor: pointer; }
.medicine-select-row:focus-visible { outline: var(--tblr-focus-ring-width) solid var(--tblr-focus-ring-color); outline-offset: -2px; }
.medicine-select-row.active { background: var(--tblr-primary-lt); }
.medicine-expiry-warning { background: color-mix(in srgb, #dc2626 9%, var(--tblr-bg-surface)); border-inline-start: 3px solid #dc2626; animation: expiry-pulse 3s ease-in-out infinite; }
@keyframes expiry-pulse { 50% { box-shadow: inset 0 0 0 1px color-mix(in srgb, #dc2626 20%, transparent); } }
@media (max-width: 767.98px) { .medicine-workspace.has-selection { grid-template-columns: minmax(0,1fr); } .medicine-workspace.has-selection .medicine-list-card { display:none; } }
@media (max-width: 575.98px) {
  .medicine-list-card .table-responsive { overflow-x: hidden; }
  .medicine-list-table { display:block; table-layout:auto; width:100%; }
  .medicine-list-table thead { display:none; }
  .medicine-list-table tbody { display:block; width:100%; }
  .medicine-list-table tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"medicine actions" "company stock"; gap:.25rem .75rem; position:relative; padding:.75rem; border-bottom:var(--tblr-border-width) solid var(--tblr-border-color); }
  .medicine-list-table tbody td { display:block; min-width:0; padding:.25rem; border:0; }
  .medicine-list-table tbody td:nth-child(1) { grid-area:medicine; padding-right:.25rem; }
  .medicine-list-table tbody td:nth-child(2) { grid-area:company; color:var(--tblr-secondary); }
  .medicine-list-table tbody td:nth-child(3) { grid-area:stock; text-align:right; }
  .medicine-list-table tbody td:nth-child(4) { grid-area:actions; }
  .medicine-list-table tbody td:nth-child(4) .dropdown { position:absolute; top:.5rem; right:.5rem; }
  .medicine-list-table tbody td:nth-child(2)::before { content:"Company: "; font-weight:600; color:var(--tblr-body-color); }
  .medicine-list-table tbody td:nth-child(3)::before { content:"Stock: "; font-weight:600; color:var(--tblr-body-color); }
}
@media (prefers-reduced-motion: reduce) { .medicine-workspace,.medicine-expiry-warning { transition:none; animation:none; } }
@media (max-width: 991.98px) {
  .sales-mobile-cart { position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .65rem .85rem; margin: .75rem -.5rem 0; background: var(--tblr-bg-surface); border: 1px solid var(--tblr-border-color); box-shadow: 0 -4px 14px rgb(0 0 0 / 8%); }
  #sales-workspace section { scroll-margin-top: 1rem; }
}
