:root {
  --nomad-bg: #fafaf9;
  --nomad-panel: #ffffff;
  --nomad-panel-soft: #f5f5f4;
  --nomad-ink: #1c1917;
  --nomad-muted: #78716c;
  --nomad-line: #e7e5e4;
  --nomad-line-dark: #d6d3d1;
  --nomad-brand: #e51a1c;
  --nomad-brand-dark: #b91c1c;
  --nomad-brand-soft: #fee2e2;
  --nomad-dark: #1c1917;
  --nomad-shadow: 0 24px 80px rgba(28, 25, 23, 0.12);
  --row-height: 38px;
}

.nomad-page {
  background:
    linear-gradient(180deg, #ffffff 0, var(--nomad-bg) 220px),
    var(--nomad-bg);
  color: var(--nomad-ink);
  min-height: 100vh;
  padding: 10px 12px 16px;
}

.nomad-hero {
  display: grid;
  grid-template-columns: minmax(250px, 0.55fr) auto minmax(680px, 1.65fr);
  align-items: end;
  gap: 12px;
  margin: 0 0 10px;
  width: 100%;
}

.nomad-eyebrow {
  margin: 0 0 3px;
  color: var(--nomad-brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nomad-hero h1 {
  margin: 0;
  color: var(--nomad-ink);
  font-size: clamp(24px, 2.2vw, 38px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.nomad-intro {
  display: none;
}

.nomad-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 6px;
}

.nomad-stats div {
  border: 1px solid var(--nomad-line);
  border-radius: 6px;
  background: #fff;
  padding: 7px 9px;
  box-shadow: 0 10px 24px rgba(28, 25, 23, 0.04);
}

.nomad-stats strong {
  display: block;
  color: var(--nomad-ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.nomad-stats span {
  display: block;
  margin-top: 3px;
  color: var(--nomad-muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.nomad-controls {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) minmax(190px, 1.2fr) minmax(82px, 0.5fr) minmax(100px, 0.62fr) minmax(90px, 0.52fr);
  gap: 6px;
  align-items: end;
  border: 1px solid var(--nomad-line);
  border-radius: 7px;
  background: var(--nomad-dark);
  padding: 8px;
  box-shadow: 0 14px 36px rgba(28, 25, 23, 0.1);
}

.control-field,
.passport-panel {
  min-width: 0;
}

.control-field span,
.passport-panel > span {
  display: block;
  margin: 0 0 3px;
  color: #d6d3d1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nomad-page button,
.nomad-page input,
.nomad-page select {
  font: inherit;
}

.nomad-page select,
.nomad-page input {
  width: 100%;
  height: 30px;
  border: 1px solid var(--nomad-line-dark);
  border-radius: 6px;
  background: #fff;
  color: var(--nomad-ink);
  padding: 0 9px;
  outline: none;
}

.nomad-page input::placeholder {
  color: #a8a29e;
}

.nomad-page select:focus,
.nomad-page input:focus,
.passport-dropdown[open] summary {
  border-color: var(--nomad-brand);
  box-shadow: 0 0 0 3px rgba(229, 26, 28, 0.14);
}

.nomad-page button {
  height: 30px;
  border: 1px solid var(--nomad-brand);
  border-radius: 6px;
  background: var(--nomad-brand);
  color: #fff;
  padding: 0 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.nomad-page button:hover {
  background: var(--nomad-brand-dark);
  border-color: var(--nomad-brand-dark);
}

.nomad-page button:active {
  transform: translateY(1px);
}

.secondary-action {
  border-color: var(--nomad-line-dark);
  background: #fff;
  color: var(--nomad-ink);
}

.secondary-action:hover {
  border-color: var(--nomad-ink);
  background: var(--nomad-panel-soft);
}

.passport-dropdown {
  position: relative;
}

.passport-dropdown summary,
.column-chooser summary {
  display: flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--nomad-line-dark);
  border-radius: 6px;
  background: #fff;
  color: var(--nomad-ink);
  padding: 0 28px 0 9px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.passport-dropdown summary::-webkit-details-marker,
.column-chooser summary::-webkit-details-marker {
  display: none;
}

.passport-dropdown summary::after,
.column-chooser summary::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 11px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--nomad-muted);
  border-bottom: 2px solid var(--nomad-muted);
  transform: rotate(45deg);
}

.passport-menu,
.column-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--nomad-line-dark);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--nomad-shadow);
  padding: 10px;
}

.passport-list,
.column-toggle-list {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.passport-option,
.column-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border-radius: 6px;
  padding: 4px 6px;
  color: var(--nomad-ink);
  cursor: pointer;
}

.passport-option:hover,
.column-toggle:hover {
  background: var(--nomad-brand-soft);
}

.passport-option input,
.column-toggle input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--nomad-brand);
}

.passport-option span,
.column-toggle span {
  margin: 0;
  color: var(--nomad-muted);
  font-size: 12px;
}

.passport-option strong {
  display: inline-flex;
  min-width: 28px;
  color: var(--nomad-ink);
  font-size: 12px;
}

.table-panel {
  margin-top: 8px;
  width: 100%;
  max-width: none;
  border: 1px solid var(--nomad-line);
  border-radius: 8px;
  background: var(--nomad-panel);
  box-shadow: 0 18px 50px rgba(28, 25, 23, 0.08);
  overflow: hidden;
}

.table-head {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(520px, auto);
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid var(--nomad-line);
  background: #fff;
  padding: 8px 10px;
}

.table-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.1;
}

.table-title p {
  margin: 2px 0 0;
  color: var(--nomad-muted);
  font-size: 11px;
}

.table-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 112px 112px 112px;
  gap: 8px;
  align-items: end;
}

.column-chooser {
  position: relative;
}

.column-menu {
  width: min(340px, 80vw);
  left: auto;
}

.table-shell {
  overflow: auto;
  max-height: calc(100vh - 190px);
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(245, 245, 244, 0.9), rgba(245, 245, 244, 0)),
    #fff;
}

.nomad-page table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
}

.nomad-page thead {
  position: sticky;
  top: 0;
  z-index: 25;
}

.nomad-page th,
.nomad-page td {
  border-right: 1px solid var(--nomad-line);
  border-bottom: 1px solid var(--nomad-line);
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.nomad-page th {
  position: relative;
  height: 72px;
  background: #292524;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  user-select: none;
}

.nomad-page th.active {
  background: #3f3a37;
}

.nomad-page th.sticky,
.nomad-page td.sticky {
  position: sticky;
  z-index: 12;
  box-shadow: 1px 0 0 var(--nomad-line);
}

.nomad-page th.sticky {
  z-index: 30;
}

.nomad-page td {
  height: var(--row-height);
  max-height: var(--row-height);
  padding: 6px 10px;
  color: #292524;
}

tbody tr:nth-child(even) td {
  background: #fafaf9;
}

tbody tr:hover td {
  background: #fff7ed;
}

tbody tr.pinned-row td {
  background: #fff1f2;
}

td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.filter-row th {
  height: 42px;
  background: #f5f5f4;
  padding: 5px;
}

.filter-cell input {
  height: 30px;
  border-radius: 5px;
  font-size: 12px;
}

.range-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.th-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
}

.drag-handle {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: grab;
  background:
    radial-gradient(circle, #a8a29e 1.5px, transparent 1.6px) 0 0 / 6px 6px;
  opacity: 0.9;
}

.freeze-button {
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #e7e5e4;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 800;
}

.freeze-button.active,
.freeze-button:hover {
  border-color: var(--nomad-brand);
  background: var(--nomad-brand);
  color: #fff;
}

.th-label {
  display: block;
  white-space: normal;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.18;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
}

.row-resizer {
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 5px;
  cursor: row-resize;
}

.city-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.city-link {
  color: var(--nomad-text);
  font-weight: 900;
  text-decoration: none;
}

.city-link:hover {
  color: var(--nomad-brand);
  text-decoration: underline;
}

.row-pin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--nomad-line-dark);
  border-radius: 5px;
  background: #fff;
  color: var(--nomad-muted);
  padding: 0;
}

.row-pin-button.active,
.row-pin-button:hover {
  border-color: var(--nomad-brand);
  background: var(--nomad-brand);
  color: #fff;
}

.pin-icon {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  transform: rotate(-35deg);
}

.pin-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 6px;
  height: 7px;
  border-radius: 4px 4px 2px 2px;
  background: currentColor;
}

.pin-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  width: 2px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.fare-link,
.video-link,
.cell-links a,
.scenic-info-cell a {
  color: var(--nomad-brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.fare-link:hover,
.video-link:hover,
.cell-links a:hover,
.scenic-info-cell a:hover {
  text-decoration: underline;
}

.scenic-info-cell,
.cell-links {
  display: grid;
  gap: 3px;
}

.scenic-image-cell {
  display: block;
}

.scenic-gallery {
  display: grid;
  grid-template-columns: 24px minmax(88px, 1fr) 24px;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.scenic-gallery img,
.scenic-gallery .scenic-fallback {
  width: 100%;
  height: 62px;
  border-radius: 6px;
  object-fit: cover;
  background: linear-gradient(135deg, #292524, #e51a1c);
}

.gallery-nav {
  width: 24px;
  height: 28px;
  border-radius: 5px;
  padding: 0;
}

.gallery-count {
  color: var(--nomad-muted);
  font-size: 10px;
}

.number-explain {
  cursor: help;
}

.is-dragging {
  opacity: 0.55;
}

body.is-resizing .nomad-page,
body.is-row-resizing .nomad-page {
  cursor: col-resize;
  user-select: none;
}

@media (max-width: 1100px) {
  .nomad-hero,
  .table-head {
    grid-template-columns: 1fr;
  }

  .nomad-stats {
    width: 100%;
  }

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

  .table-tools {
    grid-template-columns: minmax(0, 1fr) repeat(3, 108px);
  }
}

@media (max-width: 720px) {
  .nomad-page {
    padding: 16px 10px;
  }

  .nomad-controls,
  .table-tools,
  .nomad-stats {
    grid-template-columns: 1fr;
  }

  .table-shell {
    max-height: calc(100vh - 220px);
  }

  .table-head {
    padding: 10px;
  }
}
