.stop-search,
.board-shell,
.line-detail-panel {
  background: linear-gradient(180deg, #001f74 0%, var(--color-bg-board) 70%);
  border: var(--border-width-thin) solid var(--color-border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-board);
  padding: var(--space-4);
}

.license-note {
  margin: calc(var(--space-2) * -1) auto 0;
  padding: var(--space-2) var(--space-1) 0;
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(100%, 56rem);
}

.license-kicker {
  margin: 0 0 var(--space-1);
  color: var(--color-text-highlight);
  font-family: var(--font-family-board);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.license-copy {
  margin: 0;
  max-width: 40rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.license-copy + .license-copy {
  margin-top: 0.12rem;
}

.data-collection-copy {
  display: inline-block;
  max-width: min(100%, 38rem);
  text-wrap: balance;
}

.license-label {
  color: var(--color-text-secondary);
}

.license-group {
  display: inline-block;
  white-space: nowrap;
}

.license-note a {
  color: var(--color-text-highlight);
  text-decoration-color: rgba(255, 230, 0, 0.38);
  text-underline-offset: 0.18em;
}

.search-label {
  display: block;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
}

.search-input {
  width: 100%;
  box-sizing: border-box;
  border: var(--border-width-thin) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: #001044;
  color: var(--color-text-primary);
  padding: var(--space-3);
  font-size: var(--font-size-md);
}

.geo-locate-button {
  width: 3.675rem;
  height: 3.675rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-highlight);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.geo-locate-button svg {
  width: 1.715rem;
  height: 1.715rem;
  fill: currentColor;
}

.search-status {
  margin-top: var(--space-2);
  min-height: 1.25rem;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.stop-results-list,
.line-stops-list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.stop-result-button,
.line-stop-button {
  width: 100%;
  text-align: left;
  border: var(--border-width-thin) solid var(--color-border-soft);
  background: #00217d;
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.board-meta h2 {
  margin: 0;
  color: var(--color-text-highlight);
}

.selected-stop-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.favorite-toggle {
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.favorite-toggle.is-active {
  color: var(--color-text-highlight);
}

.favorite-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

.board-meta-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.board-meta-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.board-meta-button {
  border: var(--border-width-thin) solid var(--color-border-soft);
  background: transparent;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.5rem;
  cursor: pointer;
}

.board-meta-button.is-active {
  color: var(--color-text-highlight);
  border-color: var(--color-text-highlight);
}

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

.board-clock {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-family-board);
  font-size: 1rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.board-window {
  margin: 0.35rem 0 0;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
}

.departures-cards {
  display: none;
}

.board-controls {
  margin-top: var(--space-2);
  display: flex;
  justify-content: center;
}

.extend-window-toggle {
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

@media (max-width: 680px) {
  .data-collection-copy {
    max-width: min(100%, 31ch);
  }
}

.departures-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--font-size-sm);
}

.departures-table th,
.departures-table td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-grid-line);
  white-space: nowrap;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.departures-table th {
  text-align: left;
  color: var(--color-text-highlight);
  font-family: var(--font-family-board);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--font-size-xs);
  border-bottom: 2px solid #3f63d8;
}

.th-main,
.th-sub {
  display: block;
  line-height: 1.1;
}

.th-sub {
  margin-top: 0.22rem;
  color: var(--color-text-primary);
  font-family: var(--font-family-base);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.departure-row:nth-child(odd) {
  background: var(--color-bg-row-odd);
}

.departure-row:nth-child(even) {
  background: var(--color-bg-row-even);
}

.departures-table td {
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.departure-cell-text,
.departure-cell-button {
  display: block;
  width: 100%;
  min-width: 0;
}

.departure-cell-button,
.departure-card-button {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  margin: 0;
  padding: 0;
  text-align: left;
}

.departure-cell-button {
  cursor: pointer;
}

.departure-cell-button--destination,
.departure-card-destination {
  text-decoration: underline;
  text-decoration-color: rgba(255, 230, 0, 0.26);
  text-underline-offset: 0.18em;
}

.departure-cell-button.is-active,
.departure-card-button.is-active {
  color: var(--color-text-highlight);
  text-decoration-color: rgba(255, 230, 0, 0.72);
}

.departure-destination-stack,
.departure-card-destination-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.22rem;
  min-width: 0;
}

.departure-source-badge,
.departure-card-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 230, 0, 0.34);
  background: rgba(255, 230, 0, 0.1);
  color: var(--color-text-secondary);
  font-size: 0.68rem;
  line-height: 1.1;
  white-space: nowrap;
}

/* Column proportions tuned to avoid overlap between Destination and Spår. */
.departures-table th:nth-child(1),
.departures-table td:nth-child(1) { width: 10%; }

.departures-table th:nth-child(2),
.departures-table td:nth-child(2) { width: 12%; }

.departures-table th:nth-child(3),
.departures-table td:nth-child(3) { width: 9%; }

.departures-table th:nth-child(4),
.departures-table td:nth-child(4) { width: 30%; }

.departures-table th:nth-child(5),
.departures-table td:nth-child(5) { width: 12%; }

.departures-table th:nth-child(6),
.departures-table td:nth-child(6) { width: 27%; }

.departures-table td:nth-child(4) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.departures-table td:nth-child(6) {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.line-detail-panel h2 {
  margin: 0;
  color: var(--color-text-highlight);
}

.line-detail-panel p {
  margin: var(--space-2) 0 var(--space-3);
  color: var(--color-text-secondary);
}

.line-stop-button {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.stop-result-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  opacity: 0.9;
}

.stop-result-inline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
}

.stop-result-name {
  min-width: 0;
}

.stop-result-distance {
  margin-left: auto;
  flex-shrink: 0;
  text-align: right;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  opacity: 0.9;
  white-space: nowrap;
}

.line-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.trip-close {
  display: none;
  border: var(--border-width-thin) solid var(--color-border-soft);
  background: #00217d;
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font: inherit;
  cursor: pointer;
}

.mobile-empty {
  margin: 0;
  color: var(--color-text-secondary);
}

@media (max-width: 768px) {
  .trip-close {
    display: inline-block;
  }
}

@media (max-width: 680px) {
  .board-meta-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .selected-stop-head {
    width: 100%;
  }

  .board-meta-tools {
    width: 100%;
    justify-content: space-between;
  }

  .table-wrap {
    display: none;
  }

  .departures-cards {
    display: grid;
    gap: var(--space-2);
  }

  .departure-card {
    width: 100%;
    text-align: left;
    border: 1px solid var(--color-grid-line);
    background: var(--color-bg-row-odd);
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    display: block;
  }

  .departure-card.is-active {
    background: var(--color-bg-row-active);
    box-shadow: inset 0 0 0 2px #9fb5ff;
  }

  .departure-card-top {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: var(--space-2);
    align-items: baseline;
  }

  .departure-card-time,
  .departure-card-expected,
  .departure-card-line,
  .departure-card-destination,
  .departure-card-platform,
  .departure-card-remarks {
    margin: 0;
  }

  .departure-card-time {
    font-size: 1.15rem;
    font-weight: var(--font-weight-bold);
  }

  .departure-card-expected {
    font-size: 1rem;
  }

  .departure-card-line {
    justify-self: end;
    width: auto;
    font-size: 1rem;
    color: var(--color-text-highlight);
  }

  .departure-card-bottom {
    margin-top: var(--space-1);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-2);
    align-items: start;
  }

  .departure-card-button {
    width: 100%;
    cursor: pointer;
  }

  .departure-card-platform {
    background: rgba(255, 230, 0, 0.12);
    border: 1px solid rgba(255, 230, 0, 0.5);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.82rem;
    width: auto;
    text-decoration: none;
  }

  .departure-card-remarks {
    margin-top: var(--space-1);
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .departure-card-destination {
    white-space: normal;
  }

  .departure-card-source-badge {
    font-size: 0.66rem;
  }

  .departures-table {
    font-size: 0.78rem;
  }

  .departures-table th,
  .departures-table td {
    padding: 0.38rem;
  }

  .departures-table td {
    font-size: 0.86rem;
  }

  .departures-table th:nth-child(1),
  .departures-table td:nth-child(1) { width: 14%; }

  .departures-table th:nth-child(2),
  .departures-table td:nth-child(2) { width: 16%; }

  .departures-table th:nth-child(3),
  .departures-table td:nth-child(3) { width: 11%; }

  .departures-table th:nth-child(4),
  .departures-table td:nth-child(4) { width: 24%; }

  .departures-table th:nth-child(5),
  .departures-table td:nth-child(5) { width: 12%; }

  .departures-table th:nth-child(6),
  .departures-table td:nth-child(6) { width: 23%; }

  .departures-table td:nth-child(6) {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}
