:root {
  --fg: #1f2328; --muted: #59636e; --line: #d1d9e0; --bg: #ffffff; --soft: #f6f8fa; --accent: #0969da; --bad: #cf222e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.top { display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--soft); }
.brand { font-weight: 600; color: var(--fg); }
.crumb { color: var(--muted); }
.logout { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); }
button { font: inherit; padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; }
button:hover { background: var(--soft); }

.login { max-width: 340px; margin: 12vh auto 0; padding: 24px; border: 1px solid var(--line); border-radius: 8px; }
.login h1 { margin: 0 0 16px; font-size: 20px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.login input { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--fg); }
.login button { background: #1f883d; border-color: #1a7f37; color: #fff; padding: 8px; }
.error { color: var(--bad); margin: 0 0 12px; }

.index { max-width: 1200px; margin: 0 auto; padding: 16px 24px 48px; }
.lead { color: var(--muted); max-width: 820px; }
.index h2 { font-size: 16px; margin: 28px 0 8px; }
.count { color: var(--muted); font-weight: 400; }
table.sheets { width: 100%; border-collapse: collapse; }
.sheets th, .sheets td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.sheets th { font-weight: 600; color: var(--muted); font-size: 12px; }
.sheets th:nth-child(3), .sheets th:nth-child(5) { text-align: right; }

.sheet-page { height: 100vh; display: flex; flex-direction: column; }
.sheet { flex: 1; display: flex; min-height: 0; }
.panel { width: 340px; overflow-y: auto; padding: 12px 16px; border-right: 1px solid var(--line); }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 8px; }
.map { flex: 1; background: #e8eaed; }
.layer { padding: 8px 0; border-bottom: 1px solid var(--line); }
.layer label { display: block; font-weight: 500; }
.layer input[type=range] { width: 100%; margin: 4px 0 0; }
.note { color: var(--muted); font-size: 12px; margin-top: 2px; }
.legend { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; columns: 2; }
.legend li { display: flex; align-items: center; gap: 6px; margin: 2px 0; break-inside: avoid; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.2); flex: none; }
table.metrics { width: 100%; border-collapse: collapse; font-size: 12px; }
.metrics td { padding: 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.metrics td.num { padding-left: 8px; }
.source { color: var(--muted); font-size: 12px; word-break: break-word; margin-top: 16px; }
.pos { background: rgba(255,255,255,.85); padding: 2px 6px; border-radius: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.overlay-tiles { image-rendering: auto; }

/* разметка индексов */
.label-panel { width: 520px; }
.progress { margin: 4px 0 8px; }
.howto { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.howto ol { padding-left: 18px; margin: 6px 0; }
.region-facts { margin: 0 0 6px; }
img.crop { display: block; max-width: 100%; border: 1px solid var(--line); }
.spots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.spots figure { margin: 0; border: 1px solid var(--line); }
.spots img { display: block; max-width: 100%; }
.spots figcaption { font-size: 11px; color: var(--muted); padding: 0 4px; }
.hints { padding-left: 18px; margin: 4px 0 10px; }
.hints li { margin: 3px 0; }
.label-form { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.label-form label { display: flex; flex-direction: column; gap: 3px; font-weight: 500; }
.label-form input[name=unit] { font: inherit; font-size: 16px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.label-form input[name=comment] { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.label-form fieldset { border: 0; padding: 0; margin: 0; }
.label-form legend { font-weight: 500; margin-bottom: 2px; }
.label-form label.radio { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.buttons { display: flex; gap: 8px; }
button.primary { background: #1f883d; border-color: #1a7f37; color: #fff; }
button.primary:hover { background: #1a7f37; }
.history { padding-left: 18px; font-size: 12px; color: var(--muted); }
.map { position: relative; }
.map-error { position: absolute; top: 8px; left: 50px; z-index: 1000; background: #fff; border: 1px solid var(--bad); color: var(--bad); padding: 6px 10px; border-radius: 6px; }
.label-link { display: inline-block; margin: 4px 0 10px; font-weight: 600; }
