:root {
  --bg: #f6f7f8; --surface: #ffffff; --surface2: #eef1f2; --text: #1b2226; --muted: #66727a; --line: #dde3e6;
  --accent: #0f8f82; --accent-ink: #ffffff; --accent-soft: #dff3f0; --danger: #c0392b; --star: #d99a00;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06); --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111518; --surface: #1a2024; --surface2: #232b30; --text: #e6ebee; --muted: #93a0a8; --line: #2c353b;
    --accent: #2fc0b0; --accent-ink: #062320; --accent-soft: #163a36; --danger: #ff7b6b; --star: #ffc233; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.4em; margin: 8px 0 0; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.icon-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: transparent; font-size: 22px; cursor: pointer; }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); }

/* Přihlášení */
.screen { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; text-align: center; }
.login-card img { margin: 0 auto; border-radius: 18px; }
.login-card h1 { margin: 6px 0 0; font-size: 26px; }
.login-card p { margin: 0 0 10px; }
.login-card label { text-align: left; font-size: 14px; color: var(--muted); }
.login-card input { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); }
.login-card .btn { margin-top: 8px; padding: 12px; }

/* Horní lišta */
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--bg); }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.viewbar { display: flex; align-items: baseline; gap: 8px; padding: 4px 16px 8px; }
.viewbar h2 { margin: 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewbar select { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 14px; max-width: 45%; }

/* Seznam */
#list { padding: 0 12px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; max-width: 760px; margin: 0 auto; }
.card { display: flex; gap: 12px; padding: 12px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); cursor: pointer; border: 1px solid transparent; }
.card:active { border-color: var(--accent); }
.card .thumb { width: 64px; height: 64px; flex: none; border-radius: 10px; background: var(--surface2) center/cover no-repeat; display: grid; place-items: center; overflow: hidden; }
.card .thumb img.fav { width: 24px; height: 24px; }
.card .body { min-width: 0; flex: 1; }
.card .title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .desc { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.card .desc mark, .snip mark { background: var(--accent-soft); color: inherit; border-radius: 3px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.chip { background: var(--surface2); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--muted); }
.star { color: var(--star); }
.dot-later { color: var(--accent); font-weight: 600; }
.more { display: block; margin: 0 auto 32px; }
.empty { text-align: center; color: var(--muted); padding: 40px 24px; }

/* Šuplík s pohledy */
.drawer { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35); }
.drawer-panel { position: absolute; inset: 0 auto 0 0; width: min(320px, 86vw); background: var(--surface); overflow-y: auto; padding: calc(12px + env(safe-area-inset-top)) 8px 16px; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px 12px; }
.drawer-head img { border-radius: 8px; }
.drawer-head .muted { margin-left: auto; font-size: 12px; }
#views { flex: 1; }
.vgroup { margin: 12px 10px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.vitem { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: transparent; border-radius: 10px; text-align: left; cursor: pointer; }
.vitem .ic { width: 22px; text-align: center; flex: none; }
.vitem .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vitem .n { color: var(--muted); font-size: 13px; }
.vitem.on { background: var(--accent-soft); font-weight: 600; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); }

/* Spodní list (detail, přidání) */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel { width: 100%; max-width: 760px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-panel.reader { max-height: 100dvh; height: 100dvh; border-radius: 0; }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; overflow-wrap: anywhere; }
.sheet .src { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.sheet .cover { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; margin: 10px 0 4px; background: var(--surface2); }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.act { text-decoration: none; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; cursor: pointer; }
.act .ic { font-size: 20px; line-height: 1; }
.act.on { background: var(--accent-soft); border-color: transparent; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { flex: 1; }
.summary { background: var(--surface2); border-radius: 12px; padding: 10px 12px; font-size: 15px; margin: 8px 0; }
.hl { border-left: 3px solid var(--accent); padding: 4px 10px; margin: 8px 0; font-size: 15px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Čtečka */
.reader-bar { position: sticky; top: calc(-16px); display: flex; align-items: center; gap: 8px; background: var(--surface); padding: 4px 0 8px; margin-top: -4px; }
.reader-bar .t { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-text { max-width: 680px; margin: 0 auto; font-size: 18px; line-height: 1.65; overflow-wrap: anywhere; }
.reader-text p { margin: 0 0 1em; }
.reader-text h1 { font-size: 24px; line-height: 1.3; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: calc(100vw - 32px); font-size: 15px; }
.spin { text-align: center; color: var(--muted); padding: 24px; }
@media (min-width: 900px) { .card .thumb { width: 88px; height: 66px; } }
