/* ==========================================================================
   Komunita (views/komunita.js, docs/design-v2/Komunita.dc.html) — prefix .km-
   Colours only through tokens: the Nova 2 look (v2.css) gives paper #F6F4EE, white cards with a hairline,
   green = farm (the živnostník), brown = costs and community (employees, the active tab); the classic look
   and dark mode follow app.css. Phone first: nothing wider than the phone, ≥ 44 px targets on touch, inputs
   16 px (app.css), rows open in place below themselves (nothing above a tapped row changes).
   ========================================================================== */

.km { gap: 12px; }
.km-summary { font-size: 14px; }

/* ---- Tabs Členovia · Služby · Výroba (three equal buttons, brown when active) ---- */
/* „Upraviť“ of the roster preview scrolls the tabs into view below the sticky header (scroll-margin). */
.km-tabs.tabs { display: flex; gap: 6px; overflow: visible; scroll-margin-top: calc(var(--header-h, 56px) + 12px); }
.km-tabs .tab {
  flex: 1 1 0;
  justify-content: center;
  min-width: 0;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.km-tabs .tab:hover { background: var(--surface-2); }
/* Active: solid brown with white text (design); the selector beats [data-look="nova"] .tabs--pills .tab.is-active. */
.km .km-tabs.tabs--pills .tab.is-active,
.km .km-tabs.tabs--pills .tab.is-active:hover { border-color: var(--brown); background: var(--brown); color: #ffffff; }
/* Dark: white on the lighter dark-mode brown is below 4.5 : 1 – a brown tint with the brown text instead. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .km .km-tabs.tabs--pills .tab.is-active,
  :root:not([data-theme="light"]) .km .km-tabs.tabs--pills .tab.is-active:hover { background: var(--brown-soft); color: var(--brown-text); }
}
:root[data-theme="dark"] .km .km-tabs.tabs--pills .tab.is-active,
:root[data-theme="dark"] .km .km-tabs.tabs--pills .tab.is-active:hover { background: var(--brown-soft); color: var(--brown-text); }
.km-tabs .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.km-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.km-panel[hidden] { display: none; }

/* ---- Cards ---- */
.km-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);
}
.km-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.km-card-title { margin: 0; min-width: 0; font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.km-note { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.km-note.is-warn { color: var(--warning-text); }
.km-empty { margin: 0; color: var(--text-2); font-size: 13.5px; }
.km-empty[hidden], .km-note[hidden] { display: none; }
.km-warn {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: 13px;
  line-height: 1.4;
}
.km-warn[hidden] { display: none; }

/* „Pridať prácu“ pill of the design (brown outline on a brown tint) */
.km-add-pill.btn {
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--brown);
  border-radius: 999px;
  background: var(--brown-soft);
  color: var(--brown-text);
  font-size: 13px;
  font-weight: 600;
}
.km-add-pill.btn:hover:not(:disabled) { background: var(--brown-tint); border-color: var(--brown); color: var(--brown-text); }
.km-add-pill[hidden] { display: none; }
.km-link-btn {
  flex: none;
  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;
}
.km-link-btn:hover { text-decoration: underline; }
.km-link { color: var(--link); font-size: 13.5px; font-weight: 600; }

/* ---- Avatars (initials) ---- */
.km-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grey-soft);
  color: var(--grey-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.km-avatar.km-tone-green { background: var(--green-soft); color: var(--green-text); }
.km-avatar.km-tone-brown { background: var(--brown-soft); color: var(--brown-text); }
.km-avatar.km-tone-none { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); }
.km-avatar-sm { width: 28px; height: 28px; font-size: 11.5px; }

/* ---- Members ---- */
.km-mlist {
  display: flex;
  flex-direction: column;
  margin: 0 -16px;
  border-top: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
}
.km-member { border-bottom: 1px solid var(--grid); min-width: 0; }
.km-member:last-child { border-bottom: 0; }
.km-mrow, .km-trow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  padding: 12px 14px 12px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.km-mrow:hover, .km-trow:hover { background: var(--surface-2); }
.km-mrow:focus-visible, .km-trow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.km-mtext, .km-ttext { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-width: 0; }
.km-mname, .km-tname { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.km-tname.is-empty { color: var(--text-2); font-style: italic; }
.km-msub, .km-tmeta { color: var(--text-2); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.km-mside { display: flex; flex: none; flex-direction: column; align-items: flex-end; max-width: 30%; text-align: right; }
.km-mhours { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.km-mhours[hidden] { display: none; }
.km-mhint { color: var(--text-2); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.km-mchev { display: grid; place-items: center; flex: none; color: var(--muted); transition: transform 0.15s; }
.is-open > .km-mrow .km-mchev, .is-open > .km-trow .km-mchev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .km-mchev { transition: none; } }

.km-medit, .km-tedit {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 4px 16px 16px;
  background: var(--surface);
}
.km-medit[hidden], .km-tedit[hidden] { display: none; }
.km-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px 12px; min-width: 0; }
.km-fields > * { min-width: 0; }
.km-fields .field[hidden], .km-fgroup[hidden] { display: none; }
.km-f-wage.is-low .field-hint { color: var(--warning-text); }
.km-fgroup { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.km-flabel { color: var(--text-2); font-size: 13px; font-weight: 600; }
.km-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.km-remove[hidden] { display: none; }

.km-szco {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--green-tint);
}
.km-szco[hidden] { display: none; }
.km-szco-text { margin: 0; font-size: 13.5px; line-height: 1.45; }

/* ---- Chips (skills, days, templates) ---- */
.km-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.km-chips-own { display: contents; }
.km-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.km-chip:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.km-chip.is-on { border-color: var(--brown); background: var(--brown-soft); color: var(--brown-text); }
.km-chip:disabled { cursor: not-allowed; opacity: 0.6; }
.km-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.km-chip-day { min-width: 40px; padding-inline: 8px; }
.km-chip-add { border-style: dashed; }
.km-chip-add[hidden] { display: none; }
.km-chip-tpl { background: var(--surface-2); border-color: var(--border); color: var(--grey-text); font-weight: 550; }
.km-templates { display: flex; flex-direction: column; gap: 6px; }
.km-templates[hidden] { display: none; }

/* ---- Roster preview (Členovia) ---- */
.km-rgrid { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12px; }
/* R21: a row per service of the week („Ráno – maštaľ“ wraps in its column), Po – Ne */
.km-rgrid-row { display: grid; grid-template-columns: minmax(0, 1.8fr) repeat(7, minmax(0, 1fr)); gap: 4px; min-width: 0; }
.km-rgrid-day { color: var(--text-2); font-weight: 600; text-align: center; }
.km-rgrid-label { align-self: center; min-width: 0; color: var(--text-2); font-size: 11.5px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.km-rgrid-cell {
  display: grid;
  place-items: center;
  height: 30px;
  min-width: 0;
  overflow: hidden;
  border-radius: 7px;
  background: var(--grey-soft);
  color: var(--grey-text);
  font-weight: 700;
  white-space: nowrap;
}
.km-rgrid-cell.km-slot-morning, .km-rgrid-cell.km-win-morning, .km-rgrid-cell.km-win-dawn { background: var(--green-soft); color: var(--green-text); }
.km-rgrid-cell.km-slot-evening, .km-rgrid-cell.km-win-evening, .km-rgrid-cell.km-win-dusk { background: var(--brown-soft); color: var(--brown-text); }
.km-rgrid-cell.is-empty { background: transparent; border: 1px dashed var(--border); }
.km-rgrid-cell.is-off { background: transparent; border: 0; }
.km-rgrid-cell.is-warn { box-shadow: inset 0 0 0 2px var(--warning); }

/* ---- Works ---- */
.km-tlist { display: flex; flex-direction: column; margin: 0 -16px; }
.km-tlist:not(:empty) { border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); }
.km-task { border-bottom: 1px solid var(--grid); min-width: 0; }
.km-task:last-child { border-bottom: 0; }
.km-trow { min-height: 56px; }
.km-tdot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--brown); }

/* ---- Links (taxes, living costs) ---- */
.km-links { display: flex; flex-direction: column; gap: 10px; }

/* ---- Roster editor (Služby, R21): the services of the week as rows (window – place, time, works), Po – Ne as columns; a phone
   shows one day (.km-roster[data-day] + the day chips, the rules at the end) ---- */
.km-roster { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.km-roster-row { display: grid; grid-template-columns: minmax(0, 2.2fr) repeat(7, minmax(0, 1fr)); gap: 6px; align-items: stretch; min-width: 0; }
.km-roster-head > span { color: var(--text-2); font-size: 12.5px; font-weight: 700; }
.km-roster-corner { align-self: end; }
.km-roster-dayh { display: grid; min-width: 0; }
.km-roster-day {
  min-width: 0;
  min-height: 32px;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.km-roster-day.is-on { border-color: var(--brown); background: var(--brown-soft); color: var(--brown-text); }
.km-roster-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.km-roster-shead { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 4px 0; }
.km-roster-sname { font-size: 13.5px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.km-roster-stime { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.km-roster-sworks { color: var(--text-2); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.km-roster-sscope { align-self: flex-start; padding: 0 6px; border-radius: 999px; background: var(--green-soft); color: var(--green-text); font-size: 11.5px; font-weight: 600; }
.km-roster-sscope[hidden], .km-roster-stime[hidden] { display: none; }
.km-roster-row.is-legacy .km-roster-sname { color: var(--warning-text); }
.km-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--grey-tint);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.km-cell.km-slot-morning, .km-cell.km-win-morning, .km-cell.km-win-dawn { background: var(--green-tint); }
.km-cell.km-slot-evening, .km-cell.km-win-evening, .km-cell.km-win-dusk { background: var(--brown-tint); }
.km-cell:hover:not(:disabled) { border-color: var(--border-strong); }
.km-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.km-cell:disabled { cursor: default; }
.km-cell.is-empty { background: var(--surface); border-style: dashed; color: var(--text-2); font-weight: 550; }
.km-cell.is-warn { border-color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); }
/* a day without work in the service: no cell to fill */
.km-cell.is-off { justify-content: center; background: transparent; border-style: dotted; color: var(--muted); font-weight: 500; }
.km-cell-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.km-fair {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.4;
}
.km-fair.is-warn { background: var(--warning-soft); color: var(--warning-text); }
.km-fair-title { margin: 0; font-weight: 600; }
.km-fair-list { margin: 0; padding-left: 18px; }
.km-fair-list[hidden], .km-fair-counts[hidden] { display: none; }
.km-fair-counts { margin: 0; color: var(--text-2); }
.km-fair.is-warn .km-fair-counts { color: inherit; }

/* ---- Member picker (modal) ---- */
.km-pick-list { display: flex; flex-direction: column; gap: 6px; }
.km-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;
}
.km-pick:hover { background: var(--surface-2); }
.km-pick.is-active { border-color: var(--brown); background: var(--brown-tint); }
.km-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.km-pick .km-avatar { width: 36px; height: 36px; }
.km-pick-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.km-pick-name { font-weight: 600; overflow-wrap: anywhere; }
.km-pick-sub { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }

/* ---- Výroba ---- */
.km-soon { align-items: flex-start; }
.km-soon-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--green-soft); color: var(--green-text); }
.km-products { display: flex; flex-direction: column; align-self: stretch; margin: 0; padding: 0; list-style: none; }
.km-products[hidden] { display: none; }
.km-product {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--grid);
}
.km-product:last-child { border-bottom: 0; }
.km-product-name { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.km-product-meta { color: var(--text-2); font-size: 13px; }
.km-soon-action.btn { min-height: 40px; }

/* ---- Phone / touch: ≥ 44 px targets ---- */
@media (pointer: coarse) {
  .km-tabs .tab { height: 44px; }
  .km-chip { min-height: 44px; }
  .km-chip-day { min-width: 44px; }
  .km-add-pill.btn, .km-link-btn, .km-soon-action.btn { min-height: 44px; }
  .km-cell { min-height: 52px; }
  .km-pick { min-height: 56px; }
  .km-remove.btn { min-height: 44px; }
  /* „Dane a odvody farmy vo Financiách“ stands on its own line in the živnostník's card – a 44 px target */
  .km-szco .km-link { display: inline-flex; align-items: center; min-height: 44px; }
}
/* A phone: the amount of a link card („2 696 € / mes.“) gets its own line under the text, so the title and the sub line
   keep the card's width instead of a 100 px column. */
@media (max-width: 420px) {
  .km-link-card.v2-card-link { flex-wrap: wrap; row-gap: 6px; }
  .km-link-card .v2-row-text { flex: 1 1 calc(100% - 92px); }
  .km-link-card .v2-row-count { order: 5; max-width: calc(100% - 50px); margin-left: 50px; }
}
@media (max-width: 400px) {
  .km-card { padding: 12px 14px; }
  .km-mlist, .km-tlist { margin: 0 -14px; }
  .km-mrow, .km-trow { padding-left: 14px; padding-right: 10px; gap: 10px; }
  .km-medit, .km-tedit { padding-inline: 14px; }
  .km-rgrid-row { grid-template-columns: minmax(0, 1.8fr) repeat(7, minmax(0, 1fr)); gap: 3px; }
}

/* Print: the opened editors and the roster stay readable on paper. */
@media print {
  .km-tabs, .km-add-pill, .km-templates, .km-remove, .km-link-btn { display: none !important; }
  .km-panel[hidden] { display: flex !important; }
}

/* ---- Tasks (docs/SPEC_V3.md §B): the task lists of task-sheet.css (.ts-list-block) inside the cards ---- */
.km-count { flex: none; }
.km-tasks[hidden], .km-duties[hidden] { display: none; }
.km-mtasks, .km-ttasks { padding-bottom: 12px; border-bottom: 1px solid var(--grid); }
.km-tasks-meta { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.km-duties { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.km-duty {
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.km-duty:hover { background: var(--surface-2); }
.km-duty:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.km-tasks-add.btn { align-self: flex-start; }
.km-tasks-card { gap: 8px; }
.km-pick-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.km-pick-body:focus { outline: none; }
.km-member.is-target > .km-mrow, .km-task.is-target > .km-trow { box-shadow: inset 3px 0 0 var(--accent); }
@media (pointer: coarse) {
  .km-duty { min-height: 44px; }
  .km-tasks-add.btn { min-height: 44px; }
}

/* ==========================================================================
   Round 12 (docs/SPEC_V4.md R7, R8, R21, R22): Služby day view, „Práce farmy“, the volunteer fieldset, the certificate,
   the card „Právna forma komunity“, its choice sheet and the comparison modal. Phone first: one day of the roster per screen,
   ≥ 44 px targets on touch, texts wrap (no nowrap below this line), nothing wider than the phone.
   ========================================================================== */

/* Služby on a phone: the day chips choose the day, the rows show that day's cell beside the service */
@media (max-width: 599px) {
  .km-roster-row { grid-template-columns: minmax(0, 1fr) minmax(0, 42%); }
  .km-roster-head { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
  .km-roster-head .km-roster-corner { display: none; }
  .km-roster-day { min-height: 40px; border-color: var(--border); background: var(--surface); color: var(--text); }
  .km-roster[data-day="0"] .km-cell:not([data-day="0"]),
  .km-roster[data-day="1"] .km-cell:not([data-day="1"]),
  .km-roster[data-day="2"] .km-cell:not([data-day="2"]),
  .km-roster[data-day="3"] .km-cell:not([data-day="3"]),
  .km-roster[data-day="4"] .km-cell:not([data-day="4"]),
  .km-roster[data-day="5"] .km-cell:not([data-day="5"]),
  .km-roster[data-day="6"] .km-cell:not([data-day="6"]) { display: none; }
}
.km-regen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: var(--warning-text);
  font-size: 13px;
  line-height: 1.4;
}
.km-regen[hidden] { display: none; }
.km-regen-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.km-regen-btn[hidden] { display: none; }
.km-pick.is-warn { border-color: var(--warning); }

/* „Práce farmy“: groups per service, a row per work (title → the shared sheet, time, window) */
.km-fw { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.km-fw[hidden], .km-fw-empty[hidden] { display: none; }
.km-fw-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.km-fw-ghead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.km-fw-gname { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.km-fw-gtime { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.km-fw-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--grid); }
.km-fw-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 11rem);
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--grid);
}
.km-fw-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.km-fw-title {
  align-self: flex-start;
  max-width: 100%;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.km-fw-title:disabled { color: var(--text); cursor: default; }
.km-fw-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.km-fw-meta { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.km-fw-time { color: var(--text); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.km-fw-time.is-empty { color: var(--muted); font-weight: 500; }
.km-fw-ctl { display: flex; min-width: 0; }
.km-fw-ctl .select { width: 100%; min-width: 0; }
.km-fw-fixed { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.km-fw-fixed[hidden], .km-fw-win[hidden] { display: none; }
@media (max-width: 520px) {
  .km-fw-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  .km-fw-ctl { grid-column: 1 / -1; }
}
/* R8: the catalogue works of Členovia show a time only once logged („—“ until then) */
.km-catwork-time { color: var(--text); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.km-catwork-time.is-empty { color: var(--muted); font-weight: 500; }

/* ---- R7: health insurance, the volunteer fieldset and the certificate ---- */
.km-ins[hidden], .km-vol[hidden] { display: none; }
.km-f-health.is-warn .field-hint { color: var(--warning-text); }
.km-vol {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.km-vol-legend { padding: 0 4px; font-size: 14px; font-weight: 700; }
.km-vol-help { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.km-vol-warns { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.km-vol-warns[hidden] { display: none; }
.km-vol-warn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
}
.km-vol-warn.is-warning { border-color: var(--warning); background: var(--warning-soft); color: var(--warning-text); }
.km-vol-warn-text { margin: 0; overflow-wrap: anywhere; }
.km-vol-consentwrap[hidden], .km-vol-oblwrap[hidden] { display: none; }
.km-vol-chips, .km-assoc-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.km-vol-chips[hidden], .km-assoc-chips[hidden] { display: none; }
.km-assoc-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.km-assoc-chip:hover { background: var(--surface-3); }
.km-assoc-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.km-vol-cert[hidden] { display: none; }
.km-cert-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.km-cert-summary { margin: 0; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.km-cert-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.45; }
.km-cert-empty { color: var(--text-2); list-style: none; margin-left: -18px; }
.km-cert-preview { margin: 6px 0 0; padding: 10px; border-radius: var(--radius); background: var(--surface-2); font: inherit; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- R22: „Právna forma komunity“ ---- */
.km-assoc-badge { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--grey-soft); color: var(--grey-text); font-size: 12.5px; font-weight: 600; }
.km-assoc-badge.is-founding { background: var(--brown-soft); color: var(--brown-text); }
.km-assoc-badge.is-active { background: var(--green-soft); color: var(--green-text); }
.km-assoc-shr { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.km-assoc-text, .km-assoc-active-line { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.km-assoc-intro, .km-assoc-founding, .km-assoc-active, .km-assoc-money { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.km-assoc-intro[hidden], .km-assoc-founding[hidden], .km-assoc-active[hidden], .km-assoc-money[hidden], .km-assoc-oblwrap[hidden] { display: none; }
.km-assoc-decision[hidden], .km-assoc-taxshare[hidden], .km-assoc-church[hidden], .km-assoc-churchfields[hidden] { display: none; }
.km-assoc-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.km-assoc-actions .btn[hidden] { display: none; }
.km-assoc-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--brown-tint);
  border: 1px solid var(--border);
}
.km-assoc-step-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.km-assoc-step-line { margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.km-assoc-step-line[hidden], .km-assoc-step-open[hidden] { display: none; }
.km-assoc-step-due.is-overdue { color: var(--danger-text, var(--warning-text)); font-weight: 600; }
.km-assoc-step-open { align-self: flex-start; }
.km-assoc-activate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--green-tint);
  font-size: 13px;
  line-height: 1.4;
}
.km-assoc-activate[hidden] { display: none; }
.km-assoc-activate-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.km-assoc-allsteps { min-width: 0; }
.km-assoc-allsteps-sum { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13.5px; font-weight: 600; list-style: none; cursor: pointer; }
.km-assoc-steps { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 0; padding: 0; list-style: none; }
.km-assoc-steprow { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 6px 4px; border-radius: 8px; }
.km-assoc-steprow.is-target { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
.km-assoc-stepmark {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grey-soft);
  color: var(--grey-text);
  font-size: 12px;
  font-weight: 700;
}
.km-assoc-steprow.is-done .km-assoc-stepmark { background: var(--green-soft); color: var(--green-text); }
.km-assoc-steprow.is-overdue .km-assoc-stepmark { background: var(--warning-soft); color: var(--warning-text); }
.km-assoc-steptext { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.km-assoc-stepname { font-size: 13.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.km-assoc-steprow.is-done .km-assoc-stepname { color: var(--text-2); }
.km-assoc-stepmeta { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.km-assoc-bodies .pp { margin-top: 2px; }
.km-assoc-sub { margin: 4px 0 0; font-size: 14px; font-weight: 700; }
.km-assoc-budget { display: flex; flex-direction: column; margin: 0; }
.km-assoc-brow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 0 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--grid);
}
.km-assoc-blabel { min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.km-assoc-btax { color: var(--text-2); font-size: 12.5px; }
.km-assoc-bamount { margin: 0; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.km-assoc-bnote { grid-column: 1 / -1; margin: 0; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.km-assoc-totals { margin: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.km-assoc-texts { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.km-assoc-rent { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.km-assoc-rent[hidden], .km-assoc-rent-btn[hidden] { display: none; }
.km-assoc-rent-text { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.km-assoc-footer { font-size: 12.5px; }

/* the choice sheet (§10.3 options) and the activation sheet */
.km-choice-body, .km-act-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.km-choice-intro { margin: 0; font-size: 14px; line-height: 1.45; }
.km-choice-list { display: flex; flex-direction: column; gap: 8px; }
.km-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.km-choice:hover { background: var(--surface-2); }
.km-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.km-choice[data-kind="oz"] { border-color: var(--green); }
.km-choice-label { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.km-choice-sub { color: var(--text-2); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.km-choice-church { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.km-choice-church[hidden] { display: none; }
.km-choice-church-text { margin: 0; font-size: 13.5px; line-height: 1.45; }

/* the comparison modal: tabs (the bar scrolls sideways), each panel ≤ one phone screen – long lists as folded rows */
.km-cmp { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
/* PH12-06: the seven tabs wrap into rows (every one visible – „Čo zvoliť“ never off-screen), no sideways scroll */
.km-cmp-tabs.tabs { flex-wrap: wrap; overflow: visible; gap: 4px; }
.km-cmp-tabs.tabs .tab { flex: 0 1 auto; white-space: normal; text-align: center; line-height: 1.2; }
.km-cmp-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.km-cmp-panel[hidden] { display: none; }
.km-cmp-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 4px 12px; padding: 0 0 6px; }
.km-cmp-other { display: flex; flex-direction: column; gap: 2px; padding: 0 0 8px; }
.km-cmp-cell { display: flex; flex-direction: column; gap: 1px; margin: 0; min-width: 0; font-size: 13px; line-height: 1.4; }
.km-cmp-form { color: var(--text-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.km-cmp-text { margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.km-cmp-meta { margin: 0; color: var(--text-2); font-size: 11.5px; overflow-wrap: anywhere; }
.km-cmp-note { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.km-cmp-sub { margin: 4px 0 0; font-size: 13.5px; font-weight: 700; }
.km-cmp-choose { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.km-cmp-choose > li { display: flex; flex-direction: column; padding: 4px 0; border-bottom: 1px solid var(--grid); font-size: 12.5px; line-height: 1.35; }
.km-cmp-sit { color: var(--text-2); }
.km-cmp-pick { font-weight: 600; }
.km-cmp-details { border-bottom: 1px solid var(--grid); }
.km-cmp-summary { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13.5px; font-weight: 600; line-height: 1.3; list-style: none; cursor: pointer; overflow-wrap: anywhere; }
/* a folded row shows that it opens (the flex summary hides the native marker in WebKit) */
.km-cmp-summary::-webkit-details-marker, .km-assoc-allsteps-sum::-webkit-details-marker { display: none; }
.km-cmp-summary::after, .km-assoc-allsteps-sum::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform 0.15s; }
details[open] > .km-cmp-summary::after, details[open] > .km-assoc-allsteps-sum::after { transform: rotate(180deg); }
.km-cmp-details > .km-cmp-text { padding: 0 0 6px; }
.km-cmp-footer { margin: 0; padding-top: 6px; border-top: 1px solid var(--grid); color: var(--text-2); font-size: 12.5px; }

@media (pointer: coarse) {
  .km-roster-day { min-height: 44px; }
  .km-fw-title { min-height: 44px; }
  .km-assoc-chip { min-height: 44px; }
  .km-assoc-allsteps-sum, .km-cmp-summary { min-height: 44px; }
  .km-choice { min-height: 56px; }
  .km-cmp-tabs .tab { min-height: 44px; }
  .km-assoc .btn, .km-vol .btn, .km-regen .btn, .km-choice-church .btn { min-height: 44px; }
  /* round 13: „Prístup členov“ and „Oznamy komunity“ (the section at the end of this file) */
  .km-acc-btns .btn, .km-acc-link-actions .btn, .km-acc-status .btn, .km-acc-actions .btn { min-height: 44px; }
  .km-acc-open, .km-acc-error-link { min-height: 44px; }
  .km-board-add.btn, .km-board-more.btn { min-height: 44px; }
  .km-board-del.btn { min-width: 44px; min-height: 44px; }
  .km-acc-policy .toggle { min-height: 44px; }
  .km-access-link.btn { min-height: 44px; }
}

/* PH12-06: below 768 px the comparison is a full-height sheet (like the HACCP modal) – its header and tabs keep their place when a
   tab with a shorter or longer panel is chosen */
@media (max-width: 767px) {
  .modal-backdrop:has(> .km-assoc-compare) { padding: 0; align-items: stretch; }
  .km-assoc-compare.modal { max-width: none; height: 100vh; max-height: 100vh; border: 0; border-radius: 0; }
  .km-assoc-compare .modal-header { padding: 8px 8px 2px 16px; }
  .km-assoc-compare .modal-body { padding: 4px 14px 10px; }
}
@supports (height: 100dvh) {
  @media (max-width: 767px) {
    .km-assoc-compare.modal { height: 100dvh; max-height: 100dvh; }
  }
}

/* ==========================================================================
   Round 13 (docs/SPEC_V4.md §3 R9, R13; views/komunita-pristup.js): the owner's cards „Prístup členov“ (.km-acc-) and „Oznamy komunity“
   (.km-board-). Phone first: a member row is avatar + name + chip on one line, the actions below it; the invite link wraps inside its
   field; ≥ 44 px targets on touch (in the last „pointer: coarse“ block above), inputs 16 px (app.css), texts wrap, nothing wider
   than the phone.
   ========================================================================== */
/* a deep link (?karta=pristup) scrolls the card's head below the sticky app header */
.km-access, .km-board { scroll-margin-top: calc(var(--header-h, 56px) + 12px); }
.km-acc-badge { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--warning-soft); color: var(--warning-text); font-size: 12.5px; font-weight: 600; }
.km-acc-badge[hidden] { display: none; }
.km-acc-section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.km-acc-section[hidden], .km-acc-status[hidden], .km-acc-moved[hidden], .km-acc-actions[hidden] { display: none; }
.km-acc-h { margin: 4px 0 0; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.km-acc-label { margin: 2px 0 0; color: var(--text-2); font-size: 13px; font-weight: 600; }
.km-acc-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.km-acc-status .btn[hidden] { display: none; }
.km-acc-moved {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--brown-tint);
  border: 1px solid var(--border);
}
.km-acc-moved-text { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.km-acc-open, .km-acc-error-link { align-self: flex-start; display: inline-flex; align-items: center; min-height: 32px; }
.km-acc-error-link[hidden] { display: none; }

/* member rows */
.km-acc-list, .km-acc-reqs, .km-board-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; min-width: 0; }
.km-acc-list[hidden], .km-board-list[hidden] { display: none; }
.km-acc-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--grid); min-width: 0; }
.km-acc-row:last-child { border-bottom: 0; }
.km-acc-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.km-acc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.km-acc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.km-acc-name { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.km-acc-sub { color: var(--text-2); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.km-acc-chip { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--grey-soft); color: var(--grey-text); font-size: 12px; font-weight: 600; line-height: 1.5; }
.km-acc-chip[hidden] { display: none; }
.km-acc-chip[data-state="active"] { background: var(--green-soft); color: var(--green-text); }
.km-acc-chip[data-state="invited"] { background: var(--warning-soft); color: var(--warning-text); }
.km-avatar.km-acc-tone-active { background: var(--green-soft); color: var(--green-text); }
.km-avatar.km-acc-tone-invited { background: var(--brown-soft); color: var(--brown-text); }
.km-acc-btns { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; padding-left: 52px; }
.km-acc-btns .btn[hidden] { display: none; }

/* requests of members */
.km-acc-req { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--radius); background: var(--warning-soft); min-width: 0; }
.km-acc-req p { margin: 0; overflow-wrap: anywhere; }
.km-acc-req-title { color: var(--warning-text); font-size: 12.5px; font-weight: 700; }
.km-acc-req-what { font-size: 14px; font-weight: 600; line-height: 1.4; }
.km-acc-req-to { color: var(--text-2); font-size: 13px; }
.km-acc-req-note { font-size: 13.5px; font-style: italic; line-height: 1.4; white-space: pre-wrap; }
.km-acc-req-note[hidden] { display: none; }
.km-acc-req .km-acc-btns { padding-left: 0; margin-top: 4px; }

/* „Čo vidia členovia“ */
.km-acc-policy .toggle { align-items: flex-start; }
/* v5 R24 „Čo smú členovia zapisovať“: grouped chips (on = allowed), the summary, the one-time notice */
.km-acc-allow-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.km-acc-allow-hint { margin: 0; font-size: 13px; line-height: 1.4; }
.km-acc-allow-summary { margin: 0; font-size: 14.5px; font-weight: 650; overflow-wrap: anywhere; }
.km-acc-allow-summary[data-state="limited"] { color: var(--warning-text); }
.km-acc-seen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.km-acc-seen[hidden] { display: none; }
.km-acc-seen-text { flex: 1 1 220px; min-width: 0; margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.km-acc-seen-ok.btn { flex: none; min-height: 44px; }
.km-acc-money-kinds[hidden], .km-acc-scope-note[hidden], .km-acc-kind-note[hidden] { display: none; }
.km-acc-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding-top: 4px; border-top: 1px solid var(--grid); }

/* sheets: invite, link, confirmation */
.km-acc-sheet-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.km-acc-lead { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.km-acc-error { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: var(--critical-soft); color: var(--critical-text); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.km-acc-error[hidden] { display: none; }
.km-acc-link.input { width: 100%; min-width: 0; font-family: var(--font-mono); font-size: 16px; text-overflow: ellipsis; }
.km-acc-link-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.km-acc-expiry { overflow-wrap: anywhere; }

/* „Oznamy komunity“ */
.km-board-composer { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
.km-board-composer[hidden], .km-board-empty[hidden], .km-board-more[hidden] { display: none; }
.km-board-composer .km-board-add { align-self: flex-start; }
.km-board-input.textarea { min-height: 72px; resize: vertical; }
.km-board-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--grid); min-width: 0; }
.km-board-row:last-child { border-bottom: 0; }
.km-board-body { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; }
.km-board-text { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.km-board-meta { margin: 0; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.km-board-row[data-by="member"] .km-board-meta { color: var(--brown-text); }
.km-board-del.btn { flex: none; }
.km-board-more.btn { align-self: flex-start; }

/* a narrow phone: the actions of a member row start under the avatar, not beside it */
@media (max-width: 400px) {
  .km-acc-btns { padding-left: 0; }
}
/* a member's card „Prístup do aplikácie“ → that row marked in „Prístup členov“ */
.km-acc-row.is-target { box-shadow: 0 0 0 6px var(--accent-soft); border-radius: 2px; background: var(--accent-soft); }
