:root {
  color-scheme: light;
  background: #f4f6f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f6f8;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 32px 18px;
}

.journey-panel {
  position: relative;
  background: #ffffff;
  border: 1px solid #d7dde3;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
  padding: 28px;
}

.home-button {
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: 48px;
  border: 2px solid #17202a;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  font-weight: 800;
  padding: 0 18px;
}

.masthead {
  border-bottom: 1px solid #e5e9ed;
  padding-bottom: 18px;
  margin-bottom: 24px;
  padding-right: 110px;
}

.eyebrow {
  color: #506171;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.05;
  margin: 0;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 0 0 18px;
}

h3 {
  font-size: 1rem;
  margin: 0 0 10px;
}

.step-label {
  color: #506171;
  font-weight: 700;
  margin: 10px 0 0;
}

.wizard-step {
  display: none;
}

.wizard-step.is-active {
  display: block;
}

.journey-form {
  display: grid;
  gap: 22px;
}

.field-group {
  display: grid;
  gap: 8px;
}

label {
  font-weight: 700;
}

.search-control {
  position: relative;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #aab5bf;
  border-radius: 6px;
  padding: 0 14px;
  color: #17202a;
  background: #ffffff;
}

.chat-shell {
  max-width: 880px;
}

.chat-home {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.chat-log {
  display: grid;
  gap: 14px;
  min-height: 360px;
  max-height: 58vh;
  overflow-y: auto;
  border: 1px solid #d7dde3;
  border-radius: 8px;
  background: #f9fafb;
  padding: 16px;
}

.chat-message {
  display: grid;
  gap: 10px;
}

.chat-message-user {
  justify-items: end;
}

.chat-message-assistant {
  justify-items: start;
}

.chat-bubble {
  max-width: min(680px, 100%);
  border: 1px solid #d7dde3;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  padding: 12px 14px;
  line-height: 1.45;
}

.chat-message-user .chat-bubble {
  border-color: #17202a;
  background: #17202a;
  color: #ffffff;
}

.chat-form {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-send {
  min-width: 110px;
}

.chat-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-choice {
  min-height: 42px;
}

.chat-details {
  width: min(680px, 100%);
  font-size: 0.9rem;
}

.chat-details pre {
  overflow-x: auto;
  border: 1px solid #d7dde3;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

@media (max-width: 640px) {
  .chat-input-row {
    grid-template-columns: 1fr;
  }

  .chat-send {
    width: 100%;
  }
}

input:focus {
  outline: 3px solid #f4c542;
  outline-offset: 1px;
  border-color: #17202a;
}

.helper {
  color: #506171;
  margin: 0;
  font-size: 0.95rem;
}

.results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #c8d0d8;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(23, 32, 42, 0.16);
}

.results.is-open {
  display: block;
}

.result-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  padding: 10px 14px;
  text-align: left;
}

.result-button:hover,
.result-button:focus {
  background: #edf7fb;
  outline: 0;
}

.quick-picks {
  border-top: 1px solid #e5e9ed;
  border-bottom: 1px solid #e5e9ed;
  padding: 18px 0;
}

.quick-picks-header {
  color: #2d3a45;
  font-weight: 700;
  margin-bottom: 12px;
}

.quick-pick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-pick {
  min-height: 48px;
  border: 2px solid #0c6b58;
  border-radius: 6px;
  background: #f3fbf8;
  color: #063f35;
  cursor: pointer;
  font-weight: 700;
  padding: 0 14px;
}

.quick-pick:hover,
.quick-pick:focus {
  background: #dff4ec;
  outline: 3px solid #f4c542;
  outline-offset: 1px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.choice-button {
  min-height: 72px;
  border: 2px solid #0c6b58;
  border-radius: 6px;
  background: #f3fbf8;
  color: #063f35;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 10px;
}

.choice-button:hover,
.choice-button:focus,
.choice-button.is-selected {
  background: #0c6b58;
  color: #ffffff;
  outline: 3px solid #f4c542;
  outline-offset: 1px;
}

.interchange-box {
  background: #f8fafc;
  border: 1px solid #d7dde3;
  border-radius: 8px;
  padding: 16px;
}

.results-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border: 1px solid #d7dde3;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
  margin-bottom: 18px;
  overflow: hidden;
}

.results-toolbar {
  align-items: center;
  background: #f8fafc;
  display: flex;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
}

.sort-control {
  align-items: center;
  display: flex;
  flex: 0 0 220px;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

.sort-control span {
  color: #506171;
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-row {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.results-toolbar .form-check {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dde3;
  border-radius: 6px;
  display: inline-flex;
  gap: 5px;
  margin: 0;
  min-height: 28px;
  padding: 3px 7px 3px 28px;
}

.results-toolbar .form-check-input {
  height: 0.86rem;
  margin-left: -22px;
  margin-top: 0;
  width: 1.55rem;
}

.results-toolbar .form-check-label {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.searched-journey {
  background: #17202a;
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  padding: 6px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 0.7fr);
  align-items: center;
  gap: 12px;
  min-height: 62px;
  background: #edf1f5;
  border-radius: 6px;
  color: #2d3a45;
  font-weight: 700;
  padding: 14px;
  margin-top: 24px;
}

.summary span {
  min-width: 0;
}

.arrow {
  color: #0c6b58;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.status-box {
  border-left: 5px solid #0c6b58;
  background: #edf7fb;
  border-radius: 6px;
  font-weight: 700;
  margin-bottom: 18px;
  padding: 14px;
}

.raw-results {
  display: grid;
  gap: 14px;
}

.field-block {
  border: 1px solid #d7dde3;
  border-radius: 6px;
  background: #f8fafc;
  padding: 14px;
}

.field-row {
  border-top: 1px solid #edf0f3;
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
  padding: 8px 0;
}

.journey-tile {
  border-radius: 8px;
}

.journey-tile-cancelled {
  box-shadow: inset 6px 0 0 #dc3545, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.google-alternatives {
  border-top: 1px solid #d7dde3;
  padding-top: 18px;
}

.google-route-tile {
  background: #f2f7ff;
  box-shadow: inset 6px 0 0 #0d6efd, 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.google-route-tile .card-body {
  background: #f2f7ff;
  border-radius: 8px;
}

.journey-route {
  font-size: 1.35rem;
  line-height: 1.2;
}

.journey-side {
  display: grid;
  gap: 7px;
  justify-items: start;
}

.journey-times {
  display: flex;
  gap: 18px;
  justify-content: flex-start;
}

.duration-label {
  color: #506171;
  font-size: 0.9rem;
  font-weight: 800;
}

.time-pair {
  display: grid;
  gap: 2px;
}

.time-pair span:first-child {
  color: #17202a;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.time-revised {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.time-scheduled {
  color: #6c757d;
  font-size: 0.82em;
  font-weight: 700;
  text-decoration: line-through;
}

.time-expected {
  color: #dc3545;
  font-weight: 900;
}

.time-cancelled {
  color: #dc3545;
  font-weight: 900;
}

.time-current {
  color: #17202a;
  font-weight: 800;
}

.connection-detail {
  color: #17202a;
}

.connection-divider {
  align-items: center;
  color: #506171;
  display: flex;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 10px;
  margin: 14px 0;
}

.connection-divider::before,
.connection-divider::after {
  background: #c8d0d8;
  content: "";
  flex: 1 1 auto;
  height: 1px;
}

.connection-divider span {
  background: #f8fafc;
  border: 1px solid #d7dde3;
  border-radius: 999px;
  padding: 4px 10px;
}

.train-identifiers {
  color: #0c6b58;
  font-weight: 800;
  margin-top: 4px;
}

.technical-toggle {
  font-weight: 800;
  text-decoration: none;
}

.technical-info {
  background: #ffffff;
  border: 1px solid #d7dde3;
  border-radius: 6px;
  margin-top: 6px;
  padding: 8px 10px;
}

.technical-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  padding: 4px 0;
}

.technical-row + .technical-row {
  border-top: 1px solid #edf0f3;
}

.technical-row span:first-child {
  color: #506171;
  font-weight: 800;
}

.technical-row span:last-child {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.raw-detail {
  color: #506171;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.wizard-nav {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  margin-top: 18px;
}

.primary-button {
  min-height: 52px;
  border: 0;
  border-radius: 6px;
  background: #17202a;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 18px;
}

.primary-button:disabled {
  background: #aab5bf;
  cursor: not-allowed;
}

.secondary-button {
  min-height: 52px;
  border: 2px solid #506171;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  font-weight: 700;
  padding: 0 18px;
}

.secondary-button:disabled {
  border-color: #c8d0d8;
  color: #87929c;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .shell {
    padding: 14px;
  }

  .journey-panel {
    padding: 20px;
  }

  .masthead {
    padding-right: 0;
    padding-top: 58px;
  }

  .home-button {
    left: 20px;
    right: 20px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .results-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-control {
    flex-basis: auto;
    width: 100%;
  }

  .filter-row {
    flex-wrap: wrap;
    white-space: normal;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .arrow {
    width: max-content;
  }

  .wizard-nav {
    grid-template-columns: 1fr;
  }

  .journey-times {
    justify-content: space-between;
  }

  .journey-side {
    justify-items: stretch;
  }
}
