@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #667386;
  --line: #d4dde6;
  --brand: #116a8c;
  --brand-dark: #0e536d;
  --blue-soft: #e8f4f8;
  --green: #1f8a50;
  --green-soft: #e2f4e9;
  --amber: #a46a00;
  --amber-soft: #fff0ce;
  --red: #b12f3c;
  --red-soft: #fae0e4;
  --purple: #7654a6;
  --purple-soft: #eee7f7;
  --cyan: #277282;
  --cyan-soft: #e4f4f7;
  --shadow: 0 10px 26px rgba(15, 29, 43, .12);
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--brand-dark);
  color: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .2);
}

.kicker {
  margin: 0 0 2px;
  color: #bde4ef;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
}

.top-subtitle {
  margin-top: 2px;
  color: #c9e6ee;
  font-size: 11px;
}

.header-tools {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.refresh-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 5px;
  font-weight: 700;
}

.refresh-status small {
  display: block;
  color: #c9e6ee;
  font-size: 10px;
}

.refresh-ring {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(#5bd082 var(--refresh-progress, 100%), rgba(255, 255, 255, .28) 0);
  position: relative;
}

.refresh-ring::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--brand-dark);
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding-bottom: 230px;
}

.controls {
  position: sticky;
  top: 66px;
  z-index: 18;
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
  padding: 10px;
  background: rgba(238, 242, 245, .96);
  backdrop-filter: blur(8px);
}

.search-box {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  overflow: hidden;
}

.search-box span {
  padding: 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  padding: 8px;
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button,
.small-button,
.view-switch button,
.filter-strip button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.icon-button {
  width: 36px;
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .24);
}

.view-switch button {
  min-height: 24px;
  min-width: 48px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.filter-strip button {
  border-radius: 4px;
}

.view-switch .selected,
.filter-strip .selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.view-switch .selected {
  background: #fff;
  border-color: #fff;
  color: var(--brand-dark);
}

.board-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.select-control,
.toggle-control {
  display: grid;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.select-control {
  grid-template-columns: 42px 1fr;
}

.select-control span {
  padding-left: 8px;
  color: var(--muted);
  font-weight: 700;
}

.select-control select {
  min-width: 0;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.toggle-control {
  grid-template-columns: 28px 1fr;
  padding: 0 8px 0 4px;
  color: var(--ink);
  font-weight: 700;
}

.board-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 10px 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.board-status strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

.board-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.filter-meta {
  margin-top: 2px;
}

.filter-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin: 0 10px 8px;
  padding: 2px;
  border-radius: 6px;
  background: #dde5ec;
}

.alert-panel {
  margin: 0 10px 8px;
  padding: 9px 10px;
  border: 1px solid #f0cb80;
  border-radius: 6px;
  background: #fff8e7;
  color: #6d4700;
  font-weight: 700;
}

.board {
  display: grid;
  gap: 8px;
  padding: 0 10px;
}

.service-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(15, 29, 43, .04);
  overflow: hidden;
}

.service-card.selected {
  outline: 2px solid var(--brand);
}

.service-card.warn {
  border-left-color: var(--amber);
}

.service-card.bad {
  border-left-color: var(--red);
}

.service-card.service-bus {
  border-left-color: var(--purple);
}

.service-card.service-ferry {
  border-left-color: var(--cyan);
}

.service-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.card-main {
  display: grid;
  grid-template-columns: 44px 1fr 48px;
  gap: 8px;
  align-items: start;
  padding: 9px 9px 6px;
}

.service-time {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
}

.service-time span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.service-title h2 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.service-title p,
.card-note,
.detail-muted {
  color: var(--muted);
}

.service-title p {
  margin-top: 2px;
  font-size: 12px;
}

.platform-box {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--brand-dark);
  font-size: 20px;
  font-weight: 700;
}

.platform-box span {
  display: block;
  font-size: 9px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.platform-box.hidden-platform {
  background: #f1f3f5;
  color: var(--muted);
  text-decoration: line-through;
}

.card-note {
  padding: 0 9px 8px;
  font-size: 12px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 9px 8px;
}

.flag,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #edf2f6;
  color: #344253;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.flag.operational {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.flag.restriction {
  background: var(--amber-soft);
  color: var(--amber);
}

.flag.disruption {
  background: var(--red-soft);
  color: var(--red);
}

.flag.association {
  background: var(--purple-soft);
  color: var(--purple);
}

.flag.source {
  background: #e7edff;
  color: #3457a6;
}

.status-pill.good {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.late {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.train-strip {
  display: flex;
  align-items: flex-start;
  gap: 3px;
  padding: 8px 9px 9px;
  border-top: 1px solid #edf1f5;
  overflow-x: auto;
}

.coach {
  position: relative;
  flex: 0 0 24px;
  min-height: 20px;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 3px;
  background: var(--green);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.coach-markers {
  display: flex;
  justify-content: center;
  gap: 1px;
  margin-top: 1px;
  color: #fff;
  font-size: 7px;
  line-height: 1;
}

.direction {
  flex: 0 0 auto;
  min-height: 20px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.loading-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px 0;
  color: var(--muted);
  font-size: 11px;
}

.loading-summary strong {
  color: var(--ink);
  font-weight: 700;
}

.coach.medium {
  background: #d99b16;
}

.coach.busy {
  background: #c34335;
}

.coach.unknown {
  background: #8591a0;
}

.dense {
  gap: 4px;
}

.dense-row {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 7px;
  align-items: center;
  padding: 7px 8px;
}

.dense-main {
  min-width: 0;
}

.dense-main h2 {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dense-main p {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dense-flags {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  overflow: hidden;
}

.dense-flags .flag,
.dense-flags .status-pill {
  min-height: 17px;
  padding: 1px 4px;
  font-size: 9px;
}

.dense-platform {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--brand-dark);
  font-size: 15px;
  font-weight: 700;
}

.station-arrival {
  color: var(--muted);
  font-size: 11px;
}

.service-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  max-height: 72vh;
  overflow: auto;
  padding: 8px 10px 14px;
  border-top: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateY(100%);
  transition: transform .18s ease;
}

.service-panel.open {
  transform: translateY(0);
}

.panel-handle {
  width: 44px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 99px;
  background: #b9c3cf;
}

.panel-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.detail-head {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.detail-head h2 {
  font-size: 17px;
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0;
}

.metric {
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.association-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 8px 0;
}

.association-strip button {
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
}

.detail-banner {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.detail-banner.warn {
  border-color: #f0cb80;
  background: #fff8e7;
  color: #6d4700;
}

.detail-banner.bad {
  border-color: #edb4bd;
  background: #fff2f4;
  color: var(--red);
}

.calls {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.call-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.call-row:last-child {
  border-bottom: 0;
}

.call-row.request,
.call-row.restriction {
  background: #fffaf0;
}

.call-row.cancelled {
  background: #fff2f4;
}

.call-time {
  font-weight: 700;
}

.call-time span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.passing-points {
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.passing-points summary {
  min-height: 34px;
  padding: 9px;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

.pass-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  padding: 7px 9px;
  border-top: 1px solid #e7edf3;
  color: #465468;
}

.pass-row span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.passing-toggle {
  width: 100%;
  min-height: 34px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  color: var(--brand-dark);
  font-weight: 700;
}

.calls.hide-passing .passing-points {
  display: none;
}

.notice-list {
  display: grid;
  gap: 6px;
  margin: 0 10px 8px;
}

.notice-summary {
  width: calc(100% - 20px);
  min-height: 34px;
  margin: 0 10px 8px;
  border: 1px solid #f0d597;
  border-radius: 6px;
  background: #fff9eb;
  color: #6d4700;
  font-weight: 700;
}

.notice-summary.major,
.notice-summary.severe {
  border-color: #edb4bd;
  background: #fff2f4;
  color: var(--red);
}

.notice-list.collapsed {
  display: none;
}

.notice {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.notice.minor {
  border-color: #f0d597;
  background: #fff9eb;
}

.notice.major,
.notice.severe {
  border-color: #edb4bd;
  background: #fff2f4;
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.notice p {
  color: var(--muted);
  font-size: 12px;
}

.notice a {
  color: var(--brand-dark);
  font-weight: 700;
}

.flags-dialog {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
}

.flags-dialog::backdrop {
  background: rgba(15, 29, 43, .38);
}

.flags-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.flags-dialog h2 {
  font-size: 17px;
}

.flag-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.flag-def {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 8px;
  align-items: start;
}

.flag-def p {
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 760px) {
  body {
    font-size: 14px;
  }

  .controls {
    grid-template-columns: 1fr 86px;
  }

  .board.cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-panel {
    top: 76px;
    right: 18px;
    bottom: 18px;
    left: auto;
    width: 420px;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    transform: translateX(calc(100% + 28px));
  }

  .service-panel.open {
    transform: translateX(0);
  }
}
