/* Kundenplattform - Oberflaeche
 *
 * Die Marke gibt die Farben vor: das Navy und das Blau des HIT-Zeichens
 * (#0C2340 und #2E6FD9), dazu die helle, sachliche Anmutung von
 * heinsen-it.de - weisse Flaechen auf hellem Grau, Haarlinien statt
 * Schatten, kleine Radien, ein kraeftiges Blau fuer alles, was handelt.
 * Ueberschriften stehen in derselben serifenlosen Schrift wie dort (Roboto,
 * sonst die Systemschrift), Daten wie Schluessel und Versionen in Monospace.
 *
 * Es werden ausschliesslich vorhandene Schriften benutzt. Keine externen
 * Fonts, kein Nachladen von fremden Servern (Datenschutz), kein Warten.
 *
 * 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. Im Dunkeln wird aus
 * dem Navy der Grund, und das Blau hellt auf, damit es lesbar bleibt.
 */

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

:root {
    color-scheme: light;

    /* Die Marke: Navy und Blau aus dem HIT-Zeichen. */
    --marke-navy: #0c2340;
    --marke-blau: #2e6fd9;

    --papier: #f3f5f8;
    --papier-glanz: rgba(46, 111, 217, .08);
    --flaeche: #ffffff;
    --flaeche-glas: rgba(255, 255, 255, .86);
    --flaeche-2: #eef1f6;
    --flaeche-3: #e3e8ef;
    --eingabe: #ffffff;

    --tinte: #16213a;
    --tinte-2: #44536b;
    --gedaempft: #5f6e85;
    --linie: #e2e7ee;
    --linie-stark: #c8d1dd;

    --akzent: #1f66cc;
    --akzent-hover: #17508f;
    --akzent-flaeche: #e8f0fc;
    --akzent-linie: rgba(46, 111, 217, .35);
    --fokus-ring: rgba(46, 111, 217, .25);

    --knopf: #2e6fd9;
    --knopf-hover: #1f58bb;
    --knopf-text: #ffffff;

    --ok: #0b7a3b;
    --ok-flaeche: #e4f3ea;
    --ok-linie: #b5ddc5;
    --warnung: #9a5c00;
    --warnung-flaeche: #fbf0dc;
    --warnung-linie: #ecd3a6;
    --fehler: #b3261e;
    --fehler-flaeche: #fbe7e5;
    --fehler-linie: #f0c0bb;
    --info: #1f66cc;
    --info-flaeche: #e8f0fc;
    --info-linie: #bed5f3;

    --log-grund: #0c2340;
    --log-text: #dde6f4;
    --schatten-scroll: rgba(12, 35, 64, .14);
    --schatten-schwebend: 0 1px 2px rgba(12, 35, 64, .06), 0 12px 32px -16px rgba(12, 35, 64, .28);

    --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='%2344536b' 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 Neue", Arial, sans-serif;
    --schrift-kopf: Roboto, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --schrift-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 6px;
    --radius-klein: 4px;
    --kopf-hoehe: 60px;
    --tableiste-hoehe: 62px;
    /* Satzspiegel: breit genug fuer Tabellen mit vielen Spalten, aber nicht
       so breit, dass eine Zeile Text unlesbar wird - dafuer sorgt
       zusaetzlich das Mass am Fliesstext (--mass-text). */
    --breite: 1480px;
    --breite-schmal: 820px;
    --mass-text: 86ch;
}

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

        --marke-navy: #0c2340;
        --marke-blau: #4b8bf0;

        --papier: #0a1422;
        --papier-glanz: rgba(75, 139, 240, .14);
        --flaeche: #112033;
        --flaeche-glas: rgba(10, 20, 34, .84);
        --flaeche-2: #16263b;
        --flaeche-3: #1e3148;
        --eingabe: #0e1b2b;

        --tinte: #e8eef7;
        --tinte-2: #b8c5d6;
        --gedaempft: #8798ae;
        --linie: #1f2f44;
        --linie-stark: #2d4059;

        --akzent: #74a8f5;
        --akzent-hover: #9cc3fa;
        --akzent-flaeche: #15273f;
        --akzent-linie: rgba(116, 168, 245, .42);
        --fokus-ring: rgba(116, 168, 245, .3);

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

        --ok: #5cc98a;
        --ok-flaeche: #11291c;
        --ok-linie: #27492f;
        --warnung: #e3b05c;
        --warnung-flaeche: #2b2415;
        --warnung-linie: #4a3c1d;
        --fehler: #f08a80;
        --fehler-flaeche: #2f1a1a;
        --fehler-linie: #562b29;
        --info: #74a8f5;
        --info-flaeche: #15273f;
        --info-linie: #294365;

        --log-grund: #060e18;
        --log-text: #ccd8e8;
        --schatten-scroll: rgba(0, 0, 0, .55);
        --schatten-schwebend: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .75);

        --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='%23b8c5d6' 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;

    --marke-navy: #0c2340;
    --marke-blau: #4b8bf0;

    --papier: #0a1422;
    --papier-glanz: rgba(75, 139, 240, .14);
    --flaeche: #112033;
    --flaeche-glas: rgba(10, 20, 34, .84);
    --flaeche-2: #16263b;
    --flaeche-3: #1e3148;
    --eingabe: #0e1b2b;

    --tinte: #e8eef7;
    --tinte-2: #b8c5d6;
    --gedaempft: #8798ae;
    --linie: #1f2f44;
    --linie-stark: #2d4059;

    --akzent: #74a8f5;
    --akzent-hover: #9cc3fa;
    --akzent-flaeche: #15273f;
    --akzent-linie: rgba(116, 168, 245, .42);
    --fokus-ring: rgba(116, 168, 245, .3);

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

    --ok: #5cc98a;
    --ok-flaeche: #11291c;
    --ok-linie: #27492f;
    --warnung: #e3b05c;
    --warnung-flaeche: #2b2415;
    --warnung-linie: #4a3c1d;
    --fehler: #f08a80;
    --fehler-flaeche: #2f1a1a;
    --fehler-linie: #562b29;
    --info: #74a8f5;
    --info-flaeche: #15273f;
    --info-linie: #294365;

    --log-grund: #060e18;
    --log-text: #ccd8e8;
    --schatten-scroll: rgba(0, 0, 0, .55);
    --schatten-schwebend: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .75);

    --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='%23b8c5d6' 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 24px;
}

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

main.wrap { padding-top: 38px; padding-bottom: 52px; }

@media (min-width: 1100px) {
    .wrap { padding: 0 32px; }
}

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, .plugin-card, .theme-toggle, .mainnav a {
        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-kopf);
    font-weight: 600;
    font-size: 1.85rem;
    line-height: 1.2;
    letter-spacing: -.015em;
    margin: 0 0 6px;
}

/* Abschnittstitel in Flaechen: kleines, gesperrtes Etikett mit Haarlinie. */
h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gedaempft);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--linie);
}

/* 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; }

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

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. Ein
   backdrop-filter direkt auf .topbar wuerde die Tab-Leiste des Portals
   (position: fixed, siehe unten) an den Kopf binden statt an das Fenster. */
.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); }

/* Das HIT-Zeichen: Klammern im Markenblau, Schriftzug in der Textfarbe. */
.brand .logo {
    display: block;
    flex-shrink: 0;
    color: var(--tinte);
}

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

.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;
}

.mainnav svg { display: none; width: 22px; height: 22px; }
.mainnav .nav-mobile-only { display: none; }
.topbar-tools .nav-mobile-only { display: none; }

.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. */
.topbar.is-admin { border-top: 2px solid var(--akzent); }

.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);
    padding: 26px 30px;
    margin-bottom: 24px;
}

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

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

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

.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 h1 .lizenzschluessel { font-size: .7em; vertical-align: middle; }

.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%, 190px), 1fr));
    gap: 1px;
    background: var(--linie);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 22px;
}

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

.kpi .zahl {
    font-family: var(--schrift-kopf);
    font-size: 2.3rem;
    font-weight: 600;
    line-height: 1;
    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: 10px 12px;
    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; }

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

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

/* Schmale Bildschirme: die Tabelle scrollt seitlich, ein Schatten am Rand
   verraet, dass da noch etwas kommt. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
    background:
        linear-gradient(to right, var(--flaeche) 30%, rgba(255, 255, 255, 0)),
        linear-gradient(to right, rgba(255, 255, 255, 0), var(--flaeche) 70%) 100% 0,
        radial-gradient(farthest-side at 0 50%, var(--schatten-scroll), rgba(0, 0, 0, 0)),
        radial-gradient(farthest-side at 100% 50%, var(--schatten-scroll), rgba(0, 0, 0, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 48px 100%, 48px 100%, 16px 100%, 16px 100%;
    background-attachment: local, local, scroll, scroll;
}

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

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

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

label > span.hint {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--gedaempft);
    line-height: 1.45;
}

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; }

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; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 0 18px;
}

.field-row > * { min-width: 0; }

/* 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-kopf);
    font-size: 18px;
    font-weight: 600;
    color: var(--tinte);
    border-bottom: 1px solid var(--linie);
}

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

/* 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); }

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

.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;
}

/* Suite-Anbindung: die Rechte auf der Zustimmungsseite, der Verbindungscode. */
.scope-list { margin: 14px 0 18px; padding-left: 22px; }
.scope-list li { margin-bottom: 6px; }
.connect-code { font-size: 1.15rem; letter-spacing: .12em; }

/* Ein kleines Eingabefeld neben einem Knopf, z. B. die Passwortabfrage in
   einer Tabellenzeile. */
input.input-small {
    display: inline-block;
    width: auto;
    max-width: 180px;
    margin: 0 6px 0 0;
    padding: 4px 10px;
    min-height: 31px;
    font-size: 13px;
    vertical-align: middle;
}

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

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

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

.actions > a:not(.button) { font-size: 14px; }
.actions + p { margin-top: 18px; }

form.inline { display: inline; }

/* 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; }

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

.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;
}

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

.badge-ok { background: var(--ok-flaeche); color: var(--ok); border-color: var(--ok-linie); }
.badge-warn { background: var(--warnung-flaeche); color: var(--warnung); border-color: var(--warnung-linie); }
.badge-error { background: var(--fehler-flaeche); color: var(--fehler); border-color: var(--fehler-linie); }
.badge-info { background: var(--info-flaeche); color: var(--info); border-color: var(--info-linie); }
/* Early Access: die Marke des Hauses - so faellt sie neben Beta auf. */
.badge-ea { background: var(--akzent-flaeche); color: var(--akzent); border-color: var(--akzent-linie); }

/* Vorabfassungen neben dem Angebot (Beta-Kanal, Early-Access-Kanal) ---- */

.prerelease-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 22px;
    margin-bottom: 22px;
}

.prerelease-row > .card { margin-bottom: 0; }
.prerelease-card { border-style: dashed; }
.prerelease-card.is-ea { border-color: var(--akzent-linie); }
.prerelease-card .eyebrow { margin-bottom: 2px; }
.prerelease-card .titel {
    font-family: var(--schrift-kopf);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.01em;
    color: var(--tinte);
    margin: 0 0 8px;
}
.prerelease-card .daten { margin: 12px 0 4px; }
.prerelease-card .actions + p { margin-top: 12px; }

.plugin-card .meta .vorab { display: inline-flex; align-items: center; gap: 6px; }

/* Plugin-Kacheln ----------------------------------------------------- */

.plugin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
    gap: 18px;
}

.plugin-card {
    position: relative;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    padding: 22px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plugin-card:hover {
    border-color: var(--linie-stark);
    box-shadow: var(--schatten-schwebend);
    transform: translateY(-2px);
}

.plugin-card h2 {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
    text-transform: none;
    color: var(--tinte);
}

.plugin-card h2 a { text-decoration: none; color: var(--tinte); }
.plugin-card h2 a:hover { color: var(--akzent); }

.plugin-card .meta {
    display: flex;
    gap: 6px 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--gedaempft);
    font-variant-numeric: tabular-nums;
}

.plugin-card .meta > span:first-child {
    font-family: var(--schrift-mono);
    color: var(--tinte-2);
    background: var(--flaeche-2);
    border-radius: 5px;
    padding: 1px 7px;
}

.plugin-card .beschreibung { color: var(--tinte-2); font-size: 14px; flex: 1; line-height: 1.5; }

.plugin-card .fuss {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--linie);
}

/* Der Hinweis, warum ein Plugin nicht geladen werden kann, darf umbrechen. */
.plugin-card .fuss .badge {
    white-space: normal;
    max-width: 100%;
    align-items: flex-start;
    line-height: 1.4;
    padding-top: 4px;
    padding-bottom: 4px;
}

.plugin-card .fuss .badge::before { margin-top: .45em; }

/* Vorschaubilder (Screenshot eines Themes, Icon eines Plugins) -------- */

.plugin-card .vorschau {
    display: block;
    margin: -22px -22px 4px;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    background: var(--flaeche-2);
    aspect-ratio: 4 / 3;
}

.plugin-card .vorschau img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.plugin-card:hover .vorschau img { opacity: .94; }

.card.screenshot-card {
    padding: 0;
    overflow: hidden;
    background: var(--flaeche-2);
}

.screenshot-card img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    object-position: top;
}

.daten .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.hint-inline { margin-left: 8px; }
.page-head .eyebrow { margin-bottom: 4px; }

/* Zweiter Faktor ------------------------------------------------------ */

.abstand { margin-top: 18px; }

.code-input,
input[type="text"].code-input {
    font-family: var(--schrift-mono);
    font-size: 24px;
    letter-spacing: .28em;
    text-align: center;
    max-width: 320px;
}

.setup-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 22px 26px;
    align-items: start;
    margin-bottom: 22px;
}

/* Immer weiss, auch im dunklen Schema - die Kamera braucht den Kontrast. */
.qr-code {
    display: inline-block;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--linie);
    border-radius: var(--radius-klein);
}

.qr-code svg { display: block; width: 200px; height: 200px; }

.schritte { margin: 0; padding-left: 20px; line-height: 1.6; }
.schritte li { margin-bottom: 8px; }
.schritte .lizenzschluessel { margin: 6px 6px 0 0; font-size: 14px; }

.recovery-codes {
    columns: 2;
    column-gap: 26px;
    list-style: none;
    margin: 12px 0 18px;
    padding: 0;
    font-family: var(--schrift-mono);
    font-size: 16px;
    letter-spacing: .06em;
}

.recovery-codes li {
    padding: 7px 0;
    border-bottom: 1px dashed var(--linie);
    break-inside: avoid;
    user-select: all;
    -webkit-user-select: all;
}

.method-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.method-choice .choice {
    padding: 18px 20px;
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    background: var(--flaeche-2);
}

.method-choice .choice h3, .grid > form.card h3 { margin: 0 0 8px; padding-top: 0; border-top: 0; }
.method-choice .choice p { margin: 0 0 12px; }
.method-choice .choice label { margin-bottom: 12px; }

.actions-secondary { margin-top: 14px; gap: 10px; }
.actions-secondary form { display: inline; }

@media (max-width: 600px) {
    .setup-row, .method-choice { grid-template-columns: 1fr; }
    .recovery-codes { columns: 1; }
}

/* Reiter (z. B. Plugin-/Theme-Lizenzen) -------------------------------- */

.tabs {
    display: flex;
    gap: 4px;
    margin: -8px 0 22px;
    padding: 4px;
    border: 1px solid var(--linie);
    border-radius: 999px;
    background: var(--flaeche-2);
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    color: var(--tinte-2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

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

.tabs a.is-active {
    background: var(--flaeche);
    color: var(--tinte);
    box-shadow: 0 1px 2px rgba(12, 35, 64, .10);
}

.tabs .zaehler {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--gedaempft);
    background: var(--flaeche-2);
    border-radius: 999px;
    padding: 0 7px;
}

.tabs a.is-active .zaehler { background: var(--akzent-flaeche); color: var(--akzent); }

/* Lizenzen im Portal ------------------------------------------------- */

.license-list { display: grid; gap: 14px; }
.license-list > * { min-width: 0; }

.license-tile {
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    padding: 20px 22px;
}

.license-head {
    display: flex;
    align-items: center;
    gap: 10px 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.license-tile .daten { margin-bottom: 4px; }

/* Mehrere Schluessel in einer Flaeche (Plugin-Seite): Haarlinie dazwischen. */
.daten + .license-head {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--linie);
}

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

.daten {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 9px 26px;
    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;
}

/* Beschreibungstexte aus der readme.txt ------------------------------ */

.readme p { margin: 0 0 12px; max-width: var(--mass-text); }
.readme ul, .readme ol { margin: 0 0 12px; padding-left: 22px; max-width: var(--mass-text); }
.readme li { margin-bottom: 4px; }
.readme h4 { margin: 18px 0 6px; font-size: 14px; }
.readme h4:first-child { margin-top: 0; }

/* Protokoll ---------------------------------------------------------- */

pre.code {
    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;
    margin: 0;
}

pre.log {
    background: var(--log-grund);
    color: var(--log-text);
    padding: 14px 16px;
    border-radius: var(--radius-klein);
    overflow-x: auto;
    font-family: var(--schrift-mono);
    font-size: 12.5px;
    line-height: 1.55;
    margin: 0;
}

/* Startseite --------------------------------------------------------- */

.hero {
    padding: 28px 0 36px;
}

.hero h1 {
    font-size: clamp(2.1rem, 5vw, 3rem);
    line-height: 1.08;
    max-width: 14em;
    margin-bottom: 18px;
}

.hero .lead {
    font-size: 17px;
    line-height: 1.6;
    color: var(--tinte-2);
    max-width: 34em;
    margin-bottom: 26px;
}

.hero .actions { margin-top: 0; }

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 24px 32px;
    margin: 0 0 32px;
    padding: 0;
    list-style: none;
}

.feature-list li {
    border-top: 1px solid var(--linie-stark);
    padding-top: 14px;
}

.feature-list h3 { margin: 0 0 6px; font-size: 15px; }
.feature-list p { color: var(--gedaempft); font-size: 14px; }

.feature-list .nummer {
    display: block;
    font-family: var(--schrift-kopf);
    font-weight: 600;
    font-size: 13px;
    color: var(--akzent);
    margin-bottom: 8px;
}

/* 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); }

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

.pager {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
    font-size: 14px;
}

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

.filter {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 20px;
    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 { min-width: 0; }
.filter .button, .filter button { flex-shrink: 0; }

/* Schlankes Layout (Anmeldung Verwaltung, Fehlerseiten) ------------- */

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

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

.plain-wrap .brand {
    justify-content: center;
    width: 100%;
    margin-bottom: 22px;
    font-size: 15px;
}

.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; }

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

.stack > * + * { margin-top: 24px; }
.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; }

    .filter label { flex-basis: 100%; }
    .filter .button, .filter button { flex: 1 1 auto; }

    /* 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-tools .nav-desktop-only { display: none; }

    /* Das Portal bekommt eine Tab-Leiste am unteren Rand - da, wo der
       Daumen ist. Die Kontoseite rutscht dort mit hinein. */
    body.hat-tableiste { padding-bottom: calc(var(--tableiste-hoehe) + env(safe-area-inset-bottom, 0px)); }
    body.hat-tableiste .topbar-tools .user-name { display: none; }

    .topbar.is-portal .mainnav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        min-height: var(--tableiste-hoehe);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        gap: 0;
        background: var(--flaeche-glas);
        -webkit-backdrop-filter: saturate(160%) blur(14px);
        backdrop-filter: saturate(160%) blur(14px);
        border-top: 1px solid var(--linie);
    }

    .topbar.is-portal .mainnav a {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        font-size: 11px;
        font-weight: 500;
        color: var(--gedaempft);
    }

    .topbar.is-portal .mainnav a.is-active { color: var(--akzent); }
    .topbar.is-portal .mainnav a.is-active::after { display: none; }
    .topbar.is-portal .mainnav svg { display: block; }
    .topbar.is-portal .mainnav .nav-mobile-only { display: inline-flex; }

    .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; border-radius: 10px; }
    .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; }
    .plugin-card { padding: 18px 18px 16px; }
    .plugin-card .vorschau { margin: -18px -18px 4px; }
    .license-tile { padding: 16px; }
    .hero { padding: 16px 0 28px; }
    th, td { padding: 9px 8px; }

    /* 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; }
    .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 { display: none !important; }
    main.wrap { padding: 0; max-width: none; }
    .card, .plugin-card, .license-tile, .grid-3 { border-color: #bbb; break-inside: avoid; box-shadow: none; }
    a { color: inherit; text-decoration: none; }
}
