/* Purpose: Styles all pages consistently. Makes it look clean and responsive. */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background-color: #f9f9f9;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}
h1 {
  color: #333;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  table-layout: fixed; /* Ensures consistent column widths */
  border-spacing: 0; /* Removes any spacing between cells */
}

/* NEW APPROACH: Clean, Simple Table Design */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Simple, consistent cell styling */
table th,
table td {
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
}

/* Exclude gaps-summary-table from general rules - it has its own Nigerian Heritage theme */
table.gaps-summary-table th,
table.gaps-summary-table td {
  /* Styles are handled in the specific gaps-summary-table rule above */
}

/* Exclude lab-tests-table from general rules - select-lab-orders has its own Nigerian Heritage theme */
table.lab-tests-table th,
table.lab-tests-table td {
  border-color: rgba(0, 135, 83, 0.2);
}

/* NEW APPROACH: Flexbox Table for Perfect Alignment */
#patients-table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

#patients-table thead {
  display: block;
  width: 100%;
}

#patients-table tbody {
  display: block;
  width: 100%;
}

#patients-table tr {
  display: flex;
  width: 100%;
}

#patients-table th,
#patients-table td {
  flex: 1;
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

#patients-table th:nth-child(1),
#patients-table td:nth-child(1) {
  flex: 0 0 16%;
  min-width: 120px;
}

#patients-table th:nth-child(2),
#patients-table td:nth-child(2) {
  flex: 0 0 10%;
  min-width: 100px;
}

#patients-table th:nth-child(3),
#patients-table td:nth-child(3) {
  flex: 0 0 6%;
  min-width: 80px;
}

#patients-table th:nth-child(4),
#patients-table td:nth-child(4) {
  flex: 1;
  min-width: 400px;
}

#patients-table th {
  background: linear-gradient(135deg, #0c3b2e, #06251c);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

#patients-table td {
  background: white;
}

#patients-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

#patients-table tr:hover td {
  background-color: #f3efe6;
}

/* Patients page theme actions */
.patients-header-actions a {
  background-color: #0c3b2e !important;
  border: 2px solid #06251c !important;
  color: #ffffff !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.patients-header-actions .back-dashboard {
  background-color: #1b4f9c !important;
  border-color: #123468 !important;
}
.patients-header-actions .add-patient {
  background-color: #008753 !important;
  border-color: #006b42 !important;
}
.patients-footer-actions {
  background-color: #f6f1e7 !important;
}
.patients-footer-actions .export-btn {
  background-color: #b36b00 !important;
  border: 2px solid #7a4300 !important;
  color: #ffffff !important;
}

/* Patients pagination styling */
.patients-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: nowrap;
  margin: 20px 0;
  background: #f6f1e7;
  border: 2px solid #0c3b2e;
  border-radius: 12px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.patients-pagination .page-info {
  font-weight: 600;
  color: #0c3b2e;
  background: #f2efe9;
  padding: 6px 12px;
  border-radius: 16px;
  white-space: nowrap;
}
.patients-pagination .pagination-btn {
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  color: #ffffff !important;
  font-weight: 700;
  min-width: 120px;
  cursor: pointer;
  transition: filter 0.15s ease-in-out;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  width: auto !important;
  margin: 0 !important;
}
.patients-pagination .pagination-btn:hover {
  filter: brightness(0.95);
}
.patients-pagination .pagination-prev {
  background: #1b4f9c !important;
  border: 2px solid #123468;
}
.patients-pagination .pagination-next {
  background: #b36b00 !important;
  border: 2px solid #7a4300;
}
.patients-pagination .pagination-btn[disabled] {
  background: #b9b9b9 !important;
  border: 2px solid #9a9a9a;
  cursor: not-allowed;
  filter: none;
}

/* Patients table controls */
#patients-table th button {
  width: auto !important;
  margin-left: 6px;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: #b36b00 !important;
  color: #ffffff !important;
  border: 1px solid #7a4300 !important;
  cursor: pointer;
}
#patients-table th button:hover {
  background: #7a4300 !important;
}

/* Patient list action overrides */
#patients-table .print-summary-btn {
  background-color: #008753 !important;
  border: 1px solid #006b42 !important;
  color: #ffffff !important;
}

/* Remove borders from last column */
#patients-table th:last-child,
#patients-table td:last-child {
  border-right: none;
}

/* Remove borders from last row */
#patients-table tr:last-child td {
  border-bottom: none;
}

/* Properly sized action buttons */
#patients-table td:nth-child(4) .action-btn {
  font-size: 11px;
  padding: 6px 8px;
  margin: 2px;
  min-width: 100px;
  white-space: nowrap;
  text-align: center;
  flex-shrink: 0;
  overflow: visible;
  text-overflow: clip;
}

/* Specific button text visibility - much wider */
#patients-table td:nth-child(4) .action-btn:nth-child(4) {
  min-width: 140px; /* "Add New Encounter" needs much more space */
}

#patients-table td:nth-child(4) .action-btn:nth-child(5) {
  min-width: 150px; /* "Add New Appointment" needs much more space */
}

/* Ensure action buttons fit in the Actions column */
#patients-table td:nth-child(4) {
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-start;
  align-items: center;
}

/* APPLY FLEXBOX TABLE APPROACH TO ALL TABLES */
/* History Tables */
table.history-table,
table.note-history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

table.history-table thead,
table.note-history-table thead {
  display: block;
  width: 100%;
}

table.history-table tbody,
table.note-history-table tbody {
  display: block;
  width: 100%;
}

table.history-table tr,
table.note-history-table tr {
  display: flex;
  width: 100%;
}

table.history-table th,
table.history-table td,
table.note-history-table th,
table.note-history-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

table.history-table th:nth-child(1), 
table.history-table td:nth-child(1),
table.note-history-table th:nth-child(1), 
table.note-history-table td:nth-child(1) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.history-table th:nth-child(2), 
table.history-table td:nth-child(2),
table.note-history-table th:nth-child(2), 
table.note-history-table td:nth-child(2) {
  flex: 0 0 50%;
  min-width: 200px;
}

table.history-table th:nth-child(3), 
table.history-table td:nth-child(3),
table.note-history-table th:nth-child(3), 
table.note-history-table td:nth-child(3) {
  flex: 0 0 25%;
  min-width: 150px;
}

table.history-table th:nth-child(4), 
table.history-table td:nth-child(4),
table.note-history-table th:nth-child(4), 
table.note-history-table td:nth-child(4) {
  flex: 0 0 10%;
  min-width: 80px;
}

/* Diagnoses Tables */
table.diagnoses-table,
table.note-diagnoses-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

table.diagnoses-table thead,
table.note-diagnoses-table thead {
  display: block;
  width: 100%;
}

table.diagnoses-table tbody,
table.note-diagnoses-table tbody {
  display: block;
  width: 100%;
}

table.diagnoses-table tr,
table.note-diagnoses-table tr {
  display: flex;
  width: 100%;
}

table.diagnoses-table th,
table.diagnoses-table td,
table.note-diagnoses-table th,
table.note-diagnoses-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

table.diagnoses-table th:nth-child(1), 
table.diagnoses-table td:nth-child(1),
table.note-diagnoses-table th:nth-child(1), 
table.note-diagnoses-table td:nth-child(1) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.diagnoses-table th:nth-child(2), 
table.diagnoses-table td:nth-child(2),
table.note-diagnoses-table th:nth-child(2), 
table.note-diagnoses-table td:nth-child(2) {
  flex: 0 0 50%;
  min-width: 200px;
}

table.diagnoses-table th:nth-child(3), 
table.diagnoses-table td:nth-child(3),
table.note-diagnoses-table th:nth-child(3), 
table.note-diagnoses-table td:nth-child(3) {
  flex: 0 0 25%;
  min-width: 150px;
}

table.diagnoses-table th:nth-child(4), 
table.diagnoses-table td:nth-child(4),
table.note-diagnoses-table th:nth-child(4), 
table.note-diagnoses-table td:nth-child(4) {
  flex: 0 0 10%;
  min-width: 80px;
}

/* Allergies Tables */
table.allergies-table,
table.note-allergies-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

table.allergies-table thead,
table.note-allergies-table thead {
  display: block;
  width: 100%;
}

table.allergies-table tbody,
table.note-allergies-table tbody {
  display: block;
  width: 100%;
}

table.allergies-table tr,
table.note-allergies-table tr {
  display: flex;
  width: 100%;
}

table.allergies-table th,
table.allergies-table td,
table.note-allergies-table th,
table.note-allergies-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

table.allergies-table th:nth-child(1), 
table.allergies-table td:nth-child(1),
table.note-allergies-table th:nth-child(1), 
table.note-allergies-table td:nth-child(1) {
  flex: 0 0 30%;
  min-width: 150px;
}

table.allergies-table th:nth-child(2), 
table.allergies-table td:nth-child(2),
table.note-allergies-table th:nth-child(2), 
table.note-allergies-table td:nth-child(2) {
  flex: 0 0 30%;
  min-width: 150px;
}

table.allergies-table th:nth-child(3), 
table.allergies-table td:nth-child(3),
table.note-allergies-table th:nth-child(3), 
table.note-allergies-table td:nth-child(3) {
  flex: 0 0 20%;
  min-width: 100px;
}

table.allergies-table th:nth-child(4), 
table.allergies-table td:nth-child(4),
table.note-allergies-table th:nth-child(4), 
table.note-allergies-table td:nth-child(4) {
  flex: 0 0 20%;
  min-width: 100px;
}

/* Immunizations Tables */
table.immunizations-table,
table.note-immunizations-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

table.immunizations-table thead,
table.note-immunizations-table thead {
  display: block;
  width: 100%;
}

table.immunizations-table tbody,
table.note-immunizations-table tbody {
  display: block;
  width: 100%;
}

table.immunizations-table tr,
table.note-immunizations-table tr {
  display: flex;
  width: 100%;
}

table.immunizations-table th,
table.immunizations-table td,
table.note-immunizations-table th,
table.note-immunizations-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

table.immunizations-table th:nth-child(1), 
table.immunizations-table td:nth-child(1),
table.note-immunizations-table th:nth-child(1), 
table.note-immunizations-table td:nth-child(1) {
  flex: 0 0 40%;
  min-width: 200px;
}

table.immunizations-table th:nth-child(2), 
table.immunizations-table td:nth-child(2),
table.note-immunizations-table th:nth-child(2), 
table.note-immunizations-table td:nth-child(2) {
  flex: 0 0 20%;
  min-width: 100px;
}

table.immunizations-table th:nth-child(3), 
table.immunizations-table td:nth-child(3),
table.note-immunizations-table th:nth-child(3), 
table.note-immunizations-table td:nth-child(3) {
  flex: 0 0 20%;
  min-width: 100px;
}

table.immunizations-table th:nth-child(4), 
table.immunizations-table td:nth-child(4),
table.note-immunizations-table th:nth-child(4), 
table.note-immunizations-table td:nth-child(4) {
  flex: 0 0 20%;
  min-width: 100px;
}

/* Medical Visits Tables - 3 columns */
table.medical-visits-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

table.medical-visits-table thead {
  display: block;
  width: 100%;
}

table.medical-visits-table tbody {
  display: block;
  width: 100%;
}

table.medical-visits-table tr {
  display: flex;
  width: 100%;
}

table.medical-visits-table th,
table.medical-visits-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

table.medical-visits-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

/* Order Modal Table Styles - Override global table styles */
.order-modal-table th,
.order-modal-table td {
  text-align: left !important;
  border: 1px solid #ddd !important;
  padding: 12px !important;
  vertical-align: top !important;
  box-sizing: border-box !important;
}

.order-modal-table .order-th-left {
  text-align: left !important;
}

.order-modal-table .order-th-center {
  text-align: center !important;
}

table.medical-visits-table td {
  background: white;
}

table.medical-visits-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

table.medical-visits-table tr:hover td {
  background-color: #e8f5e8;
}

/* 3 columns for medical visits table */
table.medical-visits-table th:nth-child(1),
table.medical-visits-table td:nth-child(1) {
  flex: 0 0 30%;
  min-width: 150px;
}

table.medical-visits-table th:nth-child(2),
table.medical-visits-table td:nth-child(2) {
  flex: 0 0 20%;
  min-width: 100px;
}

table.medical-visits-table th:nth-child(3),
table.medical-visits-table td:nth-child(3) {
  flex: 0 0 50%;
  min-width: 200px;
}

/* Medications Tables */
table.patient-medications-table,
table.prescriptions-summary-table,
table.active-medications-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

table.patient-medications-table thead,
table.prescriptions-summary-table thead,
table.active-medications-table thead {
  display: block;
  width: 100%;
}

table.patient-medications-table tbody,
table.prescriptions-summary-table tbody,
table.active-medications-table tbody {
  display: block;
  width: 100%;
}

table.patient-medications-table tr,
table.prescriptions-summary-table tr,
table.active-medications-table tr {
  display: flex;
  width: 100%;
}

table.patient-medications-table th,
table.patient-medications-table td,
table.prescriptions-summary-table th,
table.prescriptions-summary-table td,
table.active-medications-table th,
table.active-medications-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

table.patient-medications-table th,
table.prescriptions-summary-table th,
table.active-medications-table th,
table.clinical-note-prescriptions-table th {
  background: linear-gradient(135deg, #008753, #006b42) !important;
  color: white !important;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

table.patient-medications-table td,
table.prescriptions-summary-table td,
table.active-medications-table td {
  background: white;
}

table.patient-medications-table tr:nth-child(even) td,
table.prescriptions-summary-table tr:nth-child(even) td,
table.active-medications-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

table.patient-medications-table tr:hover td,
table.prescriptions-summary-table tr:hover td,
table.active-medications-table tr:hover td {
  background-color: #e8f5e8;
}

/* Patient Medications Table - 6 columns */
table.patient-medications-table th:nth-child(1),
table.patient-medications-table td:nth-child(1) {
  flex: 0 0 20%;
  min-width: 120px;
}

table.patient-medications-table th:nth-child(2),
table.patient-medications-table td:nth-child(2) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.patient-medications-table th:nth-child(3),
table.patient-medications-table td:nth-child(3) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.patient-medications-table th:nth-child(4),
table.patient-medications-table td:nth-child(4) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.patient-medications-table th:nth-child(5),
table.patient-medications-table td:nth-child(5) {
  flex: 0 0 20%;
  min-width: 120px;
}

table.patient-medications-table th:nth-child(6),
table.patient-medications-table td:nth-child(6) {
  flex: 0 0 15%;
  min-width: 100px;
}

/* Prescriptions Summary Container */
#prescriptions-summary {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#prescriptions-summary h4 {
  margin-bottom: 15px;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

/* Prescriptions Summary Table - 7 columns */
table.prescriptions-summary-table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
  overflow-x: auto;
  box-sizing: border-box;
}

table.prescriptions-summary-table th:nth-child(1),
table.prescriptions-summary-table td:nth-child(1) {
  flex: 0 0 14%;
  min-width: 90px;
}

table.prescriptions-summary-table th:nth-child(2),
table.prescriptions-summary-table td:nth-child(2) {
  flex: 0 0 10%;
  min-width: 70px;
}

table.prescriptions-summary-table th:nth-child(3),
table.prescriptions-summary-table td:nth-child(3) {
  flex: 0 0 13%;
  min-width: 85px;
}

table.prescriptions-summary-table th:nth-child(4),
table.prescriptions-summary-table td:nth-child(4) {
  flex: 0 0 16%;
  min-width: 105px;
}

table.prescriptions-summary-table th:nth-child(5),
table.prescriptions-summary-table td:nth-child(5) {
  flex: 0 0 10%;
  min-width: 70px;
}

table.prescriptions-summary-table th:nth-child(6),
table.prescriptions-summary-table td:nth-child(6) {
  flex: 0 0 10%;
  min-width: 70px;
}

table.prescriptions-summary-table th:nth-child(7),
table.prescriptions-summary-table td:nth-child(7) {
  flex: 0 0 27%;
  min-width: 180px;
}

/* Additional alignment fixes for prescriptions summary table */
table.prescriptions-summary-table th,
table.prescriptions-summary-table td {
  justify-content: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.prescriptions-summary-table th {
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Clinical Note Prescriptions Table - 6 columns (specific for clinical-note.html) */
table.clinical-note-prescriptions-table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
  overflow-x: auto;
  box-sizing: border-box;
}

table.clinical-note-prescriptions-table th:nth-child(1),
table.clinical-note-prescriptions-table td:nth-child(1) {
  flex: 0 0 18%;
  min-width: 110px;
}

table.clinical-note-prescriptions-table th:nth-child(2),
table.clinical-note-prescriptions-table td:nth-child(2) {
  flex: 0 0 12%;
  min-width: 80px;
}

table.clinical-note-prescriptions-table th:nth-child(3),
table.clinical-note-prescriptions-table td:nth-child(3) {
  flex: 0 0 20%;
  min-width: 130px;
}

table.clinical-note-prescriptions-table th:nth-child(4),
table.clinical-note-prescriptions-table td:nth-child(4) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.clinical-note-prescriptions-table th:nth-child(5),
table.clinical-note-prescriptions-table td:nth-child(5) {
  flex: 0 0 12%;
  min-width: 80px;
}

table.clinical-note-prescriptions-table th:nth-child(6),
table.clinical-note-prescriptions-table td:nth-child(6) {
  flex: 0 0 23%;
  min-width: 150px;
}

/* Active Medications Table - 7 columns */
table.active-medications-table th:nth-child(1),
table.active-medications-table td:nth-child(1) {
  flex: 0 0 18%;
  min-width: 120px;
}

table.active-medications-table th:nth-child(2),
table.active-medications-table td:nth-child(2) {
  flex: 0 0 15%;
  min-width: 100px;
}

table.active-medications-table th:nth-child(3),
table.active-medications-table td:nth-child(3) {
  flex: 0 0 20%;
  min-width: 140px;
}

table.active-medications-table th:nth-child(4),
table.active-medications-table td:nth-child(4) {
  flex: 0 0 13%;
  min-width: 90px;
}

table.active-medications-table th:nth-child(5),
table.active-medications-table td:nth-child(5) {
  flex: 0 0 12%;
  min-width: 80px;
}

table.active-medications-table th:nth-child(6),
table.active-medications-table td:nth-child(6) {
  flex: 0 0 8%;
  min-width: 60px;
}

table.active-medications-table th:nth-child(7),
table.active-medications-table td:nth-child(7) {
  flex: 0 0 14%;
  min-width: 100px;
}

/* Generated Orders Tables */
table.generated-orders-table,
table.generated-referrals-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  background: white !important;
  margin-bottom: 15px !important;
}

table.generated-orders-table {
  border: 2px solid var(--primary-green) !important;
  box-shadow: 0 4px 15px rgba(0, 135, 83, 0.15) !important;
}

table.generated-referrals-table {
  border: 1px solid #e0e0e0 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

/* Upcoming Appointments and Non-Visit Encounters Tables */
table.upcoming-appointments-table,
table.non-visit-encounters-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
  table-layout: fixed;
}

/* Deleted Patients Table - 3 columns */
table.deleted-patients-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
  table-layout: fixed;
}

/* Patient Encounters Prescriptions Table - 7 columns */
table.encounters-prescriptions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
  table-layout: fixed;
  display: block;
  margin: 0;
  min-width: 100%;
}

table.upcoming-appointments-table thead,
table.non-visit-encounters-table thead,
table.deleted-patients-table thead,
table.encounters-prescriptions-table thead {
  display: block;
  width: 100%;
}

table.upcoming-appointments-table tbody,
table.non-visit-encounters-table tbody,
table.deleted-patients-table tbody,
table.encounters-prescriptions-table tbody {
  display: block;
  width: 100%;
}

table.upcoming-appointments-table tr,
table.non-visit-encounters-table tr,
table.deleted-patients-table tr,
table.encounters-prescriptions-table tr {
  display: flex;
  width: 100%;
  min-width: 100%;
}

table.upcoming-appointments-table th,
table.upcoming-appointments-table td,
table.non-visit-encounters-table th,
table.non-visit-encounters-table td,
table.deleted-patients-table th,
table.deleted-patients-table td,
table.encounters-prescriptions-table th,
table.encounters-prescriptions-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

table.upcoming-appointments-table th,
table.non-visit-encounters-table th,
table.deleted-patients-table th,
table.encounters-prescriptions-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

table.upcoming-appointments-table td,
table.non-visit-encounters-table td,
table.deleted-patients-table td,
table.encounters-prescriptions-table td {
  background: white;
}

table.upcoming-appointments-table tr:nth-child(even) td,
table.non-visit-encounters-table tr:nth-child(even) td,
table.deleted-patients-table tr:nth-child(even) td,
table.encounters-prescriptions-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

table.upcoming-appointments-table tr:hover td,
table.non-visit-encounters-table tr:hover td,
table.deleted-patients-table tr:hover td,
table.encounters-prescriptions-table tr:hover td {
  background-color: #e8f5e8;
}

/* Upcoming Appointments Table - 4 columns */
table.upcoming-appointments-table th:nth-child(1),
table.upcoming-appointments-table td:nth-child(1) {
  flex: 0 0 20%;
  min-width: 100px;
}

table.upcoming-appointments-table th:nth-child(2),
table.upcoming-appointments-table td:nth-child(2) {
  flex: 0 0 15%;
  min-width: 80px;
}

table.upcoming-appointments-table th:nth-child(3),
table.upcoming-appointments-table td:nth-child(3) {
  flex: 0 0 25%;
  min-width: 120px;
}

table.upcoming-appointments-table th:nth-child(4),
table.upcoming-appointments-table td:nth-child(4) {
  flex: 0 0 40%;
  min-width: 150px;
}

/* Non-Visit Encounters Table - 5 columns */
table.non-visit-encounters-table th:nth-child(1),
table.non-visit-encounters-table td:nth-child(1) {
  flex: 0 0 18%;
  min-width: 90px;
}

table.non-visit-encounters-table th:nth-child(2),
table.non-visit-encounters-table td:nth-child(2) {
  flex: 0 0 25%;
  min-width: 120px;
}

table.non-visit-encounters-table th:nth-child(3),
table.non-visit-encounters-table td:nth-child(3) {
  flex: 0 0 20%;
  min-width: 100px;
}

table.non-visit-encounters-table th:nth-child(4),
table.non-visit-encounters-table td:nth-child(4) {
  flex: 0 0 15%;
  min-width: 80px;
}

table.non-visit-encounters-table th:nth-child(5),
table.non-visit-encounters-table td:nth-child(5) {
  flex: 0 0 22%;
  min-width: 110px;
}

/* Deleted Patients Table - 3 columns */
table.deleted-patients-table th:nth-child(1),
table.deleted-patients-table td:nth-child(1) {
  flex: 0 0 40%;
  min-width: 200px;
}

table.deleted-patients-table th:nth-child(2),
table.deleted-patients-table td:nth-child(2) {
  flex: 0 0 25%;
  min-width: 120px;
}

table.deleted-patients-table th:nth-child(3),
table.deleted-patients-table td:nth-child(3) {
  flex: 0 0 35%;
  min-width: 180px;
}

/* Patient Encounters Prescriptions Table - 7 columns using CSS Grid */
table.encounters-prescriptions-table tr {
  display: grid !important;
  grid-template-columns: 1.5fr 0.8fr 1.5fr 2fr 0.8fr 0.8fr 2.5fr !important;
  width: 100% !important;
  gap: 0 !important;
}

table.encounters-prescriptions-table th,
table.encounters-prescriptions-table td {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 8px 10px !important;
  border-right: 1px solid #e0e0e0 !important;
  border-bottom: 1px solid #e0e0e0 !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Ensure Prescription ID column has enough width for RX numbers */
table.encounters-prescriptions-table th:nth-child(1),
table.encounters-prescriptions-table td:nth-child(1) {
  min-width: 120px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
}

/* Ensure full width for encounters prescriptions wrapper */
#encounter-prescriptions {
  width: 100% !important;
  box-sizing: border-box !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#encounter-prescriptions > div {
  width: 100% !important;
  box-sizing: border-box !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Force table to take absolute full width */
table.encounters-prescriptions-table {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

/* Ensure body and html don't constrain width */
html, body {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Ensure main content area takes full width */
body > * {
  max-width: none !important;
}

/* Gaps Summary Table - 5 columns - Nigerian Heritage Theme */
table.gaps-summary-table {
  width: 100% !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box !important;
  table-layout: fixed !important;
  display: table !important;
  margin: 0 !important;
}

table.gaps-summary-table thead {
  display: table-header-group !important;
  width: 100% !important;
}

table.gaps-summary-table tbody {
  display: table-row-group !important;
  width: 100% !important;
}

table.gaps-summary-table tr {
  display: table-row !important;
  width: 100% !important;
}

table.gaps-summary-table th,
table.gaps-summary-table td {
  display: table-cell !important;
  box-sizing: border-box !important;
  vertical-align: top !important;
  padding: 12px 10px !important;
  border: 1px solid #e0e0e0 !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Nigerian Heritage Theme Headers */
table.gaps-summary-table th {
  background: linear-gradient(135deg, #008753 0%, #006b42 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  letter-spacing: 0.3px !important;
  border: 1px solid #006b42 !important;
  text-align: left !important;
}

table.gaps-summary-table th:nth-child(2),
table.gaps-summary-table th:nth-child(3),
table.gaps-summary-table th:nth-child(4),
table.gaps-summary-table th:nth-child(5) {
  text-align: center !important;
}

/* Column Widths - Fixed alignment */
table.gaps-summary-table th:nth-child(1),
table.gaps-summary-table td:nth-child(1) {
  width: 50% !important;
  min-width: 300px !important;
}

table.gaps-summary-table th:nth-child(2),
table.gaps-summary-table td:nth-child(2) {
  width: 12.5% !important;
  min-width: 100px !important;
  text-align: center !important;
}

table.gaps-summary-table th:nth-child(3),
table.gaps-summary-table td:nth-child(3) {
  width: 12.5% !important;
  min-width: 100px !important;
  text-align: center !important;
}

table.gaps-summary-table th:nth-child(4),
table.gaps-summary-table td:nth-child(4) {
  width: 12.5% !important;
  min-width: 100px !important;
  text-align: center !important;
}

table.gaps-summary-table th:nth-child(5),
table.gaps-summary-table td:nth-child(5) {
  width: 12.5% !important;
  min-width: 150px !important;
  text-align: center !important;
}

table.gaps-summary-table td {
  background: white !important;
  text-align: left !important;
}

table.gaps-summary-table td:nth-child(2),
table.gaps-summary-table td:nth-child(3),
table.gaps-summary-table td:nth-child(4),
table.gaps-summary-table td:nth-child(5) {
  text-align: center !important;
}

table.gaps-summary-table tr:nth-child(even) td {
  background-color: rgba(0, 135, 83, 0.1) !important;
}

table.gaps-summary-table tr:hover td {
  background-color: rgba(0, 135, 83, 0.3) !important;
}

/* Imaging Orders Table - 3 columns */
table.imaging-orders-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
  table-layout: fixed;
  display: block;
  margin: 0;
  min-width: 100%;
}

table.imaging-orders-table thead {
  display: block;
  width: 100%;
}

table.imaging-orders-table tbody {
  display: block;
  width: 100%;
}

table.imaging-orders-table tr {
  display: grid !important;
  grid-template-columns: 1.5fr 1fr 1fr 1.5fr 1fr 1.5fr !important;
  width: 100% !important;
  gap: 0 !important;
}

table.imaging-orders-table th,
table.imaging-orders-table td {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 8px 10px !important;
  border-right: 1px solid #e0e0e0 !important;
  border-bottom: 1px solid #e0e0e0 !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

table.imaging-orders-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

table.imaging-orders-table td {
  background: white;
}

table.imaging-orders-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

table.imaging-orders-table tr:hover td {
  background-color: #e8f5e8;
}

/* Lab Orders Table - 3 columns */
table.lab-orders-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
  table-layout: fixed;
  display: block;
  margin: 0;
  min-width: 100%;
}

table.lab-orders-table thead {
  display: block;
  width: 100%;
}

table.lab-orders-table tbody {
  display: block;
  width: 100%;
}

table.lab-orders-table tr {
  display: grid !important;
  grid-template-columns: 1.5fr 1fr 1.5fr 1fr 1.5fr 1fr !important;
  width: 100% !important;
  gap: 0 !important;
}

table.lab-orders-table th,
table.lab-orders-table td {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 8px 10px !important;
  border-right: 1px solid #e0e0e0 !important;
  border-bottom: 1px solid #e0e0e0 !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

table.lab-orders-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

table.lab-orders-table td {
  background: white;
}

table.lab-orders-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

table.lab-orders-table tr:hover td {
  background-color: #e8f5e8;
}

/* Balanced full width for encounters prescriptions table */
table.encounters-prescriptions-table,
table.encounters-prescriptions-table thead,
table.encounters-prescriptions-table tbody {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

table.generated-orders-table thead,
table.generated-referrals-table thead {
  display: block !important;
  width: 100% !important;
}

table.generated-orders-table thead {
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--dark-green) 100%) !important;
}

table.generated-orders-table tbody,
table.generated-referrals-table tbody {
  display: block !important;
  width: 100% !important;
  max-height: 600px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

table.generated-orders-table thead tr,
table.generated-orders-table tbody tr,
table.generated-referrals-table thead tr,
table.generated-referrals-table tbody tr {
  display: flex !important;
  flex-direction: row !important;
  width: 100% !important;
  flex-wrap: nowrap !important;
}

table.generated-orders-table th {
  padding: 12px 10px !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-bottom: 2px solid var(--dark-green) !important;
  text-align: left !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  color: white !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
  letter-spacing: 0.5px !important;
  background: transparent !important;
  flex-shrink: 0 !important;
}

table.generated-orders-table td,
table.generated-referrals-table th,
table.generated-referrals-table td {
  padding: 12px 10px !important;
  border-right: 1px solid #e0e0e0 !important;
  border-bottom: 1px solid #e0e0e0 !important;
  text-align: left !important;
  vertical-align: top !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  min-height: 48px !important;
  flex-shrink: 0 !important;
}

table.generated-orders-table td {
  background: white;
}

table.generated-orders-table tr:nth-child(even) td {
  background-color: #f8f9fa;
}

table.generated-orders-table tr:hover td {
  background-color: var(--light-green) !important;
}

/* Status badge styling for orders table */
.status-badge {
  display: inline-block !important;
  padding: 4px 10px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: capitalize !important;
  white-space: nowrap !important;
}

.status-badge.status-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3) !important;
}

.status-badge.status-pending {
  background: linear-gradient(135deg, var(--kente-gold) 0%, #FFD700 100%) !important;
  color: var(--charcoal) !important;
  box-shadow: 0 2px 4px rgba(218, 165, 32, 0.3) !important;
}

.status-badge.status-default {
  background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%) !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3) !important;
}

/* Ensure status badges are properly displayed in Generated Orders table */
table.generated-orders-table td:nth-child(4) {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

table.generated-orders-table td:nth-child(4) .status-badge {
  display: inline-block !important;
  white-space: nowrap !important;
}

/* Actions column: allow wrap so View, Remove test, Delete are all visible */
table.generated-orders-table td:nth-child(6) .order-actions-container {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-width: 0 !important;
}

/* Button hover effects for order actions */
table.generated-orders-table .action-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

table.generated-orders-table .action-btn:active {
  transform: translateY(0) !important;
}

/* Generated Orders Table - 6 columns */
/* Generated Orders Table - Improved column widths for better display */
table.generated-orders-table th:nth-child(1), 
table.generated-orders-table td:nth-child(1) {
  flex: 0 0 10% !important;
  min-width: 90px !important;
  max-width: 120px !important;
}

table.generated-orders-table th:nth-child(2), 
table.generated-orders-table td:nth-child(2) {
  flex: 0 0 12% !important;
  min-width: 110px !important;
  max-width: 140px !important;
}

table.generated-orders-table th:nth-child(3), 
table.generated-orders-table td:nth-child(3) {
  flex: 1 1 30% !important;
  min-width: 200px !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

table.generated-orders-table th:nth-child(4), 
table.generated-orders-table td:nth-child(4) {
  flex: 0 0 10% !important;
  min-width: 90px !important;
  max-width: 120px !important;
}

table.generated-orders-table th:nth-child(5), 
table.generated-orders-table td:nth-child(5) {
  flex: 0 0 12% !important;
  min-width: 100px !important;
  max-width: 130px !important;
  font-family: 'Courier New', monospace !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--primary-green) !important;
}

table.generated-orders-table th:nth-child(6), 
table.generated-orders-table td:nth-child(6) {
  flex: 1 1 280px !important;
  min-width: 280px !important;
  max-width: none !important;
  overflow: visible !important;
}

table.generated-orders-table th:nth-child(7), 
table.generated-orders-table td:nth-child(7) {
  flex: 0 0 18% !important;
  min-width: 150px !important;
  max-width: 180px !important;
  overflow: visible !important;
}

/* Generated Referrals Table - 5 columns */
table.generated-referrals-table th:nth-child(1), 
table.generated-referrals-table td:nth-child(1) {
  flex: 0 0 15%;
  min-width: 80px;
}

table.generated-referrals-table th:nth-child(2), 
table.generated-referrals-table td:nth-child(2) {
  flex: 0 0 25%;
  min-width: 150px;
}

table.generated-referrals-table th:nth-child(3), 
table.generated-referrals-table td:nth-child(3) {
  flex: 0 0 35%;
  min-width: 200px;
}

table.generated-referrals-table th:nth-child(4), 
table.generated-referrals-table td:nth-child(4) {
  flex: 0 0 10%;
  min-width: 80px;
}

table.generated-referrals-table th:nth-child(5), 
table.generated-referrals-table td:nth-child(5) {
  flex: 0 0 15%;
  min-width: 100px;
}

/* Vitals Table */
#vitals-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

#vitals-table thead {
  display: block;
  width: 100%;
}

#vitals-table tbody {
  display: block;
  width: 100%;
}

#vitals-table tr {
  display: flex;
  width: 100%;
}

#vitals-table th,
#vitals-table td {
  padding: 6px 8px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 40px;
  overflow: hidden;
  font-size: 12px;
}

#vitals-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.2px;
}

/* Vitals Table - 12 columns with optimized widths */
#vitals-table th:nth-child(1),
#vitals-table td:nth-child(1) {
  flex: 0 0 8%;
  min-width: 80px;
}

#vitals-table th:nth-child(2),
#vitals-table td:nth-child(2) {
  flex: 0 0 8%;
  min-width: 80px;
}

#vitals-table th:nth-child(3),
#vitals-table td:nth-child(3) {
  flex: 0 0 10%;
  min-width: 100px;
}

#vitals-table th:nth-child(4),
#vitals-table td:nth-child(4) {
  flex: 0 0 8%;
  min-width: 80px;
}

#vitals-table th:nth-child(5),
#vitals-table td:nth-child(5) {
  flex: 0 0 8%;
  min-width: 80px;
}

#vitals-table th:nth-child(6),
#vitals-table td:nth-child(6) {
  flex: 0 0 7%;
  min-width: 70px;
}

#vitals-table th:nth-child(7),
#vitals-table td:nth-child(7) {
  flex: 0 0 7%;
  min-width: 70px;
}

#vitals-table th:nth-child(8),
#vitals-table td:nth-child(8) {
  flex: 0 0 7%;
  min-width: 70px;
}

#vitals-table th:nth-child(9),
#vitals-table td:nth-child(9) {
  flex: 0 0 6%;
  min-width: 60px;
}

#vitals-table th:nth-child(10),
#vitals-table td:nth-child(10) {
  flex: 0 0 8%;
  min-width: 80px;
}

#vitals-table th:nth-child(11),
#vitals-table td:nth-child(11) {
  flex: 0 0 15%;
  min-width: 120px;
}

#vitals-table th:nth-child(12),
#vitals-table td:nth-child(12) {
  flex: 0 0 10%;
  min-width: 100px;
}

/* Preventive Gaps Table */
table.preventive-gaps-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
  table-layout: fixed;
}

table.preventive-gaps-table th,
table.preventive-gaps-table td {
  padding: 8px 10px;
  border: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  overflow: hidden;
}

table.preventive-gaps-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

/* Preventive Gaps Table - 5 columns with fixed widths */
table.preventive-gaps-table th:nth-child(1), 
table.preventive-gaps-table td:nth-child(1) {
  width: 35%;
}

table.preventive-gaps-table th:nth-child(2), 
table.preventive-gaps-table td:nth-child(2) {
  width: 18%;
}

table.preventive-gaps-table th:nth-child(3), 
table.preventive-gaps-table td:nth-child(3) {
  width: 15%;
}

table.preventive-gaps-table th:nth-child(4), 
table.preventive-gaps-table td:nth-child(4) {
  width: 15%;
}

table.preventive-gaps-table th:nth-child(5), 
table.preventive-gaps-table td:nth-child(5) {
  width: 17%;
}

/* Lab and Imaging Tables */
#lab-table,
#imaging-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

#lab-table thead,
#imaging-table thead {
  display: block;
  width: 100%;
}

#lab-table tbody,
#imaging-table tbody {
  display: block;
  width: 100%;
}

#lab-table tr,
#imaging-table tr {
  display: flex;
  width: 100%;
}

#lab-table th,
#lab-table td,
#imaging-table th,
#imaging-table td {
  padding: 8px 10px;
  border-right: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
}

#lab-table th:nth-child(1),
#lab-table td:nth-child(1),
#imaging-table th:nth-child(1),
#imaging-table td:nth-child(1) {
  flex: 0 0 30%;
  min-width: 150px;
}

#lab-table th:nth-child(2),
#lab-table td:nth-child(2),
#imaging-table th:nth-child(2),
#imaging-table td:nth-child(2) {
  flex: 0 0 30%;
  min-width: 150px;
}

#lab-table th:nth-child(3),
#lab-table td:nth-child(3),
#imaging-table th:nth-child(3),
#imaging-table td:nth-child(3) {
  flex: 0 0 20%;
  min-width: 100px;
}

#lab-table th:nth-child(4),
#lab-table td:nth-child(4),
#imaging-table th:nth-child(4),
#imaging-table td:nth-child(4) {
  flex: 0 0 20%;
  min-width: 100px;
}

/* Ensure all tables spread across page width even when empty - but don't override specific table layouts */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(#vitals-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.gaps-summary-table):not(.appointments-table) {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed !important;
}

/* Empty table styling - only for tables without specific styling */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(#vitals-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.gaps-summary-table):not(.appointments-table) tbody:empty::after {
  content: "No data available";
  display: block;
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

/* Ensure empty tables still show proper structure - only for tables without specific styling */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(#vitals-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.appointments-table) tbody:empty {
  display: block;
  min-height: 100px;
}

/* Fix for tables with empty tbody - only for tables without specific styling */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(.inpatient-table):not(#vitals-table):not(#vitals-flowsheet-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.appointments-table) tbody:empty + * {
  display: none;
}

/* Ensure all table headers are properly styled - only for tables without specific styling */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(.inpatient-table):not(#vitals-table):not(#vitals-flowsheet-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.prescriptions-summary-table):not(.active-medications-table):not(.clinical-note-prescriptions-table):not(.condition-stats-table):not(.gaps-summary-table):not(.appointments-table) th {
  background: linear-gradient(135deg, #4CAF50, #45a049) !important;
  color: white !important;
  font-weight: 600 !important;
  text-align: left !important;
  font-size: 13px !important;
  letter-spacing: 0.3px !important;
  padding: 8px 10px !important;
  border: 1px solid #e0e0e0 !important;
}

/* Ensure all table cells are properly styled - only for tables without specific styling */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(#vitals-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.gaps-summary-table):not(.condition-stats-table):not(.appointments-table) td {
  padding: 8px 10px !important;
  border: 1px solid #e0e0e0 !important;
  text-align: left !important;
  vertical-align: top !important;
  background: white !important;
}

/* Alternating row colors for better readability - only for tables without specific styling */
table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(#vitals-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.gaps-summary-table):not(.prescriptions-summary-table):not(.active-medications-table):not(.clinical-note-prescriptions-table):not(.condition-stats-table):not(.appointments-table) tr:nth-child(even) td {
  background-color: #f8f9fa !important;
}

table:not(#patients-table):not(.note-history-table):not(.note-diagnoses-table):not(.note-allergies-table):not(.note-immunizations-table):not(.medical-visits-table):not(.generated-orders-table):not(.generated-referrals-table):not(#vitals-table):not(#lab-table):not(#imaging-table):not(.preventive-gaps-table):not(.gaps-summary-table):not(.prescriptions-summary-table):not(.active-medications-table):not(.clinical-note-prescriptions-table):not(.condition-stats-table):not(.appointments-table) tr:hover td {
  background-color: #e8f5e8 !important;
}

/* Preventive Care Gaps Styling - Match Target Layout */
#preventive-gaps-list,
#gaps-section {
  width: 100% !important;
  margin: 20px 0 !important;
  clear: both !important;
  position: relative !important;
  z-index: 1 !important;
  overflow: visible !important;
}

/* Override any conflicting styles */
#preventive-gaps-list *,
#gaps-section * {
  box-sizing: border-box !important;
}

#preventive-gaps-list ul,
#gaps-section ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  clear: both !important;
}

/* Force vertical list layout */
#preventive-gaps-list,
#gaps-section {
  display: block !important;
  width: 100% !important;
}

#preventive-gaps-list ul li,
#gaps-section ul li {
  display: block !important;
  width: 100% !important;
  float: none !important;
  clear: both !important;
}

#preventive-gaps-list li,
#gaps-section li {
  margin: 0 0 10px 0 !important;
  display: block !important;
  width: 100% !important;
  float: none !important;
  clear: both !important;
  box-sizing: border-box !important;
  position: relative !important;
}

#preventive-gaps-list li .gap-text,
#gaps-section li .gap-text {
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
  word-wrap: break-word !important;
  display: block !important;
}

#preventive-gaps-list li .gap-buttons,
#gaps-section li .gap-buttons {
  display: block !important;
  text-align: right !important;
  margin: 0 !important;
  padding: 0 !important;
}

#preventive-gaps-list li button,
#gaps-section li button {
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  display: inline-block !important;
  position: relative !important;
}

#preventive-gaps-list li button[onclick*="markGapAddressed"],
#gaps-section li button[onclick*="markGapAddressed"] {
  background-color: #28a745 !important;
  color: white !important;
}

#preventive-gaps-list li button[onclick*="markGapUnaddressed"],
#gaps-section li button[onclick*="markGapUnaddressed"] {
  background-color: #dc3545 !important;
  color: white !important;
}

#preventive-gaps-list li button[onclick*="addProofAttachment"],
#gaps-section li button[onclick*="addProofAttachment"] {
  background-color: #000000 !important;
  color: white !important;
}

#preventive-gaps-list li button[onclick*="viewProofAttachments"],
#gaps-section li button[onclick*="viewProofAttachments"] {
  background-color: #28a745 !important;
  color: white !important;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  #preventive-gaps-list li,
  #gaps-section li {
    padding: 12px !important;
  }
  
  #preventive-gaps-list li .gap-buttons,
  #gaps-section li .gap-buttons {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  
  #preventive-gaps-list li button,
  #gaps-section li button {
    width: 100% !important;
    margin: 2px 0 !important;
  }
}
/* Removed duplicate th, td rules - now handled above with !important */

/* Removed conflicting CSS rules - now handled by simplified table rules above */
table:not(.appointments-table) th {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  font-weight: 600;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.3px;
  position: sticky; /* Keeps headers in place during scroll */
  top: 0;
  z-index: 10;
  white-space: nowrap; /* Prevents header text from wrapping */
  overflow: hidden; /* Hides any overflow text */
  text-overflow: ellipsis; /* Shows ellipsis for overflow text */
}
tr:nth-child(even) {
  background-color: #f8f9fa;
}
tr:hover {
  background-color: #e8f5e8;
  transition: background-color 0.2s ease;
}
/* Removed duplicate td rule - now handled by simplified table rules above */

/* Table column widths are now handled by JavaScript for better alignment */

/* Removed specific table column width rules - handled by JavaScript */

/* All specific table column width rules removed - handled by JavaScript for better alignment */
input, select, button {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  box-sizing: border-box;
}

/* Lab dashboard: prevent global input/button from breaking search layout */
#lab-content .lab-search-wrapper input,
#lab-content .lab-search-wrapper .lab-search-input {
  width: 100% !important;
  margin: 0 !important;
}
#lab-content .lab-search-wrapper .lab-search-clear-btn {
  width: auto !important;
  margin: 0 !important;
}

/* Override for checkboxes to prevent vertical spacing issues */
input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  vertical-align: middle;
}

/* ICD Selector Container Styles */
[id$="-container"] {
  position: relative;
  width: 100%;
  margin: 10px 0;
}

[id$="-container"] input {
  width: 100%;
  padding: 10px;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

[id$="-container"] input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Selected items list styling */
[id$="-list"] {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

[id$="-list"] li {
  display: inline-block;
  margin: 0;
}

/* Mobile responsiveness for ICD selectors */
@media (max-width: 768px) {
  [id$="-container"] {
    margin: 5px 0;
  }
  
  [id$="-container"] input {
    padding: 8px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  [id$="-list"] {
    margin-top: 5px;
    gap: 3px;
  }
  
  [id$="-list"] li {
    font-size: 12px;
    padding: 4px 8px;
  }
  
  /* Responsive table adjustments for mobile */
  table {
    font-size: 12px;
  }
  
  th, td {
    padding: 8px 6px;
  }
  
  /* Make columns more compact on mobile */
  table.medical-visits-table th:nth-child(1), 
  table.medical-visits-table td:nth-child(1) { flex: 0 0 25% !important; } /* Visit Date */
  table.medical-visits-table th:nth-child(2), 
  table.medical-visits-table td:nth-child(2) { flex: 0 0 15% !important; } /* Status */
  table.medical-visits-table th:nth-child(3), 
  table.medical-visits-table td:nth-child(3) { flex: 0 0 60% !important; } /* Note */
  
  /* Patient Medications Table - mobile responsive */
  table.patient-medications-table th:nth-child(1), 
  table.patient-medications-table td:nth-child(1) { flex: 0 0 25% !important; } /* Name */
  table.patient-medications-table th:nth-child(2), 
  table.patient-medications-table td:nth-child(2) { flex: 0 0 20% !important; } /* Dosage */
  table.patient-medications-table th:nth-child(3), 
  table.patient-medications-table td:nth-child(3) { flex: 0 0 15% !important; } /* Start Date */
  table.patient-medications-table th:nth-child(4), 
  table.patient-medications-table td:nth-child(4) { flex: 0 0 15% !important; } /* End Date */
  table.patient-medications-table th:nth-child(5), 
  table.patient-medications-table td:nth-child(5) { flex: 0 0 15% !important; } /* Notes */
  table.patient-medications-table th:nth-child(6), 
  table.patient-medications-table td:nth-child(6) { flex: 0 0 10% !important; } /* Actions */
  
  /* Prescriptions Summary Table - mobile responsive (7 columns) */
  table.prescriptions-summary-table th:nth-child(1), 
  table.prescriptions-summary-table td:nth-child(1) { flex: 0 0 14% !important; } /* Prescription ID */
  table.prescriptions-summary-table th:nth-child(2), 
  table.prescriptions-summary-table td:nth-child(2) { flex: 0 0 10% !important; } /* Date */
  table.prescriptions-summary-table th:nth-child(3), 
  table.prescriptions-summary-table td:nth-child(3) { flex: 0 0 13% !important; } /* Doctor */
  table.prescriptions-summary-table th:nth-child(4), 
  table.prescriptions-summary-table td:nth-child(4) { flex: 0 0 16% !important; } /* Diagnosis */
  table.prescriptions-summary-table th:nth-child(5), 
  table.prescriptions-summary-table td:nth-child(5) { flex: 0 0 10% !important; } /* Medications Count */
  table.prescriptions-summary-table th:nth-child(6), 
  table.prescriptions-summary-table td:nth-child(6) { flex: 0 0 10% !important; } /* Status */
  table.prescriptions-summary-table th:nth-child(7), 
  table.prescriptions-summary-table td:nth-child(7) { flex: 0 0 27% !important; } /* Actions */
  
  /* Clinical Note Prescriptions Table - mobile responsive (6 columns) */
  table.clinical-note-prescriptions-table th:nth-child(1), 
  table.clinical-note-prescriptions-table td:nth-child(1) { flex: 0 0 18% !important; } /* Prescription ID */
  table.clinical-note-prescriptions-table th:nth-child(2), 
  table.clinical-note-prescriptions-table td:nth-child(2) { flex: 0 0 12% !important; } /* Date */
  table.clinical-note-prescriptions-table th:nth-child(3), 
  table.clinical-note-prescriptions-table td:nth-child(3) { flex: 0 0 20% !important; } /* Diagnosis */
  table.clinical-note-prescriptions-table th:nth-child(4), 
  table.clinical-note-prescriptions-table td:nth-child(4) { flex: 0 0 15% !important; } /* Medications Count */
  table.clinical-note-prescriptions-table th:nth-child(5), 
  table.clinical-note-prescriptions-table td:nth-child(5) { flex: 0 0 12% !important; } /* Status */
  table.clinical-note-prescriptions-table th:nth-child(6), 
  table.clinical-note-prescriptions-table td:nth-child(6) { flex: 0 0 23% !important; } /* Actions */
  
  /* Active Medications Table - mobile responsive (7 columns) */
  table.active-medications-table th:nth-child(1), 
  table.active-medications-table td:nth-child(1) { flex: 0 0 18% !important; } /* Medication */
  table.active-medications-table th:nth-child(2), 
  table.active-medications-table td:nth-child(2) { flex: 0 0 15% !important; } /* Strength & Form */
  table.active-medications-table th:nth-child(3), 
  table.active-medications-table td:nth-child(3) { flex: 0 0 20% !important; } /* Directions */
  table.active-medications-table th:nth-child(4), 
  table.active-medications-table td:nth-child(4) { flex: 0 0 13% !important; } /* Prescribed */
  table.active-medications-table th:nth-child(5), 
  table.active-medications-table td:nth-child(5) { flex: 0 0 12% !important; } /* Duration */
  table.active-medications-table th:nth-child(6), 
  table.active-medications-table td:nth-child(6) { flex: 0 0 8% !important; } /* Refills */
  table.active-medications-table th:nth-child(7), 
  table.active-medications-table td:nth-child(7) { flex: 0 0 14% !important; } /* Prescription ID */
  
  /* Upcoming Appointments Table - mobile responsive (4 columns) */
  table.upcoming-appointments-table th:nth-child(1), 
  table.upcoming-appointments-table td:nth-child(1) { flex: 0 0 20% !important; } /* Date */
  table.upcoming-appointments-table th:nth-child(2), 
  table.upcoming-appointments-table td:nth-child(2) { flex: 0 0 15% !important; } /* Time */
  table.upcoming-appointments-table th:nth-child(3), 
  table.upcoming-appointments-table td:nth-child(3) { flex: 0 0 25% !important; } /* Doctor */
  table.upcoming-appointments-table th:nth-child(4), 
  table.upcoming-appointments-table td:nth-child(4) { flex: 0 0 40% !important; } /* Notes */
  
  /* Non-Visit Encounters Table - mobile responsive (5 columns) */
  table.non-visit-encounters-table th:nth-child(1), 
  table.non-visit-encounters-table td:nth-child(1) { flex: 0 0 18% !important; } /* Date */
  table.non-visit-encounters-table th:nth-child(2), 
  table.non-visit-encounters-table td:nth-child(2) { flex: 0 0 25% !important; } /* Reason */
  table.non-visit-encounters-table th:nth-child(3), 
  table.non-visit-encounters-table td:nth-child(3) { flex: 0 0 20% !important; } /* Assigned Doctor */
  table.non-visit-encounters-table th:nth-child(4), 
  table.non-visit-encounters-table td:nth-child(4) { flex: 0 0 15% !important; } /* Status */
  table.non-visit-encounters-table th:nth-child(5), 
  table.non-visit-encounters-table td:nth-child(5) { flex: 0 0 22% !important; } /* Actions */
  
  /* Deleted Patients Table - mobile responsive (3 columns) */
  table.deleted-patients-table th:nth-child(1), 
  table.deleted-patients-table td:nth-child(1) { flex: 0 0 40% !important; } /* Full Name */
  table.deleted-patients-table th:nth-child(2), 
  table.deleted-patients-table td:nth-child(2) { flex: 0 0 25% !important; } /* Deleted On */
  table.deleted-patients-table th:nth-child(3), 
  table.deleted-patients-table td:nth-child(3) { flex: 0 0 35% !important; } /* Actions */
  
  /* Patient Encounters Prescriptions Table - mobile responsive (7 columns) */
  table.encounters-prescriptions-table tr {
    grid-template-columns: 1.5fr 0.8fr 1.5fr 2fr 0.8fr 0.8fr 2.5fr !important;
  }
  
  /* Gaps Summary Table - mobile responsive (5 columns) */
  table.gaps-summary-table tr {
    grid-template-columns: 2fr 1.5fr 1fr 1fr 1.5fr !important;
  }
  
  /* Imaging Orders Table - mobile responsive (6 columns) */
  table.imaging-orders-table tr {
    grid-template-columns: 1.5fr 1fr 1fr 1.5fr 1fr 1.5fr !important;
  }
  
  /* Lab Orders Table - mobile responsive (6 columns) */
  table.lab-orders-table tr {
    grid-template-columns: 1.5fr 1fr 1.5fr 1fr 1.5fr 1fr !important;
  }
}
button:not(.action-btn):not(.pagination-btn) {
  background-color: #4CAF50;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 6px;  /* Rounded edges for all buttons */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);  /* Default raised effect */
  transition: transform 0.2s, box-shadow 0.2s;  /* Smooth hover transition */
}
button:not(.action-btn):not(.pagination-btn):hover {
  background-color: #45a049;
  transform: translateY(-3px);  /* Lift on hover for rise effect */
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);  /* Deeper shadow on hover */
}

/* Ensure prescription button is always visible for doctors */
#new-prescription-btn {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 10 !important;
}

/* Compact and right-aligned prescription button on clinical note */
#new-prescription-btn {
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

/* Proof attachment button styles */
button[style*="background: #007bff"] {
  background-color: #007bff !important;
  font-size: 12px;
  padding: 5px 8px;
  margin: 2px;
  width: auto;
}

button[style*="background: #007bff"]:hover {
  background-color: #0056b3 !important;
}

button[style*="background: #000000"] {
  background-color: #000000 !important;
  color: white !important;
  font-size: 12px;
  padding: 5px 8px;
  margin: 2px;
  width: auto;
}

button[style*="background: #000000"]:hover {
  background-color: #333333 !important;
}

button[style*="background: #28a745"] {
  background-color: #28a745 !important;
  font-size: 12px;
  padding: 5px 8px;
  margin: 2px;
  width: auto;
}

button[style*="background: #28a745"]:hover {
  background-color: #1e7e34 !important;
}

button[style*="background: #dc3545"] {
  background-color: #dc3545 !important;
  font-size: 12px;
  padding: 5px 8px;
  margin: 2px;
  width: auto;
}

button[style*="background: #dc3545"]:hover {
  background-color: #c82333 !important;
}

/* Allergy Selector Button Styling */
#allergy-selector-container button,
#clinical-note-allergy-selector-container button {
  background-color: #6c757d !important; /* Default to gray for clear button */
  color: white !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
  width: auto !important; /* Override global width: 100% rule */
  margin: 0 !important; /* Override global margin rule */
  flex: 1 !important; /* Make buttons equal width in flex container */
}

#allergy-selector-container button:hover,
#clinical-note-allergy-selector-container button:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

/* Clear Selection button */
#allergy-selector-container button[id$="-clear"],
#clinical-note-allergy-selector-container button[id$="-clear"] {
  background-color: #6c757d !important;
}

#allergy-selector-container button[id$="-clear"]:hover,
#clinical-note-allergy-selector-container button[id$="-clear"]:hover {
  background-color: #5a6268 !important;
}

/* Apply/Add to Allergies Table button */
#allergy-selector-container button[id$="-apply"],
#clinical-note-allergy-selector-container button[id$="-apply"] {
  background-color: #007bff !important;
}

#allergy-selector-container button[id$="-apply"]:hover,
#clinical-note-allergy-selector-container button[id$="-apply"]:hover {
  background-color: #0056b3 !important;
}

/* Enhanced button styling for table actions - EXCEPT allergies table */
td button:not(.allergies-table button) {
  font-size: 11px;
  padding: 4px 8px;
  margin: 1px;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

/* Standard action buttons in tables (Edit/Delete) - EXCEPT allergies table */
td button:not([style*="background:"]):not(.allergies-table button) {
  background-color: #4CAF50;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 6px;
  margin: 1px;
  width: 50px;
  height: 24px;
  white-space: nowrap;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

/* SPECIFIC STYLING FOR ALLERGIES TABLE BUTTONS - VERY SMALL SIZE */
.allergies-table .action-buttons button {
  font-size: 8px !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  border-radius: 2px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  min-width: 30px !important;
  min-height: 16px !important;
  white-space: nowrap !important;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1) !important;
  border: none !important;
}

.allergies-table .action-buttons .edit-btn {
  background: #008753 !important;
  color: white !important;
}

.allergies-table .action-buttons .delete-btn {
  background: #dc3545 !important;
  color: white !important;
}

td button:not([style*="background:"]):hover {
  background-color: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(76,175,80,0.4);
  border: 1px solid #3d8b40;
}

/* Enhanced hover effects for proof buttons */
button[style*="background: #007bff"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

button[style*="background: #000000"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

button[style*="background: #28a745"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(40,167,69,0.3);
}

button[style*="background: #dc3545"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(220,53,69,0.3);
}

/* Modal styles for proof attachments */
.modal {
  z-index: 10000;
}

.modal h3 {
  margin-top: 0;
  color: #333;
}

.modal button {
  margin: 5px;
  width: auto;
  display: inline-block;
}
a {
  color: #4CAF50;
  text-decoration: none;
  display: block;
  margin: 10px 0;
}
/* Mobile-friendly */
@media (max-width: 600px) {
  body {
    margin: 10px;
  }
  table, input, button {
    font-size: 14px;
  }
}
label {
  display: block;
  margin-top: 10px;
  font-weight: bold;  /* Optional: Makes labels stand out */
}
/* Dashboard grid layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.dashboard-grid button {
  padding: 20px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;  /* Space between icon and text */
  border-radius: 8px;  /* Slightly larger radius for dashboard buttons */
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);  /* Raised effect (aligned with general) */
  transition: transform 0.2s, box-shadow 0.2s;
}
.dashboard-grid button:hover {
  transform: translateY(-5px);  /* Lift on hover */
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);  /* Deeper shadow on hover */
}
/* New class for horizontal action buttons in tables */
.action-btn {
  width: auto;
  display: inline-block;
  margin: 0 5px;
  padding: 8px 12px;  /* Increased padding for larger size */
  font-size: 14px;  /* Slightly larger font for better fit */
}
/* Center actions in patients table */
#patients-table td:nth-child(4) {
  text-align: center;
  white-space: nowrap; /* Prevent button wrapping */
}
/* Ensure action buttons fit properly */
#patients-table .action-btn {
  margin: 2px;
  padding: 6px 8px;
  font-size: 10px;
  min-width: 150px;
  height: 36px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
  text-align: center;
}
/* Hover effects for action buttons */
#patients-table .action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
/* Specific button colors for better UX */
#patients-table .action-btn:nth-child(1) { /* View button */
  background-color: #0c3b2e;
  color: #ffffff;
}
#patients-table .action-btn:nth-child(2) { /* Edit button */
  background-color: #1b4f9c;
  color: #ffffff;
}
#patients-table .action-btn:nth-child(3) { /* Delete button */
  background-color: #7a1f1f;
  color: #ffffff;
}
#patients-table .action-btn:nth-child(4) { /* Encounter button */
  background-color: #5a2d82;
  color: #ffffff;
}
#patients-table .action-btn:nth-child(5) { /* Appointment button */
  background-color: #b36b00;
  color: #ffffff;
}
#patients-table .action-btn:nth-child(6) { /* Print Summary button */
  background-color: #008753;
  color: #ffffff;
}

/* Hover effect for Print Summary button */
#patients-table .action-btn:nth-child(6):hover {
  background-color: #006b42;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,135,83,0.3);
}

/* Appointment table action buttons */
table .action-btn {
  margin: 3px;
  padding: 8px 12px;
  font-size: 11px;
  min-width: 100px;
  height: 36px;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
  text-align: center;
  border: none;
  cursor: pointer;
  letter-spacing: 0.3px;
}

/* Appointment button colors - more distinct and readable */
table .checkin-btn {
  background-color: #2E7D32 !important; /* Dark green */
  color: white !important;
  border: 1px solid #1B5E20 !important;
}
table .checkin-btn:hover {
  background-color: #1B5E20 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(46,125,50,0.3);
}

table .checkout-btn {
  background-color: #E65100 !important; /* Orange */
  color: white !important;
  border: 1px solid #BF360C !important;
}
table .checkout-btn:hover {
  background-color: #BF360C !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(230,81,0,0.3);
}

table .edit-btn {
  background-color: #1565C0 !important; /* Blue */
  color: white !important;
  border: 1px solid #0D47A1 !important;
}
table .edit-btn:hover {
  background-color: #0D47A1 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(21,101,192,0.3);
}

table .delete-btn {
  background-color: #C62828 !important; /* Red */
  color: white !important;
  border: 1px solid #B71C1C !important;
}
table .delete-btn:hover {
  background-color: #B71C1C !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(198,40,40,0.3);
}

/* Generated Orders View Details Button */
.view-details-btn {
  background-color: #007bff !important;
  color: white !important;
  border: 1px solid #0056b3 !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 90px !important;
  height: 32px !important;
  box-shadow: 0 2px 4px rgba(0,123,255,0.2) !important;
}

.view-details-btn:hover {
  background-color: #0056b3 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0,123,255,0.3) !important;
  border-color: #004085 !important;
}

/* Attach Results Button */
.attach-results-btn {
  background-color: #17a2b8 !important;
  color: white !important;
  border: 1px solid #138496 !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 110px !important;
  height: 32px !important;
  box-shadow: 0 2px 4px rgba(23,162,184,0.2) !important;
}

.attach-results-btn:hover {
  background-color: #138496 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(23,162,184,0.3) !important;
  border-color: #117a8b !important;
}

/* View Results Button */
.view-results-btn {
  background-color: #28a745 !important;
  color: white !important;
  border: 1px solid #1e7e34 !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 110px !important;
  height: 32px !important;
  box-shadow: 0 2px 4px rgba(40,167,69,0.2) !important;
}

.view-results-btn:hover {
  background-color: #1e7e34 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(40,167,69,0.3) !important;
  border-color: #1c7430 !important;
}

table .note-btn {
  background-color: #6A1B9A !important; /* Purple */
  color: white !important;
  border: 1px solid #4A148C !important;
}
table .note-btn:hover {
  background-color: #4A148C !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(106,27,154,0.3);
}

/* Hover effects for appointment buttons */
table .action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
/* Compact textarea design for clinical-note.html */
textarea {
  width: 100%;
  min-height: 40px; /* Compact initial height */
  max-height: 300px; /* Cap max height to prevent overflow */
  resize: vertical; /* Allow vertical resizing only */
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  font-size: 16px; /* Slightly larger font for readability */
  transition: min-height 0.2s ease; /* Smooth transition when expanding */
  overflow-y: auto; /* Show scrollbar when content exceeds max-height */
}

/* Auto-expand textareas when they have content */
#soap-form textarea:focus,
#soap-form textarea:not(:placeholder-shown) {
  min-height: 80px; /* Expand when focused or has content */
}

/* Specific adjustments for clinical-note.html to ensure full page width */
#soap-form textarea {
  width: 100%;
  margin-bottom: 15px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
  textarea {
    min-height: 35px; /* Compact for mobile */
    font-size: 14px;
  }
  #soap-form textarea:focus,
  #soap-form textarea:not(:placeholder-shown) {
    min-height: 70px; /* Expand when focused or has content on mobile */
  }
}

/* Styles for lab tests section in clinical-note.html */
#lab-tests-section table {
  width: 100%;
  border-collapse: collapse;
}
#lab-tests-section td:first-child {
  width: 30px; /* Checkbox column width for ~10mm spacing */
  text-align: center;
}
#lab-tests-section input[type="checkbox"] {
  margin: 0;
}
#lab-tests-section label {
  display: inline; /* Keep label inline with checkbox */
  margin-top: 0; /* Override general label margin */
  vertical-align: middle;
}

/* Specific styling for checkbox labels in both lab and imaging sections */
#lab-tests-section input[type="checkbox"] + label,
#imaging-tests-section input[type="checkbox"] + label {
  display: inline;
  margin-top: 0;
  margin-left: 5px;
  vertical-align: middle;
  font-weight: normal; /* Override bold from general label rule */
}
#lab-tests-section details {
  margin-top: 10px;
}

/* Imaging tests section styling */
#imaging-tests-section input[type="checkbox"] {
  margin: 0;
}

#imaging-tests-section label {
  display: inline;
  margin-top: 0;
  vertical-align: middle;
}

#imaging-tests-section details {
  margin-top: 10px;
}

/* Spacing for lab and imaging test sections */
#lab-tests-section {
  margin-bottom: 20px;
}

#imaging-tests-section {
  margin-top: 10px;
}

/* Immunization section button styling */
.immunization-edit-btn {
  background-color: #28a745 !important;
  color: white !important;
  border: 1px solid #1e7e34 !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 60px !important;
  height: 32px !important;
  box-shadow: 0 2px 4px rgba(40,167,69,0.2) !important;
}

.immunization-edit-btn:hover {
  background-color: #1e7e34 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(40,167,69,0.3) !important;
  border-color: #1c7430 !important;
}

.immunization-delete-btn {
  background-color: #dc3545 !important;
  color: white !important;
  border: 1px solid #c82333 !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 60px !important;
  height: 32px !important;
  box-shadow: 0 2px 4px rgba(220,53,69,0.2) !important;
}

.immunization-delete-btn:hover {
  background-color: #c82333 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(220,53,69,0.3) !important;
  border-color: #bd2130 !important;
}

.immunization-proof-btn {
  background-color: #000000 !important;
  color: white !important;
  border: 1px solid #333333 !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-align: center !important;
  min-width: 80px !important;
  height: 32px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.immunization-proof-btn:hover {
  background-color: #333333 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3) !important;
  border-color: #555555 !important;
}

/* Vital Signs Analysis Styles */
.vital-signs-container {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.vital-signs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 15px;
}

.vital-signs-header h4 {
  margin: 0;
  color: #333;
  font-size: 1.3em;
}

.analysis-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s ease;
}

.analysis-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.vital-signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.vital-sign-item {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  transition: all 0.3s ease;
}

.vital-sign-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.vital-sign-label {
  font-size: 0.85em;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.vital-sign-value {
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
  margin-bottom: 3px;
}

.vital-sign-date {
  font-size: 0.8em;
  color: #999;
}

.vital-sign-trend {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: bold;
  margin-left: 8px;
}

.trend-up {
  background-color: #ffebee;
  color: #c62828;
}

.trend-down {
  background-color: #e8f5e8;
  color: #2e7d32;
}

.trend-stable {
  background-color: #fff3e0;
  color: #ef6c00;
}

.vital-signs-chart {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.vital-signs-chart canvas {
  max-height: 200px;
}

.no-data {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

.vital-signs-insights {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.insight-item {
  background: white;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  border-left: 3px solid #667eea;
  font-size: 0.9em;
}

.insight-item.warning {
  border-left-color: #ffc107;
  background-color: #fffbf0;
}

.insight-item.danger {
  border-left-color: #dc3545;
  background-color: #fff5f5;
}

.insight-item.success {
  border-left-color: #28a745;
  background-color: #f8fff8;
}

/* Conditions Breakdown Table - 9 columns with proper alignment */
table.conditions-breakdown-table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

table.conditions-breakdown-table th,
table.conditions-breakdown-table td {
  padding: 8px 10px !important;
  border: 1px solid #e0e0e0 !important;
  text-align: left !important;
  vertical-align: top !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  margin: 0 !important;
  display: table-cell !important;
}

table.conditions-breakdown-table th {
  background: linear-gradient(135deg, #4CAF50, #45a049) !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  letter-spacing: 0.3px !important;
}

table.conditions-breakdown-table tr:nth-child(even) td {
  background-color: #f8f9fa !important;
}

table.conditions-breakdown-table tr:hover td {
  background-color: #e8f5e8 !important;
}

/* Column widths for 9 columns */
table.conditions-breakdown-table th:nth-child(1),
table.conditions-breakdown-table td:nth-child(1) {
  width: 25% !important; /* Medical Condition */
}

table.conditions-breakdown-table th:nth-child(2),
table.conditions-breakdown-table td:nth-child(2) {
  width: 10% !important; /* Total Count */
}

table.conditions-breakdown-table th:nth-child(3),
table.conditions-breakdown-table td:nth-child(3) {
  width: 8% !important; /* Male */
}

table.conditions-breakdown-table th:nth-child(4),
table.conditions-breakdown-table td:nth-child(4) {
  width: 8% !important; /* Female */
}

table.conditions-breakdown-table th:nth-child(5),
table.conditions-breakdown-table td:nth-child(5) {
  width: 15% !important; /* Tribe */
}

table.conditions-breakdown-table th:nth-child(6),
table.conditions-breakdown-table td:nth-child(6) {
  width: 11% !important; /* 0-18 years */
}

table.conditions-breakdown-table th:nth-child(7),
table.conditions-breakdown-table td:nth-child(7) {
  width: 11% !important; /* 19-25 years */
}

table.conditions-breakdown-table th:nth-child(8),
table.conditions-breakdown-table td:nth-child(8) {
  width: 11% !important; /* 26-65 years */
}

table.conditions-breakdown-table th:nth-child(9),
table.conditions-breakdown-table td:nth-child(9) {
  width: 11% !important; /* 66+ years */
}

/* Condition Stats Table - 4 columns with proper alignment */
table.condition-stats-table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

table.condition-stats-table th,
table.condition-stats-table td {
  padding: 12px 15px !important;
  border: 1px solid #e0e0e0 !important;
  text-align: left !important;
  vertical-align: top !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  margin: 0 !important;
  display: table-cell !important;
}

/* Nigerian Heritage Theme for Condition Stats Table */
table.condition-stats-table th {
  background: linear-gradient(135deg, #008753 0%, #006b42 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  letter-spacing: 0.3px !important;
  border: 1px solid #006b42 !important;
}

table.condition-stats-table tr:nth-child(even) td {
  background-color: rgba(0, 135, 83, 0.1) !important;
}

table.condition-stats-table tr:hover td {
  background-color: rgba(0, 135, 83, 0.3) !important;
}

/* Column widths for 4 columns */
table.condition-stats-table th:nth-child(1),
table.condition-stats-table td:nth-child(1) {
  width: 25% !important; /* Medical Condition */
}

table.condition-stats-table th:nth-child(2),
table.condition-stats-table td:nth-child(2) {
  width: 25% !important; /* Gender Breakdown */
}

table.condition-stats-table th:nth-child(3),
table.condition-stats-table td:nth-child(3) {
  width: 25% !important; /* Tribe Breakdown */
}

table.condition-stats-table th:nth-child(4),
table.condition-stats-table td:nth-child(4) {
  width: 25% !important; /* Age Breakdown */
}

/* Appointments Table - 5 columns with proper alignment */
table.appointments-table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  margin: 20px 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  background-color: white !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
  /* Ensure this table uses standard table layout, not flexbox */
  display: table !important;
}

table.appointments-table thead {
  display: table-header-group !important;
  width: 100% !important;
}

table.appointments-table tbody {
  display: table-row-group !important;
  width: 100% !important;
}

table.appointments-table tr {
  display: table-row !important;
  width: 100% !important;
}

table.appointments-table th,
table.appointments-table td {
  padding: 12px 15px !important;
  border: 1px solid #e0e0e0 !important;
  text-align: left !important;
  vertical-align: top !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  margin: 0 !important;
  /* Ensure cells use standard table cell layout */
  display: table-cell !important;
}

table.appointments-table th {
  background: #0c3b2e !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  letter-spacing: 0.3px !important;
}

table.appointments-table td {
  background: white !important;
}

table.appointments-table tr:nth-child(even) td {
  background-color: #f8f9fa !important;
}

table.appointments-table tr:hover td {
  background-color: #f3efe6 !important;
}

/* Appointments theme overrides (Nigerian heritage palette) */
table.appointments-table a {
  color: #0c3b2e !important;
  font-weight: 600;
  text-decoration: none;
}
table.appointments-table a:hover {
  text-decoration: underline;
}
table.appointments-table .action-btn,
table.appointments-table button.action-btn,
table.appointments-table button {
  background-color: #1b4f9c !important;
  color: #ffffff !important;
  border: 1px solid #123468 !important;
}
table.appointments-table .checkin-btn {
  background-color: #0c3b2e !important;
  border-color: #06251c !important;
}
table.appointments-table .checkout-btn {
  background-color: #2e7d32 !important;
  border-color: #1b5e20 !important;
}
table.appointments-table .edit-btn {
  background-color: #1b4f9c !important;
  border-color: #123468 !important;
}
table.appointments-table .note-btn {
  background-color: #5a2d82 !important;
  border-color: #3d1f59 !important;
}
table.appointments-table .invoice-btn,
table.appointments-table .payment-btn {
  background-color: #b36b00 !important;
  border-color: #7a4300 !important;
}
table.appointments-table .delete-btn {
  background-color: #7a1f1f !important;
  border-color: #4a1212 !important;
}

/* Appointments page final overrides - ensure no global table styles win */
table.appointments-table thead th {
  background: #0c3b2e !important;
  color: #ffffff !important;
  border-color: #0c3b2e !important;
}
table.appointments-table button.action-btn.checkin-btn {
  background-color: #0c3b2e !important;
  border-color: #06251c !important;
}
table.appointments-table button.action-btn.checkout-btn {
  background-color: #2e7d32 !important;
  border-color: #1b5e20 !important;
}
table.appointments-table button.action-btn.edit-btn {
  background-color: #1b4f9c !important;
  border-color: #123468 !important;
}
table.appointments-table button.action-btn.note-btn {
  background-color: #5a2d82 !important;
  border-color: #3d1f59 !important;
}
table.appointments-table button.action-btn.invoice-btn,
table.appointments-table button.action-btn.payment-btn {
  background-color: #b36b00 !important;
  border-color: #7a4300 !important;
}
table.appointments-table button.action-btn.delete-btn {
  background-color: #7a1f1f !important;
  border-color: #4a1212 !important;
}

/* Column widths for 6 columns - using table-layout: fixed for proper alignment */
table.appointments-table th:nth-child(1),
table.appointments-table td:nth-child(1) {
  width: 20% !important; /* Patient Name */
}

table.appointments-table th:nth-child(2),
table.appointments-table td:nth-child(2) {
  width: 12% !important; /* Date */
}

table.appointments-table th:nth-child(3),
table.appointments-table td:nth-child(3) {
  width: 12% !important; /* Time */
}

table.appointments-table th:nth-child(4),
table.appointments-table td:nth-child(4) {
  width: 18% !important; /* Appointment Type */
}

table.appointments-table th:nth-child(5),
table.appointments-table td:nth-child(5) {
  width: 12% !important; /* Visit Duration */
}

table.appointments-table th:nth-child(6),
table.appointments-table td:nth-child(6) {
  width: 26% !important; /* Actions */
}

/* Additional overrides to ensure no flexbox interference */
table.appointments-table * {
  display: revert !important;
}

table.appointments-table,
table.appointments-table thead,
table.appointments-table tbody,
table.appointments-table tr,
table.appointments-table th,
table.appointments-table td {
  display: table !important;
}

table.appointments-table thead {
  display: table-header-group !important;
}

table.appointments-table tbody {
  display: table-row-group !important;
}

table.appointments-table tr {
  display: table-row !important;
}

table.appointments-table th,
table.appointments-table td {
  display: table-cell !important;
}