.tbmd-dashboard {
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid #dcdcde;
  border-radius: 12px;
  padding: 20px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tbmd-dashboard-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}
.tbmd-dashboard-header p {
  margin: 0 0 16px;
}
.tbmd-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tbmd-tab-button {
  border: 1px solid #0a4b78;
  background: #fff;
  color: #0a4b78;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}
.tbmd-tab-button.is-active {
  background: #0a4b78;
  color: #fff;
}
.tbmd-filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.tbmd-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tbmd-filter-field label {
  font-weight: 700;
}
.tbmd-filter-field select {
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid #8c8f94;
  border-radius: 6px;
  background: #fff;
}
.tbmd-section-live {
  margin-bottom: 28px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}
.tbmd-section-header {
  display: block;
  margin-bottom: 12px;
}
.tbmd-section-header h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}
.tbmd-section-header p {
  margin: 0;
}
.tbmd-chart-wrap {
  min-height: 160px;
}
.tbmd-chart-wrap-full {
  width: 100%;
  min-height: 220px;
  margin: 0 0 16px;
}
.tbmd-table-wrap {
  overflow: auto;
  max-height: 560px;
  border: 1px solid #dcdcde;
  border-radius: 8px;
}
.tbmd-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  --tbmd-header-height: 41px;
}
.tbmd-table th,
.tbmd-table td {
  border: 1px solid #dcdcde;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}
.tbmd-table th:first-child,
.tbmd-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
}
.tbmd-table thead th {
  background: #003f87;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 0;
}
.tbmd-table tbody tr:nth-child(even) td {
  background: #f3f4f6;
}
.tbmd-table tbody tr:nth-child(odd) td {
  background: #fff;
}
.tbmd-table tbody tr:nth-child(even) td:first-child,
.tbmd-table tbody tr:nth-child(odd) td:first-child {
  position: sticky;
  left: 0;
}
.tbmd-alert-cell {
  color: #c62828;
  font-weight: 700;
}
.tbmd-empty,
.tbmd-loading {
  padding: 16px;
  border: 1px solid #dcdcde;
  background: #fff;
}
@media (max-width: 900px) {
  .tbmd-section-header {
    grid-template-columns: 1fr;
  }
}


.tbmd-table tbody tr.tbmd-total-row td {
  background: #fcd116 !important;
  color: #000 !important;
  font-weight: 700;
}
.tbmd-table tbody tr.tbmd-total-row td:first-child {
  background: #fcd116 !important;
  color: #000 !important;
}
.tbmd-table tbody tr.tbmd-total-row .tbmd-alert-cell {
  color: #c62828 !important;
}

.tbmd-table tbody tr.tbmd-total-row td {
  position: sticky;
  top: var(--tbmd-header-height, 41px);
  z-index: 3;
  border-top: 0;
}
.tbmd-table thead th:first-child {
  z-index: 6;
}
.tbmd-table tbody tr.tbmd-total-row td:first-child {
  z-index: 5;
}

.tbmd-volunteers {
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid #dcdcde;
  border-radius: 12px;
  padding: 20px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tbmd-volunteers h2 {
  margin: 0 0 16px;
  font-size: 1.5rem;
}
.tbmd-volunteer-table-wrap {
  overflow-x: auto;
  border: 1px solid #dcdcde;
  border-radius: 8px;
}
.tbmd-volunteer-table th,
.tbmd-volunteer-table td {
  text-align: left;
}
.tbmd-volunteer-table th:first-child,
.tbmd-volunteer-table td:first-child {
  position: static;
}
.tbmd-volunteer-table a {
  font-weight: 600;
}

/* District volunteer shortcode tables */
.tbmd-volunteer-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: none;
  border-radius: 0;
}
.tbmd-volunteer-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
.tbmd-volunteer-table th,
.tbmd-volunteer-table td {
  border: none !important;
  text-align: left;
}
.tbmd-volunteer-table th:first-child,
.tbmd-volunteer-table td:first-child {
  position: static;
  left: auto;
}

.tbmd-vacant {
  color: #000;
  font-style: italic;
}

.tbmd-column-note {
  border-top: 3px solid #003f87;
  background: #f6f8fb;
  color: #1f2937;
  padding: 10px 12px;
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
}
.tbmd-risk-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 12px;
  font-size: 0.9rem;
}
.tbmd-risk-legend-item {
  font-weight: 700;
}
.tbmd-risk-low {
  color: #2e7d32;
  font-weight: 700;
}
.tbmd-risk-medium {
  color: #b77900;
  font-weight: 700;
}
.tbmd-risk-high,
.tbmd-alert-cell {
  color: #c62828;
  font-weight: 700;
}
.tbmd-table tbody tr.tbmd-total-row .tbmd-risk-low {
  color: #2e7d32 !important;
}
.tbmd-table tbody tr.tbmd-total-row .tbmd-risk-medium {
  color: #8a5a00 !important;
}
.tbmd-table tbody tr.tbmd-total-row .tbmd-risk-high,
.tbmd-table tbody tr.tbmd-total-row .tbmd-alert-cell {
  color: #c62828 !important;
}


/* Responsive refinements */
.tbmd-mobile-scroll-note {
  display: none;
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
}
.tbmd-table-wrap,
.tbmd-volunteer-table-wrap {
  -webkit-overflow-scrolling: touch;
}
.tbmd-table th,
.tbmd-table td {
  vertical-align: middle;
}

@media (max-width: 760px) {
  .tbmd-dashboard,
  .tbmd-volunteers {
    padding: 14px;
    border-radius: 10px;
  }
  .tbmd-dashboard-header h1 {
    font-size: 1.55rem;
    line-height: 1.2;
  }
  .tbmd-tabs {
    gap: 8px;
  }
  .tbmd-tab-button {
    flex: 1 1 120px;
    padding: 9px 10px;
  }
  .tbmd-filters {
    gap: 10px;
  }
  .tbmd-filter-field {
    width: 100%;
  }
  .tbmd-filter-field select {
    width: 100%;
    min-width: 0;
  }
  .tbmd-section-header h2,
  .tbmd-volunteers h2 {
    font-size: 1.25rem;
  }
  .tbmd-chart-wrap-full {
    min-height: 260px;
  }
  .tbmd-mobile-scroll-note {
    display: block;
  }
  .tbmd-table-wrap {
    max-height: 430px;
  }
  .tbmd-table {
    font-size: 12px;
  }
  .tbmd-table th,
  .tbmd-table td {
    padding: 7px 8px;
  }
  .tbmd-table tbody tr.tbmd-total-row td {
    top: var(--tbmd-header-height, 38px);
  }
  .tbmd-risk-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  /* District volunteer tables collapse into two-line cards on small screens. */
  .tbmd-volunteer-table-wrap {
    overflow: visible;
  }
  .tbmd-volunteer-table,
  .tbmd-volunteer-table thead,
  .tbmd-volunteer-table tbody,
  .tbmd-volunteer-table th,
  .tbmd-volunteer-table td,
  .tbmd-volunteer-table tr {
    display: block;
    width: 100%;
  }
  .tbmd-volunteer-table thead {
    position: absolute;
    left: -9999px;
    height: 1px;
    overflow: hidden;
  }
  .tbmd-volunteer-table tr {
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0 0 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  .tbmd-volunteer-table tbody tr:nth-child(even) td,
  .tbmd-volunteer-table tbody tr:nth-child(odd) td {
    background: transparent;
  }
  .tbmd-volunteer-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
  }
  .tbmd-volunteer-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #475569;
    flex: 0 0 42%;
  }
  .tbmd-volunteer-table td:first-child {
    font-weight: 700;
  }
}
