:root {
  --bg: #f4f6f8; --card: #fff; --text: #1c2630; --muted: #66727e; --line: #dde3e8;
  --blue: #1a86b8; --blue-d: #136a93; --blue-l: #e6f3f9;
  --red: #c8372d; --red-l: #fbe9e7; --orange: #d9822b; --orange-l: #fdf1e3; --gray: #5b7083; --gray-l: #eaf0f4;
  --green: #2e8b57; --green-l: #e5f4ec; --violet: #7a4fb5; --violet-l: #f1ebf9;
  --radius: 10px; --shadow: 0 1px 3px rgba(20, 40, 60, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h2 { font-size: 20px; } h3 { font-size: 16px; margin-top: .6em; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.error { color: var(--red); margin: .5em 0 0; } .ok { color: var(--green); margin: .5em 0 0; }
.warn { background: var(--orange-l); color: #7a4a10; padding: 6px 10px; border-radius: 6px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-l); border-color: var(--blue); }
textarea { resize: vertical; }
label { display: block; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 3px; font-size: 15px; color: var(--text); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; }
label.check input { width: auto; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c4cd; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--gray-l); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { color: var(--red); border-color: #efc2bd; }
.btn:disabled { opacity: .55; cursor: default; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* přihlášení */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 28px; }
.login-card h1 { color: var(--blue); }
.login-card .btn { width: 100%; margin-top: 6px; padding: 10px; }

/* hlavička */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.brand strong { color: var(--blue); font-size: 18px; margin-right: 8px; }
.last { flex: 1; font-size: 13px; color: var(--muted); text-align: center; min-width: 200px; }
.last b { color: var(--text); font-weight: 600; }
.who { display: flex; gap: 4px; align-items: center; }
.who #me-name { font-weight: 600; margin-right: 6px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* přehled */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.sum { padding: 12px 14px; border-left: 4px solid var(--gray); cursor: pointer; }
.sum.nutne { border-left-color: var(--red); } .sum.dulezite { border-left-color: var(--orange); }
.sum h3 { margin: 0 0 2px; font-size: 15px; }
.sum .hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.sum .nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.sum .nums b { font-size: 20px; color: var(--text); display: block; line-height: 1.1; }
.sum .bar { height: 5px; background: var(--gray-l); border-radius: 3px; margin-top: 9px; overflow: hidden; }
.sum .bar i { display: block; height: 100%; background: var(--green); }

/* nástroje */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar select { width: auto; } .toolbar input[type=search] { width: auto; flex: 1; min-width: 140px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--blue-l); color: var(--blue-d); font-weight: 600; }

/* seznam */
.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: 52px 86px 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px 14px; cursor: pointer; border: 1px solid transparent; }
.row:hover { border-color: #c9d6df; }
.row.active { border-color: var(--blue); }
.row .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.row .title { font-weight: 500; min-width: 0; }
.row .title .sub { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 1px; }
.row.unread .title { font-weight: 700; }
.row .meta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: middle; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.p-nutne { background: var(--red-l); color: var(--red); }
.p-dulezite { background: var(--orange-l); color: #a35d14; }
.p-pozdeji { background: var(--gray-l); color: var(--gray); }
.s-novy { background: var(--blue-l); color: var(--blue-d); }
.s-rozpracovano { background: var(--violet-l); color: var(--violet); }
.s-hotovo { background: #fff6d6; color: #8a6a00; }
.s-vraceno { background: var(--red-l); color: var(--red); }
.s-schvaleno { background: var(--green-l); color: var(--green); }
.s-zruseno { background: #eee; color: #888; text-decoration: line-through; }

/* detail */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: #fff; z-index: 20;
  box-shadow: -4px 0 20px rgba(20, 40, 60, .15); overflow-y: auto; }
.panel-in { padding: 18px 20px 40px; }
.shade { position: fixed; inset: 0; background: rgba(20, 30, 40, .25); z-index: 15; }
.p-head { display: flex; gap: 10px; align-items: flex-start; }
.p-head h2 { flex: 1; margin: 0; }
.p-meta { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.p-chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.p-chips select { width: auto; padding: 3px 6px; font-size: 13px; }
.p-chips select.chip-select { font-weight: 600; border-radius: 20px; border: 0; }
.desc { white-space: pre-wrap; background: var(--bg); padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; overflow-wrap: anywhere; }
.p-url { margin: 0 0 12px; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; background: var(--blue-l); border-radius: 8px; margin-bottom: 16px; align-items: center; }
.actions .lbl { font-size: 13px; color: var(--blue-d); margin-right: 4px; }

.timeline { border-left: 2px solid var(--line); margin: 0 0 16px 6px; padding-left: 14px; }
.ev { margin: 0 0 12px; position: relative; }
.ev::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.ev.comment::before { background: var(--blue); }
.ev .h { font-size: 13px; color: var(--muted); }
.ev .h b { color: var(--text); }
.ev .t { white-space: pre-wrap; margin-top: 3px; overflow-wrap: anywhere; }
.ev.comment .t { background: var(--bg); padding: 8px 10px; border-radius: 8px; }
.ev.mine.comment .t { background: var(--blue-l); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.files a.img img { max-width: 180px; max-height: 130px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.files a.doc { font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }

.composer textarea { min-height: 80px; }
.composer .row-end { margin-top: 6px; }
.pasted { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.pasted span { font-size: 12px; background: var(--gray-l); padding: 3px 8px; border-radius: 6px; }
.pasted button { border: 0; background: none; cursor: pointer; color: var(--red); padding: 0 0 0 4px; }

.row-end { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.row-end .grow { flex: 1; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 10px; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(20, 30, 40, .35); }
.dlg { padding: 20px; }
.dlg + .dlg { border-top: 1px solid var(--line); }

.edit-form { background: var(--bg); padding: 12px; border-radius: 8px; margin-bottom: 12px; }

@media (max-width: 720px) {
  .summary { grid-template-columns: 1fr; }
  .last { order: 3; text-align: left; flex-basis: 100%; }
  .row { grid-template-columns: auto 1fr; gap: 4px 10px; }
  .row .num { grid-row: span 2; align-self: start; }
  .row .pr { grid-column: 2; justify-self: start; order: 3; }
  .row .meta { text-align: left; grid-column: 2; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .panel-in { padding: 14px 16px 40px; }
}
.link { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 0 0 0 8px; font-size: 13px; text-decoration: underline; }
.ev .edit-form { margin-top: 4px; }
