:root {
    --ink: #1d2832;
    --ink-soft: #3e4d5c;
    --paper: #f3eee6;
    --paper-2: #fffcf7;
    --line: #ddd2c2;
    --wine: #5c2430;
    --wine-deep: #431924;
    --gold: #8d6b34;
    --ok: #1c5c3e;
    --ok-bg: #e5f2eb;
    --warn: #7a4e10;
    --warn-bg: #f8efd8;
    --bad: #8a2e2e;
    --bad-bg: #f8e6e4;
    --focus: #1f4e79;
    --shadow: 0 18px 40px rgba(29, 40, 50, 0.08);
    --serif: "Palatino Linotype", Palatino, Georgia, serif;
    --sans: "Segoe UI", "Helvetica Neue", sans-serif;
    --space: 1.25rem;
    color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    font-size: 1.125rem;
    line-height: 1.55;
    color: var(--ink);
    background:
        radial-gradient(1200px 400px at 10% -10%, rgba(140, 106, 50, 0.08), transparent 50%),
        var(--paper);
}
body:has(.site-nav.is-open) { overflow: hidden; }
img, svg { max-width: 100%; }
h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4vw, 3.1rem); margin: 0 0 0.6rem; }
h2 { font-size: 1.6rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.4rem; }
p { margin: 0 0 0.9rem; }
a { color: var(--wine); text-underline-offset: 0.18em; }
a:hover { color: var(--wine-deep); }
:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}
.skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    background: var(--ink);
    color: white;
    padding: 0.6rem 1rem;
    z-index: 20;
}
.skip:focus { top: 1rem; }

.site-header, .site-footer, #obsah { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.site-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: rgba(243, 238, 230, 0.94);
    z-index: 5;
}
.who {
    flex: 1 0 100%;
    margin: 0.15rem 0 0;
    padding: 0.35rem 0;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--ink);
}
.who:empty { display: none; }
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    min-height: 48px;
}
.brand:hover { color: inherit; }
.mark { width: 52px; height: 52px; color: var(--wine); flex: none; }
.brand-kicker {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
}
.brand-name {
    display: block;
    font-family: var(--serif);
    font-size: 1.45rem;
    line-height: 1;
}
.nav-toggle {
    margin-left: auto;
    display: none;
}
.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    margin-left: auto;
    align-items: center;
}
.site-nav a {
    color: var(--ink);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.15rem;
    border-bottom: 2px solid transparent;
}
.site-nav a[aria-current="page"] { border-color: var(--wine); color: var(--wine); }
.site-footer {
    padding: 2.5rem 0 2rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
}
#obsah { padding: 1.6rem 0 2rem; }

.hero { max-width: 40rem; margin-bottom: 1.5rem; }
.kicker {
    color: var(--gold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
}
.lede { font-size: 1.2rem; color: var(--ink-soft); }

.panel, .card, .sheet {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.panel, .sheet { padding: 1.25rem; }
.sheet { margin-bottom: 1rem; }
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.card {
    padding: 1.1rem 1.15rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border-top: 4px solid var(--wine);
    animation: rise 0.45s ease;
}
.card h2, .card h3 { font-size: 1.35rem; }
.card a.title {
    color: inherit;
    text-decoration: none;
}
.card a.title:hover { text-decoration: underline; }
.author { color: var(--ink-soft); margin-bottom: 0.6rem; }
.excerpt {
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card .actions, .row-actions { margin-top: auto; padding-top: 0.8rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0; }
.tag, .badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: #efe6d8;
    color: var(--ink);
    font-size: 0.92rem;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.overdue { background: #fff6f4; box-shadow: inset 4px 0 0 var(--bad); }

.filters, .form-grid, .inline-form { display: grid; gap: 0.8rem; }
.filters { grid-template-columns: 1.4fr 0.8fr 0.8fr auto; align-items: end; margin-bottom: 1rem; }
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--bad);
    background: #fff8f7;
    box-shadow: 0 0 0 3px rgba(138, 46, 46, 0.18);
}
.field-error,
.form-error {
    color: var(--bad);
    font-size: 1rem;
    margin: 0.15rem 0 0;
}
.form-error {
    background: var(--bad-bg);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
}
label, legend { font-weight: 650; }
input, select, textarea, button {
    font: inherit;
    color: inherit;
}
input, select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.55rem 0.75rem;
    border: 1px solid #c9bba8;
    border-radius: 12px;
    background: white;
}
textarea { min-height: 8rem; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.checks label { font-weight: 500; display: flex; gap: 0.45rem; align-items: center; min-height: 44px; }
.checks input { width: 1.15rem; height: 1.15rem; min-height: 0; }
button, .btn {
    min-height: 48px;
    padding: 0.55rem 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--wine);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
button:hover, .btn:hover { background: var(--wine-deep); color: white; }
.btn-ghost, button.btn-ghost {
    background: transparent;
    color: var(--wine);
    border-color: #c9b0b4;
}
.btn-ghost:hover, button.btn-ghost:hover { background: #f6ecec; color: var(--wine-deep); }
.btn-danger, button.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #6f2424; }
.actions, .subnav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.subnav a {
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--paper-2);
}
.subnav a[aria-current="page"] { border-color: var(--wine); color: var(--wine); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper-2); }
th, td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.92rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-soft); }
.pager { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 1rem; }
.pager a, .pager span {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--ink);
}
.pager [aria-current="page"] { background: var(--wine); color: white; border-color: var(--wine); }

.suggest { position: relative; }
.suggest ul {
    position: absolute;
    z-index: 4;
    left: 0;
    right: 0;
    margin: 0.25rem 0 0;
    padding: 0.3rem;
    list-style: none;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.suggest li button {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    color: var(--ink);
    border: 0;
    border-radius: 8px;
}
.suggest li button:hover, .suggest li button[aria-selected="true"] { background: #f6efe4; color: var(--ink); }
.muted { color: var(--ink-soft); }
.notice {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--warn-bg);
    color: var(--warn);
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.stat { padding: 1rem; }
.stat strong { display: block; font-family: var(--serif); font-size: 1.8rem; }
.chart { width: 100%; height: auto; margin: 0.5rem 0 1rem; }
.chart text { font-size: 14px; fill: var(--ink); font-family: var(--sans); }
.chart rect { fill: var(--wine); }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.help h2 { margin-top: 1.4rem; }
.secret {
    font-family: Consolas, "Courier New", monospace;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
    background: #f6efe4;
    padding: 0.8rem 1rem;
    border-radius: 12px;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%) translateY(120%);
    background: var(--ink);
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: min(36rem, calc(100% - 2rem));
    z-index: 30;
    transition: transform 0.25s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }
dialog {
    border: 0;
    border-radius: 18px;
    padding: 1.3rem;
    width: min(32rem, calc(100% - 2rem));
    background: var(--paper-2);
    color: var(--ink);
    box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(29, 40, 50, 0.48); }
dialog .actions { justify-content: flex-end; }
.empty { padding: 1.5rem; text-align: center; }

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 0;
        padding: 0.6rem 1rem 1rem;
        background: var(--paper);
        border-bottom: 1px solid var(--line);
        flex-direction: column;
        align-items: stretch;
    }
    .site-nav.is-open { display: flex; }
    .filters { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
@keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
