/* WordPress Update Server - Admin-Oberflaeche
 *
 * Die Gestaltung folgt dem Auftritt von heinsen-it.de und der Bildmarke HIT:
 * ein kuehl-heller Grund, weisse Flaechen mit einem Hauch Schatten, das
 * Blau der Klammern als einziger Akzent und das Navy des Schriftzugs fuer
 * Titel. Flaechen werden durch Haarlinien getrennt, Ecken sind nur leicht
 * gerundet (wie auf der Webseite), Marken sind runde Pillen. Daten wie
 * Schluessel, Versionen und Pfade stehen in Monospace.
 *
 * Schrift: fuer Titel Roboto wie auf der Webseite - aber nur, wenn sie auf
 * dem Rechner vorhanden ist. Es wird nichts von fremden Servern nachgeladen;
 * fehlt Roboto, uebernimmt die Systemschrift.
 *
 * Farbschema: Standard ist die Systemeinstellung. Ein Umschalter im Kopf
 * setzt data-theme="light" bzw. "dark" am <html>; der Wert wird im Browser
 * gespeichert (assets/app.js). Deshalb gibt es jede Farbe dreimal: hell,
 * dunkel per Systemeinstellung, dunkel per Umschalter. Die Webseite selbst
 * kennt nur Hell - das dunkle Schema ist aus dem Navy der Marke entwickelt.
 *
 * Die Klassen der Vorlagen sind die des Update-Servers (.state, .table,
 * .form-grid, .code ...) - die Kundenplattform-Namen (.badge, .daten) gibt
 * es daneben, damit sich Vorlagen zwischen beiden Anwendungen austauschen
 * lassen.
 */

/* Farben und Masse -------------------------------------------------- */

:root {
    color-scheme: light;

    /* Die beiden Farben der Bildmarke - in beiden Schemata dieselben. */
    --marke-blau: #2e6fd9;
    --marke-navy: #0c2340;

    /* Das Logo im Kopf: Klammern und Schriftzug getrennt steuerbar. */
    --logo-rahmen: var(--marke-blau);
    --logo-wort: var(--marke-navy);

    --papier: #f3f5f8;
    --papier-glanz: rgba(46, 111, 217, .07);
    --flaeche: #ffffff;
    --flaeche-glas: rgba(255, 255, 255, .86);
    --flaeche-2: #f1f4f8;
    --flaeche-3: #e7ecf3;
    --eingabe: #ffffff;

    --tinte: #1b2733;
    --tinte-2: #54595f;
    --gedaempft: #7a828c;
    --titel: var(--marke-navy);
    --linie: #e2e8f0;
    --linie-stark: #c7d1de;

    --akzent: #1e73be;
    --akzent-hover: #155a96;
    --akzent-flaeche: #e9f1fb;
    --akzent-linie: rgba(46, 111, 217, .35);
    --fokus-ring: rgba(46, 111, 217, .25);

    --knopf: #2e6fd9;
    --knopf-hover: #245ab0;
    --knopf-text: #ffffff;

    --ok: #0b7a3b;
    --ok-flaeche: #e4f3ea;
    --ok-linie: #bfe0cc;
    --warnung: #9a5a00;
    --warnung-flaeche: #fbf0dd;
    --warnung-linie: #ecd6a8;
    --fehler: #b3261e;
    --fehler-flaeche: #fbe9e7;
    --fehler-linie: #efc2bd;
    --info: #1e73be;
    --info-flaeche: #e7f0fa;
    --info-linie: #bcd4ec;

    --log-grund: #0c2340;
    --log-text: #d7e3f4;
    --schatten-scroll: rgba(12, 35, 64, .16);
    --schatten-karte: 0 1px 2px rgba(12, 35, 64, .04), 0 2px 10px rgba(12, 35, 64, .05);
    --schatten-schwebend: 0 1px 2px rgba(12, 35, 64, .06), 0 12px 32px -16px rgba(12, 35, 64, .3);

    --zeige-sonne: block;
    --zeige-mond: none;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2354595f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");

    --schrift: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --schrift-titel: Roboto, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
    --schrift-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 6px;
    --radius-klein: 4px;
    --kopf-hoehe: 60px;
    /* Breit genug, dass Tabellenspalten und Formularfelder nebeneinander
       atmen koennen - der Admin zeigt Daten, keinen Fliesstext. */
    --breite: 1560px;
    --breite-schmal: 820px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --logo-rahmen: #4e8bea;
        --logo-wort: #eaf0f8;

        --papier: #0b1726;
        --papier-glanz: rgba(78, 139, 234, .13);
        --flaeche: #11213a;
        --flaeche-glas: rgba(11, 23, 38, .84);
        --flaeche-2: #16273e;
        --flaeche-3: #1d3150;
        --eingabe: #0e1d31;

        --tinte: #e8eef7;
        --tinte-2: #c0cbdb;
        --gedaempft: #8c9ab0;
        --titel: #eaf0f8;
        --linie: #1e3149;
        --linie-stark: #2d4563;

        --akzent: #6ba6f5;
        --akzent-hover: #93bffa;
        --akzent-flaeche: #16304f;
        --akzent-linie: rgba(107, 166, 245, .4);
        --fokus-ring: rgba(107, 166, 245, .3);

        --knopf: #2e6fd9;
        --knopf-hover: #4b86e8;
        --knopf-text: #ffffff;

        --ok: #5fcf8e;
        --ok-flaeche: #112d20;
        --ok-linie: #22513a;
        --warnung: #e3b35f;
        --warnung-flaeche: #2d2512;
        --warnung-linie: #4b3d1c;
        --fehler: #f08a80;
        --fehler-flaeche: #331b1b;
        --fehler-linie: #562c29;
        --info: #6ba6f5;
        --info-flaeche: #16263c;
        --info-linie: #27405f;

        --log-grund: #081322;
        --log-text: #cfdcee;
        --schatten-scroll: rgba(0, 0, 0, .55);
        --schatten-karte: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 12px rgba(0, 0, 0, .3);
        --schatten-schwebend: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .7);

        --zeige-sonne: none;
        --zeige-mond: block;
        --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23c0cbdb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --logo-rahmen: #4e8bea;
    --logo-wort: #eaf0f8;

    --papier: #0b1726;
    --papier-glanz: rgba(78, 139, 234, .13);
    --flaeche: #11213a;
    --flaeche-glas: rgba(11, 23, 38, .84);
    --flaeche-2: #16273e;
    --flaeche-3: #1d3150;
    --eingabe: #0e1d31;

    --tinte: #e8eef7;
    --tinte-2: #c0cbdb;
    --gedaempft: #8c9ab0;
    --titel: #eaf0f8;
    --linie: #1e3149;
    --linie-stark: #2d4563;

    --akzent: #6ba6f5;
    --akzent-hover: #93bffa;
    --akzent-flaeche: #16304f;
    --akzent-linie: rgba(107, 166, 245, .4);
    --fokus-ring: rgba(107, 166, 245, .3);

    --knopf: #2e6fd9;
    --knopf-hover: #4b86e8;
    --knopf-text: #ffffff;

    --ok: #5fcf8e;
    --ok-flaeche: #112d20;
    --ok-linie: #22513a;
    --warnung: #e3b35f;
    --warnung-flaeche: #2d2512;
    --warnung-linie: #4b3d1c;
    --fehler: #f08a80;
    --fehler-flaeche: #331b1b;
    --fehler-linie: #562c29;
    --info: #6ba6f5;
    --info-flaeche: #16263c;
    --info-linie: #27405f;

    --log-grund: #081322;
    --log-text: #cfdcee;
    --schatten-scroll: rgba(0, 0, 0, .55);
    --schatten-karte: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 12px rgba(0, 0, 0, .3);
    --schatten-schwebend: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .7);

    --zeige-sonne: none;
    --zeige-mond: block;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23c0cbdb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}

/* Grundlagen --------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--kopf-hoehe) + 16px);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--papier);
    /* Ein Hauch Akzent oben - gibt der Seite Tiefe, ohne dass es ein Bild braucht. */
    background-image: radial-gradient(1100px 380px at 50% -120px, var(--papier-glanz), transparent 70%);
    background-repeat: no-repeat;
    color: var(--tinte);
    font-family: var(--schrift);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; width: 100%; }

.wrap {
    width: 100%;
    max-width: var(--breite);
    margin: 0 auto;
    padding: 0 28px;
}

.wrap-narrow { max-width: var(--breite-schmal); }

main.wrap { padding-top: 36px; padding-bottom: 48px; }

a {
    color: var(--akzent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--akzent-linie);
    text-underline-offset: 3px;
}

a:hover { color: var(--akzent-hover); text-decoration-color: currentColor; }

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

::selection { background: var(--akzent-flaeche); color: var(--tinte); }

@media (prefers-reduced-motion: no-preference) {
    a, .button, button, input, select, textarea, .theme-toggle, .mainnav a, summary {
        transition: color .15s ease, background-color .15s ease, border-color .15s ease,
                    box-shadow .15s ease, transform .15s ease, opacity .15s ease;
    }
}

/* Schrift ------------------------------------------------------------ */

h1, h2, h3, h4 { color: var(--tinte); }

h1 {
    font-family: var(--schrift-titel);
    font-weight: 600;
    font-size: 1.95rem;
    line-height: 1.18;
    letter-spacing: -.015em;
    color: var(--titel);
    margin: 0 0 6px;
}

/* Abschnittstitel in Flaechen: kleines, gesperrtes Etikett mit Haarlinie.
   Blau wie die Abschnittstitel auf heinsen-it.de. */
h2 {
    font-family: var(--schrift-titel);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--akzent);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--linie);
}

/* Mehrere Abschnitte in einer Flaeche: die weiteren bekommen Luft nach oben. */
.card > * + h2, .block + .block > h2 { margin-top: 28px; }

/* Unterabschnitte innerhalb einer Flaeche: eine Haarlinie trennt sie vom
   Vorhergehenden - ausser sie stehen ganz oben. */
h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 26px 0 12px;
    padding-top: 18px;
    border-top: 1px solid var(--linie);
}

h2 + h3, h3:first-child, .notice + h3, .page-head + h3 {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

h4 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

ul, ol { margin: 0 0 12px; padding-left: 22px; }
li { margin-bottom: 4px; }

code {
    font-family: var(--schrift-mono);
    font-size: .9em;
    background: var(--flaeche-2);
    border: 1px solid var(--linie);
    border-radius: 5px;
    padding: 1px 5px;
    overflow-wrap: anywhere;
}

pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.muted { color: var(--gedaempft); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: var(--schrift-mono); font-size: .93em; }
.eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--akzent);
    margin: 0 0 10px;
}

/* Sprunglink fuer Tastatur und Vorleseprogramme - erscheint erst beim Fokus. */
.skip {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 60;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--tinte);
    color: var(--papier);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.skip:focus { top: 12px; outline-color: var(--akzent); }

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--linie);
}

/* Der Glaseffekt liegt auf einem eigenen Element hinter dem Inhalt. */
.topbar::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    background: var(--flaeche-glas);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: var(--kopf-hoehe);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: var(--tinte);
    font-weight: 600;
    letter-spacing: -.01em;
    text-decoration: none;
    white-space: nowrap;
}

.brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand:hover { color: var(--tinte); }

/* Die Bildmarke: das Logo steht als SVG direkt in der Seite, damit
   Klammern und Schriftzug dem Farbschema folgen koennen. Eine eingebundene
   Bilddatei koennte das nicht - sie bliebe im Dunkeln navy auf navy. */
.brand-logo {
    display: block;
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.brand-logo .rahmen { fill: var(--logo-rahmen); }
.brand-logo .wort { fill: var(--logo-wort); }


.brand-tag {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--akzent);
    border: 1px solid var(--akzent-linie);
    border-radius: 999px;
    padding: 2px 8px;
    margin-left: 2px;
}

.mainnav {
    display: flex;
    align-items: stretch;
    gap: 22px;
    min-height: var(--kopf-hoehe);
}

.mainnav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 2px;
    color: var(--tinte-2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.mainnav a:hover { color: var(--tinte); }

.mainnav a.is-active { color: var(--tinte); }

/* Die aktive Seite bekommt einen Strich, der auf der Haarlinie des Kopfes sitzt. */
.mainnav a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--akzent);
    border-radius: 2px 2px 0 0;
}

.topbar-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    color: var(--gedaempft);
    flex-shrink: 0;
}

.topbar-tools .user-name {
    color: var(--tinte-2);
    text-decoration: none;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-tools .user-name:hover { color: var(--akzent); }
.topbar-tools .user-name em { font-style: normal; color: var(--gedaempft); }

/* Der Admin-Bereich: Akzentstreifen oben und die Navigation als eigene Zeile,
   die auf schmalen Bildschirmen seitlich scrollt. */
.topbar.is-admin { border-top: 2px solid var(--marke-blau); }

.topbar.is-admin .topbar-inner { flex-wrap: wrap; gap: 0 28px; }

.topbar.is-admin .mainnav {
    order: 3;
    flex-basis: 100%;
    min-height: 44px;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--linie);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.topbar.is-admin .mainnav::-webkit-scrollbar { display: none; }
.topbar.is-admin .mainnav a { padding: 0 11px; font-size: 13.5px; }
.topbar.is-admin .mainnav a:first-child { padding-left: 0; }
.topbar.is-admin .mainnav a:last-child { padding-right: 32px; }
.topbar.is-admin .mainnav a.is-active::after { left: 11px; right: 11px; }
.topbar.is-admin .mainnav a:first-child.is-active::after { left: 0; }

/* Umschalter Hell/Dunkel */

.theme-toggle {
    display: none;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--linie-stark);
    border-radius: 999px;
    background: transparent;
    color: var(--tinte-2);
    cursor: pointer;
    flex-shrink: 0;
}

/* Ohne JavaScript gibt es nichts umzuschalten - dann bleibt der Knopf weg. */
.js .theme-toggle { display: inline-grid; }
.theme-toggle:hover { background: var(--flaeche-2); color: var(--tinte); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: var(--zeige-sonne); }
.theme-toggle .icon-moon { display: var(--zeige-mond); }

.theme-toggle-floating {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 40;
    background: var(--flaeche-glas);
}

/* Flaechen ----------------------------------------------------------- */

.card {
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten-karte);
    padding: 26px 30px;
    margin-bottom: 22px;
}

.card > :last-child { margin-bottom: 0; }
.card .card { background: transparent; box-shadow: none; }
.card > p + form, .card > .notice + form, .card > .daten + form, .card > table + form { margin-top: 22px; }

.card-narrow { width: 100%; max-width: 520px; }
.card-wide { width: 100%; max-width: 780px; }

/* Ein Abschnitt in einer Flaeche (z. B. auf der Kontoseite). */
.block + .block { margin-top: 28px; padding-top: 4px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 22px;
    align-items: start;
    margin-bottom: 22px;
}

.grid > * { min-width: 0; }
.grid > .card { margin-bottom: 0; }
.grid > div > .card:last-child { margin-bottom: 0; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 26px;
    flex-wrap: wrap;
}

.page-head > div:first-child { min-width: 0; }
.page-head p { margin: 0; }
.page-head .muted { font-size: 15px; }
.page-head h1 { overflow-wrap: anywhere; }
.page-head form { margin: 0; }

.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Kennzahlen: ein zusammenhaengender Streifen mit Haarlinien dazwischen,
   keine einzelnen Kaestchen. */

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 1px;
    background: var(--linie);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten-karte);
    overflow: hidden;
    margin-bottom: 22px;
}

.kpi {
    background: var(--flaeche);
    padding: 20px 22px 18px;
    min-width: 0;
}

.kpi .zahl {
    font-family: var(--schrift-titel);
    font-weight: 600;
    font-size: 2.3rem;
    line-height: 1.05;
    color: var(--titel);
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.kpi .titel {
    margin-top: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--gedaempft);
}

.kpi .titel a { color: inherit; text-decoration: none; }
.kpi .titel a:hover { color: var(--akzent); }

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

th, td {
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--linie);
    vertical-align: top;
}

th:first-child, td:first-child { padding-left: 4px; }
th:last-child, td:last-child { padding-right: 4px; }

thead th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gedaempft);
    white-space: nowrap;
}

/* Zeilenkoepfe in Schluessel-Wert-Tabellen (Diagnose, Paketdaten): ein
   ruhiges Etikett links, der Wert rechts. */
tbody th {
    width: 1%;
    padding-right: 24px;
    font-weight: 500;
    color: var(--gedaempft);
    white-space: nowrap;
}

tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover td { background: var(--flaeche-2); }
td .state, td .badge { vertical-align: middle; }
td form { margin: 0; }
td p:last-child { margin-bottom: 0; }

/* Die grosse Liste: eine eigene Flaeche mit Kopfzeile. Der Rahmen ist ein
   <div> um die Tabelle - so kann sie auf schmalen Bildschirmen seitlich
   scrollen, statt die Seite zu sprengen. */
.table-wide {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: var(--schatten-karte);
    margin-bottom: 22px;
}

.table-wide table { width: 100%; min-width: 100%; margin: 0; }
.table-wide thead th { background: var(--flaeche-2); }
.table-wide th:first-child, .table-wide td:first-child { padding-left: 20px; }
.table-wide th:last-child, .table-wide td:last-child { padding-right: 20px; }
.table-wide tbody tr:hover td { background: var(--flaeche-2); }

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.table-scroll table { min-width: 100%; }

/* Formulare ---------------------------------------------------------- */

label {
    display: block;
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tinte);
}

/* Hinweis unter einem Feld - <small> wie in den Vorlagen, span.hint wie in
   der Kundenplattform. */
label > small, label > span.hint {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--gedaempft);
    line-height: 1.45;
}

label .state, label .badge { margin-left: 6px; vertical-align: middle; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 13px;
    border: 1px solid var(--linie-stark);
    border-radius: var(--radius-klein);
    background: var(--eingabe);
    color: var(--tinte);
    font: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
}

input::placeholder, textarea::placeholder { color: var(--gedaempft); opacity: .8; }

input:hover, select:hover, textarea:hover { border-color: var(--gedaempft); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--akzent);
    box-shadow: 0 0 0 3px var(--fokus-ring);
}

input:disabled, select:disabled, textarea:disabled {
    background: var(--flaeche-2);
    color: var(--gedaempft);
    cursor: not-allowed;
}

select {
    padding-right: 38px;
    background-image: var(--chevron);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

select[multiple] { padding-right: 13px; background-image: none; }

textarea { min-height: 110px; resize: vertical; font-family: var(--schrift-mono); font-size: 14px; }

input.mono, textarea.mono { font-family: var(--schrift-mono); font-size: 14px; }

input[type="checkbox"], input[type="radio"] {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--akzent);
    flex-shrink: 0;
}

label.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 400;
    cursor: pointer;
}

label.check input { margin-top: 2px; width: 17px; }
label.check span { flex: 1; }
label.check span small {
    display: block;
    margin-top: 4px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--gedaempft);
    line-height: 1.45;
}

/* Felder nebeneinander. Die Mindestbreite entscheidet, wie viele Spalten
   entstehen - lieber wenige breite als viele enge: die Hinweise unter den
   Feldern sollen in zwei Zeilen passen, nicht in fuenf. */
.form-grid, .field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
    gap: 0 20px;
}

.form-grid > *, .field-row > * { min-width: 0; }
.form-grid > .wide, .field-row > .wide { grid-column: 1 / -1; }

/* Formularabschnitte: kein Kasten, sondern ein Titel mit Haarlinie. */
fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 28px;
    min-width: 0;
}

legend {
    display: block;
    width: 100%;
    padding: 0 0 10px;
    margin: 0 0 18px;
    font-family: var(--schrift-titel);
    font-size: 17px;
    font-weight: 600;
    color: var(--titel);
    border-bottom: 1px solid var(--linie);
}

legend .muted { font-family: var(--schrift); font-size: 13px; }

/* Auf- und zuklappbare Abschnitte. */
details { margin: 0 0 18px; }
details:last-child { margin-bottom: 0; }

summary {
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--tinte-2);
    padding: 8px 0;
    list-style: none;
}

summary::-webkit-details-marker { display: none; }

summary::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 10px 2px 2px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(-45deg);
}

details[open] > summary::before { transform: rotate(45deg); margin-bottom: 4px; }
summary:hover { color: var(--tinte); }
details > :not(summary) { margin-top: 10px; }

/* Schaltflaechen ----------------------------------------------------- */

.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 7px 17px;
    border: 1px solid var(--linie-stark);
    border-radius: var(--radius-klein);
    background: var(--flaeche);
    color: var(--tinte);
    font: inherit;
    font-family: var(--schrift);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.button:hover, button:hover {
    background: var(--flaeche-2);
    border-color: var(--gedaempft);
    color: var(--tinte);
}

.button:active, button:active { transform: translateY(1px); }

/* Der Hauptknopf wie die Handlungsknoepfe auf heinsen-it.de: gefuellt im
   Markenblau, Versalien, etwas gesperrt. */
.button-primary, button.button-primary {
    background: var(--knopf);
    border-color: var(--knopf);
    color: var(--knopf-text);
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.button-primary:hover, button.button-primary:hover {
    background: var(--knopf-hover);
    border-color: var(--knopf-hover);
    color: var(--knopf-text);
}

.button-danger, button.button-danger {
    border-color: var(--fehler-linie);
    color: var(--fehler);
}

.button-danger:hover, button.button-danger:hover {
    background: var(--fehler-flaeche);
    border-color: var(--fehler);
    color: var(--fehler);
}

.button-small, button.button-small {
    min-height: 31px;
    padding: 4px 13px;
    font-size: 13px;
}

.button[disabled], button[disabled] {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.button svg, button svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Ein Knopf, der direkt einem Formular folgt: etwas Luft. */
.form-grid + .button, .form-grid + button, label + .button, label + button, p + form .button:only-child { margin-top: 4px; }

.actions {
    display: flex;
    gap: 10px 14px;
    align-items: center;
    flex-wrap: wrap;
}

.actions > a:not(.button) { font-size: 14px; }

/* In einer Tabellenzelle bleiben die Knoepfe in der Zeile. */
td.actions { display: table-cell; white-space: nowrap; }
td.actions > form, td.actions > .button { display: inline-flex; vertical-align: middle; margin-right: 6px; }
td.actions > :last-child { margin-right: 0; }

form.inline { display: inline; }

/* Einzelne Handgriffe nebeneinander - jeder ein kleines Formular. */
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

.action-row form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--linie);
    border-radius: var(--radius-klein);
    background: var(--flaeche-2);
}

/* Ein Formular, das nur aus einem Knopf besteht, braucht keinen Kasten -
   den bekommen nur Formulare mit sichtbaren Eingabefeldern. */
.action-row form { padding: 0; border: 0; background: transparent; }
.action-row form:has(input:not([type="hidden"]), select, textarea) {
    padding: 10px 12px;
    border: 1px solid var(--linie);
    background: var(--flaeche-2);
}
.action-row input, .action-row select { margin-top: 0; width: auto; min-width: 120px; }
.action-row label { margin-bottom: 0; }

/* Kopieren-Knopf neben Schluesseln - nur sichtbar, wenn JavaScript laeuft. */
.copy { display: none; }

.js .copy {
    display: inline-flex;
    min-height: 30px;
    padding: 3px 11px;
    font-size: 12.5px;
    color: var(--tinte-2);
    background: transparent;
}

.js .copy.is-done { color: var(--ok); border-color: var(--ok-linie); background: var(--ok-flaeche); }

/* Meldungen ---------------------------------------------------------- */

.notice {
    position: relative;
    padding: 13px 16px 13px 20px;
    border: 1px solid var(--linie);
    border-radius: var(--radius-klein);
    background: var(--flaeche);
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

.notice::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gedaempft);
}

.notice-success { background: var(--ok-flaeche); border-color: var(--ok-linie); }
.notice-success::before { background: var(--ok); }
.notice-error { background: var(--fehler-flaeche); border-color: var(--fehler-linie); }
.notice-error::before { background: var(--fehler); }
.notice-warning { background: var(--warnung-flaeche); border-color: var(--warnung-linie); }
.notice-warning::before { background: var(--warnung); }
.notice-info { background: var(--info-flaeche); border-color: var(--info-linie); }
.notice-info::before { background: var(--info); }

.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice p:last-child { margin-bottom: 0; }
.notice code { background: rgba(127, 127, 127, .12); border-color: transparent; }
.notice form { margin-top: 10px; }

/* Kennzeichnungen ---------------------------------------------------- */

.state, .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    background: var(--flaeche-2);
    color: var(--tinte-2);
    border: 1px solid var(--linie);
    white-space: nowrap;
    vertical-align: middle;
}

.state::before, .badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .75;
    flex-shrink: 0;
}

.state-muted { color: var(--gedaempft); }
.state-ok, .badge-ok { background: var(--ok-flaeche); color: var(--ok); border-color: var(--ok-linie); }
.state-warn, .badge-warn { background: var(--warnung-flaeche); color: var(--warnung); border-color: var(--warnung-linie); }
.state-error, .badge-error { background: var(--fehler-flaeche); color: var(--fehler); border-color: var(--fehler-linie); }
.state-info, .badge-info { background: var(--info-flaeche); color: var(--info); border-color: var(--info-linie); }

/* Kleine Marke ohne Punkt - fuer Rollen, Quellen und Kuerzel. */
.tag {
    display: inline-block;
    padding: 0 7px;
    border: 1px solid var(--linie-stark);
    border-radius: 5px;
    font-family: var(--schrift-mono);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--tinte-2);
    vertical-align: middle;
}

a.tag { text-decoration: none; }
a.tag:hover { border-color: var(--akzent); color: var(--akzent); }

/* Die gepackte Fassung, eine Fassung im Rueckstand, eine stille Website. */
.tag-aktuell { border-color: var(--akzent); color: var(--akzent); background: var(--akzent-flaeche); }
.tag-warn { border-color: var(--warnung-linie); color: var(--warnung); background: var(--warnung-flaeche); }
.tag-still { opacity: .55; }

/* Verteilung: Marken nebeneinander, umbrechend. */
.verteilung { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
td .verteilung { margin-top: 0; }

/* Anteil einer Fassung als schmaler Balken neben der Zahl. */
.balken-zelle { min-width: 140px; }
.balken {
    display: inline-block;
    width: 90px;
    height: 8px;
    margin-right: 8px;
    border: 1px solid var(--linie-stark);
    border-radius: 4px;
    background: var(--flaeche-2);
    vertical-align: middle;
    overflow: hidden;
}
.balken-fuellung { height: 100%; background: var(--akzent); }

.zeit { white-space: nowrap; }
tr.ist-still td { color: var(--gedaempft); }
tr.ist-gewaehlt td { background: var(--akzent-flaeche); }

/* Zwei-Faktor-Anmeldung: QR-Code, Schluessel zum Abtippen, die zehn
   Wiederherstellungscodes. Der QR-Code bleibt schwarz auf weiss - auch im
   dunklen Schema, sonst liest ihn die App nicht. */
.qr {
    width: min(100%, 220px);
    padding: 10px;
    background: #fff;
    border: 1px solid var(--linie);
    border-radius: var(--radius-klein);
}
.qr svg { display: block; width: 100%; height: auto; }

code.schluessel {
    display: inline-block;
    padding: 8px 12px;
    font-size: 15px;
    letter-spacing: .06em;
    user-select: all;
}

.codes-liste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin: 14px 0;
}
.codes-liste code {
    display: block;
    padding: 8px 10px;
    text-align: center;
    font-size: 15px;
    letter-spacing: .08em;
    user-select: all;
}

/* Bibliothek: die Karte, wie die Suite sie zeigt - Symbol, Name,
   Kurzbeschreibung, Voraussetzungen, Knoepfe. Nur zur Ansicht. */
.bib-karten {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
}

.bib-karte {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--flaeche-2);
    min-width: 0;
}

.card .bib-karte { background: var(--flaeche-2); }
.bib-karte-inaktiv { opacity: .6; border-style: dashed; }

.bib-kopf { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bib-titel { min-width: 0; }
.bib-titel h4 { margin: 0 0 2px; font-size: 15px; overflow-wrap: anywhere; }
.bib-titel h4 a { color: inherit; text-decoration: none; }
.bib-titel h4 a:hover { color: var(--akzent); }

.bib-symbol {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: cover;
    background: var(--flaeche);
    border: 1px solid var(--linie);
}

.bib-platzhalter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--schrift-titel);
    font-weight: 600;
    font-size: 26px;
    color: var(--akzent);
    background: var(--akzent-flaeche);
    border-color: var(--akzent-linie);
}

.bib-text { margin: 0; font-size: 14px; line-height: 1.5; }
.bib-voraussetzungen { overflow-wrap: anywhere; }
.bib-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.bib-knoepfe .button { cursor: default; }
.bib-knoepfe a.button { cursor: pointer; }

/* Definitionslisten -------------------------------------------------- */

.daten {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px 32px;
    margin: 0;
    font-size: 14px;
}

.daten dt { color: var(--gedaempft); }
.daten dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.daten.small { font-size: 13px; gap: 6px 18px; }

/* Schluessel --------------------------------------------------------- */

.lizenzschluessel {
    display: inline-block;
    font-family: var(--schrift-mono);
    font-size: 15px;
    letter-spacing: .08em;
    color: var(--tinte);
    background: var(--flaeche-2);
    border: 1px dashed var(--linie-stark);
    border-radius: var(--radius-klein);
    padding: 7px 12px;
    user-select: all;
    -webkit-user-select: all;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Code und Protokoll ------------------------------------------------- */

pre, .code {
    display: block;
    margin: 0;
    background: var(--flaeche-2);
    border: 1px solid var(--linie);
    border-radius: var(--radius-klein);
    padding: 12px 14px;
    overflow-x: auto;
    font-family: var(--schrift-mono);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--tinte);
    white-space: pre;
    tab-size: 4;
}

.code-scroll { max-height: 420px; overflow-y: auto; }

/* Das Protokoll: dunkel wie ein Terminal, in beiden Farbschemata. */
.log, pre.log {
    background: var(--log-grund);
    color: var(--log-text);
    border-color: transparent;
    white-space: pre-wrap;
    word-break: break-word;
}

p + .code, .notice + .code { margin-top: 12px; }
.code + p { margin-top: 12px; }

/* Blaettern ---------------------------------------------------------- */

.pager, .pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin: 18px 0 22px;
    font-size: 14px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 4px 11px;
    border: 1px solid var(--linie-stark);
    border-radius: 999px;
    background: var(--flaeche);
    color: var(--tinte);
    text-decoration: none;
    font-size: 13px;
}

.pagination a:hover { background: var(--flaeche-2); border-color: var(--gedaempft); }
.pagination a.is-active { background: var(--knopf); border-color: var(--knopf); color: var(--knopf-text); }

/* Filterleiste ------------------------------------------------------- */

.filter {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.card > .filter { padding-bottom: 20px; border-bottom: 1px solid var(--linie); }

.filter label { flex: 1 1 180px; margin-bottom: 0; min-width: 0; }
.filter > input, .filter > select { flex: 1 1 180px; width: auto; min-width: 0; margin-top: 0; }
.filter .button, .filter button { flex-shrink: 0; }

/* Fusszeile ---------------------------------------------------------- */

.footer {
    flex-shrink: 0;
    color: var(--gedaempft);
    font-size: 12.5px;
    padding: 24px 24px 36px;
    border-top: 1px solid var(--linie);
}

.footer a { color: var(--gedaempft); text-decoration-color: var(--linie-stark); }
.footer a:hover { color: var(--akzent); }

/* Schlankes Layout (Anmeldung, Ersteinrichtung, Startseite, Fehler) ---- */

body.centered {
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.plain-wrap {
    width: 100%;
    max-width: 470px;
    margin: 0 auto;
}

.plain-wrap.plain-wrap-wide { max-width: 780px; }

/* Auf der Anmeldung und der Startseite steht die Marke gross und mittig
   ueber der Flaeche: erst das Logo, darunter der Name. */
.plain-wrap .brand {
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    width: 100%;
    margin-bottom: 24px;
    font-size: 15px;
}

.plain-wrap .brand-logo { height: 52px; }

.plain-wrap main.card { margin-bottom: 0; padding: 28px 30px; }
.plain-wrap h1 { font-size: 1.7rem; margin-bottom: 8px; }
.plain-wrap .abstand { margin-top: 16px; }
.plain-wrap .card .card { border: 0; padding: 0; margin: 0; }

/* Abstaende ---------------------------------------------------------- */

.stack > * + * { margin-top: 22px; }
.abstand { margin-top: 16px; }
.abstand-oben-klein { margin-top: 8px; }

/* Schmale Bildschirme ----------------------------------------------- */

@media (max-width: 900px) {
    .wrap { padding: 0 20px; }
    main.wrap { padding-top: 28px; padding-bottom: 40px; }
}

@media (max-width: 720px) {
    :root { --kopf-hoehe: 56px; }

    h1 { font-size: 1.65rem; }
    .card { padding: 20px 18px; }
    .kpi { padding: 16px 16px 14px; }
    .kpi .zahl { font-size: 2.1rem; }
    .grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
    .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 22px; }
    .head-actions { width: 100%; }

    .daten { grid-template-columns: 1fr; gap: 2px 0; }
    .daten dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
    .daten dd { margin-bottom: 10px; }
    .daten dd:last-child { margin-bottom: 0; }

    tbody th { white-space: normal; }

    .filter label, .filter > input, .filter > select { flex-basis: 100%; }
    .filter .button, .filter button { flex: 1 1 auto; }
    .action-row form { flex: 1 1 100%; }

    /* iOS zoomt in Eingabefelder unter 16px hinein. */
    input[type="text"], input[type="email"], input[type="password"], input[type="url"],
    input[type="number"], input[type="date"], input[type="search"], select, textarea {
        font-size: 16px;
    }

    .topbar-inner { gap: 14px; }
    .topbar-tools { gap: 8px; }
    .topbar-tools .user-name { max-width: 120px; }
    .topbar.is-admin .topbar-inner { gap: 0 16px; }
    .topbar.is-admin .mainnav a { font-size: 13px; }
}

@media (max-width: 480px) {
    .wrap { padding: 0 16px; }
    .card { padding: 18px 16px; }
    .plain-wrap main.card { padding: 24px 20px; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-3 > :last-child:nth-child(odd) { grid-column: span 2; }
    th, td { padding: 9px 8px; }
    .table-wide th:first-child, .table-wide td:first-child { padding-left: 14px; }
    .table-wide th:last-child, .table-wide td:last-child { padding-right: 14px; }

    /* Schaltflaechen in Formularen nehmen die volle Breite; blosse Links bleiben Links. */
    form .actions > .button, form .actions > button { flex: 1 1 auto; }
    .head-actions .button { flex: 1 1 auto; }

    .topbar .brand-name { max-width: 150px; }
    .topbar .brand-tag { display: none; }
    /* Auf dem Telefon reicht der Abmelden-Knopf; der Name steht unter Konto. */
    .topbar-tools .user-name { display: none; }
    .footer { padding: 20px 16px 32px; }
}

/* Grobe Zeiger (Touch): Ziele etwas groesser. */
@media (pointer: coarse) {
    .button, button { min-height: 42px; }
    .button-small, button.button-small { min-height: 36px; }
    .theme-toggle { width: 40px; height: 40px; }
}

/* Druck --------------------------------------------------------------- */

@media print {
    body { background: #fff; color: #000; display: block; }
    .topbar, .footer, .theme-toggle, .head-actions, .actions, .copy, .filter, .pager, .pagination { display: none !important; }
    main.wrap { padding: 0; max-width: none; }
    .card, .table-wide, .grid-3 { border-color: #bbb; break-inside: avoid; box-shadow: none; }
    a { color: inherit; text-decoration: none; }
}
