* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1d2327;
  background: #f4f5f6;
}

header { padding: 10px 16px; background: #fff; border-bottom: 1px solid #dde1e4; }
h1 { margin: 0 0 8px; font-size: 18px; }
.tag { font-size: 12px; font-weight: 500; color: #5b6770; background: #eef1f3; padding: 2px 6px; border-radius: 4px; }
#filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#filters input, #filters select, #filters button, #more, #state button {
  font: inherit; padding: 5px 8px; border: 1px solid #c3c9ce; border-radius: 6px; background: #fff;
}
#filters input[type=number] { width: 80px; }
#filters input[type=search] { width: 220px; }
#filters button[type=submit] { background: #1a5fb4; color: #fff; border-color: #1a5fb4; }

main { display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
#list-pane { overflow: auto; padding: 10px; border-right: 1px solid #dde1e4; background: #fff; }
#list { list-style: none; margin: 0; padding: 0; }
#list li { padding: 10px; border: 1px solid #e2e6e9; border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
#list li:hover, #list li.active { border-color: #1a5fb4; background: #f2f7fd; }
#list h3 { margin: 0 0 4px; font-size: 15px; }
.meta { color: #5b6770; font-size: 12px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #eef1f3; margin-right: 4px; }
.badge.circular { background: #e3f4e8; color: #1e6b37; }
.badge.transit { background: #fdf0de; color: #8a5300; }
.warn { color: #a3361c; }
#state { padding: 14px; border-radius: 8px; background: #f7f8f9; margin-bottom: 8px; }
#state.error { background: #fdecea; color: #8c1d18; }
#more { width: 100%; }

#map-pane { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }
#map-down {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: #fff3cd; border: 1px solid #e6c35c; padding: 8px 14px; border-radius: 8px; z-index: 2;
}
#card {
  position: absolute; top: 12px; right: 12px; width: 360px; max-height: calc(100% - 24px); overflow: auto;
  background: #fff; border-radius: 10px; box-shadow: 0 4px 18px rgba(0, 0, 0, .18); padding: 14px; z-index: 3;
}
#card h2 { margin: 0 24px 6px 0; font-size: 17px; }
#card .close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 20px; cursor: pointer; }
#card ol { padding-left: 20px; margin: 6px 0; }

footer { display: flex; gap: 16px; align-items: flex-start; padding: 6px 16px; background: #fff; border-top: 1px solid #dde1e4; font-size: 12px; }
footer details { flex: 1; }
#log { max-height: 120px; overflow: auto; margin: 4px 0 0; font-family: ui-monospace, Consolas, monospace; }

.pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); cursor: pointer; }
.pin.start { background: #2e9e4f; }
.pin.finish { background: #d1462f; }
.pin.loop { background: #1a5fb4; }
.stop { width: 20px; height: 20px; border-radius: 50%; background: #1a5fb4; color: #fff; font-size: 11px; font-weight: 600;
        display: grid; place-items: center; border: 2px solid #fff; }

@media (max-width: 800px) {
  main { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  #card { width: auto; left: 12px; }
}
