:root {
  --color-navy: #1a3a5c;
  --color-navy-hover: #254e7a;
  --color-surface: #fff;
  --color-bg: #f4f6f8;
  --color-text: #333;
  --color-border: #eaecef;
  --color-row-alt: #f8f9fb;
  --active-bg: #e8f0fe;
  --color-link: #1a5fb4;
  --color-shadow: rgba(0, 0, 0, 0.1);
  --focus-color: #1a3a5c;
  --transition: 0.2s ease;
}

body.high-contrast {
  --color-navy: #000;
  --color-navy-hover: #222;
  --color-surface: #000;
  --color-bg: #000;
  --color-text: #fff;
  --color-border: #fff;
  --color-row-alt: #111;
  --active-bg: #222;
  --color-link: #7dd3fc;
  --color-shadow: rgba(255, 255, 255, 0.2);
  --focus-color: #fff;
  background: #000 !important;
  color: #fff !important;
}

body.high-contrast .table-wrapper {
  border: 0.125rem solid #fff;
  background: #000 !important;
}

body.high-contrast #incidents-table {
  background: #000 !important;
}

body.high-contrast #incidents-table thead tr {
  background: #000 !important;
  border-bottom: 0.125rem solid #fff;
}

body.high-contrast #incidents-table td {
  color: #fff !important;
  border-bottom-color: #fff !important;
  background: #000 !important;
}

body.high-contrast #incidents-table tbody tr:hover td {
  background: #222 !important;
}

body.high-contrast #incidents-table a {
  color: #ffd600 !important;
}

body.high-contrast .btn-outline {
  border-color: #fff !important;
  color: #fff !important;
  background: transparent !important;
}

body.high-contrast .btn-primary {
  background: #333 !important;
  border-color: #fff !important;
  color: #fff !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-size: 1rem;
  color: var(--color-text);
  transition:
    background var(--transition),
    color var(--transition);
  box-sizing: border-box;
}

.text-only-container {
  padding: 0.5rem;
}

.container {
  max-width: 75rem;
  margin: 0 auto;
}

.controls {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.controls-right {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 2.75rem;
  padding: 0 1rem;
  font-size: 1rem !important;
  line-height: 1;
  border-radius: 0.25rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border: 0.125rem solid transparent;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.btn-primary {
  background: var(--color-navy);
  color: #fff !important;
  border-color: var(--color-navy);
}

.btn-primary:hover {
  background: var(--color-navy-hover);
  border-color: var(--color-navy-hover);
}

.btn-outline {
  background: transparent;
  color: var(--color-navy);
  border-color: var(--color-navy);
}

.btn-outline:hover {
  background: var(--active-bg);
}

a.btn.btn-outline {
  text-decoration: none;
}

:focus-visible {
  outline: 0.125rem solid var(--focus-color);
  outline-offset: 0.125rem;
}

.table-wrapper {
  border-radius: 0.5rem;
  box-shadow: 0 0.0625rem 0.25rem var(--color-shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#incidents-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface) !important;
  table-layout: fixed;
}

#incidents-table th:nth-child(1) {
  width: 38%;
}
#incidents-table th:nth-child(2) {
  width: 24%;
}
#incidents-table th:nth-child(3) {
  width: 18%;
}
#incidents-table th:nth-child(4) {
  width: 20%;
}

#incidents-table thead tr {
  background: var(--color-navy);
  color: #fff;
  text-align: left;
}

#incidents-table th {
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
}

#incidents-table th button {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: #fff !important;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  text-align: left;
  min-height: 2.75rem;
  font-family: inherit;
}

#incidents-table th button:hover {
  background: var(--color-navy-hover);
}

#incidents-table th button:focus-visible {
  outline: 0.1875rem solid #fff;
  outline-offset: -0.1875rem;
  background: var(--color-navy-hover);
}

#incidents-table th .sort-icon {
  display: none;
  font-style: normal;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

#incidents-table th[aria-sort] .sort-icon {
  display: inline;
}

#incidents-table td {
  padding: 0.6875rem 1rem;
  font-size: 1rem;
  border-bottom: 0.0625rem solid var(--color-border);
  color: var(--color-text);
  word-break: break-word;
}

#incidents-table tbody tr:last-child td {
  border-bottom: none;
}

#incidents-table tbody tr:nth-child(even) {
  background: var(--color-row-alt);
}

#incidents-table tbody tr:hover {
  background: var(--active-bg);
}

#incidents-table a {
  color: var(--color-link) !important;
  text-decoration: none;
  font-weight: 500;
  font-size: inherit !important;
  line-height: inherit !important;
}

#incidents-table a:hover {
  text-decoration: underline;
}

#incidents-table a:focus-visible {
  outline: 0.125rem solid var(--focus-color) !important;
  /* border: none !important; */
  background-color: transparent !important;
  box-shadow: none !important;
}

.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Force correct table display — prevents CMS global CSS from stacking rows or hiding the header on mobile */
#incidents-table {
  display: table !important;
}

#incidents-table thead {
  display: table-header-group !important;
}

#incidents-table tbody {
  display: table-row-group !important;
}

#incidents-table tr {
  display: table-row !important;
}

#incidents-table th {
  display: table-cell !important;
}

#incidents-table td {
  display: table-cell !important;
  float: none !important;
  position: static !important;
}

@media screen and (max-width: 640px) {
  .btn {
    height: 2.25rem;
    padding: 0 0.625rem;
    font-size: 1rem;
  }

  #incidents-table th button {
    padding: 0.5rem 0.625rem;
    font-size: 1rem;
    min-height: 2.25rem;
  }

  #incidents-table td {
    padding: 0.5rem 0.625rem;
    font-size: 1rem;
  }
}

td[data-label='Type'] a {
  outline: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

td[data-label='Type'] a:focus,
td[data-label='Type'] a:focus-visible,
td[data-label='Type'] a:active,
td[data-label='Type'] a:hover {
  outline: 2px solid black !important;
  outline-offset: 4px;
  box-shadow: none !important;
  text-decoration: none !important;
  background: transparent !important;
}
