:root {
  --bg: #f5f6f8; --card: #fff; --fg: #111827; --muted: #4b5563; --line: #cbd2da;
  --primary: #1d4ed8; --ok: #166534; --ok-bg: #dcfce7; --bad: #991b1b; --bad-bg: #fee2e2;
  --pro: #166534; --proti: #991b1b; --zdrzel: #374151;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --card: #1c2027; --fg: #f3f4f6; --muted: #aab2bd; --line: #3a414c;
    --primary: #6ea0ff; --ok: #86efac; --ok-bg: #14351f; --bad: #fca5a5; --bad-bg: #3f1818;
    --pro: #86efac; --proti: #fca5a5; --zdrzel: #d1d5db;
  }
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 18px; }
body { margin: 0; background: var(--bg); color: var(--fg); touch-action: manipulation; }
button, input, textarea, label.btn { font: inherit; touch-action: manipulation; }
a { color: var(--primary); }
.content { padding: 0.75rem; max-width: 60rem; margin: 0 auto; padding-bottom: 5rem; }
.screen > * + * { margin-top: 0.75rem; }
h1, h2 { margin: 0.25rem 0; font-size: 1.25rem; }
p { margin: 0.25rem 0; }
.meta, .hint, .lbl { color: var(--muted); font-size: 0.85rem; }
.hint { font-size: 0.9rem; }

.banner { padding: 0.6rem 0.75rem; font-weight: 600; }
.banner.info { background: #fef3c7; color: #78350f; }
.banner.error { background: #b91c1c; color: #fff; position: sticky; top: 0; z-index: 30; }

.top { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; padding: 0.5rem 0.75rem; min-height: 48px; text-decoration: none; color: inherit; }
.sum-item { display: flex; flex-direction: column; }
.badge { padding: 0.4rem 0.7rem; border-radius: 999px; font-weight: 700; min-height: 48px; display: inline-flex; align-items: center; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border: 2px solid var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad); }
.tabs { display: flex; }
.tabs a { flex: 1; text-align: center; padding: 0.8rem 0.5rem; min-height: 48px; text-decoration: none; font-weight: 600; color: var(--fg); border-top: 1px solid var(--line); }
.tabs a.active { border-bottom: 4px solid var(--primary); color: var(--primary); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem; }
.card > * + * { margin-top: 0.5rem; }
.list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.search, .title-input, .paste { width: 100%; min-height: 48px; padding: 0.5rem 0.75rem; border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); }
.search-box { position: relative; }
.search-box .search { display: block; padding-right: 3rem; }
.search::-webkit-search-cancel-button { display: none; }
.search::-ms-clear { display: none; }
.search-clear { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.search-clear:not([hidden]) { display: flex; align-items: center; justify-content: center; }
.search-clear svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.btn, button.btn { min-height: 48px; min-width: 48px; padding: 0.5rem 1rem; border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.big { width: 100%; font-size: 1.1rem; }
.btn:disabled, .segbtn:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.back { display: inline-block; min-height: 48px; line-height: 48px; }
.check { display: flex; align-items: center; min-height: 48px; }
.check input { width: 24px; height: 24px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; min-height: 56px; }
.row .name { font-weight: 700; }
button.row { width: 100%; text-align: left; color: var(--fg); cursor: pointer; }
.row.toggle.on { border-color: var(--ok); background: var(--ok-bg); }
.row .state { font-weight: 700; }

.seg { display: flex; gap: 0.35rem; }
.bulk-votes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; padding-right: calc(0.75rem + 2px); }
.segbtn { min-height: 48px; min-width: 6rem; padding: 0 0.75rem; border: 2px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); font-weight: 600; cursor: pointer; }
.segbtn.on { color: #fff; border-color: transparent; }
.segbtn.pro.on { background: #15803d; }
.segbtn.proti.on { background: #b91c1c; }
.segbtn.zdrzel.on { background: #4b5563; }

.results { background: var(--card); border: 2px solid var(--primary); border-radius: 10px; padding: 0.5rem 0.75rem; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.5rem; }
.result { font-size: 0.85rem; }
.result strong { font-size: 1.05rem; }
.result.pro strong { color: var(--pro); }
.result.proti strong { color: var(--proti); }
.result.zdrzel strong { color: var(--zdrzel); }

.voting-item { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.voting-item .grow { flex: 1 1 14rem; }
.warn { background: #fef3c7; color: #78350f; padding: 0.5rem; border-radius: 6px; font-weight: 600; }
.errors { background: var(--bad-bg); color: var(--bad); padding: 0.5rem 0.75rem; border-radius: 6px; white-space: pre-wrap; }
.ok-text { color: var(--ok); font-weight: 600; }
