:root {
  color-scheme: dark;
  --bg: #101820;
  --panel: rgba(17, 24, 29, 0.84);
  --panel-strong: rgba(27, 38, 45, 0.92);
  --line: rgba(220, 235, 241, 0.16);
  --text: #edf6f8;
  --muted: rgba(237, 246, 248, 0.66);
  --accent: #65d6ff;
  --sentinel: #f5ae40;
  --danger: #ff5b4d;
  --ok: #6bdc9b;
  --shadow: 0 18px 58px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
meter {
  font: inherit;
}

button {
  letter-spacing: 0;
}

#mapRoot,
#mapCanvas,
#appRoot {
  position: fixed;
  inset: 0;
}

#mapRoot {
  z-index: 0;
  background: #101820;
}

#mapCanvas {
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

body[data-map="external"] #mapCanvas {
  display: none;
}

body[data-map="canvas"] #mapRoot {
  display: none;
}

#appRoot {
  pointer-events: none;
  z-index: 5;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #101820;
  font: inherit;
}

.appShell {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.sidePanel,
.regionPanel {
  pointer-events: auto;
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidePanel {
  top: 16px;
  left: 16px;
  width: min(360px, calc(100dvw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 14px;
}

.regionPanel {
  right: 16px;
  bottom: 16px;
  width: min(300px, calc(100dvw - 32px));
  max-height: min(44dvh, 420px);
  overflow: auto;
  padding: 12px;
}

.brandBlock {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.brandCopy {
  min-width: 0;
  flex: 1 1 auto;
}

.mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, #ff5b4d 0 18%, transparent 20%),
    linear-gradient(135deg, #65d6ff, #f5ae40);
}

.helpButton {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.helpButton:hover,
.poweredLink:hover,
.closeButton:hover {
  border-color: rgba(101, 214, 255, 0.44);
}

.languageSwitcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding-top: 12px;
}

.languageSwitcher button {
  min-width: 0;
  height: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 38, 45, 0.62);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.languageSwitcher button[data-active="true"] {
  border-color: rgba(101, 214, 255, 0.54);
  background: rgba(101, 214, 255, 0.15);
  color: var(--text);
}

h1,
h2,
p,
ul,
ol {
  margin: 0;
}

h1 {
  font-size: 16px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.1;
  text-transform: uppercase;
}

p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.panelSection {
  padding: 14px 0 0;
}

.statusGrid {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.statusGrid strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metricGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.metric span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.1;
}

.alerts ul,
.regions {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.alerts li,
.regions li {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  font-size: 12px;
}

.regions li {
  grid-template-columns: 1fr auto;
}

.regions meter {
  grid-column: 1 / -1;
  width: 100%;
  height: 6px;
  accent-color: var(--sentinel);
}

.regionMeta {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.regionMeta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.regionMeta span:first-child {
  grid-column: 1 / -1;
  color: rgba(237, 246, 248, 0.46);
}

.alerts strong,
.regions span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alerts em {
  color: var(--muted);
  font-style: normal;
}

.badge {
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(101, 214, 255, 0.18);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.sentinel {
  background: rgba(245, 174, 64, 0.18);
  color: var(--sentinel);
}

.badge.baseline {
  background: rgba(255, 91, 77, 0.18);
  color: var(--danger);
}

.empty {
  color: var(--muted);
}

.panelFooter {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.poweredLink {
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  text-decoration: none;
}

.poweredMeta {
  color: var(--muted);
  font-size: 11px;
}

.infoOverlay {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 10, 13, 0.42);
  backdrop-filter: blur(4px);
}

.infoDialog {
  width: min(520px, calc(100dvw - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 29, 0.96);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.42);
}

.infoDialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.infoDialog h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.18;
  text-transform: none;
}

.infoDialog h3 {
  margin: 14px 0 0;
  color: var(--sentinel);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
}

.infoDialog p {
  margin-top: 8px;
  color: rgba(237, 246, 248, 0.78);
  font-size: 13px;
  line-height: 1.55;
}

.infoDialog a {
  color: var(--accent);
  font-weight: 760;
  text-decoration: none;
}

.closeButton {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

@media (max-width: 760px) {
  .sidePanel {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 48dvh;
  }

  .regionPanel {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 30dvh;
  }

  .languageSwitcher {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
