body {
  font-size: 13px;
  background: #f5f5f5;
}

h1 {
  padding: 24px 24px 16px;
  font-size: 20px;
  font-weight: 700;
}

/* Report value coloring (variance / labor %). These cells live in .table-striped
   tables (e.g. Labor by Location), so feeding the *base* --bs-table-color is not
   enough. Bootstrap 5.3 resolves each cell's text as
   `color: var(--bs-table-color-state, var(--bs-table-color-type, --bs-table-color))`,
   and on odd rows `.table-striped > tbody > tr:nth-of-type(odd) > *` (specificity
   0,2,2) sets --bs-table-color-type to the striped color — which the var() chain
   reads *before* the base and which outranks a bare class (0,1,0). That shadowing
   left striped rows uncolored. We set --bs-table-color-type instead, with
   !important to win the same-property battle against the striped selector (same
   trick the data-source tinting uses below). The plain `color` still covers spans
   and any non-table use. */
.txt-good {
  color: #16a34a;
  --bs-table-color-type: #16a34a !important;
}
.txt-warn {
  color: #d97706;
  --bs-table-color-type: #d97706 !important;
}
.txt-bad {
  color: #dc2626;
  --bs-table-color-type: #dc2626 !important;
}
.txt-muted {
  color: #888;
  --bs-table-color-type: #888 !important;
}

/* Login page dark backdrop */
body.login-bg {
  background: #1a1a2e;
}

/* Farrelli's brand-red button */
.btn-brand {
  background: #c0141c;
  color: #fff;
}
.btn-brand:hover {
  background: #a01018;
  color: #fff;
}

.release-version {
  color: #9ca3af;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.login-release {
  color: #6b7280;
  font-size: 11px;
  opacity: 0.7;
}

.login-card {
  width: min(360px, calc(100vw - 24px));
}

.admin-subnav {
  margin-top: -4px;
}

.admin-subnav .btn-group {
  flex-wrap: wrap;
  gap: 6px;
}

.admin-action-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  max-width: 760px;
}

.admin-action {
  background: #fff;
  border: 1px solid #d1d5db;
  border-left: 6px solid #475569;
  border-radius: 6px;
  color: #111827;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  text-decoration: none;
}

.admin-action:hover {
  border-color: #9ca3af;
  color: #111827;
}

.admin-action-primary {
  border-left-color: #c0141c;
}

.admin-action-title {
  font-size: 16px;
  font-weight: 700;
}

.admin-action-meta {
  color: #6b7280;
}

.admin-overview-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  padding: 8px;
}

.admin-overview-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  display: grid;
  gap: 3px;
  padding: 12px;
  min-width: 0;
}

.admin-overview-label {
  color: #6b7280;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-overview-item strong {
  color: #111827;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.admin-overview-kicker {
  color: #374151;
  font-weight: 700;
}

.admin-overview-item span:last-child,
.admin-overview-empty {
  color: #6b7280;
}

.admin-overview-empty {
  background: #fff;
  border-top: 1px solid #d1d5db;
  margin: 0;
  padding: 12px;
}

.admin-overview-errors {
  border-top: 1px solid #d1d5db;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.admin-overview-error {
  background: #fff;
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
  border-radius: 6px;
  color: #111827;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  text-decoration: none;
}

.admin-overview-error:hover {
  border-color: #ef4444;
  color: #111827;
}

.admin-overview-error-meta {
  color: #7f1d1d;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-overview-error-message {
  color: #374151;
  overflow-wrap: anywhere;
}

.admin-health-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  max-width: 980px;
}

.admin-health-card {
  background: #fff;
  border: 1px solid #d1d5db;
  border-left: 6px solid #64748b;
  border-radius: 6px;
  padding: 14px;
}

.admin-health-card h2 {
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
  padding: 0;
  text-transform: uppercase;
}

.admin-health-card p {
  color: #6b7280;
  margin: 8px 0 0;
}

.admin-health-value {
  color: #111827;
  font-size: 17px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-health-ok {
  border-left-color: #16a34a;
}

.admin-health-warning {
  border-left-color: #f59e0b;
}

.admin-health-failed {
  border-left-color: #dc2626;
}

.admin-id {
  color: #374151;
  --bs-table-color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.admin-status-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.admin-legend,
.admin-source-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-legend-item,
.admin-source-chip {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.admin-status-filter {
  align-items: end;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
}

.admin-status-filter label {
  color: #4b5563;
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
  min-width: 140px;
}

.admin-status-table {
  max-height: 75vh;
}

.admin-status-table th,
.admin-status-table td {
  min-width: 102px;
  white-space: nowrap;
}

.admin-status-table .sticky-date {
  left: 0;
  min-width: 112px;
  position: sticky;
  z-index: 2;
}

.admin-status-table tbody .sticky-date {
  background: #fff;
}

.admin-status-cell {
  border-left: 1px solid #fff;
  border-right: 1px solid #fff;
  font-weight: 600;
  position: relative;
}

.admin-status-ok {
  background: #d9f99d;
  --bs-table-bg: #d9f99d;
  box-shadow: inset 0 0 0 1px #86efac;
  color: #14532d;
  --bs-table-color: #14532d;
}

.admin-status-failed {
  background: #fecaca;
  --bs-table-bg: #fecaca;
  box-shadow: inset 0 0 0 2px #ef4444;
  color: #7f1d1d;
  --bs-table-color: #7f1d1d;
  font-weight: 800;
}

.admin-status-running {
  background: #fde68a;
  --bs-table-bg: #fde68a;
  box-shadow: inset 0 0 0 1px #f59e0b;
  color: #78350f;
  --bs-table-color: #78350f;
}

.admin-status-missing {
  background: #e5e7eb;
  --bs-table-bg: #e5e7eb;
  box-shadow: inset 0 0 0 1px #9ca3af;
  color: #374151;
  --bs-table-color: #374151;
}

.admin-status-partial {
  background: #bfdbfe;
  --bs-table-bg: #bfdbfe;
  box-shadow: inset 0 0 0 1px #60a5fa;
  color: #1e3a8a;
  --bs-table-color: #1e3a8a;
}

.admin-source-head.admin-source-all,
.admin-source-chip.admin-source-all {
  background: #e0f2fe;
  color: #075985;
}

/* Daily report: "Highlight data sources" toggle, legend, and cell tints ---- */

.admin-source-toggle {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  user-select: none;
}

/* Family palette, shared by the legend chips and the row tints. */
.src-toast {
  background: #d9f99d;
  color: #14532d;
}

.src-7shifts {
  background: #bfdbfe;
  color: #1e3a8a;
}

.src-json {
  background: #fde68a;
  color: #78350f;
}

.src-computed {
  background: #e5e7eb;
  color: #374151;
}

.src-other {
  background: #f5d0fe;
  color: #701a75;
}

/* Per-cell tinting for the Daily report, where individual value cells carry
   data-source-family. !important beats Bootstrap's table-striped row variable. */
.sources-highlighted td[data-source-family="toast"] {
  background-color: #d9f99d !important;
}

.sources-highlighted td[data-source-family="7shifts"] {
  background-color: #bfdbfe !important;
}

.sources-highlighted td[data-source-family="json"] {
  background-color: #fde68a !important;
}

.sources-highlighted td[data-source-family="computed"] {
  background-color: #e5e7eb !important;
}

.sources-highlighted td[data-source-family="other"] {
  background-color: #f5d0fe !important;
}

.admin-hover-panel {
  background: #111827;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgb(0 0 0 / 22%);
  color: #fff;
  display: none;
  font-weight: 600;
  left: 50%;
  min-width: 190px;
  padding: 10px;
  position: absolute;
  text-align: left;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: normal;
  z-index: 20;
}

.admin-hover-panel::before {
  border: 6px solid transparent;
  border-bottom-color: #111827;
  content: "";
  left: 50%;
  position: absolute;
  top: -12px;
  transform: translateX(-50%);
}

.admin-status-cell:hover .admin-hover-panel,
.admin-status-cell:focus-within .admin-hover-panel {
  display: block;
}

.admin-location-section {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}

.admin-location-heading {
  background: #111827;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  padding: 10px 12px;
}

.admin-detail-table {
  margin-bottom: 0;
  table-layout: fixed;
}

.admin-detail-source {
  width: 150px;
}

.admin-detail-status {
  width: 88px;
}

.admin-detail-records {
  width: 88px;
}

.admin-detail-actions {
  width: 104px;
}

.admin-detail-time {
  color: #4b5563;
  --bs-table-color: #4b5563;
  font-size: 12px;
  white-space: normal;
  word-break: break-word;
}

.admin-error-cell {
  border-left: 1px solid #d1d5db;
  font-size: 12px;
  max-width: 1px;
  padding-left: 14px !important;
  white-space: normal;
  word-break: break-word;
}

.admin-detail-table th:nth-child(6),
.admin-history-table th:nth-child(6) {
  border-left: 1px solid #9ca3af;
  padding-left: 14px;
}

.admin-detail-table td:nth-child(5),
.admin-history-table td:nth-child(5) {
  background: #f9fafb;
}

.admin-detail-table th:nth-child(7),
.admin-detail-table td:nth-child(7) {
  padding-left: 14px;
}

.admin-history-row td {
  background: #f9fafb;
  padding-left: 28px;
}

.admin-history-row summary {
  color: #374151;
  cursor: pointer;
  font-weight: 700;
}

.admin-history-table {
  table-layout: fixed;
}

@media (max-width: 575.98px) {
  h1 {
    padding: 18px 12px 12px;
  }

  .navbar .container-fluid {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
  }

  .navbar-brand {
    min-width: 0;
  }

  .navbar-brand span {
    white-space: normal;
  }

  .navbar-nav {
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px 8px;
    justify-content: flex-start;
    margin-left: 0 !important;
  }

  .admin-subnav {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .admin-subnav .btn-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .admin-subnav .btn-group > .btn {
    border-radius: 4px !important;
    margin-left: 0 !important;
    min-width: 0;
  }

  .admin-overview-grid,
  .admin-action-grid {
    grid-template-columns: 1fr;
  }
}
