/* Bright, readable timetable palette in dark mode */

:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable,
:root[data-theme="dark"] #pageSchedule .compact-timetable th,
:root[data-theme="dark"] #pageSchedule .compact-timetable td {
  color: #f8fbfd !important;
}

:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable,
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody,
:root[data-theme="dark"] #pageSchedule .compact-timetable tr.train-row {
  background: var(--surface) !important;
}

:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable thead th,
:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable tbody tr.train-row > td {
  color: #f8fbfd !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable th,
:root[data-theme="dark"] #pageSchedule .compact-timetable td {
  border-color: #8897a1 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(1) {
  background: #6c7d87 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(1) {
  background: #52636d !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(2),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(3) {
  background: #806796 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(2),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(3) {
  background: #655276 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(4),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(5) {
  background: #3b84ac !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(4),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(5) {
  background: #316d8f !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(6),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(7),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(8) {
  background: #a88430 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(6),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(7),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(8) {
  background: #826925 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(9),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(10) {
  background: #938a40 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(9),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(10) {
  background: #746d33 !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(11),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(12),
:root[data-theme="dark"] #pageSchedule .compact-timetable thead th:nth-child(13) {
  background: #4b925c !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(11),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(12),
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row > td:nth-child(13) {
  background: #3d774b !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tr.train-row.train-marked > .mark-cell {
  background: #079447 !important;
}

:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable tbody tr.train-row.selected > td,
:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable tbody tr.train-row.selected:hover > td,
:root[data-theme="dark"] #pageSchedule table.dispatch-table.compact-timetable tbody tr.train-row:focus-visible > td {
  color: #fff !important;
  background: #168fdd !important;
  box-shadow: none !important;
  filter: none !important;
}

:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row.selected > td::before,
:root[data-theme="dark"] #pageSchedule .compact-timetable tbody tr.train-row:focus-visible > td::before {
  color: rgba(255, 255, 255, .82) !important;
}

/* Every timetable surface remains dark, including dialogs and editors. */
:root[data-theme="dark"] .train-info .route-table-scroll,
:root[data-theme="dark"] .train-info table.route-table {
  border-color: #8897a1 !important;
  color: #f8fbfd !important;
  background: var(--surface) !important;
}

:root[data-theme="dark"] .train-info .route-table th,
:root[data-theme="dark"] .train-info .route-table td {
  border-color: #8897a1 !important;
  color: #f8fbfd !important;
}

:root[data-theme="dark"] .train-info .route-table th:nth-child(1) {
  background: #3b84ac !important;
}

:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(1) {
  background: #316d8f !important;
}

:root[data-theme="dark"] .train-info .route-table th:nth-child(2),
:root[data-theme="dark"] .train-info .route-table th:nth-child(3),
:root[data-theme="dark"] .train-info .route-table th:nth-child(4) {
  background: #a88430 !important;
}

:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(2),
:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(3),
:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(4) {
  background: #826925 !important;
}

:root[data-theme="dark"] .train-info .route-table th:nth-child(5),
:root[data-theme="dark"] .train-info .route-table th:nth-child(6) {
  background: #938a40 !important;
}

:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(5),
:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(6) {
  background: #746d33 !important;
}

:root[data-theme="dark"] .train-info .route-table th:nth-child(7),
:root[data-theme="dark"] .train-info .route-table th:nth-child(8),
:root[data-theme="dark"] .train-info .route-table th:nth-child(9) {
  background: #4b925c !important;
}

:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(7),
:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(8),
:root[data-theme="dark"] .train-info .route-table tbody td:nth-child(9) {
  background: #3d774b !important;
}

:root[data-theme="dark"] .schedule-stops-scroll,
:root[data-theme="dark"] .schedule-stops-table,
:root[data-theme="dark"] .schedule-stops-table tbody,
:root[data-theme="dark"] .schedule-stops-table tr {
  border-color: var(--table-border) !important;
  color: var(--ink) !important;
  background: var(--surface) !important;
}

:root[data-theme="dark"] .schedule-stops-table th {
  border-color: var(--table-border) !important;
  color: var(--ink) !important;
  background: var(--table-head) !important;
}

:root[data-theme="dark"] .schedule-stops-table td {
  border-color: var(--table-border) !important;
  color: var(--ink) !important;
  background: var(--surface-soft) !important;
}
