/* ============================================================
   Zvonec One – Zdroje (Šablony, Formáty, Místa) and Správa (Přístupy, Nastavení sboru). Owned by P5.
   Only the pieces these screens add to the kit: the marks that lead a row (40) or a detail (56), the osnova and the
   needs in the template's layers, the secret sheet, Nastavení's value blocks. The frames, rows, sections, facts,
   layers and empty states are the kit's (css/kit.css, css/layers.css) and are not restyled here.
   Tokens only (css/palettes.css → css/tokens.css), no raw colours.
   ============================================================ */

/* the marks (.lead-mark, 40 / 56) are the kit's: css/kit.css */
.row:has(> .tpl-time:first-child) { --row-rule-start: calc(var(--space-3) + 52px + var(--space-3)); }

/* a quiet line under a list in a section („A ještě 3 setkání.“) */
.gather-note { margin-top: var(--gap-y); }

/* ---------- Šablony ---------- */
.tpl-time { flex: none; width: 52px; font-size: var(--type-meta); line-height: var(--lh-body); font-weight: var(--weight-strong); color: var(--ink-2); font-feature-settings: var(--numerals); }
.tpl-sum { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--gap-y); font-size: var(--type-meta); line-height: var(--lh-meta); color: var(--ink-2); }
.tpl-outline > .tpl-sum:first-child { margin-top: 0; margin-bottom: var(--gap-y); }
.tpl-sum[data-over="true"] { color: var(--wait-ink); }
.tpl-outline { display: grid; }
.tpl-outline__foot { display: flex; flex-wrap: wrap; gap: var(--gap-x); margin-top: var(--gap-y); }
.tpl-description { max-width: 62ch; margin-top: var(--gap-y); }
.tpl-image:not([hidden]) { display: block; margin-top: var(--gap-y); overflow: hidden; border-radius: var(--shape-block); background: var(--tint); }
.tpl-image:not([hidden]) { max-width: 360px; }
.tpl-image > img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }   /* 16 : 9 as stored */
.tpl-image-field .tpl-image:not([hidden]) { margin: 0 0 var(--gap-y); }
.tpl-image__actions { display: flex; flex-wrap: wrap; gap: var(--gap-x); }
.tpl-places { display: grid; gap: var(--gap-y); }
.tpl-places__group { display: grid; gap: var(--space-2); }
.tpl-places .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.tpl-total { font-weight: var(--weight-strong); }
.tpl-team { display: grid; }
.tpl-team + .tpl-team { margin-top: var(--gap-group); }
.tpl-team__head { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-m); }
.tpl-team__head > h3 { font-size: var(--type-body); line-height: var(--lh-body); font-weight: var(--weight-strong); }
.tpl-need { display: flex; align-items: center; gap: var(--space-3); min-height: var(--row-h-single); padding-left: calc(var(--avatar-s) + var(--space-3)); border-top: 1px solid var(--hairline); }
.tpl-need__name { flex: 1; min-width: 0; display: grid; font-size: var(--type-body); line-height: var(--lh-body); }

/* ---------- Formáty: the needs editor in the dialog ---------- */
.fmt-needs { display: grid; gap: var(--gap-y); }
.fmt-need { display: flex; align-items: center; gap: var(--space-3); }
.fmt-need__name { flex: 1; min-width: 0; display: grid; font-weight: var(--weight-strong); }

/* ---------- Místa ---------- */
.plc-inherit { padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); background: var(--tint); }

/* ---------- Přístupy: the secret shown once ---------- */
.secret { display: grid; gap: var(--space-2); }
.secret + .secret { margin-top: var(--gap-group); }
.secret__actions { display: flex; flex-wrap: wrap; gap: var(--gap-x); }
.acc-screen .ls__body > .callout { margin-bottom: var(--gap-group); }

/* ---------- Nastavení sboru: value blocks ---------- */
.cfg-blocks { display: grid; gap: var(--gap-group); }
.cfg-block { padding: var(--space-5); border-radius: var(--shape-block); background: var(--card); box-shadow: 0 0 0 1px var(--edge); min-width: 0; }
.cfg-values { display: grid; }
.cfg-value { display: grid; gap: 2px; padding: var(--space-2) 0; border-top: 1px solid var(--hairline); }
.cfg-value:first-child { border-top: 0; padding-top: 0; }
.cfg-value:last-child { padding-bottom: 0; }
.cfg-value > dt { font-size: var(--type-meta); line-height: var(--lh-meta); color: var(--ink-2); }
.cfg-value > dd { margin: 0; font-size: var(--type-body); line-height: var(--lh-body); overflow-wrap: anywhere; }
@media (min-width: 600px) {
  .cfg-value { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); align-items: baseline; }
  .cfg-value > dd { text-align: right; }
}
.cfg-stepper { display: flex; align-items: center; gap: var(--space-3); }
.cfg-unit { color: var(--ink-2); min-width: 4.5em; }
.cfg-actions { display: flex; flex-wrap: wrap; gap: var(--gap-x); margin-top: var(--gap-y); }
.cfg-admin { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--gap-y); }

/* ---------- Přehled (#prehled, leaders; ui/overview.js) – one figure block per section (kit figures()) ---------- */

/* ---------- Dary (#dary, the treasurer and the admins; ui/gifts.js) – the kit's blocks, only the joins here ---------- */
/* the year: ‹ 2026 › then 24 to the figure block, the bank line 12 under it */
.gifts-year { display: grid; gap: var(--gap-y); }
.gifts-year > .period-line { margin-bottom: calc(var(--gap-group) - var(--gap-y)); }
.gifts-main { display: grid; align-content: start; gap: var(--section-gap); min-width: 0; }
.gifts-main > .section { margin-top: 0; }
.gift-list + .meta { margin-top: var(--gap-y); }
.gift-print { display: flex; margin-top: var(--gap-y); }
.gift-img__row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.gift-img { display: grid; place-items: center; width: calc(1.5 * var(--space-9)); height: var(--space-9); border-radius: var(--radius-m); background: var(--card); box-shadow: inset 0 0 0 1px var(--edge); }
.gift-img img { max-width: calc(100% - var(--space-2)); max-height: calc(100% - var(--space-2)); }

/* ---------- the donation certificate (print, A4 portrait, one donor per page; ui/certificate.js) ---------- */
@page dary { size: A4 portrait; margin: 0; }
@media print {
  html[data-print="dary"] #view { display: none !important; }
  html[data-print="dary"] .print-sheet--cert { display: block; page: dary; }
  .cert {
    position: relative; overflow: hidden; display: flex; flex-direction: column; box-sizing: border-box;
    width: 210mm; height: 297mm; padding: 26mm 20mm 16mm; break-after: page;
    font-family: var(--font-ui); font-size: 10.5pt; line-height: 1.6; color: var(--p-ink); background: #fff;
  }
  .cert:last-child { break-after: auto; }
  .cert p { margin: 0; }
  /* the Manifest's otisk: pale pink lines bleeding off the top right corner, behind nothing but white space */
  .cert__otisk { position: absolute; z-index: 0; top: -54mm; right: -57mm; width: 125mm; height: auto; transform: rotate(60deg); opacity: .42; }
  .cert > :not(.cert__otisk) { position: relative; z-index: 1; }
  .cert__brand { margin: 0 0 12mm !important; font-family: var(--font-brand); font-weight: 800; font-size: 13pt; line-height: 1; letter-spacing: -.01em; color: #3b2f2f; }
  .cert__title { margin: 0 0 1.5mm; font-family: var(--font-title); font-weight: 900; font-size: 20pt; line-height: 1.1; }
  .cert__sub { margin-bottom: 10mm !important; color: var(--p-ink-2); }
  .cert__parties { display: grid; grid-template-columns: auto 1fr; gap: 4mm 7mm; margin: 0 0 8mm; }
  .cert__parties dt { color: var(--p-ink-2); }
  .cert__parties dd { margin: 0; }
  .cert__parties strong, .cert__line strong { font-weight: 620; }
  .cert__gifts { width: 100%; border-collapse: collapse; margin: 5mm 0 0; }
  .cert__gifts td { padding: 2mm 0; border-bottom: .5pt solid var(--p-line); }
  .cert__gifts td:last-child { text-align: right; font-weight: 620; font-feature-settings: var(--numerals); white-space: nowrap; }
  .cert__gifts .cert__sum td { border-bottom: 0; padding-top: 3.5mm; font-size: 12pt; }
  .cert__sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; margin: auto 0 8mm; padding-top: 10mm; }
  .cert__place { margin-bottom: 8mm !important; color: var(--p-ink-2); }
  .cert__marks { display: flex; align-items: flex-end; }
  .cert__stamp { display: block; width: 32mm; height: 32mm; margin: 0 -9mm 9mm 0; transform: rotate(-7deg); mix-blend-mode: multiply; opacity: .9; position: relative; z-index: 1; }
  .cert__stamp--empty { transform: none; }
  .cert__sig { width: 56mm; text-align: center; color: var(--p-ink-2); font-size: 9.5pt; line-height: 1.45; }
  .cert__sig img { display: block; width: 33mm; height: auto; margin: 0 0 -1.5mm 15mm; mix-blend-mode: multiply; }
  .cert__sig-room { display: block; height: 16mm; }
  .cert__line { border-top: .75pt solid var(--p-ink); padding-top: 1.5mm; }
  .cert__line strong { display: block; color: var(--p-ink); }
  .cert__foot { padding-top: 3.5mm; border-top: .5pt solid var(--p-line); color: var(--p-ink-3); font-size: 8pt; text-align: center; }
}

/* ---------- Sbírky (ui/fundraisers.js) – rows, a detail and the figure block from the kit ---------- */
.fund-detail .figures + * { margin-top: var(--gap-y); }

/* Nastavení sboru › Zprávy: a message shown as it will arrive – a quiet bubble that keeps its lines */
.msg-values { display: grid; gap: var(--space-5); }
.msg-value, .msg-preview { display: grid; gap: var(--space-2); justify-items: start; min-width: 0; }
.msg-value__label { font-size: var(--type-meta); line-height: var(--lh-meta); color: var(--ink-2); }
.msg-bubble {
  justify-self: stretch; margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-m) var(--radius-m) var(--radius-m) 4px;
  background: var(--wash); font-size: var(--type-body); line-height: var(--lh-body); white-space: pre-line; overflow-wrap: anywhere;
}

/* Osnova of a šablona: the drag handle before the time (as on the meeting's Osnova) */
.row:has(> .reorder-grip:first-child) { --row-rule-start: calc(var(--space-3) + 44px + var(--space-2) + 52px + var(--space-3)); }
.row > .reorder-grip { margin-right: calc(var(--space-2) - var(--space-3)); cursor: grab; touch-action: none; color: var(--ink-2); }
.row[data-dragging] { position: relative; z-index: 2; background: var(--overlay); box-shadow: var(--lift-4); transition: none; }
.row[data-dragging] > .reorder-grip { cursor: grabbing; }
.row[data-dragging]::before, .row[data-dragging] + .row::before { background: transparent; }
.tpl-outline__list > .row:not([data-dragging]) { transition: transform var(--dur-state) var(--ease); }
