.page { min-height: 100vh; padding: 32px clamp(16px, 3vw, 40px) 96px; }
.wrap { max-width: 1360px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }

.top { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-end; justify-content: space-between; }
.brand { display: flex; gap: 20px; align-items: center; }
.brand-text { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.brand-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--cream); color: var(--navy); padding: 10px 16px; min-width: 120px; box-shadow: 4px 4px 0 var(--red); }
.stat-yellow { background: var(--yellow); min-width: 180px; }
.stat-value { font-size: 40px; font-weight: 900; font-stretch: 70%; line-height: 1; }
.stat-of, .stat-unit { font-size: 20px; color: var(--ink-4); }
.stat-yellow .stat-unit { color: var(--navy); }
.stat-note { font-size: 13px; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 8px; }

.banner { margin: 0; padding: 10px 14px; background: var(--red-soft); color: var(--navy); font-weight: 700; border: 3px solid var(--navy); }

.board { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.side { flex: 1 1 360px; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 24px; }
.sheet-tabs { display: none; }

.panel { background: var(--panel); border: 3px solid var(--cream); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 3px solid var(--cream); }
.panel-head .mono-label { color: var(--on-navy-3); }

.map-card { flex: 999 1 560px; min-width: 0; background: var(--panel); border: 3px solid var(--cream); box-shadow: 8px 8px 0 var(--red); }
.card-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 3px solid var(--cream); }
.title-dot { color: var(--yellow); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-body { padding: 16px; }
.map-frame { position: relative; height: clamp(420px, 72vh, 860px); background: var(--navy-deep); overflow: hidden; }
.map { position: absolute; inset: 0; }
.map-tools { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 1000; }
.map-zoom { position: absolute; left: 10px; bottom: 10px; z-index: 1000; background: var(--navy); color: var(--cream); font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 4px 8px; pointer-events: none; }
.map-note {
  position: absolute; top: 10px; left: 10px; z-index: 1000;
  max-width: calc(100% - 84px);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 10px 12px;
  background: var(--cream); color: var(--navy);
  border: 3px solid var(--navy);
  box-shadow: 4px 4px 0 var(--red);
  font-weight: 700;
}
.map-note p { margin: 0; }
.measure-route { font-size: 14px; line-height: 1.3; }
.measure-km { font-size: 36px; font-weight: 900; font-stretch: 70%; line-height: 1; }
.measure-hint { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.accent { color: var(--red-dark); }
.card-foot { padding: 12px 18px; border-top: 3px solid var(--cream); display: flex; flex-direction: column; gap: 10px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--on-navy); }
.legend .swatch { border-color: var(--cream); }
.hint { margin: 0; font-size: 14px; color: var(--on-navy-2); display: flex; gap: 8px; align-items: center; }
.hint .icon { color: var(--yellow); }

.leaflet-container { background: var(--navy-deep); font-family: var(--font-display); }
.map-frame.fixing .leaflet-container { cursor: crosshair; }
.leaflet-control-attribution { background: var(--cream) !important; color: var(--navy); font-family: var(--font-mono); font-size: 10px; }
.leaflet-control-attribution a { color: var(--navy); }
.leaflet-regions-pane { z-index: 350; pointer-events: none; }
path.region { fill: var(--tint); fill-opacity: 0.55; stroke: var(--navy); stroke-width: 1; stroke-opacity: 0.55; }
.jm-outline path.region { fill-opacity: 0; stroke-width: 2; stroke-opacity: 0.8; }

.pin-icon, .city-icon, .measure-icon { background: none; border: 0; }
.pin { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.pin-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid var(--navy);
  background: var(--tint);
  color: var(--navy);
  font-size: 13px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 var(--navy);
  transition: transform 0.12s;
}
.pin.selected .pin-dot { width: 36px; height: 36px; background: var(--yellow); font-size: 15px; }
.pin-residence .pin-dot, .pin-residence.selected .pin-dot { position: relative; isolation: isolate; border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 11px; padding-top: 7px; }
.pin-residence .pin-dot svg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; fill: var(--tint); stroke: var(--navy); filter: drop-shadow(0 3px 0 var(--navy)); }
.pin-residence.selected .pin-dot svg { fill: var(--yellow); }
.pin-icon.hovered .pin-dot { transform: scale(1.25); }
.pin-check {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--navy); color: var(--green-soft);
  display: flex; align-items: center; justify-content: center;
}
.pin-check svg { width: 12px; height: 12px; }
.pin-label {
  position: absolute; bottom: 42px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--yellow); color: var(--navy);
  font-size: 13px; font-weight: 800;
  padding: 4px 8px;
  box-shadow: 3px 3px 0 var(--navy);
}
.pin-day {
  position: absolute; top: 40px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--cream); color: var(--navy);
  border: 2px solid var(--day);
  box-shadow: 2px 2px 0 var(--day);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  padding: 1px 5px;
}
.leaflet-popup-content-wrapper { border-radius: 0; background: var(--cream); color: var(--navy); border: 3px solid var(--navy); box-shadow: 4px 4px 0 var(--red); }
.leaflet-popup-tip { background: var(--cream); }
.leaflet-popup-content { margin: 10px; font-family: var(--font-display); }
.pin-pop { display: flex; flex-direction: column; gap: 6px; }
.pin-pop-drag { min-height: 44px; display: flex; align-items: center; padding: 8px 10px; background: var(--yellow); color: var(--navy); border: 2px solid var(--navy); font-size: 14px; font-weight: 800; cursor: grab; }
.pin-pop-hint { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--ink-3); }
.leaflet-marker-icon:focus-visible { outline: 3px solid var(--red); outline-offset: 0; }
.city { position: relative; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.city-dot { width: 10px; height: 10px; background: var(--white); border: 2px solid var(--navy); box-sizing: content-box; }
.city-name { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 12px; font-weight: 800; color: var(--navy); text-shadow: 0 0 3px var(--white), 0 0 3px var(--white), 0 0 2px var(--white); }
.city.label-l .city-name { left: auto; right: 28px; }
.city.label-t .city-name { top: auto; bottom: 26px; left: 50%; transform: translateX(-50%); }
.city.label-b .city-name { top: 26px; left: 50%; transform: translateX(-50%); }
.measure-mark { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; background: var(--red); color: var(--white); border: 2px solid var(--navy); font-size: 13px; font-weight: 900; }
path.measure-under { stroke: var(--navy); stroke-linecap: round; }
path.measure-line { stroke: var(--red); stroke-linecap: round; }
path.me { fill: var(--red); fill-opacity: 1; stroke: var(--white); stroke-width: 3; }
path.route { stroke-linecap: round; stroke-opacity: 0.9; }
.route-0 { stroke: var(--day-0); }
.route-1 { stroke: var(--day-1); }
.route-2 { stroke: var(--day-2); }
.route-3 { stroke: var(--day-3); }
.route-4 { stroke: var(--day-4); }
.route-5 { stroke: var(--day-5); }
.route-6 { stroke: var(--day-6); }
.route-7 { stroke: var(--day-7); }

.cream { background: var(--cream); color: var(--navy); border-color: var(--cream); }
.add { box-shadow: 8px 8px 0 var(--yellow); }
.cream-head { background: var(--navy); color: var(--yellow); padding: 8px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cream-head .mono-label { color: var(--cream); font-weight: 500; letter-spacing: 0; }
.add-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.add-row .field { flex: 1 1 200px; min-width: 0; width: auto; }
.add-row .btn-primary { height: 48px; }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.results:empty { display: none; }
.result { margin: 0; font-size: 14px; font-weight: 700; padding: 8px 10px; color: var(--navy); overflow-wrap: anywhere; }
.result.done { background: var(--green-soft); }
.result.note { background: var(--yellow-soft); }
.result.problem { background: var(--red-soft); }
.note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-3); }


[data-pane="plan"] { display: none; }

@media (min-width: 1000px) {
  .map-card { position: sticky; top: 16px; }
}

@media (max-width: 720px) {
  .page { padding: 16px 16px 96px; }
  .wrap { gap: 16px; }
  .top { gap: 14px; align-items: flex-start; }
  .logo { width: 52px; height: 52px; font-size: 20px; }
  .brand { gap: 14px; }
  .brand-chips .outline { display: none; }
  .display { font-size: 40px; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; width: 100%; padding: 0 4px 4px 0; gap: 10px; box-sizing: border-box; }
  .stat { min-width: 0; padding: 8px 12px; }
  .stat-value { font-size: 30px; }
  .stat-note { max-width: 100%; }
  .brand { flex: 1 1 0; min-width: 0; }
  .top-actions { order: 1; }
  .stats { order: 2; }
  .board { flex-direction: column; flex-wrap: nowrap; gap: 0; align-items: stretch; }
  .map-card { box-shadow: none; border-width: 3px 3px 0; }
  .card-head { padding: 8px 10px; }
  .map-body { padding: 0; }
  .map-frame { height: 48svh; min-height: 280px; }
  .card-foot { display: none; }
  .side { gap: 16px; border: 3px solid var(--cream); border-top-width: 0; padding: 0 0 16px; background: var(--navy); }
  .sheet-tabs { display: flex; position: sticky; top: 0; z-index: 1100; background: var(--navy); border-bottom: 3px solid var(--cream); }
  .sheet-tab {
    flex: 1 1 0;
    min-height: 48px;
    border: 0;
    background: transparent;
    color: var(--cream);
    font-family: var(--font-display);
    font-size: 17px; font-weight: 900; font-stretch: 75%;
    text-transform: uppercase;
    cursor: pointer;
  }
  .sheet-tab[aria-pressed="true"] { background: var(--yellow); color: var(--navy); }
  .side > .panel { margin: 0 12px; }
  .add { box-shadow: 4px 4px 0 var(--yellow); }
  [data-pane="plan"] { display: block; }
  .board[data-tab="list"] .side > [data-pane]:not([data-pane="list"]),
  .board[data-tab="place"] .side > [data-pane]:not([data-pane="place"]),
  .board[data-tab="plan"] .side > [data-pane]:not([data-pane="plan"]) { display: none; }
}
