/* ==========================================================================
   Flexportal Backend – Admin-Styles
   Umsetzung der Designvorlage „Beratungsplattform Backend“, Richtung A
   (Arbeitsplatz): helle Seitenleiste mit Icons und Labels, luftige Karten,
   eine Aufgabe pro Seite. Alle Werte sind als Design-Tokens in :root definiert.
   ========================================================================== */

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Grundfarben */
    --c-bg: #f5f6fa;
    --c-surface: #ffffff;
    --c-ink: #1e1b39;
    --c-text-2: #4a4865;
    --c-muted: #6e6e8a;
    --c-line: #f0f0f5;
    --c-line-2: #ececf3;
    --c-input-border: #e3e3ec;

    /* Akzent */
    --c-primary: #5b2fd6;
    --c-primary-hover: #4720b8;
    --c-primary-soft: #efeafd;
    --c-primary-border: #d9d0f7;

    /* Status-Töne: Hintergrund / Vordergrund */
    --t-live-bg: #efeafd;   --t-live-fg: #5b2fd6;
    --t-online-bg: #e3f8fa; --t-online-fg: #0b7f8b;
    --t-pause-bg: #fff4e5;  --t-pause-fg: #9a5b00;
    --t-offline-bg: #f1f1f5; --t-offline-fg: #6e6e8a;
    --t-warn-bg: #fdecec;   --t-warn-fg: #c0392b;
    --t-ok-bg: #e7f7ee;     --t-ok-fg: #1e7d4a;
    --c-danger-border: #f5d0cc;

    /* Typografie */
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Form */
    --radius-sm: 7px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-pill: 20px;
    --shadow-card: 0 2px 16px rgba(30, 27, 57, .04);
    --shadow-raised: 0 1px 4px rgba(30, 27, 57, .1);
    --shadow-lg: 0 20px 60px rgba(30, 27, 57, .12);
    --ring: 0 0 0 3px rgba(91, 47, 214, .18);

    --sidebar-w: 232px;
    --gap: 16px;
    --page-pad: 28px;
}

/* --- Basis --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--c-ink);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: 0; }
input, select, textarea, button { font-family: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 12px; color: var(--c-text-2); }

.icon {
    width: 18px;
    height: 18px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.muted { color: var(--c-muted); }
.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;
}
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.num { font-variant-numeric: tabular-nums; }
.text-2 { color: var(--c-text-2); }

/* --- Shell --------------------------------------------------------------- */

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    background: var(--c-surface);
    border-right: 1px solid var(--c-line);
}

.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; color: var(--c-ink); }
.sidebar__brand:hover { color: var(--c-ink); }

.brand-mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    font-weight: 800;
}
.brand-name { font-weight: 700; font-size: 17px; }

.sidebar__nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group--bottom { margin-top: auto; padding-top: 12px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--c-text-2);
    font-size: 13.5px;
    font-weight: 500;
}
.nav-link span { flex: 1; }
.nav-link:hover { background: var(--c-bg); color: var(--c-ink); }
.nav-link.is-active { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 700; }
.nav-link__badge {
    flex: none !important;
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 20px;
    padding: 0 7px;
    border-radius: 10px;
    background: var(--c-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px var(--page-pad);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-line);
}
.topbar__menu { display: none; }
.topbar__title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--c-muted); }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.topbar__actions form { margin: 0; }

.pill-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid var(--c-line-2);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--c-text-2);
    white-space: nowrap;
}
.pill-box strong { color: var(--c-ink); }

.crumb { color: var(--c-ink); font-weight: 600; }
.crumb--link { color: var(--c-muted); font-weight: 400; }
.crumb--link:hover { color: var(--c-ink); }
.crumb__sep { width: 14px; height: 14px; color: var(--c-muted); }

.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu__name { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
.user-menu__name strong { font-size: 13px; font-weight: 600; }
.user-menu__name small { font-size: 11.5px; color: var(--c-muted); }

.content {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    padding: 24px var(--page-pad) 40px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-backdrop { display: none; }

/* --- Seitenkopf ------------------------------------------------------------ */

.page-head { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.page-head > :first-child { flex: 1; min-width: 240px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.page-subtitle { font-size: 13px; color: var(--c-muted); }

/* Kopfkarte einer Detailseite (Avatar, Name, Status, Aktionen) */
.profile-head {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 20px 22px;
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.profile-head__main { flex: 1; min-width: 220px; }
.profile-head__title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.profile-head__name { font-size: 22px; font-weight: 700; }
.profile-head__meta { margin-top: 2px; font-size: 13px; color: var(--c-muted); }
.profile-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-head__actions form { margin: 0; }

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

.card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.card__header { display: flex; align-items: baseline; gap: 12px; padding: 18px 20px 0; }
.card__header .link { margin-left: auto; font-size: 12px; font-weight: 600; }
.card__title { font-size: 15px; font-weight: 700; }
.card__subtitle { font-size: 13px; color: var(--c-muted); margin-top: 2px; }
.card__body { padding: 18px 20px 20px; }
.card--form .card__header { padding: 24px 28px 0; flex-direction: column; gap: 0; }
.card--form .card__title { font-size: 17px; }
.card--form .card__body { padding: 22px 28px 26px; }
.card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--c-line);
    font-size: 12.5px;
}
.card--danger .card__title { color: var(--t-warn-fg); }

/* --- Kennzahlen ------------------------------------------------------------ */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }

.stat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    color: inherit;
    transition: box-shadow .15s;
}
a.stat:hover { color: inherit; box-shadow: 0 4px 22px rgba(30, 27, 57, .09); }
.stat__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--t-live-bg);
    color: var(--t-live-fg);
}
.stat__icon .icon { width: 17px; height: 17px; }
.stat__label { font-size: 12.5px; color: var(--c-muted); }
.stat__value { font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: 12px; font-weight: 600; color: var(--c-muted); }
.stat--success .stat__icon { background: var(--t-ok-bg); color: var(--t-ok-fg); }
.stat--muted .stat__icon { background: var(--t-offline-bg); color: var(--t-offline-fg); }
.stat--accent .stat__icon { background: var(--t-online-bg); color: var(--t-online-fg); }
.stat--warn .stat__icon { background: var(--t-warn-bg); color: var(--t-warn-fg); }

/* Kompakte Kennzahl-Karten (Rollen-/Filterkarten der Benutzerliste) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.tile {
    display: block;
    padding: 16px 18px;
    background: var(--c-surface);
    border: 1.5px solid transparent;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    color: inherit;
}
.tile:hover { color: inherit; border-color: var(--c-primary-border); }
.tile.is-active { border-color: var(--c-primary); }
.tile__head { display: flex; align-items: baseline; gap: 8px; }
.tile__title { flex: 1; font-size: 14px; font-weight: 700; }
.tile__value { font-size: 20px; font-weight: 700; color: var(--c-primary); font-variant-numeric: tabular-nums; }
.tile__desc { margin-top: 4px; font-size: 12px; line-height: 1.45; color: var(--c-muted); }

.panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.panel--wide { grid-column: 1 / -1; }

/* Listen in Karten (z. B. „Letzte Anmeldungen“) */
.list { list-style: none; margin: 0; padding: 6px 20px 8px; }
.list__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--c-line);
}
.list__item:last-child { border-bottom: 0; }
.list__meta { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list__meta small { display: block; font-size: 11.5px; font-weight: 400; color: var(--c-muted); }
.link { font-weight: 600; }

/* Schlüssel/Wert-Liste (Seitenkarte „Informationen“) */
.meta-list { margin: 0; padding: 8px 20px 14px; font-size: 12.5px; }
.meta-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--c-line); }
.meta-list > div:last-child { border-bottom: 0; }
.meta-list dt { color: var(--c-muted); }
.meta-list dd { margin: 0; font-weight: 700; text-align: right; }

/* Kennzahlen einer Detailseite (Wert farbig, Notiz darunter) */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi { padding: 14px 18px; background: var(--c-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.kpi__label { font-size: 12.5px; color: var(--c-muted); }
.kpi__value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi__value--warn { color: var(--t-pause-fg); }
.kpi__value--ok { color: var(--t-ok-fg); }
.kpi__note { font-size: 12px; color: var(--c-muted); }

/* Reiter mit Unterstrich */
.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--c-line-2); overflow-x: auto; }
.tab {
    padding: 14px 12px 12px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-muted);
    white-space: nowrap;
}
.tab:hover { color: var(--c-ink); }
.tab.is-active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab .count { margin-left: 4px; }

/* Kompakte Zeilenliste in Seitenkarten */
.mini-list { margin: 0; padding: 4px 20px 14px; list-style: none; font-size: 12.5px; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--c-line); }
.mini-list li:last-child { border-bottom: 0; }

.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.table th.text-right { text-align: right; }

/* --- Buttons ------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-hover); color: #fff; }
.btn--secondary { background: var(--c-surface); border-color: var(--c-input-border); color: var(--c-text-2); }
.btn--secondary:hover { background: var(--c-bg); color: var(--c-ink); }
.btn--outline { background: var(--c-surface); border-color: var(--c-primary-border); color: var(--c-primary); }
.btn--outline:hover { background: var(--c-primary-soft); color: var(--c-primary); }
.btn--ghost { color: var(--c-text-2); padding-inline: 12px; }
.btn--ghost:hover { background: var(--c-surface); color: var(--c-ink); }
.btn--danger { background: var(--c-surface); border-color: var(--c-danger-border); color: var(--t-warn-fg); }
.btn--danger:hover { background: var(--t-warn-bg); color: var(--t-warn-fg); }
.btn--block { width: 100%; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--c-muted);
    cursor: pointer;
}
.icon-btn:hover { background: var(--c-bg); color: var(--c-ink); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn .icon { width: 17px; height: 17px; }

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

.form-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.grid-postal { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 0 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }

.field { display: flex; flex-direction: column; }
.field__label { display: block; margin-bottom: 6px; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--c-ink); }
.field__hint { margin-top: 5px; font-size: 11.5px; color: var(--c-muted); }
.field__error { margin-top: 5px; font-size: 11.5px; font-weight: 600; color: var(--t-warn-fg); }

.input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--c-input-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-ink);
    font: inherit;
    font-size: 14px;
    line-height: 1.3;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--c-muted); }
.input:hover { border-color: #cfcfdc; }
.input:focus { outline: none; border-color: var(--c-primary); box-shadow: var(--ring); }
select.input {
    padding-right: 36px;
    appearance: none;
    background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236e6e8a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.has-error .input { border-color: var(--t-warn-fg); }
.has-error .input:focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, .14); }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--c-muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }

.fieldset { margin: 0; padding: 0; border: 0; min-width: 0; transition: opacity .15s; }
.fieldset.is-muted { opacity: .45; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--c-input-border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
}
.check:hover { border-color: var(--c-primary-border); }
.check:has(input:checked) { border-color: var(--c-primary-border); background: var(--c-primary-soft); color: var(--c-primary); font-weight: 600; }
.check input { accent-color: var(--c-primary); width: 16px; height: 16px; margin: 0; }

/* Schalter in grauer Box, wie in der Vorlage (Einstellungen) */
.switch {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--c-bg);
    cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
    position: relative;
    flex: none;
    width: 38px;
    height: 22px;
    border-radius: 11px;
    background: #cfcfdc;
    transition: background .15s;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s;
}
.switch input:checked + .switch__track { background: var(--c-primary); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch input:disabled + .switch__track { opacity: .5; }
.switch:has(input:disabled) { cursor: not-allowed; }
.switch__text { flex: 1; display: flex; flex-direction: column; }
.switch__text strong { font-size: 13px; font-weight: 600; }
.switch__text small { font-size: 12px; color: var(--c-muted); }
.switch.has-error { box-shadow: inset 0 0 0 1px var(--t-warn-fg); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px;
    border-top: 1px solid var(--c-line);
}
.form-section + .form-section { border-top: 1px solid var(--c-line); }

.form-narrow { max-width: 920px; }
.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: var(--gap); align-items: start; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { padding: 2px 9px; border-radius: var(--radius-pill); background: var(--t-offline-bg); color: var(--c-text-2); font-family: var(--font-mono); font-size: 11.5px; }

/* --- Toolbar, Suche, Filter ---------------------------------------------- */

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--c-line);
}
.toolbar__spacer { flex: 1; }

.search {
    position: relative;
    width: 260px;
    max-width: 100%;
}
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--c-muted); pointer-events: none; }
.search .input { padding: 8px 12px 8px 34px; border-color: transparent; background: var(--c-bg); font-size: 13px; }
.search .input:focus { background: var(--c-surface); border-color: var(--c-primary); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--c-text-2);
}
.filter-pill:hover { background: var(--c-bg); color: var(--c-ink); }
.filter-pill.is-active { background: var(--c-primary-soft); color: var(--c-primary); }
.count { font-size: 11px; font-weight: 700; opacity: .7; }

/* --- Tabelle ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    padding: 12px 10px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--c-muted);
    white-space: nowrap;
}
.table td { padding: 10px; border-top: 1px solid var(--c-line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:hover { background: #fafafd; }
.table__actions { width: 1%; text-align: right; white-space: nowrap; }
.table__empty { padding: 48px 20px !important; text-align: center; color: var(--c-muted); }

.th-sort { display: inline-flex; align-items: center; gap: 3px; color: inherit; }
.th-sort .icon { width: 12px; height: 12px; opacity: .45; }
.th-sort:hover, .th-sort.is-active { color: var(--c-ink); }
.th-sort.is-active .icon { opacity: 1; color: var(--c-primary); }

.row-actions { display: inline-flex; gap: 2px; }
.row-actions form { margin: 0; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; }
.person:hover { color: inherit; }
.person:hover strong { color: var(--c-primary); }
.person__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.person__text strong { font-weight: 600; }
.person__text small { font-size: 11.5px; color: var(--c-muted); }

/* Avatare in sechs Tönen, Auswahl über die Benutzer-ID */
.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e8e2fb;
    color: var(--c-primary);
    font-size: 12px;
    font-weight: 700;
}
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.avatar--lg { width: 68px; height: 68px; font-size: 22px; }
.avatar--t1 { background: #dff6f8; color: #0b7f8b; }
.avatar--t2 { background: #ffe3d3; color: #9a3b00; }
.avatar--t3 { background: #fde2ea; color: #b0284f; }
.avatar--t4 { background: #e4f3e6; color: #2c7a3b; }
.avatar--t5 { background: #fff1cc; color: #8a6100; }

/* --- Badges & Status (Pills) -------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--t-offline-bg);
    color: var(--c-text-2);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge--accent, .badge--live { background: var(--t-live-bg); color: var(--t-live-fg); }
.badge--ok { background: var(--t-ok-bg); color: var(--t-ok-fg); }
.badge--warn { background: var(--t-warn-bg); color: var(--t-warn-fg); }
.badge--pause { background: var(--t-pause-bg); color: var(--t-pause-fg); }
.badge--online { background: var(--t-online-bg); color: var(--t-online-fg); }

.status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status--active { background: var(--t-ok-bg); color: var(--t-ok-fg); }
.status--disabled { background: var(--t-offline-bg); color: var(--t-offline-fg); }
.status--locked { background: var(--t-warn-bg); color: var(--t-warn-fg); }
.status--expired { background: var(--t-pause-bg); color: var(--t-pause-fg); }

/* --- Hinweise ------------------------------------------------------------- */

.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
}
.alert > span { flex: 1; }
.alert--success { background: var(--t-ok-bg); color: var(--t-ok-fg); }
.alert--error { background: var(--t-warn-bg); color: var(--t-warn-fg); }
.alert--info { background: var(--t-live-bg); color: var(--t-live-fg); }
.alert__close { display: grid; padding: 0; border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; }
.alert__close:hover { opacity: 1; }
.alert__close .icon { width: 16px; height: 16px; }

/* --- Pagination ----------------------------------------------------------- */

.pagination { display: inline-flex; gap: 4px; }
.pagination__item, .pagination__gap {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    color: var(--c-text-2);
    font-weight: 600;
}
.pagination__item:hover { background: var(--c-bg); color: var(--c-ink); }
.pagination__item.is-current { background: var(--c-primary-soft); color: var(--c-primary); }
.pagination__item .icon { width: 15px; height: 15px; }

/* --- Login & Fehlerseiten ------------------------------------------------ */

body.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--c-bg); }
.auth__wrap { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth__brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.auth__card { padding: 30px 32px 32px; box-shadow: var(--shadow-lg); }
.auth__card .alert { margin-top: 18px; }
.auth__title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 2px; }

.error-card { padding: 36px 32px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.error-card__code { font-size: 48px; font-weight: 800; color: var(--c-primary); line-height: 1; }
.error-card__title { font-size: 22px; font-weight: 700; }
.error-card__trace { width: 100%; text-align: left; font-size: 11.5px; }
.error-card__trace pre { overflow: auto; max-height: 320px; padding: 12px; background: var(--c-bg); border-radius: var(--radius); }
body.auth .auth__wrap:has(.error-card__trace) { max-width: 920px; }

/* --- Responsive ----------------------------------------------------------- */

.show-md { display: none; }

@media (max-width: 1180px) {
    .layout-2col, .panels { grid-template-columns: 1fr; }
    .stats, .tiles, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hide-md { display: none; }
    .show-md { display: inline; }
}

@media (max-width: 860px) {
    :root { --page-pad: 16px; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
    .shell.is-nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .shell.is-nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(30, 27, 57, .35); }
    .main { margin-left: 0; }
    .topbar__menu { display: inline-grid; }
    .grid-2 { grid-template-columns: 1fr; }
    .search { width: 100%; }
    .hide-sm, .user-menu__name, .pill-box { display: none; }
    .page-title { font-size: 24px; }
}

@media (max-width: 520px) {
    .stats, .tiles, .kpis { grid-template-columns: 1fr; }
}
