:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eceff2;
  --text: #182027;
  --muted: #5d6a75;
  --line: #d7dee5;
  --accent: #a6a6a6;
  --accent-dark: #737373;
  --warn: #a3551f;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(24, 32, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.login-view {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-card {
  max-width: 420px;
  width: 100%;
}

.login-card h1 {
  color: var(--text);
  margin-bottom: 10px;
}

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

.topbar {
  align-items: center;
  background: #182027;
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 86px;
  padding: 18px clamp(16px, 4vw, 48px);
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  display: block;
  flex: 0 0 auto;
  height: 58px;
  object-fit: cover;
  width: 58px;
}

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.eyebrow {
  color: #c9ced3;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2.4rem);
}

.version-label {
  color: #c9ced3;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 5px 0 0;
}

h2 {
  font-size: 1rem;
}

main {
  margin: 0 auto;
  max-width: 1280px;
  padding: 22px clamp(16px, 4vw, 48px) 48px;
}

.status {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #eaf6f3;
  font-size: 0.9rem;
  padding: 8px 12px;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.summary-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 14px;
}

.summary-grid span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.summary-grid strong {
  display: block;
  font-size: 1.35rem;
  min-height: 32px;
}

.submission-panel {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 16px;
}

.submission-panel h2 {
  margin: 0 0 5px;
}

.submission-panel .hint {
  margin: 0;
}

.ref-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 560px;
}

.ref-submission-detail {
  margin-top: 20px;
}

.ref-submission-detail h3 {
  margin: 22px 0 10px;
}

.tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.qualification-alerts {
  display: grid;
  gap: 8px;
  margin: 12px auto 0;
  max-width: 1500px;
  padding: 0 24px;
}

.qualification-alert {
  border: 1px solid;
  border-radius: 6px;
  font-weight: 700;
  padding: 10px 14px;
}

.qualification-alert.expired {
  background: #fbe9e7;
  border-color: #c83d31;
  color: #7a2119;
}

.qualification-alert.warning {
  background: #fff6d9;
  border-color: #dba313;
  color: #745300;
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 12px 14px;
}

.country-flag {
  border: 1px solid #7d8790;
  display: inline-flex;
  flex-direction: column;
  height: 18px;
  margin-left: 5px;
  overflow: hidden;
  vertical-align: -4px;
  width: 29px;
}

.country-flag i {
  display: block;
  flex: 1;
}

.country-flag-de i:nth-child(1) { background: #1f1f1f; }
.country-flag-de i:nth-child(2) { background: #d51e32; }
.country-flag-de i:nth-child(3) { background: #f5ca1a; }

.country-flag-at i:nth-child(1),
.country-flag-at i:nth-child(3) { background: #d71920; }
.country-flag-at i:nth-child(2) { background: #ffffff; }
}

.tab.active {
  border-color: var(--accent);
  color: var(--text);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.form-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 20px;
}

.qualification-form {
  margin: 20px 0;
}

.qualification-tfs {
  max-width: 300px;
}

.qualification-divider {
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.qualification-heading,
.qualification-entry {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
}

.qualification-heading {
  align-items: center;
}

.qualification-heading h3 {
  font-size: 1rem;
  margin: 0;
}

.qualification-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.qualification-entries {
  display: grid;
  gap: 10px;
}

@media (max-width: 640px) {
  .qualification-alerts {
    padding: 0 14px;
  }

  .qualification-heading,
  .qualification-entry {
    grid-template-columns: 1fr;
  }
}

form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  padding: 16px;
}

.field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #c9d2da;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

.route-picker {
  position: relative;
}

.route-picker-menu {
  background: #fff;
  border: 1px solid #c9d2da;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 10px 24px rgba(22, 33, 42, 0.18);
  display: none;
  left: 0;
  max-height: 320px;
  overflow-y: auto;
  position: absolute;
  right: 0;
  top: calc(100% - 1px);
  z-index: 20;
}

.route-picker.open .route-picker-menu {
  display: block;
}

.route-picker-option {
  align-items: flex-start;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e1e6ea;
  color: var(--text);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 3px;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.route-picker-option:hover,
.route-picker-option:focus {
  background: #eef1f3;
  outline: 0;
}

.route-picker-option small,
.route-picker-empty {
  color: var(--muted);
  font-size: 0.75rem;
}

.route-picker-empty {
  padding: 10px;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

button.primary {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #182027;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

.ghost {
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  text-decoration: none;
}

.restore-form {
  background: transparent;
  border: 0;
  display: inline-flex;
  padding: 0;
}

button.primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

button.secondary {
  background: #eef0f2;
  border: 1px solid #c7ccd1;
  border-radius: 6px;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 0 16px;
}

button.danger {
  border-color: #c9a2a2;
  color: #8f1f1f;
}

button.danger:hover {
  background: #f8eeee;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  margin-bottom: 20px;
}

.view-switch {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
}

.view-button,
.at-view-button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 36px;
  padding: 0 14px;
}

.view-button.active,
.at-view-button.active {
  background: var(--accent);
  color: var(--text);
}

.matrix-toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-bottom: 12px;
  padding: 12px;
}

.matrix-toolbar label {
  max-width: 140px;
}

.checkbox-label {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  max-width: none !important;
}

.checkbox-label input {
  min-height: auto;
  width: auto;
}

#routeMatrixView,
#atRouteMatrixView {
  margin-left: calc(50% - 50vw + 16px);
  width: calc(100vw - 32px);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 820px;
  width: 100%;
}

#usersTable input,
#usersTable select {
  min-width: 110px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 13px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #a6a6a6;
  color: #182027;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.matrix-wrap {
  max-height: 68vh;
  overflow: auto;
}

.matrix-table {
  min-width: 1540px;
}

.matrix-table th,
.matrix-table td {
  padding: 8px 10px;
}

.matrix-table th[rowspan],
.matrix-table td:nth-child(-n + 5) {
  min-width: 108px;
}

.matrix-table .month-group {
  text-align: center;
}

.matrix-table thead th {
  position: sticky;
  z-index: 2;
}

.matrix-table thead tr:first-child th {
  top: 0;
}

.matrix-table thead tr:nth-child(2) th {
  top: 33px;
}

.matrix-region-row td {
  background: #eceff1;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 0;
}

.matrix-region-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #182027;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 10px;
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 12px;
  text-align: left;
  width: 100%;
}

.matrix-region-toggle:hover {
  background: #dde3e7;
}

.matrix-region-icon {
  align-items: center;
  background: #a6a6a6;
  border-radius: 4px;
  display: inline-flex;
  height: 20px;
  justify-content: center;
  line-height: 1;
  width: 20px;
}

.matrix-region-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.date-cell {
  min-width: 116px;
  padding: 6px;
}

.matrix-current-validity {
  color: #42505b;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.matrix-acquired,
.matrix-date,
.at-matrix-acquired,
.at-matrix-date {
  font-size: 0.9rem;
  min-height: 34px;
  padding: 6px;
  text-align: center;
  width: 96px;
}

.month-cell {
  min-width: 50px;
  padding: 5px;
}

.matrix-day,
.at-matrix-day {
  font-size: 0.9rem;
  min-height: 34px;
  padding: 5px;
  text-align: center;
  width: 40px;
}

.map-toolbar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 14px 16px;
}

.map-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.map-zoom {
  align-items: center;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 6px;
  padding: 4px;
}

.map-zoom span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  min-width: 44px;
  text-align: center;
}

.icon-button {
  min-width: 34px;
  padding-left: 0;
  padding-right: 0;
}

.small-button {
  min-height: 30px;
  padding: 6px 9px;
}

.map-legend {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
}

.map-filter {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 5px;
  min-height: 30px;
  padding: 5px 8px;
}

.map-filter input {
  accent-color: var(--accent-dark);
  height: 10px;
  margin: 0;
  width: 10px;
}

.map-filter:has(input:not(:checked)) {
  opacity: 0.48;
}

.legend-swatch {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 22px;
}

.legend-swatch.valid {
  background: #2f8f46;
}

.legend-swatch.warning {
  background: #d8a21b;
}

.legend-swatch.expired {
  background: #c0392b;
}

.legend-swatch.unknown {
  background: #8f989f;
}

.legend-swatch.city {
  background: #182027;
}

.route-map-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 1120px;
  min-height: 520px;
  overflow: hidden;
  position: relative;
}

.route-map {
  cursor: grab;
  display: block;
  height: min(70vh, 720px);
  min-height: 520px;
  touch-action: none;
  width: 100%;
}

.route-map.dragging {
  cursor: grabbing;
}

.map-country-switch {
  display: inline-flex;
  gap: 4px;
}

.map-country-switch button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text);
}

.route-map-shell.map-country-at {
  min-height: 0;
}

.route-map.map-country-at {
  aspect-ratio: 1.8;
  height: auto;
  min-height: 0;
}

.map-borders {
  pointer-events: none;
}

.map-borders polyline {
  stroke: #69747c;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.map-city-label {
  pointer-events: none;
}

.map-city-label circle {
  fill: #182027;
  stroke: #ffffff;
  stroke-width: 1.8;
}

.map-city-text {
  fill: #182027;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.map-city-halo {
  fill: none;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 4;
}

.manual-map-grid line {
  stroke: #d8dde1;
  stroke-width: 0.7;
}

.rail-base-map {
  opacity: 0.68;
  pointer-events: none;
}

.rail-base-map polyline {
  stroke: #9ca3aa;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.15;
}

.manual-map-draft {
  pointer-events: none;
}

.manual-map-draft polyline {
  filter: drop-shadow(0 1px 2px rgba(17, 34, 53, 0.28));
  vector-effect: non-scaling-stroke;
}

.manual-map-draft circle {
  fill: #ffffff;
  stroke: #111827;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.station-choice-panel {
  border-top: 1px solid #d4d9de;
  margin-top: 16px;
  padding-top: 14px;
}

.station-choice-row + .station-choice-row {
  margin-top: 12px;
}

.station-choice-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.station-choice-options button {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.station-choice-options button span {
  color: #657380;
  font-size: 0.72rem;
  font-weight: 600;
}

.path-choice-panel {
  margin: 8px 0 12px;
}

.path-choice-options {
  display: grid;
  gap: 6px;
}

.path-choice {
  align-items: flex-start;
  border: 1px solid #d4d9de;
  cursor: pointer;
  display: flex;
  gap: 9px;
  padding: 9px 10px;
}

.path-choice.selected {
  background: #f1f3f4;
  border-color: #8b959d;
}

.path-choice span,
.path-choice small {
  display: block;
}

.path-review-note {
  border-left: 3px solid #c28a12;
  padding-left: 10px;
}

.path-choice small {
  color: #657380;
  margin-top: 2px;
}

.manual-map-draft text {
  fill: #111827;
  font-size: 13px;
  font-weight: 900;
}

.osm-preview-line {
  pointer-events: none;
}

.osm-preview-line polyline {
  opacity: 0.92;
  stroke: #111827;
  stroke-dasharray: 9 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.osm-candidate-stations {
  pointer-events: none;
}

.osm-candidate-stations circle {
  fill: #1d4ed8;
  stroke: #ffffff;
  stroke-width: 2;
}

.osm-station-text {
  fill: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.osm-station-halo {
  fill: none;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 4;
}

.map-empty {
  color: var(--muted);
  font-weight: 700;
  left: 50%;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px));
}

.section-toolbar {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 0 12px;
  padding: 14px 16px;
}

.osm-review,
.manual-map-editor,
.stock-suggestions {
  margin-bottom: 20px;
}

.osm-review-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.osm-review-wrap {
  max-height: 520px;
  overflow-x: hidden;
  overflow-y: auto;
}

.osm-review-table {
  min-width: 0;
  table-layout: fixed;
}

.osm-review-table th,
.osm-review-table td {
  overflow-wrap: anywhere;
  vertical-align: top;
}

.osm-review-table th:nth-child(1),
.osm-review-table td:nth-child(1) {
  width: 96px;
}

.osm-review-table th:nth-child(2),
.osm-review-table td:nth-child(2) {
  width: 132px;
}

.osm-review-table th:nth-child(5),
.osm-review-table td:nth-child(5) {
  width: 116px;
}

.osm-review-table th:nth-child(6),
.osm-review-table td:nth-child(6) {
  width: 128px;
}

.osm-review-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.osm-review-table tr.verified td {
  background: #f4f7f4;
}

.osm-review-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 0;
  padding: 14px 16px;
}

.osm-search-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 12px 0 4px;
}

.osm-search-fields label {
  color: var(--muted-text);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 5px;
}

.osm-search-fields input {
  min-width: 0;
  width: 100%;
}

@media (max-width: 760px) {
  .osm-search-fields {
    grid-template-columns: 1fr;
  }
}

.osm-review-detail h3,
.osm-review-detail h4 {
  margin: 0 0 8px;
}

.source-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.source-summary span {
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 5px 8px;
}

.osm-station-list {
  color: var(--muted);
  margin: 0 0 14px;
  max-height: 130px;
  overflow: auto;
  padding-left: 20px;
}

.osm-route-summary {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  color: var(--muted);
}

.osm-route-summary strong {
  color: var(--text);
}

.osm-line-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 14px;
  max-height: 240px;
  overflow: auto;
}

.osm-line-choice {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 4px 8px;
  grid-template-columns: auto 1fr;
  padding: 8px;
}

.osm-line-choice small {
  color: var(--muted);
  grid-column: 2;
}

.manual-map-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  margin-bottom: 16px;
}

.manual-map-layout > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.manual-point-list {
  color: var(--muted);
  margin: 8px 0 0;
  max-height: 180px;
  overflow: auto;
  padding-left: 22px;
}

.manual-point-list li {
  margin-bottom: 5px;
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  justify-content: center;
  min-width: 104px;
  padding: 5px 9px;
}

.status-badge.matched {
  background: #dfeee4;
  color: #1f6f36;
}

.status-badge.manual {
  background: #e6edf4;
  color: #23465f;
}

.status-badge.open {
  background: #f4e4df;
  color: #8c2f24;
}

.status-badge.accepted {
  background: #dfeee4;
  color: #1f6f36;
}

.status-badge.rejected {
  background: #eceff2;
  color: #5d6a75;
}

.status-badge.parent {
  background: #eceff2;
  color: #5d6a75;
}

.status-badge.ignored {
  background: #eceff2;
  color: #5d6a75;
}

@media (min-width: 1980px) {
  #routeMatrixView {
    margin-left: -302px;
    width: 1884px;
  }
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  padding: 18px;
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
}

.toast {
  background: #182027;
  border-radius: 999px;
  bottom: 18px;
  box-shadow: 0 10px 28px rgba(24, 32, 39, 0.18);
  color: #fff;
  font-size: 0.9rem;
  left: 50%;
  max-width: min(560px, calc(100vw - 32px));
  overflow: hidden;
  padding: 10px 14px;
  position: fixed;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 10;
}

.toast.error {
  background: #8c2f24;
}

@media (max-width: 880px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .brand-logo {
    height: 50px;
    width: 50px;
  }

  .summary-grid,
  .form-panel,
  .admin-grid,
  .field-grid,
  .field-grid.two {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
