* { 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 { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; 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; line-height: 1.4; }
.status-badge { white-space: nowrap; 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; }
.subheading { margin: 12px 0 6px; font-size: 13px; color: #455a64; }
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; }
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; }
.button-row.single { grid-template-columns: 1fr; }
.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; }
.category-grid { gap: 8px; }
.summary { font-size: 13px; line-height: 1.7; background: #f7fafc; border: 1px solid #e3ebf1; border-radius: 10px; padding: 10px; white-space: pre-wrap; }
.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); }
.dot { width: 12px; height: 12px; display: inline-block; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); margin-right: 6px; vertical-align: -1px; }
.level5 { background: #1976d2; }
.level4 { background: #4fc3f7; }
.level3 { background: #fdd835; }
.level2 { background: #fb8c00; }
.level1 { background: #e53935; }
.line-sample { width: 24px; height: 0; border-top: 3px solid; display: inline-block; }
.line-sample.rail { border-color: #3949ab; }
.line-sample.bus { border-color: #00897b; }
.level-table { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 13px; }
.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: 280px; }
.popup-title { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.popup-grid { display: grid; grid-template-columns: 112px 1fr; gap: 3px 8px; font-size: 12px; }
.popup-grid .muted { color: #607d8b; }
@media (max-width: 900px) {
  .app-header { min-height: auto; align-items: flex-start; }
  .app-header h1 { font-size: 18px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 52vh 48vh; height: calc(100% - 86px); }
  .panel { order: 2; border-right: 0; border-top: 1px solid #d9e3ea; }
  .map-wrap { order: 1; }
  .legend { left: 8px; right: auto; bottom: 8px; max-width: calc(100% - 16px); }
}
