* {
  box-sizing: border-box;
}

:root {
  --blue: #0a67c7;
  --blue2: #1554a8;
  --cyan: #46bdd4;

  --mint: #d9f7f4;

  --ink: #143047;
  --muted: #6d7d8b;

  --line: #e4eaf0;
  --card: #ffffff;

  --good: #18864b;
  --good-bg: #dff5e9;

  --warn: #d98200;
  --warn-bg: #fff1d8;

  --bad: #c53b3b;
  --bad-bg: #fde4e4;

  --planned: #0a67c7;
  --planned-bg: #e9f1ff;
}

html,
body {
  margin: 0;
  padding: 0;

  background: var(--mint);
  color: var(--ink);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}


/* =========================================================
   APP
   ========================================================= */

.app-shell {
  width: min(1160px, 100%);
  margin: 0 auto;

  padding: 16px 14px 40px;
}


/* =========================================================
   HERO
   ========================================================= */

.hero {
  background: var(--card);

  border-radius: 26px;

  padding: 12px 16px;

  display: grid;
  grid-template-columns: 96px 1fr;

  align-items: center;

  gap: 16px;

  box-shadow:
    0 10px 35px
    rgba(20, 48, 71, 0.1);
}

.logo {
  width: 96px;
  height: 96px;

  border-radius: 18px;

  object-fit: cover;

  display: block;
}

.hero-copy .eyebrow {
  color: var(--cyan);

  font-weight: 800;

  font-size: 0.78rem;

  text-transform: uppercase;

  letter-spacing: 0.08em;
}

h1 {
  margin: 2px 0 5px;

  color: var(--blue);

  font-size:
    clamp(1.55rem, 5vw, 2.5rem);

  line-height: 1;
}

.hero-copy p {
  margin: 0;

  color: var(--muted);

  font-weight: 700;
}


/* =========================================================
   STATUS
   ========================================================= */

.statusbar {
  margin: 12px 0;

  background: #fff;

  border: 1px solid var(--line);

  border-radius: 16px;

  padding: 10px 12px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 10px;

  font-size: 0.88rem;
}

.statusbar > div {
  display: flex;

  align-items: center;

  gap: 8px;

  flex-wrap: wrap;
}

.dot {
  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: var(--good);

  display: inline-block;

  box-shadow:
    0 0 0 4px
    rgba(24, 134, 75, 0.12);
}

.dot.off {
  background: var(--warn);

  box-shadow:
    0 0 0 4px
    rgba(217, 130, 0, 0.12);
}

#updatedAt {
  color: var(--muted);
}

.secondary-btn {
  border: 0;

  border-radius: 12px;

  padding: 10px 14px;

  font-weight: 800;

  background: #eaf3fc;

  color: var(--blue);
}


/* =========================================================
   NEXT TRAIN
   ========================================================= */

.next-card {
  background:
    linear-gradient(
      135deg,
      var(--blue),
      var(--blue2)
    );

  color: white;

  border-radius: 20px;

  padding: 16px;

  box-shadow:
    0 12px 30px
    rgba(10, 103, 199, 0.22);
}

.next-label {
  font-size: 0.72rem;

  letter-spacing: 0.12em;

  font-weight: 900;

  opacity: 0.75;
}

.next-main {
  display: flex;

  justify-content: space-between;

  align-items: center;

  gap: 16px;

  margin-top: 4px;
}

.next-route {
  font-size: 1.45rem;

  font-weight: 900;
}

.next-meta {
  opacity: 0.86;

  font-size: 0.9rem;

  margin-top: 3px;
}

.next-time {
  font-size: 2.25rem;

  font-weight: 950;

  white-space: nowrap;
}

.next-advice {
  margin-top: 10px;

  padding-top: 10px;

  border-top:
    1px solid
    rgba(255, 255, 255, 0.2);

  font-weight: 800;
}

.next-late {
  color: #ffd18b;
}


/* =========================================================
   LEGEND
   ========================================================= */

.legend {
  display: flex;

  align-items: center;

  gap: 6px;

  flex-wrap: wrap;

  margin: 12px 2px;
}

.pill {
  font-size: 0.67rem;

  font-weight: 950;

  padding: 4px 7px;

  border-radius: 999px;
}

.pill.live {
  background: var(--good-bg);

  color: var(--good);
}

.pill.planned {
  background: var(--planned-bg);

  color: var(--blue);
}

.pill.done {
  background: var(--good-bg);

  color: var(--good);
}

.legend-text {
  color: var(--muted);

  font-size: 0.78rem;

  margin-left: 4px;
}


/* =========================================================
   HEADINGS
   ========================================================= */

.section-heading {
  display: flex;

  justify-content: space-between;

  align-items: end;

  gap: 10px;

  margin: 18px 2px 10px;
}

.section-heading h2 {
  margin: 0;

  font-size: 1.25rem;
}

.section-heading p {
  margin: 4px 0 0;

  color: var(--muted);

  font-size: 0.82rem;

  max-width: 700px;
}


/* =========================================================
   PROGRESS
   ========================================================= */

.progress-wrap {
  background: white;

  border: 1px solid var(--line);

  border-radius: 14px;

  padding: 10px 12px;

  margin-bottom: 10px;
}

.progress-top {
  display: flex;

  justify-content: space-between;

  align-items: center;

  gap: 10px;

  font-size: 0.8rem;

  font-weight: 800;
}

.progress-bar-track {
  height: 7px;

  background: #e9eff4;

  border-radius: 99px;

  overflow: hidden;

  margin-top: 7px;
}

.progress-bar {
  height: 100%;

  width: 0;

  background:
    linear-gradient(
      90deg,
      var(--blue),
      var(--cyan)
    );

  border-radius: 99px;

  transition:
    width 0.25s ease;
}


/* =========================================================
   LOADING / ERROR
   ========================================================= */

.loading-card,
.empty {
  background: #fff;

  border: 1px dashed #b8c6d2;

  border-radius: 15px;

  padding: 16px;

  color: var(--muted);
}

.error-card {
  display: grid;

  gap: 5px;

  border-color: var(--bad);

  color: var(--bad);
}


/* =========================================================
   TABLE
   ========================================================= */

.table-scroll {
  width: 100%;

  overflow-x: auto;
  overflow-y: hidden;

  -webkit-overflow-scrolling: touch;

  border-radius: 18px;

  box-shadow:
    0 5px 18px
    rgba(20, 48, 71, 0.06);
}

.tour-table {
  width: 100%;

  min-width: 940px;

  table-layout: fixed;

  border-collapse: separate;

  border-spacing: 0;

  background: #fff;

  border: 1px solid var(--line);

  border-radius: 18px;

  overflow: hidden;
}


/*
 * Column widths:
 *
 * #               6%
 * Stop            12%
 * Arrive at       11%
 * Wetherspoon     27%
 * Walk / bus      13%
 * Leave pub       15%
 * Planned train   16%
 */

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

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

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

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

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

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

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

.tour-table th,
.tour-table td {
  padding: 11px 10px;

  text-align: left;

  vertical-align: top;

  border-bottom:
    1px solid var(--line);
}

.tour-table th {
  background: #f7fafc;

  font-size: 0.72rem;

  text-transform: uppercase;

  letter-spacing: 0.06em;

  color: var(--muted);
}

.tour-table tr:last-child td {
  border-bottom: 0;
}

.tour-table tr.stop-completed {
  background:
    linear-gradient(
      90deg,
      #f2fbf5,
      #ffffff
    );
}


/* =========================================================
   NUMBER / COMPLETION
   ========================================================= */

.number-cell {
  white-space: nowrap;

  text-align: center !important;
}

.completion-indicator {
  display: inline-flex;

  width: 28px;
  height: 28px;

  align-items: center;

  justify-content: center;

  border-radius: 50%;

  background: #f1f5f8;

  color: var(--blue);

  font-size: 0.78rem;

  font-weight: 950;
}

.completion-indicator.completed {
  width: auto;

  min-width: 32px;

  padding: 0 4px;

  background: var(--good-bg);

  color: var(--good);

  font-size: 1.05rem;
}


/* =========================================================
   STOP / PUB
   ========================================================= */

.stop-town {
  font-weight: 900;
}

.pub {
  font-weight: 900;

  overflow-wrap: anywhere;
}

.pub-name-row {
  display: flex;

  align-items: flex-start;

  gap: 5px;
}

.pint {
  flex: 0 0 auto;

  font-size: 1rem;

  line-height: 1.1;
}

.pub-completed {
  color: #126c3d;
}

.pub small,
.subtle {
  display: block;

  color: var(--muted);

  font-weight: 600;

  font-size: 0.75rem;

  margin-top: 3px;

  line-height: 1.35;
}

.pub-stay {
  display: inline-flex;

  align-items: baseline;

  gap: 5px;

  margin-top: 8px;

  padding: 5px 7px;

  background: #eef8f4;

  color: var(--good);

  border-radius: 8px;

  font-size: 0.75rem;
}

.pub-stay span {
  color: var(--muted);

  font-weight: 600;
}

.done-label {
  display: inline-block;

  margin-top: 7px;

  padding: 4px 7px;

  background: var(--good-bg);

  color: var(--good);

  border-radius: 999px;

  font-size: 0.68rem;

  font-weight: 900;
}


/* =========================================================
   ARRIVAL
   ========================================================= */

.arrival-cell {
  background: #f7fbff;

  border-radius: 8px;

  padding: 5px 6px;
}

.arrival-cell .time {
  color: var(--blue2);
}


/* =========================================================
   TIMES
   ========================================================= */

.time {
  font-weight: 950;

  white-space: nowrap;
}

.planned-time {
  color: var(--blue);
}

.leave {
  color: var(--blue2);
}


/* =========================================================
   LIVE TRAIN
   ========================================================= */

.live-train,
.planned-train,
.planned-only {
  display: flex;

  flex-wrap: wrap;

  align-items: center;

  gap: 5px;
}

.live-time {
  color: var(--good);

  font-weight: 950;

  font-size: 1rem;
}

.late-train .live-time {
  color: var(--bad);
}

.on-time-train .live-time {
  color: var(--good);
}

.status-badge {
  font-size: 0.65rem;

  font-weight: 900;

  border-radius: 999px;

  padding: 3px 6px;

  background: var(--good-bg);

  color: var(--good);
}

.status-badge.late {
  background: var(--bad-bg);

  color: var(--bad);
}

.route-code {
  white-space: nowrap;
}


/* =========================================================
   LEAVE TIME
   ========================================================= */

.leave-cell.changed {
  display: grid;

  gap: 6px;
}

.original-time {
  color: var(--muted);

  font-size: 0.8rem;
}

.new-leave {
  padding: 6px 8px;

  border-radius: 8px;

  background: #fff0f0;

  color: var(--bad);
}

.new-leave strong {
  font-size: 1rem;

  white-space: nowrap;
}

.new-leave .subtle {
  color: var(--bad);

  opacity: 0.8;
}


/* =========================================================
   COMPLETED LEAVE
   ========================================================= */

.completed-leave {
  padding: 7px;

  background:
    #f0faf4;

  border-radius: 9px;

  border:
    1px solid
    #ccebd8;
}

.completed-label {
  color: var(--good);

  font-size: 0.7rem;

  font-weight: 950;
}

.completed-leave-time {
  margin-top: 3px;

  color: var(--good);

  font-size: 1rem;

  font-weight: 950;
}

.recorded-train {
  margin-top: 6px;

  color: var(--good);

  font-size: 0.72rem;

  font-weight: 800;
}

.completed-leave .original-time {
  margin-top: 5px;

  font-size: 0.7rem;
}


/* =========================================================
   WALK / BUS
   ========================================================= */

.transport strong {
  white-space: nowrap;
}

.transport.bus strong {
  color: var(--blue2);
}

.pub-connection {
  margin-top: 8px;

  padding-top: 7px;

  border-top:
    1px solid
    var(--line);
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
  margin: 20px 3px 0;

  color: var(--muted);

  font-size: 0.72rem;

  line-height: 1.45;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .tour-table {
    min-width: 940px;
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {
  .app-shell {
    padding: 8px 8px 30px;
  }

  .hero {
    grid-template-columns: 70px 1fr;

    border-radius: 18px;

    padding: 9px;

    gap: 10px;
  }

  .logo {
    width: 70px;
    height: 70px;

    border-radius: 13px;
  }

  .hero-copy p {
    font-size: 0.78rem;
  }

  .hero-copy .eyebrow {
    font-size: 0.65rem;
  }

  .hero-copy h1 {
    font-size: 1.5rem;
  }

  .statusbar {
    position: sticky;

    top: 0;

    z-index: 10;
  }

  .table-scroll {
    margin-right: 0;

    border-radius: 16px;
  }

  .tour-table {
    min-width: 940px;
  }

  .tour-table th,
  .tour-table td {
    padding: 10px 9px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .next-main {
    gap: 10px;
  }

  .next-route {
    font-size: 1.15rem;
  }

  .next-time {
    font-size: 1.9rem;
  }
}


/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 430px) {
  .hero {
    grid-template-columns: 58px 1fr;

    padding: 8px;
  }

  .logo {
    width: 58px;
    height: 58px;

    border-radius: 11px;
  }

  .hero-copy h1 {
    font-size: 1.25rem;
  }

  .hero-copy p {
    font-size: 0.68rem;
  }

  .hero-copy .eyebrow {
    font-size: 0.58rem;
  }

  .statusbar {
    font-size: 0.78rem;
  }

  .secondary-btn {
    padding: 8px 10px;

    font-size: 0.78rem;
  }

  .next-card {
    padding: 14px;
  }

  .next-route {
    font-size: 1.05rem;
  }

  .next-meta {
    font-size: 0.75rem;
  }

  .next-time {
    font-size: 1.65rem;
  }
}
