:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #16201f;
  --muted: #62706d;
  --line: #d9e0de;
  --accent: #0f766e;
  --accent-strong: #0b5e58;
  --ready: #2563eb;
  --precast: #b45309;
  --shadow: 0 16px 42px rgba(22, 32, 31, 0.13);
}

* {
  box-sizing: border-box;
}

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

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

.app-shell {
  display: flex;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  flex: 0 0 390px;
  min-width: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 500;
}

.sidebar-header {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.scope {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.filters {
  display: grid;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
}

select:focus,
input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfa;
}

.stats strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.list-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.panel-title {
  padding: 14px 22px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.company-list {
  overflow: auto;
  padding: 0 12px 16px;
}

.company-item {
  width: 100%;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.company-item:hover,
.company-item:focus {
  border-color: var(--accent);
  outline: none;
}

.company-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.company-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.activity-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 8px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #eef6f5;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.map-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#map {
  position: relative;
  width: 100%;
  height: 100%;
}

#map .leaflet-pane,
#map .leaflet-tile,
#map .leaflet-marker-icon,
#map .leaflet-marker-shadow,
#map .leaflet-tile-container,
#map .leaflet-pane > svg,
#map .leaflet-pane > canvas,
#map .leaflet-zoom-box,
#map .leaflet-image-layer,
#map .leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

#map .leaflet-container {
  overflow: hidden;
}

#map .leaflet-tile-pane {
  z-index: 200;
}

#map .leaflet-overlay-pane {
  z-index: 400;
}

#map .leaflet-shadow-pane {
  z-index: 500;
}

#map .leaflet-marker-pane {
  z-index: 600;
}

#map .leaflet-tooltip-pane {
  z-index: 650;
}

#map .leaflet-popup-pane {
  z-index: 700;
}

#map .leaflet-popup {
  position: absolute;
  margin-bottom: 20px;
  text-align: left;
}

#map .leaflet-popup-content-wrapper {
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(22, 32, 31, 0.25);
}

#map .leaflet-popup-content {
  min-width: 320px;
}

#map .leaflet-popup-tip-container {
  position: absolute;
  left: 50%;
  width: 40px;
  height: 20px;
  margin-left: -20px;
  overflow: hidden;
}

#map .leaflet-popup-tip {
  width: 16px;
  height: 16px;
  margin: -8px auto 0;
  background: #ffffff;
  transform: rotate(45deg);
  box-shadow: 0 8px 18px rgba(22, 32, 31, 0.2);
}

#map .leaflet-popup-close-button {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 1;
  color: #62706d;
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
}

.popup {
  min-width: 320px;
  max-width: 420px;
}

.popup h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.2;
}

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

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

.popup dd {
  margin: 0;
}

.popup a {
  color: var(--accent-strong);
  font-weight: 700;
}

.leaflet-popup-content {
  margin: 14px;
}

.marker-ready,
.marker-precast {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.marker-ready {
  background: var(--ready);
}

.marker-precast {
  background: var(--precast);
}

@media (max-width: 820px) {
  .app-shell {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body {
    overflow: auto;
  }

  .sidebar {
    flex: 0 0 auto;
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .map-panel {
    flex: 0 0 48vh;
    order: 1;
    min-height: 360px;
  }

  h1 {
    font-size: 23px;
  }
}
