@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --primary: #2f5d50;
    --primary-dark: #22463c;
    --primary-light: #e6f0ec;
    --accent: #c9822b;
    --accent-light: #fbf1e3;
    --text: #1f2a27;
    --text-muted: #5f6b67;
    --border: #d9e2de;
    --bg: #f5f7f4;
    --card: #ffffff;
    --error: #9b2c2c;
    --error-bg: #fdecec;
    --success: #1f6b45;
    --success-bg: #e5f4ea;
    --test: #8a4b00;
    --test-bg: #fff3d6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
}

.site-header {
    background: var(--primary);
    color: #fff;
    padding: 18px 20px;
}
.site-header .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.site-header .logo { font-size: 1.9rem; line-height: 1; }
.site-header h1 { font-size: 1.2rem; font-weight: 800; }
.site-header .sub { font-size: .85rem; opacity: .85; }

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

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 26px 26px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.04);
}
.card-title { font-size: 1.15rem; font-weight: 800; color: var(--primary); margin-bottom: 14px; }
.part-label { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }

p { margin-bottom: 12px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }

.letter p { margin-bottom: 12px; }
.signatures { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 18px; }
.signatures div { flex: 1; min-width: 180px; }
.signatures strong { display: block; }
.signatures span { color: var(--text-muted); font-size: .9rem; }

/* ── Formuláře ── */
.field { margin-bottom: 16px; }
label.lbl { display: block; font-weight: 700; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font: inherit;
    background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
input.code-input { font-family: 'Courier New', monospace; font-size: 1.3rem; letter-spacing: .18em; text-transform: uppercase; text-align: center; font-weight: 700; }
textarea { min-height: 110px; resize: vertical; }

.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 9px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #7a2020; }
.btn-sm { padding: 8px 14px; font-size: .88rem; }
.btn-block { display: block; width: 100%; text-align: center; }

.alert { padding: 12px 15px; border-radius: 9px; margin-bottom: 16px; font-weight: 600; }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-test { background: var(--test-bg); color: var(--test); }

/* ── Otázky ── */
.question { padding: 16px 0; border-top: 1px solid var(--border); }
.question:first-of-type { border-top: none; padding-top: 4px; }
.q-text { font-weight: 700; margin-bottom: 10px; }
.q-num { color: var(--accent); font-weight: 800; margin-right: 4px; }
.q-note { font-weight: 400; font-style: italic; color: var(--text-muted); font-size: .9rem; }
.question.missing { background: var(--error-bg); margin: 0 -14px; padding: 14px; border-radius: 9px; border-top-color: transparent; }
.question.missing .q-text::after { content: ' – prosím odpovězte'; color: var(--error); font-size: .85rem; font-weight: 700; }

.options { display: flex; flex-direction: column; gap: 7px; }
.opt {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    background: #fff;
    transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--primary); }
.opt input { width: 19px; height: 19px; accent-color: var(--primary); flex-shrink: 0; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-light); font-weight: 700; }
.opt.na { color: var(--text-muted); }

.staff-block { border: 2px solid var(--primary-light); border-radius: 12px; padding: 18px 18px 6px; margin-top: 16px; }
.staff-name { font-size: 1.1rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }

.info-date { background: var(--accent-light); border-left: 4px solid var(--accent); border-radius: 0 9px 9px 0; padding: 12px 15px; margin-bottom: 18px; }
.intro-box { background: var(--primary-light); border-radius: 10px; padding: 14px 16px; margin-bottom: 4px; }

.char-count { font-size: .78rem; color: var(--text-muted); text-align: right; margin-top: 3px; }

.thank-you { text-align: center; padding: 30px 10px; }
.thank-you .icon { font-size: 3.4rem; margin-bottom: 10px; }
.thank-you h2 { color: var(--primary); font-size: 1.5rem; margin-bottom: 10px; }

.test-banner { background: var(--test-bg); color: var(--test); text-align: center; padding: 8px 12px; font-weight: 800; font-size: .9rem; }

/* ── Admin a výsledky ── */
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { background: var(--primary-light); color: var(--primary-dark); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tbl td.num, .tbl th.num { text-align: right; }
.table-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 4px; }
.stat { background: var(--primary-light); border-radius: 10px; padding: 14px; text-align: center; }
.stat.test { background: var(--test-bg); }
.stat .v { font-size: 1.7rem; font-weight: 800; color: var(--primary); }
.stat.test .v { color: var(--test); }
.stat .l { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .75rem; font-weight: 800; }
.badge-used { background: var(--success-bg); color: var(--success); }
.badge-free { background: var(--accent-light); color: #7a4a0c; }
.badge-test { background: var(--test-bg); color: var(--test); }
.badge-live { background: var(--primary-light); color: var(--primary); }
.badge-exp { background: #eee; color: #666; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Pruhové grafy */
.res-q { padding: 12px 0; border-top: 1px solid var(--border); }
.res-q:first-of-type { border-top: none; }
.res-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; margin-bottom: 7px; }
.res-head .avg { white-space: nowrap; color: var(--text-muted); font-weight: 700; font-size: .85rem; }
.bar { display: flex; height: 24px; border-radius: 6px; overflow: hidden; background: #eef1ef; }
.bar .seg { height: 100%; color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .8rem; color: var(--text-muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.hbar-row { display: grid; grid-template-columns: minmax(160px, 38%) 1fr 70px; gap: 10px; align-items: center; margin: 5px 0; font-size: .9rem; }
.hbar { height: 18px; background: #eef1ef; border-radius: 5px; overflow: hidden; }
.hbar > div { height: 100%; background: var(--primary); }

.text-answers { list-style: none; }
.text-answers li { background: var(--bg); border-left: 3px solid var(--accent); padding: 9px 12px; margin-bottom: 7px; border-radius: 0 7px 7px 0; white-space: pre-wrap; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-radius: 8px; background: #fff; border: 1.5px solid var(--border); color: var(--text); text-decoration: none; font-weight: 700; font-size: .9rem; }
.tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 580px) {
    .card { padding: 20px 16px; }
    .hbar-row { grid-template-columns: 1fr 60px; }
    .hbar-row .hbar { grid-column: 1 / -1; grid-row: 2; }
    .staff-block { padding: 14px 12px 4px; }
}

@media print {
    .no-print, .site-header { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .table-scroll { max-height: none; overflow: visible; }
}
