* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #263238; background: #f4f7fb; }
.app-header { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: #ffffff; border-bottom: 1px solid #dfe7ef; }
.app-header h1 { margin: 0; font-size: 22px; }
.app-header p { margin: 3px 0 0; font-size: 12px; color: #607d8b; }
.status-badge { padding: 8px 12px; border-radius: 999px; background: #eef3f7; font-size: 12px; }
.layout { height: calc(100% - 72px); display: grid; grid-template-columns: 380px minmax(0, 1fr); }
.panel { overflow-y: auto; padding: 12px; background: #eef4f8; border-right: 1px solid #d9e3ea; }
.card { background: #fff; border: 1px solid #dbe5ec; border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card h2 { font-size: 15px; margin: 0 0 12px; }
label { display: block; font-size: 12px; font-weight: 700; margin: 8px 0; color: #455a64; }
input, select, button { width: 100%; padding: 9px 10px; border: 1px solid #c8d4dc; border-radius: 10px; font: inherit; background: #fff; }
select[multiple] { min-height: 92px; }
button { cursor: pointer; background: #f6f9fb; font-weight: 700; }
button.primary { background: #1976d2; color: #fff; border-color: #1976d2; }
button:hover { filter: brightness(.98); }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint, .small { font-size: 12px; color: #607d8b; line-height: 1.5; }
.check-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.check-label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 700; }
.check-label input { width: auto; padding: 0; }

.summary { font-size: 13px; line-height: 1.7; background: #f7fafc; border: 1px solid #e3ebf1; border-radius: 10px; padding: 10px; white-space: pre-wrap; }
.hourly-editor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 260px; overflow: auto; padding: 4px; background: #f7fafc; border-radius: 10px; }
.hourly-editor label { margin: 0; font-size: 11px; }
.hourly-editor input { padding: 6px; }
.map-wrap { position: relative; min-width: 0; }
#map { width: 100%; height: 100%; }
.legend { position: absolute; right: 12px; bottom: 16px; z-index: 400; background: rgba(255,255,255,.95); padding: 10px 12px; border-radius: 12px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.16); }
.legend div { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.swatch { width: 16px; height: 12px; display: inline-block; border: 1px solid rgba(0,0,0,.2); }
.level1 { background: #d73027; }
.stage1 { background: #f46d43; }
.stage2 { background: #fdae61; }
.stage3 { background: #fee08b; }
.stage4 { background: #d9ef8b; }
.stage5 { background: #91bfdb; }
.nonblank { background: #cfd8dc; }
.busy { position: fixed; inset: 0; z-index: 9999; background: rgba(255,255,255,.75); display: grid; place-items: center; text-align: center; }
.busy.hidden { display: none; }
.spinner { width: 48px; height: 48px; border: 5px solid #d9e3ea; border-top-color: #1976d2; border-radius: 50%; animation: spin 1s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.leaflet-popup-content { min-width: 260px; }
.popup-title { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.popup-grid { display: grid; grid-template-columns: 110px 1fr; gap: 3px 8px; font-size: 12px; }
@media (max-width: 900px) {
  .app-header { height: auto; align-items: flex-start; gap: 8px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 48vh 52vh; height: calc(100% - 86px); }
  .panel { order: 2; border-right: 0; border-top: 1px solid #d9e3ea; }
  .map-wrap { order: 1; }
}

.subheading { margin: 12px 0 6px; font-size: 13px; color: #455a64; }

.swatch.level1-gradient { background: linear-gradient(90deg, #fee5d9, #fcae91, #fb6a4a, #de2d26, #a50f15); }
.swatch.level1-gtfs-gradient { background: linear-gradient(90deg, #fff7ec, #fdd49e, #fdbb84, #fc8d59, #d7301f); }
.swatch.level2-gradient { background: linear-gradient(90deg, #edf8fb, #b3cde3, #8c96c6, #8856a7, #2b8cbe); }
