/* Рабочий инструмент: белая панель, карта на весь экран, досье справа. Крупный шрифт для чтения по-китайски. */
:root {
  --bg: #ffffff; --ink: #121619; --mute: #5a636a; --line: #e1e4e7; --panel: #f6f7f8; --chip: #eef0f2; --hover: #e2e5e8;
  --gas: #1456d6; --well: #0a8670; --oil: #cf3f26; --user: #e0007a; --sel: #ffd400;
  --fs: 16px; --fs-s: 14px; --fs-xs: 12.5px; --fs-h2: 26px;
  --side: clamp(380px, 31vw, 500px);
  --shadow: 0 1px 4px rgb(0 0 0 / .18);
  color-scheme: light;
}
:root.big { --fs: 19px; --fs-s: 16.5px; --fs-xs: 14.5px; --fs-h2: 30px; --side: clamp(420px, 36vw, 580px); }
* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: var(--fs)/1.5 "Segoe UI", "Golos Text", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  overflow-x: clip;
}
button { font: inherit; color: var(--ink); background: transparent; border: 0; border-radius: 8px; padding: 6px 12px; min-height: 40px; cursor: pointer; font-size: var(--fs-s); }
button:hover { background: var(--hover); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--gas); outline-offset: 1px; }
input, select { font: inherit; font-size: var(--fs-s); color: var(--ink); }
.mute { color: var(--mute); }
.small { font-size: var(--fs-xs); }
code { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: .92em; }

.app { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }

/* ---------- верхняя полоса */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: calc(var(--fs) - 1px); margin-right: auto; }
.brand svg { flex: none; }
.asof { color: var(--mute); font-weight: 400; font-size: var(--fs-xs); }
.seg { display: flex; gap: 3px; background: var(--chip); padding: 3px; border-radius: 10px; }
.seg button[aria-pressed=true] { background: var(--bg); box-shadow: var(--shadow); font-weight: 600; }
.icon-btn { min-width: 44px; font-weight: 700; background: var(--chip); }
.icon-btn .plus { font-size: .8em; vertical-align: super; }
.icon-btn[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.search-wrap { position: relative; flex: 1 1 260px; max-width: 420px; }
/* крупный шрифт: шапка должна остаться в одну строку на обычном мониторе */
:root.big .search-wrap { flex-basis: 150px; }
@media (max-width: 1280px) and (min-width: 901px) { :root.big .asof { display: none; } }
#gsearch { width: 100%; padding: 8px 12px; min-height: 42px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); }
#gsearch:focus { border-color: var(--gas); outline: none; }
.dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgb(0 0 0 / .16); max-height: 60vh; overflow: auto; z-index: 20; padding: 4px; }
.sr { display: block; width: 100%; text-align: left; padding: 8px 10px; min-height: 0; border-radius: 6px; font-size: var(--fs-s); }
.sr small { color: var(--mute); margin-left: 4px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; flex: none; }

/* ---------- рабочая область */
.work { display: grid; grid-template-columns: minmax(0, 1fr) var(--side); min-height: 0; }
.mapbox { position: relative; overflow: hidden; min-height: 0; background: #e9e6df; }
#map { position: absolute; inset: 0; }
.maplibregl-canvas.drawing, .drawing { cursor: crosshair !important; }
.maplibregl-ctrl-group button { min-height: 0; padding: 0; border-radius: 0; }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-popup-content { font: var(--fs-s)/1.45 inherit; padding: 12px 14px; border-radius: 10px; }
.maplibregl-popup-close-button { min-height: 0; padding: 0 6px; font-size: 18px; }

.views { position: absolute; left: 12px; top: 12px; z-index: 2; box-shadow: var(--shadow); background: rgb(255 255 255 / .92); }
.views button { min-height: 34px; padding: 4px 10px; font-size: var(--fs-xs); }

.toolbar { position: absolute; left: 12px; top: 64px; z-index: 2; display: grid; gap: 2px; background: var(--bg); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.toolbar button { display: flex; align-items: center; gap: 8px; padding: 0 8px; min-height: 40px; width: 40px; overflow: hidden; white-space: nowrap; transition: width .15s; justify-content: flex-start; }
.toolbar button svg { flex: none; width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.toolbar button span { font-size: var(--fs-xs); opacity: 0; }
.toolbar:hover button, .toolbar:focus-within button { width: 168px; }
.toolbar:hover button span, .toolbar:focus-within button span { opacity: 1; }
.toolbar button[aria-pressed=true] { background: var(--user); }
.toolbar button[aria-pressed=true] svg { stroke: #fff; }
.toolbar button[aria-pressed=true] span { color: #fff; }

.toolbox, .profile { position: absolute; z-index: 3; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 18px rgb(0 0 0 / .22); padding: 10px 14px 12px; font-size: var(--fs-s); }
.toolbox { left: 64px; top: 64px; width: min(340px, calc(100% - 80px)); max-height: calc(100% - 120px); overflow: auto; }
.profile { left: 64px; right: 64px; bottom: 34px; max-width: 760px; }
.tb-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.tb-h b { font-size: var(--fs); }
.tb-hint { color: var(--mute); margin: 2px 0 8px; font-size: var(--fs-xs); }
.tb-m { margin: 4px 0 8px; min-height: 1.4em; }
.tb-row { display: grid; gap: 3px; margin: 6px 0; }
.tb-row input, .tb-row select { padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 8px; min-height: 40px; width: 100%; background: var(--bg); }
.quick { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.err { color: #b42318; font-size: var(--fs-xs); margin: 6px 0; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.acts.col { flex-direction: column; }
.btn { background: var(--chip); font-weight: 600; }
.btn.pri { background: var(--ink); color: var(--bg); }
.btn.pri:hover { background: #2b3238; }
.mini { min-height: 0; padding: 3px 8px; white-space: nowrap; font-size: var(--fs-xs); background: var(--chip); border-radius: 6px; }

.prof { width: 100%; height: auto; display: block; touch-action: none; }
.prof text { font-size: 11px; fill: var(--mute); }
.prof .gl { stroke: var(--line); }
.prof .ar { fill: rgb(122 75 30 / .18); }
.prof .pl { fill: none; stroke: #7a4b1e; stroke-width: 1.8; }
.prof .hx { stroke: var(--user); stroke-width: 1.2; }
.prof .ht { font-size: 12px; fill: var(--ink); font-weight: 600; }
.pf-mk { width: 14px; height: 14px; border-radius: 50%; background: var(--user); border: 2px solid #fff; box-shadow: var(--shadow); }

.coordbar { position: absolute; left: 12px; bottom: 8px; z-index: 2; display: flex; align-items: center; gap: 6px; background: rgb(255 255 255 / .9); border-radius: 8px; padding: 2px 8px 2px 2px; font-size: var(--fs-xs); box-shadow: var(--shadow); }
.coordbar button { min-height: 28px; padding: 2px 8px; font-size: var(--fs-xs); font-weight: 600; background: var(--chip); }
#cval { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; white-space: nowrap; }
.satnote { position: absolute; right: 56px; top: 12px; z-index: 2; background: rgb(18 22 25 / .8); color: #fff; font-size: var(--fs-xs); padding: 4px 10px; border-radius: 8px; max-width: 280px; }
.toast { position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); z-index: 6; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-size: var(--fs-s); max-width: 90%; box-shadow: var(--shadow); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: var(--fs-xs); line-height: 1.4; padding: 8px 10px; border-radius: 8px; max-width: 270px; box-shadow: 0 2px 8px rgb(0 0 0 / .25); z-index: 4; }
.tip b { display: block; font-size: var(--fs-s); }
.peek { position: absolute; left: 8px; right: 8px; bottom: 40px; z-index: 5; background: var(--bg); border-radius: 12px; box-shadow: 0 4px 18px rgb(0 0 0 / .25); padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.peek b { flex: 1; font-size: var(--fs-s); }
.chooser { font-size: var(--fs-s); line-height: 1.8; }
.ctx b { display: block; margin-bottom: 4px; }

/* ---------- боковая панель */
.side { border-left: 1px solid var(--line); display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; background: var(--panel); }
.tabs { display: flex; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; }
.tabs button { flex: 1 0 auto; background: var(--chip); padding: 6px 10px; }
.tabs button[aria-selected=true] { background: var(--ink); color: var(--bg); font-weight: 600; }
.tabs button[hidden] { display: none; }
.pane { overflow: auto; padding: 16px 18px 28px; }
.empty { color: var(--mute); padding: 16px 0; }
.note { font-size: var(--fs-xs); color: var(--mute); margin: 12px 0 0; }
.verify { font-size: var(--fs-s); margin: 4px 0 8px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-xs); }
.pill { border-radius: 999px; padding: 2px 10px; font-weight: 600; color: #fff; background: var(--c); }
.pill.new { background: var(--ink); color: var(--bg); }
.pills .d { color: var(--mute); }
h2 { font-size: var(--fs-h2); line-height: 1.12; margin: 8px 0 2px; text-wrap: balance; }
h2.h2s { font-size: calc(var(--fs-h2) - 6px); margin-top: 0; }
.where { color: var(--mute); margin: 0 0 10px; font-size: var(--fs-s); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 12px; }
.kpis div { background: var(--bg); padding: 8px 10px; }
.kpis span { display: block; font-size: var(--fs-xs); color: var(--mute); }
.kpis b { font-size: var(--fs-s); line-height: 1.25; display: block; }
.sum { margin: 0 0 6px; }
h3 { font-size: var(--fs-xs); color: var(--mute); font-weight: 650; margin: 20px 0 6px; padding-bottom: 4px; border-bottom: 1.5px solid var(--ink); text-transform: uppercase; letter-spacing: .02em; }
dl { margin: 0; }
dl div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
dt { color: var(--mute); font-size: var(--fs-s); }
dd { margin: 0; font-size: var(--fs-s); overflow-wrap: anywhere; }

.depth { display: grid; gap: 8px; margin: 4px 0 10px; }
.axis, .drow { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 8px; align-items: center; }
.axis .t { position: relative; height: 16px; font-size: 11px; color: var(--mute); }
.axis .t span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.axis .t span:first-child { transform: none; }
.axis .t span:last-child { transform: translateX(-100%); }
.drow .n { font-size: var(--fs-xs); font-weight: 600; }
.trk { position: relative; height: 22px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 6)); border-radius: 4px; background-color: var(--bg); }
.trk .bar { position: absolute; left: 0; top: 6px; height: 10px; border-radius: 0 3px 3px 0; background: #b8c3cc; }
.trk .des { position: absolute; left: 0; top: 5px; height: 12px; border: 1.5px dashed var(--mute); border-left: 0; border-radius: 0 3px 3px 0; }
.trk .int { position: absolute; top: 2px; height: 18px; border-radius: 3px; background: var(--c); min-width: 4px; }
.trk .v { position: absolute; top: 2px; font-size: 12px; font-weight: 600; white-space: nowrap; padding-left: 6px; }
.trk .na { position: absolute; left: 8px; top: 2px; font-size: 12px; color: var(--mute); }
.dkey { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--mute); }
.dkey i { display: inline-block; width: 18px; height: 8px; margin-right: 5px; vertical-align: 0; border-radius: 2px; }
.dkey .k-td { background: #b8c3cc; }
.dkey .k-des { border: 1.5px dashed var(--mute); }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-s); }
th { text-align: left; font-size: var(--fs-xs); color: var(--mute); font-weight: 600; border-bottom: 1.5px solid var(--ink); padding: 6px 8px 6px 0; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); padding: 7px 8px 7px 0; vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
.wt td:first-child { font-weight: 600; white-space: nowrap; }
.lt .lnk, .lnk { padding: 0; min-height: 0; font-weight: 600; color: var(--gas); text-align: left; text-decoration: underline; text-underline-offset: 3px; font-size: var(--fs-s); background: none; }
.lt tr.on td { background: #fff7cc; }
.ct { font-size: var(--fs-xs); }
.ct th { border: 0; padding: 4px 8px 4px 0; font-weight: 400; white-space: normal; }
.ct td { border-bottom: 1px solid var(--line); padding: 4px 6px 4px 0; }
.ct td:last-child { width: 1%; }
.mean { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 8px; padding: 10px 12px; margin-top: 14px; }
.src { list-style: none; padding: 0; margin: 0; font-size: var(--fs-s); }
.src li { padding: 4px 0; }
.src a { color: var(--gas); text-underline-offset: 3px; }
.src span { color: var(--mute); font-size: var(--fs-xs); margin-left: 6px; }
.search { width: 100%; font-size: var(--fs-s); padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); margin: 8px 0 10px; min-height: 44px; }

.cnt { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: var(--fs-xs); margin: 6px 0; }
.cnt i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

/* слои */
.layers { display: grid; gap: 2px; }
.lyr { display: grid; grid-template-columns: auto 44px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 6px; border-radius: 8px; cursor: pointer; background: var(--bg); }
.lyr.dis { opacity: .5; cursor: default; }
.lyr input, .sub input, .my input { width: 18px; height: 18px; accent-color: var(--ink); }
.ln-t { font-size: var(--fs-s); font-weight: 600; }
.ln-t small { display: block; font-weight: 400; color: var(--mute); font-size: var(--fs-xs); }
.sym { display: flex; gap: 3px; align-items: center; justify-content: center; }
.sym i { display: inline-block; }
.sym .dot, .sub .dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .15); }
.sym .dot.sm { width: 10px; height: 10px; }
.sym .dia, .sub .dia { width: 10px; height: 10px; transform: rotate(45deg); border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .15); }
.sym .sq { width: 12px; height: 12px; border-radius: 2px; }
.sym .tri { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid; }
.sym .ln { width: 30px; height: 4px; border-radius: 2px; }
.sym .blk { width: 28px; height: 16px; border: 1.8px dashed var(--oil); background: rgb(207 63 38 / .12); }
.sym .rel { width: 28px; height: 16px; border-radius: 3px; background: linear-gradient(135deg, #f1ece2, #8c7a64); }
.sub { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 6px 8px 32px; }
.sub .chip { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); background: var(--bg); border: 1px solid var(--line); padding: 4px 8px; border-radius: 999px; cursor: pointer; }
.my { list-style: none; padding: 0; margin: 0; }
.my li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.my small { white-space: nowrap; }

/* ---------- телефон и узкий экран */
@media (max-width: 900px) {
  .app { height: auto; min-height: 100dvh; }
  .work { grid-template-columns: minmax(0, 1fr); }
  .mapbox { height: 64vh; min-height: 380px; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .pane { overflow: visible; }
  .brand { width: 100%; margin-right: 0; }
  .search-wrap { flex-basis: 100%; max-width: none; order: 5; }
  .toolbar { top: auto; bottom: 62px; left: 8px; right: auto; max-width: calc(100% - 16px); display: flex; overflow-x: auto; }
  .toolbar button, .toolbar:hover button, .toolbar:focus-within button { width: 42px; flex: none; justify-content: center; padding: 0; }
  .toolbar:hover button span, .toolbar:focus-within button span, .toolbar button span { display: none; }
  .toolbox { left: 8px; right: 8px; width: auto; top: 56px; max-height: calc(100% - 140px); }
  .profile { left: 8px; right: 8px; bottom: 112px; }
  .satnote { left: 8px; right: auto; top: 54px; }
  .views { left: 8px; top: 8px; }
  .coordbar { bottom: 28px; }
  .peek { bottom: 112px; }
}
@media (max-width: 600px) {
  .top { padding: 8px; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  dl div { grid-template-columns: minmax(0, 1fr); gap: 1px; }
  .stack thead { display: none; }
  .stack tr { display: grid; padding-block: 8px; border-bottom: 1px solid var(--line); }
  .stack td { display: flow-root; border: 0; padding: 3px 0; padding-inline-start: 8em; text-align: start !important; white-space: normal !important; }
  .stack td::before { content: attr(data-l); float: inline-start; width: 7.5em; margin-inline-start: -8em; color: var(--mute); font-size: var(--fs-xs); }
  .coordbar #cval { font-size: 11px; }
  .lt td:nth-child(2), .lt th:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toolbar button { transition: none; } }
