:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1d1f23;
  --muted: #6c6f76;
  --line: #e6e1d8;
  --accent: #b8432f;
  --accent-ink: #ffffff;
  --soft: #f8ebe6;
  --green: #1f6f5c;
  --green-soft: #edf5f2;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a; --card: #202227; --ink: #ecebe8; --muted: #9a9ca3; --line: #30333a;
    --accent: #ee7a62; --accent-ink: #1e0d09; --soft: #2d1f1b; --green: #4cc2a0; --green-soft: #1d2b27;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent); }

/* přihlášení */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 320px; text-align: center; display: grid; gap: 12px; }
.login .logo { font-size: 48px; }
.login h1 { margin: 0 0 8px; }
.login input { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.err { color: var(--accent); min-height: 1em; margin: 0; }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; cursor: pointer; background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn:disabled { opacity: .6; cursor: default; }

/* rozložení: mobil = seznam, nebo detail; desktop = vedle sebe */
#app { min-height: 100vh; }
.list-pane { padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 40px); max-width: 760px; margin: 0 auto; }
.detail-pane { display: none; }
body.show-detail .list-pane { display: none; }
body.show-detail .detail-pane { display: block; }
@media (min-width: 1000px) {
  #app { display: grid; grid-template-columns: 420px 1fr; height: 100vh; }
  .list-pane { overflow-y: auto; max-width: none; margin: 0; border-right: 1px solid var(--line); }
  .detail-pane, body.show-detail .detail-pane { display: block; overflow-y: auto; }
  body.show-detail .list-pane { display: block; }
  .detail-back { display: none !important; }
}
.empty-detail { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-detail .big { font-size: 56px; opacity: .5; }

/* hlavička seznamu */
.title-row { display: flex; align-items: center; justify-content: space-between; }
.top h1 { font-size: 26px; margin: 4px 0 10px; letter-spacing: -.02em; }
.back-link { font-size: 14px; text-decoration: none; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.search input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); outline: none; }
.search input:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip i { font-style: normal; opacity: .6; margin-left: 4px; }

/* seznam */
.day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; }
.card { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid transparent; border-radius: 14px; padding: 10px 14px; margin-bottom: 6px; box-shadow: var(--shadow); cursor: pointer; }
.card:hover { border-color: var(--line); }
.card.sel { border-color: var(--accent); }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.card h3 { font-size: 16px; margin: 0; line-height: 1.3; }
.gist { margin: 4px 0 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flag { margin-left: auto; }
.card ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.card ul li { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-weight: 600; }
.badge.hot { background: var(--soft); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* detail */
.detail { max-width: 820px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 60px); }
.detail-back { background: none; border: 0; color: var(--accent); padding: 8px 0; cursor: pointer; font-size: 16px; }
.detail h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 8px; letter-spacing: -.02em; }
.detail .card-meta { font-size: 13px; margin-bottom: 16px; }
.box { background: var(--card); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.box h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.box ul { margin: 0; padding-left: 20px; }
.box li { margin: 5px 0; }
.box.summary li::marker { color: var(--accent); }
.steps { list-style: none; padding: 0 !important; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps li::before { content: "→"; color: var(--green); font-weight: 700; }
.promise b { color: var(--accent); }

.write { border: 1.5px dashed var(--line); background: transparent; box-shadow: none; }
.write p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.write-row { display: flex; gap: 8px; flex-wrap: wrap; }
.write-row input { flex: 1 1 220px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.writing { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

.md h2 { font-size: 18px; text-transform: none; letter-spacing: -.01em; color: var(--ink); margin: 20px 0 8px; }
.md h2:first-child { margin-top: 0; }
.md h3 { font-size: 16px; margin: 14px 0 6px; }
.md p { margin: 6px 0; }
.md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.box-head h2 { margin: 0; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 14px; padding: 4px; }

details.box > summary { cursor: pointer; list-style: none; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::after { content: " ▸"; }
details.box[open] > summary::after { content: " ▾"; }
.transcript { white-space: pre-wrap; font-size: 14px; line-height: 1.55; margin-top: 12px; max-height: 70vh; overflow-y: auto; }
mark { background: #ffe08a; color: #1d1f23; border-radius: 3px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 10; }

/* 🔄 kontrola nových nahrávek */
.sync-btn { width: 100%; margin-bottom: 10px; padding: 12px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.sync-btn:disabled { opacity: .7; cursor: default; }
.sync-box { background: var(--card); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; box-shadow: var(--shadow); }
.sync-box .row { display: flex; gap: 8px; align-items: center; }
.sync-box .pend { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.sync-box.err { color: var(--accent); }
.copy-btn { width: 100%; margin-bottom: 14px; }
.copy-btn.done { background: var(--green); color: #fff; border-color: transparent; }
