:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #2f5597; --ok: #1f8a4c; --warn: #b7791f; --bad: #c0392b; --soft: #eef3fb;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2128; --text: #e6e8ec; --muted: #9aa3b2; --line: #2d333d;
          --accent: #7aa2e3; --ok: #4cc27f; --warn: #e0a84b; --bad: #ef6b5f; --soft: #232b38; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
h1 { font-size: 18px; margin: 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { background: none; border: 0; padding: 8px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; }
nav button.active { background: var(--soft); color: var(--accent); font-weight: 600; }
main { padding: 20px; max-width: 1300px; margin: 0 auto; }
.tab { display: none; } .tab.active { display: block; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
select, input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.muted { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card.click { cursor: pointer; } .card.click:hover { border-color: var(--accent); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0 6px; }
.bar > div { height: 100%; background: var(--ok); }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--soft); }
tr.done td { color: var(--muted); } tr.done .nazev { text-decoration: line-through; }
tr.current { outline: 2px solid var(--accent); outline-offset: -2px; }
td input[type=text] { width: 100%; } td input.num { width: 60px; }
h2 { font-size: 16px; margin: 22px 0 8px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--soft); white-space: nowrap; }
.badge.hotovo, .badge.připraveno { color: var(--ok); }
.badge.nezačato { color: var(--bad); }
.badge.rozpracováno, .badge.předělat, .badge.vylepšit, .badge.orientační { color: var(--warn); }
.iconbtn { background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; padding: 2px 7px; color: var(--text); }
.iconbtn:hover { border-color: var(--accent); }
.journal { display: flex; gap: 8px; margin-top: 8px; } .journal input[type=text] { flex: 1; }
.journal-list { margin: 8px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.note { background: var(--soft); border-left: 3px solid var(--accent); padding: 6px 10px; margin: 4px 0; border-radius: 4px; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 30px; text-align: center; color: var(--muted); }
#toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 420px; }
#toast.show { opacity: .95; } #toast.err { background: var(--bad); color: #fff; }
.small { font-size: 12px; }
.btn { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.iconbtn.danger:hover { border-color: var(--bad); color: var(--bad); }
a.iconbtn { text-decoration: none; display: inline-block; }
td.actions { white-space: nowrap; }
td input.wide { min-width: 260px; }
.addrow { display: flex; gap: 8px; margin: -10px 0 18px; }
.addrow input { flex: 1; max-width: 520px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.form h3 { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
tr.alldone td { background: color-mix(in srgb, var(--ok) 16%, transparent); }
tr.partial td { background: color-mix(in srgb, var(--ok) 7%, transparent); }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 10px; border: 1px solid var(--line); }
.legend.alldone { background: color-mix(in srgb, var(--ok) 35%, transparent); }
.legend.partial { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.chip { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 8px; background: var(--soft); color: var(--ok); margin: 1px; }
#top-links { margin-left: auto; display: flex; gap: 8px; }
.big { font-size: 22px; font-weight: 600; }
code { font-size: 12px; background: var(--soft); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
body.server [data-act=open], body.server [data-open], body.server #t-open { display: none; }

/* telefon a tablet */
@media (max-width: 800px) {
  header { padding: 8px 12px; gap: 8px; }
  nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; order: 3; }
  nav button { white-space: nowrap; }
  main { padding: 12px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  td input[type=text] { min-width: 140px; }
  td input.num { min-width: 60px; }
  .card[style*="span 2"] { grid-column: auto !important; }
  .journal { flex-wrap: wrap; }
  .addrow { flex-wrap: wrap; }
  input, select, .btn { font-size: 16px; } /* iOS nezvětšuje stránku při psaní */
}
