:root {
  --brand-blue: #154788;
  --brand-blue-dark: #0e3263;
  --brand-blue-soft: #eaf1fb;
  --brand-red: #d9271e;
  --brand-green: #168446;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #1d2433;
  --muted: #647084;
  --border: #d9e0ea;
  --shadow: 0 10px 28px rgba(16, 34, 66, 0.14);
  --radius: 6px;
  --font-scale: 1;
  --content-width: 1560px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: calc(16px * var(--font-scale));
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="file"] {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  color: #fff;
  background: var(--brand-blue);
}

.accessibility-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 8px 20px 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
}

.link-button {
  border: 0;
  padding: 0;
  color: #fff;
  background: transparent;
  font-weight: 700;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 30px 20px 54px;
}

.brand-logo {
  width: 108px;
  height: 118px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 2.1rem;
  line-height: 1.12;
}

.subtitle {
  margin-bottom: 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.45;
}

main {
  width: min(var(--content-width), calc(100% - 48px));
  margin: -30px auto 0;
  flex: 1;
}

.filters-panel,
.content-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filters-panel {
  padding: 20px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field[hidden] {
  display: none;
}

.search-field {
  grid-column: 1 / -1;
}

select,
input[type="search"],
input[type="text"],
input[type="password"],
input[type="file"],
input:not([type]) {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 8px 11px;
  font-weight: 400;
}

select:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
input:not([type]):focus,
button:focus-visible {
  outline: 3px solid rgba(19, 82, 209, 0.25);
  outline-offset: 2px;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.button-primary {
  background: var(--brand-blue);
  color: #fff;
}

.button-secondary {
  background: #fff;
  color: var(--brand-blue-dark);
  border-color: var(--border);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.export-menu {
  position: relative;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  min-width: 150px;
  padding: 8px 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 8px 18px rgba(16, 34, 66, 0.2);
}

.menu-panel button {
  display: block;
  width: 100%;
  border: 0;
  padding: 13px 16px;
  background: #fff;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
}

.menu-panel button:hover,
.menu-panel button:focus-visible {
  background: var(--brand-blue-soft);
}

.content-area {
  margin-top: 22px;
  overflow: hidden;
}

.content-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.content-title h2 {
  margin-bottom: 5px;
  font-size: 1.16rem;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary {
  display: grid;
  min-width: 148px;
  border-left: 4px solid var(--brand-green);
  padding-left: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: left;
}

.summary-inline {
  width: max-content;
  margin: 18px 20px;
}

.summary strong {
  color: var(--text);
  font-size: 1.65rem;
  line-height: 1;
}

.status-message {
  margin: 20px;
  border: 1px solid #c8d7f5;
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
}

.table-shell {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1220px;
  font-size: 0.84rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5fb;
  color: #344157;
  font-size: 0.68rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0;
}

th button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-transform: inherit;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:nth-child(even) {
  background: var(--surface-muted);
}

tbody tr:hover,
tbody tr:focus {
  background: #e7efff;
}

tbody tr.selected {
  background: #dce8ff;
  box-shadow: inset 4px 0 0 var(--brand-blue);
}

td {
  line-height: 1.25;
}

th:nth-child(1),
td:nth-child(1) {
  width: 78px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 230px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 125px;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  width: 105px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 105px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 210px;
}

th:nth-child(8),
td:nth-child(8) {
  width: 370px;
}

.cell-main {
  font-weight: 700;
}

.cell-muted {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 22px 20px 26px;
  border-top: 1px solid var(--border);
}

.page-button {
  min-width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  text-align: center;
}

.page-button:hover:not(:disabled),
.page-button:focus-visible {
  background: var(--brand-blue-soft);
}

.page-button.active {
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
}

.page-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 30px;
  padding: 20px;
  color: var(--muted);
  font-size: 0.875rem;
}

.admin-panel {
  max-width: 760px;
  margin-inline: auto;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.admin-header h2 {
  margin-bottom: 5px;
}

.status-error {
  border-color: #f1b8b8;
  border-left-color: #b42318;
  background: #fff3f3;
  color: #7a1a14;
}

.status-success {
  border-color: #b9dfc8;
  border-left-color: var(--brand-green);
  background: #f0fff5;
  color: #115c2d;
}

body.high-contrast {
  --brand-blue: #003f9e;
  --brand-blue-dark: #001f54;
  --brand-blue-soft: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f0f0f0;
  --text: #000000;
  --muted: #222222;
  --border: #000000;
  --shadow: none;
}

@media (max-width: 860px) {
  .brand-header {
    align-items: flex-start;
    padding-bottom: 46px;
  }

  .brand-logo {
    width: 84px;
    height: 92px;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-title {
    flex-direction: column;
  }

  .summary {
    min-width: auto;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 20px, 1180px);
  }

  .accessibility-strip {
    justify-content: flex-start;
    padding-inline: 14px;
  }

  .brand-header {
    gap: 14px;
    padding: 24px 14px 42px;
  }

  .brand-logo {
    width: 64px;
    height: 70px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .filters-panel {
    padding: 14px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .button {
    width: 100%;
  }

  .export-menu {
    width: 100%;
  }

  .menu-panel {
    left: 0;
    right: 0;
  }

  .content-title {
    padding: 16px;
  }

  .status-message {
    margin: 16px;
  }

  .pagination {
    flex-wrap: wrap;
  }
}
