:root {
  --bg: #f1f4ef;
  --card: #ffffff;
  --fg: #1c241d;
  --muted: #58635a;
  --line: #dde4da;
  --accent: #2f6b3a;
  --accent-fg: #ffffff;
  --ok: #2e8b57;
  --soon: #b7791f;
  --due: #c0392b;
  --warn-bg: #fff6e5;
  --track: #e6ece3;
  --radius: 12px;
  --pine: #2f6b3a;
  --spruce: #1f4e5f;
  --birch: #b08d2e;
  --other: #7a5c99;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111612;
    --card: #1a211b;
    --fg: #e4ebe2;
    --muted: #9fac9f;
    --line: #2c372d;
    --accent: #7cc48a;
    --accent-fg: #0e1a10;
    --ok: #4fbf7f;
    --soon: #e0ab2a;
    --due: #ef6b5b;
    --warn-bg: #2d2412;
    --track: #243024;
    --pine: #7cc48a;
    --spruce: #6fb3c8;
    --birch: #e2c26a;
    --other: #b79ad6;
  }
}

/* yleiset */
.back { display: inline-block; margin-bottom: 6px; text-decoration: none; font-size: 0.9rem; }
.space-note { font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
.warn { background: var(--warn-bg); border-radius: 8px; padding: 8px 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select, .filters input { flex: 0 1 180px; }
.gps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.pager { display: flex; align-items: center; gap: 8px; }
.pager .spacer { flex: 1; }
.with-btn { display: flex; gap: 6px; align-items: center; }
.with-btn input { flex: 1 1 auto; min-width: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; margin: 8px 0; }
details.more { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
details.more summary { cursor: pointer; font-weight: 600; }
.notes { white-space: pre-wrap; }
.result { font-size: 1.3rem; font-weight: 700; color: var(--accent); }

/* kenttätila: isot kohteet hanskakäteen */
.species-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.species-pick .sp { padding: 14px 4px; font-size: 1rem; justify-content: center; }
.species-pick .sp.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
input.big-num { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.dbh { display: grid; gap: 4px; align-content: start; }
.dbh > .btn { justify-self: start; }
.sticky-save { position: sticky; bottom: 0; background: var(--card); padding: 8px 0; border-top: 1px solid var(--line); z-index: 2; }
.angle-live { font-size: 2.2rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; padding: 6px 0; }
@media (max-width: 560px) { .species-pick { grid-template-columns: repeat(2, 1fr); } }

/* taulukot */
table.trees, table.logs, table.mills { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.trees th, table.trees td, table.logs th, table.logs td, table.mills th, table.mills td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table td.num, table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.trees tr.click { cursor: pointer; }
table.trees tr.click:hover { background: var(--track); }
table.trees tr.kaadettu, table.trees tr.poistettu { opacity: 0.6; }
table.trees tfoot td { font-weight: 700; border-bottom: 0; }
table.logs tr.too-big td { color: var(--due); }
@media (max-width: 560px) {
  table.trees th:nth-child(5), table.trees td:nth-child(5), table.trees th:nth-child(8), table.trees td:nth-child(8) { display: none; }
}

/* kuvat */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo { margin: 0; border-radius: 8px; overflow: hidden; background: var(--track); }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: pointer; }
.photo figcaption { padding: 3px 6px; }
.photo-full { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto; border-radius: 8px; }

/* kartta */
.map-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--track); }
svg.tree-map { display: block; width: 100%; height: auto; max-height: 75vh; }
svg.tree-map .map-bg { fill: var(--track); }
svg.tree-map .map-grid { stroke: var(--line); stroke-width: 0.15; }
svg.tree-map .map-prop { fill: var(--fg); font-family: system-ui, sans-serif; paint-order: stroke; stroke: var(--card); stroke-width: 0.6; }
svg.tree-map .map-tree { cursor: pointer; }
svg.tree-map .map-tree circle { stroke: #fff; stroke-width: 0.35; fill-opacity: 0.88; }
svg.tree-map .map-tree text { fill: #fff; font-family: system-ui, sans-serif; font-weight: 700; pointer-events: none; }
svg.tree-map .map-tree.manty circle { fill: var(--pine); }
svg.tree-map .map-tree.kuusi circle { fill: var(--spruce); }
svg.tree-map .map-tree.koivu circle { fill: var(--birch); }
svg.tree-map .map-tree.muu circle { fill: var(--other); }
svg.tree-map .map-tree.merkitty circle { stroke: var(--due); stroke-width: 0.9; stroke-dasharray: 1 0.6; }
svg.tree-map .map-tree.kaadettu, svg.tree-map .map-tree.poistettu { opacity: 0.35; }
svg.tree-map .map-tree:focus-visible circle { stroke: var(--accent); stroke-width: 1.2; }
svg.tree-map .map-scale { stroke: var(--fg); stroke-width: 0.6; }
svg.tree-map .map-scale-t { fill: var(--fg); font-family: system-ui, sans-serif; paint-order: stroke; stroke: var(--card); stroke-width: 0.5; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; }
.legend .lg.manty { color: var(--pine); }
.legend .lg.kuusi { color: var(--spruce); }
.legend .lg.koivu { color: var(--birch); }
.legend .lg.muu { color: var(--other); }
.legend .lg.merkitty { color: var(--due); }

.kv + .actions, .kv + .notes { margin-top: 12px; }
@media (max-width: 560px) { table.logs th:nth-child(2), table.logs td:nth-child(2) { display: none; } }
