:root {
  color-scheme: light;
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --surface-strong: #17211d;
  --text: #101916;
  --muted: #65746e;
  --line: #d7e0dc;
  --green: #1f9d55;
  --amber: #d98615;
  --red: #d33f32;
  --blue: #2563eb;
  --gray: #64748b;
  --shadow: 0 18px 44px rgba(16, 25, 22, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(215, 224, 220, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

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

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 157, 85, 0.96), rgba(37, 99, 235, 0.92)),
    var(--green);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 5px;
  border-radius: 999px;
  background: #ffffff;
}

.brand-mark::before {
  top: 13px;
}

.brand-mark::after {
  bottom: 13px;
}

.brand p,
.brand h1 {
  margin: 0;
}

.brand p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  overflow: hidden;
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.status-pill,
.time-pill,
.state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.live,
.state-badge.ok {
  border-color: rgba(31, 157, 85, 0.3);
  color: #146b3b;
  background: rgba(31, 157, 85, 0.1);
}

.status-pill.warn,
.state-badge.warn {
  border-color: rgba(217, 134, 21, 0.34);
  color: #87510c;
  background: rgba(217, 134, 21, 0.12);
}

.status-pill.error,
.state-badge.alert {
  border-color: rgba(211, 63, 50, 0.3);
  color: #8f241b;
  background: rgba(211, 63, 50, 0.12);
}

.state-badge.offline {
  border-color: rgba(100, 116, 139, 0.28);
  color: #475569;
  background: rgba(100, 116, 139, 0.1);
}

.state-badge.planned {
  border-color: rgba(37, 99, 235, 0.28);
  color: #19469a;
  background: rgba(37, 99, 235, 0.1);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f3f7fb;
}

.icon-button span {
  display: block;
  font-size: 1.18rem;
  line-height: 1;
}

.admin-button,
.account-button,
.demo-button,
.planning-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.admin-button span:last-child,
.account-button span:last-child,
.demo-button span:last-child,
.planning-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-button span:first-child,
.account-button span:first-child,
.demo-button span:first-child,
.planning-button span:first-child {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--gray);
  font-size: 0.72rem;
  line-height: 1;
}

.admin-button:hover,
.account-button:hover,
.demo-button:hover,
.planning-button:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f3f7fb;
}

.admin-button.authenticated span:first-child,
.account-button.authenticated span:first-child,
.planning-button.ready span:first-child {
  background: var(--blue);
}

.demo-button.active {
  border-color: rgba(217, 134, 21, 0.34);
  color: #87510c;
  background: rgba(217, 134, 21, 0.12);
}

.demo-button.active span:first-child {
  background: var(--amber);
}

.planning-button.active {
  border-color: rgba(37, 99, 235, 0.34);
  color: #19469a;
  background: rgba(37, 99, 235, 0.1);
}

.planning-button.active span:first-child {
  background: var(--blue);
}

.admin-button.editing,
.account-button.editing {
  border-color: rgba(31, 157, 85, 0.35);
  color: #146b3b;
  background: rgba(31, 157, 85, 0.1);
}

.admin-button.saving,
.account-button.saving {
  border-color: rgba(217, 134, 21, 0.34);
  color: #87510c;
  background: rgba(217, 134, 21, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  min-height: 0;
}

.map-panel {
  position: relative;
  min-height: calc(100vh - 78px);
  overflow: hidden;
  background: #dde5df;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-overlay {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 8px;
  width: min(600px, calc(100% - 36px));
}

.admin-map-state {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  color: #19469a;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(16, 25, 22, 0.16);
  font-size: 0.86rem;
  font-weight: 900;
}

.admin-tools {
  position: absolute;
  top: 68px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}

.planning-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 10;
  display: grid;
  gap: 7px;
  width: min(420px, calc(100% - 36px));
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(16, 25, 22, 0.16);
  backdrop-filter: blur(10px);
}

.planning-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.planning-row select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #ffffff;
  font-weight: 850;
}

.planning-panel span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-action-button {
  min-height: 38px;
  border: 1px solid rgba(37, 99, 235, 0.32);
  border-radius: 8px;
  padding: 0 12px;
  color: #19469a;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(16, 25, 22, 0.16);
  font-weight: 900;
  cursor: pointer;
}

.map-action-button.sound {
  border-color: rgba(124, 58, 237, 0.32);
  color: #4c1d95;
}

.map-overlay div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  border: 1px solid rgba(215, 224, 220, 0.92);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(16, 25, 22, 0.16);
}

.map-overlay span,
.metric span,
.panel-title span,
.station-main small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.map-overlay strong {
  font-size: 1.6rem;
  line-height: 1;
}

.detail-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: calc(100vh - 78px);
  max-height: calc(100vh - 78px);
  overflow: auto;
  border-left: 1px solid var(--line);
  padding: 16px;
  background: var(--surface-soft);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.detail-head > div {
  min-width: 0;
}

.detail-head span:first-child {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-head h2 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 1.5rem;
  line-height: 1.1;
}

.pa-direction-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(31, 157, 85, 0.05)),
    #ffffff;
}

.pa-direction-head,
.pa-direction-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pa-direction-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pa-direction-head output {
  color: var(--blue);
  font-size: 1.1rem;
  font-weight: 950;
}

.pa-direction-slider {
  width: 100%;
  accent-color: var(--blue);
}

.pa-direction-controls {
  flex-wrap: wrap;
}

.pa-direction-controls button {
  min-width: 54px;
  min-height: 34px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  color: #19469a;
  background: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.pa-direction-controls button:hover,
.pa-direction-controls button:focus-visible {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.pa-direction-controls label {
  display: grid;
  grid-template-columns: auto 72px;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.pa-direction-controls input {
  width: 72px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--text);
  font-weight: 900;
}

.pa-direction-panel.is-saving {
  opacity: 0.72;
}

.pa-direction-panel.is-saving button,
.pa-direction-panel.is-saving input {
  cursor: wait;
}

.db-stage {
  --meter: 0;
  --meter-color: var(--gray);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(31, 157, 85, 0.14), rgba(217, 134, 21, 0.14), rgba(211, 63, 50, 0.14)),
    #ffffff;
}

.db-stage::before {
  content: "";
  display: block;
  width: calc(var(--meter) * 1%);
  height: 10px;
  border-radius: 999px;
  background: var(--meter-color);
}

.db-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.db-value strong {
  font-size: 5.2rem;
  line-height: 0.9;
}

.db-value span {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 900;
}

.db-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.bass-panel {
  --bass: 0;
  --bass-color: #64748b;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(31, 157, 85, 0.06)),
    #ffffff;
}

.bass-panel.bass-active {
  border-color: rgba(217, 134, 21, 0.36);
  background:
    linear-gradient(135deg, rgba(217, 134, 21, 0.16), rgba(37, 99, 235, 0.08)),
    #ffffff;
}

.bass-panel.bass-event {
  border-color: rgba(211, 63, 50, 0.42);
  background:
    linear-gradient(135deg, rgba(211, 63, 50, 0.18), rgba(37, 99, 235, 0.08)),
    #ffffff;
}

.bass-head,
.bass-readings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bass-head span,
.bass-readings span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.bass-head strong {
  color: var(--bass-color);
  font-size: 1rem;
}

.bass-meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eeeb;
}

.bass-meter span {
  display: block;
  width: calc(var(--bass) * 1%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, var(--bass-color));
}

.bass-readings {
  align-items: stretch;
}

.bass-readings div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bass-readings strong {
  font-size: 1.28rem;
  line-height: 1;
  white-space: nowrap;
}

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

.metric,
.trend-panel,
.audio-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 12px;
}

.metric strong {
  font-size: 1.8rem;
  line-height: 1;
}

.trend-panel,
.audio-panel {
  min-width: 0;
  padding: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-title h3 {
  margin: 0;
  font-size: 1rem;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mini-icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
}

.mini-icon-button:hover,
.mini-icon-button:focus-visible {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.mini-icon-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

#trendCanvas {
  display: block;
  width: 100%;
  height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbfa);
}

.audio-list {
  display: grid;
  gap: 8px;
}

.audio-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(31, 157, 85, 0.04)),
    #ffffff;
}

.audio-row.error {
  border-color: rgba(211, 63, 50, 0.34);
  background:
    linear-gradient(135deg, rgba(211, 63, 50, 0.1), rgba(37, 99, 235, 0.04)),
    #ffffff;
}

.audio-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.audio-row-main strong,
.audio-row-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-row-main small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.audio-load-button {
  min-width: 92px;
  min-height: 34px;
  padding: 0 10px;
}

.audio-load-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.audio-row audio {
  grid-column: 1 / -1;
  width: 100%;
  height: 38px;
}

.audio-message {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.station-list {
  display: grid;
  gap: 8px;
}

.station-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: inherit;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.station-row:hover,
.station-row:focus-visible,
.station-row.selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.station-row.planned {
  border-style: dashed;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(31, 157, 85, 0.04)),
    #ffffff;
}

.station-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gray);
}

.station-dot.ok {
  background: var(--green);
}

.station-dot.warn {
  background: var(--amber);
}

.station-dot.alert {
  background: var(--red);
}

.station-dot.planned {
  border: 2px solid var(--blue);
  background: #ffffff;
}

.station-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.station-main strong,
.station-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-reading {
  font-size: 1.1rem;
  font-weight: 900;
  white-space: nowrap;
}

.sound-marker {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background: var(--gray);
  box-shadow: 0 12px 26px rgba(16, 25, 22, 0.32);
  font-weight: 950;
}

.sound-marker.ok {
  background: var(--green);
}

.sound-marker.warn {
  background: var(--amber);
}

.sound-marker.alert {
  background: var(--red);
  animation: markerPulse 1.4s ease-out infinite;
}

.sound-marker.offline {
  background: var(--gray);
}

.sound-marker.planned {
  border-color: #dbeafe;
  color: #19469a;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
  outline: 2px dashed rgba(37, 99, 235, 0.48);
  outline-offset: 3px;
}

.sound-marker.sound-system {
  --direction: 0deg;
  --pa-color: #2563eb;
  --pa-soft: rgba(37, 99, 235, 0.18);
  --pa-edge: rgba(37, 99, 235, 0.86);
  position: relative;
  display: block;
  overflow: visible;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
}

.sound-marker.sound-system .pa-glyph {
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: drop-shadow(0 12px 20px rgba(16, 25, 22, 0.32));
  overflow: visible;
  transform: rotate(calc(var(--direction) - 90deg));
  transform-origin: 50% 50%;
}

.sound-marker.sound-system .pa-cone-fill {
  fill: var(--pa-soft);
}

.sound-marker.sound-system .pa-cone-edge {
  fill: none;
  stroke: var(--pa-edge);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.sound-marker.sound-system .pa-speaker {
  fill: #202a32;
  stroke: #ffffff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.sound-marker.sound-system .pa-speaker-face {
  fill: #111827;
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.sound-marker.sound-system.ok {
  --pa-color: #2563eb;
  --pa-soft: rgba(37, 99, 235, 0.18);
  --pa-edge: rgba(37, 99, 235, 0.86);
}

.sound-marker.sound-system.warn {
  --pa-color: var(--amber);
  --pa-soft: rgba(217, 134, 21, 0.2);
  --pa-edge: rgba(217, 134, 21, 0.9);
}

.sound-marker.sound-system.alert {
  --pa-color: var(--red);
  --pa-soft: rgba(211, 63, 50, 0.2);
  --pa-edge: rgba(211, 63, 50, 0.92);
}

.sound-marker.sound-system.offline {
  --pa-color: #40516d;
  --pa-soft: rgba(64, 81, 109, 0.18);
  --pa-edge: rgba(64, 81, 109, 0.88);
}

.sound-marker.sound-system.planned {
  --pa-color: var(--blue);
  --pa-soft: rgba(37, 99, 235, 0.14);
  --pa-edge: rgba(37, 99, 235, 0.72);
  outline: none;
}

.sound-marker.sound-system span,
.sound-marker.sound-system small {
  position: absolute;
  left: 50%;
  z-index: 1;
}

.sound-marker.sound-system span {
  top: 50%;
  min-width: 30px;
  padding: 3px 7px 4px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(16, 25, 22, 0.78);
  box-shadow: 0 8px 18px rgba(16, 25, 22, 0.22);
  font-size: 0.82rem;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
}

.sound-marker.sound-system small {
  display: none;
}

.sound-marker.editable {
  cursor: grab;
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 4px;
}

.leaflet-drag-target .sound-marker.editable {
  cursor: grabbing;
}

.sound-marker small {
  font-size: 0.68rem;
  font-weight: 800;
}

.admin-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.admin-dialog::backdrop {
  background: rgba(16, 25, 22, 0.42);
  backdrop-filter: blur(3px);
}

.admin-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.login-fields {
  display: grid;
  gap: 14px;
}

.account-summary {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(31, 157, 85, 0.04)),
    #ffffff;
}

.account-summary strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.account-summary span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-form input,
.admin-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-weight: 700;
}

.admin-form input:focus,
.admin-form select:focus {
  border-color: rgba(37, 99, 235, 0.56);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

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

.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.admin-message {
  min-height: 20px;
  margin: 0;
  color: #8f241b;
  font-size: 0.88rem;
  font-weight: 800;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 8px;
}

.popup {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.popup strong {
  font-size: 1rem;
}

.popup span {
  color: var(--muted);
  font-weight: 800;
}

@keyframes markerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(211, 63, 50, 0.38), 0 12px 26px rgba(16, 25, 22, 0.32);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(211, 63, 50, 0), 0 12px 26px rgba(16, 25, 22, 0.32);
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: 58vh;
  }

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .time-pill {
    display: none;
  }

  .map-overlay {
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    grid-template-columns: none;
    gap: 4px;
    width: auto;
    overflow-x: hidden;
    padding: 2px;
  }

  .map-overlay div {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 34px;
    border-radius: 999px;
    padding: 6px 5px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 18px rgba(16, 25, 22, 0.14);
    backdrop-filter: blur(10px);
  }

  .map-overlay div:nth-child(1) {
    flex-grow: 1.08;
  }

  .map-overlay div:nth-child(2) {
    flex-grow: 0.9;
  }

  .map-overlay div:nth-child(3) {
    flex-grow: 0.82;
  }

  .map-overlay div:nth-child(4) {
    flex-grow: 1.2;
  }

  .map-overlay span {
    max-width: 42px;
    overflow: hidden;
    font-size: 0;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-overlay span::after {
    font-size: 0.58rem;
  }

  .map-overlay div:nth-child(1) span::after {
    content: "Punkte";
  }

  .map-overlay div:nth-child(2) span::after {
    content: "Alarm";
  }

  .map-overlay div:nth-child(3) span::after {
    content: "Bass";
  }

  .map-overlay div:nth-child(4) span::after {
    content: "Max";
  }

  .map-overlay strong {
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .admin-map-state {
    top: 10px;
    right: 10px;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 0.72rem;
    box-shadow: 0 8px 18px rgba(16, 25, 22, 0.14);
  }

  .admin-tools {
    top: auto;
    right: 10px;
    bottom: 56px;
    gap: 6px;
  }

  .planning-panel {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 18px rgba(16, 25, 22, 0.14);
  }

  .planning-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
  }

  .planning-row select,
  .planning-row .map-action-button {
    min-height: 34px;
    font-size: 0.78rem;
  }

  .planning-panel span {
    font-size: 0.72rem;
  }

  .map-action-button {
    min-height: 34px;
    border-radius: 999px;
    padding: 0 11px;
    font-size: 0.78rem;
    box-shadow: 0 8px 18px rgba(16, 25, 22, 0.14);
  }

  .leaflet-control-zoom {
    display: none;
  }

  .leaflet-bottom.leaflet-right {
    bottom: 46px;
  }

  .leaflet-control-attribution {
    max-width: calc(100vw - 24px);
    overflow: hidden;
    border-radius: 999px 0 0 999px;
    font-size: 0.62rem;
    opacity: 0.74;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .detail-panel {
    padding: 12px;
  }

  .db-value strong {
    font-size: 3.8rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .bass-readings strong {
    font-size: 1rem;
  }

  .audio-row {
    grid-template-columns: 1fr;
  }

  .audio-load-button {
    width: 100%;
  }
}
