:root {
  color-scheme: light;
  --bg: #eef3f5;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #5f6f7d;
  --line: #d6e0e6;
  --fault: #d7193f;
  --restored: #0b83ba;
  --planned: #e47f00;
  --accent: #0a6fa8;
  --shadow: 0 14px 42px rgba(22, 44, 66, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  height: 100vh;
  min-height: 640px;
}

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

.map {
  height: 100%;
  width: 100%;
}

.map-topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(214, 224, 230, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  left: 18px;
  max-width: calc(100% - 36px);
  padding: 12px;
  position: absolute;
  top: 18px;
  z-index: 700;
}

.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: #12364d;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 42px;
  font-size: 14px;
  font-weight: 700;
  height: 42px;
  justify-content: center;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p,
.eyebrow,
.list-head span,
.stat small,
.status-message {
  color: var(--muted);
}

.brand p {
  font-size: 13px;
  margin-top: 3px;
}

.icon-button,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.icon-button {
  align-items: center;
  background: #f7fafb;
  color: #1b3c52;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.secondary-button {
  background: #f6f9fb;
  color: #143950;
  padding: 9px 12px;
}

.legend {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(214, 224, 230, 0.92);
  border-radius: 8px;
  bottom: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  left: 18px;
  padding: 10px 12px;
  position: absolute;
  z-index: 700;
}

.legend span {
  align-items: center;
  display: inline-flex;
  font-size: 14px;
  gap: 7px;
}

.key {
  border-radius: 50%;
  display: inline-block;
  height: 12px;
  width: 12px;
}

.key.fault {
  background: var(--fault);
}

.key.restored {
  background: var(--restored);
}

.key.planned {
  background: var(--planned);
}

.side-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
}

.summary {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 4px;
  text-transform: uppercase;
}

h2 {
  font-size: 24px;
}

.status-message {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.4;
  margin: 14px 0;
  padding-bottom: 14px;
}

.stats-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stat span {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.fault-stat span {
  color: var(--fault);
}

.restored-stat span {
  color: var(--restored);
}

.planned-stat span {
  color: var(--planned);
}

.stat small {
  display: block;
  font-size: 13px;
  margin-top: 5px;
}

.filters {
  border: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
  padding: 0;
}

.filters legend,
.search-label {
  color: #314858;
  font-size: 14px;
  font-weight: 700;
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.toggle {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 42px;
  padding: 8px;
  text-align: center;
}

.toggle input {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.toggle.active {
  background: #edf7fc;
  border-color: #92c8e2;
  color: #0b5f8d;
  font-weight: 700;
}

.tools {
  display: grid;
  gap: 7px;
}

.search-input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.list-head {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
}

h3 {
  font-size: 16px;
}

.outage-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  overflow: auto;
  padding-right: 4px;
}

.outage-card {
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.outage-card:hover,
.outage-card:focus {
  border-color: #93c9df;
  outline: none;
}

.outage-card.fault {
  border-left-color: var(--fault);
}

.outage-card.restored {
  border-left-color: var(--restored);
}

.outage-card.planned {
  border-left-color: var(--planned);
}

.card-top {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.badge {
  border-radius: 999px;
  color: #fff;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.badge.fault {
  background: var(--fault);
}

.badge.restored {
  background: var(--restored);
}

.badge.planned {
  background: var(--planned);
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.marker-pin {
  align-items: center;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  color: #fff;
  display: flex;
  font-size: 16px;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  transform: rotate(-45deg);
  width: 32px;
}

.marker-pin span {
  transform: rotate(45deg);
}

.marker-pin.fault {
  background: var(--fault);
}

.marker-pin.restored {
  background: var(--restored);
}

.marker-pin.planned {
  background: var(--planned);
}

.popup {
  min-width: 230px;
}

.popup h4 {
  font-size: 16px;
  margin: 0 0 7px;
}

.popup dl {
  display: grid;
  gap: 5px 10px;
  grid-template-columns: auto 1fr;
  margin: 0;
}

.popup dt {
  color: var(--muted);
  font-weight: 700;
}

.popup dd {
  margin: 0;
}

.popup p {
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 9px;
  padding-top: 9px;
}

.sr-only {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 60vh minmax(360px, 40vh);
    height: auto;
    min-height: 100vh;
  }

  .map-panel {
    min-height: 420px;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: none;
  }
}

@media (max-width: 540px) {
  .map-topbar {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .legend {
    bottom: 10px;
    left: 10px;
    right: 10px;
  }

  .filters,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
