:root {
  --bg: #f4f6f9; --card: #fff; --text: #1d2733; --muted: #6b7785; --line: #e1e6ec;
  --brand: #0b5cad; --brand-2: #e8f1fb;
  --ok: #1a7f4b; --ok-bg: #e3f4ea;
  --oprava: #0b5cad; --oprava-bg: #e5effa;
  --overit: #a35c00; --overit-bg: #fdf0dc;
  --nenal: #b3261e; --nenal-bg: #fbe5e3;
  --chyba: #6b2c91; --chyba-bg: #f1e6f7;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
code, pre { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
pre { background: #f0f3f7; padding: 10px 12px; border-radius: 6px; overflow-x: auto; }

.top { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 54px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-size: 16px; white-space: nowrap; }
.brand b { color: var(--brand); }
.tabs { display: flex; gap: 2px; height: 100%; }
.tabs button { border: 0; background: none; padding: 0 14px; font: inherit; color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.ruian-badge { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
.tab { display: none; }
.tab.active { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card h3 { font-size: 14px; margin: 18px 0 6px; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.grid2 .card { margin-bottom: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } .top { flex-wrap: wrap; height: auto; padding: 8px 16px; } }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand);
  color: #fff; font-size: 12px; margin-right: 6px; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
label input, select { display: block; width: 100%; margin-top: 3px; padding: 7px 9px; font: inherit; color: var(--text);
  border: 1px solid #c9d2dc; border-radius: 5px; background: #fff; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
label.inline input { width: auto; margin: 0; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row-inline { display: flex; gap: 8px; align-items: center; }
.row-inline select { width: auto; margin: 0; }

.btn { display: inline-block; padding: 7px 14px; border: 1px solid #c9d2dc; background: #fff; border-radius: 5px;
  font: inherit; color: var(--text); cursor: pointer; text-decoration: none; }
.btn:hover { background: #f2f5f8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #094c8f; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
button.link { border: 0; background: none; color: var(--brand); cursor: pointer; text-decoration: underline; font: inherit; }
.err { color: var(--nenal); margin-left: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.actions { margin-top: 14px; }

.seg { display: flex; gap: 16px; margin-bottom: 12px; }
.seg label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); margin: 0; }
.seg input { width: auto; margin: 0; }

.dropzone { border: 2px dashed #b9c6d4; border-radius: 8px; padding: 28px 16px; text-align: center; cursor: pointer;
  background: #fafbfd; transition: .15s; }
.dropzone.over { border-color: var(--brand); background: var(--brand-2); }
.dz-main { font-size: 15px; }
.dz-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.file-info { margin-top: 8px; font-size: 13px; }

.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #c9d2dc; border-radius: 5px;
  box-shadow: 0 6px 18px rgba(0,0,0,.1); max-height: 280px; overflow-y: auto; z-index: 5; display: none; }
.ac-list.open { display: block; }
.ac-list div { padding: 7px 10px; cursor: pointer; color: var(--text); font-size: 13px; }
.ac-list div:hover, .ac-list div.hl { background: var(--brand-2); }
.ac-list small { color: var(--muted); display: block; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; background: #fff; }
.kpi .v { font-size: 24px; font-weight: 600; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .p { font-size: 12px; color: var(--muted); }
.kpi.ok .v { color: var(--ok); } .kpi.oprava .v { color: var(--oprava); } .kpi.overit .v { color: var(--overit); }
.kpi.nenal .v { color: var(--nenal); } .kpi.chyba .v { color: var(--chyba); }
.small-kpis .kpi .v { font-size: 18px; }
.stackbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); margin: -4px 0 14px; }
.stackbar span { display: block; height: 100%; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line);
  padding: 6px 8px; position: sticky; top: 0; background: #fff; }
.tbl td { border-bottom: 1px solid #eef1f4; padding: 6px 8px; vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #f6f9fc; }
.tbl tr.sel td { background: var(--brand-2); }
.tbl tr.cont td.first { color: transparent; }
.tbl-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }

.st { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st-OK { background: var(--ok-bg); color: var(--ok); }
.st-OPRAVA { background: var(--oprava-bg); color: var(--oprava); }
.st-OVERIT { background: var(--overit-bg); color: var(--overit); }
.st-NENALEZENO { background: var(--nenal-bg); color: var(--nenal); }
.st-CHYBA { background: var(--chyba-bg); color: var(--chyba); }
.lvl-chyba { color: var(--nenal); font-weight: 600; }
.lvl-varovani { color: var(--overit); font-weight: 600; }

.head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h2 { margin: 0; margin-right: auto; }
.exports { display: flex; gap: 6px; align-items: center; }
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.filters input { padding: 6px 9px; border: 1px solid #c9d2dc; border-radius: 5px; font: inherit; min-width: 240px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #c9d2dc; background: #fff; border-radius: 14px; padding: 3px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.k-wrap { max-height: 50vh; }
.tbl th.chk, .tbl td.chk { width: 30px; text-align: center; }
.tbl td.chk input, .tbl th.chk input { margin: 0; cursor: pointer; }
#kTbl tr.off td:not(.chk) { color: var(--muted); text-decoration: line-through; text-decoration-color: #c9d2dc; }
#kTbl tbody tr { cursor: pointer; }
.sel-sm { width: auto; margin: 0; padding: 5px 8px; }
.sel-btns { display: flex; gap: 6px; }
.nalez { display: block; font-size: 12px; }

dl.meta { display: grid; grid-template-columns: 180px 1fr; gap: 4px 12px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; font-weight: 500; }
.progress { position: relative; height: 22px; background: var(--line); border-radius: 5px; margin-top: 12px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--brand); width: 0; transition: width .3s; }
.progress .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--text); }
.prose { max-width: 900px; }
th.dl, td.dl { text-align: right; white-space: nowrap; }
.btn.dl-csv { color: var(--ok); font-weight: 600; }
.btn.dl-csv:hover { background: var(--ok-bg); }
.del { color: var(--muted); border: 0; background: none; cursor: pointer; font-size: 15px; }
.del:hover { color: var(--nenal); }

/* strukturované porovnání iDES × RÚIAN */
.v-tbl thead tr:nth-child(2) th { top: 27px; }
.v-tbl th.grp { text-align: center; border-bottom: 2px solid; }
.v-tbl th.grp-ides { color: var(--muted); border-color: #c9d2dc; }
.v-tbl th.grp-ruian { color: var(--brand); border-color: var(--brand); }
.v-tbl td.ides { background: #fafbfc; }
.v-tbl tr:not(.cont) td { border-top: 1px solid #dfe5eb; }
.v-tbl tr.cont td { border-top: 0; }
.v-tbl td.diff { background: var(--overit-bg); color: #7a4500; font-weight: 600; }
.v-tbl td.shoda { color: var(--ok); font-weight: 600; }
.v-tbl td.chybi { color: var(--muted); font-style: italic; }
.v-tbl td.kam { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 4px; }

.btn.primary-ghost { border-color: var(--brand); color: var(--brand); font-weight: 600; }
#kInfo { color: var(--muted); margin-top: 4px; }
#kInfo .warn { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 4px;
  background: var(--overit-bg); color: #7a4500; font-weight: 600; }

/* přihlášení do aplikace, uživatel, přístupy */
body.auth-wait > header, body.auth-wait > main { visibility: hidden; }
.auth-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-brand { text-align: center; font-size: 18px; margin-bottom: 18px; }
.auth-brand b { color: var(--brand); }
.auth-card form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px 24px 20px;
  box-shadow: 0 4px 18px rgba(20, 40, 70, .08); }
.auth-card h2 { margin: 0 0 14px; font-size: 17px; }
.auth-card .btn.primary { width: 100%; padding: 9px; margin-top: 4px; }
.auth-card #hesloZpet { width: 100%; margin-top: 8px; }
.auth-err { color: var(--nenal); font-size: 13px; min-height: 18px; margin-bottom: 4px; }
.user-box { font-size: 12px; color: var(--muted); white-space: nowrap; }
.user-box #userName { color: var(--text); font-weight: 600; margin-right: 6px; }
body:not(.is-admin) .admin-only { display: none !important; }
body.is-admin .admin-hide { display: none; }
#uzivTbl tr.neaktivni td { color: var(--muted); }
.role-admin { color: var(--brand); font-weight: 600; }
.uziv-aktivni { align-self: end; margin-bottom: 18px !important; }
.tbl td.akce { white-space: nowrap; text-align: right; }
.tabs button { white-space: nowrap; }
@media (max-width: 1300px) { .top { gap: 14px; } .ruian-badge { display: none; } .user-box { margin-left: auto; } }
@media (max-width: 1100px) { .top { flex-wrap: wrap; height: auto; padding: 6px 16px; } .tabs { height: 42px; } }

/* vyhodnocení párování nad tabulkou výsledků */
.v-eval { margin: 14px 0 12px; }
.ev-head { font-weight: 600; margin-bottom: 8px; }
.ev-head .muted { font-weight: 400; font-size: 12px; }
.ev-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 1100px) { .ev-grid { grid-template-columns: repeat(2, 1fr); } }
.ev-tile { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: 8px 10px; }
.ev-beze { border-left-color: var(--ok); }
.ev-formalni { border-left-color: #7fb6e8; }
.ev-vecna { border-left-color: var(--oprava); }
.ev-neres { border-left-color: var(--overit); }
.ev-main { display: flex; align-items: baseline; gap: 8px; border: 0; background: none; padding: 0; font: inherit;
  cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.ev-n { font-size: 22px; font-weight: 700; }
.ev-l { font-weight: 600; }
.ev-sub { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 4px; font-size: 12px; }
.ev-item { border: 0; background: none; padding: 1px 4px; margin-left: -4px; font: inherit; color: var(--text);
  cursor: pointer; border-radius: 3px; text-align: left; }
.ev-item:hover, .ev-main:hover .ev-l { text-decoration: underline; }
.ev-item.on, .ev-main.on { background: var(--brand-2); outline: 1px solid var(--brand); border-radius: 3px; }
.zt { display: inline-block; font-size: 11px; padding: 0 5px; margin: 1px 3px 1px 0; border-radius: 3px; white-space: nowrap; }
.zt-beze { background: var(--ok-bg); color: var(--ok); }
.zt-form { background: #eef4fb; color: #3a6ea5; }
.zt-vecna { background: var(--oprava-bg); color: var(--oprava); font-weight: 600; }
.v-tbl td.zm { white-space: normal; min-width: 90px; }
.btn.dl-pdf { color: var(--brand); font-weight: 600; }
