:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --text: #1c2024;
    --muted: #6b7280;
    --line: #e3e6ea;
    --accent: #2563eb;
    --ok: #15803d;
    --ok-bg: #e8f5ec;
    --no: #b91c1c;
    --no-bg: #fdecec;
    --uns: #92610b;
    --uns-bg: #fdf4e3;
    --radius: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14171b;
        --panel: #1c2026;
        --text: #e7e9ec;
        --muted: #9aa3ad;
        --line: #2c323a;
        --accent: #5b8def;
        --ok: #58c07d;
        --ok-bg: #1c2f24;
        --no: #f08b8b;
        --no-bg: #33201f;
        --uns: #d6ab5f;
        --uns-bg: #322a1c;
    }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--accent); }

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 22px 18px 60px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--no); font-weight: 600; }
.mt { margin-top: 22px; }
.lead { color: var(--muted); margin: 6px 0 18px; max-width: 70ch; }

/* --------------------------------------------------------------- topbar */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand { font-weight: 650; text-decoration: none; color: var(--text); }
.topbar-actions { margin: 0; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 5px; }

/* ---------------------------------------------------------------- karty */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.person-card { text-decoration: none; color: inherit; display: block; transition: border-color .15s, transform .15s; }
.person-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.person-name { font-size: 19px; font-weight: 650; margin-bottom: 2px; }

.list { display: flex; flex-direction: column; gap: 12px; }

.row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    text-decoration: none;
    color: inherit;
}
.row-card:hover { border-color: var(--accent); }
.row-title { font-weight: 600; }
.row-progress { min-width: 150px; text-align: right; }

.bar {
    height: 7px;
    background: var(--line);
    border-radius: 99px;
    overflow: hidden;
    margin: 10px 0 4px;
}
.bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .2s; }
.bar.wide { flex: 1; min-width: 120px; margin: 0; }

.empty {
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 24px;
    color: var(--muted);
}
.empty.error { border-color: var(--no); color: var(--no); }

/* ------------------------------------------------------------- tlačítka */

.btn {
    display: inline-block;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 13px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-link { border: 0; background: none; color: var(--muted); padding: 7px 4px; text-decoration: underline; }

/* -------------------------------------------------------------- toolbar */

.toolbar {
    position: sticky;
    top: 53px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
}
.progress-label { font-size: 14px; white-space: nowrap; }
.switch { font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }

/* ------------------------------------------------------------ kandidáti */

.cards { display: flex; flex-direction: column; gap: 14px; }

.candidate { border-left: 4px solid var(--line); }
.candidate[data-state="yes"] { border-left-color: var(--ok); }
.candidate[data-state="no"]  { border-left-color: var(--no); }
.candidate.hidden { display: none; }

.cand-head { display: flex; gap: 12px; align-items: flex-start; }
.seq {
    flex: none;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 99px;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}
.cand-title { flex: 1; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 99px;
    border: 1px solid transparent;
}
.v-ok  { background: var(--ok-bg);  color: var(--ok); }
.v-no  { background: var(--no-bg);  color: var(--no); }
.v-uns { background: var(--uns-bg); color: var(--uns); }
.score { background: var(--bg); color: var(--muted); border-color: var(--line); }
.state-badge { display: none; }
.candidate[data-state="yes"] .state-badge { display: inline; background: var(--ok-bg); color: var(--ok); }
.candidate[data-state="no"]  .state-badge { display: inline; background: var(--no-bg); color: var(--no); }

.reason { margin: 12px 0; max-width: 90ch; }

.cv-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-name { word-break: break-all; }

.cv-viewer { margin-top: 12px; }
.cv-viewer iframe {
    width: 100%;
    height: 78vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.cv-viewer img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }

/* --------------------------------------------------------------- review */

.review {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choices { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.choice {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}
.choice input { accent-color: var(--accent); margin: 0; }
.choice-yes:has(input:checked) { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.choice-no:has(input:checked)  { border-color: var(--no); background: var(--no-bg); color: var(--no); font-weight: 600; }

.note-label { display: block; font-size: 13px; color: var(--muted); }

textarea.note {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 56px;
}
textarea.note:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.save-status { font-size: 12px; color: var(--muted); min-height: 16px; }
.save-status.saving { color: var(--accent); }
.save-status.error { color: var(--no); font-weight: 600; }

/* ----------------------------------------------------------- ostatní */

.log {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    overflow: auto;
    font-size: 13px;
    white-space: pre-wrap;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 18px 30px; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { display: flex; flex-direction: column; gap: 10px; width: min(340px, 90vw); }
.login input {
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

@media (max-width: 640px) {
    .row-card { flex-direction: column; align-items: stretch; }
    .row-progress { text-align: left; }
    .toolbar { top: 49px; }
}
