html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--bs-secondary-color);
}

.list-toolbar {
  max-width: 28rem;
  margin-bottom: 1rem;
}

.list-surface {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background-color: var(--bs-body-bg);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.list-surface .table {
  min-width: 760px;
}

.list-surface .table thead th {
  padding: 0.8rem 1rem;
  color: #343a40;
  background-color: #e2e3e5;
  border-bottom-width: 1px;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.list-surface .table tbody td {
  padding: 0.85rem 1rem;
}

.action-group {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
}

.action-group .btn {
  border-radius: 0.25rem;
  white-space: nowrap;
}

.list-empty-state {
  padding: 3rem 1rem;
}

.help-surface {
  margin-bottom: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background-color: var(--bs-body-bg);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.help-intro {
  max-width: 48rem;
  margin-bottom: 2rem;
}

.help-eyebrow {
  color: var(--bs-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.help-intro h2 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.help-feature h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.help-feature p,
.help-section p {
  color: var(--bs-secondary-color);
}

.help-layout {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
}

.help-navigation {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0;
}

.help-navigation a {
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.help-navigation a:hover,
.help-navigation a:focus-visible {
  color: var(--bs-primary);
}

.help-content .help-surface:last-child {
  margin-bottom: 0;
}

.help-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
}

.help-section ol {
  padding-left: 1.25rem;
}

.help-section li {
  margin-bottom: 0.4rem;
}

.form-surface,
.record-surface {
  max-width: 52rem;
  padding: 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background-color: var(--bs-body-bg);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.form-surface-narrow {
  max-width: 36rem;
}

.form-content .form-label {
  font-weight: 600;
}

.form-section-title {
  margin-bottom: 1rem;
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-actions,
.record-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--bs-border-color);
}

.record-details dt {
  margin-bottom: 0.35rem;
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.record-details dd {
  margin-bottom: 1rem;
}

.section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.delete-surface {
  max-width: 52rem;
}

.department-detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.department-detail-metric {
  min-width: 0;
  padding-right: 1rem;
  border-right: 1px solid var(--bs-border-color);
}

.department-detail-metric:last-child {
  padding-right: 0;
  border-right: 0;
}

.department-detail-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--bs-secondary-color);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.department-detail-metric strong {
  display: block;
  overflow-wrap: anywhere;
}

.department-health-status {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.department-health-good {
  color: #198754;
}

.department-health-watch {
  color: #b58105;
}

.department-health-high {
  color: #dc3545;
}

.department-health-over {
  color: #8b0000;
}

.department-health-neutral {
  color: var(--bs-secondary-color);
}

.progress-bar.department-health-good {
  background-color: #198754;
}

.progress-bar.department-health-watch {
  background-color: #ffc107;
}

.progress-bar.department-health-high {
  background-color: #dc3545;
}

.progress-bar.department-health-over {
  background-color: #8b0000;
}

.progress-bar.department-health-neutral {
  background-color: var(--bs-secondary-color);
}

.department-health-cell {
  min-width: 9rem;
}

.dashboard-metrics .card-body {
  padding: 0.75rem;
}

.dashboard-metric {
  min-width: 0;
  padding: 0.25rem 0.5rem;
}

.dashboard-metric small {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.dashboard-metric h4 {
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  white-space: nowrap;
}

.department-summary-body {
  padding: 1rem;
}

.department-budget-badge {
  color: var(--budget-color);
  background-color: color-mix(in srgb, var(--budget-color) 12%, white);
  border: 1px solid color-mix(in srgb, var(--budget-color) 30%, white);
  font-weight: 600;
  white-space: nowrap;
}

.department-empty-state {
  background-color: var(--bs-light);
}

.department-summary-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.department-summary-card:hover,
.text-decoration-none:focus-visible .department-summary-card {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.department-summary-action {
  color: var(--bs-primary);
}

@media (max-width: 420px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .btn {
    align-self: flex-start;
  }

  .list-toolbar {
    max-width: none;
  }

  .help-surface {
    padding: 1rem;
  }

  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-navigation {
    margin-bottom: 0;
  }

  .form-surface,
  .record-surface {
    padding: 1rem;
  }

  .form-actions,
  .record-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .btn,
  .record-actions .btn {
    width: 100%;
  }

  .department-detail-metrics {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .department-detail-metric,
  .department-detail-metric:last-child {
    padding: 0.85rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--bs-border-color);
  }

  .department-detail-metric:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .dashboard-metric {
    padding-inline: 0.2rem;
  }

  .dashboard-metric small {
    font-size: 0.58rem;
  }

  .dashboard-metric h4 {
    font-size: 1rem;
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}