/* ==========================================================================
   ProfilVersum - Stylesheet
   ==========================================================================
   Bewusst handgeschrieben und lokal ausgeliefert (kein CDN), damit die
   Content-Security-Policy streng bleiben kann: Es wird nichts von fremden
   Servern nachgeladen.

   Aufbau:
   1. Farben & Grundlagen
   2. Layout (Sidebar, Topbar, Inhalt)
   3. Navigation
   4. Bausteine (Karten, Tabellen, Formulare, Buttons, Pills, Alerts)
   5. Anmeldeseiten
   6. Responsive & Druck
   ========================================================================== */

/* ---------- 1. Farben & Grundlagen --------------------------------------- */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #f8fafc;

    --accent: #4338ca;
    --accent-hover: #3730a3;
    --accent-soft: #eef2ff;

    --ok: #059669;
    --ok-soft: #ecfdf5;
    --warn: #b45309;
    --warn-soft: #fffbeb;
    --error: #dc2626;
    --error-soft: #fef2f2;
    --info: #0369a1;
    --info-soft: #f0f9ff;

    --sidebar-bg: #111827;
    --sidebar-text: #cbd5e1;
    --sidebar-text-strong: #ffffff;
    --sidebar-active: #1f2937;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);

    --sidebar-width: 264px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --surface: #131c31;
        --surface-2: #1a2439;
        --border: #263248;
        --border-strong: #33415c;

        --text: #e8edf7;
        --text-muted: #94a3b8;

        --accent: #818cf8;
        --accent-hover: #a5b4fc;
        --accent-soft: #1e293b;

        --ok: #34d399;
        --ok-soft: #052e23;
        --warn: #fbbf24;
        --warn-soft: #2e2205;
        --error: #f87171;
        --error-soft: #2f1113;
        --info: #38bdf8;
        --info-soft: #082f45;

        --sidebar-bg: #080d1a;
        --sidebar-active: #1a2439;

        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; }

.icon { width: 20px; height: 20px; flex: none; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; }

/* ---------- 2. Layout ---------------------------------------------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    flex: none;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.15rem 1.15rem 1rem;
    color: var(--sidebar-text-strong);
    font-weight: 650;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar__logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; }
.sidebar__logo .icon { width: 18px; height: 18px; }
.sidebar__name { font-size: .98rem; }
.sidebar__close { display: none; margin-left: auto; color: var(--sidebar-text); }

.sidebar__footer {
    margin-top: auto;
    padding: .9rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem 1.6rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar__title { font-size: 1.05rem; margin: 0; font-weight: 650; }
.topbar__spacer { flex: 1; }
.topbar__meta { color: var(--text-muted); font-size: .85rem; }
.topbar__burger { display: none; }

.content { padding: 1.6rem; flex: 1; max-width: 1280px; width: 100%; }

.footer {
    display: flex; gap: .5rem; flex-wrap: wrap;
    padding: 1rem 1.6rem 2rem;
    color: var(--text-muted); font-size: .82rem;
}

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 25;
}
.sidebar-backdrop[hidden] { display: none; }

/* ---------- 3. Navigation ------------------------------------------------ */

.nav { padding: .8rem .6rem; overflow-y: auto; flex: 1; }

.nav__link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .58rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: .92rem;
    text-decoration: none;
    cursor: pointer;
}
.nav__link:hover { background: var(--sidebar-active); color: var(--sidebar-text-strong); text-decoration: none; }
.nav__link.is-active { background: var(--accent); color: #fff; }
.nav__link.is-active .nav__icon { color: #fff; }

.nav__icon { display: grid; place-items: center; color: #94a3b8; }
.nav__link.is-active .nav__icon,
.nav__link:hover .nav__icon { color: inherit; }

.nav__group { margin-bottom: .1rem; }
.nav__summary { list-style: none; user-select: none; }
.nav__summary::-webkit-details-marker { display: none; }

.nav__chevron { margin-left: auto; transition: transform .15s ease; opacity: .7; }
.nav__chevron .icon { width: 15px; height: 15px; }
.nav__group[open] > .nav__summary .nav__chevron { transform: rotate(90deg); }

.nav__sub { list-style: none; margin: .15rem 0 .4rem; padding: 0 0 0 2.15rem; }

.nav__sublink {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .6rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: .88rem;
    text-decoration: none;
}
.nav__sublink:hover { background: var(--sidebar-active); color: var(--sidebar-text-strong); text-decoration: none; }
.nav__sublink.is-active { color: #fff; background: var(--sidebar-active); font-weight: 600; }
.nav__sublink.is-soon { opacity: .45; cursor: default; }

.badge {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .08rem .35rem;
    border-radius: 999px;
    border: 1px solid currentColor;
}

.user-chip { display: flex; align-items: center; gap: .6rem; padding: .3rem .3rem .7rem; }
.user-chip__avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 650; flex: none;
}
.user-chip__text { display: flex; flex-direction: column; min-width: 0; }
.user-chip__text strong { color: var(--sidebar-text-strong); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip__text small { color: #94a3b8; font-size: .76rem; }

.logout-form .btn { color: var(--sidebar-text); border-color: rgba(255, 255, 255, .12); }
.logout-form .btn:hover { background: var(--sidebar-active); color: #fff; }

/* ---------- 4. Bausteine ------------------------------------------------- */

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.2rem;
}
.page-head p { color: var(--text-muted); margin: 0; }

.section { margin-bottom: 1.8rem; }
.section__head { margin-bottom: .8rem; }
.section__head p { color: var(--text-muted); margin: 0; font-size: .9rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card--muted { background: var(--surface-2); box-shadow: none; }
.card--muted h3 { display: flex; align-items: center; gap: .5rem; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .5rem; }
.card__head h3 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.card__text { color: var(--text-muted); font-size: .9rem; }
.card__foot { margin-top: .9rem; }
.card__error {
    background: var(--error-soft); color: var(--error);
    padding: .5rem .7rem; border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: .4rem; font-size: .86rem;
}

.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card__facts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1rem; margin: .9rem 0 0; }
.card__facts div { display: flex; flex-direction: column; }
.card__facts dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.card__facts dd { margin: 0; font-size: .92rem; font-weight: 550; }

.stat-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 1.8rem; }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .95rem 1.1rem; box-shadow: var(--shadow);
}
.stat__label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.stat__value { display: block; font-size: 1.7rem; font-weight: 650; line-height: 1.3; }
.stat__value--sm { font-size: 1.05rem; font-weight: 550; padding-top: .45rem; }
.stat__value small { font-size: .85rem; font-weight: 400; color: var(--text-muted); }

.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .16rem .6rem; border-radius: 999px;
    font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--error { background: var(--error-soft); color: var(--error); }
.pill--info { background: var(--info-soft); color: var(--info); }
.pill--idle { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.alert {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .75rem .95rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; font-size: .9rem;
    border: 1px solid transparent;
}
.alert__icon { flex: none; display: grid; place-items: center; }
.alert__icon .icon { width: 18px; height: 18px; }
.alert--success { background: var(--ok-soft); color: var(--ok); border-color: currentColor; }
.alert--error { background: var(--error-soft); color: var(--error); border-color: currentColor; }
.alert--warning { background: var(--warn-soft); color: var(--warn); border-color: currentColor; }
.alert--info { background: var(--info-soft); color: var(--info); border-color: currentColor; }
.alert strong { font-weight: 650; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: none; }
.table--compact th, .table--compact td { padding: .4rem .5rem; }
.table th[scope="row"] { font-weight: 550; color: var(--text-muted); }

.def-list { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: .45rem 1rem; margin: 0; }
.def-list dt { color: var(--text-muted); font-size: .85rem; }
.def-list dd { margin: 0; font-size: .92rem; }

.tag {
    display: inline-block; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 6px; padding: .05rem .35rem; margin: 0 .2rem .2rem 0;
    font-size: .78rem; font-family: var(--mono);
}
.details-cell { max-width: 380px; }

.empty-state {
    display: flex; align-items: center; gap: .5rem; justify-content: center;
    color: var(--text-muted); padding: 1.6rem; text-align: center;
}

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist__item {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem 0; border-bottom: 1px solid var(--border);
}
.checklist__item:last-child { border-bottom: none; }
.checklist__icon { color: var(--text-muted); display: grid; place-items: center; }
.checklist__item.is-done .checklist__icon { color: var(--ok); }
.checklist__state { margin-left: auto; font-size: .82rem; color: var(--text-muted); }

.hint-box {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 1rem 0;
    font-size: .88rem;
}
.hint-box ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.hint-box li { margin-bottom: .2rem; }

/* Formulare */
.form { display: block; }
.form--inline { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.form--inline .field { margin-bottom: 0; min-width: 200px; flex: 1; }

.field { margin-bottom: 1rem; }
.field label {
    display: block; font-size: .85rem; font-weight: 600;
    margin-bottom: .3rem; color: var(--text);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="time"],
.field select,
.field textarea {
    width: 100%;
    padding: .58rem .7rem;
    font: inherit;
    font-size: .93rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-muted); opacity: .7; }
.field__hint { font-size: .8rem; color: var(--text-muted); margin: .35rem 0 0; }
.field__meta { margin-top: .1rem; }

/* Formulare mit mehreren Feldern nebeneinander (Agenten-Einstellungen) */
.form-grid {
    display: grid;
    gap: 0 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-grid--tight { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: 640px; }

.field__label {
    display: block; font-size: .85rem; font-weight: 600;
    margin-bottom: .3rem; color: var(--text);
}
.field__note { font-weight: 400; color: var(--text-muted); font-size: .78rem; margin-left: .35rem; }

.fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem .4rem;
    margin: .4rem 0 1.2rem;
}
.fieldset legend { font-size: .85rem; font-weight: 640; padding: 0 .4rem; }

.input--code {
    font-family: var(--mono);
    font-size: 1.4rem !important;
    letter-spacing: .35em;
    text-align: center;
}

.checkbox { display: inline-flex; align-items: center; gap: .45rem; font-size: .87rem; margin: .3rem 0; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; }
.checkbox--danger { color: var(--error); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .55rem 1rem;
    font: inherit; font-size: .9rem; font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: var(--surface-2);
    color: var(--text);
    transition: background .12s ease, border-color .12s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.is-busy { opacity: .6; }
.btn .icon { width: 17px; height: 17px; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn--danger { background: var(--error); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(.93); }
.btn--block { width: 100%; }
.btn--sm { padding: .35rem .7rem; font-size: .84rem; }

.btn-link {
    background: none; border: none; padding: 0; font: inherit; font-size: .88rem;
    color: var(--accent); cursor: pointer; text-decoration: underline;
}
.inline-form { display: inline; }

.icon-btn {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    background: transparent; border: none; border-radius: var(--radius-sm);
    color: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.button-row--sticky {
    position: sticky; bottom: 0;
    background: var(--bg);
    padding: .8rem 0;
    border-top: 1px solid var(--border);
}

.pagination { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; font-size: .87rem; color: var(--text-muted); }

.details-inline > summary { cursor: pointer; font-size: .88rem; }
.details-inline--right { position: relative; }
.details-inline--right > summary { display: inline-flex; }
.popover {
    position: absolute; right: 0; z-index: 15;
    width: min(320px, 80vw);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    text-align: left;
}
.popover hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

.steps { counter-reset: step; list-style: none; margin: 0 0 1rem; padding: 0; }
.steps > li { position: relative; padding: 0 0 1.2rem 2.3rem; }
.steps > li::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 0; top: 0;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: .82rem; font-weight: 650;
}
.steps > li p { color: var(--text-muted); font-size: .88rem; margin: .25rem 0 .5rem; }

.qr-box {
    display: inline-block;
    background: #fff;
    padding: .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: .6rem 0;
}
.qr-box svg { display: block; width: 200px; height: 200px; }

.secret-display { text-align: center; margin: .5rem 0; }
.secret-display code {
    font-size: 1.05rem; letter-spacing: .12em;
    background: var(--surface-2); border: 1px solid var(--border);
    padding: .5rem .8rem; border-radius: var(--radius-sm); display: inline-block;
    word-break: break-all;
}

.code-grid {
    list-style: none; margin: 1rem 0; padding: 0;
    display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.code-grid code {
    display: block; text-align: center;
    background: var(--surface-2); border: 1px dashed var(--border-strong);
    padding: .55rem; border-radius: var(--radius-sm);
    font-size: 1rem; letter-spacing: .08em;
}
.code-large { font-size: 1.1rem; letter-spacing: .05em; }

/* Fortschrittsbalken – Breite über Klassen statt style-Attribut,
   weil die Content-Security-Policy Inline-Styles verbietet */
.progress {
    height: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin: .6rem 0 .3rem;
}
.progress__bar { height: 100%; background: var(--accent); border-radius: 999px; }
.progress__bar--w0 { width: 0%; }
.progress__bar--w5 { width: 5%; }
.progress__bar--w10 { width: 10%; }
.progress__bar--w15 { width: 15%; }
.progress__bar--w20 { width: 20%; }
.progress__bar--w25 { width: 25%; }
.progress__bar--w30 { width: 30%; }
.progress__bar--w35 { width: 35%; }
.progress__bar--w40 { width: 40%; }
.progress__bar--w45 { width: 45%; }
.progress__bar--w50 { width: 50%; }
.progress__bar--w55 { width: 55%; }
.progress__bar--w60 { width: 60%; }
.progress__bar--w65 { width: 65%; }
.progress__bar--w70 { width: 70%; }
.progress__bar--w75 { width: 75%; }
.progress__bar--w80 { width: 80%; }
.progress__bar--w85 { width: 85%; }
.progress__bar--w90 { width: 90%; }
.progress__bar--w95 { width: 95%; }
.progress__bar--w100 { width: 100%; }

/* Nachbau einer Teams-Karte für die Vorschau im Postausgang */
.teams-card {
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 1rem 1.1rem;
    margin: .6rem 0 .8rem;
}
.teams-card__text { margin: 0 0 .55rem; font-size: .92rem; line-height: 1.5; }
.teams-card__text.is-bold { font-weight: 650; }
.teams-card__text.is-large { font-size: 1.12rem; margin-bottom: .2rem; }
.teams-card__text.is-subtle { color: var(--text-muted); font-size: .85rem; }
.teams-card__text.is-good { color: var(--ok); }
.teams-card__text.is-warning { color: var(--warn); }
.teams-card__text.is-attention { color: var(--error); }

.teams-card__facts {
    display: grid; grid-template-columns: minmax(120px, auto) 1fr;
    gap: .3rem .9rem; margin: .7rem 0; font-size: .88rem;
}
.teams-card__facts dt { color: var(--text-muted); }
.teams-card__facts dd { margin: 0; font-weight: 550; }

.teams-card__row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: .5rem; padding: .35rem 0; font-size: .84rem;
    border-bottom: 1px solid var(--border);
}
.teams-card__row.is-header { font-weight: 650; color: var(--text-muted); text-transform: none; }
.teams-card__row:last-of-type { border-bottom: none; }

.teams-card__actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .9rem; }

.code-block {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .8rem;
    font-family: var(--mono); font-size: .78rem;
    overflow-x: auto; max-height: 420px; margin: .7rem 0 0;
}

/* ---------- 5. Anmeldeseiten --------------------------------------------- */

.auth-body { background: var(--bg); display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.auth-wrap { width: 100%; max-width: 460px; }

.auth-brand {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    font-weight: 650; font-size: 1.05rem; margin-bottom: 1.2rem;
}
.auth-brand__logo {
    display: grid; place-items: center; width: 34px; height: 34px;
    border-radius: 10px; background: var(--accent); color: #fff;
}
.auth-brand__logo .icon { width: 19px; height: 19px; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.8rem;
}
.auth-title { font-size: 1.28rem; margin-bottom: .35rem; }
.auth-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.3rem; }
.auth-links { margin-top: 1rem; font-size: .88rem; text-align: center; }
.auth-hint {
    margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border);
    font-size: .82rem; color: var(--text-muted);
}
.auth-footer { text-align: center; color: var(--text-muted); font-size: .8rem; margin-top: 1.2rem; }

/* ---------- 6. Responsive & Druck ---------------------------------------- */

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar__close { display: grid; }
    .topbar__burger { display: grid; }
    .content { padding: 1.1rem; }
    .card__facts { grid-template-columns: 1fr; }
    .panel-grid { grid-template-columns: 1fr; }
    .panel__body { grid-template-columns: 1fr; gap: .9rem; }
    .panel__number { font-size: 2.4rem; }
    .panel__unit { max-width: none; }
    .topbar__meta { display: none; }
}

/* ---------- Auswertungs-Panels & Diagramme ------------------------------- */
/*
   Die Panels auf der Startseite: je Agent eine Kernzahl, eine Einordnung und
   ein oder zwei Diagramme. Die Diagramme sind SVG, das PHP direkt erzeugt --
   die Farben kommen aus den Variablen oben, damit der Dunkelmodus ohne
   Zusatzarbeit mitläuft.
*/

.panel-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.35rem 1.45rem;
    position: relative;
    overflow: hidden;
}

/* Schmaler Farbstreifen links: Zustand auf einen Blick, ohne Ampel-Kitsch */
.panel::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--accent);
}
.panel--ok::before    { background: var(--ok); }
.panel--warn::before  { background: var(--warn); }
.panel--error::before { background: var(--error); }

.panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.panel__head h3 { margin: 0; font-size: 1.06rem; font-weight: 640; }
.panel__meta { margin: .25rem 0 0; font-size: .82rem; color: var(--text-muted); }

.panel__body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.4rem;
    align-items: center;
}

.panel__figure { display: flex; flex-direction: column; min-width: 5.5rem; }
.panel__number {
    font-size: 2.9rem;
    font-weight: 680;
    line-height: 1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.panel--ok    .panel__number { color: var(--ok); }
.panel--warn  .panel__number { color: var(--warn); }
.panel--error .panel__number { color: var(--error); }

.panel__unit {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .35rem;
    max-width: 8.5rem;
    line-height: 1.35;
}

.panel__text { margin: 0; font-size: .92rem; line-height: 1.55; color: var(--text); }

.panel__charts {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    border-top: 1px solid var(--border);
    padding-top: 1.1rem;
}

.chart-box { margin: 0; min-width: 0; }
.chart-box figcaption {
    font-size: .76rem;
    font-weight: 560;
    color: var(--text-muted);
    margin-bottom: .55rem;
    letter-spacing: .01em;
}

.panel__facts {
    list-style: none;
    margin: 0;
    padding: .85rem 0 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.6rem;
}
.panel__facts li { display: flex; flex-direction: column; gap: .1rem; }
.panel__facts span { font-size: .72rem; color: var(--text-muted); }
.panel__facts strong { font-size: .88rem; font-weight: 580; font-variant-numeric: tabular-nums; }

.panel__foot { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }

.stat__value--warn { color: var(--warn); }

/* ---------- Die SVG-Diagramme selbst ------------------------------------- */
/*
   Gestaltung angelehnt an shadcn/ui: zurückgenommene gestrichelte Hilfslinien,
   keine Achsenlinien, abgerundete Säulenköpfe, weiche Kurve mit Farbverlauf.
   Alle Farben kommen aus den Variablen ganz oben - dadurch stimmt der
   Dunkelmodus ohne eigene Regeln.
*/

.chart { display: block; width: 100%; height: auto; overflow: visible; }

.chart__grid {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: .75;
}
.chart__grid--basis { stroke-dasharray: none; opacity: 1; }

.chart__label {
    font-size: 11px;
    fill: var(--text-muted);
    letter-spacing: .01em;
}
.chart__value {
    font-size: 12.5px;
    font-weight: 620;
    fill: var(--text);
    font-variant-numeric: tabular-nums;
}
.chart__value--null { fill: var(--text-muted); font-weight: 500; opacity: .55; }

/* Säulen */
.chart__col { fill: var(--accent); }
.chart__col--warn  { fill: var(--warn); }
.chart__col--error { fill: var(--error); }
.chart__col--ok    { fill: var(--ok); }

/* Verlaufskurve */
.chart__line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.chart__line--warn  { stroke: var(--warn); }
.chart__line--error { stroke: var(--error); }
.chart__line--ok    { stroke: var(--ok); }

.chart__flaeche { stroke: none; }
.chart__stop-top    { stop-color: var(--accent); stop-opacity: .32; }
.chart__stop-bottom { stop-color: var(--accent); stop-opacity: .02; }
.chart__stop--warn  { stop-color: var(--warn); }
.chart__stop--error { stop-color: var(--error); }
.chart__stop--ok    { stop-color: var(--ok); }

.chart__dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart__dot--warn  { fill: var(--warn); }
.chart__dot--error { fill: var(--error); }
.chart__dot--ok    { fill: var(--ok); }

/* ---------- Einblendung beim Darueberfahren ------------------------------
   Umgesetzt in reinem SVG plus CSS-Hover: kein JavaScript noetig, damit
   auch nichts an der Sicherheitsrichtlinie vorbei muss. In SVG gibt es kein
   z-index - die Reihenfolge im Dokument entscheidet, deshalb stehen die
   Punktgruppen im Markup ganz hinten.
*/

.chart__hover { fill: transparent; cursor: default; }

.chart__punkt .chart__tip,
.chart__punkt .chart__fokus,
.chart__punkt .chart__fokus-punkt {
    opacity: 0;
    transition: opacity .12s ease;
    pointer-events: none;
}
.chart__punkt:hover .chart__tip,
.chart__punkt:hover .chart__fokus,
.chart__punkt:hover .chart__fokus-punkt { opacity: 1; }

/* Senkrechte Fokuslinie am Messpunkt */
.chart__fokus {
    stroke: var(--text-muted);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: .5;
}

.chart__fokus-punkt { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; }
.chart__fokus-punkt--warn  { fill: var(--warn); }
.chart__fokus-punkt--error { fill: var(--error); }
.chart__fokus-punkt--ok    { fill: var(--ok); }

/* Die Karte selbst */
.chart__tip-box {
    fill: var(--surface);
    stroke: var(--border);
    stroke-width: 1;
    filter: drop-shadow(0 4px 10px rgba(15, 23, 42, .16));
}
.chart__tip-label {
    font-size: 10.5px;
    font-weight: 500;
    fill: var(--text-muted);
    letter-spacing: .01em;
}
.chart__tip-wert {
    font-size: 13px;
    font-weight: 660;
    fill: var(--text);
    font-variant-numeric: tabular-nums;
}
.chart__tip-punkt { fill: var(--accent); }
.chart__tip-punkt--warn  { fill: var(--warn); }
.chart__tip-punkt--error { fill: var(--error); }
.chart__tip-punkt--ok    { fill: var(--ok); }

/* Helles Band ueber der Spalte unter dem Zeiger - wie bei shadcn.
   Es liegt ueber der Saeule statt dahinter (SVG kennt kein z-index), ist
   dafuer so blass, dass die Saeule durchscheint und nur leicht abgesetzt
   wirkt. */
.chart__band { fill: var(--text); fill-opacity: 0; transition: fill-opacity .12s ease; pointer-events: none; }
.chart__punkt:hover .chart__band { fill-opacity: .055; }

.chart-empty { margin: 0; font-size: .82rem; color: var(--text-muted); font-style: italic; }

.checklist--inline { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; }
.checklist--inline .checklist__item { border: 0; padding: .3rem 0; }

/* ---------- Detailseite: Fundtabelle & Kleinteile ------------------------ */

.card--table { padding-bottom: .9rem; }

/* Breite Tabellen scrollen in sich selbst, statt die ganze Seite zu schieben */
.table-scroll { overflow-x: auto; margin: -.25rem 0 .5rem; }

.table--findings { min-width: 640px; }
.table--findings td.mono { font-family: var(--mono); font-size: .86rem; }

.table--findings tr.is-urgent { background: var(--warn-soft); }
.table--findings tr.is-urgent td { font-weight: 560; }
/* Farbe allein soll die Dringlichkeit nicht tragen - der Strich sagt es auch */
.table--findings tr.is-urgent td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.mini-list li { display: flex; justify-content: space-between; gap: 1rem; }
.mini-list span { color: var(--text-muted); }
.mini-list strong { font-weight: 580; font-variant-numeric: tabular-nums; white-space: nowrap; }

.inline-code {
    font-family: var(--mono);
    font-size: .82rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .1rem .35rem;
}

/* ---------- Umsatzauswertung --------------------------------------------- */

.stat__foot {
    display: block;
    font-size: .76rem;
    color: var(--text-muted);
    margin-top: .4rem;
    line-height: 1.4;
}

/* Veränderungspfeil. Die Richtung steht als Zeichen davor, nicht nur als
   Farbe - sonst ginge die Aussage bei Farbfehlsichtigkeit verloren. */
.trend { font-weight: 620; white-space: nowrap; }
.trend--hoch   { color: var(--ok); }
.trend--runter { color: var(--error); }
.trend--gleich { color: var(--text-muted); font-weight: 500; }

.table tr.is-muted td { color: var(--text-muted); }

/* ---------- Zeitraumwahl -------------------------------------------------- */
/*
   Schaltflaechen als Links, nicht als Formular: Der gewaehlte Zeitraum steht
   damit in der Adresse und laesst sich als Lesezeichen speichern.
*/

.zeitraum {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    margin-bottom: 1.4rem;
}
.zeitraum__gruppe { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.zeitraum__titel {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-right: .15rem;
}
.zeitraum__knopf {
    display: inline-block;
    padding: .38rem .78rem;
    font-size: .85rem;
    font-weight: 550;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
}
.zeitraum__knopf:hover { border-color: var(--accent); color: var(--accent); }
.zeitraum__knopf.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
/* Im Dunkelmodus ist der Akzent hell - dann braucht die Schrift Kontrast */
@media (prefers-color-scheme: dark) {
    .zeitraum__knopf.is-active { color: #0b1120; }
}

.zeitraum--zweite { margin-top: -.7rem; margin-bottom: 1.2rem; }
.zeitraum__knopf--klein { padding: .3rem .66rem; font-size: .8rem; }

.zeitraum__hinweis {
    margin: 0 0 1.1rem;
    font-size: .9rem;
    color: var(--text-muted);
}
.zeitraum__hinweis strong { color: var(--text); }

/* ---------- Farbpalette fuer Anteilsdiagramme ---------------------------- */
/*
   Sechs unterscheidbare Farben, angelehnt an die Chart-Variablen von shadcn.
   Bewusst in der Helligkeit gestaffelt, damit die Reihenfolge auch in
   Graustufen und bei Farbfehlsichtigkeit erkennbar bleibt.
*/
:root {
    --chart-1: #4338ca;
    --chart-2: #0891b2;
    --chart-3: #059669;
    --chart-4: #d97706;
    --chart-5: #db2777;
    --chart-6: #7c3aed;
}
@media (prefers-color-scheme: dark) {
    :root {
        --chart-1: #818cf8;
        --chart-2: #22d3ee;
        --chart-3: #34d399;
        --chart-4: #fbbf24;
        --chart-5: #f472b6;
        --chart-6: #a78bfa;
    }
}

.chart__farbe--1 { fill: var(--chart-1); }
.chart__farbe--2 { fill: var(--chart-2); }
.chart__farbe--3 { fill: var(--chart-3); }
.chart__farbe--4 { fill: var(--chart-4); }
.chart__farbe--5 { fill: var(--chart-5); }
.chart__farbe--6 { fill: var(--chart-6); }

.chart__strich--1 { stroke: var(--chart-1); }
.chart__strich--2 { stroke: var(--chart-2); }
.chart__strich--3 { stroke: var(--chart-3); }
.chart__strich--4 { stroke: var(--chart-4); }
.chart__strich--5 { stroke: var(--chart-5); }
.chart__strich--6 { stroke: var(--chart-6); }

/* Ring und Torte */
.chart__stueck { stroke: var(--surface); stroke-width: 1.5; }
.chart__ring-summe { font-size: 21px; font-weight: 680; fill: var(--text); font-variant-numeric: tabular-nums; }
.chart__ring-unter { font-size: 10.5px; fill: var(--text-muted); }

.chart__legende { font-size: 11.5px; fill: var(--text); }
.chart__legende-wert { font-size: 11.5px; fill: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Radial */
.chart__radial-bahn { fill: none; stroke: var(--border); opacity: .55; stroke-linecap: round; }
.chart__radial { fill: none; stroke-linecap: round; }
.chart__hover-strich { fill: none; stroke: transparent; stroke-linecap: round; cursor: default; }

/* Radar */
.chart__netz { fill: none; stroke: var(--border); stroke-width: 1; opacity: .8; }
.chart__radar-flaeche { fill: var(--accent); fill-opacity: .22; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart__radar-punkt { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }

/* ---------- Themenliste der Chat-Auswertung ------------------------------ */

.themen { display: grid; gap: .9rem; }

.thema {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.05rem 1.2rem;
}

.thema__kopf { display: flex; align-items: flex-start; gap: .9rem; }

.thema__rang {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .8rem; font-weight: 680;
    font-variant-numeric: tabular-nums;
}

.thema__titel { flex: 1 1 auto; min-width: 0; }
.thema__titel h3 { margin: 0; font-size: 1rem; font-weight: 640; }
.thema__titel p { margin: .2rem 0 0; font-size: .85rem; color: var(--text-muted); line-height: 1.45; }

.thema__zahl { text-align: right; flex: 0 0 auto; }
.thema__zahl strong { display: block; font-size: 1.25rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.thema__zahl span { font-size: .76rem; color: var(--text-muted); }

.thema__balken {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin: .8rem 0 .1rem;
}
.thema__balken-wert { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.thema__beispiele {
    list-style: none;
    margin: .75rem 0 0;
    padding: .7rem 0 0;
    border-top: 1px solid var(--border);
    display: grid; gap: .4rem;
}
.thema__beispiele li {
    font-size: .85rem;
    color: var(--text-muted);
    padding-left: .9rem;
    position: relative;
    line-height: 1.5;
}
.thema__beispiele li::before {
    content: "„";
    position: absolute; left: 0; top: 0;
    color: var(--border-strong);
    font-size: 1.1rem; line-height: 1.2;
}

@media print {
    .sidebar, .topbar, .footer, .button-row, .sidebar-backdrop, .zeitraum { display: none !important; }
    body { background: #fff; }
    .card, .auth-card, .panel { box-shadow: none; border: 1px solid #999; }
    .code-grid code { border: 1px solid #333; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
