/* razdely — choosing site sections. Mobile first; the action bar sticks to the bottom. */
:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1f1f1f; --muted: #5e5e5e; --line: #e3e0d8; --focus: #1f4e8c;
  --on: #1b6e3a; --on-bg: #e6f4ea;
  --s-parish: #073b4c; --s-pokrov: #8a6d3b; --s-orthodoxy: #2d3b46; --s-maria: #1f4e8c; --s-saints: #7a2e26;
  --serif: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --card: #1b1b1b; --ink: #ededed; --muted: #a6a6a6; --line: #2c2c2c; --focus: #8fb3e0; --on: #81c995; --on-bg: #16301f;
          --s-parish: #82c0c7; --s-pokrov: #c9a45a; --s-orthodoxy: #a7b6c5; --s-maria: #8fb3e0; --s-saints: #d98a6f; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 17px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; padding: 0 16px 170px; max-width: 980px; margin: 0 auto; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; }
h1 { font-size: 26px; margin: 20px 0 6px; }
h2 { font-size: 20px; margin: 18px 0 8px; }
.lead, .muted { color: var(--muted); font-size: 15.5px; margin: 0 0 10px; }
button, input, textarea { font: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.who { display: flex; flex-direction: column; gap: 4px; font-weight: 600; margin: 6px 0 4px; }
.who input, #q, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend .lg { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14.5px; }
.legend .lg b { font-variant-numeric: tabular-nums; }

.tools { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 6px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg-btn { flex: 1; min-height: 46px; border: 0; background: var(--card); color: var(--ink); cursor: pointer; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* sites chips */
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.s-parish { --c: var(--s-parish); } .s-pokrov { --c: var(--s-pokrov); } .s-orthodoxy { --c: var(--s-orthodoxy); } .s-maria { --c: var(--s-maria); } .s-saints { --c: var(--s-saints); }
.dot { background: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 4px 11px; border-radius: 999px; border: 1.5px solid var(--c); background: transparent; color: var(--c); cursor: pointer; font-size: 13.5px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--c); color: var(--bg); }

/* catalogue */
details.group { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin: 12px 0; }
details.group > summary { cursor: pointer; padding: 14px 16px; list-style: none; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
details.group > summary::-webkit-details-marker { display: none; }
.g-title { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.g-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.g-body { padding: 0 14px 12px; }
.g-sites { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.g-sites p { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.sec { margin: 14px 0 0; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.sec-head h3 { font-size: 16.5px; margin: 0; }
.link-btn { background: transparent; border: 0; color: var(--focus); text-decoration: underline; cursor: pointer; padding: 6px 0; min-height: 40px; font-size: 14.5px; }
.item { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.item:last-child { border-bottom: 0; }
.item.on { background: var(--on-bg); border-radius: 10px; }
.item input[type="checkbox"] { width: 26px; height: 26px; margin: 2px 0 0; accent-color: var(--on); }
.item label { cursor: pointer; }
.item .code { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.item .chips { grid-column: 2; }
.item:not(.on) .chips { display: none; }
.hidden { display: none !important; }

.note-box textarea { min-height: 110px; resize: vertical; }
.io input[type="file"] { margin: 6px 0; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(0,0,0,.08); }
.sum { font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.bar-btns { display: flex; gap: 8px; }
.bar-btns button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-weight: 600; }
.bar-btns .primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msg { margin: 6px 0 0; color: var(--muted); font-size: 14px; min-height: 1em; }

@media (min-width: 760px) {
  .tools { flex-direction: row; } #q { flex: 1; } .seg { min-width: 320px; }
  .bar-btns { max-width: 560px; }
}

/* Links, draft notice, page theme */
.crumbs { margin: 14px 0 0; font-size: 15px; }
.crumbs a { color: var(--focus); }
.crumbs a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: none; }
.draft { margin: 4px 0 8px; padding: 8px 12px; border-left: 4px solid #b98f3e; background: var(--card); border-radius: 8px; font-size: 14.5px; color: var(--muted); }
.small { font-size: 13.5px; }
.theme { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0 4px; }
.theme-pick { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 15px; flex: 1 1 220px; }
.theme-pick select { min-height: 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
.theme .seg { flex: 1 1 220px; }

/* Notes with dictation */
.item .tools-row { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.note-btn { background: transparent; border: 0; color: var(--focus); cursor: pointer; padding: 4px 0; min-height: 36px; font-size: 14px; text-decoration: underline; }
.note-btn.has { font-weight: 700; }
.note-wrap { grid-column: 1 / -1; position: relative; margin-top: 4px; }
.note-wrap textarea { width: 100%; min-height: 96px; padding: 10px 56px 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); resize: vertical; font: inherit; }
.mic { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 20px; }
.mic[aria-pressed="true"] { background: #b3261e; border-color: #b3261e; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.rec { grid-column: 1 / -1; color: #b3261e; font-size: 13.5px; margin: 2px 0 0; }

/* Own sections */
.add-row { display: flex; gap: 8px; margin: 8px 0 2px; flex-wrap: wrap; }
.add-row input { flex: 1 1 220px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
.add-row button, .add-btn { min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1.5px dashed var(--focus); background: transparent; color: var(--focus); cursor: pointer; font: inherit; font-weight: 600; }
.add-row button.ok { border-style: solid; background: var(--focus); color: var(--bg); }
.item.custom .code { color: var(--focus); font-weight: 700; }
.del { background: transparent; border: 0; color: #b3261e; cursor: pointer; min-height: 36px; font-size: 14px; text-decoration: underline; }
