:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #293a9b;
  background: #ffffff;
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  padding: 0 13px 24px;
  background: repeating-linear-gradient(
    0deg,
    #ffffff 0,
    #ffffff 2px,
    #fafcff 2px,
    #fafcff 3px
  );
  font-size: 16px;
}

.page-header {
  min-height: 125px;
  padding: 22px 0;
  border-bottom: 1px solid #999999;
  text-align: center;
}

.page-header h1,
.page-header h2 {
  margin: 0;
  color: #293a9b;
}

.page-header h1 {
  font-size: 31px;
  line-height: 1.05;
}

.page-header h2 {
  font-size: 24px;
  line-height: 1.1;
}

.disclaimer {
  margin: 7px 0 0;
  color: #293a9b;
  font-size: 13px;
}

.site-nav {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid #999999;
}

.site-nav a {
  padding: 8px 14px;
  white-space: nowrap;
  color: inherit;
}

.site-nav a.selected {
  color: #293a9b;
  background: #d8eaff;
  font-weight: bold;
  text-decoration: none;
}

.site-nav-secondary {
  display: flex;
  margin-left: auto;
  border-left: 1px solid #999999;
}

main {
  padding-top: 27px;
}

h3 {
  margin: 0 0 8px;
  color: #293a9b;
  font-size: 24px;
}

#directory-content > h3 {
  margin-top: 0;
  padding-top: 24px;
}

#directory-content > h3:first-child {
  padding-top: 0;
}

p {
  margin: 6px 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: #293a9b;
  text-decoration: underline;
}

.train-form {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 18px;
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  margin-bottom: 10px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.section-toolbar .train-form {
  margin-bottom: 0;
}

body:not(.has-train) .section-toolbar {
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

body:not(.has-train) .section-toolbar .table-toolbar {
  justify-content: flex-start;
}

.table-toolbar input {
  width: 260px;
}

.table-toolbar select {
  width: 260px;
}

.quick-searches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: #555555;
  font-size: 0.9rem;
}

.quick-searches button {
  border: 1px solid #b7c3e9;
  background: #f4f6ff;
  color: #293a9b;
  cursor: pointer;
  padding: 3px 8px;
}

.quick-searches button:hover {
  background: #d8eaff;
}

.trains-toolbar {
  flex: 1;
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
}

.trains-toolbar .history-controls {
  margin-left: auto;
}

body[data-directory="trains"] .section-toolbar {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

body[data-directory="trains"] .section-toolbar .table-toolbar {
  width: 100%;
}

.table-toolbar button {
  height: 31px;
  padding: 4px 10px;
  border: 1px solid #777777;
  background: #eeeeee;
  color: #111111;
  cursor: pointer;
}

.last-updated {
  margin: 7px 0 18px;
  color: #0075c8;
  font-size: 14px;
  text-align: left;
}

.action-icon {
  display: inline-block;
  min-width: 18px;
  margin: 0 1px;
  color: #0000ee;
  font-size: 17px;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.action-icon:hover {
  color: #293a9b;
  text-decoration: underline;
}

.history-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.history-controls[hidden] {
  display: none;
}

.history-controls button {
  min-width: 31px;
  height: 31px;
  padding: 4px 8px;
  border: 1px solid #777777;
  background: #eeeeee;
  color: #0000ee;
  line-height: 21px;
  text-align: center;
}

.history-controls button:hover:not(:disabled) {
  background: #d8eaff;
}

.history-controls button:disabled {
  background: #f7f7f7;
  color: #999999;
  cursor: default;
}

.history-controls span {
  min-width: 0;
  color: #293a9b;
  text-align: center;
}

.history-controls input {
  width: 42px;
  height: 31px;
  padding: 4px;
  text-align: center;
}

.status-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.status-footer .last-updated {
  margin-bottom: 18px;
}

.train-summary {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.train-summary li {
  margin: 6px 0;
}

input,
select,
button {
  font: inherit;
}

input {
  width: 130px;
  height: 31px;
  padding: 4px 6px;
  border: 1px solid #777777;
}

select {
  height: 31px;
  padding: 4px 6px;
  border: 1px solid #777777;
  background: #ffffff;
}

.train-form button {
  height: 31px;
  padding: 4px 10px;
  border: 1px solid #777777;
  background: #eeeeee;
  color: #111111;
  cursor: pointer;
}

.error {
  color: #d00000;
}

.loading {
  color: #293a9b;
}

.train-title {
  margin: 0 0 17px;
  color: #293a9b;
  font-size: 24px;
}

.blue-line {
  color: #293a9b;
}

.delay-text {
  color: #ef4444;
}

.on-time-text {
  color: #10b981;
}

.delay-success {
  color: #10b981;
}

.delay-warning {
  color: #f59e0b;
}

.delay-danger {
  color: #ef4444;
}

.delay-neutral {
  color: #64748b;
}

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

table {
  width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  color: #111111;
}

th,
td {
  white-space: nowrap;
  padding: 4px 6px;
  border-right: 3px solid #ffffff;
  border-bottom: 3px solid #ffffff;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #3598ed;
  color: #000000;
  font-size: 18px;
  line-height: 1.02;
}

td {
  background: #b8d9fa;
}

tr.current td {
  box-shadow: inset 4px 0 #d40077;
  font-weight: bold;
}

.current-vehicle {
  color: #d40077;
  font-weight: bold;
  text-decoration: underline;
}

.vehicle-info-table a,
.vehicle-history a {
  color: #293a9b;
}

tr.passed td {
  color: #66727c;
}

.composition-table {
  margin-top: 0;
}

#active-table {
  margin-top: 0;
}

#active-table th:last-child,
#active-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

#active-table {
  min-width: 1120px;
}

.composition-table th:nth-child(1) {
  width: 18%;
}

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

.composition-table th:nth-child(3) {
  width: 14%;
}

.composition-table th:nth-child(4),
.composition-table th:nth-child(5) {
  width: 25%;
}

.history-table {
  margin-top: 8px;
}

.catalog-table {
  min-width: 980px;
}

#compositions-table th:nth-child(-n + 5),
#compositions-table td:nth-child(-n + 5),
.history-block th:nth-child(-n + 5),
.history-block td:nth-child(-n + 5),
.vehicle-history th:nth-child(-n + 4),
.vehicle-history td:nth-child(-n + 4) {
  white-space: nowrap;
}

#compositions-table {
  min-width: 1100px;
}

#compositions-table th:nth-child(1),
#compositions-table td:nth-child(1) {
  width: 110px;
}

#compositions-table th:nth-child(2),
#compositions-table td:nth-child(2) {
  width: 125px;
}

#compositions-table th:nth-child(3),
#compositions-table td:nth-child(3) {
  width: 90px;
}

#compositions-table th:nth-child(4),
#compositions-table td:nth-child(4),
#compositions-table th:nth-child(5),
#compositions-table td:nth-child(5) {
  width: auto;
}

#active-table th:nth-child(-n + 7),
#active-table td:nth-child(-n + 7),
#delay th:nth-child(-n + 4),
#delay td:nth-child(-n + 4) {
  white-space: nowrap;
}

.vehicle-detail {
  width: 100%;
}

.vehicle-info-table {
  width: max-content;
  min-width: 420px;
  max-width: 700px;
}

.vehicle-info-table table {
  width: max-content;
  min-width: 0;
}

.vehicle-image {
  display: block;
  width: min(100%, 420px);
  height: 260px;
  margin: 0 0 14px;
  object-fit: contain;
  background: #f4f8fd;
}

.vehicle-stats {
  color: #293a9b;
}

.vehicle-history {
  margin-top: 24px;
}

.stats-table-wrap {
  max-width: 800px;
}

.stats-daily-wrap {
  margin-top: 24px;
}

.history-block {
  margin-bottom: 22px;
}

.history-block h3 {
  margin-bottom: 4px;
  font-size: 20px;
}

@media (max-width: 700px) {
  .page-header {
    text-align: left;
  }

  .page-header h1,
  .page-header h2 {
    text-align: left;
  }

  .page-header h1 {
    font-size: 25px;
  }

  .page-header h2 {
    font-size: 18px;
  }

  .table-toolbar {
    justify-content: flex-start;
  }

  .site-nav {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .site-nav-secondary {
    width: 100%;
    margin-left: 0;
    border-top: 1px solid #999999;
    border-left: 0;
    flex-wrap: wrap;
  }

  .section-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  th,
  td {
    white-space: nowrap;
  }
}
