* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
}
body {
  margin: 0;
  color: #133;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #f6f8fa;
}
header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: #004494;
  color: #fff;
}
header h1 {
  flex: 1;
  font-size: 1.2rem;
  margin: 0;
  font-weight: 600;
}
header button {
  background: #fff;
  color: #004494;
  border: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
header button.secondary {
  background: #f1f5f4;
}
#appLayout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 0;
}
#selectors {
  padding: 1rem;
  overflow: auto;
  background: #fff;
  border-right: 1px solid #d0dad8;
}
#selectors h2 {
  margin: 0.6rem 0 0.4rem;
  font-size: 1rem;
  color: #144;
}
label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: #155;
}
select {
  padding: 0.45rem 0.5rem;
  border: 1px solid #8bb5ae;
  border-radius: 4px;
  background: #fff;
}
#swapRow {
  margin-bottom: 0.6rem;
  text-align: right;
}
#swapBtn {
  background: #75BDFB;
  color: #fff;
  border: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
}
.status {
  font-size: 0.75rem;
  color: #555;
  margin-bottom: 0.5rem;
  min-height: 1.1rem;
}
#optionsList {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.optionCard {
  border: 2px solid #d9e5e2;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  outline: none;
  transition: background 0.2s, border 0.2s, transform 0.1s;
  position: relative; /* allow absolute badge */
}
.optionCard:hover,
.optionCard:focus {
  border-color: #004494;
  cursor: pointer;
}
.optionCard.chosen {
  background: #98c33a84;
  box-shadow: 0 0 0 2px #ffb74d40;
}
/* Chosen (solver-selected) badge */
.optionCard .selected-badge {
  position: absolute;
  bottom: 4px;
  right: 6px;
  background: #98C33A;
  color: #103013;
  padding: 0.15rem 0.45rem;
  font-size: 0.55rem;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 1px 2px #0002;
  pointer-events: none;
}
.opt-line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
}
.opt-line2 {
  display: flex;
  gap: 0.7rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #335;
}
.price {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0d473f;
}
.modes {
  display: flex;
  gap: 0.25rem;
}
.mode-icon {
  font-size: 1rem;
  line-height: 1;
}
#mapPanel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#tripDetails {
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-bottom: 1px solid #d0dad8;
  min-height: 58px;
  font-size: 0.8rem;
  line-height: 1.2;
}
#map {
  flex: 1;
}
.leaflet-container {
  width: 100%;
  height: 100%;
}
#metaDialog {
  max-width: 640px;
  width: 90%;
}
#metaContent {
  max-height: 60vh;
  overflow: auto;
  background: #0c27302b;
  padding: 0.6rem;
  border-radius: 4px;
}
.badge {
  background: #004494;
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.55rem;
  font-weight: 600;
}
/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.loading-overlay.hidden { display: none; }
.loading-overlay .loading-box {
  background: #ffffffeb;
  padding: 1rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 4px 16px -2px #0005;
  font-size: 0.95rem;
  font-weight: 600;
  color: #123;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.loading-overlay .loading-box:before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid #98C33A;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  #appLayout {
    grid-template-columns: 100%;
  }
  #selectors {
    border-right: 0;
    border-bottom: 1px solid #d0dad8;
  }
  #mapPanel {
    height: 60vh;
  }
}
