/* Local Noto Sans - latin */
@font-face {
    font-display: swap;
    font-family: "Noto Sans";
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/noto-sans-v42-latin-regular.woff2') format('woff2');
}

@font-face {
    font-display: swap;
    font-family: "Noto Sans";
    font-style: normal;
    font-weight: 500;
    src: url('../fonts/noto-sans-v42-latin-500.woff2') format('woff2');
}

@font-face {
    font-display: swap;
    font-family: "Noto Sans";
    font-style: normal;
    font-weight: 600;
    src: url('../fonts/noto-sans-v42-latin-600.woff2') format('woff2');
}

@font-face {
    font-display: swap;
    font-family: "Noto Sans";
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/noto-sans-v42-latin-700.woff2') format('woff2');
}

:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #24334f;
    --muted: #66748d;
    --border: #dde4ee;
    --primary: #334b91;
    --primary-dark: #253873;
    --primary-soft: #eef3fb;
    --accent: #66a2d6;
    --accent-soft: #eaf4fc;
    --success: #176b45;
    --success-bg: #e9f7ef;
    --warning: #8a5b00;
    --warning-bg: #fff4d8;
    --danger: #b42318;
    --danger-bg: #ffebe9;
    --shadow: 0 12px 32px rgba(51, 75, 145, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: "Noto Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(102, 162, 214, .10), transparent 28rem),
        var(--bg);
    color: var(--text);
}
main { flex: 1 0 auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
.shell { width: min(1540px, calc(100% - 28px)); margin: 0 auto; }

/* JeCo / REDI Invoice header */
.topbar {
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid rgba(51, 75, 145, .15);
    box-shadow: 0 5px 20px rgba(51, 75, 145, .06);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}
.topbar-inner {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: var(--text);
    text-decoration: none;
    flex: 0 0 auto;
}
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 72px;
    height: 58px;
    object-fit: contain;
    display: block;
}
.brand-copy {
    display: grid;
    line-height: 1.05;
    gap: 5px;
}
.brand-copy strong {
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.025em;
}
.brand-copy small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}
nav { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
nav a {
    color: #455574;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background-color .15s ease, color .15s ease;
}
nav a:hover {
    color: var(--primary);
    background: var(--accent-soft);
    text-decoration: none;
}

.hero, .page-heading {
    padding: 42px 0 22px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}
.hero h1, .page-heading h1 {
    margin: 4px 0 8px;
    color: var(--primary);
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: -.035em;
}
.eyebrow {
    margin: 0;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .095em;
    font-size: 12px;
}
.muted, .hint { color: var(--muted); }
.summary-card {
    min-width: 220px;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 12px;
    padding: 17px 20px;
    box-shadow: var(--shadow);
}
.summary-card span, .summary-card small { display: block; color: var(--muted); }
.summary-card strong { display: block; color: var(--primary); font-size: 26px; margin: 4px 0; }

.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 10px 0 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 5px; background: #e8edf5; padding: 4px; border-radius: 9px; }
.tabs a { padding: 8px 12px; color: #55627a; border-radius: 7px; font-weight: 700; }
.tabs a:hover { text-decoration: none; color: var(--primary); }
.tabs a.active { background: #fff; color: var(--primary); box-shadow: 0 2px 7px rgba(51,75,145,.10); }
.toolbar-actions { display: flex; gap: 8px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 13px rgba(51, 75, 145, .14);
}
.button:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.button.secondary { background: #fff; color: var(--primary); border: 1px solid #cfd8e7; box-shadow: none; }
.button.secondary:hover { background: var(--primary-soft); }
.button.danger { background: var(--danger); }

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
.invoice-table { min-width: 1080px; }
.invoice-table .supplier-col { width: 24%; }
.invoice-table .document-col { width: 22%; }
.invoice-table .date-col { width: 12%; }
.invoice-table .amount-col { width: 16%; }
.invoice-table .discount-col { width: 9%; }
.invoice-table .status-col { width: 9%; }
.invoice-table .actions-col { width: 10%; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
th {
    background: linear-gradient(180deg, #f7faff, #f1f5fb);
    color: #53617a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .045em;
    border-bottom-color: #dce5f0;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f9fbfe; }
.right { text-align: right; }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.payable-value { display: inline-block; border-radius: 7px; padding: 4px 7px; white-space: nowrap; }
.payable-value.discount-active { background: var(--success-bg); color: var(--success); box-shadow: inset 0 0 0 1px #bfe5cd; }
.amount-original { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.discount-last-day { display: block; max-width: 245px; margin: 5px 0 0 auto; color: var(--danger); font-size: 11px; line-height: 1.35; font-weight: 700; }
.negative { color: var(--danger); }
.credit-row td { background: #fffdfd; }
.badge { display: inline-block; padding: 4px 7px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.badge.approved { background: var(--success-bg); color: var(--success); }
.badge.review { background: var(--warning-bg); color: var(--warning); }
.badge.paid { background: #edf0f5; color: #566174; }
.source { display: inline-block; margin-left: 6px; color: #7b8494; font-size: 11px; }
.actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.invoice-table th.actions-col,
.invoice-table td.actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #fff;
    box-shadow: -10px 0 16px -16px rgba(36, 51, 79, .65);
}
.invoice-table th.actions-col { z-index: 3; background: linear-gradient(180deg, #f7faff, #f1f5fb); }
.invoice-table tr:hover td.actions { background: #f9fbfe; }
.invoice-table .credit-row td.actions { background: #fffdfd; }
.actions form { margin: 0; }
.link-button { background: transparent; border: 0; color: var(--primary); padding: 0; font: inherit; cursor: pointer; }
.empty { text-align: center; padding: 38px; color: var(--muted); }
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.form-card { padding: 24px; margin-bottom: 28px; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
label { display: grid; gap: 7px; font-weight: 700; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid #cfd6e1; border-radius: 8px; padding: 10px 11px; font: inherit; color: var(--text); background: #fff; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(102,162,214,.18); border-color: var(--accent); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.5; }
.checkbox-row { margin: 20px 0; display: flex; align-items: center; gap: 9px; font-weight: 600; }
.checkbox-row input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.flash { margin: 20px 0; border-radius: 9px; padding: 12px 14px; border: 1px solid transparent; }
.flash.success { background: var(--success-bg); color: var(--success); border-color: #c4ead2; }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: #f4c5c1; }
.hint { font-size: 13px; line-height: 1.5; }

/* Copy / supplier / sorting helpers */
.copy-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copy-field strong { overflow-wrap: anywhere; }
.amount-copy-line { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.copy-button {
    flex: 0 0 auto;
    min-width: 46px;
    border: 1px solid #cfd8e7;
    border-radius: 7px;
    background: #fff;
    color: #53617a;
    padding: 4px 7px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.2;
}
.copy-button:hover { border-color: var(--accent); color: var(--primary); background: var(--accent-soft); }
.copy-button.copied { border-color: #9fd4b6; color: var(--success); background: var(--success-bg); }
.copy-button.copy-error { border-color: #efb4ae; color: var(--danger); background: var(--danger-bg); }
.supplier-picker { display: grid; gap: 7px; }
.supplier-search { font-weight: 400; background: #f8fafc; }
.supplier-heading { gap: 22px; }
.compact-summary { min-width: 190px; }
.supplier-add-form { max-width: 760px; }
.inline-add { display: flex; gap: 10px; align-items: center; }
.inline-add input { flex: 1 1 auto; }
.inline-add .button { flex: 0 0 auto; }
.supplier-tools { margin: 18px 0 12px; display: flex; justify-content: flex-end; }
.supplier-filter-label { width: min(420px, 100%); }
.import-warning { margin-top: 8px; font-size: 13px; line-height: 1.45; }
tr[hidden] { display: none; }
.supplier-name-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--primary);
    padding: 0;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}
.supplier-name-button:hover { color: var(--primary-dark); }
.invoice-table .supplier-name-button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.supplier-inline-details {
    margin-top: 9px;
    padding: 10px 11px;
    min-width: 320px;
    max-width: 480px;
    border: 1px solid #d8e2ef;
    border-radius: 9px;
    background: #f6f9fd;
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 4px 12px rgba(51,75,145,.06);
}
.supplier-inline-details[hidden] { display: none; }
.supplier-iban-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.supplier-edit-link { display: inline-block; margin-top: 8px; font-weight: 700; }
.iban-warning-compact { display: block; margin-top: 4px; color: var(--danger); font-size: 11px; font-weight: 700; }
.iban-warning { margin-top: 9px; padding: 8px 9px; border: 1px solid #f0b7b1; border-radius: 7px; background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.iban-info { margin-top: 9px; padding: 8px 9px; border: 1px solid #cbdced; border-radius: 7px; background: var(--accent-soft); color: #405d82; }
.sort-link { display: inline-flex; align-items: center; gap: 5px; color: #53617a; font-weight: 700; white-space: nowrap; }
.sort-link:hover { color: var(--primary); text-decoration: none; }
.sort-link span { color: #94a1b6; font-size: 10px; }
.sort-link.active { color: var(--primary); }
.sort-link.active span { color: var(--accent); }
/* Footer follows the public JeCo site's restrained corporate footer structure. */
.site-footer {
    flex: 0 0 auto;
    margin-top: 48px;
    background: linear-gradient(135deg, #30488d 0%, #2c3f7b 52%, #243564 100%);
    color: rgba(255, 255, 255, .86);
    border-top: 4px solid var(--accent);
    box-shadow: 0 -12px 30px rgba(28, 42, 80, .08);
}
.footer-inner {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 34px;
    padding-top: 26px;
    padding-bottom: 24px;
    font-size: 13px;
}
.footer-slogan {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    color: rgba(255, 255, 255, .96);
    font-size: 13.5px;
    line-height: 1.7;
    font-style: italic;
    letter-spacing: .012em;
    text-align: center;
    text-wrap: balance;
}
.footer-meta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .16);
}
.footer-copyright {
    font-weight: 600;
    color: rgba(255, 255, 255, .92);
}
.footer-copyright a { color: #fff; font-weight: 700; margin-left: 8px; }
.footer-copyright a:hover { color: #fff; }
.footer-redi-badge {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 9px 14px 9px 10px;
    border: 1px solid rgba(243, 229, 184, .42);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .08) 100%);
    box-shadow: 0 10px 24px rgba(18, 29, 61, .22), inset 0 1px 0 rgba(255, 255, 255, .16);
    backdrop-filter: blur(4px);
}
.footer-redi-icon {
    display: inline-flex;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
}
.footer-redi-icon svg {
    width: 46px;
    height: 46px;
    display: block;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .22));
}
.footer-redi-copy {
    display: inline-flex;
    align-items: center;
    text-align: left;
    line-height: 1;
}
.footer-redi-copy strong {
    color: #fff;
    font-size: 17px;
    letter-spacing: .18em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}


@media (max-width: 1180px) {
    .discount-tools { margin-left: 0; }
}
@media (max-width: 980px) {
    .topbar-inner { align-items: flex-start; flex-direction: column; padding: 13px 0 14px; gap: 10px; }
    nav { justify-content: flex-start; }
}
@media (max-width: 760px) {
    .shell { width: min(100% - 20px, 1540px); }
    .hero, .page-heading { align-items: flex-start; flex-direction: column; }
    .grid.two { grid-template-columns: 1fr; }
    .summary-card { width: 100%; }
    .inline-add { align-items: stretch; flex-direction: column; }
    .supplier-tools { justify-content: stretch; }
    .supplier-filter-label { width: 100%; }
    .footer-inner { gap: 18px; }
    .footer-slogan { text-align: left; margin: 0; }
    .footer-meta { align-items: flex-start; flex-direction: column; gap: 10px; padding-top: 14px; }
    .footer-redi-badge { justify-content: flex-start; }
    .footer-redi-copy { text-align: left; }
    .brand-logo { width: 62px; height: 50px; }
    .brand-copy strong { font-size: 20px; }
}

/* Invoice search and archive pagination */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.list-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: -2px 0 14px;
    flex-wrap: wrap;
}
.discount-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.button.compact { padding: 8px 11px; font-size: 13px; }
.button.secondary.active-filter { background: var(--success-bg); border-color: #bfe5cd; color: var(--success); }
.button.secondary.active-filter:hover { background: #dcf2e6; color: var(--success); }
.invoice-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(720px, 100%);
}
.invoice-search input[type="search"] {
    flex: 1 1 360px;
    min-width: 220px;
    background: #fff;
}
.search-result-meta {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}
.search-safety-warning {
    margin: 0 0 14px;
    padding: 10px 13px;
    border: 1px solid #f0cf89;
    border-left: 4px solid #d99a22;
    border-radius: 8px;
    background: var(--warning-bg);
    color: #6d4c00;
    font-size: 13px;
    line-height: 1.45;
}
.search-safety-warning a { font-weight: 700; }
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 14px 0 6px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(51, 75, 145, .05);
}
.pagination-info {
    color: var(--muted);
    font-size: 13px;
}
.pagination-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pagination .button {
    padding: 8px 12px;
    font-size: 13px;
}
.pagination .button.disabled {
    opacity: .42;
    cursor: default;
    pointer-events: none;
}

@media (max-width: 760px) {
    .invoice-search { align-items: stretch; flex-direction: column; }
    .invoice-search input[type="search"] { flex-basis: auto; min-width: 0; }
    .search-result-meta { white-space: normal; }
    .pagination { align-items: stretch; flex-direction: column; }
    .pagination-actions { justify-content: space-between; }
}

/* Import options */
.import-stack { display: grid; gap: 22px; }
.import-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.import-card-heading h2 { margin: 0 0 5px; color: var(--primary); font-size: 21px; letter-spacing: -.02em; }
.import-card-heading p { margin: 0; }
.import-format-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 6px 9px;
    border: 1px solid #c9d9ea;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
}
.file-input-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f9fbfe;
}
.file-input-wrap input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.file-select-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.file-select-button:hover { background: var(--primary-dark); }
.file-selected-name {
    color: var(--muted);
    font-weight: 600;
}
input[type="date"] { font-variant-numeric: tabular-nums; }


/* Version 15: Schutz vor gleichzeitigem Bearbeiten */
.conflict-notice { border-left: 5px solid #b42318; }
.conflict-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.conflict-notice .button.secondary { background: #fff; border-color: #d7a7a2; color: #7a271a; }
.button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* Version 18: Benutzerkonten, Login und Rollen */
.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    min-width: 0;
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}
.user-chip {
    display: grid;
    gap: 1px;
    min-width: 90px;
    line-height: 1.2;
}
.user-chip strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-chip small {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .045em;
}
.logout-form { margin: 0; }
.nav-logout {
    border: 1px solid #d5ddea;
    border-radius: 8px;
    background: #fff;
    color: #58657c;
    padding: 7px 9px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.nav-logout:hover { color: var(--primary); border-color: var(--accent); background: var(--accent-soft); }

.auth-body { min-height: 100vh; }
.auth-shell {
    flex: 1 0 auto;
    width: min(100% - 28px, 520px);
    margin: 0 auto;
    display: grid;
    place-items: center;
    padding: 48px 0;
}
.auth-card {
    width: 100%;
    padding: 30px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(51, 75, 145, .12);
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.auth-brand img { width: 78px; height: 62px; object-fit: contain; }
.auth-brand div { display: grid; gap: 4px; }
.auth-brand strong { color: var(--primary); font-size: 24px; line-height: 1; }
.auth-brand small { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.auth-card h1 { margin: 6px 0 8px; color: var(--primary); font-size: 30px; letter-spacing: -.03em; }
.auth-form { display: grid; gap: 17px; margin-top: 24px; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-footer { margin-top: 0; }
.user-heading { align-items: center; }
.user-table-wrap table { min-width: 860px; }
.user-role-note { margin-top: 18px; }
.user-role-note p { margin-bottom: 0; }
.user-form { max-width: 900px; }
.user-active-field { align-content: start; }
.user-active-check { margin: 0; min-height: 43px; }

@media (max-width: 1180px) {
    .topbar-right { align-items: flex-end; flex-direction: column; gap: 7px; }
    .user-menu { border-left: 0; padding-left: 0; }
}
@media (max-width: 980px) {
    .topbar-right { width: 100%; align-items: stretch; }
    .user-menu { justify-content: space-between; padding-top: 6px; border-top: 1px solid var(--border); }
}
@media (max-width: 560px) {
    .auth-card { padding: 22px; }
    .auth-shell { padding: 24px 0; }
}

/* Version 19: Aktivitäten und Audit-Log */
.activity-heading { align-items: end; }
.activity-users-card { padding: 20px 22px; margin-bottom: 20px; }
.section-title-row { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.section-title-row h2 { margin: 0 0 4px; color: var(--primary); font-size: 20px; }
.section-title-row p { margin: 0; }
.active-user-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.active-user-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid #dce5f0;
    border-radius: 9px;
    background: #f9fbfe;
}
.active-user-item div { display: grid; gap: 2px; }
.active-user-item small, .activity-time { color: var(--muted); font-size: 11px; }
.activity-dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; vertical-align: middle; }
.activity-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(23, 107, 69, .12); }
.activity-dot.offline { background: #9aa5b6; }
.activity-definition { margin: 12px 2px 22px; }
.activity-empty { margin: 16px 0 0; }
.audit-tools { margin-top: 22px; }
.audit-table-wrap table { min-width: 1180px; }
.audit-table th:nth-child(1), .audit-table td:nth-child(1) { width: 145px; white-space: nowrap; }
.audit-table th:nth-child(2), .audit-table td:nth-child(2) { width: 175px; }
.audit-table th:nth-child(3), .audit-table td:nth-child(3) { width: 155px; }
.audit-table th:nth-child(4), .audit-table td:nth-child(4) { width: 180px; }
.audit-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.audit-username { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.audit-detail-cell { min-width: 380px; }
.audit-changes { margin-top: 6px; }
.audit-changes summary { color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; }
.audit-change-grid { display: grid; gap: 5px; margin-top: 8px; padding: 9px 10px; background: #f7f9fc; border: 1px solid #e3e9f1; border-radius: 8px; }
.audit-change-row { display: grid; grid-template-columns: minmax(110px, .8fr) minmax(90px, 1fr) auto minmax(90px, 1fr); gap: 8px; align-items: start; font-size: 12px; }
.audit-old { color: #7a5b5b; text-decoration: line-through; text-decoration-thickness: 1px; }
.audit-new { color: var(--success); font-weight: 700; }

@media (max-width: 760px) {
    .audit-change-row { grid-template-columns: 1fr; gap: 3px; }
    .audit-change-row > span[aria-hidden="true"] { display: none; }
}


/* Floating shortcut to return to the top of long lists. */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 24px rgba(30, 50, 100, .22);
    font: inherit;
    font-size: 25px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease, background .18s ease;
}
.back-to-top:hover { background: var(--primary-dark); }
.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:focus-visible {
    outline: 3px solid rgba(102, 162, 214, .45);
    outline-offset: 3px;
}
@media (max-width: 760px) {
    .back-to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; }
}

.actions .danger-link { color: #9b2f2f; }
.actions .danger-link:hover { color: #761f1f; }


/* REDI version badge and changelog */
.footer-version {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 30px;
    padding: 5px 9px;
    border-left: 1px solid rgba(255, 255, 255, .18);
    color: #f3e5b8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-decoration: none;
}
.footer-version:hover { color: #fff; text-decoration: none; }
.footer-version-static { cursor: default; }
.release-head { margin-bottom: 18px; }
.release-list { display: grid; gap: 12px; margin-bottom: 26px; }
.release-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    box-shadow: 0 8px 24px rgba(51, 75, 145, .05);
}
.release-card.current { border-color: rgba(102, 162, 214, .65); box-shadow: 0 12px 30px rgba(51, 75, 145, .09); }
.release-card summary {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 66px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.release-card summary::-webkit-details-marker { display: none; }
.release-card summary::after {
    content: '+';
    grid-column: 3;
    grid-row: 1;
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
}
.release-card[open] summary::after { content: '−'; }
.release-card summary .release-current { grid-column: 3; grid-row: 1; margin-right: 30px; }
.release-version {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.release-card.current .release-version { background: var(--primary); color: #fff; }
.release-summary-copy { display: grid; gap: 2px; min-width: 0; }
.release-summary-copy strong { color: var(--text); font-size: 15px; }
.release-summary-copy small { color: var(--muted); font-size: 12px; }
.release-current {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 11px;
    font-weight: 800;
}
.release-body { padding: 0 20px 17px 102px; border-top: 1px solid var(--border); }
.release-body ul { margin: 14px 0 0; padding-left: 18px; }
.release-body li { margin: 7px 0; line-height: 1.55; }
.version-maintenance { margin-top: 12px; }
.version-maintenance code { font-weight: 700; }
@media (max-width: 680px) {
    .release-card summary { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; padding: 11px 12px; }
    .release-body { padding: 0 14px 14px; }
    .release-card summary .release-current { display: none; }
}
