:root {
    --ink: #1c1917;
    --muted: #44403c;
    --line: #d6d3d1;
    --paper: #fafaf9;
    --panel: #ffffff;
    --link: #1e3a8a;
    --accent: #9f1239;
    --focus: #b45309;
    --ok: #14532d;
    --warn: #7c2d12;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Segoe UI", "Liberation Sans", Arial, sans-serif;
    line-height: 1.55;
}

img { max-width: 100%; height: auto; }

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

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.skip {
    position: absolute;
    left: 0.5rem;
    top: -4rem;
    background: #fff;
    color: #000;
    padding: 0.5rem 0.8rem;
    z-index: 20;
}

.skip:focus { top: 0.5rem; }

.wrap {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
}

.a11y-bar {
    background: #111827;
    color: #fafaf9;
}

.a11y-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.35rem 0;
}

.a11y-label {
    margin: 0 0.4rem 0 0;
    font-size: 0.85rem;
}

.a11y-bar button,
.btn,
button,
input,
select,
textarea {
    font: inherit;
}

.a11y-bar button,
.btn,
button[type="submit"] {
    background: #fff;
    color: #111827;
    border: 1px solid #111827;
    border-radius: 2px;
    padding: 0.2rem 0.55rem;
    cursor: pointer;
}

.a11y-bar button[aria-pressed="true"] {
    background: #fde68a;
}

.site-header {
    background: #fff;
    border-bottom: 4px solid var(--accent);
}

.header-grid {
    display: grid;
    grid-template-columns: auto 1fr minmax(16rem, 22rem);
    gap: 1.25rem;
    align-items: center;
    padding: 1rem 0;
}

.logo-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
}

.logo-link img { display: block; height: 58px; width: auto; }

.kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
}

.entity-name {
    margin: 0.15rem 0;
    font-size: 1.45rem;
    line-height: 1.2;
    font-weight: 700;
}

.entity-name a { color: inherit; text-decoration: none; }
.entity-name a:hover { text-decoration: underline; }

.entity-address { margin: 0; color: var(--muted); }

.required-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.search-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
}

.search-row { display: flex; gap: 0.4rem; }

.search-row input[type="search"] {
    flex: 1;
    min-width: 0;
    border: 1px solid #44403c;
    padding: 0.35rem 0.5rem;
    background: #fff;
}

.shell {
    display: grid;
    grid-template-columns: 18.5rem 1fr;
    gap: 1.5rem;
    padding: 1.5rem 0 2.5rem;
}

.menu {
    background: #fff;
    border: 1px solid var(--line);
    padding: 0.8rem 0.9rem 1rem;
}

.menu-title {
    margin: 0 0 0.6rem;
    font-size: 1rem;
}

.menu-group h3 {
    margin: 0.9rem 0 0.3rem;
    font-size: 0.92rem;
}

.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li { margin: 0.15rem 0; }
.menu a { text-decoration: none; }
.menu a:hover,
.menu a[aria-current="page"] { text-decoration: underline; }
.menu a[aria-current="page"] { font-weight: 700; }

.content h1 { margin-top: 0; font-size: 1.8rem; line-height: 1.25; }
.content h2 { font-size: 1.3rem; margin-top: 1.6rem; }
.content h3 { font-size: 1.1rem; }

.prose { max-width: 46rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin: 1.2rem 0;
}

.cards article {
    background: #fff;
    border: 1px solid var(--line);
    padding: 0.8rem 1rem;
}

.cards h2 { margin-top: 0; font-size: 1.05rem; }

.latest { list-style: none; padding: 0; }
.latest li { margin: 0.35rem 0; }
.latest time { display: inline-block; min-width: 11rem; color: var(--muted); }

.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.6rem; }
.breadcrumb a { color: var(--link); }

table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { border: 1px solid #a8a29e; padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
th { background: #f5f5f4; }
caption { text-align: left; font-weight: 700; margin-bottom: 0.4rem; }
.table-wrap { overflow-x: auto; }

.metryczka {
    margin-top: 2rem;
    background: #fff;
    border: 1px solid var(--line);
    padding: 0.8rem 1rem;
    max-width: 46rem;
}

.metryczka h2 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.metryczka dl { margin: 0; }
.metryczka dl > div { display: grid; grid-template-columns: 13rem 1fr; gap: 0.4rem; padding: 0.25rem 0; border-top: 1px solid var(--line); }
.metryczka dt { font-weight: 700; }
.metryczka dd { margin: 0; }

.history { margin-top: 1rem; max-width: 46rem; }
.attachments { max-width: 46rem; }

.results { list-style: none; padding: 0; }
.results li { margin: 0 0 1rem; }
mark { background: #fde68a; color: inherit; }

.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }

.site-footer {
    background: #111827;
    color: #f5f5f4;
    padding: 1.5rem 0 2rem;
}

.site-footer a { color: #fde68a; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 1.5rem; }
.site-footer h2 { font-size: 1rem; margin-top: 0; }
.site-footer ul { padding-left: 1.1rem; }
.site-footer p { margin: 0.4rem 0; }

@media (max-width: 860px) {
    .header-grid, .shell, .cards, .footer-grid, .metryczka dl > div {
        grid-template-columns: 1fr;
    }
    html { font-size: 17px; }
}

body.contrast {
    background: #000;
    color: #fff;
}

body.contrast a { color: #ffe14a; }
body.contrast .site-header,
body.contrast .menu,
body.contrast .cards article,
body.contrast .metryczka,
body.contrast table,
body.contrast th,
body.contrast td,
body.contrast .a11y-bar,
body.contrast .site-footer,
body.contrast .admin-top,
body.contrast .panel,
body.contrast .user-dialog {
    background: #000;
    color: #fff;
    border-color: #fff;
}

body.contrast .a11y-bar button,
body.contrast .btn,
body.contrast button,
body.contrast input,
body.contrast select,
body.contrast textarea {
    background: #000;
    color: #fff;
    border-color: #fff;
}

@media print {
    .a11y-bar, .menu, .search-form, .site-footer, .no-print { display: none !important; }
    .shell, .header-grid { display: block; }
    body { background: #fff; color: #000; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}

.admin-app { background: #f5f5f4; }
.admin-top {
    background: #111827;
    color: #fff;
    padding: 0.8rem 0;
}
.admin-top a { color: #fde68a; }
.admin-top .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.admin-main { padding: 1.2rem 0 3rem; }
.panel {
    background: #fff;
    border: 1px solid var(--line);
    padding: 1rem;
    margin: 0 0 1rem;
}
.notice { border-left: 4px solid var(--accent); padding: 0.6rem 0.8rem; background: #fff7ed; }
.notice.ok { border-color: var(--ok); background: #f0fdf4; }
.notice.warn { border-color: var(--warn); }
.form-grid { display: grid; gap: 0.7rem; max-width: 52rem; }
.form-grid label { font-weight: 700; display: block; }
.form-grid input[type="text"],
.form-grid input[type="password"],
.form-grid input[type="email"],
.form-grid input[type="date"],
.form-grid input[type="number"],
.form-grid input[type="url"],
.form-grid select,
.form-grid textarea {
    width: 100%;
    border: 1px solid #44403c;
    padding: 0.4rem 0.5rem;
    background: #fff;
}
.check { font-weight: 400; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.3rem; }
.editor-toolbar button { background: #fff; border: 1px solid #44403c; padding: 0.15rem 0.45rem; cursor: pointer; }
.visual-editor {
    min-height: 16rem;
    border: 1px solid #44403c;
    padding: 0.6rem;
    background: #fff;
}
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.login-box { max-width: 28rem; margin: 3rem auto; }
.inline-form { display: inline; }

.user-dialog {
    width: min(40rem, calc(100% - 2rem));
    border: 1px solid var(--line);
    padding: 0.4rem 1.2rem 1.2rem;
    background: #fff;
    color: var(--ink);
}

.user-dialog::backdrop { background: rgba(17, 24, 39, 0.55); }

.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.mfa-box { border: 1px solid var(--line); padding: 0.8rem; }

.mfa-box legend { font-weight: 700; padding: 0 0.3rem; }

.mfa-secret {
    font-family: ui-monospace, "Liberation Mono", monospace;
    letter-spacing: 0.04em;
    word-break: break-all;
}

.mfa-qr svg { display: block; width: 180px; height: 180px; background: #fff; }

.mfa-message { min-height: 1.2em; }
