* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1b1b1b;
  background: #f7f7f5;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e3e3df;
}

h1 { margin: 0; font-size: 1.3rem; }
h2 { font-size: 1rem; margin: 18px 0 8px; }

.status { font-size: 0.85rem; color: #555; }

.banner {
  padding: 10px 20px;
  font-size: 0.9rem;
  background: #fff4cc;
  border-bottom: 1px solid #e8d48a;
}
.banner.error { background: #fde2e2; border-color: #e7aaaa; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px 20px;
}

@media (max-width: 1000px) {
  main { grid-template-columns: 1fr; }
}

.map-panel { min-width: 0; }

.controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.controls label { display: flex; align-items: center; gap: 6px; }
select {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #c8c8c2;
  border-radius: 4px;
  background: #fff;
}

#map {
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid #e3e3df;
  border-radius: 6px;
}

.state { stroke: #fff; stroke-width: 0.8; transition: fill 0.4s ease; cursor: pointer; }
.state:hover { stroke: #222; stroke-width: 1.4; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #333;
}
.legend .sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  vertical-align: -1px;
  border-radius: 2px;
}
.legend .note { color: #777; }

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.card {
  background: #fff;
  border: 1px solid #e3e3df;
  border-radius: 6px;
  padding: 8px 10px;
}
.card .label { font-size: 0.75rem; color: #666; text-transform: uppercase; letter-spacing: 0.03em; }
.card .value { font-size: 1.1rem; font-weight: 600; }
.card .value.d { color: #2166ac; }
.card .value.r { color: #b2182b; }

.table-wrap {
  max-height: 520px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e3e3df;
  border-radius: 6px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 6px 8px; text-align: right; border-bottom: 1px solid #efefeb; white-space: nowrap; }
th { position: sticky; top: 0; background: #fafaf8; font-weight: 600; font-size: 0.75rem; color: #555; }
th:first-child, td:first-child { text-align: left; }
td.call-d { color: #2166ac; font-weight: 600; }
td.call-r { color: #b2182b; font-weight: 600; }
td.call-none { color: #888; }

.tip {
  position: fixed;
  pointer-events: none;
  background: #1b1b1b;
  color: #fff;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1.45;
  max-width: 260px;
  z-index: 10;
}
