/* hoa.by — one stylesheet, one spacing scale.
   Spacing: 4 · 8 · 12 · 16 · 24 · 32 · 48. Every vertical gap comes from a
   .stack (or a component's own gap), never from element default margins. */

@font-face {
  font-family: "Golos Text";
  src: url("golos-cyrillic.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("golos-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --ink: #1d2a23;
  --muted: #5c6a62;
  --line: #dde4de;
  --line-strong: #c3cdc6;
  --accent: #2f6f57;
  --accent-hover: #245a46;
  --accent-soft: #e6f0ea;
  --danger: #b42318;
  --danger-soft: #fdf1f0;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;
  --info: #1f4fae;
  --info-soft: #e9effc;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 6px;   /* controls */
  --r-md: 10px;  /* panels and lists */
  --control: 44px;
  --focus: 0 0 0 3px rgba(47, 111, 87, 0.25);
  color-scheme: light;
}

/* Reset: no default margins anywhere; spacing is explicit. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  font: 400 16px/1.55 "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
img { display: block; max-width: 100%; }
ul { list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

h1 { font-size: 28px; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 20px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 17px; line-height: 1.35; font-weight: 600; }
small, .small { font-size: 14px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---- Layout ---------------------------------------------------------- */
.wrap { width: 100%; max-width: 1040px; margin-inline: auto; padding-inline: var(--s4); }
@media (min-width: 640px) { .wrap { padding-inline: var(--s5); } }
main.wrap { padding-block: var(--s5) var(--s6); }

.stack { display: flex; flex-direction: column; gap: var(--gap, var(--s4)); }
.stack-xs { --gap: var(--s1); }
.stack-sm { --gap: var(--s2); }
.stack-md { --gap: var(--s5); }
.stack-lg { --gap: var(--s6); }
.row { display: flex; align-items: center; gap: var(--gap, var(--s3)); flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.narrow { max-width: 440px; margin-inline: auto; width: 100%; }
.cols-2 { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Side-by-side panels share a height; their actions line up at the bottom. */
.cols-2 > .panel > form.stack { flex: 1; }
.cols-2 > .panel > form.stack > .row:last-child { margin-top: auto; }

/* ---- Top bar --------------------------------------------------------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.brand img { border-radius: 8px; }
.brand:hover { color: var(--ink); }
.topbar .org { color: var(--muted); font-size: 15px; padding-left: var(--s3); margin-left: var(--s1); border-left: 1px solid var(--line); }
.topbar .who { display: flex; align-items: center; gap: var(--s4); font-size: 15px; }
.topbar .who a { text-decoration: none; }
@media (max-width: 560px) { .topbar .org, .topbar .who .name { display: none; } }

/* An association's sections: one nav (layout.html) in two looks. Below
   1024px, tabs that scroll sideways, fading at the edge to say there is
   more; from 1024px, a list on the left, grouped, that any number of
   sections fits. */
.sections { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: var(--s5);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); padding-right: 24px; }
.sections ul { display: contents; }
.sections-group { display: none; }
.sections a { display: block; padding: var(--s3) var(--s4); color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.sections a:hover { color: var(--ink); }
.sections a[aria-current=page] { color: var(--accent); border-bottom-color: var(--accent); }
@media (min-width: 1024px) {
  .has-nav .wrap { max-width: 1280px; }
  main.with-nav { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: var(--s6); align-items: start; }
  .sections { position: sticky; top: var(--s5); flex-direction: column; gap: 2px; border-bottom: 0; overflow: visible; margin: 0; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .sections ul { display: flex; flex-direction: column; gap: 2px; }
  .sections-group { display: block; padding: var(--s5) var(--s3) var(--s1); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
  .sections a { padding: var(--s2) var(--s3); border-bottom: 0; margin: 0; border-radius: var(--r-sm); white-space: normal; line-height: 1.35; }
  .sections a:hover { background: #ebf0ec; }
  .sections a[aria-current=page] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.lead { font-size: 18px; color: var(--muted); max-width: 60ch; }

/* ---- Surfaces -------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); }

/* A bordered list of rows: tickets, members, invites, memberships. */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); }
a.list-row { color: inherit; text-decoration: none; }
a.list-row:hover { background: #f8faf8; }
/* Below 12rem the text column takes a line of its own and badges wrap under it. */
.list-row .grow { flex: 1 1 12rem; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .meta { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; column-gap: var(--s3); row-gap: 2px; }

.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: var(--s6) var(--s5); text-align: center; color: var(--muted); }

/* ---- Forms ----------------------------------------------------------- */
form.stack { --gap: var(--s5); }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field > .label { font-size: 15px; font-weight: 600; }
.field .hint { font-size: 14px; color: var(--muted); }
.field .error { font-size: 14px; color: var(--danger); }
/* A refusal beside its input (fail.go), and the input it is about. */
.field-error { display: block; margin-top: var(--s1); font-size: 14px; line-height: 1.4; color: var(--danger); }
input:not([type=checkbox], [type=radio], [type=file], [type=hidden]), select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  width: 100%; min-height: var(--control); padding: 10px var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select { appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235c6a62' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[aria-invalid=true] { border-color: var(--danger); }
:is(input, select, textarea):has(+ .field-error) { border-color: var(--danger); }
input[readonly] { background: #f8faf8; color: var(--muted); }
::placeholder { color: #8a968f; }
input[type=file] { max-width: 100%; font: inherit; font-size: 15px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 500; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px var(--s4); margin-right: var(--s3); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
/* Floating labels: the label sits inside the box where the text goes, and
   moves to its top edge once the field has focus or a value. An input needs a
   placeholder (" " if nothing to say) for :placeholder-shown to see it empty;
   its own placeholder shows only under focus, below the moved label. */
.field:has(> .label + :is(input, select, textarea):not([type=file])) { position: relative; }
.field > .label:has(+ :is(input, select, textarea):not([type=file])) {
  position: absolute; left: 13px; right: 13px; top: 7px; z-index: 1;
  font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
  transition: top 120ms ease-out, font-size 120ms ease-out;
}
.field > .label + :is(input, select, textarea):not([type=file]) { min-height: 56px; padding-top: 25px; padding-bottom: 6px; }
.field > .label + select { padding-right: 40px; }
.field > .label:has(+ :is(input, textarea):placeholder-shown:not(:focus, :autofill)) { top: 17px; font-size: 16px; font-weight: 400; }
.field > .label + :is(input, textarea):not(:focus)::placeholder { color: transparent; }
.field:focus-within > .label { color: var(--accent); }
.field:has(> [aria-invalid=true]) > .label { color: var(--danger); }

fieldset { border: 0; }
legend { font-size: 15px; font-weight: 600; margin-bottom: var(--s2); }

/* Choice cards: a radio or checkbox with a title and an explanation. */
.choices { display: grid; gap: var(--s2); }
.choices.grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.choice { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; }
.choice .title { font-weight: 600; display: block; hyphens: auto; overflow-wrap: anywhere; }
.choice .hint { font-size: 14px; color: var(--muted); display: block; }

/* ---- Buttons: filled (primary) · outline (secondary) · text (tertiary) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--control); padding: 0 var(--s5);
  font: inherit; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
  color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: var(--r-sm); cursor: pointer;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-secondary { color: var(--accent); background: var(--surface); border-color: var(--line-strong); }
.btn-secondary:hover { color: var(--accent-hover); background: var(--accent-soft); border-color: var(--accent); }
.btn-text { min-height: auto; padding: 0; color: var(--accent); background: none; border: 0; font-weight: 500; }
.btn-text:hover { background: none; color: var(--accent-hover); text-decoration: underline; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: #8f1c13; }
.btn-sm { min-height: 36px; padding: 0 var(--s4); font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* ---- Feedback -------------------------------------------------------- */
.alert { padding: var(--s3) var(--s4); border-radius: var(--r-sm); font-size: 15px; border: 1px solid; }
/* API messages arrive in lower case, mid-sentence style. */
.alert::first-letter, .detail::first-letter { text-transform: uppercase; }
.alert-error { color: var(--danger); background: var(--danger-soft); border-color: #f5c6c1; }
.alert-ok { color: #19583f; background: var(--accent-soft); border-color: #c3dccf; }
.errors:empty { display: none; }
.saved { color: var(--accent); font-size: 14px; font-weight: 500; }
/* A refusal outdates an earlier "Saved" in the same form or edited row. */
:is(form, .reg-edit):has(.errors:not(:empty)) .saved { display: none; }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.status-open { background: var(--info-soft); color: var(--info); }
.status-in_progress { background: var(--warn-soft); color: var(--warn); }
.status-done { background: var(--accent-soft); color: #19583f; }
.status-rejected { background: #eef0ee; color: var(--muted); }
.badge-quiet { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); font-weight: 500; }
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 14px; background: var(--accent-soft); color: #19583f; }

/* Ticket list: search, a filters button, the active filters as chips. */
.search-bar { display: flex; gap: var(--s2); }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box input { padding-right: 48px; }
.search-box .icon-btn { position: absolute; right: 0; top: 0; }
.icon-btn { display: inline-grid; place-items: center; width: var(--control); height: var(--control); padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--accent); background: var(--accent-soft); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-variant-numeric: tabular-nums; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.chip-remove { gap: var(--s1); padding: 4px 8px 4px 12px; text-decoration: none; min-height: 32px; }
.chip-remove::after { content: "×"; font-size: 18px; line-height: 1; opacity: .7; }
.chip-remove:hover { color: #19583f; background: #d5e7dc; }
.reset-all { font-size: 14px; font-weight: 500; padding: 6px var(--s1); }
@media (max-width: 479px) { .search-bar .btn { padding-inline: var(--s3); } }

/* Sheet: a native popover (no script). A bottom sheet on phones, a centred
   panel from 640px. */
.sheet { margin: 0; border: 0; padding: var(--s5); color: var(--ink); background: var(--surface);
  inset: auto 0 0 0; width: 100%; max-width: none; max-height: 85dvh; overflow-y: auto;
  border-radius: var(--r-md) var(--r-md) 0 0; box-shadow: 0 -8px 32px rgba(29, 42, 35, 0.18); }
.sheet::backdrop { background: rgba(29, 42, 35, 0.35); }
.sheet[popover]:popover-open { animation: sheet-in 200ms ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@media (min-width: 640px) {
  .sheet { inset: 0; margin: auto; width: min(560px, calc(100vw - 2 * var(--s5))); height: fit-content; border-radius: var(--r-md); box-shadow: 0 16px 48px rgba(29, 42, 35, 0.2); }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-block: calc(-1 * var(--s2)); }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: var(--s2); position: sticky; bottom: calc(-1 * var(--s5)); background: var(--surface); padding-block: var(--s3) var(--s5); margin-bottom: calc(-1 * var(--s5)); border-top: 1px solid var(--line); }
/* In the sheet a choice is the whole pill; the radio stays for keyboards and
   screen readers, only unseen. */
.sheet .toggle { position: relative; min-height: 40px; padding-inline: var(--s4); font-size: 15px; }
.sheet .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sheet .toggle:has(input:focus-visible) { box-shadow: var(--focus); }
.sheet .toggle:has(input:checked) { font-weight: 600; }

/* ---- Auth ------------------------------------------------------------ */
.auth-shell { max-width: 480px; margin-inline: auto; }
/* Kratos fields: full width by default; the three name parts share one row. */
.auth-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4) var(--s3); }
.auth-fields > .field { grid-column: 1 / -1; }
.auth-fields > .field.part { grid-column: auto; }
@media (max-width: 480px) { .auth-fields > .field.part { grid-column: 1 / -1; } }
.auth-alt { text-align: center; color: var(--muted); font-size: 15px; padding-top: var(--s5); border-top: 1px solid var(--line); }
.forgot { align-self: flex-end; font-size: 14px; margin-top: calc(-1 * var(--s3)); }
.auth .qr { grid-column: 1 / -1; justify-self: center; border: 1px solid var(--line); border-radius: var(--r-sm); }
.auth .secret { font: 500 15px/1.4 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em; overflow-wrap: anywhere; background: var(--bg); padding: var(--s2) var(--s3); border-radius: var(--r-sm); }
.narrow-left { max-width: 640px; }
.auth .mismatch { font-size: 14px; color: var(--danger); }
.auth .section + .section { border-top: 1px solid var(--line); padding-top: var(--s6); }
/* Settings accordion: a row per section, its current state on the right. */
.accordion > details + details { border-top: 1px solid var(--line); padding-top: 0; }
.accordion > details > summary { width: auto; display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding-block: var(--s3); color: var(--ink); font-weight: 600; font-size: 17px; }
.accordion > details > summary::before, .accordion > details[open] > summary::before { content: none; }
.accordion > details > summary::after { content: ""; flex: none; width: 10px; height: 10px; margin: 0 4px 4px 0; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 150ms ease-out; }
.accordion > details[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.accordion > details > summary .title { flex: 1; }
.accordion > details > summary .hint { min-width: 0; color: var(--muted); font-size: 14px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.accordion > details[open] > summary { margin-bottom: 0; }
.accordion > details[open] > summary .hint { display: none; }
.accordion > details[open] { padding-bottom: var(--s4); }

/* ---- Landing --------------------------------------------------------- */
.hero { max-width: 640px; padding-block: var(--s7) var(--s5); }
.hero h1 { font-size: clamp(36px, 6vw, 52px); letter-spacing: -0.03em; }

/* ---- Tickets --------------------------------------------------------- */
.ticket-num { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3ch; }
.ticket-title .num { color: var(--muted); font-weight: 500; }
.ticket-layout { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .ticket-layout .side { position: sticky; top: var(--s5); }
}
/* Admin: a list or the main card on the left, a form on the right. */
.admin-layout { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .admin-layout .side { position: sticky; top: var(--s5); }
}
.org-active { background: var(--accent-soft); color: #19583f; }
.org-suspended { background: var(--danger-soft); color: var(--danger); }
.side .status-actions { flex-direction: column; }
.side .status-actions .btn { width: 100%; }
.facts { display: flex; flex-direction: column; gap: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s4); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { font-size: 15px; }
.ticket-body { white-space: pre-line; font-size: 17px; max-width: 70ch; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s2); }
.gallery a { display: block; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.status-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 500; list-style: none; width: fit-content; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+ "; }
details[open] > summary::before { content: "− "; }
details[open] > summary { margin-bottom: var(--s3); }

/* Discussion */
.thread { display: flex; flex-direction: column; gap: var(--s5); }
.comment { display: grid; grid-template-columns: 36px 1fr; column-gap: var(--s3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: #19583f; display: grid; place-items: center; font-size: 14px; font-weight: 600; }
.comment .body { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.comment .who { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; }
.comment .who strong { font-weight: 600; }
.comment .who time { color: var(--muted); font-size: 14px; }
.comment .text { white-space: pre-line; }
.comment .reply { margin-top: var(--s1); font-size: 14px; }
.comment .reply form { margin-top: var(--s2); }
.replies { grid-column: 2; display: flex; flex-direction: column; gap: var(--s4); margin-top: var(--s4); padding-left: var(--s4); border-left: 2px solid var(--line); }

/* ---- Members, invites, premises ------------------------------------- */
.toggles { display: flex; flex-wrap: wrap; gap: var(--s2); }
.toggle { display: inline-flex; align-items: center; gap: var(--s2); padding: 6px var(--s3); border: 1px solid var(--line-strong); border-radius: 999px; font-size: 14px; cursor: pointer; background: var(--surface); }
.toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: #19583f; }
.toggle input { width: 16px; height: 16px; }
/* Register: one compact row per member, a link to their page. Roles sit on
   the right, under the name on phones. */
.member-row { padding-block: var(--s3); gap: var(--s2) var(--s4); }
.member-row .badges .chip { font-size: 13px; }
.list-more { padding: var(--s2) var(--s5); text-align: center; }
.count-heading { font-weight: 500; font-size: 0.7em; font-variant-numeric: tabular-nums; }
.back { font-size: 15px; text-decoration: none; width: fit-content; }
.meta-line { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); color: var(--muted); font-size: 15px; }

.invite-row { flex-wrap: wrap; }
.invite-row .grow { min-width: 220px; }
.invite-row .link { flex: 2; min-width: 260px; display: flex; flex-direction: column; gap: var(--s1); }
.invite-row input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }
.fresh { background: #f2f8f4; }

.premise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--s2); }
.premise-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2) var(--s3); text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: var(--s2); align-items: flex-start; flex-wrap: wrap; }
.inline-form input { max-width: 280px; }
.inline-form .errors { flex-basis: 100%; }

/* Shown only while the list has no rows; htmx adds and removes rows in place. */
.list:has(li) + .empty-note, .premise-grid:has(li) + .empty-note { display: none; }
.list:not(:has(li)) { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* New-ticket form: what happened on the left, where/who/photos on the right. */
.ticket-form { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .ticket-form { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.ticket-form .panel:first-child .fill { flex: 1; }
.ticket-form .panel:first-child .fill textarea { flex: 1; min-height: 188px; }
.comment textarea { min-height: 72px; }
#comments textarea { min-height: 96px; }
dl .row dt { min-width: 120px; }

/* ---- Member actions, journal ----------------------------------------- */
.member-actions .action + .action { border-top: 1px solid var(--line); padding-top: var(--s4); }
.member-actions .link input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }
.audit-row { align-items: flex-start; }
.audit-row .meta a { color: inherit; }
.avatar-system { background: var(--line); color: var(--muted); }
.audit-more { padding: var(--s2) var(--s5); }

/* ---- Заявки v2 -------------------------------------------------------- */
.h3 { font-size: 16px; }
.badges { gap: var(--s2); flex-wrap: wrap; }
.badge-emergency { background: var(--warn-soft); color: var(--warn); }
.rich > * + * { margin-top: var(--s2); }
.rich ul, .rich ol { padding-left: var(--s5); }
.rich ul { list-style: disc; }
.rich ol { list-style: decimal; }
.rich blockquote { border-left: 3px solid var(--line-strong); padding-left: var(--s3); color: var(--muted); }
.rich del { color: var(--muted); }
.rich a { word-break: break-word; }
.ticket-body.rich { white-space: normal; }
.comment .text.rich { white-space: normal; }
.editor.fill { flex: 1; }
.editor.fill textarea { flex: 1; min-height: 180px; }
.editor-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.editor-bar .hint { font-size: 13px; color: var(--muted); }
.preview:empty { display: none; }
.preview-box { border: 1px dashed var(--line-strong); border-radius: var(--r-sm); padding: var(--s3); background: #fafbfa; }
.comment.internal > .body { background: var(--warn-soft); border-radius: var(--r-sm); padding: var(--s2) var(--s3); }
.replies.flat { padding-left: 0; border-left: none; grid-column: 1 / -1; }
.history { display: flex; flex-direction: column; gap: var(--s2); font-size: 14px; }
.history li { display: flex; flex-direction: column; }
.stars { color: var(--warn); letter-spacing: 1px; }

/* Errors. Each kind has its own tone; none is red-on-white (see docs/ui.md).
   missing/denied: calm accent — it is an answer, not a breakage.
   down: info blue — temporary, nothing lost.  slow, broken: amber. */
.trouble { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.trouble.trouble-down, .toast.toast-down { --tone: var(--info); --tone-soft: var(--info-soft); }
.trouble.trouble-slow, .trouble.trouble-broken, .toast.toast-slow, .toast.toast-broken { --tone: var(--warn); --tone-soft: var(--warn-soft); }
.trouble { margin-top: var(--s7); }
.trouble-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--tone); background: var(--tone-soft);
}
.ref { font-size: 14px; color: var(--muted); }
.ref code {
  font: 500 13px/1 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 3px 6px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  user-select: all;
}
.countdown { height: 4px; border-radius: 2px; background: var(--tone-soft); overflow: hidden; }
.countdown span {
  display: block; height: 100%; background: var(--tone);
  transform-origin: left; animation: countdown var(--secs, 30s) linear forwards;
}
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .countdown { display: none; } }

/* Toasts: failed htmx actions and lost connection. <dialog open> shows
   without script; its method=dialog form closes it. */
#flash:empty { display: none; }
.toast {
  --tone: var(--accent); --tone-soft: var(--accent-soft);
  position: fixed; inset: auto var(--s4) var(--s4) auto; z-index: 10;
  width: min(400px, calc(100vw - 2 * var(--s4)));
  margin: 0; padding: var(--s4); display: none; gap: var(--s3); flex-direction: column;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--tone); border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(29, 42, 35, 0.14);
  font-size: 15px;
}
.toast[open] { display: flex; animation: toast-in 160ms ease-out; }
.toast strong { color: var(--tone); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast[open] { animation: none; } }

/* Language switch: the current language plain, the others as links. */
.lang-switch { display: flex; gap: var(--s2); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.lang-switch span[aria-current] { color: var(--ink); }
.lang-switch a { color: var(--muted); }
.lang-switch a:hover { color: var(--accent); }

/* The heading of a comment that gives the reason for a move. */
.move-note { font-size: 15px; }

/* ---- Shared pieces for the register, announcements, documents, meetings ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h4 { font-size: 15px; font-weight: 600; }
.center { text-align: center; }
.narrow-wide { max-width: 760px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--s3); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .grid-2, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 820px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.bullets { list-style: disc; padding-left: var(--s5); display: grid; gap: var(--s1); }
.alert-warn { color: var(--warn); background: var(--warn-soft); border-color: #f0d7a8; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.warn-text { color: var(--warn); font-weight: 500; }
.btn-danger { background: #6b3a2e; border-color: #6b3a2e; }
.btn-danger:hover { background: #57291f; border-color: #57291f; }

/* A one-of-several switch between views of a page. */
.segmented { display: inline-flex; gap: var(--s1); padding: var(--s1); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); max-width: 100%; overflow-x: auto; align-self: flex-start; }
.segmented a { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.segmented a[aria-current=page] { background: var(--accent-soft); color: #19583f; font-weight: 600; }

/* Notes that say what is happening and what to do about it. */
.callout { padding: var(--s4) var(--s5); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); }
.callout-info { border-left-color: var(--info); background: var(--info-soft); }
.callout-ok { border-left-color: var(--accent); background: var(--accent-soft); }
.callout-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.prose { font-size: 17px; max-width: 70ch; }

/* Summary figures. */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { .stats dd { font-size: 18px; } }

.card-panel > summary, .add-panel > summary, .tips > summary { min-height: 24px; }
.card-panel[open] > summary, .add-panel[open] > summary, .tips[open] > summary { margin-bottom: var(--s4); }

/* ---- Register ---------------------------------------------------------- */
.reg-row { align-items: flex-start; padding-block: var(--s3); }
.reg-num { min-width: 3.5ch; font-weight: 650; font-size: 18px; font-variant-numeric: tabular-nums; }
.owners { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: 15px; }
.holder { overflow-wrap: anywhere; }
.holder .share { white-space: nowrap; }
.reg-row > .grow { min-width: 0; }
.share { color: var(--muted); font-variant-numeric: tabular-nums; }
.reg-edit { background: #fafbfa; }
.holdings { display: grid; gap: var(--s2); }
.holding { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.holding .grow { flex: 1 1 10rem; }
.holding .errors { flex-basis: 100%; }
.share-input { width: 7.5rem; flex: none; }
.share-input input { text-align: center; }

/* ---- Announcements ----------------------------------------------------- */
.cards { display: grid; gap: var(--s3); }
.card { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: inherit; text-decoration: none; }
.card:hover { border-color: var(--accent); color: inherit; }
.card .badges:empty { display: none; }
.card .title { font-size: 18px; font-weight: 600; }
.card .meta { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.excerpt { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.excerpt.rich > * + * { margin-top: var(--s1); }

/* ---- Documents ----------------------------------------------------------- */
.folders { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s1); }
.chip-link { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s4); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; white-space: nowrap; font: inherit; font-size: 15px; cursor: pointer; }
.chip-link[aria-current=page] { border-color: var(--accent); background: var(--accent-soft); color: #19583f; font-weight: 600; }
.chip-add { color: var(--accent); border-style: dashed; }
.doc-row { align-items: center; padding-block: var(--s3); }
.doc-row .title { color: var(--ink); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.doc-row a.title:hover { color: var(--accent); text-decoration: underline; }
.doc-row.outdated .title { text-decoration: line-through; color: var(--muted); }
.pin { color: var(--accent); font-weight: 600; }
.file-icon { width: 40px; height: 48px; flex: none; display: grid; place-items: end center; padding-bottom: 6px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #fff; background: var(--muted); }
.file-pdf { background: #8a5a2b; }
.file-doc { background: #2b5797; }
.file-xls { background: #1e7145; }
.file-img { background: #6b5b95; }
.meter-line { display: flex; flex-direction: column; gap: var(--s1); max-width: 320px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }

/* ---- Meetings ------------------------------------------------------------ */
.phase-draft { background: #eef0ee; color: var(--muted); }
.phase-voting { background: var(--info-soft); color: var(--info); }
.phase-counting { background: var(--warn-soft); color: var(--warn); }
.phase-counted, .phase-published { background: var(--accent-soft); color: #19583f; }
.phase-cancelled { background: #eef0ee; color: var(--muted); }

.steps { display: flex; gap: var(--s2); counter-reset: step; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.steps li { counter-increment: step; display: inline-flex; align-items: center; gap: var(--s2); }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); font-weight: 600; }
.steps li + li::after { order: -1; content: ""; width: 16px; height: 1px; background: var(--line-strong); }
.steps li[aria-current=step] { color: var(--ink); font-weight: 600; }
.steps li[aria-current=step]::before { background: var(--accent); border-color: var(--accent); color: #fff; }

.checklist { display: grid; gap: var(--s2); }
.checklist li { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.checklist li::before { content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); transform: translateY(3px); }
.checklist li.done::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.checklist li span { flex: 1 1 14rem; }

.agenda { display: grid; gap: var(--s3); counter-reset: q; }
.q-num { color: var(--muted); font-weight: 600; }
.proposal-view + .proposal-view { border-top: 1px dashed var(--line); padding-top: var(--s3); }
.proposal-text { font-weight: 500; }
.danger-zone { border-top: 1px solid var(--line); padding-top: var(--s4); }

/* The ballot: big, thumb-sized choices, one row each. */
.ballot { border-color: var(--accent); }
.step-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.ballot-q { border-top: 1px solid var(--line); padding-top: var(--s4); }
.ballot-q legend { margin-bottom: var(--s2); }
.ballot-q .q-title { font-size: 17px; font-weight: 600; }
.proposal + .proposal { margin-top: var(--s3); }
.vote-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.vote-opt { position: relative; display: grid; place-items: center; min-height: 48px; padding: var(--s2); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-weight: 600; text-align: center; cursor: pointer; }
.vote-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.vote-opt:has(input:focus-visible) { box-shadow: var(--focus); }
.vote-opt:hover { border-color: var(--accent); }
.vote-for:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.vote-against:has(input:checked) { background: #6b3a2e; border-color: #6b3a2e; color: #fff; }
.vote-abstain:has(input:checked) { background: var(--muted); border-color: var(--muted); color: #fff; }
.code-input { font: 600 28px/1 ui-monospace, "SF Mono", Menlo, monospace !important; letter-spacing: .3em; text-align: center; }
.ballot-summary { display: grid; gap: var(--s3); padding-left: var(--s5); }
.ballot-summary .q-title { font-weight: 600; }
.ballot-summary ul { display: grid; gap: var(--s1); margin-top: var(--s1); }
.choice-mark { font-weight: 600; white-space: nowrap; }
.choice-mark.vote-for, dt.vote-for { color: var(--accent); }
.choice-mark.vote-against, dt.vote-against { color: #6b3a2e; }
.choice-mark.vote-abstain, dt.vote-abstain { color: var(--muted); }
.receipt { border-color: #c3dccf; background: #f7fbf8; }
.receipt-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; }

/* Turnout bars, with a line where quorum lies. */
.turnout h3 { font-size: 17px; }
.bar-block { display: grid; gap: var(--s1); }
.bar { position: relative; height: 12px; border-radius: 6px; background: var(--line); }
.bar > span { display: block; height: 100%; border-radius: 6px; background: var(--info); }
.bar::after { content: ""; position: absolute; top: -4px; bottom: -4px; left: var(--mark, 50%); width: 2px; background: var(--ink); }
.stacked-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); }
.seg-for { background: var(--accent); }
.seg-against { background: #6b3a2e; }
.seg-abstain { background: var(--line-strong); }
.result-lines { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.result-lines div { display: flex; gap: var(--s1); }
.result-lines dt { font-weight: 600; }

.agenda-q h3 { font-size: 16px; }
.agenda-p { align-items: flex-start; flex-wrap: nowrap; }
.agenda-p textarea { min-height: 64px; }
.agenda-p .icon-btn { margin-top: 6px; }

/* ---- Paper: protocols and blank ballots, made to be printed -------------- */
.print-tools { margin-bottom: var(--s4); }
.paper { background: #fff; color: #000; max-width: 210mm; margin-inline: auto; padding: var(--s6) var(--s5); border: 1px solid var(--line); font-size: 15px; line-height: 1.45; display: grid; gap: var(--s4); }
.paper h1 { font-size: 20px; }
.paper h2 { font-size: 16px; }
.paper-title { text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.paper-draft { text-align: center; color: var(--warn); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.paper table { width: 100%; border-collapse: collapse; }
.paper th, .paper td { border: 1px solid #999; padding: 6px 8px; text-align: left; vertical-align: top; }
.paper-facts th { width: 38%; font-weight: 600; background: #f6f6f6; }
.paper-votes .box-col { width: 15%; text-align: center; }
.paper-votes .box { height: 36px; }
.paper-agenda { padding-left: var(--s5); list-style: decimal; }
.paper-q { break-inside: avoid; display: grid; gap: var(--s2); }
.paper-sign { display: grid; gap: var(--s4); margin-top: var(--s5); }
@media (max-width: 640px) { .paper { padding: var(--s4) var(--s3); font-size: 14px; } }
@media print {
  @page { size: A4; margin: 18mm 16mm; }
  html, body { background: #fff; }
  .topbar, .sections, .no-print, #flash, #offline { display: none !important; }
  main.wrap { padding: 0; max-width: none; display: block; }
  .paper { border: 0; padding: 0; max-width: none; }
}

/* A legend sits on its fieldset's border; floated, it is an ordinary block. */
.ballot-q > legend { float: left; width: 100%; }
.ballot-q > legend + * { clear: both; }
@media (max-width: 480px) {
  .vote-opt { font-size: 15px; padding: var(--s2) var(--s1); overflow-wrap: anywhere; }
}
.hint { font-size: 14px; color: var(--muted); }
@media (max-width: 480px) { .stats > div { padding: var(--s2) var(--s3); } .stats dt { font-size: 12px; overflow-wrap: anywhere; hyphens: auto; } }

/* A floating label over a textarea keeps a background, so text scrolled
   under it never shows through. */
.field > .label.label:has(+ textarea):has(+ textarea) { top: 1px; left: 1px; right: 1px; padding: 6px 12px 3px; background: var(--surface); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.field > .label.label:has(+ textarea:placeholder-shown:not(:focus)):has(+ textarea) { top: 11px; background: transparent; }

/* Phones: every tap target is at least 44px tall, and switches fit the width. */
@media (max-width: 720px) {
  .btn-sm, .topbar .who .btn { min-height: var(--control); }
  .btn-text { min-height: var(--control); display: inline-flex; align-items: center; }
  .back { display: inline-flex; align-items: center; min-height: var(--control); }
  .brand { min-height: var(--control); }
  .lang-switch { gap: 0; }
  .lang-switch a, .lang-switch span[aria-current] { display: inline-grid; place-items: center; min-width: 36px; min-height: var(--control); }
  .segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; overflow: visible; }
  .segmented a { min-height: var(--control); justify-content: center; padding: 0 var(--s2); white-space: normal; text-align: center; line-height: 1.2; }
  .folders { flex-wrap: wrap; overflow: visible; }
  .chip-link { min-height: var(--control); }
  .icon-btn { min-width: var(--control); }
}

/* Narrow phones: a switch's label and count stack, so three fit. */
@media (max-width: 480px) {
  .segmented a { flex-direction: column; gap: 0; padding: var(--s1) 2px; font-size: 13px; }
}

/* The register in bulk, buildings, and a premise's owners. */
.import-steps { list-style: none; padding: 0; }
.table-wrap { overflow-x: auto; }
.sheet-columns { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet-columns th, .sheet-columns td { text-align: left; vertical-align: top; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.sheet-columns thead th { color: var(--muted); font-size: 13px; font-weight: 600; }
.sheet-columns tbody th { font-weight: 600; white-space: nowrap; }
.sheet-columns code { font-size: 13px; }
.segmented.building-filter { display: inline-flex; width: auto; overflow-x: auto; }
.building-edit { flex-basis: auto; }
.building-edit > summary { list-style: none; }
.building-edit > summary::-webkit-details-marker { display: none; }
.building-edit[open] { flex-basis: 100%; }
.building-edit[open] > summary { margin-bottom: var(--s3); }
.owner-slot { border: 0; padding: 0; margin: 0; min-width: 0; }
.owner-slot + .owner-slot { border-top: 1px dashed var(--line); padding-top: var(--s3); }
.date-field { max-width: 15rem; }
.holders-change > summary, .holders-add > summary, .add-panel details > summary { cursor: pointer; color: var(--accent); font-weight: 500; }
/* A building's passport: a row per kind of premise, its count and area. */
.passport { padding: 0; margin: 0; min-width: 0; }
/* Rows align at the top, so a message under one input leaves its neighbour in line. */
.passport-row { display: grid; gap: var(--s2); grid-template-columns: 1fr 1fr; align-items: start; }
.passport-kind { grid-column: 1 / -1; font-size: 14px; font-weight: 500; }
@media (min-width: 560px) { .passport-row { grid-template-columns: 11rem 1fr 1fr; } .passport-kind { grid-column: auto; min-height: var(--control); display: flex; align-items: center; } }
.holdings > li + li { border-top: 1px solid var(--line); padding-top: var(--s2); }
