/* ==========================================================================
   Pozemky – oddiely a priradenia (views/editor/pozemky.js, docs/design-v2/Pozemky.dc.html) — prefix .pz-
   Colours only through tokens (the Nova 2 values of v2.css, the classic ones of app.css; light, OS dark, forced
   dark). Section states: pasie sa = solid green, odpočíva = green tint, seno / kosba = grey, obnova porastu = amber
   tint, plodina = brown tint, nevyužité = dashed outline. Phone first: nothing wider than the phone, ≥ 44 px targets
   on touch, inputs 16 px (app.css), the selected section's card updates in place under the grid.
   v4 R3 / R18 (round 10): sections with subsections fold as groups in the grid (.pz-tgroup, .pz-subgrid, the area bar
   .pz-meter), the section card's tree (.pz-crumb, .pz-kids, .pz-sec-tools ↑↓), „Príprava pôdy“ (brown stripes), a leaf out of
   the rotation by a soil transition (.pz-tile[data-out]) and the soil blocks (.pz-soil, .pz-soil-box).
   ========================================================================== */

:root {
  --pz-graze-bg: #2f7d4a;
  --pz-graze-fg: #ffffff;
  --pz-rest-line: #c9dccf;
  --pz-rest-edge: #8dbf9e;
  --pz-renew-line: #f3ddb5;
  --pz-crop-line: #e3cdb3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pz-graze-bg: #2f7d4a;
    --pz-graze-fg: #ffffff;
    --pz-rest-line: #2f5a3d;
    --pz-rest-edge: #3d7a52;
    --pz-renew-line: #5c4615;
    --pz-crop-line: #4d3824;
  }
}
:root[data-theme="dark"] {
  --pz-graze-bg: #2f7d4a;
  --pz-graze-fg: #ffffff;
  --pz-rest-line: #2f5a3d;
  --pz-rest-edge: #3d7a52;
  --pz-renew-line: #5c4615;
  --pz-crop-line: #4d3824;
}

.pz { gap: 12px; }
/* Revealed under the sticky app header (arrival from the plots table, a tapped tile, a new task). */
.pz-head, .pz-sec-head, .pz-task { scroll-margin-top: calc(var(--header-h, 56px) + 12px); scroll-margin-bottom: calc(var(--tabbar-space, 0px) + 12px); }
.pz-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pz-main[hidden], .pz-missing[hidden] { display: none; }

/* ---- Head: ‹ Pôda · „Nový oddiel“ · title · lead ---- */
.pz-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.pz-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.pz-back:hover { text-decoration: underline; }
.pz-new {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pz-new:hover:not(:disabled) { background: var(--green-tint); }
.pz-new:disabled { opacity: 0.55; cursor: not-allowed; }
.pz-new[hidden] { display: none; }
.pz-title { overflow-wrap: anywhere; }
.pz-lead[hidden] { display: none; }

/* ---- Cards ---- */
.pz-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pz-card[hidden] { display: none; }
.pz-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.pz-card-title { margin: 0; font-size: 15px; font-weight: 700; }
.pz-card-hint { color: var(--text-2); font-size: 12.5px; }
.pz-card-hint[hidden] { display: none; }
.pz-muted { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.pz-muted[hidden] { display: none; }
.pz-note { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.pz-note.is-warn { padding: 8px 10px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning-text); }
.pz-note[hidden] { display: none; }

/* ---- Grid of sections (6 on a phone, more on wider screens) ---- */
.pz-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; min-width: 0; }
@media (min-width: 560px) {
  .pz-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 52px), 1fr)); }
}
.pz-grid[hidden] { display: none; }
.pz-tile {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pz-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pz-tile.is-selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* State paint: tiles, legend swatches and the state chips' dots share it. */
:is(.pz-tile, .pz-swatch, .pz-dot)[data-state="grazing"],
[data-state="grazing"] > .pz-swatch,
[data-state="grazing"] > .pz-dot { background: var(--pz-graze-bg); border-color: var(--pz-graze-bg); color: var(--pz-graze-fg); }
.pz-tile[data-state="resting"],
[data-state="resting"] > .pz-swatch,
[data-state="resting"] > .pz-dot { background: var(--green-soft); border-color: var(--pz-rest-line); color: var(--green-text); }
.pz-tile[data-state="hay"],
[data-state="hay"] > .pz-swatch,
[data-state="hay"] > .pz-dot { background: var(--grey-soft); border-color: var(--border); color: var(--grey-text); }
.pz-tile[data-state="renewal"],
[data-state="renewal"] > .pz-swatch,
[data-state="renewal"] > .pz-dot { background: var(--warning-soft); border-color: var(--pz-renew-line); color: var(--warning-text); }
.pz-tile[data-state="crop"],
[data-state="crop"] > .pz-swatch,
[data-state="crop"] > .pz-dot { background: var(--brown-soft); border-color: var(--pz-crop-line); color: var(--brown-text); }
.pz-tile[data-state="idle"],
[data-state="idle"] > .pz-swatch,
[data-state="idle"] > .pz-dot { background: var(--surface); border-color: var(--border-strong); border-style: dashed; color: var(--text-2); }
/* v4 R18 „Príprava pôdy“ (only manure and cover crops, never grazed): brown stripes. */
.pz-tile[data-state="prepSoil"],
[data-state="prepSoil"] > .pz-swatch,
[data-state="prepSoil"] > .pz-dot {
  background: repeating-linear-gradient(135deg, var(--brown-soft) 0 5px, var(--surface) 5px 9px);
  border-color: var(--pz-crop-line);
  color: var(--brown-text);
}

.pz-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-2); font-size: 12px; }
.pz-legend[hidden] { display: none; }
.pz-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.pz-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border: 1px solid transparent; border-radius: 3px; }
/* The next paddock of the planner's rotation (never a hay / renewal / crop one): a dot in the tile's corner and in the legend. */
.pz-tile { position: relative; }
.pz-tile[data-next="true"]::after,
.pz-mark { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--pz-graze-bg); box-shadow: 0 0 0 1.5px var(--surface); }
.pz-tile[data-next="true"]::after { position: absolute; top: 4px; right: 4px; }
.pz-legend-mark { display: inline-flex; align-items: center; gap: 5px; }
.pz-mark { display: inline-block; flex: none; }
/* The rotation rule under the legend; no free paddock = the planner's warning. */
.pz-legend-note { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.pz-rot-note { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning-text); font-size: 13px; line-height: 1.4; }
.pz-legend-note[hidden], .pz-rot-note[hidden] { display: none; }

.pz-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.pz-empty[hidden] { display: none; }
.pz-empty-text { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }

/* ---- Card of the selected section (tone stripe = its state) ---- */
.pz-sec { border-left: 4px solid var(--border-strong); }
.pz-sec[data-state="grazing"] { border-left-color: var(--green); }
.pz-sec[data-state="resting"] { border-left-color: var(--pz-rest-edge); }
.pz-sec[data-state="hay"] { border-left-color: var(--grey); }
.pz-sec[data-state="renewal"] { border-left-color: var(--warning); }
.pz-sec[data-state="crop"] { border-left-color: var(--brown); }
.pz-sec[data-state="prepSoil"] { border-left-color: var(--brown); border-left-style: dashed; }
.pz-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; min-width: 0; }
.pz-sec-title { flex: 1 1 min(14em, 100%); margin: 0; min-width: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.pz-sec-status { flex: 0 1 auto; color: var(--text-2); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.pz-sec-status[data-tone="good"] { color: var(--green-text); }
.pz-sec-status[data-tone="warn"] { color: var(--warning-text); }

.pz-states { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pz-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pz-state:hover:not(:disabled) { background: var(--surface-2); }
.pz-state.is-active { border-color: var(--green); background: var(--green-soft); color: var(--green-text); }
.pz-state:disabled { cursor: default; opacity: 0.7; }
.pz-state.is-active:disabled { opacity: 1; }
.pz-state:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pz-dot { display: inline-block; flex: none; width: 9px; height: 9px; border: 1px solid transparent; border-radius: 50%; }

.pz-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pz-label { margin: 0; color: var(--text-2); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* Assigned chips: herds and animals green, the crop brown, equipment grey; „Priradiť z farmy“ dashed. */
.pz-chips-row { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pz-chips { display: contents; }
.pz-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-height: 32px;
  padding: 2px 4px 2px 10px;
  border-radius: 999px;
  background: var(--grey-soft);
  color: var(--grey-text);
  font-size: 13px;
  font-weight: 600;
}
.pz-chip[data-tone="green"] { background: var(--green-soft); color: var(--green-text); }
.pz-chip[data-tone="crop"] { background: var(--brown-soft); color: var(--brown-text); }
.pz-chip-text { min-width: 0; padding-right: 4px; overflow-wrap: anywhere; }
.pz-chip-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.pz-chip-x:hover { background: var(--surface-3); }
.pz-chip-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.pz-assign {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--green-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pz-assign:hover { background: var(--green-tint); }
.pz-assign[hidden] { display: none; }

/* ---- Tasks of the section ---- */
.pz-tasks { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pz-task { min-width: 0; border-radius: 10px; background: var(--surface-2); }
.pz-trow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pz-trow:hover { background: var(--surface-3); }
.pz-trow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pz-tdot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--brown); }
.pz-task.is-gen .pz-tdot { background: var(--green); }
.pz-ttext { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-width: 0; }
.pz-tname { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.pz-tname.is-empty { color: var(--text-2); font-style: italic; }
.pz-task.is-done .pz-tname { color: var(--text-2); text-decoration: line-through; }
.pz-tmeta { color: var(--text-2); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.pz-tchev { display: grid; place-items: center; flex: none; color: var(--muted); transition: transform 0.15s; }
.pz-task.is-open .pz-tchev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .pz-tchev { transition: none; } }
/* Prepojené úlohy: the block „Úlohy“ of the section (views/farm-tasks.js, css/farm-tasks.css) and its own task definitions */
.pz-tasks-block { gap: 10px; }
.pz-sec-tasks { min-width: 0; }
.pz-own { min-width: 0; border-top: 1px solid var(--border); padding-top: 6px; }
.pz-own[hidden] { display: none; }
.pz-own-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  list-style-position: inside;
}
.pz-own-count { color: var(--text); font-variant-numeric: tabular-nums; }
.pz-own-hint { margin-left: auto; color: var(--link); font-weight: 600; }
.pz-own[open] .pz-own-hint { visibility: hidden; }
.pz-tedit { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 4px 10px 12px; }
.pz-tedit[hidden] { display: none; }

.pz-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 10px 12px; min-width: 0; }
.pz-fields > * { min-width: 0; }
.pz-fields .field[hidden] { display: none; }
.pz-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pz-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pz-row-actions > :only-child { margin-left: 0; }
.pz-add-task[hidden], .pz-add-note[hidden], .pz-remove[hidden], .pz-tremove[hidden] { display: none; }
.pz-link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pz-link-btn:hover { text-decoration: underline; }
.pz-link-btn[hidden] { display: none; }

/* ---- History ---- */
.pz-stats { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.4; }
.pz-stats[hidden], .pz-history[hidden] { display: none; }
.pz-history { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.pz-hist {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 13px;
}
.pz-hist:last-child { border-bottom: 0; }
.pz-hist-date { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pz-hist-text { min-width: 0; overflow-wrap: anywhere; }

/* ---- Name, area, kind (folded) ---- */
.pz-more { min-width: 0; border-top: 1px solid var(--grid); padding-top: 4px; }
.pz-more > summary {
  display: flex;
  align-items: center;
  min-height: 36px;
  color: var(--link);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pz-more[open] > summary { margin-bottom: 8px; }
.pz-more .pz-actions { margin-top: 8px; }

/* ---- Other plots ---- */
.pz-plots { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pz-plots[hidden] { display: none; }
.pz-plot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 60px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}
.pz-plot:hover { border-color: var(--border-strong); text-decoration: none; }
.pz-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pz-plot-text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-width: 0; }
.pz-plot-title { font-weight: 600; overflow-wrap: anywhere; }
.pz-plot-sub { color: var(--text-2); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.pz-plot-open { flex: none; color: var(--link); font-size: 13.5px; font-weight: 600; }

/* ---- Picker „Priradiť z farmy“ and the split sheet (modals; bottom sheets on a phone – app.css) ---- */
.pz-pick-body, .pz-split { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pz-pick-intro { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.pz-pick-intro:focus { outline: none; }
.pz-pick-group { margin: 8px 0 0; color: var(--text-2); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.pz-pick-list { display: flex; flex-direction: column; gap: 6px; }
.pz-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pz-pick:hover { background: var(--surface-2); }
.pz-pick.is-active { border-color: var(--green); background: var(--green-tint); }
.pz-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pz-pick-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  color: transparent;
}
.pz-pick.is-active .pz-pick-box { border-color: var(--green); background: var(--green); color: var(--pz-graze-fg); }
.pz-pick-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pz-pick-name { font-weight: 600; overflow-wrap: anywhere; }
.pz-pick-sub { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.pz-split .field[hidden] { display: none; }
.pz-seg { align-self: flex-start; max-width: 100%; }
.pz-split-preview { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; line-height: 1.45; }
.pz-split-preview.is-warn { background: var(--warning-soft); color: var(--warning-text); }

/* ---- Farma → Pôda: „Oddiely a pasenie“ at the top of the plots section (views/editor/plots.js) ---- */
.ed-sections-hub { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.ed-sections-hub[hidden] { display: none; }
.ed-sections-hub-title { margin: 0; font-size: 15px; font-weight: 700; }
.ed-sections-hub-note { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.ed-sections-hub-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ed-sections-hub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.ed-sections-hub-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-sections-hub-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.ed-sections-hub-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.ed-sections-hub-sub { color: var(--green-text, var(--text-2)); font-size: 12px; }
.ed-sections-hub-count { flex: none; color: var(--link); font-size: 13.5px; font-weight: 700; white-space: nowrap; }

/* ---- v4 R3: sections with subsections (a foldable group in the grid), the area bar, the section card's tree ---- */
.pz-tgroup { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 4px 0 6px; border-top: 1px solid var(--grid); }
.pz-grid > .pz-tgroup:first-child { border-top: 0; padding-top: 0; }
.pz-tgroup > .pz-tgroup-head { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; min-height: 0; padding: 0; }
.pz-tgroup > .pz-tgroup-head > .fold-toggle { flex: none; margin: 0; }
.pz-tgroup-head > .fold-summary { flex: 1 1 100%; padding-left: 48px; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.pz-tgroup-btn {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pz-tgroup-btn:hover { background: var(--surface-3); }
.pz-tgroup-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pz-tgroup-btn.is-selected { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.pz-tgroup-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 14px; font-weight: 700; }
.pz-tgroup-num { flex: none; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pz-tgroup-name { min-width: 0; overflow-wrap: anywhere; }
.pz-tgroup-meta { color: var(--text-2); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pz-tgroup-meta.is-warn, .pz-kids-meta.is-warn { color: var(--warning-text); font-weight: 600; }
/* subsections: the grid of their tiles, indented under the section */
.pz-subgrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  margin-left: 4px;
  padding-left: 6px;
  border-left: 2px solid var(--border);
}
@media (min-width: 560px) {
  .pz-subgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 52px), 1fr)); }
}
.pz-subgrid > .pz-tile { font-size: 12px; }
/* a narrow phone (320 px): 5 tiles a row, so every tile stays ≥ 40 px wide */
@media (max-width: 359px) {
  .pz-grid, .pz-subgrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
/* the area bar „4,2 z 5,0 ha“: green, amber when the parts are bigger than the whole */
.pz-meter { display: block; width: 100%; height: 4px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.pz-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.pz-meter[data-tone="warn"] .pz-meter-fill, .pz-meter[data-tone="over"] .pz-meter-fill { background: var(--warning); }
/* a leaf out of the rotation by an applied soil transition (planner rotationOutOn): a brown corner mark */
.pz-tile[data-out="true"]::before,
.pz-out-mark { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--brown); box-shadow: 0 0 0 1.5px var(--surface); }
.pz-tile[data-out="true"]::before { position: absolute; top: 4px; left: 4px; }
.pz-legend-out { display: inline-flex; align-items: center; gap: 5px; }
.pz-out-mark { display: inline-block; flex: none; }

/* the section card: ‹ section of a subsection, the subsections of a section, what they have assigned */
.pz-sec[data-state="mixed"] { border-left-color: var(--border-strong); }
.pz-crumb {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 36px;
  margin: -4px 0 0;
  padding: 0 4px 0 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pz-crumb-text { min-width: 0; overflow-wrap: anywhere; }
.pz-crumb:hover .pz-crumb-text { text-decoration: underline; }
.pz-crumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pz-kids-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.pz-kids-meta { color: var(--text-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pz-subnote { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.pz-subnote.is-warn { padding: 8px 10px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning-text); }
.pz-kids { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pz-kid {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pz-kid:hover { background: var(--surface-3); }
.pz-kid:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pz-kid-text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-width: 0; }
.pz-kid-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.pz-kid-meta { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.pz-kid-assigned { overflow-wrap: anywhere; }
/* „Rozdeliť na podsekcie…“ and ↑↓ */
.pz-sec-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding-top: 6px; border-top: 1px solid var(--grid); }
.pz-split-sub { max-width: 100%; white-space: normal; }
.pz-order { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.pz-order-text { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pz-order-btn:disabled { opacity: 0.4; }
/* „Osamostatniť ako pozemok“ (the sheet) */
.pz-promote-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0 0 0 18px; font-size: 13.5px; line-height: 1.45; }
.pz-promote-list > li { overflow-wrap: anywhere; }
.pz-promote-body.is-blocked .pz-promote-list { padding: 8px 10px; list-style: none; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning-text); }
.pz-actions .pz-promote { margin-right: auto; }
.pz-own-areas { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pz-own-areas .field[hidden] { display: none; }

/* ---- v4 R18: „Pôda a prechod“ (the plot) and „Pôda“ (the section card) ---- */
.pz-soil-intro { font-size: 13px; }
.pz-soil-box { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pz-soil-line { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.pz-soil-box[data-state="regenerative"] > .pz-soil-line:first-of-type { color: var(--green-text); }
.pz-soil-box[data-state="prepSoil"] > .pz-soil-line:first-of-type { color: var(--brown-text); }
.pz-soil-tr { color: var(--text); }
.pz-soil-link {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  min-height: 36px;
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.pz-soil-link:hover { text-decoration: underline; }
.pz-soil-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the section's pointer to the plot's tasks (PH10-14) is a button styled as the link */
button.pz-soil-link { border: 0; background: none; padding: 0; font: inherit; text-align: left; cursor: pointer; }
/* „Otvoriť nový pozemok ›“ inside the promote toast (PH10-11) */
.pz-toast-link { color: inherit; font-weight: 600; text-decoration: underline; display: inline-flex; align-items: center; min-height: 44px; }

/* ---- Phone / touch: ≥ 44 px targets ---- */
@media (pointer: coarse) {
  .pz-new { min-height: 44px; }
  .pz-tile { min-height: 44px; }
  .pz-state { min-height: 44px; }
  .pz-assign { min-height: 44px; }
  .pz-chip { min-height: 44px; }
  .pz-chip-x { width: 40px; height: 40px; }
  .pz-trow { min-height: 56px; }
  .pz-link-btn { min-height: 44px; }
  .pz-more > summary { min-height: 44px; }
  .pz-own-sum { min-height: 44px; }
  .pz-pick { min-height: 56px; }
  .pz-seg .segmented-item { min-height: 44px; }
  .pz-tgroup-btn { min-height: 48px; }
  .pz-crumb { min-height: 44px; }
  .pz-kid { min-height: 52px; }
  .pz-soil-link { min-height: 44px; }
  .pz-split-sub { min-height: 44px; }
  .pz-promote { min-height: 44px; }
  .pz-order-btn.btn-icon.btn-sm { width: 44px; height: 44px; }
}

/* A link to one section (?oddiel=) scrolls its card to the top under the app bar (P8A-UX-07). */
.pz-sec { scroll-margin-top: calc(var(--header-h, 56px) + 12px); }
