/* Split from styles.css. Keep rule order inside each file stable. */
button,
input,
select,
textarea {
  font: inherit;
}

/* Train and locomotive database workspace */
.database-main { max-width: 1480px; }
.database-hero { padding-bottom: 8px; }
.database-hero h1 { margin-bottom: 6px; }
.database-tools { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px 24px; align-items: end; }
.database-tools > label { margin: 0; }
.database-tools input { min-height: 48px; font-size: 1rem; }
.database-type-tabs { display: flex; align-items: stretch; gap: 4px; }
.database-type-tabs .button { min-width: 142px; min-height: 48px; }
.database-status { grid-column: 1 / -1; margin: 0; }
.database-workspace { display: grid; grid-template-columns: minmax(300px, 0.72fr) minmax(520px, 1.55fr); min-height: 600px; padding: 0; overflow: hidden; }
.database-results-pane { min-width: 0; border-right: 1px solid var(--line); }
.database-results-pane .inline-heading { padding: 18px 20px 10px; }
.database-record-list { display: grid; }
.database-record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; width: 100%; padding: 15px 20px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.database-record-row:hover, .database-record-row:focus-visible { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.database-record-row.active { background: color-mix(in srgb, var(--primary) 14%, transparent); box-shadow: inset 3px 0 var(--primary); }
.database-record-title { font-size: 1rem; font-weight: 850; }
.database-record-row > span:not(.database-record-title):not(.database-record-status) { color: var(--muted); font-size: .84rem; }
.database-record-route { grid-column: 1; }
.database-record-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--primary); font-size: .75rem; font-weight: 800; }
.database-detail { min-width: 0; padding: 26px 30px 34px; }
.database-detail-empty { max-width: 460px; margin: 120px auto; color: var(--muted); text-align: center; }
.database-detail-heading { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.database-detail-heading h2 { grid-column: 1; margin: 8px 0 0; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.database-detail-heading > p { grid-column: 1; margin: 0; color: var(--muted); }
.database-detail-suggest { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.database-back-link { color: var(--primary); font-weight: 750; text-decoration: none; }
.database-detail-fields { margin: 10px 0 22px; }
.database-detail-fields > div { display: grid; grid-template-columns: minmax(150px, .45fr) minmax(0, 1fr); gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.database-detail-fields dt { color: var(--muted); font-weight: 700; }
.database-detail-fields dd { margin: 0; line-height: 1.5; }
.database-route-preview { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--primary) 5%, transparent); }
.database-route-line { display: grid; grid-template-columns: 16px 1fr 16px; align-items: center; }
.database-route-line span { width: 16px; height: 16px; border: 3px solid var(--primary); border-radius: 50%; background: var(--surface); }
.database-route-line span:last-child { border-color: #d75436; }
.database-route-line i { height: 3px; background: var(--primary); }
.database-route-preview > div:nth-child(2) { display: flex; justify-content: space-between; gap: 20px; margin-top: 8px; }
.database-route-preview p { margin: 18px 0 0; color: var(--muted); font-size: .82rem; }
.train-profile-admin-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.train-profile-admin-card > div { display: grid; gap: 5px; }

@media (max-width: 800px) {
  .database-tools { grid-template-columns: 1fr; }
  .database-type-tabs { width: 100%; }
  .database-type-tabs .button { flex: 1; min-width: 0; }
  .database-status { grid-column: 1; }
  .database-workspace { grid-template-columns: 1fr; }
  .database-results-pane { border-right: 0; }
  .database-detail { padding: 22px 18px 28px; border-top: 1px solid var(--line); }
  .database-detail-heading { grid-template-columns: 1fr; }
  .database-detail-suggest { grid-column: 1; grid-row: auto; width: 100%; }
  .database-detail-fields > div { grid-template-columns: 1fr; gap: 4px; }
}

.topbar {
  height: var(--topbar-height, 64px);
  min-height: var(--topbar-height, 64px);
  padding: calc(10px + var(--topbar-safe-top, 0px)) clamp(14px, 2.6vw, 28px) 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 3000;
  background: #102832;
  color: #fff;
}

.brand,
.account,
.field-row,
.form-actions,
.coords,
.inline-heading,
.report-card-header {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.brand > div {
  min-width: 0;
}

.brand[href] {
  color: #fff;
  text-decoration: none;
}

.brand h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 0;
  background: #c94f2f;
}

.eyebrow {
  margin: 0 0 3px;
  color: #82919e;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #b8c7d1;
}

.database-main {
  display: grid;
  gap: 22px;
  width: min(1040px, calc(100% - 32px));
}

.database-hero p:last-child {
  max-width: 760px;
}

.database-tools {
  display: grid;
  gap: 16px;
}

.database-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--control-gap);
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: var(--control-group-radius);
  background: var(--control-border);
  overflow: hidden;
}

.database-type-tabs .button {
  width: 100%;
  min-height: var(--control-height-large);
  margin: 0;
  border: 0;
  border-radius: 0;
  transition: none;
}

.database-status {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.database-status[data-tone="error"] {
  color: var(--danger);
}

.database-grid,
.database-suggestion-list {
  display: grid;
  gap: 16px;
}

.database-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.database-card,
.database-suggestion-card {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.database-card {
  align-content: start;
}

.database-card h2,
.database-suggestion-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.database-card p,
.database-suggestion-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.database-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.database-badges span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
}

.database-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.database-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.database-card .database-suggest-from-record {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
}

.database-meta dt,
.database-meta dd {
  margin: 0;
}

.database-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.database-meta dd {
  color: var(--ink);
  font-weight: 850;
}

.database-empty,
.database-gate {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.database-gate[hidden] {
  display: none;
}

.database-suggestion-section,
.database-suggestion-form {
  display: grid;
  gap: 18px;
}

.database-suggestion-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.database-suggestion-form label {
  min-width: 0;
}

.database-suggestion-form label:has(textarea),
.database-suggestion-form button {
  grid-column: 1 / -1;
}

.database-suggestion-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.database-note {
  font-size: 0.86rem;
}

.database-votes {
  display: flex;
  gap: 8px;
}

.database-vote-button {
  min-width: 62px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.database-vote-button:hover,
.database-vote-button:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.database-thumb-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pwa-refresh-button {
  width: var(--control-height-default);
  height: var(--control-height-default);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.pwa-refresh-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pwa-refresh-button:focus-visible {
  outline: 3px solid var(--control-focus);
  outline-offset: 2px;
}

.pwa-refresh-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pwa-refresh-button.is-refreshing svg {
  animation: pwa-refresh-spin 0.7s linear infinite;
}

.menu-account-status {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: #526371;
  font-size: 0.86rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.account-display-settings h3,
.account-display-settings .helper {
  margin: 0;
}

.account-display-settings .helper {
  margin-top: 3px;
}

.header-menu {
  position: relative;
}

.header-menu summary {
  min-height: 36px;
  width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.header-menu summary::-webkit-details-marker {
  display: none;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.hamburger-icon {
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -6px;
}

.hamburger-icon::after {
  top: 6px;
}

.header-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 3100;
  width: 250px;
  max-width: calc(100vw - 24px);
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  contain: paint;
}

.header-menu-section {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.header-menu-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.header-menu-section--account {
  gap: 6px;
}

.header-menu-panel a,
.header-menu-action {
  min-width: 0;
  min-height: 38px;
  display: grid;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #24323c;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-align: left;
  text-decoration: none;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.header-menu-panel a:hover,
.header-menu-action:hover,
.header-menu-action.active {
  background: #e8f1ef;
  color: var(--primary-dark);
}

.header-menu-panel .header-account-action {
  width: 100%;
  justify-items: start;
  text-align: left;
}

.header-menu-panel .header-menu-action.nav-button {
  width: 100%;
  min-height: 38px;
  display: grid;
  place-items: center start;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #24323c;
  font: inherit;
  font-weight: 850;
  text-align: left;
}

.header-menu-panel .header-menu-action.nav-button:hover,
.header-menu-panel .header-menu-action.nav-button.active {
  background: #e8f1ef;
  color: var(--primary-dark);
}

.map-search-button {
  position: relative;
  border: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.map-search-button::before {
  content: "";
  width: 13px;
  height: 13px;
  position: absolute;
  left: 12px;
  top: 11px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.map-search-button::after {
  content: "";
  width: 8px;
  height: 2px;
  position: absolute;
  left: 25px;
  top: 27px;
  transform: rotate(45deg);
  background: currentColor;
}

.leaflet-popup-content-wrapper {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.train-cluster-popup-shell .leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.train-cluster-popup-shell .leaflet-popup-close-button {
  width: 34px;
  height: 34px;
  color: var(--muted);
  font-size: 1.35rem;
}

.button.map-locate-button {
  position: absolute;
  left: 12px;
  top: 92px;
  z-index: 850;
  width: 34px;
  height: 34px;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(20, 35, 48, 0.18);
}

.map-locate-button:hover .locate-icon,
.map-locate-button:focus-visible .locate-icon {
  border-color: var(--primary);
}

.map-locate-button:hover .locate-icon::before,
.map-locate-button:hover .locate-icon::after,
.map-locate-button:focus-visible .locate-icon::before,
.map-locate-button:focus-visible .locate-icon::after {
  background: var(--primary);
}

.button.map-style-button {
  width: 34px;
  height: 34px;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(20, 35, 48, 0.18);
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.map-style-button:hover,
.map-style-button:focus-visible,
.map-style-button[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.panel-section {
  margin: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-section + .panel-section {
  margin-top: 10px;
}

.section-heading {
  margin-bottom: 14px;
}

.inline-heading {
  justify-content: space-between;
  gap: 12px;
}

.helper {
  margin: -6px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.account-data-tools > .button {
  width: fit-content;
}

.form-grid label,
.form-grid > *,
.panel-section,
.side-panel {
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  color: #35424d;
  font-size: 0.86rem;
  font-weight: 750;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field > label:first-child {
  display: block;
}

.inline-checkbox {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.82rem;
}

.inline-checkbox input {
  width: 17px;
  min-height: 17px;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--field-height);
  font-size: 16px;
  border: 1px solid var(--field-border);
  border-radius: var(--field-radius);
  padding: var(--field-padding-block) var(--field-padding-inline);
  color: var(--field-text);
  background: var(--field-bg);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

textarea {
  resize: vertical;
}

input[type="datetime-local"] {
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

input:not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  border-color: var(--field-focus) !important;
  box-shadow: 0 0 0 3px var(--field-focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--field-placeholder);
  opacity: 1;
}

input:not([type="checkbox"]):not([type="radio"])[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--field-invalid) !important;
  box-shadow: 0 0 0 3px var(--field-invalid-ring);
}

.field-hint {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.35;
}

.field-row {
  gap: 8px;
  align-items: end;
}

.field-row label {
  flex: 1 1 auto;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.checkbox-line input {
  width: auto;
}

.consist-builder .field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
}

.chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: rgba(13, 107, 99, 0.13);
  cursor: pointer;
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  cursor: pointer;
  font-weight: var(--control-font-weight);
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button {
  min-height: var(--control-height-default);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px var(--control-padding-inline);
  font-size: var(--control-font-size);
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

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

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  border-color: var(--control-border);
  background: var(--control-bg);
  color: var(--control-selected-text);
}

.button.active,
.button[aria-pressed="true"] {
  background: var(--control-selected-bg);
  color: var(--control-selected-text);
}

.button-ghost {
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
}

.button-secondary:not(:disabled):hover,
.button-ghost:not(:disabled):hover {
  background-color: var(--control-bg-hover);
  color: var(--control-selected-text);
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.icon-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  background: #102832;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}

.form-actions .button {
  width: 100%;
  min-width: 0;
  padding-inline: 10px;
  line-height: 1.15;
}

.form-actions button[type="submit"] {
  grid-column: 1 / -1;
}

.older-reports-button {
  justify-self: center;
  width: auto;
  max-width: 100%;
}

.admin-page-button {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.consent-dialog-actions .button {
  width: auto;
}

.app-toast button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.app-dialog-actions .button {
  width: auto;
}

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

.tab-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.tab-button.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(20, 35, 48, 0.1);
}

.admin-card,
.user-card,
.info-page,
.moderation-tools {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.asset-row-actions .button {
  width: auto;
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.admin-card p,
.user-card p,
.info-page p,
.moderation-tools p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.info-page h3 {
  margin: 0;
  font-size: 0.98rem;
}

.report-card-actions .button {
  flex: 1 1 150px;
}

.report-rating-button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

.report-rating-button:hover,
.report-rating-button.selected-rating {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.report-rating-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.report-history-actions .button {
  flex: 1 1 140px;
}

.report-edit-location-tools .button {
  width: auto;
}

.side-panel .reports-panel .section-heading {
  margin-bottom: 12px;
}

.side-panel .reports-panel .tab-button.active {
  border-bottom: 2px solid var(--primary);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.content-page,
.account-page {
  min-height: 100vh;
  background: #f6f8fa;
}

.content-header {
  padding: 20px clamp(18px, 5vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #102832;
  color: #fff;
}

.content-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.content-header a {
  color: #dff5f1;
  font-weight: 900;
  text-decoration: none;
}

.content-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 1.05rem;
}

.content-home-button {
  min-height: var(--control-height-default);
  width: var(--control-height-default);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.1);
  color: #dff5f1;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.content-home-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content-home-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.content-menu {
  flex: 0 0 auto;
}

.content-menu .header-menu-panel {
  width: 230px;
}

.content-main {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.content-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(20, 35, 48, 0.08);
}

.content-section + .content-section {
  margin-top: 16px;
}

.content-section h1,
.content-section h2 {
  margin-top: 0;
}

.content-section p,
.content-section li {
  color: #344450;
  line-height: 1.6;
}

.direction-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.direction-legend-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.direction-legend-item > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.direction-legend-item strong,
.direction-legend-item small {
  color: inherit;
}

.direction-legend-item small {
  color: var(--muted);
}

.direction-legend-swatch {
  width: 46px;
  height: 38px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 8px;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(20, 35, 48, 0.2);
}

.direction-legend-swatch--northbound {
  background: #087e8b;
}

.direction-legend-swatch--southbound {
  background: #9c2c77;
}

.direction-legend-swatch--eastbound {
  background: #315da8;
}

.direction-legend-swatch--westbound {
  background: #6546a6;
}

.direction-legend-swatch--unknown {
  border-color: #111;
  background: #fff;
  color: #111;
}

.marker-symbol-heading {
  margin: 24px 0 10px;
}

.marker-symbol-legend {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 !important;
  list-style: none;
}

.marker-symbol-legend li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.marker-symbol {
  width: 46px;
  height: 34px;
  flex: 0 0 46px;
  position: relative;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 8px;
  background: #087e8b;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(20, 35, 48, 0.18);
}

.marker-symbol--special::after {
  content: "";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #d3222a;
}

.marker-symbol--official {
  border-color: #facc15;
  background: #315da8;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.3), 0 4px 12px rgba(20, 35, 48, 0.18);
}

.marker-symbol--stale {
  border-style: dashed;
  filter: grayscale(0.35) saturate(0.72);
}

.marker-symbol--cluster {
  border-radius: 12px;
  background: #102832;
  font-size: 0.9rem;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.contact-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contact-submit {
  width: fit-content;
  min-width: 150px;
}

.version-history {
  display: grid;
  gap: 14px;
  margin: 22px 0 0;
}

.version-history-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.version-history-list li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 18px;
  position: relative;
  padding: 0 0 24px 22px;
  border-left: 2px solid var(--line);
}

.version-history-list li:last-child {
  padding-bottom: 0;
}

.version-history-list li::before {
  position: absolute;
  top: 3px;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--primary);
  content: "";
}

.version-history time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.version-history h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 1rem;
}

.version-history p {
  margin: 0;
}

.version-history-previous {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.version-history-previous > summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--ink);
  font-weight: 850;
}

.version-history-previous[open] > summary {
  border-bottom: 1px solid var(--line);
}

.version-history-previous .version-history-list {
  padding: 16px 16px 16px 22px;
}

@media (prefers-color-scheme: dark) {
body,
  .content-page,
  .account-page,
  .standalone-page {
    background: var(--surface);
    color: var(--ink);
  }

.topbar {
    background: #07161c;
  }

.side-panel,
  .panel-section,
  .header-menu-panel,
  .report-search,
  .report-card,
  .report-card-body,
  .content-section,
  .standalone-card,
  .leaflet-popup-content-wrapper,
  .leaflet-popup-tip {
    border-color: var(--line);
    background: var(--panel);
    color: var(--ink);
  }

input,
  select,
  textarea,
  .button-secondary,
  .button-ghost,
  .tab-button.active,
  .sheet-handle,
  .app-nav {
    border-color: var(--line);
    background: #0c1a22;
    color: var(--ink);
  }

input::placeholder,
  textarea::placeholder {
    color: #7f8f9a;
  }

label,
  .report-data-table td,
  .report-title,
  .report-notes,
  .popup-title {
    color: var(--ink);
  }

.helper,
  .field-hint,
  .report-meta,
  .popup-meta,
  .report-data-table th {
    color: var(--muted);
  }

.content-section p,
  .content-section li,
  .checkbox-row,
  .checkbox-row span {
    color: var(--ink);
  }

.button-primary {
    background: #1b716b;
    color: #fff;
  }

.button-primary:hover {
    background: #246f6c;
  }

.header-menu-panel a,
  .header-menu-action,
  .menu-account-status {
    color: var(--ink);
  }

.header-menu-panel a:hover,
  .header-menu-action:hover,
  .header-menu-action.active,
  .side-tab.active {
    border-color: #1b4d58;
    background: #11313a;
    color: var(--primary-dark);
  }

.report-summary,
  .selected-report .report-summary,
  .nav-button.active,
  .tab-button.active {
    background: #11313a;
    color: var(--primary-dark);
  }
}

@media (max-width: 1100px) {
.nav-button {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 46px;
    padding: 0 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
  }

.nav-button.active {
    background: #e8f1ef;
    color: var(--primary-dark);
  }
}

@media (max-width: 620px) {
.database-main {
    width: min(100% - 20px, 1040px);
    gap: 14px;
  }

.database-grid,
.database-suggestion-list {
    gap: 16px;
  }

.database-card,
.database-suggestion-card {
    padding: 14px;
  }

.database-type-tabs,
.database-suggestion-form,
.database-suggestion-card {
    grid-template-columns: 1fr;
  }

.database-type-tabs {
    gap: var(--control-gap);
  }

.database-type-tabs .button,
.database-card .database-suggest-from-record,
.database-suggestion-form button {
    min-height: var(--control-height-large);
  }

.database-votes {
    width: 100%;
  }

.database-vote-button {
    flex: 1 1 0;
  }

.report-rating-button {
    width: 100%;
  }

.topbar {
    min-height: var(--topbar-height, 68px);
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding: calc(10px + var(--topbar-safe-top, 0px)) 12px 10px;
  }

.brand {
    gap: 8px;
  }

.brand-mark {
    width: 38px;
    height: 38px;
  }

.brand h1 {
    gap: 6px;
    font-size: clamp(1.12rem, 5.4vw, 1.45rem);
  }

.header-menu-panel {
    width: min(260px, calc(100vw - 24px));
  }

.form-actions .button,
  .search-grid .button,
  .admin-actions .button,
  .report-card-actions .button {
    max-width: 100%;
    width: 100%;
  }

.map-locate-button {
    width: 34px;
    height: 34px;
    max-width: none;
  }

.consent-dialog-actions .button {
    width: 100%;
  }
}

@media (max-width: 1100px) and (prefers-color-scheme: dark) {
.nav-button {
    color: var(--muted) !important;
    background: transparent !important;
  }

.nav-button.active {
    background: #11313a !important;
    color: var(--primary-dark) !important;
  }
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .content-page,
:root[data-theme="dark"] .account-page,
:root[data-theme="dark"] .standalone-page {
  background: var(--surface);
  color: var(--ink);
}

:root[data-theme="dark"] .topbar {
  background: #07161c;
}

:root[data-theme="dark"] .side-panel,
:root[data-theme="dark"] .panel-section,
:root[data-theme="dark"] .header-menu-panel,
:root[data-theme="dark"] .report-search,
:root[data-theme="dark"] .report-card,
:root[data-theme="dark"] .report-card-body,
:root[data-theme="dark"] .content-section,
:root[data-theme="dark"] .standalone-card,
:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip,
:root[data-theme="dark"] .admin-card,
:root[data-theme="dark"] .user-card,
:root[data-theme="dark"] .info-page,
:root[data-theme="dark"] .moderation-tools {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

:root[data-theme="dark"] .report-rating-button {
  border-color: var(--line);
  background: #0c1a22;
  color: var(--ink);
}

:root[data-theme="dark"] .report-rating-button:hover,
:root[data-theme="dark"] .report-rating-button.selected-rating {
  border-color: var(--primary);
  background: #123b3a;
  color: #a7eee7;
}

:root[data-theme="dark"] .map-search-control form,
:root[data-theme="dark"] .map-search-results,
:root[data-theme="dark"] .map-search-button {
  border-color: var(--line);
  background: #0c1a22;
  color: var(--ink);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .custom-select-input,
:root[data-theme="dark"] .custom-datalist-input,
:root[data-theme="dark"] .button-secondary,
:root[data-theme="dark"] .button-ghost,
:root[data-theme="dark"] .tab-button.active,
:root[data-theme="dark"] .sheet-handle,
:root[data-theme="dark"] .app-nav,
:root[data-theme="dark"] .search-grid {
  border-color: var(--line);
  background: #0c1a22;
  color: var(--ink);
}

:root[data-theme="dark"] label,
:root[data-theme="dark"] .report-data-table td,
:root[data-theme="dark"] .report-title,
:root[data-theme="dark"] .report-notes,
:root[data-theme="dark"] .popup-title,
:root[data-theme="dark"] .flag-reason,
:root[data-theme="dark"] .content-section p,
:root[data-theme="dark"] .content-section li,
:root[data-theme="dark"] .checkbox-row,
:root[data-theme="dark"] .checkbox-row span {
  color: var(--ink);
}

:root[data-theme="dark"] .helper,
:root[data-theme="dark"] .field-hint,
:root[data-theme="dark"] .report-meta,
:root[data-theme="dark"] .popup-meta,
:root[data-theme="dark"] .report-data-table th,
:root[data-theme="dark"] .admin-card p,
:root[data-theme="dark"] .user-card p,
:root[data-theme="dark"] .info-page p,
:root[data-theme="dark"] .moderation-tools p,
:root[data-theme="dark"] .admin-meta {
  color: var(--muted);
}

:root[data-theme="dark"] .button-primary {
  background: #1b716b;
  color: #fff;
}

:root[data-theme="dark"] .button-primary:hover {
  background: #246f6c;
}

:root[data-theme="dark"] .header-menu-panel a,
:root[data-theme="dark"] .header-menu-action,
:root[data-theme="dark"] .menu-account-status {
  color: var(--ink);
}

:root[data-theme="dark"] .header-menu-panel .header-menu-action.nav-button {
  background: transparent;
  color: var(--ink);
}

:root[data-theme="dark"] .header-menu-panel a:hover,
:root[data-theme="dark"] .header-menu-action:hover,
:root[data-theme="dark"] .header-menu-action.active,
:root[data-theme="dark"] .side-tab.active {
  border-color: #1b4d58;
  background: #11313a;
  color: var(--primary-dark);
}

:root[data-theme="dark"] .header-menu-panel .header-menu-action.nav-button:hover,
:root[data-theme="dark"] .header-menu-panel .header-menu-action.nav-button.active {
  border-color: #1b4d58;
  background: #11313a;
  color: var(--primary-dark);
}

:root[data-theme="dark"] .side-tab,
:root[data-theme="dark"] .tab-button,
:root[data-theme="dark"] .nav-button {
  color: var(--muted);
}

:root[data-theme="dark"] .report-summary,
:root[data-theme="dark"] .selected-report .report-summary,
:root[data-theme="dark"] .nav-button.active,
:root[data-theme="dark"] .tab-button.active {
  background: #11313a;
  color: var(--primary-dark);
}

@media (max-width: 1100px) {
:root[data-theme="dark"] .nav-button {
    color: var(--muted) !important;
    background: transparent !important;
  }

:root[data-theme="dark"] .nav-button.active {
    background: #11313a !important;
    color: var(--primary-dark) !important;
  }
}

:root[data-theme="light"] body,
:root[data-theme="light"] .content-page,
:root[data-theme="light"] .account-page {
  background: #f6f8fa;
  color: var(--ink);
}

:root[data-theme="light"] .topbar,
:root[data-theme="light"] .content-header {
  background: #102832;
  color: #fff;
}

:root[data-theme="light"] .header-menu-panel,
:root[data-theme="light"] .report-search,
:root[data-theme="light"] .report-card,
:root[data-theme="light"] .report-card-body,
:root[data-theme="light"] .content-section,
:root[data-theme="light"] .standalone-card,
:root[data-theme="light"] .panel-section,
:root[data-theme="light"] .admin-card,
:root[data-theme="light"] .user-card,
:root[data-theme="light"] .info-page,
:root[data-theme="light"] .moderation-tools {
  background: #fff;
  color: var(--ink);
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .custom-select-input,
:root[data-theme="light"] .custom-datalist-input,
:root[data-theme="light"] .button-secondary,
:root[data-theme="light"] .button-ghost,
:root[data-theme="light"] .tab-button.active,
:root[data-theme="light"] .sheet-handle,
:root[data-theme="light"] .search-grid {
  border-color: #cbd5de;
  background: #fff;
  color: var(--ink);
}

:root[data-theme="light"] label,
:root[data-theme="light"] .eyebrow,
:root[data-theme="light"] .report-data-table td,
:root[data-theme="light"] .report-title,
:root[data-theme="light"] .report-notes,
:root[data-theme="light"] .popup-title,
:root[data-theme="light"] .flag-reason,
:root[data-theme="light"] .content-section p,
:root[data-theme="light"] .content-section li,
:root[data-theme="light"] .checkbox-row,
:root[data-theme="light"] .checkbox-row span {
  color: #344450;
}

:root[data-theme="light"] .helper,
:root[data-theme="light"] .field-hint,
:root[data-theme="light"] .report-meta,
:root[data-theme="light"] .popup-meta,
:root[data-theme="light"] .report-data-table th,
:root[data-theme="light"] .admin-card p,
:root[data-theme="light"] .user-card p,
:root[data-theme="light"] .info-page p,
:root[data-theme="light"] .moderation-tools p,
:root[data-theme="light"] .admin-meta {
  color: var(--muted);
}

:root[data-theme="light"] .button-primary {
  background: var(--primary);
  color: #fff;
}

:root[data-theme="light"] .button-primary:hover {
  background: var(--primary-dark);
}

:root[data-theme="light"] .header-menu-panel a,
:root[data-theme="light"] .header-menu-action,
:root[data-theme="light"] .menu-account-status {
  color: #24323c;
}

:root[data-theme="light"] .header-menu-panel a:hover,
:root[data-theme="light"] .header-menu-action:hover,
:root[data-theme="light"] .header-menu-action.active,
:root[data-theme="light"] .side-tab.active {
  border-color: #cfe1de;
  background: #e8f1ef;
  color: var(--primary-dark);
}

:root[data-theme="light"] .side-tab,
:root[data-theme="light"] .tab-button,
:root[data-theme="light"] .nav-button {
  color: var(--muted);
}

:root[data-theme="light"] .selected-report .report-summary,
:root[data-theme="light"] .nav-button.active,
:root[data-theme="light"] .tab-button.active {
  background: #e8f1ef;
  color: var(--primary-dark);
}

@media (max-width: 1100px) {
:root[data-theme="light"] .nav-button {
    color: var(--muted) !important;
    background: transparent !important;
  }

:root[data-theme="light"] .nav-button.active {
    background: #e8f1ef !important;
    color: var(--primary-dark) !important;
  }
}

:where(a, button, summary):focus-visible {
  outline: 3px solid var(--control-focus);
  outline-offset: 3px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: var(--control-disabled-opacity);
}

:root[data-theme="dark"] button:disabled,
:root[data-theme="dark"] input:disabled,
:root[data-theme="dark"] select:disabled,
:root[data-theme="dark"] textarea:disabled {
  opacity: 1;
  color: #bfd2d9;
  border-color: #3d5966;
  background-color: #1a3039;
}

.content-section a,
.standalone-card a,
.panel-section .helper a {
  color: var(--primary-dark);
  font-weight: 750;
  text-underline-offset: 0.16em;
}

.content-section a:hover,
.standalone-card a:hover,
.panel-section .helper a:hover {
  text-decoration-thickness: 2px;
}

.content-section h1,
.content-section h2 {
  line-height: 1.2;
}

.content-section ul,
.content-section ol {
  padding-left: 1.4rem;
}

@media (max-width: 620px) {
.content-header {
    min-height: 64px;
    padding: 10px 12px;
  }

.content-brand {
    min-width: 0;
    font-size: 1rem;
  }

.content-header-actions {
    flex-wrap: nowrap;
  }

.content-home-button {
    min-height: var(--control-height-default);
  }

.content-main {
    width: min(100% - 24px, 920px);
    padding: 16px 0 28px;
  }

.content-section {
    padding: 18px;
  }
}

@media (max-width: 1100px) {
.side-panel .panel-section {
    margin: 0;
    padding-bottom: 18px;
    border-radius: 0;
  }
}

.adjust-location-button {
  display: none;
}

.report-step-actions .button {
  width: 100%;
  min-width: 0;
}

.recent-report-controls select,
.recent-report-controls .button {
  min-width: 0;
}

.account-access-card .helper {
  margin: 0 0 9px;
}

@media (max-width: 420px) {
.contact-form-row {
    grid-template-columns: 1fr;
  }

.version-history-list li {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (max-width: 1100px) {
.adjust-location-button {
    display: inline-flex;
  }
}

body .side-panel > .panel-section {
  margin: 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body .side-panel .reports-panel .section-heading {
  margin: 0 2px 12px;
}

body .side-panel .reports-panel .reports-tools .tab-button.active {
  border: 0;
  border-radius: 5px;
  background: var(--primary-soft);
  box-shadow: none;
}

body .side-panel .reports-panel .report-list-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
}

body .side-panel .reports-panel summary.report-list-section-heading {
  cursor: pointer;
  list-style: none;
}

body .side-panel .reports-panel summary.report-list-section-heading::-webkit-details-marker {
  display: none;
}

body .side-panel .reports-panel .report-list-section--collapsible .report-list-section-heading {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

body .side-panel .reports-panel .report-list-section--collapsible[open] .report-list-section-heading {
  margin-bottom: 8px;
}

body .side-panel .reports-panel .report-list-section--collapsible .report-list-section-heading span::after {
  content: " +";
}

body .side-panel .reports-panel .report-list-section--collapsible[open] .report-list-section-heading span::after {
  content: " -";
}

body .side-panel .reports-panel .report-list-section-heading h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body .side-panel .reports-panel .report-list-section-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

body.app-page .topbar {
  flex: 0 0 auto;
}

@media (max-width: 1100px) {
body.app-page .app-nav:has(.nav-button[hidden]) {
    grid-template-columns: 1fr;
  }
}

body .database-type-tabs .button.active,
body .database-type-tabs .button[aria-pressed="true"] {
  border-color: var(--control-focus);
  background: var(--control-selected-bg);
  color: var(--control-selected-text);
  box-shadow: none;
}

/* Keep database workspace overrides last; legacy database rules above remain for fallback markup. */
body .database-main { width: min(1480px, calc(100% - 32px)); max-width: 1480px; }
body .database-main { gap: 12px; }
body .database-hero { padding: 10px 6px; border: 0; background: transparent; box-shadow: none; }
:root[data-theme="dark"] body .database-hero,
:root[data-theme="light"] body .database-hero { border: 0; background: transparent; box-shadow: none; }
body .database-hero p { margin-bottom: 0; }
body .database-tools { padding: 14px 18px; }
body .database-tools { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px 24px; align-items: end; }
body .database-type-tabs { display: flex; grid-template-columns: none; gap: 0; border: 1px solid var(--control-border); border-radius: var(--control-group-radius); background: var(--control-border); overflow: hidden; }
body .database-type-tabs .button { min-width: 142px; min-height: 48px; border: 0; border-radius: 0; }
body .database-type-tabs .button:hover,
body .database-filter-tabs button:hover,
body .database-pagination button:not(:disabled):hover { background: var(--primary-soft); color: var(--primary-dark); }
body .database-workspace { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(520px, 1.55fr); gap: 0; min-height: 600px; padding: 0; overflow: hidden; }
body .database-detail { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(380px, 1.15fr); align-content: start; gap: 18px 24px; }
body .database-detail-heading { grid-column: 1 / -1; }
body .database-detail-overview { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(300px, .85fr) minmax(380px, 1.15fr); gap: 24px; align-items: start; }
body .database-detail-fields { min-width: 0; align-self: start; }
.database-results-heading { display: grid; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.database-results-heading h2 { margin: 0; }
.database-list-controls { display: grid; gap: 8px; }
.database-list-selectors { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; }
.database-filter-tabs { display: flex; border: 1px solid var(--control-border); border-radius: var(--control-group-radius); background: var(--control-border); overflow: hidden; }
.database-filter-tabs button, .database-pagination button { min-height: 36px; border: 0; background: var(--control-bg); color: var(--ink); font: inherit; font-size: .75rem; font-weight: 800; cursor: pointer; }
.database-filter-tabs button { flex: 1; padding: 0 8px; }
.database-filter-tabs button + button { border-left: 1px solid var(--control-border); }
.database-filter-tabs button.active { background: var(--control-selected-bg); color: var(--control-selected-text); }
.database-list-controls label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .75rem; font-weight: 750; }
.database-list-controls select { min-height: 36px; width: auto; }
.database-list-selectors label:first-child select { min-width: 0; width: 100%; }
.database-list-summary { margin: 0; color: var(--muted); font-size: .78rem; }
.database-pagination { display: flex; align-items: center; justify-content: center; gap: 0; padding: 12px; border-top: 1px solid var(--line); }
.database-pagination button { padding: 0 12px; border: 1px solid var(--control-border); }
.database-pagination button:first-child { border-radius: var(--control-group-radius) 0 0 var(--control-group-radius); }
.database-pagination button:last-child { border-radius: 0 var(--control-group-radius) var(--control-group-radius) 0; }
.database-pagination span { min-height: 36px; display: inline-flex; align-items: center; padding: 0 10px; border-block: 1px solid var(--control-border); color: var(--muted); font-size: .75rem; }
.database-pagination button:disabled { opacity: .45; cursor: default; }
.database-suggestion-train-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; grid-column: 1 / -1; }
.database-suggestion-route-notes { grid-column: 1 / -1; }
.database-suggestion-subdivisions { grid-column: 1 / -1; }
.database-subdivision-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.database-subdivision-picker .button { min-width: 74px; }
.database-subdivision-selections { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.database-subdivision-selections:empty { display: none; }
.database-subdivision-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 5px 4px 10px; border: 1px solid var(--control-border); border-radius: 999px; background: var(--primary-soft); color: var(--ink); font-size: .78rem; font-weight: 750; }
.database-subdivision-chip button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.database-subdivision-chip button:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.database-suggestion-actions { display: grid; grid-template-columns: minmax(120px, .28fr) minmax(220px, 1fr); gap: 10px; grid-column: 1 / -1; }
.database-detail-suggest-footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 2px; }
.database-route-map-card, .database-recent-reports { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.database-route-map-card { min-width: 0; align-self: start; }
.database-recent-reports { grid-column: 1 / -1; }
.database-route-map-heading { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.database-route-map-heading h3, .database-recent-reports h3 { margin: 0; }
.database-route-map { width: 100%; height: 330px; background: var(--surface); }
.database-route-map-note { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.45; }
.database-route-map .leaflet-control-attribution { font-size: 10px; }
.database-recent-reports h3 { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.database-report-table-wrap { overflow-x: auto; }
.database-recent-reports table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.database-recent-reports th, .database-recent-reports td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.database-recent-reports th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.database-recent-reports tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 800px) {
  body .database-main { width: min(100% - 20px, 1480px); }
  body .database-tools { grid-template-columns: 1fr; }
  .database-list-selectors { grid-template-columns: 1fr; }
  body .database-type-tabs { width: 100%; }
  body .database-type-tabs .button { flex: 1; min-width: 0; }
  body .database-workspace { grid-template-columns: 1fr; }
  body .database-detail { display: flex; flex-direction: column; gap: 16px; }
  body .database-detail-overview { display: flex; flex-direction: column; gap: 16px; }
  body .database-detail-heading { order: 1; }
  body .database-detail-overview { order: 2; }
  body .database-recent-reports { order: 3; }
  body .database-detail-suggest-footer { order: 4; }
  body .database-detail-suggest-footer .button { width: 100%; }
  body .database-route-map-card { order: 1; }
  body .database-detail-fields { order: 2; }
  .database-suggestion-train-fields { grid-template-columns: 1fr; }
  .database-route-map { height: 280px; }
  .database-suggestion-actions { grid-template-columns: 1fr 1fr; }
}
