/* ============================================
   ELINOM HEALTHCARE MANAGEMENT SYSTEM
   Clean & Clinical Theme
   ============================================ */

/* CSS Variables */
:root {
  --hc-primary: #0ea5e9;      /* Sky 500 - Trust/Medical */
  --hc-primary-light: #38bdf8; /* Sky 400 */
  --hc-primary-dark: #0284c7;  /* Sky 600 */
  --hc-accent: #f43f5e;       /* Rose 500 - Emergency/Alert */
  --hc-success: #10b981;      /* Emerald 500 */
  --hc-warning: #f59e0b;      /* Amber 500 */
  --hc-danger: #ef4444;       /* Red 500 */
  --hc-info: #6366f1;         /* Indigo 500 */
  --hc-bg: #f0f9ff;           /* Sky 50 */
  --hc-card-bg: #fff;
  --hc-text: #0f172a;         /* Slate 900 */
  --hc-text-muted: #64748b;   /* Slate 500 */
  --hc-border: #e0f2fe;       /* Sky 100 */
  --hc-sidebar-width: 260px;
  --hc-sidebar-collapsed: 70px;
  --hc-shadow-sm: 0 1px 2px 0 rgb(14 165 233 / 0.05);
  --hc-shadow: 0 4px 6px -1px rgb(14 165 233 / 0.1), 0 2px 4px -2px rgb(14 165 233 / 0.1);
  --hc-radius: 12px;
  --hc-radius-sm: 6px;
  --hc-transition: all 0.2s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--hc-bg);
  color: var(--hc-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Embedded View Mode */
body.embedded-view .sidebar,
body.embedded-view .security-bar,
body.embedded-view .system-controls {
  display: none !important;
}

body.embedded-view .app-container {
  min-height: 100vh;
}

body.embedded-view .main-content {
  padding: 24px;
}

/* App Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--hc-sidebar-width);
  background: white;
  border-right: 1px solid var(--hc-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--hc-border);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--hc-primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--hc-text);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--hc-text-muted);
  text-decoration: none;
  border-radius: var(--hc-radius-sm);
  transition: var(--hc-transition);
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-link:hover {
  background: #e0f2fe;
  color: var(--hc-primary-dark);
}

.nav-link.active {
  background: var(--hc-primary);
  color: white;
  box-shadow: var(--hc-shadow-sm);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hc-border);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--hc-text);
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--hc-radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--hc-transition);
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--hc-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--hc-primary-dark);
}

.btn-danger {
    background: var(--hc-accent);
    color: white;
}

.btn-outline {
  background: white;
  border: 1px solid #cbd5e1;
  color: var(--hc-text);
}

.btn-outline:hover {
  border-color: var(--hc-primary);
  color: var(--hc-primary);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: var(--hc-radius);
  box-shadow: var(--hc-shadow-sm);
  border: 1px solid var(--hc-border);
  display: flex;
  flex-direction: column;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0f2fe;
  color: var(--hc-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--hc-text);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--hc-text-muted);
}

/* Content Cards & Tables */
.card {
  background: white;
  border-radius: var(--hc-radius);
  box-shadow: var(--hc-shadow-sm);
  border: 1px solid var(--hc-border);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hc-border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: 20px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--hc-border);
  font-size: 0.875rem;
}

th {
  background: #f8fafc;
  color: var(--hc-text-muted);
  font-weight: 600;
}

/* Status Badges */
.status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-checkup { background: #e0f2fe; color: #0369a1; }
.status-emergency { background: #fee2e2; color: #991b1b; }
.status-success { background: #dcfce7; color: #166534; }
.status-warning { background: #fef3c7; color: #92400e; }

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (width <= 1024px) {
    .grid-2 { grid-template-columns: 1fr; }

    .sidebar {
      width: 68px;
      min-width: 68px;
      overflow: hidden;
    }

    .sidebar .nav-text,
    .sidebar .sidebar-label { display: none; }
    .sidebar .nav-link { justify-content: center; padding: 12px 0; }
    .sidebar .nav-link i { margin-right: 0; }
    .main-content { margin-left: 68px; }
}

@media (width <= 900px) {
    .sidebar {
      position: fixed;
      left: -280px;
      top: 0;
      width: 260px;
      min-width: 260px;
      height: 100vh;
      z-index: 9999;
      transition: left 0.3s ease;
      box-shadow: 4px 0 24px rgb(0,0,0,0.3);
      overflow-y: auto;
    }
    .sidebar.mobile-open { left: 0; }

    .sidebar.mobile-open .nav-text,
    .sidebar.mobile-open .sidebar-label { display: initial; }
    .sidebar.mobile-open .nav-link { justify-content: flex-start; padding: 12px 20px; }
    .sidebar.mobile-open .nav-link i { margin-right: 12px; }
    .main-content { margin-left: 0; padding: 16px; width: 100%; }
    .header-area { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (width <= 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .patient-grid { grid-template-columns: 1fr; }
    .appointment-grid { grid-template-columns: 1fr; }
}

@media (width <= 600px) {
    .main-content { padding: 12px; }
}

@media (width <= 480px) {
    .stats-grid { gap: 8px; }
}

/* ── Wards & Beds table (template-style list) ─────────────────────────────── */
.ward-table-card {
  overflow: visible;
}

.ward-table-card > .card-body.ward-table-wrap,
.ward-table-wrap.table-responsive {
  overflow: visible !important;
}

.ward-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.ward-toolbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
}

.ward-table-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.ward-section-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 16px;
}

.ward-search-wrap {
  flex: 0 1 220px;
  max-width: 260px;
}

.ward-search-input {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  height: 36px;
}

.ward-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ward-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f766e !important;
  border-color: #0f766e !important;
  border-radius: 6px;
  font-weight: 600;
  padding: 8px 14px;
}

.ward-primary-btn:hover {
  background: #0d9488 !important;
  border-color: #0d9488 !important;
}

.ward-refresh-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #111827;
}

.ward-refresh-btn:hover {
  background: #f3f4f6;
}

.ward-refresh-btn.is-spinning i {
  animation: ward-spin 0.7s linear;
}

@keyframes ward-spin {
  to { transform: rotate(360deg); }
}

.ward-table-wrap {
  background: #fff;
}

.ward-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.ward-table thead th {
  background: #fff;
  color: #374151;
  font-weight: 700;
  font-size: 0.8125rem;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 14px;
  white-space: nowrap;
}

.ward-table tbody td {
  border-bottom: 1px solid #f3f4f6;
  padding: 12px 14px;
  vertical-align: middle;
  font-size: 0.875rem;
  color: #111827;
  background: #fff;
}

.ward-table tbody tr:hover td {
  background: #fafafa;
}

.ward-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}

.ward-status-pill.is-active {
  background: #16a34a;
  color: #fff;
}

.ward-status-pill.is-deactivated {
  background: #9ca3af;
  color: #fff;
}

.ward-status-pill.is-admitted {
  background: #0f766e;
  color: #fff;
}

.ward-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.ward-actions-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ward-actions-btn:hover,
.ward-actions-btn[aria-expanded="true"] {
  background: #f3f4f6;
  color: #111827;
}

.ward-actions-menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgb(15 23 42 / 0.12);
  padding: 6px 0;
  z-index: 1080;
  display: none;
}

.ward-actions-menu.open {
  display: block;
}

.ward-actions-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 0.875rem;
  color: #111827;
  text-align: left;
  cursor: pointer;
}

.ward-actions-menu button.is-danger,
.ward-actions-menu button.is-danger i {
  color: #dc2626;
}

.ward-actions-menu button i {
  width: 16px;
  color: #6b7280;
  text-align: center;
}

.ward-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.ward-pagination-left,
.ward-pagination-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ward-goto-label,
.ward-page-info {
  font-size: 0.8125rem;
  color: #4b5563;
}

.ward-goto-input {
  width: 52px;
  text-align: center;
}

.ward-page-size {
  width: auto;
  min-width: 64px;
}

.ward-page-btn,
.ward-page-num {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 4px;
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  font-size: 0.8125rem;
}

.ward-page-num.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.ward-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ward-page-numbers {
  display: inline-flex;
  gap: 4px;
}

.ward-empty {
  text-align: center;
  color: #6b7280;
  padding: 28px 14px !important;
}

.patient-view-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: linear-gradient(135deg, #faf7f4 0%, #f3ebe3 100%);
}

.patient-view-avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #8b5a2b;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.patient-view-meta {
  min-width: 0;
}

.patient-view-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
}

.patient-view-id {
  margin-top: 4px;
  font-size: 0.875rem;
  color: #4b5563;
}

.patient-view-label {
  font-weight: 600;
  color: #6b7280;
}

.patient-view-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin: 0;
}

.patient-view-details dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 0 0 2px;
}

.patient-view-details dd {
  margin: 0;
  font-size: 0.95rem;
  color: #111827;
  font-weight: 500;
}

.patient-view-details .patient-view-notes {
  grid-column: 1 / -1;
}

.invoice-items-scroll {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.invoice-items-scroll .table {
  margin-bottom: 0;
}

.invoice-item-del {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: #dc2626;
  color: #fff;
  line-height: 1;
}

.invoice-item-del:hover,
.invoice-item-del:focus {
  background: #b91c1c;
  color: #fff;
}

.invoice-item-del i {
  font-size: 0.85rem;
}

.invoice-items-validator {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.invoice-detail-view {
  color: #111827;
}

.invoice-detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.invoice-detail-meta .label {
  color: #6b7280;
  display: block;
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.invoice-detail-meta .value {
  font-weight: 600;
}

.invoice-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.invoice-detail-table th,
.invoice-detail-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
}

.invoice-detail-table th {
  background: #f9fafb;
  font-weight: 600;
  text-align: left;
}

.invoice-detail-table .num {
  text-align: right;
  white-space: nowrap;
}

.invoice-detail-totals {
  margin-left: auto;
  max-width: 260px;
}

.invoice-detail-totals .row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  font-size: 0.95rem;
}

.invoice-detail-totals .row.strong {
  font-weight: 700;
  border-top: 1px solid #e5e7eb;
  margin-top: 4px;
  padding-top: 8px;
}

.invoice-detail-notes {
  margin-top: 14px;
  font-size: 0.9rem;
  color: #374151;
}

@media (width <= 768px) {
  .invoice-detail-meta {
    grid-template-columns: 1fr;
  }
}

.official-invoice {
  background: #fff;
  color: #111;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 860px;
  margin: 0 auto;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.official-invoice-header {
  text-align: center;
  margin-bottom: 8px;
}

.official-invoice-clinic {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.official-invoice-meta-line {
  font-size: 0.9rem;
  color: #374151;
}

.official-invoice-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  margin: 14px 0 10px;
  text-transform: uppercase;
}

.official-invoice-rule {
  border: 0;
  border-top: 1px solid #111;
  margin: 0 0 12px;
}

.official-invoice-details {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px 18px;
  padding: 4px 0 12px;
  border-bottom: 1px solid #111;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.official-invoice-details .label {
  color: #374151;
}

.official-invoice-details .value {
  font-weight: 700;
  color: #111;
}

.official-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.official-invoice-table th,
.official-invoice-table td {
  border: 1px solid #111;
  padding: 8px 10px;
  vertical-align: top;
}

.official-invoice-table th {
  font-weight: 700;
  text-align: left;
  background: #fff;
}

.official-invoice-table .num {
  text-align: right;
  white-space: nowrap;
}

.official-invoice-table .center {
  text-align: center;
}

.official-invoice-totals {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.official-invoice-totals-box {
  min-width: 180px;
  text-align: right;
}

.official-invoice-totals-box .tot-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.official-invoice-totals-box .tot-value {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 10px;
}

.official-invoice-sign {
  margin-top: 36px;
  font-size: 0.95rem;
}

.official-invoice-sign-line {
  display: inline-block;
  min-width: 200px;
  border-bottom: 1px dotted #6b7280;
  margin-left: 6px;
  vertical-align: baseline;
}

@media (width <= 768px) {
  .official-invoice-details {
    grid-template-columns: 1fr;
  }
}

@media print {
  body * {
    visibility: hidden;
  }
  .official-invoice,
  .official-invoice * {
    visibility: visible;
  }
  .official-invoice {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }
}

.bill-state-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  white-space: nowrap;
}

.bill-state-pill.is-full {
  background: #0f766e;
}

.bill-state-pill.is-partial {
  background: #d97706;
}

.bill-state-pill.is-unpaid {
  background: #334155;
}

.bill-state-pill.is-cancelled {
  background: #9ca3af;
}

.receipt-modal-content {
  background: transparent;
  border: 0;
  box-shadow: none;
}

#paymentReceiptModal .modal-header {
  background: transparent;
}

#paymentReceiptModal .modal-body {
  background: transparent;
  padding-top: 0;
}

.receipt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.official-receipt {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 28px 32px 24px;
  max-width: 720px;
  margin: 0 auto;
}

.receipt-header {
  text-align: center;
}

.receipt-clinic-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: #111827;
}

.receipt-clinic-meta {
  font-size: 0.9rem;
  color: #4b5563;
}

.receipt-divider {
  margin: 12px auto;
  border: 0;
  border-top: 1px solid #d1d5db;
  width: 100%;
}

.receipt-title {
  font-weight: 700;
  text-decoration: underline;
  margin-top: 2px;
  color: #111827;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 28px;
  margin-top: 22px;
}

.receipt-row {
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: #111827;
}

.receipt-label {
  font-weight: 700;
  margin-right: 6px;
}

.receipt-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 36px;
  gap: 16px;
}

.receipt-sign {
  color: #111827;
}

.receipt-sign-line {
  display: inline-block;
  min-width: 180px;
  border-bottom: 1px dotted #6b7280;
  margin-left: 8px;
  vertical-align: baseline;
}

.receipt-date {
  font-weight: 700;
  color: #111827;
}

@media (width <= 768px) {
  .receipt-grid {
    grid-template-columns: 1fr;
  }
}

@media (width <= 768px) {
  .ward-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ward-toolbar-title-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .ward-search-wrap {
    max-width: none;
    flex: 1 1 auto;
  }

  .ward-toolbar-actions {
    justify-content: flex-end;
  }

  .patient-view-details {
    grid-template-columns: 1fr;
  }
}

/* Prevent fixed unified-search fallback from covering module CTAs */
body .us-trigger-fixed,
.app-container .us-trigger-fixed {
  display: none !important;
  pointer-events: none !important;
}

/* Lab request form — keep Bootstrap invalid-feedback visible despite global resets */
#lab-form .invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.875em;
  color: #dc3545;
}
#lab-form.was-validated .form-control:invalid ~ .invalid-feedback,
#lab-form.was-validated .form-select:invalid ~ .invalid-feedback,
#lab-form .is-invalid ~ .invalid-feedback {
  display: block !important;
}
#lab-form.was-validated #lab-results:not([required]):not(.is-invalid),
#lab-form #lab-results:not([required]):not(.is-invalid) {
  border-color: #ced4da;
  padding-right: 0.75rem;
  background-image: none;
}

/* Enter / Edit Results summary (avatar + test) */
.lab-result-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.1rem;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e0f2fe;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}
.lab-result-summary[hidden] {
  display: none !important;
}
.lab-result-avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0284c7;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lab-result-meta {
  min-width: 0;
}
.lab-result-patient {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.lab-result-test {
  margin-top: 4px;
  font-size: 0.95rem;
  color: #0369a1;
  font-weight: 500;
  line-height: 1.35;
}
#lab-request-fields[hidden] {
  display: none !important;
}

