:root {
  --mw-blue: #1d428a;
  --mw-yellow: #ffcd00;
  --mw-white: #ffffff;
  --mw-bg: #f1f4fa;
  --mw-text: #1b2333;
  --mw-muted: #6b7690;
  --mw-green: #2e9e4f;
  --mw-grey: #9aa3b5;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--mw-bg); color: var(--mw-text); }

.topbar { background: var(--mw-blue); color: var(--mw-white); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; border-bottom: 4px solid var(--mw-yellow); }
.brand { font-weight: 700; font-size: 1.3rem; }
.brand span { font-weight: 400; font-size: .8rem; color: var(--mw-yellow); margin-left: 6px; }
nav { display: flex; gap: 6px; }
.tab { background: transparent; color: var(--mw-white); border: 0; padding: 8px 16px; border-radius: 20px; font-size: 1rem; cursor: pointer; }
.tab:hover { background: rgba(255,255,255,.15); }
.tab.active { background: var(--mw-yellow); color: var(--mw-blue); font-weight: 700; }

main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.view { display: none; }
.view.active { display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.card { background: var(--mw-white); border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(29,66,138,.1); border-top: 4px solid var(--mw-blue); }
.card h2 { margin: 0 0 10px; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mw-muted); }
.completion { background: var(--mw-blue); color: var(--mw-white); border-top-color: var(--mw-yellow); }
.completion h2, .completion .muted { color: var(--mw-yellow); }
.big { font-size: 2.6rem; font-weight: 700; }
.muted { color: var(--mw-muted); }
.bar { background: rgba(255,255,255,.25); border-radius: 8px; height: 10px; margin: 10px 0; overflow: hidden; }
.bar div { background: var(--mw-yellow); height: 100%; transition: width .3s; }
.list { margin: 0; padding-left: 20px; }
ul.list { list-style: none; padding: 0; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--mw-bg); }
.list li:last-child { border-bottom: 0; }
.region-row { display: flex; justify-content: space-between; }

.recommended { grid-column: 1 / -1; background: var(--mw-yellow); color: var(--mw-blue); border-top-color: var(--mw-blue); padding: 28px; }
.recommended h2 { color: var(--mw-blue); }
.rec-name { font-size: 2.8rem; font-weight: 800; line-height: 1.1; }
.rec-date { font-size: 1.5rem; font-weight: 600; margin-top: 6px; }
.rec-region { font-size: 1.1rem; margin-top: 2px; }
.wide { grid-column: 1 / -1; }
.opp-row { display: grid; grid-template-columns: 2fr 2fr 1.6fr 1.5fr; gap: 10px; }
.top-row { display: grid; grid-template-columns: 2fr 1.6fr 2fr 1.5fr; gap: 10px; }

#map { height: calc(100vh - 150px); min-height: 400px; border-radius: 12px; box-shadow: 0 2px 8px rgba(29,66,138,.1); }
.popup-title { font-weight: 700; font-size: 1.05rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 10px 12px; border: 1px solid #cdd5e4; border-radius: 8px; font-size: 1rem; background: var(--mw-white); }
.toolbar input { flex: 1; min-width: 180px; }

.btn { background: var(--mw-blue); color: var(--mw-white); border: 0; border-radius: 8px; padding: 9px 14px; font-size: .95rem; cursor: pointer; }
.btn:hover { background: #16336d; }
.btn.accent { background: var(--mw-yellow); color: var(--mw-blue); font-weight: 700; }

.course { display: flex; flex-direction: column; gap: 6px; }
.course .name { font-weight: 700; font-size: 1.1rem; }
.badge { align-self: flex-start; padding: 3px 10px; border-radius: 12px; font-size: .8rem; font-weight: 600; background: #e3e7f0; color: var(--mw-muted); }
.badge.visited { background: #dff3e5; color: var(--mw-green); }
.empty { color: var(--mw-muted); }

@media (max-width: 560px) {
  .topbar { justify-content: center; }
  main { padding: 12px; }
  #map { height: calc(100vh - 190px); }
  .rec-name { font-size: 2rem; }
  .opp-row, .top-row { grid-template-columns: 1fr 1fr; }
  .opp-row strong, .top-row strong { grid-column: 1 / -1; }
}
.rec-note { margin-top: 10px; font-size: .9rem; opacity: .8; }
.trip { grid-column: 1 / -1; background: var(--mw-blue); color: var(--mw-white); border-top-color: var(--mw-yellow); }
.trip h2 { color: var(--mw-yellow); }
.trip-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 12px; }
.trip-day { color: var(--mw-yellow); font-size: .9rem; font-weight: 600; }
.trip-course { font-size: 1.8rem; font-weight: 800; }
.trip-meta { margin-top: 4px; }
.clickable { cursor: pointer; }
.course.clickable:hover { box-shadow: 0 4px 14px rgba(29,66,138,.25); }
.check { display: flex; align-items: center; gap: 6px; padding: 10px 4px; }
.fx-date { background: var(--mw-blue); color: var(--mw-yellow); font-weight: 700; padding: 6px 12px; border-radius: 8px; margin: 14px 0 6px; }
.fx-row { display: grid; grid-template-columns: 1.5fr 2fr 1.6fr 1.4fr auto; gap: 10px; align-items: center; background: var(--mw-white); padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; }
.fx-row:hover { background: #e8edf8; }
.overlay { position: fixed; inset: 0; background: rgba(15,25,50,.55); display: flex; justify-content: center; align-items: flex-start; padding: 5vh 12px; overflow-y: auto; z-index: 2000; }
.overlay[hidden] { display: none; }
.panel-box { position: relative; background: var(--mw-white); border-radius: 12px; border-top: 5px solid var(--mw-yellow); padding: 24px; width: 100%; max-width: 560px; }
.close { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 1.8rem; cursor: pointer; color: var(--mw-blue); }
.panel-title { margin: 0 0 4px; color: var(--mw-blue); font-size: 1.8rem; }
.panel-actions { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.panel-sub { color: var(--mw-blue); border-bottom: 2px solid var(--mw-yellow); padding-bottom: 4px; }
.pm h3 { margin: 14px 0 4px; font-size: 1rem; color: var(--mw-blue); }
.dates { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dates li { background: var(--mw-bg); border-radius: 6px; padding: 4px 10px; font-size: .9rem; }
.dates li.next { background: var(--mw-yellow); color: var(--mw-blue); font-weight: 700; }
@media (max-width: 560px) { .fx-row { grid-template-columns: 1fr 1fr; } .fx-row strong { grid-column: 1 / -1; } }
.fx-when { color: var(--mw-blue); font-weight: 600; }
.panel-next { margin-top: 6px; }
.nearby { list-style: none; margin: 0; padding: 0; }
.nearby li { display: grid; grid-template-columns: 1.6fr 1.4fr 1fr 1.3fr; gap: 8px; padding: 8px; border-bottom: 1px solid var(--mw-bg); font-size: .9rem; }
.nearby li:hover { background: #e8edf8; }
@media (max-width: 560px) { .overlay { padding: 0; } .panel-box { border-radius: 0; min-height: 100vh; } .nearby li { grid-template-columns: 1fr 1fr; } .nearby li strong { grid-column: 1 / -1; } }
.dates li.pick { cursor: pointer; }
.dates li.sel { outline: 2px solid var(--mw-blue); }
.trip-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.trip-ctl select { padding: 4px 8px; border-radius: 6px; border: 1px solid #cdd5e4; }
.small { font-size: .8rem; margin-top: 6px; }
.nearby li { grid-template-columns: 1.6fr 1fr 1.4fr 1.2fr; }
.fx-month { background: var(--mw-yellow); color: var(--mw-blue); font-weight: 700; padding: 8px 12px; border-radius: 8px; margin-top: 18px; display: flex; flex-direction: column; }
.fx-month span { font-weight: 400; font-size: .9rem; }
#fx-maxwrap[hidden] { display: none; }
.map-legend { background: var(--mw-white); border: 1px solid #cdd5e4; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,.25); padding: 6px 10px; font-size: .8rem; line-height: 1.7; color: var(--mw-text); }
.map-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
@media (max-width: 560px) { .map-legend { font-size: .72rem; padding: 4px 8px; line-height: 1.55; } }
