:root {
  --navy: #303983;
  --navy-deep: #1c2260;
  --green: #00753d;
  --green-bright: #1fae66;
  --bg: #f3f4f8;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --line: #e1e4ee;
  --text: #1b1f3b;
  --muted: #5d6385;
  --dim: #8d92ad;
  --danger: #c62828;
  --amber: #b76e00;
  --radius: 12px;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hover-line: #b8bdd4;
  --tint-green: #e7f6ee;
  --tint-navy: #eef0fb;
  --tint-grey: #eceef3;
  --tint-red: #fdecec;
  --tint-amber: #fff4e0;
  --tint-proposal: #f2f8f4;
  --accent: var(--navy);
  color-scheme: light;
}

/* Tmavý režim: podle systému, pokud uživatel nepřepnul ručně */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1226; --panel: #171b36; --panel-2: #1d2242; --line: #2c3256; --text: #e9ebf7; --muted: #a3a8c9;
    --dim: #767ca3; --danger: #ff6b6b; --amber: #f2b53a; --green: #1fae66; --hover-line: #4a5185;
    --tint-green: rgba(31,174,102,.16); --tint-navy: rgba(120,132,255,.16); --tint-grey: rgba(255,255,255,.08);
    --tint-red: rgba(255,107,107,.14); --tint-amber: rgba(242,181,58,.15); --tint-proposal: rgba(31,174,102,.10);
    --accent: #9aa4ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1226; --panel: #171b36; --panel-2: #1d2242; --line: #2c3256; --text: #e9ebf7; --muted: #a3a8c9;
  --dim: #767ca3; --danger: #ff6b6b; --amber: #f2b53a; --green: #1fae66; --hover-line: #4a5185;
  --tint-green: rgba(31,174,102,.16); --tint-navy: rgba(120,132,255,.16); --tint-grey: rgba(255,255,255,.08);
  --tint-red: rgba(255,107,107,.14); --tint-amber: rgba(242,181,58,.15); --tint-proposal: rgba(31,174,102,.10);
  --accent: #9aa4ff; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- Rozvržení s postranním panelem ---------- */
.layout { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; width: 232px; flex: none;
  display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line);
  z-index: 30;
}
.side-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px 18px; text-decoration: none; color: var(--text); }
.side-brand img { width: 150px; max-width: 100%; display: block; background: #fff; border-radius: 10px; padding: 6px 10px; }
.side-brand span { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px;
}
.side-nav a:hover { background: var(--panel-2); color: var(--text); }
.side-nav a.active { color: var(--text); font-weight: 650; background: var(--tint-navy); }
.side-nav a.active .ico { color: var(--accent); }
.ico { width: 21px; height: 21px; flex: none; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 6px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.side-user:hover, .side-user.active { background: var(--panel-2); }
.side-user b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { display: block; font-size: 12px; color: var(--muted); }
.side-user > span:last-child { min-width: 0; }
.side-actions { display: flex; gap: 6px; }
.side-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer; font-weight: 500;
}
.side-btn:hover { color: var(--text); border-color: var(--hover-line); }
.side-btn.grow { flex: 1; }
.side-btn .ico { width: 18px; height: 18px; }
.side-backdrop { display: none; }
.content { flex: 1; min-width: 0; }
.mobile-bar { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 600; font-size: 12px; flex: none; }

main { max-width: 1160px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- Tlačítka a formuláře ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--hover-line); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #00894a; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:disabled { opacity: .4; }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.input, select.input, textarea.input {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-size: 15px; font-weight: 400; color: var(--text);
}
textarea.input { resize: vertical; min-height: 80px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--green-bright); box-shadow: 0 0 0 3px rgba(31,174,102,.15); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

/* ---------- Karty ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 14px; }
.card h2 { margin: 0 0 12px; font-size: 18px; }
.card h3 { margin: 0; font-size: 16px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; font-weight: 600; }
.empty { padding: 34px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }

/* ---------- Seznam jednání ---------- */
.meetings { display: grid; gap: 10px; }
.meeting-row {
  display: grid; grid-template-columns: 78px 1fr auto; gap: 18px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; text-decoration: none; color: inherit;
}
.meeting-row:hover { border-color: var(--hover-line); }
.datebox { text-align: center; border-radius: 10px; background: var(--panel-2); padding: 6px 0; border: 1px solid var(--line); }
.datebox b { display: block; font-size: 19px; line-height: 1.15; color: var(--accent); white-space: nowrap; }
.datebox span { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.meeting-row.next { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,117,61,.08); }
.meeting-row.next .datebox { background: var(--green); border-color: var(--green); }
.meeting-row.next .datebox b, .meeting-row.next .datebox span { color: #fff; }
.meeting-row h3 { margin: 0 0 2px; font-size: 16px; }
.counts { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.planovano { background: var(--tint-green); color: var(--green); }
.pill.probehlo { background: var(--tint-navy); color: var(--navy); }
.pill.uzavreno { background: var(--tint-grey); color: var(--muted); }
.pill.navrh { background: var(--tint-grey); color: var(--muted); }
.pill.prijato { background: var(--tint-green); color: var(--green); }
.pill.zamitnuto { background: var(--tint-red); color: var(--danger); }
.pill.odlozeno { background: var(--tint-amber); color: var(--amber); }
.pill.neplni_se { background: var(--tint-grey); color: var(--muted); }
.pill.v_plneni { background: var(--tint-amber); color: var(--amber); }
.pill.splneno { background: var(--tint-green); color: var(--green); }
.pill.zruseno { background: var(--tint-grey); color: var(--dim); }
.pill.po_terminu { background: var(--tint-red); color: var(--danger); }

/* ---------- Detail jednání ---------- */
.meeting-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.meeting-head h1 { margin: 0; font-size: 25px; }
.meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); margin-top: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.tabs a .badge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; padding: 0 7px; margin-left: 4px; }

.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.item-head { display: flex; gap: 14px; padding: 16px 18px; align-items: flex-start; }
.item-no { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.item-body { flex: 1; min-width: 0; }
.item-body h3 { margin: 4px 0 2px; font-size: 17px; }
.item-desc { white-space: pre-wrap; margin: 8px 0 0; }
.item-section { border-top: 1px solid var(--line); padding: 12px 18px 12px 66px; }
.item-section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.proposal { background: var(--tint-proposal); border-left: 3px solid var(--green); padding: 8px 12px; border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.file .ext { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--navy); color: #fff; border-radius: 5px; padding: 2px 6px; min-width: 38px; text-align: center; }
.file a.name { flex: 1; min-width: 0; text-decoration: none; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file a.name:hover { text-decoration: underline; }
.dropzone { display: block; border: 1.5px dashed #c5cae0; border-radius: 9px; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.dropzone.over { border-color: var(--green); background: var(--tint-proposal); color: var(--green); }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress div { height: 100%; background: var(--green); width: 0; transition: width .2s; }

.comment { display: flex; gap: 10px; margin-bottom: 10px; }
.comment .avatar { width: 26px; height: 26px; font-size: 11px; flex: none; }
.comment p { margin: 2px 0 0; white-space: pre-wrap; }
.comment-form { display: flex; gap: 8px; }
.comment-form textarea { min-height: 40px; }

/* ---------- Tabulky ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--panel-2); }
table.list tr:last-child td { border-bottom: none; }
table.list td.text { white-space: pre-wrap; max-width: 460px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: var(--panel); color: var(--text); padding: 6px 12px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on.pritomen { background: var(--green); color: #fff; }
.seg button.on.omluven { background: var(--amber); color: #fff; }
.seg button.on.neomluven { background: var(--danger); color: #fff; }

.resolution { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.resolution .num { font-weight: 700; color: var(--accent); }
.res-sentence { display: grid; grid-template-columns: auto 170px 1fr; gap: 8px; align-items: start; }
.res-sentence > span { padding-top: 10px; font-weight: 600; }
.tpl-list { gap: 10px; }
.file.tpl { padding: 12px 14px; background: var(--panel); align-items: flex-start; }
.file.tpl .ext { margin-top: 2px; }
.tpl-body { flex: 1; min-width: 0; }
.tpl-body a.name { display: block; white-space: normal; font-size: 15px; }
.task.late { border-left: 3px solid var(--danger); }
.task a.num { text-decoration: none; }
code { font-size: 13px; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.votes { display: flex; gap: 8px; align-items: center; }
.votes input { width: 64px; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; color: var(--accent); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

.hit { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; text-decoration: none; color: inherit; }
.hit:hover { border-color: var(--hover-line); }
.hit p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; }

/* ---------- Přihlášení ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--navy-deep), var(--navy)); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card img { height: 54px; display: block; margin: 0 auto 14px; }
.login-card h1 { text-align: center; margin: 0 0 4px; font-size: 21px; }
.login-card p { text-align: center; margin: 0 0 20px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- Dialog a toast ---------- */
dialog { background: var(--panel); color: var(--text); border: none; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,24,60,.45); }
dialog form { padding: 22px; }
dialog h2 { margin: 0 0 16px; font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 18px; background: var(--panel-2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 9px; text-align: center; user-select: all; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy-deep); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }

@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .side.open { transform: none; }
  .side.open + .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,12,30,.45); z-index: 25; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; font-weight: 600; }
  .mobile-bar img { height: 26px; background: #fff; border-radius: 6px; padding: 2px 6px; }
  main { padding: 20px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .res-sentence { grid-template-columns: 1fr; }
  .meeting-row { grid-template-columns: 60px 1fr; }
  .meeting-row .counts { grid-column: 1 / -1; }
  .item-section { padding-left: 18px; }
  table.list { display: block; overflow-x: auto; }
}

.mail-preview { margin: 0; max-height: 260px; overflow: auto; white-space: pre-wrap; font: 13px/1.45 ui-monospace, Menlo, monospace;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.side-version { text-align: center; font-size: 11px; color: var(--dim); }

/* našeptávač formulací */
.has-suggest { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 60; max-height: 320px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(10,12,30,.18);
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 14px; color: var(--text); }
.suggest-item { padding: 8px 12px; cursor: pointer; line-height: 1.4; border-bottom: 1px solid var(--line); }
.suggest-item:hover, .suggest-item.active { background: var(--tint-navy); }
.suggest-item mark { background: var(--tint-amber); color: inherit; border-radius: 3px; padding: 0 1px; }
.suggest-count { float: right; margin-left: 8px; font-size: 12px; color: var(--dim); }
.suggest-hint { padding: 6px 12px; font-size: 11px; color: var(--dim); }

/* osobní poznámky a verze pro web */
.note-section { padding-top: 8px; padding-bottom: 8px; }
.note-field textarea { background: var(--tint-amber); border-color: transparent; }
dialog.wide { width: min(820px, calc(100vw - 32px)); }
table.anon { display: table; }
table.anon td { vertical-align: middle; }
table.anon td:first-child { width: 28px; }
table.anon input[type=checkbox] { width: 18px; height: 18px; }

/* přesun a kopie bodů */
.origin { margin-top: 2px; color: var(--accent); }
.origin a { color: inherit; }
.copy-results { max-height: 340px; overflow-y: auto; display: grid; gap: 6px; }
.copy-hit { display: grid; gap: 2px; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.copy-hit:hover { border-color: var(--hover-line); }
.copy-hit.on { border-color: var(--green); box-shadow: 0 0 0 2px var(--tint-green); }
