:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #697386;
  --line: #d8dde6;
  --blue: #2f6df6;
  --blue-dark: #2056c7;
  --green: #2fa66a;
  --green-soft: #dff5e9;
  --amber: #df8b23;
  --shadow: 0 14px 35px rgba(20, 30, 46, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.primary,
button.smallPrimary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

button.primary:hover,
button.smallPrimary:hover {
  background: var(--blue-dark);
}

button.smallPrimary {
  min-height: 30px;
  padding: 0 10px;
}

#appShell {
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  height: 100vh;
  width: 100vw;
}

.panel {
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 8px 0 24px rgba(25, 35, 55, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.brandMark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.brand span,
.statLabel,
.emptyState {
  color: var(--muted);
}

.section {
  padding: 18px 22px 0;
}

.sectionTitle {
  margin-bottom: 10px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented label,
.checkRow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #f9fafc;
}

.segmented input,
.checkRow input {
  accent-color: var(--blue);
}

.toolGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toolGrid button:nth-child(3):last-child {
  grid-column: 1 / -1;
}

.statBlock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 18px 22px 0;
}

.statBlock > div {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.statBlock strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  line-height: 1;
}

.miniStat {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.helperText {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.listSection {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding-bottom: 18px;
}

.emptyState {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.addressList {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.addressList li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #edf0f5;
}

.addressList .num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.addressList .address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.addressList .tag {
  border-radius: 999px;
  background: #eef2f7;
  color: #526071;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  text-transform: uppercase;
}

.mapWrap {
  position: relative;
  min-width: 0;
}

#map {
  position: absolute;
  inset: 0;
}

.topBar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.topBar > * {
  pointer-events: auto;
}

.searchShell {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 64px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.searchShell input {
  min-width: 0;
  height: 42px;
  border: 0;
  padding: 0 14px;
  outline: none;
}

.searchShell button {
  border-width: 0 0 0 1px;
  border-radius: 0;
}

.statusPill {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  max-width: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  color: #344054;
  padding: 10px 13px;
}

.maplibregl-ctrl-top-right {
  top: 76px;
  right: 18px;
}

dialog {
  width: min(560px, calc(100vw - 36px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 27, 41, 0.46);
}

.dialogCard {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.dialogCard header,
.dialogCard footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialogCard h2 {
  margin: 0;
  font-size: 22px;
}

.iconBtn {
  min-width: 36px;
  padding: 0;
}

.dialogCard label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 700;
}

.dialogCard input,
.dialogCard select,
.dialogCard textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}

.fieldGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mapDrawCursor canvas {
  cursor: crosshair;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  #appShell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(58vh, 1fr) auto;
    height: auto;
    min-height: 100vh;
  }

  .panel {
    grid-row: 2;
    min-height: 42vh;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .mapWrap {
    grid-row: 1;
    min-height: 58vh;
  }
}
