.coverage-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.coverage-page .topbar { flex: none; }
.coverage-page .header-actions { gap: 14px; }
.coverage-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}
.coverage-back:hover { background: #f3f3f3; }
.coverage-back .ui-icon { width: 16px; height: 16px; }

.coverage-workspace { position: relative; flex: 1; min-height: 0; isolation: isolate; }
.coverage-stage { position: relative; height: 100%; min-height: 0; }
#coverageMap { width: 100%; height: 100%; background: #fafbf9; z-index: 0; }
.coverage-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1;
  width: 288px;
  max-width: calc(100% - 92px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 14px #00000012;
}
.coverage-panel h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.35px; line-height: 1.25; }
.coverage-caption { margin: 6px 0 17px; color: var(--muted); font-size: 12px; line-height: 1.5; }
#radiusForm label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.coverage-form-row { display: flex; align-items: stretch; gap: 8px; }
.coverage-input {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding-right: 10px;
  border: 1px solid #bdbdbd;
  border-radius: 6px;
  background: #fff;
}
.coverage-input:focus-within { outline: 2px solid #252525; outline-offset: 1px; }
#radiusInput {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 0 9px;
  outline: none;
  border: 0;
  border-radius: inherit;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
#radiusUnit { color: var(--muted); font-size: 12px; white-space: nowrap; }
.coverage-apply {
  padding: 0 16px;
  border: 1px solid var(--action);
  border-radius: 6px;
  background: var(--action);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.coverage-apply:hover { background: #393939; }
.coverage-error { margin: 8px 0 0; color: var(--ink); font-size: 12px; line-height: 1.4; }
.coverage-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 15px;
  padding: 12px 0 0;
  margin: 15px 0 0;
  border-top: 1px solid #e8e8e8;
  color: #484848;
  font-size: 12px;
  line-height: 1.4;
  list-style: none;
}
.coverage-legend li { display: flex; align-items: center; gap: 5px; }
.coverage-key { flex: none; display: inline-block; }
.station-key { width: 7px; height: 7px; border-radius: 50%; background: #242424; }
.covered-key, .outside-key { width: 15px; height: 11px; border-radius: 3px; }
.covered-key { background: rgba(53,135,208,.302); border: 1px solid rgba(36,107,165,.678); }
.outside-key { border: 1px solid #aaa; background: #fafbf9; }
.coverage-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.coverage-status-row:has(#coverageStatus:not(:empty)), .coverage-status-row:has(#coverageRetry:not([hidden])) { margin-top: 10px; }
#coverageRetry { text-decoration: underline; color: var(--ink); }
.coverage-controls {
  position: absolute;
  z-index: 1;
  top: 20px;
  right: 20px;
  display: grid;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--control-shadow);
}
.coverage-controls button {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 4px;
}
.coverage-controls button:hover:enabled { background: #f2f2f2; }
.coverage-controls button:focus-visible { outline-offset: -2px; }
.coverage-controls .ui-icon { width: 18px; height: 18px; }
#coverageFit { margin-top: 2px; border-top: 1px solid var(--line); border-radius: 0 0 4px 4px; }

@media (max-width: 700px) and (orientation: portrait) {
  .coverage-workspace { display: grid; grid-template-rows: minmax(0,1fr) auto; }
  .coverage-panel {
    position: static;
    width: 100%;
    max-width: none;
    max-height: 46dvh;
    padding: 13px 16px max(13px,env(safe-area-inset-bottom));
    overflow-y: auto;
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: 0 -2px 10px #0000000a;
  }
  .coverage-panel h1 { font-size: 19px; }
  .coverage-caption { margin: 3px 0 10px; }
  .coverage-legend { padding-top: 9px; margin-top: 10px; }
}
@media (max-width: 700px) {
  .coverage-page .header-actions { gap: 4px; }
  .coverage-back { gap: 4px; padding-inline: 5px; font-size: 12px; }
  .coverage-controls { top: 12px; right: 12px; }
  .coverage-controls button { width: 40px; height: 40px; }
}
@media (max-height: 470px) and (orientation: landscape) {
  .coverage-panel { top: 10px; left: 10px; max-height: calc(100% - 20px); overflow-y: auto; }
}
