:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1d1f1c;
  --muted: #74786f;
  --line: #e4e2db;
  --accent: #2f7d4f;
  --accent-soft: #e2f0e6;
  --danger: #b3261e;
  --rec: #d93025;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151715;
    --card: #1f221f;
    --text: #ecede9;
    --muted: #979c93;
    --line: #2f332e;
    --accent: #5fbf85;
    --accent-soft: #23362a;
    --danger: #f2877f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
}
.top h1 { font-size: 26px; margin: 0; }
.count { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { background: none; border: 0; font-size: 22px; padding: 8px; border-radius: 10px; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 8px; gap: 12px;
}
.switch { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

.text-btn {
  background: none; border: 0; padding: 10px 12px; border-radius: 10px;
  color: var(--accent); font-weight: 600;
}
.primary-btn, .danger-btn {
  border: 0; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  background: var(--accent); color: #fff;
}
.danger-btn { background: none; color: var(--danger); border: 1px solid currentColor; }

.list { padding: 0 12px; max-width: 640px; margin: 0 auto; }
.cat { margin: 14px 0; }
.cat h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 6px 6px; font-weight: 700;
}
.cat ul {
  list-style: none; margin: 0; padding: 0;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden;
}
.item {
  display: flex; align-items: center; min-height: 52px;
  border-top: 1px solid var(--line);
}
.item:first-child { border-top: 0; }
.item .tap {
  flex: 1; display: flex; align-items: center; gap: 14px;
  background: none; border: 0; text-align: left; padding: 12px 6px 12px 14px;
  min-height: 52px;
}
.check {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--muted); display: grid; place-items: center;
  font-size: 14px; color: #fff; transition: background 0.15s, border-color 0.15s;
}
.item.bought .check { background: var(--accent); border-color: var(--accent); }
.item.bought .name { text-decoration: line-through; font-style: italic; color: var(--muted); }
.item.bought { background: color-mix(in srgb, var(--card) 85%, var(--bg)); }
.item .more {
  background: none; border: 0; color: var(--muted); padding: 12px 14px; font-size: 20px;
}
.item.flash { animation: flash 0.8s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } }

.hidden-note { text-align: center; color: var(--muted); font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 48px; display: block; margin-bottom: 8px; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center; gap: 28px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.round-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: var(--card); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 22px; display: grid; place-items: center;
}
.round-btn.placeholder { visibility: hidden; }
.round-btn.mic {
  width: 76px; height: 76px; font-size: 34px;
  background: var(--accent); box-shadow: 0 4px 14px rgba(47, 125, 79, 0.45);
}
.round-btn.mic.recording {
  background: var(--rec);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.55); }
  100% { box-shadow: 0 0 0 18px rgba(217, 48, 37, 0); }
}
.small-mic { width: 56px; height: 56px; font-size: 26px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 7;
  display: flex; align-items: center; gap: 8px;
  background: #2b2d2a; color: #fff; padding: 6px 6px 6px 16px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); max-width: calc(100% - 32px);
}
.toast .text-btn { color: #8fe0ad; }

dialog.sheet {
  border: 0; padding: 0; width: min(560px, 100%); max-width: 100%;
  margin: auto auto 0; border-radius: 20px 20px 0 0;
  background: var(--card); color: var(--text);
  max-height: 92vh;
}
@media (min-width: 600px) { dialog.sheet { margin: auto; border-radius: 20px; } }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog.sheet form { padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
dialog h2 { margin: 0 0 6px; font-size: 21px; }
dialog h3 { margin: 22px 0 4px; font-size: 17px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
textarea, input[type="text"], select {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea { resize: vertical; }
.interim { color: var(--muted); font-style: italic; min-height: 1.4em; margin: 6px 2px; }
.preview { list-style: none; padding: 0; margin: 0 0 8px; font-size: 14px; }
.preview li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 2px; }
.preview .pc { color: var(--muted); }
.preview .pc.unknown { color: var(--danger); }
.row { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px;
  padding: 8px 14px; font-size: 15px;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cat-edit {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px;
}
.cat-edit .head { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.cat-edit .head input { flex: 1; font-weight: 600; }
.cat-edit .head button {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  width: 38px; height: 38px; flex: none;
}
.cat-edit textarea { font-size: 14px; }
dialog.tall form { overflow-y: auto; max-height: 92vh; }

/* Návrhy */
.sug-head {
  position: sticky; top: -20px; z-index: 1; background: var(--card);
  margin: -20px -16px 0; padding: 20px 16px 4px;
}
.sug-head h2 { margin: 0; }
.sug h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 18px 0 8px;
}
.sug-new { margin-top: 12px; }
input[type="search"] {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 12px;
}
