/* Jednotný styl Evidsoft pro reporty (hlavička, patička, admin) a přetlak
   nad CSS vloženého artefaktu. Barvy a písmo odpovídají www.evidsoft.cz. */

:root {
    --es-navy: #0e1b36;
    --es-navy-deep: #04102e;
    --es-blue: #2369f0;
    --es-blue-soft: #e9f0fe;
    --es-ink: #0e1b36;
    --es-muted: #576583;
    --es-line: #e3e8f1;
    --es-bg: #f5f7fb;
    --es-surface: #ffffff;
    --es-green: #1f7a4d;
    --es-green-soft: #e6f4ec;
    --es-amber: #9a6b00;
    --es-amber-soft: #fff4d6;
    --es-red: #b4232c;
    --es-font: "Urbanist", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    --es-radius: 12px;
    --es-shadow: 0 1px 2px rgba(14, 27, 54, .05), 0 10px 30px -18px rgba(35, 105, 240, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--es-bg);
    color: var(--es-ink);
    font-family: var(--es-font);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--es-blue); }
h1, h2, h3 { font-family: var(--es-font); line-height: 1.15; margin: 0; letter-spacing: -.015em; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
h2 { font-size: 24px; font-weight: 800; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }

.es-container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.es-main { flex: 1; }
.es-page { padding: 40px 20px 72px; }
.es-muted { color: var(--es-muted); }
.es-nowrap { white-space: nowrap; }
.es-eyebrow {
    font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--es-blue);
}

/* ---------- hlavička ---------- */
.es-header {
    background: var(--es-surface);
    border-bottom: 1px solid var(--es-line);
    position: sticky; top: 0; z-index: 10;
}
.es-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.es-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--es-ink); }
.es-logo img { display: block; height: 36px; width: auto; }
.es-logo__app { font-weight: 700; color: var(--es-muted); font-size: 15px; padding-left: 10px; border-left: 1px solid var(--es-line); }
.es-header__meta { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.es-header__client { font-weight: 700; color: var(--es-ink); }
.es-header__back { color: var(--es-muted); text-decoration: none; }
.es-header__back:hover { color: var(--es-blue); }

/* ---------- patička ---------- */
.es-footer { background: var(--es-navy-deep); color: #c9d3e6; font-size: 15px; margin-top: auto; }
.es-footer__inner {
    display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; padding: 40px 20px 28px;
}
.es-footer__brand img { height: 30px; width: auto; opacity: .95; }
.es-footer__brand p { margin-top: 12px; max-width: 40ch; color: #9faecf; }
.es-footer__col { display: grid; gap: 4px; align-content: start; }
.es-footer__col strong { color: #fff; margin-bottom: 4px; }
.es-footer__col a { color: #c9d3e6; text-decoration: none; }
.es-footer__col a:hover { color: #fff; }
.es-footer__bottom {
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, .08); color: #7f8fb0; font-size: 13px;
}
@media (max-width: 720px) {
    .es-footer__inner { grid-template-columns: 1fr; gap: 20px; }
}

/* ---------- veřejná stránka klienta ---------- */
.es-hero { display: grid; gap: 12px; padding-bottom: 28px; border-bottom: 1px solid var(--es-line); margin-bottom: 32px; }
.es-lede { color: var(--es-muted); max-width: 62ch; font-size: 18px; }
.es-year { margin-bottom: 36px; }
.es-year__title { font-size: 15px; font-weight: 800; letter-spacing: .1em; color: var(--es-muted); margin-bottom: 12px; }
.es-months { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.es-month a {
    display: grid; grid-template-columns: 170px 1fr auto; gap: 16px; align-items: center;
    background: var(--es-surface); border: 1px solid var(--es-line); border-radius: var(--es-radius);
    padding: 16px 20px; text-decoration: none; color: var(--es-ink); box-shadow: var(--es-shadow);
    transition: border-color .15s, transform .15s;
}
.es-month a:hover { border-color: var(--es-blue); transform: translateY(-1px); }
.es-month__name { font-weight: 800; font-size: 18px; color: var(--es-blue); }
.es-month__title { font-weight: 500; }
.es-month__meta { font-size: 13px; color: var(--es-muted); white-space: nowrap; }
.es-month--draft a { border-style: dashed; opacity: .85; }
@media (max-width: 720px) {
    .es-month a { grid-template-columns: 1fr; gap: 4px; }
    .es-month__meta { white-space: normal; }
}
.es-empty {
    display: grid; gap: 4px; padding: 32px; text-align: center; color: var(--es-muted);
    background: var(--es-surface); border: 1px dashed var(--es-line); border-radius: var(--es-radius);
}
.es-empty strong { color: var(--es-ink); }

/* ---------- stránka reportu ---------- */
.es-report-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.es-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--es-line); }
.es-pager__link { display: grid; text-decoration: none; color: var(--es-ink); }
.es-pager__link small { color: var(--es-muted); font-size: 13px; }
.es-pager__link span { font-weight: 700; color: var(--es-blue); }
.es-pager__link--next { text-align: right; margin-left: auto; }

/* ---------- tlačítka, odznaky, flash ---------- */
.es-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
    background: var(--es-blue); color: #fff; font: inherit; font-weight: 700; font-size: 15px;
    border: 1px solid var(--es-blue); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.es-btn:hover { background: #1a56cc; border-color: #1a56cc; }
.es-btn--ghost { background: var(--es-surface); color: var(--es-ink); border-color: var(--es-line); }
.es-btn--ghost:hover { background: var(--es-blue-soft); border-color: var(--es-blue); color: var(--es-blue); }
.es-btn--danger { background: var(--es-surface); color: var(--es-red); border-color: var(--es-line); }
.es-btn--danger:hover { background: #fdeeef; border-color: var(--es-red); }
.es-link { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--es-blue); cursor: pointer; text-decoration: underline; }
.es-link--danger { color: var(--es-red); }
.es-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.es-badge--ok { background: var(--es-green-soft); color: var(--es-green); }
.es-badge--draft { background: var(--es-amber-soft); color: var(--es-amber); }
.es-flash { background: var(--es-green-soft); color: var(--es-green); border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; font-weight: 600; }
.es-flash--error { background: #fdeeef; color: var(--es-red); }

/* ---------- administrace ---------- */
.es-header--admin .es-header__inner { min-height: 64px; }
.es-nav { display: flex; align-items: center; gap: 4px; }
.es-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--es-muted); font-weight: 600; font-size: 15px; }
.es-nav a:hover, .es-nav a.is-active { background: var(--es-blue-soft); color: var(--es-blue); }
.es-nav__logout { display: flex; align-items: center; gap: 10px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--es-line); font-size: 14px; color: var(--es-muted); }
.es-nav__logout button { background: none; border: 0; padding: 0; font: inherit; color: var(--es-blue); cursor: pointer; }
.es-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.es-page-head h1 { font-size: clamp(24px, 3vw, 32px); }
.es-page-head .es-muted { margin-top: 6px; font-size: 15px; }
.es-section-title { font-size: 18px; margin: 32px 0 12px; }
.es-filter { margin-bottom: 16px; }
.es-filter select, .es-form input:not([type=checkbox]), .es-form select, .es-form textarea {
    font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--es-line); border-radius: 8px;
    background: var(--es-surface); color: var(--es-ink); width: 100%;
}
.es-form input:focus, .es-form select:focus, .es-form textarea:focus { outline: 2px solid var(--es-blue-soft); border-color: var(--es-blue); }
.es-form { display: grid; gap: 16px; max-width: 560px; }
.es-form--wide { max-width: 100%; }
.es-form--inline { grid-template-columns: repeat(auto-fit, minmax(160px, max-content)); align-items: end; max-width: 100%; margin-bottom: 24px; }
.es-form__row { display: flex; gap: 16px; flex-wrap: wrap; }
.es-form__field { display: grid; gap: 6px; }
.es-form__field > span { font-size: 13px; font-weight: 700; color: var(--es-muted); letter-spacing: .02em; }
.es-form__field--s { width: 180px; }
.es-form__field--m { width: 280px; }
.es-form__field--l { max-width: 640px; }
.es-form textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.45; resize: vertical; }
.es-form input[type=file] { padding: 8px; }
.es-form__actions { display: flex; gap: 10px; }
.es-form label.es-form__field, .es-form label { display: grid; gap: 6px; }
.es-check { display: flex !important; align-items: center; gap: 8px; font-size: 15px; }
.es-check input { width: auto; }
.es-help { font-size: 14px; color: var(--es-muted); max-width: 70ch; }
.es-login { max-width: 400px; margin: 40px auto; display: grid; gap: 14px; }
.es-table { width: 100%; border-collapse: collapse; background: var(--es-surface); border: 1px solid var(--es-line); border-radius: var(--es-radius); overflow: hidden; font-size: 15px; }
.es-table th, .es-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--es-line); vertical-align: top; }
.es-table th { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--es-muted); background: var(--es-bg); }
.es-table tr:last-child td { border-bottom: 0; }
.es-actions { display: flex; gap: 12px; flex-wrap: wrap; white-space: nowrap; }
.es-actions--buttons { align-items: center; }
.es-actions form { display: inline; }
.es-code { display: inline-block; background: var(--es-bg); border: 1px solid var(--es-line); border-radius: 6px; padding: 2px 8px; font-size: 13px; word-break: break-all; }
.es-linkbox { display: grid; gap: 12px; background: var(--es-surface); border: 1px solid var(--es-line); border-radius: var(--es-radius); padding: 18px 20px; margin-bottom: 8px; font-size: 15px; }
.es-linkbox code { display: block; margin-top: 4px; word-break: break-all; color: var(--es-blue); }
.es-linkbox .es-btn { justify-self: start; }
.es-preview-frame { background: var(--es-bg); border: 1px dashed var(--es-line); border-radius: var(--es-radius); padding: 8px; }
.pagination { display: flex; gap: 6px; margin-top: 16px; list-style: none; padding: 0; }

/* ---------- tělo reportu: přetlak nad CSS artefaktu ----------
   Scopované CSS artefaktu je v <head> až za tímto souborem, proto zvýšená specificita. */
.es-main .report-body,
.es-print .report-body,
.es-preview-frame .report-body {
    --bg: transparent;
    --surface: #ffffff;
    --surface-2: #f5f7fb;
    --ink: #0e1b36;
    --text: #0e1b36;
    --muted: #576583;
    --line: #e3e8f1;
    --border: #e3e8f1;
    --accent: #2369f0;
    --accent-soft: #e9f0fe;
    --primary: #2369f0;
    --good: #1f7a4d;
    --good-soft: #e6f4ec;
    --success: #1f7a4d;
    --info: #2369f0;
    --info-soft: #e9f0fe;
    --warn: #9a6b00;
    --warn-soft: #fff4d6;
    --shadow: 0 1px 2px rgba(14, 27, 54, .05), 0 10px 30px -18px rgba(35, 105, 240, .25);
    background: transparent;
    color: var(--es-ink);
    font-size: 17px;
    line-height: 1.6;
    padding: 0;
    margin: 0;
}
.es-main .report-body,
.es-main .report-body *,
.es-print .report-body,
.es-print .report-body *,
.es-preview-frame .report-body,
.es-preview-frame .report-body * {
    font-family: var(--es-font) !important;
}
.report-body .page, .report-body .container, .report-body .wrap, .report-body .wrapper, .report-body main {
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
}
.report-body img { max-width: 100%; height: auto; }

/* Výchozí vzhled pro report vložený jako Markdown. */
.report-body .md { display: grid; gap: 14px; max-width: 860px; }
.report-body .md h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; margin: 8px 0 4px; }
.report-body .md h2 { font-size: 24px; font-weight: 800; margin-top: 28px; padding-bottom: 8px; border-bottom: 1px solid var(--es-line); }
.report-body .md h3 { font-size: 18px; font-weight: 800; margin-top: 12px; }
.report-body .md ul, .report-body .md ol { margin: 0; padding-left: 24px; display: grid; gap: 6px; }
.report-body .md blockquote { margin: 0; padding: 12px 18px; background: var(--es-green-soft); border-left: 4px solid var(--es-green); border-radius: 8px; }
.report-body .md table { border-collapse: collapse; width: 100%; background: #fff; border: 1px solid var(--es-line); border-radius: 10px; overflow: hidden; font-size: 15px; }
.report-body .md th, .report-body .md td { padding: 10px 12px; border-bottom: 1px solid var(--es-line); text-align: left; vertical-align: top; }
.report-body .md th { background: var(--es-bg); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--es-muted); }
.report-body .md hr { border: 0; border-top: 1px solid var(--es-line); margin: 12px 0; }
.report-body .md pre { background: #0e1b36; color: #e8eef7; padding: 14px 16px; border-radius: 10px; overflow: auto; font-size: 13px; }
.report-body .md code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace !important; }

/* ---------- tisk / PDF ---------- */
.es-print { display: block; background: #fff; }
.es-print__toolbar {
    position: sticky; top: 0; display: flex; gap: 16px; align-items: center; justify-content: center;
    background: var(--es-navy); color: #fff; padding: 10px 16px; font-size: 14px;
}
.es-print__toolbar button { font: inherit; font-weight: 700; padding: 6px 14px; border-radius: 999px; border: 0; background: var(--es-blue); color: #fff; cursor: pointer; }
.es-print__toolbar a { color: #c9d3e6; }
.es-print__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 860px; margin: 28px auto 20px; padding: 0 20px 16px; border-bottom: 2px solid var(--es-navy); }
.es-print__head img { height: 32px; width: auto; }
.es-print__head div { display: grid; text-align: right; }
.es-print__head span { color: var(--es-muted); font-size: 14px; }
.es-print .report-body { max-width: 860px; margin: 0 auto; padding: 0 20px; }
.es-print__foot { max-width: 860px; margin: 32px auto 40px; padding: 12px 20px 0; border-top: 1px solid var(--es-line); color: var(--es-muted); font-size: 12px; }

@media print {
    body { background: #fff; font-size: 12pt; }
    .es-header, .es-footer, .es-report-bar__actions, .es-pager, .es-print__toolbar { display: none !important; }
    .es-print__head { margin-top: 0; }
    .es-page { padding: 0; }
    .report-body .card, .report-body section > * { break-inside: avoid; }
    .report-body h2, .report-body h3 { break-after: avoid; }
    a { color: inherit; text-decoration: none; }
}
