/* ---------------------------------------------------------------------------
 * Gemeinsames Aussehen der Unterlagen zur Kassensicherungsverordnung.
 *
 * Bewusst eine eigene Datei statt <style> je Seite: Es sind fünf Dokumente, die
 * nebeneinander gedruckt und gelesen werden – unterschiedliche Schriftgrade in
 * Bedienungsanleitung und Verfahrensdokumentation fielen einer Prüferin sofort
 * auf. Kein Tailwind, kein Build: Der Ordner liegt unter public/ und muss auch
 * dann noch stimmen, wenn die Website daneben neu gebaut wird.
 *
 * Farben sind die Tokens aus src/index.css, hier als Hex – eine statische Seite
 * hat keinen Zugriff auf die CSS-Variablen der Anwendung.
 * ------------------------------------------------------------------------- */

:root {
    --midnight-900: #0c1e2e;
    --midnight-800: #152736;
    --midnight-600: #213953;
    --ink-900: #161e27;
    --ink-700: #2c3744;
    --ink-500: #6b7785;
    --ink-400: #93a0ae;
    --ink-200: #d6dde6;
    --ink-100: #ebf0f5;
    --ink-50: #f5f7fa;
    --amber-600: #e8993a;
    --amber-50: #fef4e3;
    --sky-400: #3d9fd6;
    --sky-50: #e5f3fb;
    --coral-600: #c8364e;
    --coral-50: #fdeef1;
    --green-600: #1f8a5f;
    --green-50: #e8f6f0;
    --surface: #f7f9fc;

    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Menlo, monospace;

    --shadow-sm: 0 2px 8px rgba(20, 35, 55, 0.05);
    --shadow-md: 0 8px 24px rgba(20, 35, 55, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink-700);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

/* ------------------------------ Kopfzeile ------------------------------- */

.topbar {
    background: var(--midnight-800);
    color: #fff;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.topbar a { color: #cfdae4; text-decoration: none; }
.topbar a:hover { color: #fff; }

.topbar-brand {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
    color: #fff;
}

.topbar-brand span { color: var(--amber-600); }

.topbar-nav { display: flex; gap: 20px; font-size: 14px; flex-wrap: wrap; }
.topbar-nav a.current { color: #fff; border-bottom: 2px solid var(--amber-600); padding-bottom: 2px; }

/* -------------------------------- Kopf ---------------------------------- */

.pagehead {
    background: linear-gradient(180deg, var(--midnight-800) 0%, var(--midnight-600) 100%);
    color: #fff;
    padding: 56px 32px 48px;
}

.pagehead-inner { max-width: 980px; margin: 0 auto; }

.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--amber-600);
    margin-bottom: 14px;
}

.pagehead h1 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 16px;
}

.pagehead p.lead {
    font-size: 18px;
    line-height: 1.6;
    color: #c0cdd8;
    max-width: 70ch;
}

.docmeta {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    font-size: 13px;
    color: #93a8bb;
}

.docmeta b { color: #dbe4ec; font-weight: 500; }

/* ------------------------------- Layout --------------------------------- */

main { max-width: 980px; margin: 0 auto; padding: 48px 32px 96px; }

.layout { max-width: 1320px; margin: 0 auto; padding: 48px 32px 96px; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; align-items: start; }

.toc {
    position: sticky;
    top: 24px;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 10px;
    padding: 20px 18px;
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.toc h2 {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-400);
    margin-bottom: 12px;
}

.toc ol { list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: 2px; }
.toc a {
    display: block;
    padding: 5px 8px 5px 26px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--ink-500);
    text-decoration: none;
    border-radius: 6px;
    position: relative;
}
.toc a::before {
    content: counter(toc);
    position: absolute;
    left: 8px;
    color: var(--ink-400);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}
.toc a:hover { background: var(--ink-50); color: var(--midnight-800); }

/* ----------------------------- Textkörper -------------------------------- */

.doc > section { margin-bottom: 52px; scroll-margin-top: 24px; }

h2 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--midnight-800);
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ink-200);
}

h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 19px;
    letter-spacing: -0.01em;
    color: var(--midnight-800);
    margin: 32px 0 10px;
}

h4 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15.5px;
    color: var(--midnight-800);
    margin: 22px 0 8px;
}

p { margin-bottom: 14px; max-width: 78ch; }

ul, ol { margin: 0 0 16px 22px; max-width: 76ch; }
li { margin-bottom: 7px; }
li > ul, li > ol { margin-top: 7px; margin-bottom: 8px; }

a { color: #2d7fb0; }
a:hover { color: var(--sky-400); }

strong, b { color: var(--midnight-800); font-weight: 600; }

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--ink-100);
    border: 1px solid var(--ink-200);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--midnight-600);
    word-break: break-word;
}

hr { border: 0; border-top: 1px solid var(--ink-200); margin: 36px 0; }

/* ------------------------------ Tabellen -------------------------------- */

.tablewrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--ink-200); border-radius: 10px; background: #fff; }

table { border-collapse: collapse; width: 100%; font-size: 14.5px; }

th {
    text-align: left;
    font-weight: 600;
    color: var(--midnight-800);
    background: var(--ink-50);
    padding: 10px 14px;
    border-bottom: 1px solid var(--ink-200);
    white-space: nowrap;
}

td { padding: 10px 14px; border-bottom: 1px solid var(--ink-100); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

/* Leerzeile zum Ausfuellen: nur Hoehe und die ohnehin vorhandene Zeilenlinie.
   Eine Schraffur sah gedruckt wie ein Streifenmuster aus und machte die
   Handschrift darauf schlechter lesbar - das Gegenteil des Zwecks. */
table.fill td.blank { height: 34px; }
table.fill { table-layout: fixed; }
table.fill td, table.fill th { overflow-wrap: anywhere; }
table.fill th { white-space: normal; }

/* ------------------------------- Kästen --------------------------------- */

.note, .warn, .ok, .todo-box {
    border-radius: 10px;
    padding: 16px 18px;
    margin: 0 0 22px;
    font-size: 15px;
    border: 1px solid;
}

.note { background: var(--sky-50); border-color: #bcdcef; }
.warn { background: var(--amber-50); border-color: #f2d5a5; }
.ok { background: var(--green-50); border-color: #b6ded0; }
.todo-box { background: var(--coral-50); border-color: #f0c2cb; }

.note p:last-child, .warn p:last-child, .ok p:last-child, .todo-box p:last-child,
.note ul:last-child, .warn ul:last-child, .ok ul:last-child, .todo-box ul:last-child { margin-bottom: 0; }

.note h4, .warn h4, .ok h4, .todo-box h4 { margin-top: 0; }

/* Auszufüllende Stelle. Absichtlich auffällig: Eine Verfahrensdokumentation mit
   stehengebliebenem Platzhalter ist schlimmer als eine mit sichtbarer Lücke. */
mark.fillin {
    background: #fff3cd;
    border-bottom: 2px solid var(--amber-600);
    color: var(--midnight-800);
    padding: 0 4px;
    font-weight: 500;
    border-radius: 2px;
}

/* ------------------------------- Karten --------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 0 0 32px; }

.card {
    display: block;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--sky-400); }

.card-icon { font-size: 26px; line-height: 1; margin-bottom: 14px; }

.card-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 19px;
    letter-spacing: -0.01em;
    color: var(--midnight-800);
    margin-bottom: 8px;
}

.card-desc { font-size: 14.5px; color: var(--ink-500); line-height: 1.55; margin-bottom: 14px; }

.card-badge { font-size: 13px; font-weight: 600; color: #2d7fb0; }

/* ------------------------------ Schritte -------------------------------- */

ol.steps { list-style: none; counter-reset: step; margin-left: 0; }

ol.steps > li {
    counter-increment: step;
    position: relative;
    padding-left: 46px;
    margin-bottom: 22px;
}

ol.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--midnight-800);
    color: #fff;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

ol.steps > li > strong:first-child { display: block; color: var(--midnight-800); margin-bottom: 2px; }

/* ------------------------------- Pfade ---------------------------------- */

.path {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--midnight-800);
    color: #dbe4ec;
    border-radius: 6px;
    padding: 4px 10px;
}

.path b { color: #fff; font-weight: 600; }
.path i { color: var(--amber-600); font-style: normal; }

/* ------------------------------- Fußzeile ------------------------------- */

footer.docfoot {
    background: var(--midnight-900);
    color: #93a8bb;
    padding: 40px 32px;
    font-size: 14px;
}

footer.docfoot .inner { max-width: 980px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; }
footer.docfoot a { color: #cfdae4; }
footer.docfoot b { color: #fff; }

.print-hint {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--ink-500);
}

/* ------------------------------ Schmalbild ------------------------------ */

@media (max-width: 900px) {
    .layout { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 32px 20px 64px; }
    .toc { position: static; max-height: none; }
    main { padding: 32px 20px 64px; }
    .pagehead { padding: 40px 20px 36px; }
    .topbar { padding: 12px 20px; }
    footer.docfoot { padding: 32px 20px; }
}

/* -------------------------------- Druck --------------------------------- */
/* Die Unterlagen werden ausgedruckt oder als PDF an das Finanzamt gegeben –
   das ist der eigentliche Anwendungsfall, nicht das Lesen im Browser. */

@media print {
    :root { --surface: #fff; }

    body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.45; }

    .topbar, .toc, .print-hint { display: none !important; }

    .layout, main { display: block; max-width: none; padding: 0; margin: 0; }

    .pagehead {
        background: #fff !important;
        color: #000;
        padding: 0 0 16pt;
        border-bottom: 2pt solid #152736;
        margin-bottom: 20pt;
    }

    .pagehead h1 { color: #000; font-size: 22pt; }
    .pagehead p.lead { color: #333; font-size: 11pt; }
    .eyebrow { color: #666; }
    .docmeta { color: #444; }
    .docmeta b { color: #000; }

    h2 { font-size: 14pt; color: #000; page-break-after: avoid; break-after: avoid; }
    h3 { font-size: 12pt; color: #000; page-break-after: avoid; break-after: avoid; }
    h4 { page-break-after: avoid; break-after: avoid; }

    .doc > section { page-break-inside: auto; margin-bottom: 22pt; }

    /* Im Druck gibt es kein seitliches Scrollen: Der Rahmen darf nicht klippen,
       und die Kopfzeilen muessen umbrechen duerfen, sonst laeuft eine breite
       Formulartabelle (Anlage C) ueber den Seitenrand hinaus. */
    .tablewrap { overflow: visible; }
    table { font-size: 9pt; page-break-inside: auto; table-layout: fixed; }
    th { white-space: normal; }
    td, th { overflow-wrap: anywhere; }
    tr, li { page-break-inside: avoid; break-inside: avoid; }
    thead { display: table-header-group; }

    .note, .warn, .ok, .todo-box { border: 1pt solid #999; background: #fff !important; page-break-inside: avoid; }
    .card { break-inside: avoid; box-shadow: none; }
    .path { background: #eee; color: #000; border: 1pt solid #999; }
    .path b, .path i { color: #000; }

    a { color: #000; text-decoration: none; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }

    footer.docfoot { background: #fff; color: #000; border-top: 1pt solid #999; padding: 12pt 0 0; }
    footer.docfoot a, footer.docfoot b { color: #000; }
}
