/* ROD – základní vzhled. Jednoduchý, čitelný, velké ovládací prvky. */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --ink: #23221f;
  --muted: #6b675e;
  --line: #e2ddd1;
  --accent: #3e6b3f;
  --accent-ink: #ffffff;
  --accent-soft: #e6efe3;
  --warn: #9a6a00;
  --warn-soft: #fbf1d9;
  --bad: #a3271b;
  --bad-soft: #f8e1de;
  --ok-soft: #e1f0e2;
  --field: #f1eee7; --field-line: #b9b09c; --field-focus: #ffffff;
  --ac-bg: #fff8dc; --ac-line: #c9a227; --ac-on: #f6e3a1; --ac-ink: #2b2410;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(35, 34, 31, .06);
  --s1: #3E8E41; --s2: #E58A2E; --s3: #C8453B; --s4: #2F6FB3; --s5: #8A6A3B; --s6: #7A4FA3; --s7: #4A4F57;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b19; --surface: #252522; --ink: #ecebe6; --muted: #a9a59b; --line: #3a3934;
    --accent: #7fb27f; --accent-ink: #10200f; --accent-soft: #263325;
    --warn: #e2b450; --warn-soft: #3a3020; --bad: #f08a7e; --bad-soft: #3d2421; --ok-soft: #233223;
    --field: #34332e; --field-line: #6a675d; --field-focus: #3d3c36;
    --ac-bg: #2f2a17; --ac-line: #e2b450; --ac-on: #4a3f1c; --ac-ink: #f5ecd0;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: 0 0 .9rem; }
small, .muted { color: var(--muted); }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; font-size: .9em; word-break: break-all; }

/* Rozvržení */
.top {
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.top-inner {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: .04em; color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
  text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 8px;
}
.nav a:hover, .nav a.active { background: var(--accent-soft); }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.user form { margin: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.narrow { max-width: 440px; margin: 48px auto; padding: 0 16px; }
.narrow .brand { display: block; text-align: center; margin-bottom: 24px; font-size: 1.4rem; }

/* Karty */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card.accent { border: 2px solid var(--accent); background: var(--accent-soft); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stat { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.tiles a { display: block; text-decoration: none; color: var(--ink); }
.tiles a:hover .card { border-color: var(--accent); }

/* Formuláře */
label { display: block; font-weight: 600; margin: 0 0 4px; font-size: .95rem; }
.field { margin-bottom: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: .88rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--field-line); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { background: var(--field-focus); border-color: var(--accent); }
input[type=file] { font: inherit; padding: 8px; border: 1px dashed var(--field-line); border-radius: 8px; background: var(--field); width: 100%; }
textarea { min-height: 200px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: 20px; height: 20px; }
input[type=color] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  cursor: pointer; text-decoration: none;
}
.btn.secondary { background: transparent; color: var(--accent); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .9rem; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.link { background: none; border: none; color: var(--muted); padding: 0; min-height: 0; font-weight: 400; text-decoration: underline; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* Zprávy */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; }
.flash.success { background: var(--ok-soft); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.flash.warning { background: var(--warn-soft); color: var(--warn); }
.flash.info { background: var(--accent-soft); }
.join-code { font-size: 1.5rem; letter-spacing: .12em; font-weight: 700; user-select: all; }

/* Tabulky */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
td input[type=text], td input[type=number], td select { min-height: 36px; padding: 6px 8px; }
tr.new td { background: var(--accent-soft); }

.badge { display: inline-block; font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.badge.ok { background: var(--ok-soft); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

.checks li { list-style: none; margin: 6px 0; }
.checks { padding: 0; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-family: ui-monospace, monospace; font-size: 1.1rem; }
.qr { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }
pre.small { white-space: pre-wrap; font-size: .85rem; }

@media (max-width: 640px) {
  .top-inner { gap: 8px; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
  h1 { font-size: 1.3rem; }
  .card { padding: 16px; }
}

/* Text právních dokumentů */
.legal-text { max-width: 72ch; font-size: 1.02rem; line-height: 1.65; margin-top: 16px; }
.legal-text p { margin: 0 0 1em; }

/* Etapa 2: registrace, profily, Občiny */
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.grid2 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid2.compact .field { margin-bottom: 8px; }
.sub { margin-left: 28px; }
.option { margin-bottom: 10px; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.plain legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.row-form label { margin: 0; }
.row-form input, .row-form select { width: auto; flex: 1 1 180px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.step { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--line); color: var(--muted); font-size: .9rem; text-decoration: none; }
.step span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); font-weight: 700; font-size: .8rem; }
.step.done { background: var(--ok-soft); color: var(--ink); }
.step.current { background: var(--accent); color: #fff; }
.step.current span { color: var(--accent); }
.spheres { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 8px; }
.sphere-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sphere-row label { margin: 0; font-weight: 400; }
.sphere-row select { width: 80px; }
table.skills td:not(:first-child), table.skills th:not(:first-child) { text-align: center; width: 80px; }
table.skills input { width: 20px; height: 20px; }
details.doc { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: var(--surface); }
details.doc summary { cursor: pointer; }
.doc-scroll { max-height: 320px; overflow-y: auto; }
.sig-wrap { border: 2px dashed var(--line); border-radius: 10px; background: #fff; max-width: 600px; }
canvas.sig { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.sig-img { max-width: 300px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.error-text { color: var(--bad); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; margin: 0 6px 6px 0; border-radius: 999px; background: var(--line); font-size: .9rem; }
.note { border-left: 3px solid var(--accent); padding: 6px 12px; margin-bottom: 12px; background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.note-head { margin-bottom: 4px; }
details.card summary { cursor: pointer; }
.me-link { color: var(--muted); text-decoration: none; }
.me-link:hover { color: var(--accent); text-decoration: underline; }
.mail-preview { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; background: var(--surface); }
.mail-preview a { pointer-events: none; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--line); }
.tabs a.active { background: var(--accent); color: #fff; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--accent-soft); }
.timeline li { padding: 0 0 14px 16px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 4px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); }
.join-steps li { margin-bottom: 10px; }
table.compare th[scope=row] { width: 26%; font-size: .92rem; color: var(--ink); white-space: normal; }
table.compare td { width: 37%; }
table.compare tr.changed { background: var(--warn-soft); }
table.compare tr.changed td.orig { text-decoration: line-through; color: var(--muted); }
.field-checks { columns: 2 220px; }
.field-checks .check { break-inside: avoid; margin-bottom: 4px; }
.small-list { padding-left: 18px; margin: 0 0 12px; } .small-list li { margin-bottom: 6px; }
.req { color: var(--bad); font-weight: 700; }
.missing-val { color: var(--bad); font-weight: 600; }
.dr-fields { display: grid; gap: 6px 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.dr-field { align-items: flex-start; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.dr-field input { margin-top: 3px; flex: none; }
.dr-field.empty { border-color: var(--bad-soft); }
.dr-field.req-missing { background: var(--bad-soft); border-color: var(--bad); }
select.ignored { color: var(--muted); }
@media (max-width: 640px) {
  table.import-map thead { display: none; }
  table.import-map tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line, #e5e5e5); }
  table.import-map td { display: block; border: 0; padding: .15rem 0; }
  table.import-map select { width: 100%; }
  table.import-preview td { min-width: 7rem; }
}

/* Editor typů dokumentů */
.doc-editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.doc-preview { position: sticky; top: 12px; }
.doc-preview iframe { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
@media (max-width: 1000px) { .doc-editor { grid-template-columns: 1fr; } .doc-preview { position: static; } .doc-preview iframe { height: 70vh; } }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.pair { display: flex; gap: 6px; } .pair input { min-width: 0; }
.rte { margin: 6px 0 14px; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--bg); position: sticky; top: 0; z-index: 2; }
.rte-btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: .9rem; }
.rte-btn:hover, .rte-btn.on { border-color: var(--accent); }
.rte-btn.b { font-weight: 700; } .rte-btn.i { font-style: italic; } .rte-btn.u { text-decoration: underline; } .rte-btn.s { text-decoration: line-through; }
.rte-sel { width: auto; max-width: 150px; height: 32px; padding: 0 6px; font-size: .85rem; }
.rte-pop { position: relative; display: inline-block; }
.rte-palette { position: absolute; z-index: 5; top: 36px; left: 0; display: grid; grid-template-columns: repeat(8, 22px); gap: 3px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.rte-palette[hidden] { display: none; }
.rte-palette .sw { width: 22px; height: 22px; border: 1px solid rgba(0,0,0,.2); border-radius: 4px; cursor: pointer; padding: 0; }
.rte-area { min-height: 120px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: #fff; color: #222; overflow-wrap: anywhere; }
.rte-area:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rte-area h1 { font-size: 1.6rem; } .rte-area h2 { font-size: 1.3rem; } .rte-area h3 { font-size: 1.1rem; } .rte-area h4 { font-size: 1rem; }
.rte-area img { max-width: 100%; height: auto; }
.rte-area table { border-collapse: collapse; } .rte-area td, .rte-area th { border: 1px dashed #bbb; padding: 4px; min-width: 40px; }
.rte-area .cols { display: grid; gap: 10px; } .rte-area .cols-2 { grid-template-columns: 1fr 1fr; } .rte-area .cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.rte-area .col { outline: 1px dashed #bbb; padding: 4px 8px; min-height: 30px; }
.rte-area .pagebreak { border-top: 2px dashed #c0392b; margin: 12px 0; height: 0; }
.rte-area .pagebreak::after { content: 'konec stránky'; display: block; font-size: .75rem; color: #c0392b; text-align: center; }
.rte textarea { font-family: ui-monospace, monospace; font-size: .85rem; min-height: 160px; }
.var-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.var-row input[type=text] { flex: 1 1 120px; width: auto; } .var-row select { width: auto; }
.frame-row { margin-bottom: 10px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; z-index: 3; }
main.wide { max-width: 1600px; }
/* Nástěnky */
.board-filter { gap: 6px; } .board-filter .btn.on { border-color: var(--accent); background: var(--accent-soft); }
.board-post.pinned { box-shadow: inset 0 0 0 2px var(--warn-soft); }
.board-post h2 { margin: 4px 0 8px; }
.board-post .small { font-size: .85rem; margin: 0; }
.board-actions { align-items: center; gap: 8px; }
.board-actions .btn.on { border-color: var(--accent); }
.board-comments { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.notes-list p { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.bar { display: block; height: 10px; border-radius: 5px; background: var(--accent); min-width: 2px; }
/* Našeptávač */
.ac-wrap { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0; list-style: none; max-height: 260px; overflow-y: auto;
  background: var(--ac-bg); color: var(--ac-ink); border: 2px solid var(--ac-line); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.ac-list[hidden] { display: none; }
.ac-list li { padding: 9px 12px; cursor: pointer; line-height: 1.3; }
.ac-list li:hover, .ac-list li.on { background: var(--ac-on); font-weight: 600; }
.ac-list li + li { border-top: 1px solid color-mix(in srgb, var(--ac-line) 25%, transparent); }
.ac-list li.ac-empty { color: var(--muted); cursor: default; font-weight: 400; }
.unit-emblem { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.unit-emblem.small { width: 32px; height: 32px; border-radius: 6px; vertical-align: middle; margin-right: 8px; }
.row-form .ac-wrap { flex: 1 1 180px; }

.avatar { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.avatar.big { width: 120px; height: 120px; }
.person-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.person-head h1 { margin: 0; }
.crop { margin-top: 10px; }
.crop-view { width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.crop-view canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.crop-zoom { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 8px 0 4px; max-width: 280px; }
.crop-zoom input { flex: 1; }
/* Platby */
.pay-details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.pay-details dt { color: var(--muted); }
.pay-details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .pay-details { grid-template-columns: 1fr; gap: 2px; } .pay-details dd { margin-bottom: 8px; } }
