:root {
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #eef2f6;
  --bg-elevated: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(99, 102, 241, 0.35);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.08);
  --topbar-h: 64px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ——— Top bar ——— */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  height: var(--topbar-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-tagline {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-pill {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 999px;
}

/* ——— Login ——— */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-overlay.active {
  display: flex;
}

.login-card {
  width: 100%;
  max-width: 400px;
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  padding: 32px;
}

.login-card h2 {
  margin: 0 0 20px;
  font-size: 1.35rem;
  font-weight: 700;
}

/* ——— Referral modal ——— */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.modal-overlay.is-open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  padding: 0;
  max-height: min(90vh, 640px);
  overflow: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0c1a3a;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--text);
  background: #f1f5f9;
}

.modal-form {
  padding: 18px 22px 22px;
}

.modal-actions {
  margin-top: 8px;
}

.modal-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-weight: 600;
}

.commission-toolbar {
  margin-bottom: 16px;
}

.referrer-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.referrer-input-row input {
  flex: 1;
  min-width: 0;
}

.referrer-input-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .referrer-input-row {
    flex-direction: column;
  }
  .referrer-input-row .salutation-select--referrer {
    max-width: none;
    width: 100%;
  }
  .referrer-input-row .btn {
    width: 100%;
  }
}

/* ——— App layout ——— */
.layout {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 0;
  max-width: 100%;
  margin: 0;
  min-height: calc(100vh - var(--topbar-h));
  align-items: stretch;
}

.content {
  min-width: 0;
  padding: 28px 32px 40px;
}

/* ——— Sidebar ——— */
.nav-panel {
  background: var(--sidebar);
  color: #e2e8f0;
  padding: 20px 14px 28px;
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--sidebar-border);
}

.nav-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-brand-title {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.nav-brand-sub {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  padding: 16px 12px 8px;
}

.nav-section-label:first-of-type {
  padding-top: 4px;
}

.tab-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  color: #cbd5e1;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  background: var(--sidebar-hover);
  color: #f8fafc;
}

.tab-btn.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.tab-btn.nav-sub {
  padding-left: 16px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}

.tab-btn.nav-sub.active {
  color: #fff;
}

/* Investigation accordion */
.nav-accordion {
  margin: 8px 0 12px;
}

.nav-accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-accordion-toggle:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-accordion-icon {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.25s ease;
}

.nav-accordion--collapsed .nav-accordion-icon {
  transform: rotate(-90deg);
}

.nav-accordion-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
  max-height: 320px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
}

.nav-accordion--collapsed .nav-accordion-panel {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  pointer-events: none;
}

/* ——— Content panels ——— */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow);
}

.tab-dashboard.panel,
.tab-dashboard {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tab-content.active {
  min-height: calc(100vh - var(--topbar-h) - 56px);
}

.tab-content > h2:first-child {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hint {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

/* ——— Forms ——— */
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 18px 20px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #cbd5e1;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* ——— Buttons ——— */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.secondary {
  background: #475569;
}

.btn.secondary:hover {
  background: #334155;
}

.btn.success {
  background: var(--success);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.btn.success:hover {
  background: #047857;
}

.btn.danger {
  background: var(--danger);
}

.btn.danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: #f1f5f9;
  color: #475569;
  box-shadow: none;
}

.btn-ghost:hover {
  background: #e2e8f0;
  color: var(--text);
}

.table .btn,
.list .btn {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 600;
}

/* ——— Tables ——— */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  table-layout: fixed;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
}

.table th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: #fafbfc;
}

/* ——— Grid layouts ——— */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.grid-2 > * {
  min-width: 0;
}

.total-box {
  margin: 16px 0;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 16px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  color: #3730a3;
}

/* ——— Lists (saved bills/reports) ——— */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  transition: box-shadow 0.15s ease;
}

.list li:hover {
  box-shadow: var(--shadow);
}

.list li > span:first-child {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.list li > span:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ——— Letter preview ——— */
.letter-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.letterhead {
  border-bottom: 1px solid var(--line);
  padding: 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.letterhead h3 {
  margin: 0;
  font-size: 1.1rem;
}

.letterhead p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.preview-body {
  padding: 16px;
  overflow-x: auto;
}

/* ——— Billed tests ——— */
#billedTestsPanel {
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
}

#billedTestsList {
  max-height: 160px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fafbfc;
}

#billedTestsList label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 14px;
}

/* ——— Dashboard ——— */
.dashboard-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-greeting {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-greeting-icon {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.dashboard-greet-line {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.dashboard-user-line {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.dashboard-period-toggle {
  display: flex;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow);
}

.period-option {
  position: relative;
  cursor: pointer;
}

.period-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.period-option span {
  display: block;
  padding: 9px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
}

.period-option-picked span {
  background: var(--primary-soft);
  color: var(--primary);
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-card-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-card-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card-red {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.stat-card-icon {
  font-size: 2.25rem;
  opacity: 0.95;
}

.stat-card-label {
  margin: 0;
  font-size: 13px;
  opacity: 0.92;
  font-weight: 500;
}

.stat-card-value {
  margin: 6px 0 0;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

button.stat-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  border: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

button.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

button.stat-card:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 3px;
}

/* ——— Sample records (sample management list) ——— */
.tab-samples,
.tab-reports-list,
.tab-reprint {
  padding-bottom: 32px;
}

.reports-list-head h2 {
  margin: 0 0 6px;
}

.reports-list-toolbar {
  margin-bottom: 12px;
}

.reports-adv-panel {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.reports-delivery-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.reports-delivery-label select {
  max-width: 280px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font: inherit;
}

.reports-referral-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}

.btn-inline {
  padding: 6px 12px;
  font-size: 13px;
}

.reports-action-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 128px;
}

.reports-action-stack .btn {
  width: 100%;
  font-size: 12px;
  padding: 8px 10px;
  justify-content: center;
}

.reports-action-stack--row {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  justify-content: center;
  align-items: center;
}

.reports-action-stack--row .btn {
  width: auto;
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.tab-reports-list .reports-table.table {
  table-layout: auto;
  width: max(100%, 1100px);
  min-width: 1100px;
  margin-top: 0;
  border: none;
  border-radius: 0;
}

.tab-reports-list col.reports-col-w-actions {
  width: 158px;
  min-width: 158px;
}
.tab-reports-list col.reports-col-w-sno {
  width: 44px;
  min-width: 40px;
}
.tab-reports-list col.reports-col-w-rid {
  width: 108px;
  min-width: 96px;
}
.tab-reports-list col.reports-col-w-sample {
  width: 120px;
  min-width: 104px;
}
.tab-reports-list col.reports-col-w-patient {
  width: 168px;
  min-width: 148px;
}
.tab-reports-list col.reports-col-w-tests {
  min-width: 200px;
  width: 220px;
}
.tab-reports-list col.reports-col-w-coll {
  width: 132px;
  min-width: 120px;
}
.tab-reports-list col.reports-col-w-rdate {
  width: 132px;
  min-width: 120px;
}
.tab-reports-list col.reports-col-w-status {
  width: 88px;
  min-width: 80px;
}
.tab-reports-list col.reports-col-w-delivery {
  width: 104px;
  min-width: 96px;
}

.tab-reports-list .reports-table th.reports-th-actions,
.tab-reports-list .reports-table td.reports-col-actions {
  text-align: center;
  vertical-align: middle;
}

.tab-reports-list .reports-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e8edf4;
  color: #334155;
  border-bottom: 2px solid #cbd5e1;
  padding: 11px 12px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
}

.tab-reports-list .reports-table tbody td {
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  vertical-align: top;
  border-bottom: 1px solid #e8edf2;
}

.tab-reports-list .reports-table tbody tr:hover td {
  background: #f8fafc;
}

.reports-table tbody tr.report-row-pending {
  background: #fff8fb;
}

.reports-table tbody tr.report-row-pending:hover td {
  background: #fff0f7;
}

.tag-delivered {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: #ecfdf5;
  color: var(--success);
}

.tag-pending {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: #fff7ed;
  color: #c2410c;
}

.samples-page-head h2 {
  margin: 0 0 6px;
}

.samples-page-sub {
  margin: 0 0 18px;
}

.samples-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.samples-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.samples-toolbar-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.samples-period-toggle {
  margin: 0;
}

.samples-pending-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.samples-pending-filter input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.samples-adv-panel {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.samples-table-hint strong {
  color: var(--text);
}

.samples-empty-cell {
  padding: 36px 24px !important;
  text-align: center;
  vertical-align: middle;
  background: #fafafa;
}

.samples-empty-inner {
  max-width: 420px;
  margin: 0 auto;
}

.samples-empty-inner p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.samples-empty-icon {
  font-size: 2.5rem;
  display: block;
  line-height: 1;
}

.samples-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.samples-search-input {
  min-width: 220px;
  max-width: 420px;
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}

.samples-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.samples-sum-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.samples-sum-card strong {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.samples-sum-card .samples-sum-val {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.samples-sum-card--revenue .samples-sum-val {
  color: var(--success);
}

.samples-sum-card--dues .samples-sum-val {
  color: var(--danger);
}

.samples-table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

/* Override global .table { table-layout: fixed } so columns don’t crush & overlap */
.tab-samples .samples-table.table {
  table-layout: auto;
  width: max(100%, 1180px);
  min-width: 1180px;
  margin-top: 0;
  border: none;
  border-radius: 0;
}

.tab-samples .samples-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e8edf4;
  color: #334155;
  border-bottom: 2px solid #cbd5e1;
  padding: 11px 12px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  vertical-align: bottom;
}

.tab-samples .samples-table tbody td {
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  vertical-align: top;
  border-bottom: 1px solid #e8edf2;
}

.tab-samples .samples-table tbody tr:hover td {
  background: #f8fafc;
}

.tab-samples .samples-table th.samples-th-actions,
.tab-samples .samples-table td.samples-col-actions {
  text-align: center;
  vertical-align: middle;
}

.tab-samples .samples-col-w-actions {
  width: 142px;
  min-width: 142px;
}
.tab-samples .samples-col-w-id {
  width: 124px;
  min-width: 124px;
}
.tab-samples .samples-col-w-patient {
  width: 168px;
  min-width: 148px;
}
.tab-samples .samples-col-w-tests {
  min-width: 200px;
  width: 220px;
}
.tab-samples .samples-col-w-num {
  width: 88px;
  min-width: 78px;
}
.tab-samples .samples-col-w-pay {
  width: 118px;
  min-width: 104px;
}
.tab-samples .samples-col-w-ref {
  width: 104px;
  min-width: 92px;
}
.tab-samples .samples-col-w-date {
  width: 100px;
  min-width: 92px;
}

/* ——— Reprint Records (search + saved lists) ——— */
.reprint-page-head h2 {
  margin: 0 0 6px;
}

.reprint-page-sub {
  margin: 0 0 18px;
}

.reprint-search-form {
  margin-bottom: 18px;
}

.reprint-table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.tab-reprint .reprint-search-table.table {
  table-layout: auto;
  width: max(100%, 980px);
  min-width: 980px;
  margin-top: 0;
  border: none;
  border-radius: 0;
}

.tab-reprint .reprint-search-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e8edf4;
  color: #334155;
  border-bottom: 2px solid #cbd5e1;
  padding: 11px 12px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  vertical-align: bottom;
}

.tab-reprint .reprint-search-table tbody td {
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  vertical-align: top;
  border-bottom: 1px solid #e8edf2;
}

.tab-reprint .reprint-search-table tbody tr:hover td {
  background: #f8fafc;
}

.tab-reprint col.reprint-col-w-date {
  width: 104px;
  min-width: 96px;
}
.tab-reprint col.reprint-col-w-pid {
  width: 112px;
  min-width: 100px;
}
.tab-reprint col.reprint-col-w-name {
  width: 160px;
  min-width: 140px;
}
.tab-reprint col.reprint-col-w-phone {
  width: 120px;
  min-width: 108px;
}
.tab-reprint col.reprint-col-w-bill {
  min-width: 168px;
  width: 188px;
}
.tab-reprint col.reprint-col-w-report {
  min-width: 220px;
  width: 240px;
}

.tab-reprint td.reprint-col-actions {
  vertical-align: middle;
}

.reprint-action-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.reprint-action-btns .btn {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.reprint-bill-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.reprint-bill-cell .bill-balance-tag {
  font-size: 12px;
}

.reprint-saved-grid {
  gap: 20px;
  align-items: stretch;
}

.reprint-saved-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px 18px 12px;
  min-width: 0;
}

.reprint-saved-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tab-reprint .reprint-empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px !important;
  font-size: 14px;
}

.samples-table tbody tr.sample-row-dues td {
  background: #fff8fb;
}

.samples-table tbody tr.sample-row-dues:hover td {
  background: #fff0f7;
}

.samples-col-actions {
  white-space: nowrap;
}

.samples-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.samples-action-btns--compact {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.samples-action-btns--compact .btn.sample-act {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
  border-radius: 6px;
}

@media print {
  body.printing-sample-records * {
    visibility: hidden;
  }
  body.printing-sample-records #samplesPrintRoot,
  body.printing-sample-records #samplesPrintRoot * {
    visibility: visible;
  }
  body.printing-sample-records #samplesPrintRoot {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  body.printing-sample-records .samples-table-wrap {
    border: none !important;
  }

  body.printing-reports-records * {
    visibility: hidden;
  }
  body.printing-reports-records #reportsPrintRoot,
  body.printing-reports-records #reportsPrintRoot * {
    visibility: visible;
  }
  body.printing-reports-records #reportsPrintRoot {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  body.printing-reports-records .samples-table-wrap {
    border: none !important;
  }
}

.muted {
  color: var(--text-muted);
  font-size: 12px;
}

.sample-entry-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 26px 28px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.sample-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sample-entry-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.btn.icon-gear {
  background: #f1f5f9;
  color: #475569;
  padding: 10px 14px;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.btn.icon-gear:hover {
  background: #e2e8f0;
  color: var(--text);
}

.dashboard-sample-form .req {
  color: var(--danger);
  font-weight: 700;
}

.dashboard-sample-form .optional {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}

.grid-span-2 {
  grid-column: 1 / -1;
}

.inline-name {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.salutation-select {
  max-width: 140px;
  min-width: 88px;
  flex-shrink: 0;
}

.referrer-input-row .salutation-select--referrer {
  max-width: 132px;
}

.inline-name input {
  flex: 1;
  min-width: 0;
}

.inline-age {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.inline-age input {
  flex: 1;
  min-width: 0;
}

.inline-age select {
  max-width: 112px;
  flex-shrink: 0;
}

.selected-investigations-box {
  margin: 18px 0;
  padding: 16px 18px;
  border: 2px dashed #fecaca;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffbfb 0%, #fff 100%);
}

.selected-investigations-box h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #b91c1c;
}

.dashboard-payment {
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.discount-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.discount-row input[type="number"] {
  flex: 1;
  min-width: 0;
}

.discount-toggle {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line-strong);
}

.toggle-pill {
  border: none;
  background: #f8fafc;
  color: var(--text-muted);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

.toggle-pill.active {
  background: var(--primary);
  color: #fff;
}

.final-amount-display {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--success);
  padding: 14px 16px;
  background: var(--success-soft);
  border-radius: var(--radius-sm);
  border: 1px solid #a7f3d0;
}

.balance-due-display {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--text-muted);
}

.balance-due-display.has-balance {
  color: #b45309;
  background: #fffbeb;
  border-color: #fcd34d;
}

.bill-balance-tag {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  white-space: nowrap;
}

.input-readonly {
  background: #f8fafc;
  color: #475569;
}

.dashboard-submit-row {
  justify-content: flex-end;
  margin-top: 10px;
}

.dashboard-submit-btn {
  padding: 12px 32px;
  font-size: 15px;
}

.dashboard-bill-preview {
  margin-top: 24px;
  padding: 22px 24px;
}

.dashboard-bill-preview-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

/* ——— Create Bill: payment block ——— */
.billing-payment-section {
  margin: 20px 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.billing-payment-heading {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.billing-payment-grid {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 14px 16px;
}

.billing-payment-section .req {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 1000px) {
  .billing-payment-grid {
    grid-template-columns: 1fr;
  }
}

/* ——— Packages ——— */
.package-important {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #1e40af;
}

.package-selected-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0;
  background: #fafbfc;
}

.package-selected-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.price-summary {
  background: #eff6ff;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 12px 0;
  font-weight: 600;
  color: #1e40af;
  border: 1px solid #dbeafe;
}

.saved-packages-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.saved-packages-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
}

/* ——— Lab report print blocks ——— */
.print-header-logo {
  max-height: 70px;
  max-width: 180px;
  margin-bottom: 8px;
}

.print-header-image {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  margin-bottom: 10px;
}

.lab-top-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 12px;
  border-bottom: 1px solid #111;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.lab-top-grid p {
  margin: 2px 0;
  font-size: 13px;
}

.lab-patient-name {
  margin: 0 0 4px;
  font-size: 30px;
}

.lab-mid {
  border-left: 1px solid #111;
  padding-left: 10px;
}

.lab-mid img {
  max-width: 100%;
  height: 42px;
  object-fit: contain;
}

.lab-qr-wrap img {
  width: 96px;
  height: 96px;
}

.lab-title-wrap {
  text-align: center;
  margin: 8px 0;
}

.lab-title-wrap h3 {
  margin: 0;
  letter-spacing: 0.2px;
}

.lab-report-table th,
.lab-report-table td {
  border: 1px solid #7d7d7d;
  padding: 5px 8px;
  font-size: 13px;
}

.lab-report-table {
  min-width: 760px;
}

.lab-report-section {
  margin-top: 18px;
  padding: 14px 16px 18px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.lab-report-section:first-of-type {
  margin-top: 10px;
}

.lab-section-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

.lab-title-wrap--main {
  margin: 12px 0 4px;
}

.lab-main-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lab-sub-main-title {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

/* Multi-investigation report: one screen/print page per test (Cherry-style) */
.lab-report-page {
  position: relative;
}

.lab-page-num {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.lab-report-section--embedded {
  margin-top: 10px;
  padding: 0;
  border: none;
  background: transparent;
}

.lab-esign-slot {
  display: none;
  min-height: calc(56px * var(--lab-esign-scale, 1));
  margin-top: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.report-preview-root.report-opt--show-esign .lab-esign-slot {
  display: block;
}

.report-preview-root.report-opt--no-interpretation .interpretation-block {
  display: none !important;
}

.report-preview-root.report-opt--no-barcode .lab-barcode-block img,
.report-preview-root.report-opt--no-barcode .lab-mid > img:first-of-type {
  visibility: hidden;
}

.report-preview-root.report-opt--no-letterhead .lab-print-header {
  display: none !important;
}

.report-preview-root.report-opt--no-letterhead .lab-report-page > .letterhead {
  display: none !important;
}

.report-preview-root.report-opt--no-result-color .result-high,
.report-preview-root.report-opt--no-result-color .result-low {
  color: inherit !important;
  font-weight: inherit !important;
}

.report-preview-root.report-opt--no-table-border .lab-report-table th,
.report-preview-root.report-opt--no-table-border .lab-report-table td {
  border: none !important;
}

.report-preview-root.report-opt--no-flag .lab-report-table th:nth-child(2),
.report-preview-root.report-opt--no-flag .lab-report-table td:nth-child(2) {
  display: none;
}

.report-preview-root.report-opt--widal .lab-report-table tbody tr:nth-child(even) td {
  background: #f1f5f9;
}

.report-preview-root.report-opt--widal .lab-report-table th,
.report-preview-root.report-opt--widal .lab-report-table td {
  padding: 8px 10px;
}

.lab-report-page--merge {
  padding-left: 14px !important;
  border-left: 4px solid var(--primary);
}

.report-preview-root[data-header-style="compact"] .lab-patient-name {
  font-size: 22px;
}

.report-preview-root[data-header-style="compact"] .lab-top-grid p {
  font-size: 12px;
}

.report-preview-root[data-header-style="compact"] .lab-qr-wrap img {
  width: 80px;
  height: 80px;
}

.report-preview-root[data-header-style="stacked"] .lab-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border-bottom: 1px solid #111;
  padding-bottom: 10px;
}

.report-preview-root[data-header-style="stacked"] .lab-mid {
  border-left: none;
  padding-left: 0;
}

@media screen {
  .preview-body .print-target .lab-report-page {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
  }

  .preview-body .print-target .lab-report-page:last-child {
    margin-bottom: 0;
  }
}

/* Create Report: advanced preview toolbar + column */
.report-preview-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.report-advanced-toolbar {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.report-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.report-toolbar-row--layout {
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.report-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.report-toolbar-field select,
.report-toolbar-field input[type="number"] {
  margin-top: 2px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: #fff;
}

.report-toolbar-field--select {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.report-field-inline-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.report-toolbar-field--select select {
  margin-top: 0;
  min-width: 140px;
}

.report-field-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
}

.report-toolbar-field--range {
  flex: 1 1 180px;
  min-width: 160px;
}

.report-range-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.report-toolbar-field--range input[type="range"] {
  width: 100%;
  margin: 6px 0 4px;
  accent-color: var(--primary);
}

.report-range-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.report-toolbar-toggle--inline {
  flex-direction: row;
  align-items: center;
  margin-bottom: 0;
  padding-top: 18px;
}

.report-toolbar-row--toggles {
  align-items: center;
}

.report-toolbar-row--toggles .report-toolbar-toggle {
  margin-bottom: 0;
}

.kbd-hint {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

.report-preview-column {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
}

.report-preview-pages {
  flex: 1;
  min-width: 0;
}

.report-actions-toolbar {
  flex: 0 0 180px;
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
}

.report-toolbar-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.report-toolbar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

.report-toolbar-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.report-toolbar-hint {
  margin: 10px 0 12px;
  font-size: 11px;
  line-height: 1.35;
}

.report-toolbar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-toolbar-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: 13px;
  padding: 8px 10px;
}

@media (max-width: 960px) {
  .report-preview-column {
    flex-direction: column-reverse;
  }

  .report-actions-toolbar {
    position: static;
    flex: none;
    width: 100%;
  }

  .report-toolbar-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .report-toolbar-actions .btn {
    flex: 1;
    min-width: 120px;
  }

  .report-toolbar-row--layout {
    flex-direction: column;
    align-items: stretch;
  }

  .report-toolbar-field--range {
    flex: none;
  }
}

/* Bill / invoice / lab report PDF capture: force paper-white (no grey gradients or tints) */
#billSummaryPrintArea.pdf-export-root,
#billSummaryPrintArea.pdf-export-root .print-target,
.print-target.pdf-export-root {
  background: #ffffff !important;
  color: #0f172a;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-target.pdf-export-root .letterhead,
.print-target.pdf-export-root .lab-print-header,
.print-target.pdf-export-root .lab-report-page,
.print-target.pdf-export-root .lab-report-section,
.print-target.pdf-export-root .lab-esign-slot,
.print-target.pdf-export-root .interpretation-block {
  background: #ffffff !important;
  background-image: none !important;
}

.print-target.pdf-export-root .lab-report-table th,
.print-target.pdf-export-root .lab-report-table td {
  background: #ffffff !important;
}

.print-target.pdf-export-root.report-opt--widal .lab-report-table tbody tr:nth-child(even) td {
  background: #ffffff !important;
}

.print-target.pdf-export-root .lab-esign-slot {
  border-color: #cbd5e1 !important;
}

.result-high {
  color: var(--danger);
  font-weight: 700;
}

.result-low {
  color: #2563eb;
  font-weight: 700;
}

.interpretation-block {
  margin-top: 8px;
  font-size: 13px;
}

.interpretation-block ul {
  margin: 6px 0 0 16px;
  padding: 0;
}

.end-report {
  text-align: center;
  font-size: 13px;
}

/* ——— Bill summary (post–sample entry) ——— */
.tab-bill-summary {
  padding-bottom: 32px;
}

.bill-summary-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.bill-summary-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.bill-summary-letter {
  margin-bottom: 24px;
  max-width: 720px;
}

/* Report editor: auto-calculated results (Cherry-style pencil badge) */
.report-result-td {
  vertical-align: middle;
}

.report-result-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.report-result-input {
  flex: 1;
  min-width: 0;
}

.report-auto-calc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
}

.report-auto-calc-icon svg {
  display: block;
}

.bill-summary-letter .preview-body,
#billSummaryPrintArea {
  background: #ffffff;
  color: #0f172a;
}

.bill-summary-actions {
  margin-top: 20px;
  max-width: 920px;
}

.bill-summary-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.bill-summary-actions-row--second .bill-act-enter {
  flex: 1;
  min-width: 240px;
}

.badge-beta {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f97316;
  color: #fff;
  vertical-align: middle;
}

.bill-act {
  border: none;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.bill-act-print {
  background: #2563eb;
  color: #fff;
}
.bill-act-print:hover {
  background: #1d4ed8;
}

.bill-act-thermal {
  background: #475569;
  color: #fff;
}
.bill-act-thermal:hover {
  background: #334155;
}

.bill-act-pdf {
  background: #ea580c;
  color: #fff;
}
.bill-act-pdf:hover {
  background: #c2410c;
}

.bill-act-sms {
  background: #7dd3fc;
  color: #0c4a6e;
}

.bill-act-share {
  background: #22c55e;
  color: #fff;
}

.bill-act-share-auto {
  background: #14b8a6;
  color: #fff;
}

.bill-act-enter {
  background: #0f172a;
  color: #fff;
  padding: 14px 20px;
}

/* ——— Print ——— */
@media print {
  body * {
    visibility: hidden;
  }
  .print-target,
  .print-target * {
    visibility: visible;
  }
  .print-target {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
  }
  .print-target .lab-report-page {
    page-break-after: always;
    break-after: page;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .print-target .lab-report-page:last-of-type {
    page-break-after: auto;
    break-after: auto;
  }
  .print-target .letterhead,
  .print-target .lab-print-header,
  .print-target .lab-report-page,
  .print-target .lab-esign-slot,
  .print-target .lab-report-table th,
  .print-target .lab-report-table td {
    background: #ffffff !important;
    background-image: none !important;
  }
  .print-target.report-opt--widal .lab-report-table tbody tr:nth-child(even) td {
    background: #ffffff !important;
  }
  html.thermal-print-mode .print-target {
    max-width: 80mm !important;
    margin-left: auto !important;
    margin-right: auto !important;
    font-size: 11px !important;
  }
}

/* ——— Responsive ——— */
@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .nav-panel {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    border-radius: 0;
  }

  .content {
    padding: 20px 16px 32px;
  }

  .grid-2,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .table {
    table-layout: auto;
  }

  .lab-report-table {
    min-width: 640px;
  }

  .tab-content.active {
    min-height: auto;
  }
}
