:root {
  --bg: #f6f5f1; --surface: #ffffff; --surface-2: #efede7; --text: #1f2a26; --muted: #6a756f;
  --line: #e1ded5; --accent: #2f6f5e; --accent-text: #ffffff; --accent-soft: #e0eee9;
  --warn: #b45f06; --warn-soft: #fbeedd; --danger: #b3261e; --star: #d99a00;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181a; --surface: #1c2224; --surface-2: #252d2f; --text: #e6ebe8; --muted: #98a59f;
    --line: #2f393b; --accent: #4fae93; --accent-text: #0d1a16; --accent-soft: #1f3a33;
    --warn: #e0a050; --warn-soft: #3a2d1b; --danger: #f2877f; --star: #f0b429;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* rozloženie */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; padding: 4px 8px 12px; }
.brand img { width: 26px; height: 26px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text);
  text-decoration: none; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .count { margin-left: auto; font-size: .8rem; color: var(--muted); }
.nav h4 { margin: 14px 10px 4px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side .spacer { flex: 1; }
.side select { width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.main { min-width: 0; overflow-x: hidden; padding: 0 0 80px; }
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 14px 20px 10px; }
.capture { display: flex; gap: 8px; max-width: 760px; }
.capture input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--surface); font-size: 1.02rem; }
.capture input:focus { outline: none; border-color: var(--accent); }
.capture-hint { max-width: 760px; font-size: .78rem; color: var(--muted); margin: 5px 2px 0; }
.content { padding: 8px 20px 20px; max-width: 800px; }
.content h1 { font-size: 1.4rem; margin: 6px 0 4px; }
.content h2 { font-size: 1rem; margin: 22px 0 6px; color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; font-size: .78rem; }
.sub { color: var(--muted); margin: 0 0 12px; }

/* mobil: spodná navigácia */
.bottomnav { display: none; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 12px 8px; }
  .capture input[type="search"] { max-width: 90px !important; padding: 8px !important; }
  .content { padding: 4px 12px 20px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
  .bottomnav a { flex: 1; text-align: center; padding: 9px 2px 8px; font-size: .72rem; color: var(--muted);
    text-decoration: none; }
  .bottomnav a b { display: block; font-size: 1.2rem; font-weight: 400; }
  .bottomnav a.active { color: var(--accent); font-weight: 600; }
}

/* karty a riadky */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; gap: 6px; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.task.sub { margin-left: 28px; padding: 7px 10px; background: transparent; border-style: dashed; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.task .title { word-break: break-word; }
.check { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--muted); background: transparent;
  margin-top: 1px; padding: 0; display: grid; place-items: center; color: transparent; }
.check:hover { border-color: var(--accent); }
.check.done { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.check.doing { border-color: var(--accent); border-style: dashed; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.badge { padding: 0 7px; border-radius: 99px; background: var(--surface-2); }
.badge.late { background: var(--warn-soft); color: var(--warn); }
.badge.today { background: var(--accent-soft); color: var(--accent); }
.badge.high { background: var(--warn-soft); color: var(--warn); }
.star { border: 0; background: none; font-size: 1.15rem; color: var(--line); padding: 0 2px; }
.star:hover { color: var(--star); }
.star.on { color: var(--star); }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; border: 1px dashed var(--line);
  border-radius: var(--radius); }

/* tlačidlá a formuláre */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 8px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 9px; font-size: .85rem; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.field label { font-size: .78rem; color: var(--muted); }
.field input, .field select, .field textarea { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 130px; }
.inline-add { display: flex; gap: 6px; margin-top: 8px; }
.inline-add input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

/* projekty */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.project-card { display: block; padding: 12px 14px; text-decoration: none; color: var(--text); margin-bottom: 8px; }
.project-card:hover { border-color: var(--accent); }
.project-card .nx { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.project-card .nx b { color: var(--text); font-weight: 600; }
.next-step { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0 4px; }
.next-step small { color: var(--accent); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; font-size: .7rem; }
.people { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.avatar { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 2px 10px; font-size: .82rem; }
.activity { font-size: .85rem; color: var(--muted); list-style: none; padding: 0; margin: 0; }
.activity li { padding: 3px 0; border-bottom: 1px solid var(--line); }
.note { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  white-space: pre-wrap; word-break: break-word; }
.note .actions { margin-top: 6px; display: flex; gap: 8px; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; font-size: .9rem; }

/* dialóg */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, 96vw); max-height: 92vh; background: var(--surface);
  color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg { padding: 18px 20px; overflow-y: auto; max-height: 90vh; }
.dlg h3 { margin: 0 0 12px; }
.dlg .title-input { font-size: 1.15rem; font-weight: 600; width: 100%; border: 0; border-bottom: 2px solid var(--line);
  padding: 6px 0; background: transparent; margin-bottom: 12px; }
.dlg .title-input:focus { outline: none; border-color: var(--accent); }
.dlg-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.comment { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.comment small { color: var(--muted); }
.tip { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: .88rem; margin: 6px 0; }

/* prihlásenie */
.auth { max-width: 380px; margin: 8vh auto; padding: 24px; }
.auth h1 { margin-top: 0; text-align: center; }
.auth .logo { display: block; width: 56px; margin: 0 auto 8px; }
.auth .switch { text-align: center; margin-top: 12px; font-size: .9rem; }
.error { color: var(--danger); font-size: .9rem; margin: 6px 0; min-height: 1.2em; }

#toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 50; display: flex;
  flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast .t { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow);
  pointer-events: auto; display: flex; gap: 12px; align-items: center; max-width: 92vw; }
#toast .t button { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 0; filter: brightness(1.5); }
#toast .t.err { background: var(--danger); color: #fff; }

/* našepkávanie a náhľad rýchleho zápisu */
.capture-wrap { position: relative; flex: 1; display: flex; min-width: 0; }
.capture-wrap > input { width: 100%; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.suggest li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.suggest li small { color: var(--muted); }
.suggest li:hover, .suggest li.active { background: var(--accent-soft); }
.capture-hint { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; min-height: 1.5em; }
.chip { background: var(--surface-2); border-radius: 99px; padding: 1px 9px; font-size: .78rem; color: var(--text); }
.chip.main { background: var(--accent-soft); color: var(--accent); font-weight: 600; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.chip.bad { background: var(--warn-soft); color: var(--warn); }

/* detektor odkladania */
.stuck-box { background: var(--warn-soft); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0 4px; }
.stuck-box p { margin: 2px 0 8px; font-size: .88rem; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choice { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice small { color: var(--muted); }

/* režim „Len začnem“ */
.start-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--accent-soft);
  border-radius: var(--radius); padding: 12px 14px; margin: 8px 0 4px; }
.start-card small { color: var(--accent); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; font-size: .7rem; display: block; }
.start-title { font-weight: 600; margin: 2px 0; word-break: break-word; }
.focus-task { font-size: 1.1rem; font-weight: 600; margin: 4px 0; }
.primary-choice { border-color: var(--accent); background: var(--accent-soft); }
body.focus-on { overflow: hidden; }
.focus { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.focus-card { width: min(520px, 100%); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.focus-title { margin: 0; font-size: 1.5rem; word-break: break-word; }
.focus-dial { position: relative; width: 220px; height: 220px; margin: 8px 0; }
.focus-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 7; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.focus-time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-msg { color: var(--muted); min-height: 1.4em; }
.focus-subs { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.focus-subs label { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.focus-subs label.done { text-decoration: line-through; color: var(--muted); }
.focus-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }

/* zhodnotenie */
.tabs { display: flex; gap: 6px; margin: 6px 0 12px; }
.tabs a { padding: 6px 14px; border-radius: 99px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.win { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; margin: 6px 0; }
.plain { list-style: none; padding: 0; margin: 6px 0; color: var(--muted); font-size: .92rem; }
.plain li { padding: 2px 0; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.review-nudge { display: block; background: var(--accent-soft); color: var(--accent); border-radius: var(--radius);
  padding: 10px 14px; margin: 6px 0; font-weight: 600; text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--accent); }
.stat small { color: var(--muted); }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 90px; margin-bottom: 4px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { display: block; width: 100%; min-height: 3px; background: var(--accent); border-radius: 5px 5px 2px 2px; opacity: .85; }
.bar span { font-size: .72rem; color: var(--muted); }
.fresh { background: var(--accent-soft); border-radius: var(--radius); padding: 10px 14px; }
.fresh p { margin: 0 0 8px; }
.closing textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

/* upozornenia */
.notif { padding: 12px 14px; }
.checks { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.check-row { display: flex; align-items: center; gap: 6px; }
.mail-preview { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 8px; padding: 10px;
  font-family: inherit; font-size: .88rem; max-height: 50vh; overflow: auto; }

/* prehľad projektov */
.content.wide { max-width: 1100px; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat.warn b { color: var(--warn); }
.stat.good b { color: var(--accent); }
.dash-filters { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 12px 0; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: .88rem; }
.chip-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.dash-selects { display: flex; gap: 6px; }
.dash-selects select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; box-shadow: var(--shadow); }
.dash-card:hover { border-color: var(--accent); }
.dash-card.ok { border-left-color: var(--accent); }
.dash-card.attention { border-left-color: var(--warn); }
.dash-card.done { border-left-color: var(--muted); opacity: .85; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dash-title { font-weight: 700; color: var(--text); text-decoration: none; word-break: break-word; }
.pill { font-size: .72rem; border-radius: 99px; padding: 2px 9px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.attention { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.dash-progress { display: flex; flex-direction: column; gap: 3px; }
.dash-next { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.dash-next small { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .66rem; font-weight: 700; }
.dash-next > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dash-next-title { word-break: break-word; }
.muted-avatar { background: var(--surface-2); color: var(--muted); }
.dash-foot { font-size: .78rem; }
@media (max-width: 800px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }

/* plánovač dňa */
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; }
.plan-head { display: flex; justify-content: space-between; gap: 8px; }
.plan-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.plan-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.plan-card.warn .plan-bar i { background: var(--warn); }
.plan-card.over .plan-bar i { background: var(--danger); }
.plan-card.warn, .plan-card.over { border-color: var(--warn); background: var(--warn-soft); }
.plan-msg { font-size: .88rem; color: var(--muted); }
.plan-card.warn .plan-msg, .plan-card.over .plan-msg { color: var(--warn); }

/* šablóny projektov */
dialog.wide-dialog { width: min(860px, 96vw); }
.tpl-grid { display: grid; grid-template-columns: 250px 1fr; gap: 16px; min-height: 300px; }
.tpl-list h4 { margin: 10px 0 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tpl-item { display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 6px; cursor: pointer; background: var(--surface); }
.tpl-item:hover, .tpl-item.active { border-color: var(--accent); background: var(--accent-soft); }
.tpl-detail h4 { margin: 0 0 4px; font-size: 1.1rem; }
.tpl-tasks { list-style: none; margin: 8px 0 12px; padding: 0; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.tpl-tasks li { padding: 5px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.tpl-tasks li:last-child { border-bottom: 0; }
@media (max-width: 700px) { .tpl-grid { grid-template-columns: 1fr; } }

/* zoradenie, archív, prílohy, štítky, menu Viac */
.task-group { display: flex; flex-direction: column; gap: 6px; border-radius: var(--radius); }
.task-group[draggable="true"]:active { cursor: grabbing; }
.task-group.dragging { opacity: .4; }
.task-group.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.sort-arrows { display: flex; gap: 6px; justify-content: flex-end; }
.archive summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
.attachments { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.att { display: flex; gap: 6px; align-items: baseline; word-break: break-all; }
.badge.tag { text-decoration: none; color: var(--text); }
.badge.tag:hover { background: var(--accent-soft); color: var(--accent); }
.more-menu { position: fixed; right: 8px; bottom: 64px; z-index: 30; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; min-width: 180px; }
.more-menu a { padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.more-menu a:hover { background: var(--accent-soft); }
@media (min-width: 801px) { .more-menu { display: none; } }
