/* Санжыра: лист топографической карты. Светлый лист — работа днём в офисе за монитором. */
:root {
  --sheet: #e8ece9;
  --paper: #f4f6f5;
  --white: #ffffff;
  --ink: #1c1c1a;
  --ink-2: #45453f;
  --muted: #5d5d56;
  --rule: #c9cfca;
  --hydro: #2c6aa0;
  --forest: #5e8a4e;
  --contour: #8f5226;
  --contour-wash: #efe3d8;
  --error: #a3271f;
  --bar-h: 56px;
  font-family: Onest, system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--sheet);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--sheet); }
::selection { background: var(--contour); color: var(--white); }
:focus-visible { outline: 2px solid var(--contour); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.center { text-align: center; margin-top: 30vh; }

.app { height: 100vh; display: grid; grid-template-rows: var(--bar-h) 1fr; }

/* Верхняя полоса — чёрная печать. */
.bar { display: flex; align-items: center; gap: 28px; padding: 0 20px; background: var(--ink); color: #eceeea; min-width: 0; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .01em; }
.layers { display: flex; gap: 24px; overflow-x: auto; min-width: 0; height: 100%; }
.domain { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.domain-name { font-size: 12px; color: #b9bdb6; margin-right: 6px; }
.tab { color: #dfe2dd; text-decoration: none; padding: 0 10px; height: 100%; display: flex; align-items: center; border-bottom: 3px solid transparent; font-weight: 500; }
.tab:hover { color: var(--white); }
.tab.on { color: var(--white); border-bottom-color: var(--contour); }
.who { margin-left: auto; display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.name { display: flex; flex-direction: column; font-size: 14px; line-height: 1.2; }
.name small { color: #b9bdb6; font-size: 12px; }
.quiet { background: none; border: 1px solid #5a5a55; color: #dfe2dd; border-radius: 6px; padding: 5px 12px; font-size: 13px; }
.quiet:hover { border-color: #dfe2dd; }
.langs { display: inline-flex; border: 1px solid #5a5a55; border-radius: 6px; overflow: hidden; }
.lang { background: none; border: 0; color: #b9bdb6; padding: 4px 9px; font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.lang.on { background: #3a3a35; color: var(--white); }

/* Лист и сторона легенды. */
.layer { display: grid; grid-template-columns: minmax(0, 2fr) minmax(380px, 1fr); min-height: 0; }
.sheet { display: grid; grid-template-rows: auto 1fr; padding: 16px 18px 26px 40px; min-height: 0; }
.sheet-head { display: flex; gap: 22px; align-items: baseline; padding: 0 0 8px 2px; font-size: 13px; color: var(--muted); }
.nomenclature { color: var(--ink); font-weight: 600; letter-spacing: .22em; font-size: 13px; }
.sheet-map { position: relative; border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 4px; min-height: 0; }
.map-canvas { position: absolute; inset: 0; }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.tick { position: absolute; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.tick.lon { bottom: -24px; transform: translateX(-50%); }
.tick.lat { left: -36px; transform: translateY(-50%) rotate(-90deg); transform-origin: center; }
.maplibregl-ctrl-attrib { font-size: 11px; }

.side { background: var(--paper); border-left: 2px solid var(--ink); display: grid; grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 0; }
.legend { display: grid; grid-template-rows: auto auto 1fr; padding: 18px 20px 0; min-height: 0; border-bottom: 1px solid var(--ink); }
.legend h1 { margin: 0 0 12px; font-size: 24px; font-weight: 700; display: flex; align-items: baseline; gap: 12px; }
.legend h1 small { font-size: 13px; font-weight: 500; color: var(--muted); }
.search { width: 100%; font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--white); color: var(--ink); margin-bottom: 10px; }
.search::placeholder { color: var(--muted); }
.search:focus { border-color: var(--ink); outline: none; }
.legend-scroll { overflow: auto; min-height: 0; padding-bottom: 12px; }
.legend-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legend-table th { position: sticky; top: 0; background: var(--paper); text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 8px 8px; border-bottom: 1px solid var(--ink); }
.legend-table td { padding: 8px 8px; border-bottom: 1px solid var(--rule); }
.legend-table tr { cursor: pointer; }
.legend-table tr:hover td, .legend-table tr.lit td { background: var(--contour-wash); }
.legend-table tr.sel td { background: var(--contour-wash); box-shadow: inset 0 -2px var(--contour); font-weight: 600; }
.num { text-align: right; }
th.num .sort { text-align: right; }
.sort { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; font-weight: inherit; }
.sort[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--contour); text-underline-offset: 4px; }
.note { padding: 18px 2px; font-size: 14px; line-height: 1.5; max-width: 46ch; }
.note b { display: block; font-size: 15px; margin-bottom: 4px; }
.note p { margin: 0; color: var(--muted); }

.card { padding: 18px 20px; overflow: auto; min-height: 0; }
.object h2 { margin: 0 0 4px; font-size: 20px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.fields { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 1.2fr); margin: 0; font-size: 14px; }
.fields dt { color: var(--muted); padding: 7px 12px 7px 0; border-bottom: 1px solid var(--rule); }
.fields dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.fields dd.num { text-align: left; }
.unit { color: var(--muted); }

.message { max-width: 52ch; margin: 18vh auto 0; padding: 0 20px; }
.message h2 { font-size: 22px; margin: 0 0 8px; }
.message p { color: var(--muted); line-height: 1.5; }

/* Вход. */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 28px; background: var(--paper); border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 4px; }
.login-head { display: flex; align-items: center; justify-content: space-between; }
.login h1 { margin: 0; font-size: 24px; }
.login p { margin: 0; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login input { font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--white); color: var(--ink); }
.login input:focus { border-color: var(--ink); outline: none; }
.login .langs { border-color: var(--rule); }
.login .lang { color: var(--muted); }
.login .lang.on { background: var(--ink); color: var(--white); }
.primary { background: var(--ink); color: var(--white); border: 0; border-radius: 6px; padding: 10px 16px; font-weight: 600; }
.primary:hover { background: var(--contour); }
.primary:disabled { opacity: .55; cursor: progress; }

/* Уже 1024: лист наверх, легенда и карточка под ним. */
@media (max-width: 1024px) {
  .app { height: auto; min-height: 100vh; }
  .layer { grid-template-columns: 1fr; }
  .sheet { height: 62vh; padding: 12px 14px 26px 36px; }
  .side { border-left: 0; border-top: 2px solid var(--ink); grid-template-rows: auto auto; }
  .legend-scroll { max-height: 50vh; }
  .bar { gap: 16px; }
  .name { display: none; }
}
