/* vz-mcp — přehled veřejných zakázek. Bez frameworku. Výchozí noční režim, denní přes
   <html data-theme="light"> (přepínač v hlavičce, volba v cookie vz_theme). */

:root,
:root[data-theme="dark"] {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1d222a;
    --surface-3: #252b34;
    --border: #2a313b;
    --text: #e7eaef;
    --muted: #97a2b1;
    --accent: #7fc54f;          /* zelená z loga Kangaroo, zesvětlená pro tmavé pozadí */
    --accent-strong: #6eb43f;
    --accent-weak: #1e2b17;
    --link: #8cb8ff;
    --ok: #6fd28f;
    --ok-weak: #15301f;
    --warn: #f2a65a;
    --warn-weak: #3a2a16;
    --bad: #ff8577;
    --bad-weak: #3d1d1a;
    --neutral-weak: #262c35;
    --topbar: #0b0d10;
    --topbar-text: #d6dbe2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --radius: 10px;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --surface-3: #eef1f4;
    --border: #dde2e8;
    --text: #1d2530;
    --muted: #5d6877;
    --accent: #4f9a24;
    --accent-strong: #6eb43f;
    --accent-weak: #ebf6e3;
    --link: #1d5fd1;
    --ok: #1e7a3a;
    --ok-weak: #e3f4e8;
    --warn: #ad5600;
    --warn-weak: #fdf0e1;
    --bad: #b42318;
    --bad-weak: #fdecea;
    --neutral-weak: #eceef1;
    --topbar: #14181d;          /* hlavička zůstává tmavá i ve dne — bílé logo */
    --topbar-text: #d6dbe2;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06);
    color-scheme: light;
}

* { box-sizing: border-box; }

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

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- hlavička --- */

.topbar {
    background: var(--topbar);
    border-bottom: 3px solid var(--accent-strong);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner, main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 60px;
    flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 24px; width: auto; }
/* Název aplikace drobně pod logem — nezabírá místo v řádku menu. */
.brand-name { color: #8b95a3; font-size: 10px; line-height: 1; text-transform: uppercase; letter-spacing: .14em; padding-left: 1px; }
.nav-badge {
    display: inline-block; margin-left: 3px; padding: 0 5px; border-radius: 999px; font-size: 10px; font-weight: 600;
    line-height: 15px; vertical-align: 1px; text-transform: uppercase; letter-spacing: .04em; color: #f2a65a; border: 1px solid rgba(242, 166, 90, .5);
}
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a {
    padding: 7px 12px;
    border-radius: 6px;
    color: #aab3bf;
    font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(110, 180, 63, .18); color: #a6dd7c; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 10px; color: #aab3bf; font-size: 14px; margin-left: auto; }
.btn-ghost { background: transparent; color: #cfd6de; border-color: #3a424d; }
.btn-ghost:hover { border-color: var(--accent-strong); color: #fff; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #3a424d;
    background: transparent;
    color: #e3c56b;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent-strong); }
.theme-icon-sun { display: inline; }
.theme-icon-moon { display: none; color: #b9c7ff; }
:root[data-theme="light"] .theme-icon-sun { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: inline; }

@media (max-width: 760px) {
    .brand-name, .username { display: none; }
    .topbar-inner { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
    .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
}

main { padding-top: 24px; padding-bottom: 56px; }

h1 { font-size: 24px; line-height: 1.3; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: .01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.lead { max-width: 820px; margin: -6px 0 18px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.card > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.layout-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout-detail { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.text-warn { color: var(--warn); }

/* --- výzva na přehledu --- */

.callout {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--accent-strong);
    background: var(--accent-weak);
    color: var(--text);
}
.callout:hover { text-decoration: none; filter: brightness(1.05); }
.callout-icon {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-strong);
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.callout-go { margin-left: auto; color: var(--accent); font-size: 20px; }

/* --- čísla na přehledu --- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--text);
    border-top: 3px solid var(--border);
    transition: border-color .15s;
}
.stat:nth-child(1) { border-top-color: var(--accent-strong); }
.stat:nth-child(2) { border-top-color: #e3a008; }
.stat:nth-child(3) { border-top-color: var(--link); }
.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }

/* --- tabulky --- */

.table-wrap { overflow-x: auto; position: relative; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.title-cell { min-width: 260px; }
.title-cell a { font-weight: 600; color: var(--text); }
.title-cell a:hover { color: var(--link); }
.title-cell .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.empty { color: var(--muted); padding: 16px 0; }

/* barevný proužek podle verdiktu — rychlá orientace v seznamu */
table.tenders tbody tr td:first-child { border-left: 3px solid transparent; }
table.tenders tr.row-vhodna td:first-child { border-left-color: var(--ok); }
table.tenders tr.row-mozna td:first-child { border-left-color: var(--warn); }
table.tenders tr.row-nevhodna td:first-child { border-left-color: var(--border); }
table.tenders tr.row-nevhodna .title-cell a { color: var(--muted); font-weight: 500; }
.row-actions { width: 1%; }
.row-actions-inner { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 108px; }
.row-actions-inner .btn { justify-content: center; }
@media (max-width: 1100px) { .row-actions-inner { flex-direction: column; align-items: stretch; } }

.urgency-urgent { color: var(--bad); font-weight: 600; }
.urgency-soon { color: var(--warn); }

/* --- štítky --- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.6;
}
.badge-vhodna { background: var(--ok-weak); color: var(--ok); }
.badge-mozna { background: var(--warn-weak); color: var(--warn); }
.badge-nevhodna { background: var(--neutral-weak); color: var(--muted); }
.status {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--neutral-weak);
    color: var(--text);
    white-space: nowrap;
}
.status-zajem, .status-priprava { background: var(--accent-weak); color: var(--accent); }
.status-podano { background: var(--warn-weak); color: var(--warn); }
.status-vyhrano { background: var(--ok-weak); color: var(--ok); }
.status-prohrano, .status-nezajem { color: var(--muted); }
.star { color: #e3a008; }
.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    border: 1px dashed var(--border);
    vertical-align: 1px;
}

.deadline-short { color: var(--bad); font-weight: 600; }
.deadline-past { color: var(--muted); text-decoration: line-through; }

/* --- formuláře --- */

form.inline { display: inline; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=password], input[type=search], select, textarea {
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-link { border: 0; background: none; color: var(--link); padding: 0; font-weight: 400; }
.btn-watch.on { color: #e3a008; border-color: #e3a008; }
.btn-yes:hover { border-color: var(--ok); color: var(--ok); }
.btn-no:hover { border-color: var(--muted); color: var(--muted); }

.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(130px, 1fr)) auto; gap: 10px; align-items: end; }
.filters .field { margin: 0; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Co děláme --- */

.progress-card { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
@media (max-width: 760px) { .progress-card { grid-template-columns: 1fr; } }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--accent-strong); border-radius: 999px; width: 0; }
.progress-10 { width: 10%; } .progress-20 { width: 20%; } .progress-30 { width: 30%; } .progress-40 { width: 40%; }
.progress-50 { width: 50%; } .progress-60 { width: 60%; } .progress-70 { width: 70%; } .progress-80 { width: 80%; }
.progress-90 { width: 90%; } .progress-100 { width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent-weak); border-color: var(--accent-strong); color: var(--accent); font-weight: 600; }

.cap-list { display: grid; }
.cap-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) auto minmax(200px, 1fr);
    gap: 10px 18px;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
}
.cap-row:last-child { border-bottom: 0; }
.cap-row.is-dirty { border-left-color: var(--warn); background: var(--surface-2); }
@media (max-width: 900px) { .cap-row { grid-template-columns: 1fr; } }
.cap-title { font-weight: 600; }
.cap-hint, .cap-meta { color: var(--muted); font-size: 13px; }
.cap-meta { font-size: 12px; }
.cap-note { font-size: 14px; }

.segmented { position: relative; display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 0; padding: 0; min-width: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented .seg {
    margin: 0;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-right: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
.segmented .seg:last-of-type { border-right: 0; }
.segmented .seg:hover { color: var(--text); }
.segmented input:focus-visible + .seg { outline: 2px solid var(--accent); outline-offset: -2px; }
.segmented input:checked + .seg-ano { background: var(--ok-weak); color: var(--ok); }
.segmented input:checked + .seg-castecne { background: var(--accent-weak); color: var(--accent); }
.segmented input:checked + .seg-ne { background: var(--bad-weak); color: var(--bad); }
.segmented input:checked + .seg-nevim { background: var(--warn-weak); color: var(--warn); }

.savebar {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 12px 20px;
    margin: 0 -20px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .18);
}

/* --- detail --- */

.facts { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; }
@media (max-width: 600px) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: 8px; } }
.reason { background: var(--surface-2); border-left: 3px solid var(--border); padding: 10px 14px; border-radius: 4px; margin: 0; }
.reason.human { border-left-color: var(--accent); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.note-body { white-space: normal; word-wrap: break-word; }

/* --- zprávy --- */

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-weak); color: var(--ok); border-color: var(--ok-weak); }
.flash-error { background: var(--bad-weak); color: var(--bad); border-color: var(--bad-weak); }
.notice { background: var(--warn-weak); color: var(--warn); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }

/* --- přihlášení a samostatné stránky --- */

.center-page { max-width: 420px; margin: 8vh auto 0; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 12px; }
code, pre { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
pre.export { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 12px; white-space: pre-wrap; max-height: 360px; overflow: auto; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: Consolas, Menlo, monospace; font-size: 13px; }

.mt { margin-top: 14px; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- připomínky v detailu zakázky (D-31) --- */

.reminder-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 14px; }
.reminder-box legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.reminder-box .check { margin-bottom: 6px; }
.reminder-box input[type=text] { margin-top: 4px; }
.recipient-list { display: grid; gap: 2px; margin: 4px 0 6px 24px; }
.recipient-list .check { margin-bottom: 0; }
.reminder-plan { list-style: none; margin: 8px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-size: 13px; }
.reminder-plan li::before { content: "🔔 "; }

/* --- řazení kliknutím na sloupec a okno „Sledovat“ (D-32) --- */

th a.sort { color: inherit; text-decoration: none; }
th a.sort:hover { color: var(--text); }
th a.sort.active { color: var(--accent); }
.sort-arrow { font-size: 10px; }

.watch-dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.watch-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.watch-dialog h2 { margin-bottom: 6px; }
.watch-dialog-tender { margin: 0 0 14px; }
.watch-dialog-tender strong { display: block; }
.dialog-actions { justify-content: flex-end; margin-top: 6px; }

/* --- výtah ze zadávací dokumentace a checklist (D-35, D-37) --- */

.extract { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.extract h3 { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.extract p { margin: 0 0 6px; }
details summary { cursor: pointer; color: var(--link); }
.doc-list { margin: 8px 0; padding-left: 18px; font-size: 14px; }
.doc-list li { margin-bottom: 3px; }
.mt-0 { margin: 4px 0 10px; }

.checklist { list-style: none; margin: 0 0 12px; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist-body { flex: 1; min-width: 0; }
.checklist-title { font-weight: 600; }
.checklist li.is-done .checklist-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.checklist details p { margin: 4px 0 0; white-space: normal; }
.check-toggle {
    width: 22px; height: 22px; margin-top: 1px; flex: none;
    border: 2px solid var(--border); border-radius: 5px; background: var(--surface-2);
    color: #fff; font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
}
.check-toggle:hover { border-color: var(--accent); }
.is-done .check-toggle { background: var(--accent-strong); border-color: var(--accent-strong); }
.checklist-add { display: grid; grid-template-columns: 1fr 150px 140px auto; gap: 8px; margin-bottom: 10px; }
@media (max-width: 760px) { .checklist-add { grid-template-columns: 1fr 1fr; } }
input[type=date] { padding: 7px 8px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; }

/* --- bublina „o čem zakázka je“ a akce v hlavičce detailu (D-38) --- */

.floating-tip {
    position: fixed;
    z-index: 50;
    max-width: min(460px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-3);
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    pointer-events: none;
}
.floating-tip[hidden] { display: none; }


.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 18px; }
.detail-actions .btn { padding: 9px 16px; }
.btn-yes.active { background: var(--ok-weak); color: var(--ok); border-color: var(--ok); }
.btn-no.active { background: var(--neutral-weak); color: var(--muted); border-color: var(--muted); }
.detail-actions .btn-yes { border-color: var(--ok); color: var(--ok); }
.detail-actions .btn-yes:hover, .detail-actions .btn-yes.active { background: var(--ok-weak); }
.detail-actions .btn-watch { border-color: #e3a008; color: #e3a008; }
.detail-actions .btn-watch:hover, .detail-actions .btn-watch.on { background: rgba(227, 160, 8, .12); }

/* --- minulé ročníky v přehledu (D-40) --- */

.prev { margin-top: 4px; }
.prev-toggle {
    border: 0; background: none; padding: 0; cursor: pointer;
    color: var(--link); font: inherit; font-size: 12px; text-decoration: underline dotted;
}
.prev-pop {
    position: fixed; z-index: 60;
    width: min(440px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto;
    padding: 10px 12px; text-align: left; white-space: normal;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface-3); color: var(--text);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .4); font-size: 13px; font-variant-numeric: normal;
}
.prev-pop[hidden] { display: none; }
.prev-list { list-style: none; margin: 0; padding: 0; }
.prev-list li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.prev-list li:last-child { border-bottom: 0; }
.prev-head .tag { margin-left: 4px; }
.prev-title { color: var(--muted); font-size: 12px; margin: 1px 0 3px; }
.prev-links { margin-top: 3px; display: flex; gap: 12px; }

/* proklik na zakázku na portálu přímo ze seznamu (U-32) */
.portal-link {
    display: inline-block; margin-left: 6px; padding: 0 6px;
    font-size: 11px; font-weight: 600; line-height: 1.7; white-space: nowrap; vertical-align: 1px;
    border: 1px solid var(--border); border-radius: 999px; color: var(--link);
}
.portal-link:hover { text-decoration: none; border-color: var(--link); }

/* Zdroje — experiment (D-41) */
.tag-exp { color: var(--warn); border-color: var(--warn); border-style: solid; font-size: 12px; vertical-align: 4px; }
.source-run { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.filters-sources { grid-template-columns: 2fr repeat(4, minmax(130px, 1fr)) auto; }
.src {
    display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--accent-weak); color: var(--accent);
}
.src-ted { background: rgba(140, 184, 255, .14); color: var(--link); }
.src-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.flag { font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); line-height: 1.7; }
.title-cell a.flag-email { color: var(--ok); border-color: var(--ok); font-weight: 500; }
.flag-new { color: var(--warn); border-color: var(--warn); }
.why { min-width: 150px; }
.why-chip {
    display: inline-block; margin: 0 3px 3px 0; padding: 0 7px; border-radius: 6px; font-size: 11px; line-height: 1.8;
    background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.why-word { color: var(--text); }
.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 12px; }
.tag-grid .check { margin: 0; font-size: 13px; }
.source-overview td { padding: 8px 6px; font-size: 14px; }
.source-overview td:first-child { width: 1%; white-space: nowrap; }
.src-state { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.src-state.on { color: var(--ok); border-color: var(--ok); }
.src-state.off { color: var(--bad); border-color: var(--bad-weak); }
button[data-busy]:disabled { opacity: .7; cursor: progress; }

/* Zdroje — verdikty AI (D-42) */
.badge-pending { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--border); }
.src-line { margin-top: 6px; }
.ai-reason { font-size: 13px; margin-top: 4px; color: var(--text); max-width: 640px; }
table.sources tr.row-ceka td:first-child { border-left-color: var(--border); border-left-style: dashed; }
.btn-maybe:hover, .btn-maybe.active { border-color: var(--warn); color: var(--warn); }
.btn-maybe.active { background: var(--warn-weak); }
.btn-yes.active { background: var(--ok-weak); color: var(--ok); border-color: var(--ok); }
.stat-sub { font-size: 14px; font-weight: 500; color: var(--muted); }
.src-ezak { background: rgba(242, 166, 90, .14); color: var(--warn); }
.src-vvz { background: var(--neutral-weak); color: var(--text); border: 1px solid var(--border); }
.src-ezakazky { background: var(--bad-weak); color: var(--bad); }

/* Profily zadavatelů (D-43) */
.profile-add { display: flex; gap: 6px; }
.profile-add input[type=text] { flex: 1; min-width: 180px; font-size: 13px; padding: 5px 8px; }
.profile-customers td { min-width: 200px; }
.suggest-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.suggest-list li { padding: 3px 0; }
.suggest-list form.inline { margin-left: 4px; }
details.card > summary { cursor: pointer; }

/* Výtah AI ze zadávací dokumentace (D-49) */
.rec { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.rec-go { background: var(--ok-weak); color: var(--ok); }
.rec-maybe { background: var(--warn-weak); color: var(--warn); }
.rec-no { background: var(--neutral-weak); color: var(--muted); }
.rec-line { margin: 0 0 8px; }
details.doc-sum { margin-top: 5px; font-size: 13px; }
details.doc-sum > summary { cursor: pointer; color: var(--link); }
details.doc-sum .extract { margin-top: 6px; }

/* Konkurence (D-50) */
.filters-competition { grid-template-columns: 2fr minmax(160px, 1fr) auto; }
table.competition details.winner > summary { cursor: pointer; }
.award-list { margin: 8px 0 4px; padding-left: 18px; font-size: 13px; }
.award-list li { margin-bottom: 6px; }
table.competition tr.row-ours td { background: var(--accent-weak); }

/* Konkurence · Naše nabídky · Opakované zakázky (D-53, D-54) */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: -4px 0 16px; border-bottom: 1px solid var(--border); }
.subnav a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--text); border-bottom-color: var(--accent); }
.deadline-overdue { color: var(--warn); font-weight: 600; }
table.recurring tr.row-hidden td { opacity: .55; }
.outcome ul.plain { list-style: none; padding: 0; margin: 6px 0; }
.outcome ul.plain li { margin: 2px 0; }

/* Dashboard s dlaždicemi (D-55): pozice a velikost jen třídami (CSP bez inline stylů). */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-hint { margin: -6px 0 14px; }
.dash-add { position: relative; }
.dash-add summary { list-style: none; cursor: pointer; }
.dash-add summary::-webkit-details-marker { display: none; }
.dash-add-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 320px; max-height: 60vh; overflow: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
}
.dash-add-item {
    display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px;
    background: transparent; color: var(--text); cursor: pointer; font: inherit;
}
.dash-add-item:hover, .dash-add-item:focus { background: var(--surface-3); }
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 132px; grid-auto-flow: row dense; gap: 16px; }
.tile {
    position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tile.w-1 { grid-column: span 1; } .tile.w-2 { grid-column: span 2; } .tile.w-3 { grid-column: span 3; } .tile.w-4 { grid-column: span 4; }
.tile.h-1 { grid-row: span 1; } .tile.h-2 { grid-row: span 2; } .tile.h-3 { grid-row: span 3; } .tile.h-4 { grid-row: span 4; }
.tile-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; }
.tile-head h2 { flex: 1; margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-handle, .tile-hide {
    border: 0; background: transparent; color: var(--muted); cursor: grab; font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 6px;
}
.tile-hide { cursor: pointer; opacity: 0; }
.tile:hover .tile-hide, .tile-hide:focus { opacity: 1; }
.tile-handle:hover, .tile-hide:hover, .tile-handle:focus-visible { background: var(--surface-3); color: var(--text); }
.tile-handle { touch-action: none; }
.tile-body { flex: 1; min-height: 0; overflow: auto; padding: 2px 14px 12px; }
.tile-resize {
    position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none;
    border-right: 2px solid var(--border); border-bottom: 2px solid var(--border); border-bottom-right-radius: 6px;
}
.tile:hover .tile-resize { border-color: var(--muted); }
.tile.is-dragging { opacity: .6; outline: 2px dashed var(--accent); }
.tile.is-resizing { outline: 2px dashed var(--accent); }
.dash-grid.is-busy { user-select: none; }
.tile-list { list-style: none; margin: 0; padding: 0; }
.tile-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.tile-list li:last-child { border-bottom: 0; }
.tile-list .sub { font-size: 12px; color: var(--muted); }
ol.tile-rank { list-style: decimal inside; }
.tile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; height: 100%; align-items: center; }
.tile-stats a { display: flex; flex-direction: column; color: var(--text); }
.tile-stats a:hover { text-decoration: none; color: var(--accent); }
.tile-stats strong, .tile-big strong { font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-stats span, .tile-big span { color: var(--muted); font-size: 13px; }
.tile-big { display: flex; flex-direction: column; margin: 4px 0 8px; }
.tile-cal { margin: 0; font-size: 13px; }
.tile-cal dt { font-weight: 600; margin-top: 8px; }
.tile-cal dd { margin: 2px 0 0 0; }
.tile-search { display: flex; gap: 6px; margin: 6px 0; }
.tile-search input { flex: 1; min-width: 0; }
@media (max-width: 1000px) {
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile.w-3, .tile.w-4 { grid-column: span 2; }
}
@media (max-width: 640px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
    .tile.w-1, .tile.w-2, .tile.w-3, .tile.w-4 { grid-column: span 1; }
    .tile.h-1, .tile.h-2, .tile.h-3, .tile.h-4 { grid-row: auto; }
    .tile-body { max-height: 420px; }
    .tile-resize, .dash-hint { display: none; }
    .tile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Kalendář lhůt (D-57) */
.cal-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }

/* Novinky (D-58) */
.app-footer { max-width: 1400px; margin: 24px auto 16px; padding: 0 24px; text-align: right; }
.app-footer a { color: inherit; }
.news-release { padding: 4px 0 10px; border-bottom: 1px solid var(--border); }
.news-release:last-child { border-bottom: 0; }
.news-release h2 { font-size: 17px; margin: 10px 0 6px; }
.news-version { font-variant-numeric: tabular-nums; }
.news-release ul { margin: 0; padding-left: 20px; }
.news-release li { margin: 3px 0; }
.news-release.is-new h2 .news-version { color: var(--accent); }

/* ------------------------------------------------------------------------------------------
   Responzivita celé aplikace (D-59): menu pod tlačítkem, tabulky zakázek jako karty na mobilu,
   žádné vodorovné posouvání stránky, větší dotykové plochy, 16px písmo v polích (iOS nezoomuje).
   ------------------------------------------------------------------------------------------ */
.nav-toggle {
    display: none; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; border: 1px solid #3a424d;
    background: transparent; color: #cfd6de; font: inherit; font-size: 14px; cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent-strong); color: #fff; }
.nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f2a65a; }
.nav a { white-space: nowrap; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.layout-detail > * { min-width: 0; }
.card { min-width: 0; }
img { max-width: 100%; height: auto; }
.watch-dialog { max-width: calc(100vw - 24px); }

/* Podmenu (D-60): <details> v menu — na počítači rozbalovací nabídka, v mobilním menu rozbalení na místě. */
.nav { align-items: center; }
.nav-group { position: relative; }
.nav-group > summary {
    list-style: none; cursor: pointer; padding: 7px 12px; border-radius: 6px; color: #aab3bf; font-size: 14px;
    white-space: nowrap; user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover, .nav-group[open] > summary { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-group.active > summary { background: rgba(110, 180, 63, .18); color: #a6dd7c; font-weight: 600; }
.nav-caret { font-size: 11px; opacity: .8; }
.nav-menu {
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 250px; padding: 6px;
    background: var(--topbar); border: 1px solid #2f3742; border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
    display: flex; flex-direction: column; gap: 2px;
}
.nav-menu a { display: block; padding: 8px 10px; border-radius: 6px; white-space: normal; }
.nav-hint { display: block; font-size: 12px; font-weight: 400; color: #7d8794; }
.nav-menu a.active .nav-hint { color: #8fbf6c; }

@media (max-width: 1100px) {
    .filters, .filters-sources, .filters-competition { grid-template-columns: 1fr 1fr; }
    .filters > .field:first-child { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .nav-toggle { display: inline-flex; }
    .topbar-inner { gap: 10px; }
    .userbox { margin-left: auto; }
    .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 0 10px; }
    .topbar.nav-open .nav { display: flex; }
    .nav a, .nav-group > summary { padding: 10px 12px; font-size: 15px; }
    .nav-menu { position: static; min-width: 0; margin: 2px 0 6px 12px; padding: 0 0 0 8px; border: 0; border-left: 2px solid #2f3742; border-radius: 0; box-shadow: none; background: transparent; }
}

@media (max-width: 900px) {
    .layout-detail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .nav { overflow-x: visible; flex-wrap: nowrap; }
    .topbar-inner, main { padding-left: 14px; padding-right: 14px; }
    main { padding-top: 16px; }
    .card { padding: 14px; border-radius: 8px; }
    h1 { font-size: 21px; }
    .lead { font-size: 14px; }
    input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], select, textarea { font-size: 16px; }
    .btn { min-height: 40px; }
    .btn-small { min-height: 34px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 12px; }
    .stat-value { font-size: 24px; }
    .detail-actions .btn { flex: 1 1 auto; justify-content: center; }
    .copy-row { flex-wrap: wrap; }
    .copy-row input { min-width: 0; flex-basis: 100%; }
    .app-footer { text-align: center; padding: 0 14px; }
    .subnav { overflow-x: auto; flex-wrap: nowrap; }
    .subnav a { white-space: nowrap; }
    .dash-head .dash-tools { width: 100%; }
}

@media (max-width: 640px) {
    .filters, .filters-sources, .filters-competition { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .filters .actions { grid-column: 1 / -1; justify-content: stretch; }
    .filters .actions .btn { width: 100%; justify-content: center; }
    .filters label { font-size: 13px; }

    /* Tabulky zakázek (z mailů i z portálů) jako karty. */
    .table-wrap:has(table.tenders) { overflow-x: visible; }
    table.tenders, table.tenders tbody { display: block; width: 100%; }
    table.tenders thead { display: none; }
    table.tenders tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: start;
        padding: 12px 12px 12px 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
    }
    table.tenders td { display: block; padding: 0; border: 0; min-width: 0; width: auto; }
    table.tenders td:nth-child(1) { grid-column: 1; grid-row: 1; }
    table.tenders td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
    table.tenders td:nth-child(3) { grid-column: 1; grid-row: 3; }
    table.tenders td:nth-child(4) { grid-column: 2; grid-row: 3; text-align: right; }
    table.tenders:not(.sources) td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; }
    table.sources td:nth-child(5) { grid-column: 1 / -1; grid-row: 4; }
    table.tenders td:last-child { grid-column: 1 / -1; grid-row: 5; }
    table.tenders .row-actions-inner { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; min-width: 0; }
    table.tenders .row-actions-inner .btn, table.tenders .row-actions-inner form { flex: 1 1 auto; }
    table.tenders .title-cell a:first-child { font-size: 15px; }
    table.tenders tr { border-left-width: 4px; }
    table.tenders tbody tr td:first-child, table.tenders tbody tr[class] td:first-child { border-left: 0; padding-left: 0; }
    table.tenders tr.row-vhodna { border-left-color: var(--ok); }
    table.tenders tr.row-mozna { border-left-color: var(--warn); }
    table.sources tr.row-ceka { border-left-style: dashed; }

    /* Ostatní tabulky: posun do strany jen uvnitř karty, kompaktnější buňky. */
    .table-wrap table td, .table-wrap table th { padding: 8px 8px; }
    .facts { grid-template-columns: minmax(0, 1fr); }
}
