:root{
  --bg:#f6f5f2; --panel:#fff; --ink:#1f2328; --muted:#6b7280;
  --line:#e5e7eb; --grey-rail:#d7d9dd; --side-w:360px;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{
  font-family:"Noto Sans JP","Hiragino Sans","Yu Gothic UI","PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  color:var(--ink);background:var(--bg);overscroll-behavior:none;
}
#app{display:flex;height:100%;width:100%}
#side{
  width:var(--side-w);flex:0 0 var(--side-w);background:var(--panel);
  border-right:1px solid var(--line);display:flex;flex-direction:column;z-index:600;
}
.side-head{padding:18px 18px 12px;border-bottom:1px solid var(--line)}
.side-head h1{margin:0;font-size:19px;letter-spacing:.06em;font-weight:700}
.side-head .sub{margin:2px 0 12px;font-size:12px;color:var(--muted)}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:0}
.stats div{background:var(--bg);border-radius:8px;padding:7px 8px}
.stats dt{font-size:10px;color:var(--muted);margin:0}
.stats dd{margin:1px 0 0;font-size:15px;font-weight:600;font-variant-numeric:tabular-nums}
.tabs{display:flex;gap:2px;padding:8px 12px;border-bottom:1px solid var(--line)}
.tabs button{
  flex:1;border:0;background:transparent;padding:7px 4px;border-radius:7px;
  font:inherit;font-size:12.5px;color:var(--muted);cursor:pointer;
}
.tabs button.active{background:var(--bg);color:var(--ink);font-weight:600}
.tabs button:disabled{opacity:.4;cursor:default}
.panels{flex:1;overflow-y:auto;overscroll-behavior:contain}
.panel{padding:10px 12px 24px}
.hidden{display:none}
.group-title{font-size:11px;color:var(--muted);letter-spacing:.08em;margin:14px 4px 6px;text-transform:uppercase}
.ride{display:flex;gap:9px;align-items:flex-start;padding:8px 9px;border-radius:8px;cursor:pointer;border:1px solid transparent}
.ride:hover{background:var(--bg)}
.ride.active{background:#eff6ff;border-color:#bfdbfe}
.ride .dot{width:9px;height:9px;border-radius:50%;flex:0 0 9px;margin-top:5px}
.ride .body{min-width:0;flex:1}
.ride .l1{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ride .l2{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ride .date{font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums;flex:0 0 auto;margin-top:2px}
.line-row{display:flex;align-items:center;gap:9px;padding:8px 9px;border-radius:8px;cursor:pointer}
.line-row:hover{background:var(--bg)}
.line-row.active{background:#eff6ff}
.line-row .swatch{width:5px;height:26px;border-radius:3px;flex:0 0 5px}
.line-row .nm{flex:1;min-width:0;font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.line-row .pct{font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}
.detail-head{padding:4px 4px 10px}
.detail-head h2{margin:0;font-size:16px}
.detail-head .meta{font-size:11.5px;color:var(--muted);margin-top:3px}
.station-seq{margin-top:8px}
.seg{display:flex;gap:10px;align-items:center;height:20px;padding:0;margin-left:3px}
.seg .bar{width:3px;flex:0 0 3px;height:20px;background:var(--grey-rail)}
.st-row{display:flex;align-items:baseline;gap:8px;padding:2px 0}
.st-row .dot{width:8px;height:8px;border-radius:50%;background:#9ca3af;flex:0 0 8px;position:relative;top:-1px}
.st-row .nm{font-size:13px}
.st-row .en{font-size:10.5px;color:var(--muted)}
.seg .date{font-size:10.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.seg.locked .date{color:#c2c6cc}
#map{flex:1;min-width:0;background:#e8e6e1}
.leaflet-container{font:inherit}
/* 底图降饱和，让彩色线路跳出来 */
.leaflet-tile-pane{filter:saturate(.45) contrast(.96) brightness(1.05)}
.sheet-bar{display:none}
#legend{border-top:1px solid var(--line);padding:10px 18px 26px;font-size:11px;color:var(--muted)}
.legend-bar{height:8px;border-radius:4px;margin-top:7px;display:flex;justify-content:space-between;position:relative;background:linear-gradient(90deg,#3b6fd4,#22a06b,#e3b341,#d9463f)}
.legend-bar span{font-size:10px;color:var(--muted);position:absolute;bottom:-14px}
.legend-bar span:first-child{left:0}
.legend-bar span:last-child{right:0}
#side-toggle{
  display:none;position:fixed;left:12px;bottom:16px;z-index:700;width:42px;height:42px;
  border-radius:50%;border:1px solid var(--line);background:#fff;
  box-shadow:0 2px 10px rgba(0,0,0,.12);font-size:17px;cursor:pointer;
}
.leaflet-popup-content{font-size:12.5px;line-height:1.55;margin:10px 12px}
.banner{margin:8px 4px 0;padding:7px 9px;border-radius:7px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font-size:11.5px}
@media (max-width:720px){
  #side{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;height:56vh;border-right:0;
    border-top:1px solid var(--line);border-radius:14px 14px 0 0;box-shadow:0 -4px 20px rgba(0,0,0,.1);
    transition:transform .22s ease}
  #side.collapsed{transform:translateY(calc(56vh - 58px))}
  .sheet-bar{
    display:flex;align-items:center;gap:8px;width:100%;border:0;background:transparent;
    padding:8px 14px 6px;font:inherit;font-size:12.5px;color:var(--muted);cursor:pointer;flex-direction:column;
  }
  .sheet-bar .grip{display:block;width:36px;height:4px;border-radius:2px;background:#d5d8dd}
  #side-toggle{display:block;bottom:auto;top:12px}
  #map{position:fixed;inset:0}
  .side-head{padding-top:6px}
}

.panel-tools{padding:8px 12px;position:sticky;top:0;background:var(--bg);z-index:2;border-bottom:1px solid var(--line)}
.panel-tools input{width:100%;box-sizing:border-box;padding:7px 10px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--fg);font-size:13px;outline:none}
.panel-tools input:focus{border-color:#9bb4e8;box-shadow:0 0 0 3px rgba(59,111,212,.12)}
.line-row .meta{display:block;font-size:11px;color:var(--muted);margin-top:1px}
.line-row .bar{height:3px;border-radius:2px;background:#e5e7eb;margin-top:4px;overflow:hidden}
.line-row .bar > i{display:block;height:100%;background:var(--accent,#3b6fd4)}
.line-row.hidden{display:none}
