/* Free Validator: upload page and Report (layout A). Mobile first; no web fonts. */
:root {
    --bg: #eef1f4;
    --surface: #ffffff;
    --sunk: #f6f8fa;
    --ink: #17212c;
    --muted: #586678;
    --line: #d3dae2;
    --accent: #1d4f91;
    --err: #b3261e;
    --err-bg: #fbe9e7;
    --warn: #8f5300;
    --warn-bg: #fdf1dc;
    --ok: #17734a;
    --ok-bg: #e2f2e9;
    --info: #3d5a7a;
    --info-bg: #e7edf4;
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12171d;
        --surface: #1a2129;
        --sunk: #151b22;
        --ink: #e6ebf0;
        --muted: #9aa8b8;
        --line: #2e3945;
        --accent: #8db4ea;
        --err: #f08a80;
        --err-bg: #3a1f1d;
        --warn: #f0b860;
        --warn-bg: #352a17;
        --ok: #6fd1a0;
        --ok-bg: #16301f;
        --info: #9fb8d4;
        --info-bg: #1d2835;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
}

main {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 28px; margin-bottom: 16px; }
code { font-family: var(--font-mono); font-size: 0.85em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Upload form */
.upload {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
}
.upload label { flex-basis: 100%; font-weight: 600; }
.upload input { flex: 1 1 220px; min-width: 0; font: inherit; }
.upload .privacy { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); }
.upload button {
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
}

/* Sample invoices: secondary to the upload, so outlined buttons */
.samples { margin-top: 12px; padding: 0 16px; }
.samples h2 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.sample-buttons { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.sample-buttons form { margin: 0; }
.sample-buttons button {
    font: inherit;
    color: var(--accent);
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 6px 16px;
    cursor: pointer;
}
.samples .origin { margin: 8px 0 0; font-size: 14px; color: var(--muted); max-width: 70ch; }
.samples .origin a { color: inherit; }

/* Report */
.report { display: grid; gap: 28px; margin-top: 24px; }

/* #23 Tabs "Prüfbericht" / "Rechnung anzeigen" for an XRechnung: radio buttons, no JavaScript. */
.view-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: -12px; }
.view-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.view-tabs label {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: -1px;
}
.view-tabs input:checked + label { background: var(--surface); border-color: var(--line); color: var(--ink); }
.view-tabs input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.report:not(:has(#ansicht-rechnung:checked)) > .invoice-view { display: none; }
.report:has(#ansicht-rechnung:checked) > :not(.view-tabs, .invoice-view, footer) { display: none; }
.invoice-view iframe {
    display: block;
    width: 100%;
    height: 80vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    /* The official view has a light design of its own. */
    background: #fff;
}
.invoice-view .view-failed { margin: 0; padding: 14px 16px; border-radius: 8px; background: var(--warn-bg); }
.invoice-view .origin { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.invoice-view .origin a { color: inherit; }

.verdict {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px 18px;
    align-items: center;
    padding: 18px 20px;
    border-radius: 10px;
}
.verdict.err { background: var(--err-bg); }
.verdict.ok { background: var(--ok-bg); }
.verdict h2 { font-size: clamp(24px, 6vw, 34px); }
.verdict p { margin: 4px 0 0; max-width: 62ch; }
.light {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 28px;
    color: var(--surface);
}
.verdict.err .light { background: var(--err); }
.verdict.ok .light { background: var(--ok); }

.group h3 {
    font-size: 20px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    align-items: baseline;
}
.group h3 small { font-weight: 400; font-size: 14px; color: var(--muted); }

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.finding {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    display: grid;
    gap: 8px;
    min-width: 0;
}
.finding h4 { font-size: 17px; overflow-wrap: anywhere; }
.finding p { margin: 0; max-width: 68ch; overflow-wrap: anywhere; }
.finding .label { color: var(--muted); }
.fix { border-left: 3px solid var(--accent); padding-left: 10px; }
.fix b {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.pill {
    display: inline-block;
    vertical-align: middle;
    border-radius: 999px;
    padding: 1px 10px;
    margin-left: 4px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--info); }

details.tech summary { cursor: pointer; font-size: 14px; color: var(--accent); }
details.tech dl {
    margin: 8px 0 0;
    background: var(--sunk);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    display: grid;
    gap: 4px;
}
details.tech dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
details.tech dd { margin: 0 0 4px; overflow-wrap: anywhere; }

.report > footer {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    font-size: 14px;
    color: var(--muted);
}
.report > footer p { margin: 0 0 6px; max-width: 70ch; }
.report > footer b { color: var(--ink); font-weight: 500; }

/* Rule Pages and their index */
.rule-page h1 { margin-bottom: 8px; overflow-wrap: anywhere; }
.rule-page h2 { font-size: 20px; margin: 24px 0 8px; }
.rule-page p { margin: 0 0 12px; max-width: 68ch; overflow-wrap: anywhere; }
.rule-page .crumbs { font-size: 14px; margin-bottom: 12px; }
.rule-page .who { color: var(--muted); }
a { color: var(--accent); }
.rules { padding-left: 20px; display: grid; gap: 6px; }
.rules a { overflow-wrap: anywhere; }
.cta-box {
    margin-top: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
}
.cta {
    display: inline-block;
    font-weight: 600;
    color: var(--surface);
    background: var(--accent);
    border-radius: 6px;
    padding: 8px 20px;
    text-decoration: none;
}
.rule-page > footer {
    margin-top: 28px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
    font-size: 14px;
    color: var(--muted);
}
.rule-page > footer b { color: var(--ink); font-weight: 500; }
.finding .more { font-size: 14px; }

/* Not an E-Rechnung, Not Checkable, and a file turned away before checking */
.verdict.warn { background: var(--warn-bg); }
.verdict.warn .light { background: var(--warn); }
.reason-fix {
    margin: 0;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    max-width: 70ch;
}
.reason-fix b { display: block; }
.rejected {
    margin: 24px 0 0;
    padding: 14px 16px;
    background: var(--warn-bg);
    color: var(--ink);
    border-left: 4px solid var(--warn);
    border-radius: 8px;
}

/* A Report checked against a Preview Rule Set, or one whose version ends soon */
.preview-notice, .expiry-notice {
    margin: 0;
    padding: 14px 16px;
    background: var(--warn-bg);
    color: var(--ink);
    border-left: 4px solid var(--warn);
    border-radius: 8px;
    max-width: 70ch;
}
.preview-label { color: var(--warn); }

/* Hilfreich? Ja / Nein */
.helpful { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: var(--muted); }
.helpful button {
    font: inherit;
    color: var(--accent);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 12px;
    cursor: pointer;
}
.thanks { margin: 10px 0 0; font-size: 14px; color: var(--ok); }

/* Ergebnis falsch? Melden */
.wrong-result summary { cursor: pointer; font-size: 14px; color: var(--accent); }
.wrong-result form {
    display: grid;
    gap: 6px;
    margin-top: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 14px;
}
.wrong-result label { font-weight: 600; margin-top: 6px; }
.wrong-result label small { font-weight: 400; color: var(--muted); }
.wrong-result textarea, .wrong-result input { font: inherit; width: 100%; min-width: 0; box-sizing: border-box; }
.wrong-result .note { margin: 6px 0; color: var(--muted); max-width: 70ch; }
.wrong-result a { overflow-wrap: anywhere; }
.wrong-result button {
    justify-self: start;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
}

/* Bericht als Text kopieren / herunterladen: the buttons need report-tools.js, which marks <html class="js"> */
.report-tools { display: none; gap: 8px; }
.js .report-tools { display: grid; }
.report-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.report-buttons button {
    font: inherit;
    color: var(--accent);
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 6px 16px;
    cursor: pointer;
}
.report-status { font-size: 14px; color: var(--muted); }
.report-tools textarea {
    width: 100%;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
}

/* Admin view */
.admin h2 { font-size: 20px; margin: 28px 0 10px; }
.admin .scroll { overflow-x: auto; }
.admin table { border-collapse: collapse; background: var(--surface); font-size: 14px; }
.admin th, .admin td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.admin td + td { text-align: right; }
.wrong-results { padding-left: 20px; }
.wrong-results li { margin-bottom: 14px; }
.wrong-results .text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wrong-results .meta { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.wrong-results .rule-ids code + code { margin-left: 6px; }

/* Line for Software Vendors beside "your software" Findings: quiet, never a banner */
.vendor-hint { margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* Developer page and waitlist */
.developer p { max-width: 68ch; }
.developer .kicker { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--accent); }
.developer h1 { overflow-wrap: anywhere; }
.developer .lead { font-size: 18px; }
.developer h2 { font-size: 20px; margin: 28px 0 8px; }
.planned {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    border-radius: 999px;
    padding: 1px 10px;
    font-size: 13px;
    font-weight: 600;
    background: var(--warn-bg);
    color: var(--warn);
}
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan, .waitlist form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
}
.plan h3 { font-size: 18px; }
.plan .price { margin: 4px 0 8px; font-size: 22px; font-weight: 700; }
.plan ul { margin: 0; padding-left: 20px; }
.trial { color: var(--muted); }
.waitlist form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.waitlist label { flex-basis: 100%; font-weight: 600; }
.waitlist input { flex: 1 1 220px; min-width: 0; font: inherit; }
.waitlist .note { font-size: 14px; color: var(--muted); }
.waitlist .error { color: var(--err); font-weight: 600; }
.waitlist details summary { cursor: pointer; font-size: 14px; color: var(--accent); }
.waitlist details form { margin-top: 10px; }
.developer button {
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
}

/* Site footer on every page */
footer.site {
    max-width: 860px;
    margin: 0 auto;
    padding: 16px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--line);
    font-size: 14px;
}
footer.site nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }

/* Regelwerk-Änderungen: one entry per Rule Release, and notices that a version ends */
.rule-changes h1 { overflow-wrap: anywhere; }
.rule-changes .lead { max-width: 68ch; }
.rule-changes .end-notice {
    margin: 0 0 12px;
    padding: 14px 16px;
    background: var(--warn-bg);
    color: var(--ink);
    border-left: 4px solid var(--warn);
    border-radius: 8px;
    max-width: 70ch;
}
.rule-release { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 4px; }
.rule-release h2 { font-size: 20px; margin: 16px 0 6px; overflow-wrap: anywhere; }
.rule-release .meta { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.rule-release .status { font-weight: 600; color: var(--ok); }
.rule-release .status.angekuendigt { color: var(--warn); }
.rule-release .text { margin: 0 0 12px; max-width: 68ch; overflow-wrap: anywhere; }
