/* packages/ui/disposal_map.css
 *
 * Вкладка «Карта» сервиса «Управление сливами» (блок disposal-console-map,
 * Шаг 4) — вся разметка `disposal_map_views.js`, включая диалог координатного
 * инструмента «Указать на карте» (сам диалог строит Шаг 5, стили под его
 * классы — здесь, F-4 плана этого блока их фиксирует за этим файлом).
 *
 * Только токены из packages/theme/tokens.css (N-6 плана: НИ ОДНОГО буквального
 * цвета в шестнадцатеричной записи, даже белого — маркерная рамка берёт
 * var(--surface), у которого то же самое белое значение). Ни одной строки
 * prefers-color-scheme (единый светлый вид всей консоли,
 * tests/test_ui_assets.py::test_no_dark_theme_mechanism...).
 */

/* ADR-0227 (06.10): the left panel is a 1:1 copy of the reference map page
   (Pasha's map, owner's screenshot «photo_AgACAgIA_62.jpg» of 06.10 — the only
   reference; the older karta-slivov.html has another layout and contributes only
   its palette and the Onest typeface). The screenshot is a 0.78 downscale of the
   page (its panel is 265 px against the page's 340 px #side), so every length
   below is the measured screenshot length / 0.78. ADR-0225 layout rules stay:
   the panel is as tall as the map and scrolls inside itself, the root is a
   column (panel+map, then the footnote), on a narrow screen the panel collapses
   above the map behind the «Фильтры» button — never a sideways page scroll. */

/* The reference colours, named once and cited here (the repo gate forbids hex
   outside this block, tests/test_ui_disposal_map.py). Palette: the page's own
   :root custom properties (--blue/--orange/--ink/--muted/--line and the four
   price colours) + the tile/segment grey and the control border sampled
   (median of flat areas) from the screenshot. */
/* ADR-0227: Onest (SIL OFL 1.1, packages/ui/fonts/OFL.txt) is served from our own origin, only for this tab —
   no third-party font loading at runtime. */
@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/onest-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/onest-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/onest-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/onest-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/onest-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/onest-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/onest-cyrillic-700.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest Local";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/onest-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* dm-ref:begin */
:where(.disposal-map) {
  --dm-ref-blue: #0041a0;
  --dm-ref-orange: #ff4200;
  --dm-ref-ink: #14213d;
  --dm-ref-muted: #6b7385;
  --dm-ref-line: #d5d9e2;
  --dm-ref-tile: #dfe6ed;
  --dm-ref-chip-on: #e8efff;
  --dm-ref-green: #1f9d55;
  --dm-ref-yellow: #f2b705;
  --dm-ref-red: #e03131;
  --dm-ref-grey: #9aa3b2;
  --dm-ref-white: #ffffff;
  --dm-ref-font: "Onest Local", Onest, var(--sans);
}
/* dm-ref:end */

.disposal-map {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--dm-ref-font);
}

/* Panel and map are one block, the panel flush with the map's left edge and
   divided from it by a single hairline, like the reference. */
.disposal-map-body {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--dm-ref-white);
}

.disposal-map-filters {
  min-width: 0;
  height: clamp(420px, 70vh, 820px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 14px 14px 18px 18px;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-white);
  border-right: 1px solid var(--dm-ref-line);
}

.disposal-map-filters-body {
  display: flex;
  flex-direction: column;
}

.disposal-map-filters-toggle {
  display: none;
  align-self: stretch;
  font: inherit;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-white);
  border: 1px solid var(--dm-ref-line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 40px;
  text-align: left;
  cursor: pointer;
}

.disposal-map-filters-toggle[aria-expanded="true"] {
  background: var(--dm-ref-chip-on);
  border-color: var(--dm-ref-blue);
}

.disposal-map-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  padding: 0 0 10px;
  font-size: 13px;
  color: var(--dm-ref-muted);
}

.disposal-map-status:empty {
  display: none;
}

.disposal-map-status-text {
  color: var(--dm-ref-muted);
}

/* One section of the panel: uppercase heading + wrapping row of controls; no
   dividers, sections are separated by 14 px only. */
.disposal-map-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0 0 11px;
}

.disposal-map-group h3 {
  flex: 0 0 100%;
  margin: 0 0 3px;
  font-size: 10px;
  line-height: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dm-ref-muted);
  font-weight: 700;
}

.disposal-map-query,
.disposal-map-volume-input {
  box-sizing: border-box;
  font: inherit;
  font-size: 12px;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-white);
  border: 1px solid var(--dm-ref-line);
  border-radius: 10px;
  padding: 0 12px;
  height: 37px;
  min-width: 0;
}

.disposal-map-query {
  flex: 1 1 100%;
  text-overflow: ellipsis;
}

.disposal-map-query::placeholder,
.disposal-map-volume-input::placeholder {
  color: var(--dm-ref-muted);
  opacity: 0.8;
}

.disposal-map-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-sizing: border-box;
  height: 22px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-white);
  border: 1px solid var(--dm-ref-line);
  border-radius: 999px;
  padding: 0 9px;
  cursor: pointer;
}

/* Waste-kind chips turn blue-tinted when chosen; the state and price chips
   (all «on» by default) look plain white in the reference and are dimmed when
   switched off. */
.disposal-map-chip[aria-pressed="true"] {
  background: var(--dm-ref-chip-on);
  border-color: var(--dm-ref-blue);
}

.disposal-map-state-chip[aria-pressed="true"],
.disposal-map-tier-chip[aria-pressed="true"] {
  background: var(--dm-ref-white);
  border-color: var(--dm-ref-line);
}

.disposal-map-state-chip[aria-pressed="false"],
.disposal-map-tier-chip[aria-pressed="false"] {
  opacity: 0.45;
}

.disposal-map-chip:disabled {
  cursor: default;
  opacity: 0.55;
}

/* The two big chips of «Рабочие / Не рабочие» and the price chips (with a
   colour dot and a count) are 29 px tall and semibold. */
.disposal-map-state-chip,
.disposal-map-tier-chip {
  height: 29px;
  font-size: 12px;
  font-weight: 600;
  padding: 0 13px;
}

.disposal-map-chip-count {
  color: var(--dm-ref-muted);
  font-size: 10px;
  font-weight: 600;
}

.disposal-map-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

/* «Рабочие» carries a blue disc with a white check, «Не рабочие» a grey disc
   with a white dot — the two glyphs the map pins use. */
.disposal-map-state-mark {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dm-ref-blue);
  flex: none;
}

.disposal-map-state-mark.is-idle {
  background: var(--dm-ref-grey);
}

.disposal-map-state-mark.is-working::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 3px;
  height: 7px;
  border: solid var(--dm-ref-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.disposal-map-state-mark.is-idle::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dm-ref-white);
}

.disposal-map-hint-text {
  flex: 0 0 100%;
  margin: 2px 0 0;
  color: var(--dm-ref-muted);
  font-size: 10px;
  line-height: 14px;
}

/* Region: one row of four slanted cells; the active one is brand blue. */
.disposal-map-segments {
  display: flex;
  flex: 0 0 100%;
  gap: 2px;
}

.disposal-map-segment {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  height: 35px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-tile);
  border: 0;
  padding: 0 4px;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  cursor: pointer;
}

.disposal-map-segment[aria-pressed="true"] {
  color: var(--dm-ref-white);
  background: var(--dm-ref-blue);
}

.disposal-map-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 100%;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dm-ref-ink);
}

.disposal-map-volume-input {
  width: 58px;
  height: 31px;
}

.disposal-map-flags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  flex: 0 0 100%;
}

/* Full-width tile with the same look as the status ones. */
.disposal-map-flags.is-single {
  grid-template-columns: 1fr;
  margin-top: 2px;
}

.disposal-map-check,
.disposal-map-surcharge {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  min-width: 0;
  padding: 5px 10px;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-tile);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
}

.disposal-map-surcharge.is-disabled {
  cursor: not-allowed;
}

.disposal-map-check input,
.disposal-map-surcharge input {
  appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  box-sizing: border-box;
  background: var(--dm-ref-white);
  border: 1.5px solid var(--dm-ref-muted);
  border-radius: 3px;
}

.disposal-map-check input:checked,
.disposal-map-surcharge input:checked {
  background: var(--dm-ref-blue);
  border-color: var(--dm-ref-blue);
}

.disposal-map-check input:checked::after,
.disposal-map-surcharge input:checked::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  margin: 0 0 0 4px;
  border: solid var(--dm-ref-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.disposal-map-check input:disabled,
.disposal-map-surcharge input:disabled {
  opacity: 0.7;
}

.disposal-map-reset {
  align-self: flex-start;
  margin: 2px 0 0;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--dm-ref-orange);
  background: none;
  border: 0;
  cursor: pointer;
}

.disposal-map-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 12px 0 0;
}

.disposal-map-count {
  margin: 0;
  color: var(--dm-ref-muted);
  font-size: 12px;
}

/* Small one-paragraph footer under the map (11px/1.3). */
.disposal-map-legend {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.3;
  flex: none;
}

.disposal-map-refresh-note {
  color: var(--warn);
  font-size: 13px;
}

.disposal-map-main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.disposal-map-note {
  margin: 0 0 8px;
  padding: 8px 12px;
  color: var(--warn);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-size: 13px;
}

.disposal-map-note[hidden] {
  display: none;
}

/* `isolation` keeps Leaflet's/Yandex's own z-indexes (400-1000) inside the
   canvas, so the price key below always stays on top of the map. */
.disposal-map-canvas {
  position: relative;
  isolation: isolate;
  min-height: 320px;
  height: clamp(420px, 70vh, 820px);
  overflow: hidden;
  background: var(--surface-2);
}

/* Small price legend, bottom-left of the map, like «Цена приёма» on the
   reference map; clicks pass through the gaps, it is not a control. */
.disposal-map-pricekey {
  position: absolute;
  left: 10px;
  bottom: 28px;
  z-index: 5;
  display: grid;
  gap: 4px;
  padding: 10px 14px 10px 10px;
  color: var(--dm-ref-ink);
  background: var(--dm-ref-white);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(20, 33, 61, 0.22);
  font-size: 13px;
  line-height: 14px;
  font-weight: 500;
  pointer-events: none;
}

.disposal-map-pricekey-title {
  margin: 0 0 2px;
  color: var(--dm-ref-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.disposal-map-pricekey-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.disposal-map-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 10;
}

.disposal-map-state:empty {
  display: none;
}

.disposal-map-state .state {
  pointer-events: auto;
}

.disposal-map-state-message {
  margin: 0;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: auto;
}

/* Метки, подсказка и балун (Yandex/Leaflet layouts, Шаг 2/6) ------------- */

/* Round pin coloured by price band (inline background-color from the tier),
   white ring, white check inside for working points and a white dot for the
   others — like the reference map (ADR-0225). No text node: both glyphs are
   ::after. Unconfirmed coordinates: the whole disc at reduced opacity —
   no outline variations, every pin keeps the same solid ring. */
.disposal-map-mark {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow:
    inset 0 0 0 1px rgba(20, 33, 61, 0.22),
    0 0 0 1px rgba(20, 33, 61, 0.16),
    0 1px 3px rgba(20, 33, 61, 0.3);
  box-sizing: border-box;
}

.disposal-map-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--surface);
}

.disposal-map-mark.is-active::after {
  width: 5px;
  height: 10px;
  margin: -7px 0 0 -2px;
  border-radius: 0;
  background: none;
  border: solid var(--surface);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.disposal-map-mark.is-unconfirmed {
  opacity: 0.55;
}

/* .disposal-map-layout — корень шаблона Yandex JS API (build()/getParentElement()
   у иконки/подсказки/балуна, Шаг 2). Пустое правило нужно ровно по одной
   причине: Шаг 8 гоняет статический гейт «у каждого класса F-4 есть хотя бы
   одно правило», а сам класс — только точка монтирования для узла, который
   строит buildMarkerElement/buildHint/buildBalloon, своего вида не несёт. */
.disposal-map-layout {
  display: block;
}

.disposal-map-hint {
  padding: 4px 8px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 12px;
  white-space: nowrap;
  /* Same Leaflet font-family leak as .disposal-map-balloon above. */
  font-family: var(--sans);
}

.disposal-map-balloon {
  display: grid;
  gap: 10px;
  max-width: 320px;
  color: var(--ink);
  font-size: 13px;
  /* Leaflet's `.leaflet-container` sets its own font-family ("Helvetica Neue", Arial, ...),
     which otherwise leaks into the popup/tooltip content this file builds. */
  font-family: var(--sans);
}

.disposal-map-balloon-head {
  padding: 8px 10px;
  background: var(--surface-2);
  border-left: 6px solid var(--border-2);
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
}

.disposal-map-balloon-body {
  display: grid;
  gap: 8px;
}

/* Leaflet's `.leaflet-popup-content p { margin: 1.3em 0 }` (0,1,1; leaflet.css is appended to
   <head> after this file) outranks shell.css's `p { margin: 0 }` and the single-class resets
   above. The balloon spaces its rows by the grid gap alone, on both providers. */
.disposal-map-balloon .disposal-map-balloon-body p {
  margin: 0;
}

.disposal-map-balloon-label {
  margin: 0;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.disposal-map-balloon-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.disposal-map-balloon-tag {
  color: var(--ok);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

.disposal-map-balloon-tag.is-caution {
  color: var(--warn);
}

.disposal-map-balloon-tag.is-no {
  color: var(--ink-3);
  text-decoration: line-through;
}

.disposal-map-balloon-note {
  margin: 0;
  color: var(--ink);
  white-space: pre-line;
}

.disposal-map-balloon-open {
  justify-self: start;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.disposal-map-balloon-open:hover {
  background: var(--blue-wash);
}

/* Диалог координатного инструмента «Указать на карте» (Шаг 5 строит DOM,
   классы и стили под них — здесь, они часть F-4 этого шага). ------------ */

.disposal-map-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.disposal-map-picker-button {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  cursor: pointer;
}

.disposal-map-picker-button:hover {
  background: var(--blue-wash);
}

.disposal-map-dialog {
  max-width: min(720px, calc(100vw - 24px));
  width: 100%;
  padding: 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.disposal-map-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
}

.disposal-map-dialog-canvas {
  min-height: 320px;
  height: 60vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}

.disposal-map-dialog-readout {
  margin: 12px 0;
  color: var(--ink-2);
  font-size: 13px;
}

.disposal-map-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.disposal-map-pin {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid var(--surface);
  background: var(--blue);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.disposal-map :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.disposal-map-dialog:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .disposal-map-filters-toggle {
    display: block;
  }

  .disposal-map-body {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Collapsed by default above the map; the «Фильтры» button opens it. */
  .disposal-map-filters {
    display: none;
    height: auto;
    max-height: 70vh;
    border-right: 0;
    border-bottom: 1px solid var(--dm-ref-line);
  }

  .disposal-map.is-filters-open .disposal-map-filters {
    display: block;
  }

  .disposal-map-canvas {
    height: 60vh;
    min-height: 320px;
  }
}
