:root {
  --bg: #f2f6fd;
  --panel: #ffffff;
  --text: #0b2f1e;
  --accent: #ffcc00;
  --rail: #006635;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #e7eef9 0%, #f3f7fd 45%, #e6edf8 100%);
}

#map {
  height: 100%;
  width: 100%;
}

#map .leaflet-top {
  top: 76px;
}

.site-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  padding: 0;
}

.topnav {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: color-mix(in oklab, #0f3a73, #124d35 24%);
  border: 0;
  border-bottom: 2px solid #0d2f57;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
  padding: 14px 10px;
  position: relative;
}

.topnav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #ffcc00 0%, #ffd84a 35%, #88c9ff 100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  text-decoration: none;
  color: #ffffff;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
}

.brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-sub {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a9d5ff;
}

.menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: #e7f2ff;
  border: 1px solid #4f84b7;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.88rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%);
  transition: background 120ms ease;
}

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

.menu-dropdown[open] summary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.14) 100%);
}

.menu-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  max-height: 58vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #a9bfda;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  padding: 6px;
  transform-origin: top left;
}
.menu-dropdown[open] .menu-dropdown-list {
  animation: dropdown-soft-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-dropdown-list a {
  display: block;
  text-decoration: none;
  color: #173d68;
  font-size: 0.86rem;
  padding: 6px 8px;
  border-radius: 6px;
}

.menu-dropdown-list a:hover {
  background: #edf4ff;
}
.menu-group-title {
  padding: 6px 8px 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #60758d;
}
.menu-group-divider {
  height: 1px;
  margin: 6px 4px;
  background: #d9e2ef;
}

.header-search {
  display: flex;
  gap: 6px;
  align-items: center;
}

.header-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dff7e8;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #4a8a67;
  background: rgba(16, 70, 48, 0.55);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #24d062;
  box-shadow: 0 0 0 4px rgba(36, 208, 98, 0.2);
}

.header-search input {
  border: 1px solid #6ea1d5;
  border-radius: 6px;
  background: #ffffff;
  color: #102c46;
  padding: 6px 8px;
  font-size: 0.85rem;
  width: 150px;
}

.header-search input:last-of-type {
  width: 96px;
}

.header-search button {
  border: 1px solid #8bc6a6;
  border-radius: 6px;
  background: #1d7a4f;
  color: #ffffff;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.panel {
  position: absolute;
  top: 82px;
  left: 58px;
  z-index: 1000;
  background: color-mix(in oklab, var(--panel), #ffffff 16%);
  border: 2px solid var(--rail);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  padding: 12px;
  width: min(410px, calc(100vw - 70px));
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.panel-controls-only {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  width: auto;
  max-width: calc(100vw - 90px);
}

.small {
  margin-top: 8px;
  opacity: 0.8;
  font-size: 0.8rem;
}
.mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-end;
}
.map-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.control-dropdown {
  position: relative;
}
.control-dropdown summary {
  list-style: none;
}
.control-dropdown summary::-webkit-details-marker {
  display: none;
}
.control-btn {
  border: 1px solid #0a3266;
  background: linear-gradient(180deg, #1565c0 0%, #0f4d99 100%);
  color: #ffffff;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  box-shadow: 0 3px 10px rgba(3, 23, 52, 0.28);
  transition: background 120ms ease, border-color 120ms ease, transform 90ms ease;
}
.control-btn:hover {
  background: linear-gradient(180deg, #1b74d8 0%, #1256ab 100%);
  border-color: #0c3f7f;
  transform: translateY(-1px);
}
.dropdown-btn::after {
  content: "";
  margin-left: 7px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #e7f2ff;
}
.control-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 205px;
  max-height: 52vh;
  overflow: auto;
  background: #f7fbff;
  border: 1px solid #7ea2cc;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(2, 24, 53, 0.24);
  padding: 6px;
  z-index: 1400;
  transform-origin: top left;
}
.control-dropdown[open] .control-menu {
  animation: dropdown-soft-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.control-menu a,
.control-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  text-decoration: none;
  color: #153a63;
  font-size: 0.83rem;
  padding: 6px 7px;
  border-radius: 7px;
  cursor: pointer;
}
.control-menu a:hover,
.control-menu button:hover {
  background: #e3efff;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes dropdown-soft-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-dropdown[open] .menu-dropdown-list,
  .control-dropdown[open] .control-menu {
    animation: none;
  }
}
.btn {
  border: 1px solid #1f6d48;
  background: #f4faf6;
  color: #0b2f1e;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: #096bdb;
  border-color: #096bdb;
  color: #ffffff;
}
.mode-select-wrap {
  display: grid;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a4e37;
}
.mode-select-wrap select {
  min-width: 180px;
  border: 1px solid #1f6d48;
  border-radius: 6px;
  background: #ffffff;
  color: #0b2f1e;
  padding: 6px 8px;
}
.history-panel {
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #8eb79f;
  border-radius: 8px;
  background: #f7fbf8;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.history-grid select {
  width: 100%;
  padding: 4px;
  border: 1px solid #8eb79f;
  border-radius: 4px;
  background: #fff;
}
.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.hidden {
  display: none;
}
.history-page {
  background: linear-gradient(180deg, #e7edf8 0%, #f4f7fc 48%, #e2e8f4 100%);
}
.train-detail-page {
  --text: #13385f;
  --rail: #1f5ba7;
  --bg: #eef3fb;
  --panel: #ffffff;
  background: linear-gradient(180deg, #e9eef8 0%, #f6f8fd 46%, #e8edf7 100%) !important;
  color: var(--text);
  min-height: 100%;
}
body.train-detail-page .topnav {
  background: linear-gradient(180deg, #1f3f78 0%, #183766 100%);
  border-bottom-color: #122d56;
}
body.train-detail-page .topnav::before {
  background: linear-gradient(90deg, #7fb2f4 0%, #aecdf7 50%, #d5e5fb 100%);
}
body.train-detail-page a {
  color: #1458a8;
}
body.train-detail-page .btn {
  border-color: #1f5ba7;
  background: #eef4ff;
  color: #10396f;
}
body.train-detail-page .btn-primary {
  background: #0f5ec2;
  border-color: #0f5ec2;
  color: #ffffff;
}
body.train-detail-page .detail-badge {
  background: #e7f0ff;
  border-color: #b4caed;
  color: #143f78;
}
body.train-detail-page .fact-label {
  color: #3a5f8f;
}
body.train-detail-page .train-live-status,
body.train-detail-page .detail-empty,
body.train-detail-page .mini-row span {
  color: #365982;
}
.train-detail-top {
  max-width: 1160px;
  margin: 14px auto 0;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.with-global-header.train-detail-page .train-detail-top {
  margin-top: 96px;
}
.train-detail-status {
  font-size: 0.84rem;
  color: #21446f;
  max-width: 68%;
  text-align: right;
  word-break: break-word;
}
.train-detail-wrap {
  max-width: 1160px;
  margin: 10px auto 20px;
  padding: 0 12px 24px;
}
.train-detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #b7caeb;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(9, 48, 118, 0.09);
  padding: 14px;
  margin-bottom: 12px;
}
.train-detail-hero h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  color: #0b2f86;
}
.train-detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-badge {
  border-radius: 999px;
  padding: 3px 10px;
  background: #ffe9ac;
  border: 1px solid #e7b934;
  color: #5b4300;
  font-size: 0.8rem;
  font-weight: 700;
}
.train-speed-card {
  min-width: 130px;
  text-align: center;
  background: linear-gradient(180deg, #0f5fc0 0%, #0b3d8f 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
}
.speed-num {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
}
.speed-unit {
  font-size: 0.86rem;
  opacity: 0.95;
}
.train-facts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.fact-card {
  background: #ffffff;
  border: 1px solid #c7d7ef;
  border-radius: 10px;
  padding: 10px;
}
.fact-label {
  font-size: 0.78rem;
  color: #33567e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fact-value {
  font-size: 1.02rem;
  color: #13385f;
  font-weight: 700;
  margin-top: 2px;
}
.train-detail-section {
  background: #ffffff;
  border: 1px solid #c7d7ef;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.train-detail-section h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #10396f;
}
.train-map {
  width: 100%;
  height: 280px;
  border-radius: 8px;
  border: 1px solid #cddaf0;
  overflow: hidden;
}
.train-live-status {
  margin-top: 8px;
  font-size: 0.84rem;
  color: #274d7a;
}
.speed-chart {
  width: 100%;
  height: auto;
  border: 1px solid #d4e1f5;
  border-radius: 8px;
  background: #fbfdff;
  display: block;
}
.mini-list {
  display: grid;
  gap: 6px;
}
.mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #d7e2f4;
  padding-bottom: 4px;
}
.mini-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.detail-empty {
  color: #5a7392;
  font-size: 0.88rem;
}
.table-scroll {
  overflow-x: auto;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.9rem;
}
.detail-table th,
.detail-table td {
  border-bottom: 1px solid #d4e1f5;
  padding: 7px 8px;
  text-align: left;
}
.detail-table th {
  color: #0f3a73;
  background: #edf3ff;
  font-weight: 700;
}
.detail-table tr:nth-child(even) {
  background: #f8fbff;
}
.station-page-content .container {
  max-width: 100%;
}
.station-page-content {
  color: #13385f;
}
.station-page-content table {
  width: 100%;
  border-collapse: collapse;
}
.station-page-content td,
.station-page-content th {
  padding: 6px 8px;
  border-bottom: 1px solid #d4e1f5;
}
.station-page-content img {
  max-width: 100%;
  height: auto;
}
.station-page-content .container {
  background: #eef1f6;
  border: 1px solid #d7dce6;
  border-radius: 10px;
  padding: 12px;
}
#stationmap {
  width: 100%;
  height: 100%;
  min-height: 350px;
}
.station-board-section {
  padding: 0;
  overflow: visible;
}
.station-board-section .station-info {
  width: 100%;
  max-width: none;
}
.station-board-section .ns-board {
  border-radius: 10px;
  border-width: 1px;
  overflow: hidden;
}
.station-board-section .ns-table-wrap {
  max-height: 350px;
}
.station-board-section .track-box {
  width: 34px;
  min-width: 34px;
  height: 28px;
}
.station-board-section .track-value {
  font-size: 0.85rem;
}
.station-layout-grid {
  display: grid;
  gap: 12px;
}
.station-panel {
  border-radius: 12px;
  border: 1px solid #c7d7ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 18px rgba(9, 48, 118, 0.08);
}
.station-panel-main {
  padding: 12px;
}
.station-layout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.station-layout-header h2 {
  margin: 0;
  color: #10396f;
  font-size: 1.05rem;
  font-weight: 800;
}
.station-code-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e3efff;
  border: 1px solid #aac5ec;
  color: #10396f;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.station-layout-row {
  margin-left: -6px;
  margin-right: -6px;
}
.station-layout-col {
  padding-left: 6px;
  padding-right: 6px;
}
.station-radar-card {
  margin: 0;
  border: 1px solid #c7d7ef;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: none;
}
.station-radar-card .card-header {
  background: #f1f6ff;
  border-bottom: 1px solid #d4e1f5;
  padding: 9px 12px;
  color: #0f3a73;
}
.station-radar-card .card-body {
  padding: 0;
  height: 350px;
}
.station-extra-sections {
  display: grid;
  gap: 12px;
}
.station-panel-extra {
  padding: 12px;
}
.station-extra-grid {
  display: grid;
  gap: 10px;
}
.station-extra-card {
  margin: 0;
  border: 1px solid #c7d7ef;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: none;
}
.station-extra-header {
  padding: 9px 12px;
  border-bottom: 1px solid #d4e1f5;
  background: #eef4ff;
  color: #0f3a73;
  font-weight: 800;
}
.station-extra-body {
  background: #ffffff;
  padding: 10px 12px;
}
.station-extra-body table {
  font-size: 0.9rem;
}
.station-extra-body .btn,
.station-extra-body a.btn {
  border-radius: 8px;
  font-weight: 700;
}
.panel-history {
  border-color: #0b2f86;
  background: color-mix(in oklab, #f7f9ff, #ffffff 20%);
}
.panel-history h1 {
  color: #0b2f86;
}
.history-panel-page {
  border-color: #bac9e9;
  background: #eef3ff;
}
.history-panel-box {
  top: 82px;
  left: 58px;
  z-index: 1000;
  min-width: 360px;
  background: linear-gradient(180deg, #0f3a73 0%, #123e6f 100%);
  border: 1px solid #0d2f57;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  padding: 12px;
}
.history-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #e7f2ff;
}
.history-panel-box .history-panel {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
.history-panel-box .history-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.history-panel-box .history-grid select {
  width: 100%;
  padding: 6px 7px;
  border: 1px solid #7aa2cf;
  border-radius: 8px;
  background: #f4f9ff;
  color: #173d68;
  font-weight: 700;
}
.history-panel-box .history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.history-note {
  color: #d7e9ff;
  font-size: 0.8rem;
}
.history-status {
  margin-top: 8px;
  color: #e8f3ff;
  font-size: 0.86rem;
}

.train-label {
  background: #ffffff;
  border: 1px solid var(--rail);
  border-radius: 6px;
  padding: 1px 4px;
  font-size: 11px;
  font-weight: 600;
}
.train-card {
  min-width: 320px;
  max-width: min(430px, calc(100vw - 70px));
  font-size: 0.96rem;
  color: #102c46;
}
.train-card-title {
  font-weight: 700;
  margin-bottom: 4px;
}
.train-card-sub {
  color: #0f56a4;
  margin-bottom: 2px;
}
.train-card-meta {
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.train-card-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.train-btn {
  display: inline-block;
  background: #156fda;
  color: #fff !important;
  text-decoration: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.88rem;
}
.train-btn:visited {
  color: #fff !important;
}
.train-btn:hover {
  background: #0f5eb9;
  color: #fff !important;
}
.train-dot-wrapper {
  background: transparent;
  border: 0;
}
.train-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #006635;
  background: #ffcc00;
}
.station-info {
  width: 100%;
  min-width: 0;
  max-width: none;
  color: #0e2419;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.leaflet-popup.station-popup .leaflet-popup-content-wrapper {
  max-width: min(650px, calc(100vw - 24px));
  border: 3px solid #1f4ea3;
  border-radius: 14px;
  background: #e8edf5;
  box-shadow: 0 10px 22px rgba(12, 36, 86, 0.35);
}
.leaflet-popup.station-popup .leaflet-popup-content {
  width: min(620px, calc(100vw - 44px)) !important;
  margin: 6px 7px 7px;
}
.station-info-loading {
  padding: 10px;
}
.ns-board {
  border: 1px solid #2758ad;
  border-radius: 10px;
  overflow: hidden;
  background: #e8edf5;
  box-shadow: none;
}
.ns-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 9px;
  background: linear-gradient(180deg, #0c3c9f 0%, #083180 100%);
  border-bottom: 1px solid #0a2f79;
  font-weight: 700;
}
.ns-header-brand {
  width: 56px;
  height: 18px;
  object-fit: contain;
  display: inline-block;
  flex: 0 0 auto;
}
.ns-station {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.ns-header-clock-wrap {
  margin-left: auto;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ns-header-clock {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: inline-block;
  flex: 0 0 auto;
}
.ns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
  background: #e8edf5;
}
.ns-table-wrap {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}
.ns-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
  color: #0b2f86;
  background: #d2dbea;
  border-bottom: 1px solid #b6c7e6;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 3;
}
.ns-table thead th:nth-child(1) {
  width: 86px;
}
.ns-table thead th:nth-child(3) {
  width: 64px;
  text-align: center;
}
.ns-table thead th:nth-child(4) {
  width: 190px;
}
.ns-table tbody tr:nth-child(odd) {
  background: #e8edf5;
}
.ns-table tbody tr:nth-child(even) {
  background: #d8e1ed;
}
.ns-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid #c7d7ee;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ns-table .col-time {
  width: 86px;
  font-weight: 700;
  color: #0b2f86;
}
.time-main {
  font-size: 1.05rem;
  line-height: 1.05;
  font-weight: 800;
}
.time-delay .ns-delay {
  margin-left: 0;
}
.ns-table .col-dest {
  min-width: 0;
}
.dest-main {
  font-weight: 800;
  font-size: 1.06rem;
  color: #123a88;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.dest-sub {
  font-size: 0.85rem;
  color: #2d4769;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.ns-table .col-track {
  width: 64px;
  text-align: center;
}
.ns-table .col-train {
  width: 190px;
  color: #123a88;
}
.train-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  min-width: 0;
  max-width: 100%;
}
.ns-train-icon {
  width: 22px;
  height: 9px;
  object-fit: contain;
  display: inline-block;
  flex: 0 0 auto;
}

.train-name {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.05;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 32px;
}
.track-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.track-value {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 800;
  min-width: 1ch;
  text-align: center;
}
.ns-delay {
  margin-left: 6px;
  padding: 0;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #d71920;
  background: transparent;
}
.ns-table tr.is-cancelled .dest-main,
.ns-table tr.is-cancelled .dest-sub,
.ns-table tr.is-cancelled .col-time,
.ns-table tr.is-cancelled .track-box {
  text-decoration: line-through;
  text-decoration-color: #d71920;
  text-decoration-thickness: 2px;
  opacity: 0.7;
}
.ns-table tr.is-cancelled td,
.ns-table tr.is-cancelled td * {
  color: #7a1d1d !important;
}
@media (max-width: 700px) {
  .site-header {
    padding: 0;
  }
  .topnav {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .header-live {
    justify-self: start;
  }
  .menu-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .header-search {
    width: 100%;
  }
  .header-search input {
    width: 100%;
    min-width: 0;
  }
  .header-search input:last-of-type {
    width: 40%;
  }
  .panel {
    top: 126px;
    left: 10px;
    width: calc(100vw - 20px);
  }
  .history-panel-box {
    left: 10px;
    top: 126px;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    min-width: 0;
  }
  .history-panel-box .history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mode-row {
    flex-wrap: wrap;
  }
  .mode-select-wrap,
  .mode-select-wrap select {
    width: 100%;
  }
  .history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .train-detail-top {
    flex-wrap: wrap;
    gap: 8px;
  }
  .train-detail-status {
    max-width: 100%;
    text-align: left;
  }
  .train-detail-hero {
    flex-direction: column;
  }
  .train-facts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .station-info {
    width: min(92vw, 420px);
  }
  .leaflet-popup.station-popup .leaflet-popup-content {
    width: min(92vw, 420px) !important;
  }
  .ns-table-wrap {
    max-height: 250px;
  }
  .station-panel-main,
  .station-panel-extra {
    padding: 8px;
  }
  .station-layout-header h2 {
    font-size: 0.96rem;
  }
}
