/* ---------- Barvy a motivy ---------- */
:root {
  --bg: #FFFFFF; --bg-2: #F7F7F5; --bg-3: #EFEFEB; --bg-hover: #ECECE8;
  --line: #ECECE9; --line-2: #E0E0DC;
  --text: #1F1F1E; --text-2: #55554F; --text-3: #6B6B66; --text-4: #8A8A84;
  --accent: #1F1F1E; --accent-text: #FFFFFF;
  --danger: #B42318; --ok: #1F7A45;
  --shadow: 0 8px 30px rgba(20, 20, 18, 0.12), 0 1px 3px rgba(20, 20, 18, 0.08);
  --radius: 12px;
  --sidebar-w: 272px;
  --tabbar-h: 0px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #191918; --bg-2: #1F1F1E; --bg-3: #2A2A28; --bg-hover: #2E2E2B;
  --line: #2C2C2A; --line-2: #3A3A37;
  --text: #ECECE8; --text-2: #C4C4BE; --text-3: #A3A39C; --text-4: #85857E;
  --accent: #ECECE8; --accent-text: #191918;
  --danger: #F97066; --ok: #5CC58C;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
/* barva typu: --tc-l / --tc-d nastavuje JS */
.tc { --tc: var(--tc-l, #55554F); }
[data-theme="dark"] .tc { --tc: var(--tc-d, #B5B5AE); }
.tc { --tc-soft: color-mix(in srgb, var(--tc) 14%, var(--bg)); --tc-text: color-mix(in srgb, var(--tc) 88%, var(--text)); }

/* ---------- Základ ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
input, textarea, select { background: transparent; }
::selection { background: color-mix(in srgb, #2F5FC4 25%, transparent); }
.ic { flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid color-mix(in srgb, #2F5FC4 70%, var(--text)); outline-offset: 2px; border-radius: 6px; }

/* ---------- Rozvržení ---------- */
#app { display: flex; height: 100dvh; overflow: hidden; }
#sidebar {
  width: var(--sidebar-w); flex: none; background: var(--bg-2); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 16px;
  padding-top: max(14px, env(safe-area-inset-top));
}
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
#topbar {
  display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 6px 16px; border-bottom: 1px solid var(--line);
  padding-top: max(6px, env(safe-area-inset-top));
}
#topbar .crumbs { flex: 1; min-width: 0; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar .crumbs b { color: var(--text); font-weight: 500; }
#view { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--tabbar-h) + 40px); }
#scrim { display: none; }
#tabbar { display: none; }

.page { max-width: 780px; margin: 0 auto; padding: 32px 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.page.wide { max-width: 1240px; }

/* ---------- Postranní panel ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 600; font-size: 15px; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.searchbtn { display: flex; align-items: center; gap: 8px; width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; color: var(--text-3); font-size: 14px; text-align: left; }
.searchbtn kbd { margin-left: auto; font: inherit; font-size: 12px; color: var(--text-4); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-h { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; text-transform: uppercase; }
.nav-h button { border: 0; background: none; font-size: 12px; color: var(--text-2); padding: 6px 8px; border-radius: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.nav-h button:hover { background: var(--bg-hover); }
.navlink { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--text); min-height: 36px; }
.navlink:hover { background: var(--bg-hover); }
.navlink.active { background: var(--bg-hover); font-weight: 600; }
.navlink .count { margin-left: auto; font-size: 12px; color: var(--text-4); font-weight: 400; }
.navlink .ic { color: var(--text-3); }
.trow { display: flex; align-items: center; border-radius: 8px; }
.trow:hover { background: var(--bg-hover); }
.trow.active { background: var(--bg-hover); }
.trow.active .navlink { font-weight: 600; }
.trow .navlink { flex: 1; padding-left: 2px; background: none; }
.chev { width: 28px; height: 34px; border: 0; background: none; color: var(--text-4); display: grid; place-items: center; flex: none; border-radius: 6px; }
.chev .ic { transition: transform .15s; }
.chev.open .ic { transform: rotate(90deg); }
.tbadge { width: 22px; height: 22px; border-radius: 6px; background: var(--tc-soft); color: var(--tc); display: grid; place-items: center; flex: none; }
.tbadge.sm { width: 18px; height: 18px; border-radius: 5px; }
.subtree { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 6px 24px; padding-left: 10px; border-left: 1px solid var(--line-2); }
.subtree a, .subtree button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtree a:hover, .subtree button:hover { background: var(--bg-hover); color: var(--text); }
.subtree a.active { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.subtree .muted { color: var(--text-4); }
.sidefoot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; }
.syncdot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); flex: none; }
.syncdot.idle { background: var(--ok); }
.syncdot.syncing { background: #D9A400; }
.syncdot.error, .syncdot.loggedout { background: var(--danger); }

/* ---------- Tlačítka a vstupy ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--bg-2); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.tint { background: var(--tc); color: var(--bg); border-color: var(--tc); font-weight: 600; }
.iconbtn { width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); flex: none; }
.iconbtn:hover { background: var(--bg-hover); color: var(--text); }
.iconbtn.on { color: #D9A400; }
.iconbtn.sm { width: 32px; height: 32px; border-radius: 8px; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; background: var(--bg); font-size: 15px; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: color-mix(in srgb, var(--text) 40%, var(--line-2)); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; font-family: inherit; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.seg { display: inline-flex; background: var(--bg-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); font-size: 13px; color: var(--text-2); }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip .x { border: 0; background: none; padding: 0; color: inherit; opacity: .6; font-size: 14px; line-height: 1; }
.typechip { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: var(--tc-soft); color: var(--tc-text); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.tag { display: inline-flex; align-items: center; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--bg-3); color: var(--text-2); }
.objlink { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; padding: 1px 8px; border-radius: 6px; background: var(--tc-soft); color: var(--tc-text); font-weight: 500; font-size: .92em; border: 0; }
.cb { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); background: var(--bg); flex: none; display: grid; place-items: center; padding: 0; color: transparent; position: relative; }
.cb::after { content: ''; width: 10px; height: 6px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg) translate(1px, -1px); }
.cb.on { background: var(--tc, var(--accent)); border-color: var(--tc, var(--accent)); color: var(--bg); }
.cb.round { border-radius: 50%; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-2); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.section-h { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }
h1.title { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
input.title { border: 0; outline: 0; width: 100%; padding: 0; font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
input.title::placeholder { color: var(--text-4); }
h2.h2 { margin: 0; font-size: 20px; font-weight: 600; }

/* ---------- Vlastnosti ---------- */
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.prop { background: var(--bg-2); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prop label, .prop .k { font-size: 12px; color: var(--text-3); }
.prop input, .prop select { border: 0; outline: 0; padding: 0; font-size: 15px; font-weight: 600; width: 100%; min-width: 0; }
.prop input::placeholder { color: var(--text-4); font-weight: 400; }
.prop input[type="checkbox"] { width: 20px; height: 20px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); display: grid; place-items: center; padding: 0; }
.stepper .v { min-width: 30px; text-align: center; font-weight: 600; font-size: 16px; }
.tagedit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tagedit input { border: 0; outline: 0; min-width: 120px; flex: 1; font-size: 14px; padding: 4px 0; }

/* ---------- Markdown ---------- */
.md { font-size: 16px; line-height: 1.65; min-height: 48px; cursor: text; border-radius: 8px; word-wrap: break-word; }
.md:empty::before { content: attr(data-ph); color: var(--text-4); }
.md p { margin: 0 0 8px; }
.md h2 { font-size: 22px; margin: 16px 0 8px; }
.md h3 { font-size: 18px; margin: 14px 0 6px; }
.md h4 { font-size: 16px; margin: 12px 0 4px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md ul.checklist { list-style: none; padding-left: 0; }
.md li.check { display: flex; gap: 10px; align-items: flex-start; padding: 2px 0; }
.md li.check .cb { width: 20px; height: 20px; margin-top: 3px; border-radius: 6px; --tc: #2F5FC4; }
[data-theme="dark"] .md li.check .cb { --tc: #7FA3F5; }
.md li.check.done span { color: var(--text-4); text-decoration: line-through; }
.md blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.md code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; background: var(--bg-3); padding: 1px 5px; border-radius: 5px; }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0; }
.md a { color: color-mix(in srgb, #2F5FC4 85%, var(--text)); text-decoration: underline; text-underline-offset: 2px; }
.md a.wiki { text-decoration: none; background: var(--bg-3); color: var(--text); padding: 0 6px; border-radius: 6px; font-weight: 500; }
.md a.wiki.missing { color: var(--text-3); border: 1px dashed var(--line-2); background: none; }
.mdedit { position: relative; }
.mdedit textarea { width: 100%; border: 0; outline: 0; resize: none; font-size: 16px; line-height: 1.65; padding: 0; min-height: 120px; font-family: inherit; }
.mdtools { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.suggest { position: absolute; z-index: 30; left: 0; right: 0; max-width: 360px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.suggest button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.suggest button.sel, .suggest button:hover { background: var(--bg-hover); }

/* ---------- Kolekce ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.ocard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); min-height: 120px; }
.ocard:hover { border-color: var(--line-2); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.ocard .img { height: 140px; background: var(--tc-soft); background-size: cover; background-position: center; display: grid; place-items: center; color: var(--tc); }
.ocard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.ocard .t { font-weight: 600; font-size: 15px; }
.ocard .s { font-size: 13px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.olist { display: flex; flex-direction: column; }
.olist a { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.olist a:hover { background: var(--bg-2); }
.olist .t { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.otable { border-collapse: collapse; width: 100%; font-size: 14px; }
.otable th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg-2); }
.otable td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.otable tr:last-child td { border-bottom: 0; }
.otable tr:hover td { background: var(--bg-2); cursor: pointer; }

/* ---------- Recept ---------- */
.hero { height: 220px; border-radius: 16px; background: var(--tc-soft); background-size: cover; background-position: center; display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px; gap: 6px; }
.hero.empty-img { height: 120px; align-items: center; justify-content: center; }
.ings { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ings li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.ings li:last-child { border-bottom: 0; }
.ings li.sec { background: var(--bg-2); font-weight: 600; font-size: 13px; color: var(--text-2); padding: 8px 14px; }
.ings .q { width: 96px; flex: none; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ings li.got .n, .ings li.got .q { color: var(--text-4); text-decoration: line-through; }
.ings .note { color: var(--text-4); font-size: 13px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 14px; font-size: 16px; line-height: 1.6; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--tc-soft); color: var(--tc-text); font-weight: 700; font-size: 13px; display: grid; place-items: center; margin-top: 1px; }
.steps li.done { color: var(--text-4); }
.timerchip { border: 0; padding: 1px 8px; border-radius: 6px; background: var(--tc-soft); color: var(--tc-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; font-size: .92em; }
.cooking .steps li { font-size: 20px; }
.cooking .ings li { font-size: 18px; }

/* ---------- Nákupní seznam ---------- */
.quickadd { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 6px 0 14px; min-height: 50px; background: var(--bg); }
.quickadd input { flex: 1; min-width: 0; border: 0; outline: 0; font-size: 16px; padding: 10px 0; }
.quickadd .hint { font-size: 12px; color: var(--text-4); }
.items { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .n { font-size: 16px; border: 0; background: none; text-align: left; padding: 0; }
.item .from { font-size: 12px; color: color-mix(in srgb, #B3560E 85%, var(--text)); }
[data-theme="dark"] .item .from { color: #F2A464; }
.item .q { font-size: 14px; color: var(--text-3); border: 0; background: none; padding: 4px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.item .q:hover { background: var(--bg-hover); }
.item.done .n { color: var(--text-4); text-decoration: line-through; }
.item .catsel { border: 0; font-size: 12px; color: var(--text-4); max-width: 150px; padding: 2px; border-radius: 6px; }
.item .catsel:hover { background: var(--bg-hover); }
.item .del { opacity: .5; }
.item:hover .del { opacity: 1; }
.group-h { margin: 18px 0 2px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }
.progress { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.progress .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.progress .bar div { height: 100%; background: var(--tc); border-radius: 3px; transition: width .2s; }

/* ---------- Kalendář / úkoly ---------- */
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.day { border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-height: 200px; background: var(--bg); }
.day.today { border-color: color-mix(in srgb, var(--tc) 45%, var(--line)); background: color-mix(in srgb, var(--tc) 5%, var(--bg)); }
.day.over { outline: 2px dashed var(--tc); outline-offset: -2px; }
.day h3 { margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 14px; padding: 2px 4px; }
.day h3 a:hover { text-decoration: underline; }
.day h3 span { font-size: 12px; font-weight: 500; color: var(--text-3); }
.day .add { margin-top: auto; border: 0; background: none; text-align: left; color: var(--text-4); font-size: 13px; padding: 6px 4px; border-radius: 8px; }
.day .add:hover { background: var(--bg-hover); color: var(--text-2); }
.task { display: flex; align-items: flex-start; gap: 8px; padding: 6px 4px; border-radius: 8px; min-height: 36px; }
.task:hover { background: var(--bg-2); }
.task .cb { width: 20px; height: 20px; border-radius: 6px; margin-top: 1px; }
.task .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.task .tx a, .task .tx .tt { font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.task .time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.task.done .tt, .task.done .tx > a { color: var(--text-4); text-decoration: line-through; }
.task.overdue .time, .task .late { color: var(--danger); }
.task .mv { opacity: 0; }
.task:hover .mv, .task:focus-within .mv { opacity: 1; }
.task[draggable="true"] { cursor: grab; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.month .wd { padding: 8px; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--bg-2); border-bottom: 1px solid var(--line); }
.month .cell { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 0; }
.month .cell:nth-child(7n) { border-right: 0; }
.month .cell.other { background: var(--bg-2); color: var(--text-4); }
.month .cell .dn { font-weight: 600; font-size: 13px; border: 0; background: none; padding: 2px 6px; border-radius: 6px; align-self: flex-start; }
.month .cell.today .dn { background: var(--tc); color: var(--bg); }
.month .cell .mt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 4px; border-radius: 4px; background: var(--tc-soft); color: var(--tc-text); }
.month .cell .mt.done { opacity: .5; text-decoration: line-through; }
.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekstrip a { min-height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 11px; color: var(--text-3); position: relative; }
.weekstrip a b { font-size: 15px; color: var(--text); font-weight: 500; }
.weekstrip a:hover { background: var(--bg-hover); }
.weekstrip a.on { background: var(--accent); color: color-mix(in srgb, var(--accent-text) 75%, var(--accent)); }
.weekstrip a.on b { color: var(--accent-text); font-weight: 600; }
.weekstrip a.has::after { content: ''; position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 2px; background: currentColor; opacity: .6; }
.backlinks { display: flex; flex-wrap: wrap; gap: 8px; }
.backlinks a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.backlinks a:hover { background: var(--bg-2); }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--tc); flex: none; }

/* ---------- Překryvy ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 10, 9, .35); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
[data-theme="dark"] .overlay { background: rgba(0, 0, 0, .55); }
.modal { width: 100%; max-width: 560px; max-height: 80vh; overflow: auto; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; }
.modal header { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.modal header h2 { margin: 0; font-size: 17px; flex: 1; }
.modal .mbody { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.search .sinput { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search .sinput input { flex: 1; border: 0; outline: 0; font-size: 17px; min-width: 0; }
.sresults { padding: 6px; display: flex; flex-direction: column; }
.sresults a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.sresults a.sel, .sresults a:hover { background: var(--bg-hover); }
.sresults .t { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sresults .s { font-size: 12px; color: var(--text-3); }
.menu { position: fixed; z-index: 120; background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; min-width: 200px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--bg-hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translate(-50%, 20px); background: var(--accent); color: var(--accent-text); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 200; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#timers { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px); z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.timer { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line-2); box-shadow: var(--shadow); border-radius: 12px; padding: 8px 8px 8px 14px; font-size: 14px; }
.timer b { font-variant-numeric: tabular-nums; font-size: 18px; }
.timer.ring { border-color: var(--danger); animation: ring 1s infinite; }
@keyframes ring { 50% { transform: scale(1.03); } }

/* ---------- Mobil ---------- */
@media (max-width: 860px) {
  :root { --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  #sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 80; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); padding-bottom: calc(var(--tabbar-h) + 16px); }
  #app.drawer #sidebar { transform: none; }
  #app.drawer #scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.3); }
  #topbar { padding-left: 8px; padding-right: 8px; }
  .page { padding: 20px 16px 16px; gap: 18px; }
  h1.title, input.title { font-size: 28px; }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: var(--tabbar-h);
    padding: 6px 8px env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); justify-content: space-around; align-items: center;
  }
  #tabbar a, #tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 60px; min-height: 48px; border: 0; background: none; font-size: 11px; color: var(--text-3); }
  #tabbar .on { color: var(--text); font-weight: 600; }
  #tabbar .fab { min-width: 52px; width: 52px; height: 52px; border-radius: 26px; background: var(--accent); color: var(--accent-text); }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .month .cell { min-height: 64px; padding: 3px; }
  .month .cell .mt { font-size: 10px; padding: 0 2px; }
  .hero { height: 180px; }
  .ings .q { width: 82px; }
  .hide-m { display: none !important; }
  .modal { max-height: 86vh; }
  .overlay { padding-top: max(6vh, env(safe-area-inset-top)); }
  .task .mv { opacity: 1; }
}
@media (min-width: 861px) { .hide-d { display: none !important; } }
@media print { #sidebar, #topbar, #tabbar, #timers { display: none !important; } #view { overflow: visible; } }
